Re: [PATCH 1/2] MIPS: malta-time: Don't switch RTC to BCD mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Maciej,

On Wed, May 13, 2015 at 07:03:51PM +0100, Maciej W. Rozycki wrote:
> On Wed, 13 May 2015, James Hogan wrote:
> 
> > On Malta, the RTC is forced into binary coded decimal (BCD) mode during
> > init, even if the bootloader put it into binary mode (as YAMON does).
> > This can result in the RTC seconds being an invalid BCD (e.g.
> > 0x1a..0x1f) for up to 6 seconds.
> 
>  Sigh.  No sooner I had fixed the breakage (with 636221b8 and a fat 
> comment) it got put back (with a87ea88d).  Even though it's easily 
> spotted as it breaks the system time (all the fields, including the date 
> too, not only the seconds!) across a reboot due to YAMON eagerly 
> switching the mode back.  And that'd be the first item I'd check when 
> validating a change touching the RTC.

Indeed, a quick bit of experimentation confirms a discrepancy before
this patch is applied before YAMON's "date" command and the RTC clock as
read by Linux (with year, day of month, hour & minute all going 22 -> 16
(22 == 0x16), and presumably different rates of time depending on which
mode its in. After this patch it appears to work again as it should.

>  Is there an actual need to reinitialise the RTC at all?  The RTC 
> registers are readable, so the current configuration can be obtained, 
> the RTC driver copes with any valid arrangement, so can any other code 
> using the clock as a reference.
> 
>  YAMON OTOH is not as flexible, its clock management commands expect the 
> format the monitor itself set the chip to, so I think the kernel has to 
> respect that (just as it doesn't randomly flip bits in the RTC on x86 
> PCs for example).
> 
>  So unless proven otherwise I'll ask for `init_rtc' to be dropped 
> altogether

I suspect it comes down to what U-Boot does with RTC (possibly very
little), but I'll leave that to you and Paul to discuss.

> and any changes required made to `estimate_frequencies' 
> instead.  Which I believe you already did with 2/2.

As long as the mode doesn't get changed, my change to
estimate_frequencies() should be happy enough. Before patch 2/2 it only
reads UIP flag to try to time a single second, so it shouldn't have
cared about such details as the RTC mode.

Cheers
James

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux