2009-03-09 13:26:49

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 0/7] Generic RTC class driver


Hi Alessandro et al,

This patch series:
1. Adds the missing module alias to rtc-parisc (which is a bugfix), and
performs a few cleanups,
2. Moves the platform device creation out of rtc-ppc and into arch-specific
code (which is also a bugfix),
3. Consolidates rtc-parisc and rtc-ppc into rtc-generic (which is a cleanup),
4. Hooks up rtc-generic on m68k (it's been using [sg]et_rtc_time() since
ages),
5. Makes rtc-generic dependent on PARISC, PPC, and M68K (the existing
[sg]et_rtc_time() users):
a. without introducing ARCH_HAS_GENERIC_RTC,
b. with a big fat warning in the Kconfig comment discouraging people
from relaxing the dependencies.
6. Converts the PS3 RTC support into a separate driver, called rtc-ps3
(as a bonus ;-)

To reduce code churn, the order and number of the actual patches slightly
differs:
[1] parisc: rtc: get_rtc_time() returns unsigned int
[2] parisc: rtc: platform_driver_probe() fixups
[3] parisc: rtc: Add missing module alias
[4] parisc: rtc: Rename rtc-parisc to rtc-generic
[5] m68k: Hook up rtc-generic
[6] powerpc: Hook up rtc-generic, and kill rtc-ppc
[7] powerpc/ps3: Add rtc-ps3

a/drivers/rtc/rtc-parisc.c | 85 -------------------------
b/arch/m68k/include/asm/rtc.h | 7 +-
b/arch/m68k/kernel/time.c | 18 +++++
b/arch/parisc/Kconfig | 2
b/arch/parisc/kernel/time.c | 6 -
b/arch/powerpc/include/asm/ps3.h | 3
b/arch/powerpc/kernel/time.c | 16 ++++
b/arch/powerpc/platforms/ps3/os-area.c | 2
b/arch/powerpc/platforms/ps3/platform.h | 2
b/arch/powerpc/platforms/ps3/setup.c | 2
b/arch/powerpc/platforms/ps3/time.c | 26 +++----
b/drivers/rtc/Kconfig | 10 +--
b/drivers/rtc/Makefile | 2
b/drivers/rtc/rtc-generic.c | 84 +++++++++++++++++++++++++
b/drivers/rtc/rtc-parisc.c | 5 -
b/drivers/rtc/rtc-ps3.c | 106 +++++++++++++++++++++++++++++++-
drivers/rtc/Kconfig | 22 +++---
drivers/rtc/Makefile | 2
drivers/rtc/rtc-parisc.c | 6 -
drivers/rtc/rtc-ppc.c | 70 ---------------------
20 files changed, 271 insertions(+), 205 deletions(-)

These patches are relative to the "rtc-parisc" branch of Kyle's PA-RISC git
repository, which already contains some cleanups for the rtc-parisc driver by
Dann, which already have been ack'ed by Alessandro:

http://git.kernel.org/?p=linux/kernel/git/kyle/parisc-2.6.git;a=shortlog;h=rtc-parisc

Paul: Feel free to add your SuperH support.

I suppose the easiest way for this to go in is through Kyle's PA-RISC tree, as
he already has the preceding patches? Can I have your acks, please?

Thanks!

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: [email protected]
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 · RPR Brussels
Fortis · BIC GEBABEBB · IBAN BE41293037680010


2009-03-09 13:27:06

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 1/7] parisc: rtc: get_rtc_time() returns unsigned int

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
drivers/rtc/rtc-parisc.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/rtc/rtc-parisc.c b/drivers/rtc/rtc-parisc.c
index b966f56..620b949 100644
--- a/drivers/rtc/rtc-parisc.c
+++ b/drivers/rtc/rtc-parisc.c
@@ -13,9 +13,7 @@

static int parisc_get_time(struct device *dev, struct rtc_time *tm)
{
- unsigned long ret;
-
- ret = get_rtc_time(tm);
+ unsigned int ret = get_rtc_time(tm);

if (ret & RTC_BATT_BAD)
return -EOPNOTSUPP;
--
1.6.0.4

2009-03-09 13:27:25

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 2/7] parisc: rtc: platform_driver_probe() fixups

When using platform_driver_probe(), it's not needed to setup a .probe
function, and .remove should be marked __exit_p(), not __devexit_p().

Signed-off-by: Geert Uytterhoeven <[email protected]>
Cc: dann frazier <[email protected]>
---
drivers/rtc/rtc-parisc.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-parisc.c b/drivers/rtc/rtc-parisc.c
index 620b949..f4e871c 100644
--- a/drivers/rtc/rtc-parisc.c
+++ b/drivers/rtc/rtc-parisc.c
@@ -62,8 +62,7 @@ static struct platform_driver parisc_rtc_driver = {
.name = "rtc-parisc",
.owner = THIS_MODULE,
},
- .probe = parisc_rtc_probe,
- .remove = __devexit_p(parisc_rtc_remove),
+ .remove = __exit_p(parisc_rtc_remove),
};

static int __init parisc_rtc_init(void)
--
1.6.0.4

2009-03-09 13:27:43

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 3/7] parisc: rtc: Add missing module alias

Make udev autoload the driver

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
drivers/rtc/rtc-parisc.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/rtc/rtc-parisc.c b/drivers/rtc/rtc-parisc.c
index f4e871c..48ef5b4 100644
--- a/drivers/rtc/rtc-parisc.c
+++ b/drivers/rtc/rtc-parisc.c
@@ -81,3 +81,4 @@ module_exit(parisc_rtc_fini);
MODULE_AUTHOR("Kyle McMartin <[email protected]>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("HP PA-RISC RTC driver");
+MODULE_ALIAS("platform:rtc-parisc");
--
1.6.0.4

2009-03-09 13:28:25

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 7/7] powerpc/ps3: Add rtc-ps3

Create a real RTC driver for PS3, and unhook the deprecated
ppc_md.[gs]et_rtc_time.

Signed-off-by: Geert Uytterhoeven <[email protected]>
Cc: Geoff Levand <[email protected]>
---
arch/powerpc/include/asm/ps3.h | 3 +
arch/powerpc/platforms/ps3/os-area.c | 2 +
arch/powerpc/platforms/ps3/platform.h | 2 -
arch/powerpc/platforms/ps3/setup.c | 2 -
arch/powerpc/platforms/ps3/time.c | 26 ++++-----
drivers/rtc/Kconfig | 9 +++
drivers/rtc/Makefile | 1 +
drivers/rtc/rtc-ps3.c | 105 +++++++++++++++++++++++++++++++++
8 files changed, 132 insertions(+), 18 deletions(-)
create mode 100644 drivers/rtc/rtc-ps3.c

diff --git a/arch/powerpc/include/asm/ps3.h b/arch/powerpc/include/asm/ps3.h
index 67f1812..cdb6fd8 100644
--- a/arch/powerpc/include/asm/ps3.h
+++ b/arch/powerpc/include/asm/ps3.h
@@ -50,6 +50,9 @@ enum ps3_param_av_multi_out {

enum ps3_param_av_multi_out ps3_os_area_get_av_multi_out(void);

+extern u64 ps3_os_area_get_rtc_diff(void);
+extern void ps3_os_area_set_rtc_diff(u64 rtc_diff);
+
/* dma routines */

enum ps3_dma_page_size {
diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c
index e1c83c2..86e392b 100644
--- a/arch/powerpc/platforms/ps3/os-area.c
+++ b/arch/powerpc/platforms/ps3/os-area.c
@@ -808,6 +808,7 @@ u64 ps3_os_area_get_rtc_diff(void)
{
return saved_params.rtc_diff;
}
+EXPORT_SYMBOL(ps3_os_area_get_rtc_diff);

/**
* ps3_os_area_set_rtc_diff - Set the rtc diff value.
@@ -823,6 +824,7 @@ void ps3_os_area_set_rtc_diff(u64 rtc_diff)
os_area_queue_work();
}
}
+EXPORT_SYMBOL(ps3_os_area_set_rtc_diff);

/**
* ps3_os_area_get_av_multi_out - Returns the default video mode.
diff --git a/arch/powerpc/platforms/ps3/platform.h b/arch/powerpc/platforms/ps3/platform.h
index 235c13e..136aa06 100644
--- a/arch/powerpc/platforms/ps3/platform.h
+++ b/arch/powerpc/platforms/ps3/platform.h
@@ -64,8 +64,6 @@ int ps3_set_rtc_time(struct rtc_time *time);

void __init ps3_os_area_save_params(void);
void __init ps3_os_area_init(void);
-u64 ps3_os_area_get_rtc_diff(void);
-void ps3_os_area_set_rtc_diff(u64 rtc_diff);

/* spu */

diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index 3331ccb..6618182 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -270,8 +270,6 @@ define_machine(ps3) {
.init_IRQ = ps3_init_IRQ,
.panic = ps3_panic,
.get_boot_time = ps3_get_boot_time,
- .set_rtc_time = ps3_set_rtc_time,
- .get_rtc_time = ps3_get_rtc_time,
.set_dabr = ps3_set_dabr,
.calibrate_decr = ps3_calibrate_decr,
.progress = ps3_progress,
diff --git a/arch/powerpc/platforms/ps3/time.c b/arch/powerpc/platforms/ps3/time.c
index d0daf7d..b178a1e 100644
--- a/arch/powerpc/platforms/ps3/time.c
+++ b/arch/powerpc/platforms/ps3/time.c
@@ -19,6 +19,7 @@
*/

#include <linux/kernel.h>
+#include <linux/platform_device.h>

#include <asm/rtc.h>
#include <asm/lv1call.h>
@@ -74,23 +75,20 @@ static u64 read_rtc(void)
return rtc_val;
}

-int ps3_set_rtc_time(struct rtc_time *tm)
+unsigned long __init ps3_get_boot_time(void)
{
- u64 now = mktime(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
- tm->tm_hour, tm->tm_min, tm->tm_sec);
-
- ps3_os_area_set_rtc_diff(now - read_rtc());
- return 0;
+ return read_rtc() + ps3_os_area_get_rtc_diff();
}

-void ps3_get_rtc_time(struct rtc_time *tm)
+static int __init ps3_rtc_init(void)
{
- to_tm(read_rtc() + ps3_os_area_get_rtc_diff(), tm);
- tm->tm_year -= 1900;
- tm->tm_mon -= 1;
-}
+ struct platform_device *pdev;

-unsigned long __init ps3_get_boot_time(void)
-{
- return read_rtc() + ps3_os_area_get_rtc_diff();
+ pdev = platform_device_register_simple("rtc-ps3", -1, NULL, 0);
+ if (IS_ERR(pdev))
+ return PTR_ERR(pdev);
+
+ return 0;
}
+
+module_init(ps3_rtc_init);
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 6488c50..7b6b63a 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -730,4 +730,13 @@ config RTC_DRV_MV
This driver can also be built as a module. If so, the module
will be called rtc-mv.

+config RTC_DRV_PS3
+ tristate "PS3 RTC"
+ depends on PPC_PS3
+ help
+ If you say yes here you will get support for the RTC on PS3.
+
+ This driver can also be built as a module. If so, the module
+ will be called rtc-ps3.
+
endif # RTC_CLASS
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index bd209a5..d161d1d 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -75,3 +75,4 @@ obj-$(CONFIG_RTC_DRV_VR41XX) += rtc-vr41xx.o
obj-$(CONFIG_RTC_DRV_WM8350) += rtc-wm8350.o
obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o
obj-$(CONFIG_RTC_DRV_PCF50633) += rtc-pcf50633.o
+obj-$(CONFIG_RTC_DRV_PS3) += rtc-ps3.o
diff --git a/drivers/rtc/rtc-ps3.c b/drivers/rtc/rtc-ps3.c
new file mode 100644
index 0000000..bacf37f
--- /dev/null
+++ b/drivers/rtc/rtc-ps3.c
@@ -0,0 +1,105 @@
+/*
+ * PS3 RTC Driver
+ *
+ * Copyright 2009 Sony Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/rtc.h>
+
+#include <asm/lv1call.h>
+#include <asm/ps3.h>
+
+
+static u64 read_rtc(void)
+{
+ int result;
+ u64 rtc_val;
+ u64 tb_val;
+
+ result = lv1_get_rtc(&rtc_val, &tb_val);
+ BUG_ON(result);
+
+ return rtc_val;
+}
+
+static int ps3_get_time(struct device *dev, struct rtc_time *tm)
+{
+ to_tm(read_rtc() + ps3_os_area_get_rtc_diff(), tm);
+ tm->tm_year -= 1900;
+ tm->tm_mon -= 1;
+ return 0;
+}
+
+static int ps3_set_time(struct device *dev, struct rtc_time *tm)
+{
+ u64 now = mktime(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
+ tm->tm_hour, tm->tm_min, tm->tm_sec);
+ ps3_os_area_set_rtc_diff(now - read_rtc());
+ return 0;
+}
+
+static const struct rtc_class_ops ps3_rtc_ops = {
+ .read_time = ps3_get_time,
+ .set_time = ps3_set_time,
+};
+
+static int __init ps3_rtc_probe(struct platform_device *dev)
+{
+ struct rtc_device *rtc;
+
+ rtc = rtc_device_register("rtc-ps3", &dev->dev, &ps3_rtc_ops,
+ THIS_MODULE);
+ if (IS_ERR(rtc))
+ return PTR_ERR(rtc);
+
+ platform_set_drvdata(dev, rtc);
+ return 0;
+}
+
+static int __exit ps3_rtc_remove(struct platform_device *dev)
+{
+ rtc_device_unregister(platform_get_drvdata(dev));
+ return 0;
+}
+
+static struct platform_driver ps3_rtc_driver = {
+ .driver = {
+ .name = "rtc-ps3",
+ .owner = THIS_MODULE,
+ },
+ .remove = __exit_p(ps3_rtc_remove),
+};
+
+static int __init ps3_rtc_init(void)
+{
+ return platform_driver_probe(&ps3_rtc_driver, ps3_rtc_probe);
+}
+
+static void __exit ps3_rtc_fini(void)
+{
+ platform_driver_unregister(&ps3_rtc_driver);
+}
+
+module_init(ps3_rtc_init);
+module_exit(ps3_rtc_fini);
+
+MODULE_AUTHOR("Sony Corporation");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("ps3 RTC driver");
+MODULE_ALIAS("platform:rtc-ps3");
--
1.6.0.4

2009-03-09 13:27:58

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 5/7] m68k: Hook up rtc-generic

m68k has been a long time user of the generic RTC abstraction, so hook up
rtc-generic:
- Create the "rtc-generic" platform device if mach_hwclk is set,
- Add checks for mach_hwclk, in anticipation of RTC chip drivers being moved
to drivers/rtc/.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/m68k/include/asm/rtc.h | 7 +++++--
arch/m68k/kernel/time.c | 18 ++++++++++++++++++
drivers/rtc/Kconfig | 2 +-
3 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/arch/m68k/include/asm/rtc.h b/arch/m68k/include/asm/rtc.h
index 5d3e038..a4d08ea 100644
--- a/arch/m68k/include/asm/rtc.h
+++ b/arch/m68k/include/asm/rtc.h
@@ -36,13 +36,16 @@ static inline unsigned int get_rtc_time(struct rtc_time *time)
* RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated
* by the RTC when initially set to a non-zero value.
*/
- mach_hwclk(0, time);
+ if (mach_hwclk)
+ mach_hwclk(0, time);
return RTC_24H;
}

static inline int set_rtc_time(struct rtc_time *time)
{
- return mach_hwclk(1, time);
+ if (mach_hwclk)
+ return mach_hwclk(1, time);
+ return -EINVAL;
}

static inline unsigned int get_rtc_ss(void)
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index 7db4159..54d9807 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -18,6 +18,7 @@
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/rtc.h>
+#include <linux/platform_device.h>

#include <asm/machdep.h>
#include <asm/io.h>
@@ -159,3 +160,20 @@ int do_settimeofday(struct timespec *tv)
}

EXPORT_SYMBOL(do_settimeofday);
+
+
+static int __init rtc_init(void)
+{
+ struct platform_device *pdev;
+
+ if (!mach_hwclk)
+ return -ENODEV;
+
+ pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0);
+ if (IS_ERR(pdev))
+ return PTR_ERR(pdev);
+
+ return 0;
+}
+
+module_init(rtc_init);
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index d0aeff2..c8ead87 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -681,7 +681,7 @@ config RTC_DRV_GENERIC
tristate "Generic RTC support"
# Please consider writing a new RTC driver instead of using the generic
# RTC abstraction
- depends on PARISC
+ depends on PARISC || M68K
help
Say Y or M here to enable RTC support on systems using the generic
RTC abstraction. If you do not know what you are doing, you should
--
1.6.0.4

2009-03-09 13:28:41

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 6/7] powerpc: Hook up rtc-generic, and kill rtc-ppc

PowerPC has been a long time user of the generic RTC abstraction, so hook up
rtc-generic:
- Create the "rtc-generic" platform device if ppc_md.get_rtc_time is set,
- Kill rtc-ppc, as rtc-generic offers the same functionality in a more
generic way, and supports autoloading through udev.

Signed-off-by: Geert Uytterhoeven <[email protected]>
Cc: David Woodhouse <[email protected]>
---
arch/powerpc/kernel/time.c | 16 ++++++++++
drivers/rtc/Kconfig | 10 +------
drivers/rtc/Makefile | 1 -
drivers/rtc/rtc-ppc.c | 69 --------------------------------------------
4 files changed, 17 insertions(+), 79 deletions(-)
delete mode 100644 drivers/rtc/rtc-ppc.c

diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index c956403..926ea86 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -1127,3 +1127,19 @@ void div128_by_32(u64 dividend_high, u64 dividend_low,
dr->result_low = ((u64)y << 32) + z;

}
+
+static int __init rtc_init(void)
+{
+ struct platform_device *pdev;
+
+ if (!ppc_md.get_rtc_time)
+ return -ENODEV;
+
+ pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0);
+ if (IS_ERR(pdev))
+ return PTR_ERR(pdev);
+
+ return 0;
+}
+
+module_init(rtc_init);
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index c8ead87..6488c50 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -681,20 +681,12 @@ config RTC_DRV_GENERIC
tristate "Generic RTC support"
# Please consider writing a new RTC driver instead of using the generic
# RTC abstraction
- depends on PARISC || M68K
+ depends on PARISC || M68K || PPC
help
Say Y or M here to enable RTC support on systems using the generic
RTC abstraction. If you do not know what you are doing, you should
just say Y.

-config RTC_DRV_PPC
- tristate "PowerPC machine dependent RTC support"
- depends on PPC
- help
- The PowerPC kernel has machine-specific functions for accessing
- the RTC. This exposes that functionality through the generic RTC
- class.
-
config RTC_DRV_PXA
tristate "PXA27x/PXA3xx"
depends on ARCH_PXA
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 9c18a01..bd209a5 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -56,7 +56,6 @@ obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o
obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030.o
obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o
obj-$(CONFIG_RTC_DRV_GENERIC) += rtc-generic.o
-obj-$(CONFIG_RTC_DRV_PPC) += rtc-ppc.o
obj-$(CONFIG_RTC_DRV_PXA) += rtc-pxa.o
obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o
obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o
diff --git a/drivers/rtc/rtc-ppc.c b/drivers/rtc/rtc-ppc.c
deleted file mode 100644
index c8e97e2..0000000
--- a/drivers/rtc/rtc-ppc.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * RTC driver for ppc_md RTC functions
- *
- * © 2007 Red Hat, Inc.
- *
- * Author: David Woodhouse <[email protected]>
- *
- * 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 <[email protected]>");
-MODULE_DESCRIPTION("Generic RTC class driver for PowerPC");
--
1.6.0.4

2009-03-09 13:28:58

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 4/7] parisc: rtc: Rename rtc-parisc to rtc-generic

The rtc-parisc driver is not PA-RISC specific at all, as it uses the existing
(but deprecated) generic RTC infrastructure ([gs]et_rtc_time()).
Rename the driver from rtc-parisc to rtc-generic.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/parisc/Kconfig | 2 +-
arch/parisc/kernel/time.c | 6 ++--
drivers/rtc/Kconfig | 10 +++--
drivers/rtc/Makefile | 2 +-
drivers/rtc/rtc-generic.c | 84 +++++++++++++++++++++++++++++++++++++++++++++
drivers/rtc/rtc-parisc.c | 84 ---------------------------------------------
6 files changed, 95 insertions(+), 93 deletions(-)
create mode 100644 drivers/rtc/rtc-generic.c
delete mode 100644 drivers/rtc/rtc-parisc.c

diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index aacf11d..378b649 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -10,7 +10,7 @@ config PARISC
select HAVE_IDE
select HAVE_OPROFILE
select RTC_CLASS
- select RTC_DRV_PARISC
+ select RTC_DRV_GENERIC
select INIT_ALL_POSSIBLE
help
The PA-RISC microprocessor is designed by Hewlett-Packard and used
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index e75cae6..86a99d0 100644
--- a/arch/parisc/kernel/time.c
+++ b/arch/parisc/kernel/time.c
@@ -216,14 +216,14 @@ void __init start_cpu_itimer(void)
per_cpu(cpu_data, cpu).it_value = next_tick;
}

-static struct platform_device rtc_parisc_dev = {
- .name = "rtc-parisc",
+static struct platform_device rtc_generic_dev = {
+ .name = "rtc-generic",
.id = -1,
};

static int __init rtc_init(void)
{
- if (platform_device_register(&rtc_parisc_dev) < 0)
+ if (platform_device_register(&rtc_generic_dev) < 0)
printk(KERN_ERR "unable to register rtc device...\n");

/* not necessarily an error */
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 81450fb..d0aeff2 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -677,12 +677,14 @@ config RTC_DRV_RS5C313
help
If you say yes here you get support for the Ricoh RS5C313 RTC chips.

-config RTC_DRV_PARISC
- tristate "PA-RISC firmware RTC support"
+config RTC_DRV_GENERIC
+ tristate "Generic RTC support"
+ # Please consider writing a new RTC driver instead of using the generic
+ # RTC abstraction
depends on PARISC
help
- Say Y or M here to enable RTC support on PA-RISC systems using
- firmware calls. If you do not know what you are doing, you should
+ Say Y or M here to enable RTC support on systems using the generic
+ RTC abstraction. If you do not know what you are doing, you should
just say Y.

config RTC_DRV_PPC
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 0e697aa..9c18a01 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -55,7 +55,7 @@ obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o
obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o
obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030.o
obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o
-obj-$(CONFIG_RTC_DRV_PARISC) += rtc-parisc.o
+obj-$(CONFIG_RTC_DRV_GENERIC) += rtc-generic.o
obj-$(CONFIG_RTC_DRV_PPC) += rtc-ppc.o
obj-$(CONFIG_RTC_DRV_PXA) += rtc-pxa.o
obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o
diff --git a/drivers/rtc/rtc-generic.c b/drivers/rtc/rtc-generic.c
new file mode 100644
index 0000000..9832200
--- /dev/null
+++ b/drivers/rtc/rtc-generic.c
@@ -0,0 +1,84 @@
+/* rtc-generic: RTC driver using the generic RTC abstraction
+ *
+ * Copyright (C) 2008 Kyle McMartin <[email protected]>
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/time.h>
+#include <linux/platform_device.h>
+#include <linux/rtc.h>
+
+#include <asm/rtc.h>
+
+static int generic_get_time(struct device *dev, struct rtc_time *tm)
+{
+ unsigned int ret = get_rtc_time(tm);
+
+ if (ret & RTC_BATT_BAD)
+ return -EOPNOTSUPP;
+
+ return rtc_valid_tm(tm);
+}
+
+static int generic_set_time(struct device *dev, struct rtc_time *tm)
+{
+ if (set_rtc_time(tm) < 0)
+ return -EOPNOTSUPP;
+
+ return 0;
+}
+
+static const struct rtc_class_ops generic_rtc_ops = {
+ .read_time = generic_get_time,
+ .set_time = generic_set_time,
+};
+
+static int __init generic_rtc_probe(struct platform_device *dev)
+{
+ struct rtc_device *rtc;
+
+ rtc = rtc_device_register("rtc-generic", &dev->dev, &generic_rtc_ops,
+ THIS_MODULE);
+ if (IS_ERR(rtc))
+ return PTR_ERR(rtc);
+
+ platform_set_drvdata(dev, rtc);
+
+ return 0;
+}
+
+static int __exit generic_rtc_remove(struct platform_device *dev)
+{
+ struct rtc_device *rtc = platform_get_drvdata(dev);
+
+ rtc_device_unregister(rtc);
+
+ return 0;
+}
+
+static struct platform_driver generic_rtc_driver = {
+ .driver = {
+ .name = "rtc-generic",
+ .owner = THIS_MODULE,
+ },
+ .remove = __exit_p(generic_rtc_remove),
+};
+
+static int __init generic_rtc_init(void)
+{
+ return platform_driver_probe(&generic_rtc_driver, generic_rtc_probe);
+}
+
+static void __exit generic_rtc_fini(void)
+{
+ platform_driver_unregister(&generic_rtc_driver);
+}
+
+module_init(generic_rtc_init);
+module_exit(generic_rtc_fini);
+
+MODULE_AUTHOR("Kyle McMartin <[email protected]>");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Generic RTC driver");
+MODULE_ALIAS("platform:rtc-generic");
diff --git a/drivers/rtc/rtc-parisc.c b/drivers/rtc/rtc-parisc.c
deleted file mode 100644
index 48ef5b4..0000000
--- a/drivers/rtc/rtc-parisc.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* rtc-parisc: RTC for HP PA-RISC firmware
- *
- * Copyright (C) 2008 Kyle McMartin <[email protected]>
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/time.h>
-#include <linux/platform_device.h>
-#include <linux/rtc.h>
-
-#include <asm/rtc.h>
-
-static int parisc_get_time(struct device *dev, struct rtc_time *tm)
-{
- unsigned int ret = get_rtc_time(tm);
-
- if (ret & RTC_BATT_BAD)
- return -EOPNOTSUPP;
-
- return rtc_valid_tm(tm);
-}
-
-static int parisc_set_time(struct device *dev, struct rtc_time *tm)
-{
- if (set_rtc_time(tm) < 0)
- return -EOPNOTSUPP;
-
- return 0;
-}
-
-static const struct rtc_class_ops parisc_rtc_ops = {
- .read_time = parisc_get_time,
- .set_time = parisc_set_time,
-};
-
-static int __init parisc_rtc_probe(struct platform_device *dev)
-{
- struct rtc_device *rtc;
-
- rtc = rtc_device_register("rtc-parisc", &dev->dev, &parisc_rtc_ops,
- THIS_MODULE);
- if (IS_ERR(rtc))
- return PTR_ERR(rtc);
-
- platform_set_drvdata(dev, rtc);
-
- return 0;
-}
-
-static int __exit parisc_rtc_remove(struct platform_device *dev)
-{
- struct rtc_device *rtc = platform_get_drvdata(dev);
-
- rtc_device_unregister(rtc);
-
- return 0;
-}
-
-static struct platform_driver parisc_rtc_driver = {
- .driver = {
- .name = "rtc-parisc",
- .owner = THIS_MODULE,
- },
- .remove = __exit_p(parisc_rtc_remove),
-};
-
-static int __init parisc_rtc_init(void)
-{
- return platform_driver_probe(&parisc_rtc_driver, parisc_rtc_probe);
-}
-
-static void __exit parisc_rtc_fini(void)
-{
- platform_driver_unregister(&parisc_rtc_driver);
-}
-
-module_init(parisc_rtc_init);
-module_exit(parisc_rtc_fini);
-
-MODULE_AUTHOR("Kyle McMartin <[email protected]>");
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("HP PA-RISC RTC driver");
-MODULE_ALIAS("platform:rtc-parisc");
--
1.6.0.4

2009-03-09 14:00:18

by David Woodhouse

[permalink] [raw]
Subject: Re: [PATCH 6/7] powerpc: Hook up rtc-generic, and kill rtc-ppc

On Mon, 2009-03-09 at 14:26 +0100, Geert Uytterhoeven wrote:
> PowerPC has been a long time user of the generic RTC abstraction, so hook up
> rtc-generic:
> - Create the "rtc-generic" platform device if ppc_md.get_rtc_time is set,
> - Kill rtc-ppc, as rtc-generic offers the same functionality in a more
> generic way, and supports autoloading through udev.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>

Acked-By: David Woodhouse <[email protected]>

--
David Woodhouse Open Source Technology Centre
[email protected] Intel Corporation

2009-03-09 14:12:38

by Alessandro Zummo

[permalink] [raw]
Subject: Re: [rtc-linux] [PATCH 7/7] powerpc/ps3: Add rtc-ps3

On Mon, 9 Mar 2009 14:26:23 +0100
Geert Uytterhoeven <[email protected]> wrote:

Hi,

just a few notes:

> +
> +static int ps3_get_time(struct device *dev, struct rtc_time *tm)
> +{
> + to_tm(read_rtc() + ps3_os_area_get_rtc_diff(), tm);
> + tm->tm_year -= 1900;
> + tm->tm_mon -= 1;
> + return 0;
> +}

this should be return rtc_valid_tm() .

can't you use functions from rtc-lib.c instead of
that to_tm ?

> +
> +MODULE_AUTHOR("Sony Corporation");

real name, if possible and a contact address
here . Just in case I need someone to bother :)

--

Best regards,

Alessandro Zummo,
Tower Technologies - Torino, Italy

http://www.towertech.it

2009-03-09 14:14:32

by Alessandro Zummo

[permalink] [raw]
Subject: Re: [rtc-linux] [PATCH 0/7] Generic RTC class driver

On Mon, 9 Mar 2009 14:26:16 +0100
Geert Uytterhoeven <[email protected]> wrote:


> Hi Alessandro et al,
>
> These patches are relative to the "rtc-parisc" branch of Kyle's PA-RISC git
> repository, which already contains some cleanups for the rtc-parisc driver by
> Dann, which already have been ack'ed by Alessandro:
>
> http://git.kernel.org/?p=linux/kernel/git/kyle/parisc-2.6.git;a=shortlog;h=rtc-parisc
>
> Paul: Feel free to add your SuperH support.
>
> I suppose the easiest way for this to go in is through Kyle's PA-RISC tree, as
> he already has the preceding patches? Can I have your acks, please?

Here's mine. Thanks for your efforts .

Acked-by: Alessandro Zummo <[email protected]>

btw I'll pretend I had never seen this patch
if asked in court :)

--

Best regards,

Alessandro Zummo,
Tower Technologies - Torino, Italy

http://www.towertech.it

2009-03-09 15:24:43

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [rtc-linux] [PATCH 7/7] powerpc/ps3: Add rtc-ps3

On Mon, 9 Mar 2009, Alessandro Zummo wrote:
> On Mon, 9 Mar 2009 14:26:23 +0100
> Geert Uytterhoeven <[email protected]> wrote:
> > +
> > +static int ps3_get_time(struct device *dev, struct rtc_time *tm)
> > +{
> > + to_tm(read_rtc() + ps3_os_area_get_rtc_diff(), tm);
> > + tm->tm_year -= 1900;
> > + tm->tm_mon -= 1;
> > + return 0;
> > +}
>
> this should be return rtc_valid_tm() .

Fixed.

> can't you use functions from rtc-lib.c instead of
> that to_tm ?

Ah, those pesky PPC-specific functions... switched to rtc_time_to_tm() and
rtc_tm_to_time().

> > +
> > +MODULE_AUTHOR("Sony Corporation");
>
> real name, if possible and a contact address
> here . Just in case I need someone to bother :)

All PS3-specific drivers have this. But there's an official PS3 platform
maintainer in MAINTAINERS.

>From 41020647c3e2b07e0302a905a926d6221061a128 Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <[email protected]>
Date: Tue, 24 Feb 2009 14:04:20 +0100
Subject: powerpc/ps3: Add rtc-ps3

Create a real RTC driver for PS3, and unhook the deprecated
ppc_md.[gs]et_rtc_time.

Signed-off-by: Geert Uytterhoeven <[email protected]>
Acked-by: Alessandro Zummo <[email protected]>
---
arch/powerpc/include/asm/ps3.h | 3 +
arch/powerpc/platforms/ps3/os-area.c | 2 +
arch/powerpc/platforms/ps3/platform.h | 2 -
arch/powerpc/platforms/ps3/setup.c | 2 -
arch/powerpc/platforms/ps3/time.c | 26 ++++-----
drivers/rtc/Kconfig | 9 +++
drivers/rtc/Makefile | 1 +
drivers/rtc/rtc-ps3.c | 104 +++++++++++++++++++++++++++++++++
8 files changed, 131 insertions(+), 18 deletions(-)
create mode 100644 drivers/rtc/rtc-ps3.c

diff --git a/arch/powerpc/include/asm/ps3.h b/arch/powerpc/include/asm/ps3.h
index 67f1812..cdb6fd8 100644
--- a/arch/powerpc/include/asm/ps3.h
+++ b/arch/powerpc/include/asm/ps3.h
@@ -50,6 +50,9 @@ enum ps3_param_av_multi_out {

enum ps3_param_av_multi_out ps3_os_area_get_av_multi_out(void);

+extern u64 ps3_os_area_get_rtc_diff(void);
+extern void ps3_os_area_set_rtc_diff(u64 rtc_diff);
+
/* dma routines */

enum ps3_dma_page_size {
diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c
index e1c83c2..86e392b 100644
--- a/arch/powerpc/platforms/ps3/os-area.c
+++ b/arch/powerpc/platforms/ps3/os-area.c
@@ -808,6 +808,7 @@ u64 ps3_os_area_get_rtc_diff(void)
{
return saved_params.rtc_diff;
}
+EXPORT_SYMBOL(ps3_os_area_get_rtc_diff);

/**
* ps3_os_area_set_rtc_diff - Set the rtc diff value.
@@ -823,6 +824,7 @@ void ps3_os_area_set_rtc_diff(u64 rtc_diff)
os_area_queue_work();
}
}
+EXPORT_SYMBOL(ps3_os_area_set_rtc_diff);

/**
* ps3_os_area_get_av_multi_out - Returns the default video mode.
diff --git a/arch/powerpc/platforms/ps3/platform.h b/arch/powerpc/platforms/ps3/platform.h
index 235c13e..136aa06 100644
--- a/arch/powerpc/platforms/ps3/platform.h
+++ b/arch/powerpc/platforms/ps3/platform.h
@@ -64,8 +64,6 @@ int ps3_set_rtc_time(struct rtc_time *time);

void __init ps3_os_area_save_params(void);
void __init ps3_os_area_init(void);
-u64 ps3_os_area_get_rtc_diff(void);
-void ps3_os_area_set_rtc_diff(u64 rtc_diff);

/* spu */

diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index 3331ccb..6618182 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -270,8 +270,6 @@ define_machine(ps3) {
.init_IRQ = ps3_init_IRQ,
.panic = ps3_panic,
.get_boot_time = ps3_get_boot_time,
- .set_rtc_time = ps3_set_rtc_time,
- .get_rtc_time = ps3_get_rtc_time,
.set_dabr = ps3_set_dabr,
.calibrate_decr = ps3_calibrate_decr,
.progress = ps3_progress,
diff --git a/arch/powerpc/platforms/ps3/time.c b/arch/powerpc/platforms/ps3/time.c
index d0daf7d..b178a1e 100644
--- a/arch/powerpc/platforms/ps3/time.c
+++ b/arch/powerpc/platforms/ps3/time.c
@@ -19,6 +19,7 @@
*/

#include <linux/kernel.h>
+#include <linux/platform_device.h>

#include <asm/rtc.h>
#include <asm/lv1call.h>
@@ -74,23 +75,20 @@ static u64 read_rtc(void)
return rtc_val;
}

-int ps3_set_rtc_time(struct rtc_time *tm)
+unsigned long __init ps3_get_boot_time(void)
{
- u64 now = mktime(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
- tm->tm_hour, tm->tm_min, tm->tm_sec);
-
- ps3_os_area_set_rtc_diff(now - read_rtc());
- return 0;
+ return read_rtc() + ps3_os_area_get_rtc_diff();
}

-void ps3_get_rtc_time(struct rtc_time *tm)
+static int __init ps3_rtc_init(void)
{
- to_tm(read_rtc() + ps3_os_area_get_rtc_diff(), tm);
- tm->tm_year -= 1900;
- tm->tm_mon -= 1;
-}
+ struct platform_device *pdev;

-unsigned long __init ps3_get_boot_time(void)
-{
- return read_rtc() + ps3_os_area_get_rtc_diff();
+ pdev = platform_device_register_simple("rtc-ps3", -1, NULL, 0);
+ if (IS_ERR(pdev))
+ return PTR_ERR(pdev);
+
+ return 0;
}
+
+module_init(ps3_rtc_init);
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 6488c50..7b6b63a 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -730,4 +730,13 @@ config RTC_DRV_MV
This driver can also be built as a module. If so, the module
will be called rtc-mv.

+config RTC_DRV_PS3
+ tristate "PS3 RTC"
+ depends on PPC_PS3
+ help
+ If you say yes here you will get support for the RTC on PS3.
+
+ This driver can also be built as a module. If so, the module
+ will be called rtc-ps3.
+
endif # RTC_CLASS
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index bd209a5..d161d1d 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -75,3 +75,4 @@ obj-$(CONFIG_RTC_DRV_VR41XX) += rtc-vr41xx.o
obj-$(CONFIG_RTC_DRV_WM8350) += rtc-wm8350.o
obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o
obj-$(CONFIG_RTC_DRV_PCF50633) += rtc-pcf50633.o
+obj-$(CONFIG_RTC_DRV_PS3) += rtc-ps3.o
diff --git a/drivers/rtc/rtc-ps3.c b/drivers/rtc/rtc-ps3.c
new file mode 100644
index 0000000..968133c
--- /dev/null
+++ b/drivers/rtc/rtc-ps3.c
@@ -0,0 +1,104 @@
+/*
+ * PS3 RTC Driver
+ *
+ * Copyright 2009 Sony Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.
+ * If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/rtc.h>
+
+#include <asm/lv1call.h>
+#include <asm/ps3.h>
+
+
+static u64 read_rtc(void)
+{
+ int result;
+ u64 rtc_val;
+ u64 tb_val;
+
+ result = lv1_get_rtc(&rtc_val, &tb_val);
+ BUG_ON(result);
+
+ return rtc_val;
+}
+
+static int ps3_get_time(struct device *dev, struct rtc_time *tm)
+{
+ rtc_time_to_tm(read_rtc() + ps3_os_area_get_rtc_diff(), tm);
+ return rtc_valid_tm(tm);
+}
+
+static int ps3_set_time(struct device *dev, struct rtc_time *tm)
+{
+ unsigned long now;
+
+ rtc_tm_to_time(tm, &now);
+ ps3_os_area_set_rtc_diff(now - read_rtc());
+ return 0;
+}
+
+static const struct rtc_class_ops ps3_rtc_ops = {
+ .read_time = ps3_get_time,
+ .set_time = ps3_set_time,
+};
+
+static int __init ps3_rtc_probe(struct platform_device *dev)
+{
+ struct rtc_device *rtc;
+
+ rtc = rtc_device_register("rtc-ps3", &dev->dev, &ps3_rtc_ops,
+ THIS_MODULE);
+ if (IS_ERR(rtc))
+ return PTR_ERR(rtc);
+
+ platform_set_drvdata(dev, rtc);
+ return 0;
+}
+
+static int __exit ps3_rtc_remove(struct platform_device *dev)
+{
+ rtc_device_unregister(platform_get_drvdata(dev));
+ return 0;
+}
+
+static struct platform_driver ps3_rtc_driver = {
+ .driver = {
+ .name = "rtc-ps3",
+ .owner = THIS_MODULE,
+ },
+ .remove = __exit_p(ps3_rtc_remove),
+};
+
+static int __init ps3_rtc_init(void)
+{
+ return platform_driver_probe(&ps3_rtc_driver, ps3_rtc_probe);
+}
+
+static void __exit ps3_rtc_fini(void)
+{
+ platform_driver_unregister(&ps3_rtc_driver);
+}
+
+module_init(ps3_rtc_init);
+module_exit(ps3_rtc_fini);
+
+MODULE_AUTHOR("Sony Corporation");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("ps3 RTC driver");
+MODULE_ALIAS("platform:rtc-ps3");
--
1.6.0.4

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village ? Da Vincilaan 7-D1 ? B-1935 Zaventem ? Belgium

Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: [email protected]
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 ? RPR Brussels
Fortis ? BIC GEBABEBB ? IBAN BE41293037680010

2009-03-09 15:50:29

by Paul Mundt

[permalink] [raw]
Subject: Re: [PATCH 0/7] Generic RTC class driver

On Mon, Mar 09, 2009 at 02:26:16PM +0100, Geert Uytterhoeven wrote:
> Paul: Feel free to add your SuperH support.
>
> I suppose the easiest way for this to go in is through Kyle's PA-RISC tree, as
> he already has the preceding patches? Can I have your acks, please?
>
I'll add the SH support once the patch set is merged, it's not a very
pressing matter, so no need to make the patch juggling any more
complicated :-)

2009-03-09 18:19:44

by Geoff Levand

[permalink] [raw]
Subject: Re: [rtc-linux] [PATCH 7/7] powerpc/ps3: Add rtc-ps3

Hi,

On 03/09/2009 07:12 AM, Alessandro Zummo wrote:
> On Mon, 9 Mar 2009 14:26:23 +0100
> Geert Uytterhoeven <[email protected]> wrote:
>> +
>> +MODULE_AUTHOR("Sony Corporation");
>
> real name, if possible and a contact address
> here . Just in case I need someone to bother :)

Please look at the MAINTAINERS file, that will give
the contact for PS3. It is much easier to maintain
a single place for the contact than many spread
throughout the kernel sources.

-Geoff

2009-03-09 18:43:26

by Alessandro Zummo

[permalink] [raw]
Subject: Re: [rtc-linux] Re: [PATCH 7/7] powerpc/ps3: Add rtc-ps3

On Mon, 9 Mar 2009 11:04:17 -0700
Geoff Levand <[email protected]> wrote:

>
> Hi,
>
> On 03/09/2009 07:12 AM, Alessandro Zummo wrote:
> > On Mon, 9 Mar 2009 14:26:23 +0100
> > Geert Uytterhoeven <[email protected]> wrote:
> >> +
> >> +MODULE_AUTHOR("Sony Corporation");
> >
> > real name, if possible and a contact address
> > here . Just in case I need someone to bother :)
>
> Please look at the MAINTAINERS file, that will give
> the contact for PS3. It is much easier to maintain
> a single place for the contact than many spread
> throughout the kernel sources.

Having it in MODULE_AUTHOR allow my scripts to automatically
send an email when appropriate.

MAINTAINERS lists the files with an arbitrary
driver title so that the search must be made by an human and there's
no field that links a person to a specific .c .

so every time I want to address someone I need to check MODULE_AUTHOR,
the git log and the MAINTAINERS file.

--

Best regards,

Alessandro Zummo,
Tower Technologies - Torino, Italy

http://www.towertech.it

2009-03-09 18:51:44

by Geoff Levand

[permalink] [raw]
Subject: Re: [PATCH 7/7] powerpc/ps3: Add rtc-ps3

On 03/09/2009 06:26 AM, Geert Uytterhoeven wrote:
> Create a real RTC driver for PS3, and unhook the deprecated
> ppc_md.[gs]et_rtc_time.

> 8 files changed, 132 insertions(+), 18 deletions(-)

Sorry, I hadn't been following the discussion closely, but
could you explain why we are going from a generic framework
where we hook in our platform specific part to a totally
independent driver that has such an increase in code size.

Why couldn't you fix the generic part so that udev could
load it automatically?

I much prefer to have this code in the platform support
code as it was. It is much more effort (a pain) to maintain
a separate driver were I have to cater to a subsystem's
maintainer, and with this rtc it seems everyone who was
using the generic PPC driver will need to do the same.

-Geoff

2009-03-09 19:07:25

by Geoff Levand

[permalink] [raw]
Subject: Re: [rtc-linux] Re: [PATCH 7/7] powerpc/ps3: Add rtc-ps3

Hi,

On 03/09/2009 11:43 AM, Alessandro Zummo wrote:
> Geoff Levand <[email protected]> wrote:
>> On 03/09/2009 07:12 AM, Alessandro Zummo wrote:
>> > On Mon, 9 Mar 2009 14:26:23 +0100
>> > Geert Uytterhoeven <[email protected]> wrote:
>> >> +
>> >> +MODULE_AUTHOR("Sony Corporation");
>> >
>> > real name, if possible and a contact address
>> > here . Just in case I need someone to bother :)
>>
>> Please look at the MAINTAINERS file, that will give
>> the contact for PS3. It is much easier to maintain
>> a single place for the contact than many spread
>> throughout the kernel sources.
>
> Having it in MODULE_AUTHOR allow my scripts to automatically
> send an email when appropriate.
>
> MAINTAINERS lists the files with an arbitrary
> driver title so that the search must be made by an human and there's
> no field that links a person to a specific .c .
>
> so every time I want to address someone I need to check MODULE_AUTHOR,
> the git log and the MAINTAINERS file.

I see. It seems what you want is MODULE_MAINTAINER, as author is
the author, who after some time, may not be the maintainer any more.

There was some work by Joe Perches to list the files a maintainer is
responsible for into the MAINTAINERS file. I think that would give
you what you want, a way to automatically get the maintainer of a
file.

Joe, could you let us know the status of that work?

-Geoff

2009-03-09 19:19:00

by Joe Perches

[permalink] [raw]
Subject: Re: [rtc-linux] Re: [PATCH 7/7] powerpc/ps3: Add rtc-ps3

On Mon, 2009-03-09 at 12:06 -0700, Geoff Levand wrote:
> There was some work by Joe Perches to list the files a maintainer is
> responsible for into the MAINTAINERS file. I think that would give
> you what you want, a way to automatically get the maintainer of a
> file.
>
> Joe, could you let us know the status of that work?

I think it works fine, and is an acceptable
approach to finding a maintainer for either a
patch or a specific file.

The changes I've posted are probably not suitable
for merging by anyone other than Linus as
MAINTAINERS is the most heavily modified file
in the kernel tree.

I've submitted it several times after merging it
with the latest kernel without response from Linus.

I'd merge and submit it again if it could be accepted.

If someone would propose a mechanism that would
improve the possibility to get it merged, I'd
also appreciate that.

2009-03-10 09:21:31

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 7/7] powerpc/ps3: Add rtc-ps3

On Mon, 9 Mar 2009, Geoff Levand wrote:
> On 03/09/2009 06:26 AM, Geert Uytterhoeven wrote:
> > Create a real RTC driver for PS3, and unhook the deprecated
> > ppc_md.[gs]et_rtc_time.
>
> > 8 files changed, 132 insertions(+), 18 deletions(-)
>
> Sorry, I hadn't been following the discussion closely, but
> could you explain why we are going from a generic framework
> where we hook in our platform specific part to a totally
> independent driver that has such an increase in code size.

Alessandro prefers not to have generic RTC drivers on top of some other
abstraction, but wants platform/chip-specific drivers under drivers/rtc/
instead. The goal is to convert all RTC drivers buried in platform code
to separate RTC drivers.

(Alessandro, please correct me if I'm wrong)

> Why couldn't you fix the generic part so that udev could
> load it automatically?

BTW, I also fixed the generic part, which is now called rtc-generic and
autoloaded (patch 4).

> I much prefer to have this code in the platform support
> code as it was. It is much more effort (a pain) to maintain
> a separate driver were I have to cater to a subsystem's
> maintainer, and with this rtc it seems everyone who was
> using the generic PPC driver will need to do the same.

They can keep on using rtc-generic for now (patch 6).

If you do not want rtc-ps3, you can nak it, and keep on using rtc-generic :-)
But please consider before doing that...

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village ? Da Vincilaan 7-D1 ? B-1935 Zaventem ? Belgium

Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: [email protected]
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 ? RPR Brussels
Fortis ? BIC GEBABEBB ? IBAN BE41293037680010

2009-03-10 09:40:10

by Alessandro Zummo

[permalink] [raw]
Subject: Re: [rtc-linux] Re: [PATCH 7/7] powerpc/ps3: Add rtc-ps3

On Tue, 10 Mar 2009 10:21:14 +0100 (CET)
Geert Uytterhoeven <[email protected]> wrote:

> Alessandro prefers not to have generic RTC drivers on top of some other
> abstraction, but wants platform/chip-specific drivers under drivers/rtc/
> instead. The goal is to convert all RTC drivers buried in platform code
> to separate RTC drivers.
>
> (Alessandro, please correct me if I'm wrong)

yes, that's my dream :)

--

Best regards,

Alessandro Zummo,
Tower Technologies - Torino, Italy

http://www.towertech.it

2009-03-10 16:20:57

by Geoff Levand

[permalink] [raw]
Subject: Re: [PATCH 7/7] powerpc/ps3: Add rtc-ps3

On 03/09/2009 06:26 AM, Geert Uytterhoeven wrote:
> Create a real RTC driver for PS3, and unhook the deprecated
> ppc_md.[gs]et_rtc_time.
>
> Signed-off-by: Geert Uytterhoeven <[email protected]>
> Cc: Geoff Levand <[email protected]>
> ---
> arch/powerpc/include/asm/ps3.h | 3 +
> arch/powerpc/platforms/ps3/os-area.c | 2 +
> arch/powerpc/platforms/ps3/platform.h | 2 -
> arch/powerpc/platforms/ps3/setup.c | 2 -
> arch/powerpc/platforms/ps3/time.c | 26 ++++-----
> drivers/rtc/Kconfig | 9 +++
> drivers/rtc/Makefile | 1 +
> drivers/rtc/rtc-ps3.c | 105 +++++++++++++++++++++++++++++++++
> 8 files changed, 132 insertions(+), 18 deletions(-)
> create mode 100644 drivers/rtc/rtc-ps3.c

Acked-by: Geoff Levand <[email protected]>

2009-03-11 04:16:56

by Benjamin Herrenschmidt

[permalink] [raw]
Subject: Re: [PATCH 6/7] powerpc: Hook up rtc-generic, and kill rtc-ppc

On Mon, 2009-03-09 at 13:59 +0000, David Woodhouse wrote:
> On Mon, 2009-03-09 at 14:26 +0100, Geert Uytterhoeven wrote:
> > PowerPC has been a long time user of the generic RTC abstraction, so hook up
> > rtc-generic:
> > - Create the "rtc-generic" platform device if ppc_md.get_rtc_time is set,
> > - Kill rtc-ppc, as rtc-generic offers the same functionality in a more
> > generic way, and supports autoloading through udev.
> >
> > Signed-off-by: Geert Uytterhoeven <[email protected]>
>
> Acked-By: David Woodhouse <[email protected]>

Acked-by: Benjamin Herrenschmidt <[email protected]>

2009-03-11 10:36:21

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 0/7] Generic RTC class driver

Hi Kyle,

On Mon, 9 Mar 2009, Geert Uytterhoeven wrote:
> These patches are relative to the "rtc-parisc" branch of Kyle's PA-RISC git
> repository, which already contains some cleanups for the rtc-parisc driver by
> Dann, which already have been ack'ed by Alessandro:
>
> http://git.kernel.org/?p=linux/kernel/git/kyle/parisc-2.6.git;a=shortlog;h=rtc-parisc
>
> Paul: Feel free to add your SuperH support.
>
> I suppose the easiest way for this to go in is through Kyle's PA-RISC tree, as
> he already has the preceding patches? Can I have your acks, please?

Is it OK for you to take it through your PA-RISC tree?
If yes, I can resend the patch series with the collected acks.

Thanks!

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: [email protected]
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 · RPR Brussels
Fortis · BIC GEBABEBB · IBAN BE41293037680010

2009-03-11 15:45:28

by Kyle McMartin

[permalink] [raw]
Subject: Re: [PATCH 0/7] Generic RTC class driver

On Wed, Mar 11, 2009 at 11:36:02AM +0100, Geert Uytterhoeven wrote:
> Is it OK for you to take it through your PA-RISC tree?
> If yes, I can resend the patch series with the collected acks.
>

That's fine with me, just hit me up with a git tree address and I'll
suck it all into the rtc-parisc tree?

regards, Kyle

2009-03-11 17:26:26

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 0/7] Generic RTC class driver

Hi Kyle,

On Wed, 11 Mar 2009, Kyle McMartin wrote:
> On Wed, Mar 11, 2009 at 11:36:02AM +0100, Geert Uytterhoeven wrote:
> > Is it OK for you to take it through your PA-RISC tree?
> > If yes, I can resend the patch series with the collected acks.
>
> That's fine with me, just hit me up with a git tree address and I'll
> suck it all into the rtc-parisc tree?

I put it up at:

master.kernel.org:/pub/scm/linux/kernel/git/geert/linux-rtc-generic.git

The master branch should be a descendant of your rtc-parisc branch.

Thanks!

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village ? Da Vincilaan 7-D1 ? B-1935 Zaventem ? Belgium

Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: [email protected]
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 ? RPR Brussels
Fortis ? BIC GEBABEBB ? IBAN BE41293037680010

2009-03-13 04:26:00

by Kyle McMartin

[permalink] [raw]
Subject: Re: [PATCH 0/7] Generic RTC class driver

On Wed, Mar 11, 2009 at 06:26:12PM +0100, Geert Uytterhoeven wrote:
> Hi Kyle,
>
> On Wed, 11 Mar 2009, Kyle McMartin wrote:
> > On Wed, Mar 11, 2009 at 11:36:02AM +0100, Geert Uytterhoeven wrote:
> > > Is it OK for you to take it through your PA-RISC tree?
> > > If yes, I can resend the patch series with the collected acks.
> >
> > That's fine with me, just hit me up with a git tree address and I'll
> > suck it all into the rtc-parisc tree?
>
> I put it up at:
>
> master.kernel.org:/pub/scm/linux/kernel/git/geert/linux-rtc-generic.git
>
> The master branch should be a descendant of your rtc-parisc branch.
>
> Thanks!
>

Great, thanks Geert!

I've pulled it and pushed it back out, I'll submit it when the merge
window opens.

cheers, Kyle

2009-03-16 13:10:18

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 4/7] parisc: rtc: Rename rtc-parisc to rtc-generic

On Mon, Mar 09, 2009 at 02:26:20PM +0100, Geert Uytterhoeven wrote:
> The rtc-parisc driver is not PA-RISC specific at all, as it uses the existing
> (but deprecated) generic RTC infrastructure ([gs]et_rtc_time()).
> Rename the driver from rtc-parisc to rtc-generic.

Maybe it should be called rtc-legacy instead?

2009-04-02 09:42:46

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH 0/7] Generic RTC class driver

On Fri, 13 Mar 2009, Kyle McMartin wrote:
> On Wed, Mar 11, 2009 at 06:26:12PM +0100, Geert Uytterhoeven wrote:
> > On Wed, 11 Mar 2009, Kyle McMartin wrote:
> > > On Wed, Mar 11, 2009 at 11:36:02AM +0100, Geert Uytterhoeven wrote:
> > > > Is it OK for you to take it through your PA-RISC tree?
> > > > If yes, I can resend the patch series with the collected acks.
> > >
> I've pulled it and pushed it back out, I'll submit it when the merge
> window opens.

Apparently the first half went it through akpm. Will you take care of the
remaining commits?

Thanks!

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village ? Da Vincilaan 7-D1 ? B-1935 Zaventem ? Belgium

Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: [email protected]
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 ? RPR Brussels
Fortis ? BIC GEBABEBB ? IBAN BE41293037680010

2009-04-02 13:57:10

by Kyle McMartin

[permalink] [raw]
Subject: Re: [PATCH 0/7] Generic RTC class driver

On Thu, Apr 02, 2009 at 11:42:02AM +0200, Geert Uytterhoeven wrote:
> On Fri, 13 Mar 2009, Kyle McMartin wrote:
> > On Wed, Mar 11, 2009 at 06:26:12PM +0100, Geert Uytterhoeven wrote:
> > > On Wed, 11 Mar 2009, Kyle McMartin wrote:
> > > > On Wed, Mar 11, 2009 at 11:36:02AM +0100, Geert Uytterhoeven wrote:
> > > > > Is it OK for you to take it through your PA-RISC tree?
> > > > > If yes, I can resend the patch series with the collected acks.
> > > >
> > I've pulled it and pushed it back out, I'll submit it when the merge
> > window opens.
>
> Apparently the first half went it through akpm. Will you take care of the
> remaining commits?
>

Yup, I updated the rtc-parisc branch last night, I'll push it along to
Linus this morning.

Thanks again, Geert.

cheers, Kyle