Hi, i have custom board with ds1390 rtc. I have made it work with colibri imx8x-v10b after modifying lpspi2 node indts
&lpspi2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lpspi2>;
cs-gpios = <&lsio_gpio1 0 GPIO_ACTIVE_LOW>;
status = "okay";
/* disable standart can device at spi */
mcp2515: can@0 {
compatible = "microchip,mcp2515";
status = "disabled";
};
/* add ds1390 rtc support */
rtc_spi: ds1390@0 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "dallas,ds1390";
reg = <0>;
spi-max-frequency = <4000000>;
status = "okay";
trickle-resistor-ohms = <250>;
trickle-diode-disable = <1>;
};
spidev0: spidev@0 {
status = "disabled";
}; };
Now i want it work with colibri imx6dl. I’ve added this config to dts
&ecspi4 {
cs-gpios = <&gpio5 2 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi4>;
status = "okay";
spidev0: spidev@0 {
compatible = "toradex,evalspi";
status = "disabled";
};
/* add ds1390 rtc support */
rtc_spi: ds1390@0 {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
compatible = "dallas,ds1390";
reg = <0>;
spi-max-frequency = <4000000>;
trickle-resistor-ohms = <250>;
trickle-diode-disable = <1>;
};
};
But it’s not working. Here is my dmesg.
I have found the issue. The spi was not loaded without udev service, which i disabled in my cutom image. I’ve enabled udev and now rtc is working, but it is not synchronizing system time with hwclock automatically, so i have to use hwclock -s command.
root@colibri-imx6:~# dmesg | grep spi
[ 3.055471] rtc-ds1390 spi3.0: registered as rtc0
[ 3.079705] spi_imx 2014000.spi: probed
root@colibri-imx6:~# dmesg | grep rtc
[ 1.281945] snvs_rtc 20cc000.snvs:snvs-rtc-lp: registered as rtc1
[ 1.882727] hctosys: unable to open rtc device (rtc0)
[ 3.055471] rtc-ds1390 spi3.0: registered as rtc0
Why it’s not loaded without udev service and not sync time at booting, like when i use col imx8x-v10b with the same image.
root@imx8x-v10b:~# dmesg | grep spi
[ 0.637320] rtc-ds1390 spi0.0: registered as rtc0
[ 0.808984] rtc-ds1390 spi0.0: setting system clock to 2013-11-19T12:20:17 UTC (1384863617)
root@imx8x-v10b:~# dmesg | grep rtc
[ 0.473038] imx-sc-rtc scu:rtc: registered as rtc1
[ 0.633573] imx-drm display-subsystem: bound imx-dpu-crtc.0 (ops dpu_crtc_ops)
[ 0.634141] imx-drm display-subsystem: bound imx-dpu-crtc.1 (ops dpu_crtc_ops)
[ 0.637320] rtc-ds1390 spi0.0: registered as rtc0
[ 0.691264] imx-drm display-subsystem: bound imx-dpu-crtc.0 (ops dpu_crtc_ops)
[ 0.691583] imx-drm display-subsystem: bound imx-dpu-crtc.1 (ops dpu_crtc_ops)
[ 0.808984] rtc-ds1390 spi0.0: setting system clock to 2013-11-19T12:20:17 UTC (1384863617)
Hi @shkipper12 !
Please, take a look at this article about RTC usage on Linux: Real-Time Clock / RTC (Linux) | Toradex Developer Center
Some questions:
- Does your module have internet access?
- Is the time service responsible for accessing NTP servers is enabled?
- Have you set the Udev rule to your SPI RTC?
Best regards!
hi @henrique.tx. Thanks for reply .
I’ve tried to create the rule with following line:
KERNEL=="rtc0", SUBSYSTEM=="rtc", DRIVER=="", ATTR{name}=="rtc-ds1390 spi3.0", SYMLINK="rtc", MODE="0666"
But neither rtc or spi loaded
Here is the info from udevadm. Can you help me with correct udev rule?
Hi @henrique.tx, thanks for advice. i will give it a shot
Hi @shkipper12 !
To better understand udev rules, you can use the udevadm command.
Some examples that might help you (maybe you need to try rtc / rtc0 / rtc1):
udevadm info --attribute-walk --name=rtc
udevadm info --query=all path -n /dev/rtc