RTC hwclock ioctl error

Hi,

Currently we are using the colibri imx6dl V1.1 A SOM module and connecting to an external RTC of m41t01 using I2C1 on our custom board.
The device tree files and changes done is as follows:
aliases {
i2c0 = &i2c1;
i2c1 = &i2c3;
}; aliases {
rtc0 = &rtc_i2c;
rtc1 = &snvs_rtc;
}; /&i2c3 {
status = “okay”; /
M41T0M6 real time clock on carrier board
rtc_i2c: rtc@68 {
compatible = “st,m41t0”;
reg = <0x68>;
};
}; / &i2c1 {
status = “okay”; /
M41T0M6 real time clock on Development board*/
rtc_i2c: rtc@68 {
compatible = “st,m41t0”;
reg = <0x68>;
};
};
pinctrl_i2c1: i2c1grp {
fsl,pins = <
MX6QDL_PAD_CSI0_DAT9__I2C1_SCL 0x4001b8b1
MX6QDL_PAD_CSI0_DAT8__I2C1_SDA 0x4001b8b1 >;
}; &i2c1 {
clock-frequency = <100000>;
pinctrl-names = “default”;
pinctrl-0 = <&pinctrl_i2c1>;
scl-gpios = <&gpio5 27 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
sda-gpios = <&gpio5 26 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
status = “okay”;
};

root@b2qt-colibri-imx6:~# dmesg | grep rtc
[ 1.805061] rtc-ds1307 0-0068: registered as rtc0
[ 1.810628] snvs_rtc 20cc000.snvs:snvs-rtc-lp: registered as rtc1
[ 2.596303] rtc-ds1307 0-0068: hctosys: unable to read the hardware clock
root@b2qt-colibri-imx6:~# hwclock -s
hwclock: ioctl(3, RTC_UIE_ON, 0) to /dev/rtc0 failed: Connection timed out

root@b2qt-colibri-imx6:~# dmesg | grep rtc
[ 1.805061] rtc-ds1307 0-0068: registered as rtc0
[ 1.810628] snvs_rtc 20cc000.snvs:snvs-rtc-lp: registered as rtc1
[ 2.596303] rtc-ds1307 0-0068: hctosys: unable to read the hardware clock
[ 57.633366] rtc-ds1307 0-0068: read error -110
[ 58.143407] rtc-ds1307 0-0068: read error -110
[ 58.653964] rtc-ds1307 0-0068: read error -110
I was able to register the RTC to rtc0, however I am getting the error when trying to assign the hwclock and also referred

Thanks in advance
Basavanagouda G

Hi @Basava.lg ,

Please send your device tree changes in proper format (may be a patch file) which is easier to read.
Also, can you send us the output of

  1. dmesg logs
  2. ls -la /sys/class/i2c-dev
  3. i2cdetect -y -r
  4. Image version

Dear Sahil,
Thanks for your response,

Here are the required details you required for further clarification

The board being used is colibri imx6dl 512mb v1.1A
Kernel version: 4.14.170-0+git.62ad468b3107
QT framework 5.15.2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3.
i2cdetect -y -r 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – – – – – – – – – –
10: – – – – – – – – – – – – – – – –
20: – – – – – – – – – – – – – – – –
30: – – – – – – – – – – – – – – – –
40: – – – – – – – – – – – – – – – –
50: – – – – – – – – – – – – – – – –
60: – – – – – – – – UU – – – – – – –
70: – – – – – – – –

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2.
ls -la /sys/class/i2c-dev/
total 0
drwxr-xr-x 2 root root 0 Feb 4 21:04 .
drwxr-xr-x 51 root root 0 Feb 4 21:04 …
lrwxrwxrwx 1 root root 0 Feb 4 21:04 i2c-0 → …/…/devices/soc0/soc/2100000.aips-bus/21a0000.i2c/i2c-0/i2c-dev/i2c-0
lrwxrwxrwx 1 root root 0 Feb 4 21:04 i2c-4 → …/…/devices/soc0/i2c@0/i2c-4/i2c-dev/i2c-4
lrwxrwxrwx 1 root root 0 Feb 4 21:04 i2c-5 → …/…/devices/soc0/soc/2100000.aips-bus/21a4000.i2c/i2c-5/i2c-dev/i2c-5
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Also please find the attachment for the dmesg logs and device tree diff file
rtc.diff (37.7 KB)
dmesg.log (24.4 KB)

Thanks and Regards,

Basavanagouda G

Dear Sahil,

Any updates on the same.

Thanks and Regards

Hi @Basava.lg ,
I am testing the same, will update you in few hours

Dear Sahil,

Thanks for your support, I was able to connect successfully interface the external RTC with I2C1.
The issue was with the hw clock assigned to the I2C1

Thanks and Regards,

Basavanagouda

Hi @Basava.lg ,
Nice to hear that the issue is solved.