Re: [PATCH v7 06/19] rtc: sun6i: Add support for RTCs without external LOSCs

Icenowy Zheng
2021-07-29T08:07:03Z

在 2021-06-16星期三的 11:14 +0200，Maxime Ripard写道：
> Hi,
>
> On Tue, Jun 15, 2021 at 12:06:23PM +0100, Andre Przywara wrote:
> > Some newer Allwinner RTCs (for instance the one in the H616 SoC)
> > lack
> > a pin for an external 32768 Hz oscillator. As a consequence, this
> > LOSC
> > can't be selected as the RTC clock source, and we must rely on the
> > internal RC oscillator.
> > To allow additions of clocks to the RTC node, add a feature bit to
> > ignore
> > any provided clocks for now (the current code would think this is
> > the
> > external LOSC). Later DTs and code can then for instance add the
> > PLL
> > based clock input, and older kernel won't get confused.
> >
> > Signed-off-by: Andre Przywara <andre.przywara@arm.com>
>
> Honestly, I don't really know if it's worth it at this point.
>
> If we sums this up:
>
>  - The RTC has 2 features that we use, mostly centered around 2
>    registers set plus a global one
>
>  - Those 2 features are programmed in a completely different way
>
>  - Even the common part is different, given the discussion around the
>    clocks that we have.
>
> What is there to share in that driver aside from the probe, and maybe
> the interrupt handling? Instead of complicating this further with
> more
> special case that you were (rightfully) complaining about, shouldn't
> we
> just acknowledge the fact that it's a completely separate design and
> should be treated as such, with a completely separate driver?

I think our problem is just that we're having a single driver for both
functionalities (clock manager and RTC).

Personally I don't think we should have seperated driver for clock
managers, although I am fine with seperated RTC driver for linear days.

By the way, not having a LOSC is only what happens on H616, maybe
because there should never be a battery-backed H616 device. On R329,
the RTC part has linear day storage, but it still have LOSC. Because of
this, I don't think we should duplicate at least at least the current
sun6i-rtc dual-functionality driver, because the clock funtionality is
just the same with previous SoCs on R329.

>
> Maxime