* rtc-m48t59 on an Ultra 5
@ 2008-09-06 1:44 Josip Rodin
2008-09-08 1:14 ` David Miller
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Josip Rodin @ 2008-09-06 1:44 UTC (permalink / raw)
To: sparclinux
Hi,
Current sparc-next-2.6 on my Ultra 5 works fine, but the new RTC driver
prints the following during boot:
rtc-m48t59 rtc-m48t59.0: rtc core: registered m48t59 as rtc0
rtc-m48t59 rtc-m48t59.0: hctosys: invalid date/time
The system time is okay after boot, though.
% sudo ln -s rtc0 /dev/rtc
% sudo hwclock --debug; echo; date
hwclock from util-linux-2.12r
Using /dev/rtc interface to clock.
Last drift adjustment done at 1220663753 seconds after 1969
Last calibration done at 1220663753 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
/dev/rtc does not have interrupt functions. Waiting in loop for time from /dev/rtc to change
...got clock tick
Time read from Hardware Clock: 1940/09/06 01:42:03
Hw clock time : 1940/09/06 01:42:03 = -925251477 seconds since 1969
Fri Sep 6 02:42:03 1940 -0.646109 seconds
Sat Sep 6 03:42:03 CEST 2008
Should I be worried? :)
--
2. That which causes joy or happiness.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: rtc-m48t59 on an Ultra 5
2008-09-06 1:44 rtc-m48t59 on an Ultra 5 Josip Rodin
@ 2008-09-08 1:14 ` David Miller
2008-09-08 1:50 ` Josip Rodin
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2008-09-08 1:14 UTC (permalink / raw)
To: sparclinux
From: Josip Rodin <joy@entuzijast.net>
Date: Sat, 6 Sep 2008 03:44:32 +0200
> Current sparc-next-2.6 on my Ultra 5 works fine, but the new RTC driver
> prints the following during boot:
>
> rtc-m48t59 rtc-m48t59.0: rtc core: registered m48t59 as rtc0
> rtc-m48t59 rtc-m48t59.0: hctosys: invalid date/time
>
> The system time is okay after boot, though.
It might be related to this bug fix I just added to the
sparc-next-2.6 tree:
sparc64: fix wrong m48t59 RTC year
Correctly calculate offset to the year register for
Mostek RTC.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
arch/sparc64/kernel/time.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index 209e7d2..226a004 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -500,6 +500,7 @@ static struct of_platform_driver bq4802_driver = {
static unsigned char mostek_read_byte(struct device *dev, u32 ofs)
{
struct platform_device *pdev = to_platform_device(dev);
+ struct m48t59_plat_data *pdata = pdev->dev.platform_data;
void __iomem *regs;
unsigned char val;
@@ -507,7 +508,7 @@ static unsigned char mostek_read_byte(struct device *dev, u32 ofs)
val = readb(regs + ofs);
/* the year 0 is 1968 */
- if (ofs = M48T59_YEAR) {
+ if (ofs = pdata->offset + M48T59_YEAR) {
val += 0x68;
if ((val & 0xf) > 9)
val += 6;
@@ -518,10 +519,11 @@ static unsigned char mostek_read_byte(struct device *dev, u32 ofs)
static void mostek_write_byte(struct device *dev, u32 ofs, u8 val)
{
struct platform_device *pdev = to_platform_device(dev);
+ struct m48t59_plat_data *pdata = pdev->dev.platform_data;
void __iomem *regs;
regs = (void __iomem *) pdev->resource[0].start;
- if (ofs = M48T59_YEAR) {
+ if (ofs = pdata->offset + M48T59_YEAR) {
if (val < 0x68)
val += 0x32;
else
--
1.5.6.5.GIT
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: rtc-m48t59 on an Ultra 5
2008-09-06 1:44 rtc-m48t59 on an Ultra 5 Josip Rodin
2008-09-08 1:14 ` David Miller
@ 2008-09-08 1:50 ` Josip Rodin
2008-09-08 3:25 ` Robert Reif
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Josip Rodin @ 2008-09-08 1:50 UTC (permalink / raw)
To: sparclinux
On Sun, Sep 07, 2008 at 06:14:09PM -0700, David Miller wrote:
> > Current sparc-next-2.6 on my Ultra 5 works fine, but the new RTC driver
> > prints the following during boot:
> >
> > rtc-m48t59 rtc-m48t59.0: rtc core: registered m48t59 as rtc0
> > rtc-m48t59 rtc-m48t59.0: hctosys: invalid date/time
> >
> > The system time is okay after boot, though.
>
> It might be related to this bug fix I just added to the
> sparc-next-2.6 tree:
>
> sparc64: fix wrong m48t59 RTC year
>
> Correctly calculate offset to the year register for
> Mostek RTC.
Oh yeah, I forgot to report my test of that patch, sorry. Now the kernel said:
rtc-m48t59 rtc-m48t59.0: setting system clock to 1970-09-06 17:38:55 UTC (21490735)
Userland says:
% sudo hwclock --debug; echo; date
hwclock from util-linux-2.12r
Using /dev/rtc interface to clock.
Last drift adjustment done at 1220722547 seconds after 1969
Last calibration done at 1220722547 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
/dev/rtc does not have interrupt functions. Waiting in loop for time from /dev/rtc to change
...got clock tick
Time read from Hardware Clock: 1970/09/08 01:49:11
Hw clock time : 1970/09/08 01:49:11 = 21606551 seconds since 1969
Tue Sep 8 02:49:11 1970 -0.803853 seconds
Mon Sep 8 03:49:10 CEST 2008
Is this now ready for a hwclock --systohc or?
--
2. That which causes joy or happiness.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: rtc-m48t59 on an Ultra 5
2008-09-06 1:44 rtc-m48t59 on an Ultra 5 Josip Rodin
2008-09-08 1:14 ` David Miller
2008-09-08 1:50 ` Josip Rodin
@ 2008-09-08 3:25 ` Robert Reif
2008-09-08 15:13 ` Krzysztof Helt
2008-09-08 19:38 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Robert Reif @ 2008-09-08 3:25 UTC (permalink / raw)
To: sparclinux
Josip Rodin wrote:
> % sudo hwclock --debug; echo; date
> hwclock from util-linux-2.12r
> Using /dev/rtc interface to clock.
>
I have similar problems with debian etch on sparc32. hwclock
only supports /dev/rtc. Upgrading hwclock is problematic because there
are 3 different versions (original hwclock, linux-util and linux-util-ng)
and they require init.d script changes. Superblock times are also
corrupted with bad dates and fails fsck which immediately causes a
reboot. Fixing it requires mounting the drive on another system and
running fsck to fix the times. This is a real pain because I haven't
been able to find a combination that boots both the stock debian etch
kernel and sparc-next.
Is there any way to have the the rtc device show up as /dev/rtc?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: rtc-m48t59 on an Ultra 5
2008-09-06 1:44 rtc-m48t59 on an Ultra 5 Josip Rodin
` (2 preceding siblings ...)
2008-09-08 3:25 ` Robert Reif
@ 2008-09-08 15:13 ` Krzysztof Helt
2008-09-08 19:38 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Helt @ 2008-09-08 15:13 UTC (permalink / raw)
To: sparclinux
On Sun, 07 Sep 2008 23:25:13 -0400
Robert Reif <reif@earthlink.net> wrote:
> Josip Rodin wrote:
> > % sudo hwclock --debug; echo; date
> > hwclock from util-linux-2.12r
> > Using /dev/rtc interface to clock.
> >
> I have similar problems with debian etch on sparc32. hwclock
> only supports /dev/rtc. Upgrading hwclock is problematic because there
> are 3 different versions (original hwclock, linux-util and linux-util-ng)
> and they require init.d script changes. Superblock times are also
> corrupted with bad dates and fails fsck which immediately causes a
> reboot. Fixing it requires mounting the drive on another system and
> running fsck to fix the times. This is a real pain because I haven't
> been able to find a combination that boots both the stock debian etch
> kernel and sparc-next.
>
> Is there any way to have the the rtc device show up as /dev/rtc?
>
There are few things which can improve your situation:
1. Rebuild the kernel with CONFIG_RTC_HCTOSYS option set.
It is named "Set system time from RTC on startup and resume"
This make system use the rtc0 (you can set it up in configuration
as well) to get initial time and date.
2. Add "ln -s /dev/rtc0 /dev/rtc" to your booting scripts before
the hwclock (or ntp) is used for the first time.
3. Define udev rule (if you use udev) to create /dev/rtc link to
the /dev/rtc0.
Regards,
Krzysztof
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: rtc-m48t59 on an Ultra 5
2008-09-06 1:44 rtc-m48t59 on an Ultra 5 Josip Rodin
` (3 preceding siblings ...)
2008-09-08 15:13 ` Krzysztof Helt
@ 2008-09-08 19:38 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2008-09-08 19:38 UTC (permalink / raw)
To: sparclinux
From: Krzysztof Helt <krzysztof.h1@wp.pl>
Date: Mon, 8 Sep 2008 17:13:13 +0200
> There are few things which can improve your situation:
>
> 1. Rebuild the kernel with CONFIG_RTC_HCTOSYS option set.
> It is named "Set system time from RTC on startup and resume"
> This make system use the rtc0 (you can set it up in configuration
> as well) to get initial time and date.
>
> 2. Add "ln -s /dev/rtc0 /dev/rtc" to your booting scripts before
> the hwclock (or ntp) is used for the first time.
>
> 3. Define udev rule (if you use udev) to create /dev/rtc link to
> the /dev/rtc0.
These all work, but I really think there should be at least a kernel
config controlled way for an automatic alias to show up.
Even something as simple as just creating a /sys/class/misc/rtc/dev
file that outputs the major and minor device numbers of /dev/rtc0,
udev would just "do the right thing" and create that alias /dev/rtc
node for the user.
This whole /dev/rtc0 business is just unnecessary pain, it makes
transition of a platform to the RTC subsystem harder rather than
easier.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-09-08 19:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-06 1:44 rtc-m48t59 on an Ultra 5 Josip Rodin
2008-09-08 1:14 ` David Miller
2008-09-08 1:50 ` Josip Rodin
2008-09-08 3:25 ` Robert Reif
2008-09-08 15:13 ` Krzysztof Helt
2008-09-08 19:38 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.