RTC driver is not loaded

Hello! I am using the iMX6ULL on a custom carrier board that includes the RTC PCF8563. I am using a custom Linux BSP 5 and included the driver for this RTC. The problem is that the RTC driver is not loaded after booting, as you can see:

[    0.982602] snvs_rtc 20cc000.snvs:snvs-rtc-lp: registered as rtc0
[    1.472081] snvs_rtc 20cc000.snvs:snvs-rtc-lp: setting system clock to 1970-01-01T00:00:00 UTC (0)

However, the RTC is visible on the I2C bus, with the address 0x51:

i2cdetect -y -r 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- 2a -- -- -- -- --
30: -- -- -- -- -- -- -- 37 -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- 51 -- -- -- -- -- 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

This is the .config file I am using and you can see that the line CONFIG_RTC_DRV_PCF8563=y is configured correctly. Also, I did not find the driver in the built image, in lib\modules\5.4.91-5.2.0-devel+git.590db576d04d\kernel\drivers\i2c.

What is wrong here?

Can you show your devicetree changes for the I2C node? If you didn’t add it there, it’s not going to register upon boot.

It’s not enough to include a driver by Kernel Config. As stated by @lkoziarz you also need to do a proper bindings at Device Tree. Please note how it’s done for M41T0M6 real time clock on Colibri evaluation board. You should do a similar for PCF8563. Please check this document.

Thank you. That was the problem.

Thank you. I added the following and the RTC is loaded:

pcf8563: pcf8563@51 {
	compatible = "nxp,pcf8563";
	reg = <0x51>;
	#clock-cells = <0>;
};

However, when trying the wakeup alarm feature (rtc0 is my device; rtc1 is the internal SoC RTC), I get the message that the Device or resource is busy when giving commands after the first command:

root@colibri-imx6ull:~# echo +10 > /sys/class/rtc/rtc0/wakealarm
root@colibri-imx6ull:~# echo +10 > /sys/class/rtc/rtc0/wakealarm
-sh: echo: write error: Device or resource busy

As seen, the first command is OK, but subsequent commands return Device or resource is busy, even after the 10 seconds have passed. Also, the SoC never returns from suspend. I’ve measured the output of the RTC’s wakeup output pin and it does not change.

I confirm that my RTC’s wakeup pin is connected to SODIMM 45 (which is a wakeup source - verified using cat /sys/kernel/debug/gpio) and the suspend-wakeup procedure works when using the internal RTC (rtc1).

I mention that I get the same error with rtc1 when giving the command before the 10 seconds have passed. Also, after giving the command above, the contents of the wakealarm file (read using cat /sys/class/rtc/rtc0/wakealarm) represents the correct Unix timestamp, but never changes, even after the 10 seconds have passed, whereas in the case of rtc1 the file is empty after the 10 s.

Is this a driver-related problem? Or do I need to configure something in the device tree? Any suggestions?

Looks like as a driver or HW issue. Is time read/set works as expected? If so can you try to set alarm using IOCTL and the check if SODIMM 45 will change a state at alarm time?

It seems the pullup was too high (100k). I changed it to 4.7k and it works. Thank you!

Glad your problem has been solved. Thank you for the update.