RTC bq32000 not discovery

Hi,

I would like to add to the Rock PI S board the management of the RTC BQ32000 using the i2c-0 bus.

I recompiled the linux kernel with the support “module” for bq32000 getting the file “rtc-bq32k.ko”

I created the “.dts” file to overlay the device to insert in the device tree:

// Definitions for bq32000 module
/dts-v1/;
/plugin/;

/ {
    compatible = "rockchip,rk3308";

    fragment@0 {
        target = <&i2c0>;
        __dormant__ {
            #address-cells = <1>;
            #size-cells = <0>;

            status = "okay";

            bq32000: rtc@68 {
                compatible = "ti,bq32000";
                trickle-resistor-ohms = <1120>;
                reg = <0x68>;
                status = "okay";
            };
        };
    };
};

and compiled with “dtc” obtaining the “.dbto” file.

I edited the “/boot/uEnv.txt” file for add i2c-0 and bq32000:

overlays=rk3308-i2c0 i2c0-bq32000

I edited the “/etc/modules-load.d/modules.conf” to load kernel module:

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

# rtc bq32000
rtc-bq32k

After reboot I have checked i2c-0 bus:

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

RTC is on the bus.

I checked the dmesg log but “rtc” does not appear and kernel module is loaded:

Module                  Size  Used by
rtl8723ds            1708032  0
rtc_bq32k              16384  0
w1_therm               16384  0
w1_gpio                16384  0
wire                   28672  2 w1_gpio,w1_therm
cn                     16384  1 wire

What’s missing to make rtc bq32000 work ?

Try to decompile the live dtb to check if the dtbo is correctly loaded, also manually insmod the driver to check if there is more dmesg. It looks like the driver is not probed at all.

Hi,

thank you for your suggestion, i found my mistake:

replace dormant with overlay.

If anyone needs it, I wrote the “overlays” for three RTCs:

// Definitions for bq32000 module
/dts-v1/;
/plugin/;

/ {
    compatible = "rockchip,rk3308";

    fragment@0 {
        target = <&i2c0>;
        __overlay__ {
            #address-cells = <1>;
            #size-cells = <0>;

            status = "okay";

            bq32000: rtc@68 {
                compatible = "ti,bq32000";
                trickle-resistor-ohms = <1120>;
                reg = <0x68>;
                status = "okay";
            };
        };
    };
};

// Definitions for ds1307 module
/dts-v1/;
/plugin/;

/ {
    compatible = "rockchip,rk3308";

    fragment@0 {
        target = <&i2c0>;
        __overlay__ {
            #address-cells = <1>;
            #size-cells = <0>;

            status = "okay";

            ds1307: rtc@68 {
                compatible = "dallas,ds1307";
                wakeup-source = <1>;
                reg = <0x68>;
                status = "okay";
            };
        };
    };
};

// Definitions for ds3231 module
/dts-v1/;
/plugin/;

/ {
    compatible = "rockchip,rk3308";

    fragment@0 {
        target = <&i2c0>;
        __overlay__ {
            #address-cells = <1>;
            #size-cells = <0>;

            status = "okay";

            ds3232: rtc@68 {
                compatible = "dallas,ds3232";
                reg = <0x68>;
                status = "okay";
            };
        };
    };
};

RTC BQ32000 is now correctly recognized.

Thank you so much for your help.

1 Like