Re: [v2] rtc: pcf85363/pcf85263: fix error that failed to run hwclock -w

From: Alexandre Belloni
Date: Wed Aug 21 2019 - 07:39:01 EST


On 21/08/2019 12:30:29+0100, Mark Brown wrote:
> On Wed, Aug 21, 2019 at 01:24:13PM +0200, Alexandre Belloni wrote:
> > On 21/08/2019 12:21:42+0100, Mark Brown wrote:
> > > On Tue, Aug 20, 2019 at 01:33:14PM -0500, Li Yang wrote:
>
> > > > violation check of regmap rejects such access. According to
> > > > Alexcandre, the address wrapping is essential to the functionality of
>
> > > It's *essential*? Will innovation never cease?
>
> > To be clear, for some RTCs, its is the only way to accurately set the
> > time.
>
> What's the mechanism here? It's a very strange thing to require.

The clock control is on the first register, then you have sec, min,
hour, day, mon, year.

To be able to set the clock accurately, you need to first disable the
clock, then set the time and date and finally reenable the clock in the
first register. This should be done in a single i2c write.

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com