Bug#462529: linux-2.6: Add config file support for efika and PS3 (preliminary)
Geoff Levand wrote:
> Bastian Blank wrote:
>>> >> -# CONFIG_GEN_RTC is not set
>>> >> +CONFIG_GEN_RTC=y
>>> > Why?
>>> I am not so familiar with this option. I saw
>>> an RTC error message when this was not enabled.
>>
>> Please show the error.
>
> This is the error:
>
> Setting the system clock.
> Cannot access the Hardware Clock via any known method.
> Use the --debug option to see the details of our search for an access method.
> * Unable to set System Clock to: Fri May 30 20:33:06 UTC 2008
>
> ice:~# hwclock --debug
> hwclock from util-linux-ng 2.13.1.1
> hwclock: Open of /dev/rtc failed, errno=2: No such file or directory.
> No usable clock interface found.
> Cannot access the Hardware Clock via any known method.
> ice:~# ls -l /dev/rtc*
> ls: cannot access /dev/rtc*: No such file or directory
>
> The PS3 does not have an RTC driver. The PS3 platform code just hooks into
> the standard powerpc ppc_md.set_rtc_time and ppc_md.get_rtc_time pointers
> (arch/powerpc/platforms/ps3/time.c).
>
>>From what I understand the work to hookup the powerpc ppc_md. rtc routines
> to the RTC_INTF_DEV routines has not been done. See here:
>
> http://marc.info/?t=120352654700002&r=1&w=2
>
> I'll look into this. I either need to make a gen_rtc driver for the
> new rtc subsytem, or make a ps3 specific rtc driver.
A patch to fix this problem is attached. It has been submitted
for 2.6.27:
http://patchwork.ozlabs.org/linuxppc/patch?id=18139
With it there is a new driver rtc-ppc, enabled with CONFIG_RTC_DRV_PPC.
Should I submit another bug report for this?
-Geoff
>From dwmw2@infradead.org Fri Apr 25 19:29:12 2008
From: David Woodhouse <dwmw2@infradead.org>
Subject: [PATCH, RESEND] RTC class driver for ppc_md RTC functions
Date: Fri, 25 Apr 2008 19:29:12 +1000
X-Patchwork-ID: 18139
This hooks up the platform-specific [gs]et_rtc_time functions so that
kernels using CONFIG_RTC_CLASS have RTC support on most PowerPC
platforms.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
---
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 1e6715e..3e788b7 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -461,4 +461,12 @@ config RTC_DRV_RS5C313
help
If you say yes here you get support for the Ricoh RS5C313 RTC chips.
+config RTC_DRV_PPC
+ tristate "PowerPC machine dependent RTC support"
+ depends on PPC_MERGE
+ help
+ The PowerPC kernel has machine-specific functions for accessing
+ the RTC. This exposes that functionality through the generic RTC
+ class.
+
endif # RTC_CLASS
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 465db4d..e822e56 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -49,3 +49,4 @@ obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o
obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o
obj-$(CONFIG_RTC_DRV_VR41XX) += rtc-vr41xx.o
obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o
+obj-$(CONFIG_RTC_DRV_PPC) += rtc-ppc.o
--- /dev/null 2007-12-03 03:08:41.854157978 +0000
+++ b/drivers/rtc/rtc-ppc.c 2007-12-03 16:56:15.000000000 +0000
@@ -0,0 +1,69 @@
+/*
+ * RTC driver for ppc_md RTC functions
+ *
+ * © 2007 Red Hat, Inc.
+ *
+ * Author: David Woodhouse <dwmw2@infradead.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/rtc.h>
+#include <linux/platform_device.h>
+#include <asm/machdep.h>
+
+static int ppc_rtc_read_time(struct device *dev, struct rtc_time *tm)
+{
+ ppc_md.get_rtc_time(tm);
+ return 0;
+}
+
+static int ppc_rtc_set_time(struct device *dev, struct rtc_time *tm)
+{
+ return ppc_md.set_rtc_time(tm);
+}
+
+static const struct rtc_class_ops ppc_rtc_ops = {
+ .set_time = ppc_rtc_set_time,
+ .read_time = ppc_rtc_read_time,
+};
+
+static struct rtc_device *rtc;
+static struct platform_device *ppc_rtc_pdev;
+
+static int __init ppc_rtc_init(void)
+{
+ if (!ppc_md.get_rtc_time || !ppc_md.set_rtc_time)
+ return -ENODEV;
+
+ ppc_rtc_pdev = platform_device_register_simple("ppc-rtc", 0, NULL, 0);
+ if (IS_ERR(ppc_rtc_pdev))
+ return PTR_ERR(ppc_rtc_pdev);
+
+ rtc = rtc_device_register("ppc_md", &ppc_rtc_pdev->dev,
+ &ppc_rtc_ops, THIS_MODULE);
+ if (IS_ERR(rtc)) {
+ platform_device_unregister(ppc_rtc_pdev);
+ return PTR_ERR(rtc);
+ }
+
+ return 0;
+}
+
+static void __exit ppc_rtc_exit(void)
+{
+ rtc_device_unregister(rtc);
+ platform_device_unregister(ppc_rtc_pdev);
+}
+
+module_init(ppc_rtc_init);
+module_exit(ppc_rtc_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
+MODULE_DESCRIPTION("Generic RTC class driver for PowerPC");
--- a/debian/config/powerpc/config.powerpc64
+++ b/debian/config/powerpc/config.powerpc64
@@ -155,6 +155,11 @@ CONFIG_IBM_NEW_EMAC_RX_SKB_HEADROOM=0
##
# CONFIG_HOTPLUG_PCI is not set
+###
+### file: drivers/rtc/Kconfig
+###
+CONFIG_RTC_DRV_PPC=m
+
##
## file: drivers/scsi/Kconfig
##
Reply to: