rtc: sun6i: Expose the 32kHz oscillator
authorMaxime Ripard <maxime.ripard@free-electrons.com>
Mon, 23 Jan 2017 10:41:49 +0000 (11:41 +0100)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Wed, 1 Feb 2017 11:44:18 +0000 (12:44 +0100)
commit3855c2c3e5461ab5ece9c1578650fcc23dd248c2
treece61421ea80b304ef924be9bc12a33b4582e3431
parentfb61bb82cb46a932ef2fc62e1c731c8e7e6640d5
rtc: sun6i: Expose the 32kHz oscillator

The RTC controls the input source of the main 32kHz oscillator in the
system, feeding it to the clock unit too.

By default, this is using an internal, very inaccurate (+/- 30%)
oscillator with a divider to make it roughly around 32kHz. This is however
quite impractical for the RTC, since our time will not be tracked properly.

Since this oscillator is an input of the main clock unit, and since that
clock unit will be probed using CLK_OF_DECLARE, we have to use it as well,
leading to a two stage probe: one to enable the clock, the other one to
enable the RTC.

There is also a slight change in the binding that is required (and should
have been from the beginning), since we'll need a phandle to the external
oscillator used on that board. We support the old binding by not allowing
to switch to the external oscillator and only using the internal one (which
was the previous behaviour) in the case where we're missing that phandle.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Documentation/devicetree/bindings/rtc/sun6i-rtc.txt
drivers/rtc/rtc-sun6i.c