Patchwork [v2] Fix multiple RTC detections on SUN4D

login
register
mail settings
Submitter oftedal
Date Sept. 4, 2009, 6:29 p.m.
Message ID <Pine.LNX.4.64.0909042024150.13525@oizys.tordivel.org>
Download mbox | patch
Permalink /patch/33012/
State Accepted
Delegated to: David Miller
Headers show

Comments

oftedal - Sept. 4, 2009, 6:29 p.m.
Sorry about the slow response. Had some memory issues with the testbox.

On SUN4D machines there is one RTC-chip located on each systemboard, when
booting all of these will be probed. Registering a second RTC with the
kernel fails, and breaks the rtc:
[    0.212000] kobject (f02625f0): tried to init an initialized object, somethi
[    0.212000] [f0141418 : platform_device_register+0x4/0x18 ] [f01edbc4 : cloc
[    0.216000] ------------[ cut here ]------------
[    0.216000] WARNING: at fs/sysfs/dir.c:487 sysfs_add_one+0x84/0xa4()
[    0.216000] sysfs: cannot create duplicate filename '/devices/platform/rtc-m
[    0.216000] Modules linked in:
[    0.216000] [f00c1988 : sysfs_add_one+0x84/0xa4 ] [f00c1f70 : create_dir+0x4
[    0.216000] ---[ end trace 139ce121c98e96c9 ]---
[    0.220000] kobject_add_internal failed for rtc-m48t59.0 with -EEXIST, don't
[    0.220000] [f013d568 : device_add+0xc8/0x610 ] [f014134c : platform_device_
[    0.220000] Registering RTC device failed

Later on in the boot the following happens:
[   23.116000] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

The suggested fix searches the supplied RTC node for a address property
which only one RTC per system appears to have and registers only this RTC
with the kernel. (Tested on SS20/SUN4M and SS1000E/SUN4D).

Signed-off-by: Kjetil Oftedal <oftedal@gmail.com>


--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Sept. 8, 2009, 9:40 a.m.
From: Kjetil Oftedal <oftedal@gmail.com>
Date: Fri, 4 Sep 2009 20:29:31 +0200 (CEST)

> Signed-off-by: Kjetil Oftedal <oftedal@gmail.com>

Applied, thanks.

But you need to learn how to get your email client to not
corrupt the patches you send.  It chops up long lines and
transforms tab characters into spaces.

I thus have to apply your patches by hand.

Read Documentation/email-clients.txt in the kernel tree for help.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index 614ac7b..a70da0a 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -156,6 +156,10 @@  static int __devinit clock_probe(struct of_device *op, const struct of_device_id
         if (!model)
                 return -ENODEV;

+       /* Only the primary RTC has an address property */
+       if (!of_find_property(dp, "address", NULL))
+               return -ENODEV;
+
         m48t59_rtc.resource = &op->resource[0];
         if (!strcmp(model, "mk48t02")) {
                 /* Map the clock register io area read-only */