On Sat, Apr 07, 2018 at 08:39:43PM +0200, Mark Kettenis wrote:
> I have an RK3399 system that has two RTCs.  One of those is the RTC
> integrated on the RK808 PMIC that is a companion chip to the RK3399.
> The second one is an ISL1208 I2C chip.  Only the ISL1208 is battery
> powered, so obviously we want to use that one.  But rkpmic(4) attaches
> after islrtc(4) on this board and therefore it wins.  The diff below
> makes sure the RTC of the RK808 PMIC is only enabled if no other RTC
> installed itself.
> 

Off-topic, but related enough i hope.
instead of fixing up RTCVDD(lack of battery) on all my sunxi boards,
i'm going to rather add cheap&separate I2C RTCs for each.

What do you think about kern.timecounter.{choice,hardware}-type solution?

i'm kind of covered, either way, as maxrtc(4) does this in maxrtc_attach():
126         /* register our time handlers */
127         if (todr_handle != NULL) {                                          
128                 printf("%s: overwriting existing rtc handler\n",
129                     sc->sc_dev.dv_xname);
130         }
131         /* XXX just overwrite existing rtc handler? */
132         todr_handle = &sc->sc_todr;

-Artturi

> ok?
> 
> 
> Index: dev/fdt/rkpmic.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/fdt/rkpmic.c,v
> retrieving revision 1.4
> diff -u -p -r1.4 rkpmic.c
> --- dev/fdt/rkpmic.c  25 Feb 2018 20:43:33 -0000      1.4
> +++ dev/fdt/rkpmic.c  7 Apr 2018 18:31:41 -0000
> @@ -127,7 +127,8 @@ rkpmic_attach(struct device *parent, str
>       sc->sc_todr.cookie = sc;
>       sc->sc_todr.todr_gettime = rkpmic_gettime;
>       sc->sc_todr.todr_settime = rkpmic_settime;
> -     todr_handle = &sc->sc_todr;
> +     if (todr_handle == NULL)
> +             todr_handle = &sc->sc_todr;
>  
>       if (OF_is_compatible(node, "rockchip,rk805")) {
>               chip = "RK805";
> 

Reply via email to