From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Ond=C5=99ej?= Jirman Subject: Re: [PATCH 0/3] Add basic support for RTC on Allwinner H6 SoC Date: Fri, 9 Aug 2019 11:16:26 +0200 Message-ID: <20190809091626.6kanjbmvbi4oipco@core.my.home> References: <20190412120730.473-1-megous@megous.com> <20190806183045.edhm3qzpegscf2z7@core.my.home> <20190807105502.GK3600@piout.net> <20190808121237.g6twq2nh3sayu3vx@core.my.home> <20190808233930.GM3600@piout.net> Reply-To: megous-5qf/QAjKc83QT0dZR+AlfA@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Return-path: Sender: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Content-Disposition: inline In-Reply-To: <20190808233930.GM3600-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org> List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , To: Alexandre Belloni Cc: Chen-Yu Tsai , Mark Rutland , Alessandro Zummo , devicetree , Maxime Ripard , linux-kernel , linux-sunxi , Rob Herring , linux-arm-kernel , linux-rtc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: devicetree@vger.kernel.org On Fri, Aug 09, 2019 at 01:39:30AM +0200, Alexandre Belloni wrote: > On 08/08/2019 14:12:37+0200, Ond=C5=99ej Jirman wrote: > > On Wed, Aug 07, 2019 at 12:55:02PM +0200, Alexandre Belloni wrote: > > > Hi, > > >=20 > > > On 06/08/2019 20:30:45+0200, Ond=C5=99ej Jirman wrote: > > > > Maybe whether XO or DCXO is used also matters if you want to do som= e fine > > > > tunning of DCXO (control register has pletny of options), but that'= s probably > > > > better done in u-boot. And there's still no need to read HOSC sourc= e from DT. > > > > The driver can just check compatible, and if it is H6 and OSC_CLK_S= RC_SEL is 1, > > > > it can do it's DCXO tunning, or whatever. But neither OS nor bootlo= ader will > > > > be using this info to gate/disable the osciallator. > > > >=20 > > >=20 > > > It is actually useful to be able to tweak the crystal tuning at > > > runtime to be able to reduce clock drift and compare with a reliable > > > source (e.g. NTP). > >=20 > > I don't think there's a Linux kernel API that you can use to achieve th= at, so > > that's a rather theoretical concern at the moment. > >=20 >=20 > There is /sys/class/rtc/rtcX/offset which is even properly documented. >=20 > The reason I asked is that some RTCs have both analog (changing the > oscillator capacitance) and digital (changing the RTC counter) so I'm > wondering whether this interface should be extended. As I wrote below, that can't be achieved by tuning DCXO. > > Also there are multiple clocks, that can drive the RTC, and you usually= don't > > drive it from 24MHz DCXO oscillator. The reason is that you'd have to d= eal with > > the fact that the clock for RTC then becomes 24000000/750 (750 is fixed > > divider), which is 32000. > >=20 > > So if you want to get 32768Hz for RTC by tuning the DCXO, it would have= to have > > 24 576 000 Hz. And even if you could achieve that (doubtful), it would = throw off > > timings in the rest of the system (say UART, USB, CPU, display ctl) in = a major way. > >=20 > > I guess you can try tuning 24MHz oscillator so that it's closer to the > > real-world 24MHz via NTP reference for other reasons. But it would be > > complicated, and require precise interaction with other components, lik= e using > > HW timers sourced from 24MHz HOSC clock, because you can't use CPU's ti= mers, > > because of inaccuracies introduced during DVFS, for example. > >=20 > > regards, > > o. > >=20 > > > I'm curious, what kind of options does this RTC have? > > >=20 > > > --=20 > > > Alexandre Belloni, Bootlin > > > Embedded Linux and Kernel engineering > > > https://bootlin.com > > >=20 > > > _______________________________________________ > > > linux-arm-kernel mailing list > > > linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org > > > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >=20 > --=20 > Alexandre Belloni, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com >=20 > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --=20 You received this message because you are subscribed to the Google Groups "= linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web, visit https://groups.google.com/d/msgid= /linux-sunxi/20190809091626.6kanjbmvbi4oipco%40core.my.home.