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.

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