I have a carrier with an MCP7940N RTC chip in i2c bus 1 at address 6f.
The device tree overlay includes:
&i2c1 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
/* real time clock on carrier board */
rtc_i2c: rtc@6f {
compatible = "microchip,mcp7940x";
reg = <0x6f>;
status = "okay";
};
};
According to https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/rtc/rtc-ds1307.txt, this string looks like the correct “compatible” for the driver to use the microchip part.
The reg statement is what changes the RTC’s i2c address. OK so far.
We soft reboot the board. Then we check the dmesg log (the kernel ring buffer). The system is clearly finding the RTC at address 6f (device tree above must be operative). All is well!
# dmesg | grep rtc
[ 1.749502] rtc-ds1307 0-006f: registered as rtc0
[ 1.751064] snvs_rtc 20cc000.snvs:snvs-rtc-lp: registered as rtc1
[ 3.760173] rtc-ds1307 0-006f: setting system clock to 2021-04-17T15:18:09 UTC (1618672689)
But if we cold start. Then we check the dmesg log:
# dmesg | grep rtc
[ 1.749499] rtc-ds1307 0-006f: registered as rtc0
[ 1.751128] snvs_rtc 20cc000.snvs:snvs-rtc-lp: registered as rtc1
[ 3.004759] rtc-ds1307 0-006f: setting system clock to 2000-01-01T00:00:00 UTC (946684800)
Note: BSP 2.8.6 works fine . I’m not sure where to look now. I’m assuming the overlay is working since the kernel is finding a clock at address 6f. I don’t understand why power on reset is different from soft reboot here.
Also, I know something is working because if I reboot the system cold, then soft-reboot without setting the RTC with /sbin/hwclock --systohc, the time is still 2000.
I’m sure the issue is a typing error in the overlay… but I can’t see it.