All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ondřej Jirman" <megous@megous.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Chen-Yu Tsai <wens@csie.org>, Mark Rutland <mark.rutland@arm.com>,
	Alessandro Zummo <a.zummo@towertech.it>,
	devicetree <devicetree@vger.kernel.org>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-sunxi <linux-sunxi@googlegroups.com>,
	Rob Herring <robh+dt@kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	linux-rtc@vger.kernel.org
Subject: Re: [linux-sunxi] [PATCH 0/3] Add basic support for RTC on Allwinner H6 SoC
Date: Thu, 8 Aug 2019 14:12:37 +0200	[thread overview]
Message-ID: <20190808121237.g6twq2nh3sayu3vx@core.my.home> (raw)
In-Reply-To: <20190807105502.GK3600@piout.net>

On Wed, Aug 07, 2019 at 12:55:02PM +0200, Alexandre Belloni wrote:
> Hi,
> 
> On 06/08/2019 20:30:45+0200, Ondřej Jirman wrote:
> > Maybe whether XO or DCXO is used also matters if you want to do some 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 source from DT.
> > The driver can just check compatible, and if it is H6 and OSC_CLK_SRC_SEL is 1,
> > it can do it's DCXO tunning, or whatever. But neither OS nor bootloader will
> > be using this info to gate/disable the osciallator.
> > 
> 
> 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).

I don't think there's a Linux kernel API that you can use to achieve that, so
that's a rather theoretical concern at the moment.

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 deal with
the fact that the clock for RTC then becomes 24000000/750 (750 is fixed
divider), which is 32000.

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.

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, like using
HW timers sourced from 24MHz HOSC clock, because you can't use CPU's timers,
because of inaccuracies introduced during DVFS, for example.

regards,
	o.

> I'm curious, what kind of options does this RTC have?
> 
> -- 
> Alexandre Belloni, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: "Ondřej Jirman" <megous-5qf/QAjKc83QT0dZR+AlfA@public.gmane.org>
To: Alexandre Belloni
	<alexandre.belloni-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
Cc: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Alessandro Zummo
	<a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org>,
	devicetree <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Maxime Ripard
	<maxime.ripard-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>,
	linux-kernel
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-sunxi <linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	linux-arm-kernel
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	linux-rtc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 0/3] Add basic support for RTC on Allwinner H6 SoC
Date: Thu, 8 Aug 2019 14:12:37 +0200	[thread overview]
Message-ID: <20190808121237.g6twq2nh3sayu3vx@core.my.home> (raw)
In-Reply-To: <20190807105502.GK3600-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>

On Wed, Aug 07, 2019 at 12:55:02PM +0200, Alexandre Belloni wrote:
> Hi,
> 
> On 06/08/2019 20:30:45+0200, Ondřej Jirman wrote:
> > Maybe whether XO or DCXO is used also matters if you want to do some 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 source from DT.
> > The driver can just check compatible, and if it is H6 and OSC_CLK_SRC_SEL is 1,
> > it can do it's DCXO tunning, or whatever. But neither OS nor bootloader will
> > be using this info to gate/disable the osciallator.
> > 
> 
> 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).

I don't think there's a Linux kernel API that you can use to achieve that, so
that's a rather theoretical concern at the moment.

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 deal with
the fact that the clock for RTC then becomes 24000000/750 (750 is fixed
divider), which is 32000.

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.

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, like using
HW timers sourced from 24MHz HOSC clock, because you can't use CPU's timers,
because of inaccuracies introduced during DVFS, for example.

regards,
	o.

> I'm curious, what kind of options does this RTC have?
> 
> -- 
> Alexandre Belloni, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
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 email 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/20190808121237.g6twq2nh3sayu3vx%40core.my.home.

WARNING: multiple messages have this Message-ID (diff)
From: "Ondřej Jirman" <megous@megous.com>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Alessandro Zummo <a.zummo@towertech.it>,
	devicetree <devicetree@vger.kernel.org>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	linux-sunxi <linux-sunxi@googlegroups.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Chen-Yu Tsai <wens@csie.org>, Rob Herring <robh+dt@kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	linux-rtc@vger.kernel.org
Subject: Re: [linux-sunxi] [PATCH 0/3] Add basic support for RTC on Allwinner H6 SoC
Date: Thu, 8 Aug 2019 14:12:37 +0200	[thread overview]
Message-ID: <20190808121237.g6twq2nh3sayu3vx@core.my.home> (raw)
In-Reply-To: <20190807105502.GK3600@piout.net>

On Wed, Aug 07, 2019 at 12:55:02PM +0200, Alexandre Belloni wrote:
> Hi,
> 
> On 06/08/2019 20:30:45+0200, Ondřej Jirman wrote:
> > Maybe whether XO or DCXO is used also matters if you want to do some 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 source from DT.
> > The driver can just check compatible, and if it is H6 and OSC_CLK_SRC_SEL is 1,
> > it can do it's DCXO tunning, or whatever. But neither OS nor bootloader will
> > be using this info to gate/disable the osciallator.
> > 
> 
> 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).

I don't think there's a Linux kernel API that you can use to achieve that, so
that's a rather theoretical concern at the moment.

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 deal with
the fact that the clock for RTC then becomes 24000000/750 (750 is fixed
divider), which is 32000.

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.

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, like using
HW timers sourced from 24MHz HOSC clock, because you can't use CPU's timers,
because of inaccuracies introduced during DVFS, for example.

regards,
	o.

> I'm curious, what kind of options does this RTC have?
> 
> -- 
> Alexandre Belloni, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-08-08 12:12 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12 12:07 [PATCH 0/3] Add basic support for RTC on Allwinner H6 SoC megous
2019-04-12 12:07 ` megous
2019-04-12 12:07 ` megous via linux-sunxi
2019-04-12 12:07 ` [PATCH 1/3] dt-bindings: Add compatible for H6 RTC megous
2019-04-12 12:07   ` megous
2019-04-12 12:07   ` megous via linux-sunxi
2019-08-05 10:16   ` [linux-sunxi] " Chen-Yu Tsai
2019-08-05 10:16     ` Chen-Yu Tsai
2019-08-05 10:16     ` Chen-Yu Tsai
2019-04-12 12:07 ` [PATCH 2/3] rtc: sun6i: Add support " megous
2019-04-12 12:07   ` megous
2019-04-12 12:07   ` megous via linux-sunxi
2019-08-05 10:16   ` [linux-sunxi] " Chen-Yu Tsai
2019-08-05 10:16     ` Chen-Yu Tsai
2019-08-05 10:16     ` Chen-Yu Tsai
2019-08-05 10:20     ` [linux-sunxi] " Ondřej Jirman
2019-08-05 10:20       ` Ondřej Jirman
2019-08-05 10:45     ` Ondřej Jirman
2019-08-05 10:45       ` Ondřej Jirman
2019-08-05 10:45       ` Ondřej Jirman
2019-08-05 10:54       ` [linux-sunxi] " Chen-Yu Tsai
2019-08-05 10:54         ` Chen-Yu Tsai
2019-08-05 11:10         ` Ondřej Jirman
2019-08-05 11:10           ` Ondřej Jirman
2019-08-05 11:10           ` Ondřej Jirman
2019-08-05 11:21           ` [linux-sunxi] " Chen-Yu Tsai
2019-08-05 11:21             ` Chen-Yu Tsai
2019-08-05 11:21             ` Chen-Yu Tsai
2019-08-05 12:16           ` [linux-sunxi] " Clément Péron
2019-08-05 12:16             ` Clément Péron
2019-04-12 12:07 ` [PATCH 3/3] arm64: dts: sun50i-h6: Add support for RTC and fix the clock tree megous
2019-04-12 12:07   ` megous
2019-04-12 12:07   ` megous via linux-sunxi
2019-04-15  8:18 ` [linux-sunxi] [PATCH 0/3] Add basic support for RTC on Allwinner H6 SoC Chen-Yu Tsai
2019-04-15  8:18   ` Chen-Yu Tsai
2019-04-15  8:18   ` Chen-Yu Tsai
2019-04-15 14:22   ` [linux-sunxi] " Ondřej Jirman
2019-04-15 14:22     ` Ondřej Jirman
2019-04-15 14:22     ` 'Ondřej Jirman' via linux-sunxi
2019-04-15 14:33     ` [linux-sunxi] " Maxime Ripard
2019-04-15 14:33       ` Maxime Ripard
2019-04-15 14:33       ` Maxime Ripard
2019-04-15 14:39       ` [linux-sunxi] " Chen-Yu Tsai
2019-04-15 14:39         ` Chen-Yu Tsai
2019-04-15 14:39         ` Chen-Yu Tsai
2019-04-15 14:35     ` [linux-sunxi] " Chen-Yu Tsai
2019-04-15 14:35       ` Chen-Yu Tsai
2019-04-15 14:35       ` Chen-Yu Tsai
2019-04-15 15:17       ` [linux-sunxi] " Ondřej Jirman
2019-04-15 15:17         ` Ondřej Jirman
2019-04-15 15:17         ` 'Ondřej Jirman' via linux-sunxi
2019-08-06 18:30   ` [linux-sunxi] " Ondřej Jirman
2019-08-06 18:30     ` Ondřej Jirman
2019-08-06 18:30     ` Ondřej Jirman
2019-08-06 22:27     ` [linux-sunxi] " Ondřej Jirman
2019-08-06 22:27       ` Ondřej Jirman
2019-08-06 22:27       ` Ondřej Jirman
2019-08-07 10:55     ` [linux-sunxi] " Alexandre Belloni
2019-08-07 10:55       ` Alexandre Belloni
2019-08-07 10:55       ` Alexandre Belloni
2019-08-08  5:48       ` [linux-sunxi] " Chen-Yu Tsai
2019-08-08  5:48         ` Chen-Yu Tsai
2019-08-08  5:48         ` Chen-Yu Tsai
2019-08-08 12:12       ` Ondřej Jirman [this message]
2019-08-08 12:12         ` [linux-sunxi] " Ondřej Jirman
2019-08-08 12:12         ` Ondřej Jirman
2019-08-08 23:39         ` [linux-sunxi] " Alexandre Belloni
2019-08-08 23:39           ` Alexandre Belloni
2019-08-08 23:39           ` Alexandre Belloni
2019-08-09  9:16           ` [linux-sunxi] " Ondřej Jirman
2019-08-09  9:16             ` Ondřej Jirman
2019-08-09  9:16             ` Ondřej Jirman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190808121237.g6twq2nh3sayu3vx@core.my.home \
    --to=megous@megous.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=mark.rutland@arm.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=robh+dt@kernel.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.