Re: [PATCH v6 05/17] rtc: sun6i: Add Allwinner H616 support

From: Andre Przywara
Date: Sat May 22 2021 - 20:07:11 EST


On Sat, 22 May 2021 09:29:26 +0200
Jernej Škrabec <jernej.skrabec@xxxxxxxxx> wrote:

Hi,

> Dne sreda, 19. maj 2021 ob 12:41:40 CEST je Andre Przywara napisal(a):
> > The H616 RTC changes its day storage to the newly introduced linear day
> > scheme, so pair the new compatible string with this feature flag.
> > So far the clock parts seem to be the same as the H6, so combine the
> > compatible string with the existing H6 support bits.
>
> There is one more difference - H616 alarm value is now broken down to days,
> hours, minutes and seconds.

That's a good point, that actually requires adjusting the driver in
this respect as well. And contrary to what the manual says ("Counter
Register will down count to zero"), and the previous RTCs do, those alarm
registers now need to be set to the actual wakeup time, not the time
left before wakeup.
Will fix the driver accordingly.

Thanks for the heads up!

Cheers,
Andre

>
> Best regards,
> Jernej
>
> >
> > Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx>
> > ---
> > drivers/rtc/rtc-sun6i.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/rtc/rtc-sun6i.c b/drivers/rtc/rtc-sun6i.c
> > index 0228e9dfd969..ec0cd0ee539a 100644
> > --- a/drivers/rtc/rtc-sun6i.c
> > +++ b/drivers/rtc/rtc-sun6i.c
> > @@ -382,6 +382,8 @@ static void __init sun50i_h6_rtc_clk_init(struct
> device_node *node)
> > }
> > CLK_OF_DECLARE_DRIVER(sun50i_h6_rtc_clk, "allwinner,sun50i-h6-rtc",
> > sun50i_h6_rtc_clk_init);
> > +CLK_OF_DECLARE_DRIVER(sun50i_h616_rtc_clk, "allwinner,sun50i-h616-rtc",
> > + sun50i_h6_rtc_clk_init);
> >
> > /*
> > * The R40 user manual is self-conflicting on whether the prescaler is
> > @@ -773,6 +775,8 @@ static const struct of_device_id sun6i_rtc_dt_ids[] = {
> > { .compatible = "allwinner,sun8i-v3-rtc" },
> > { .compatible = "allwinner,sun50i-h5-rtc" },
> > { .compatible = "allwinner,sun50i-h6-rtc" },
> > + { .compatible = "allwinner,sun50i-h616-rtc",
> > + .data = (void *)RTC_LINEAR_DAY },
> > { /* sentinel */ },
> > };
> > MODULE_DEVICE_TABLE(of, sun6i_rtc_dt_ids);
> > --
> > 2.17.5
> >
> >
>
>