[LEDE-DEV] [PATCH] ramips: Add I2C driver to the default kernel config

Gagan Sidhu broly at mac.com
Sat Mar 3 13:13:51 PST 2018


hey man,

i was wondering if you could help me out with my RTC problem.

currently, i’ve managed to get the rtc/i2c drivers to load but they’re not functioning properly.

specifically, i cannot ‘get’ any value from the rtc without an “invalid argument” being returned.

i have seen your patch post a few times and i wanted to make sure that i tried everything before asking, so i hope maybe you’d have some tips?

this is the relevant output (i have tried to enable the UIE_EMUL option, but this doesn’t seem to help. same with different i2c drivers):

> root at DD-WRT:~# hwclock --debug --systohc
> hwclock from util-linux 2.31.53-82524
> System Time: 85.960873
> Trying to open: /dev/rtc0
> Using the rtc interface to the clock.
> Assuming hardware clock is kept in UTC time.
> missed it - 85.961765 is too far past 85.500000 (0.461765 > 0.001000)
> 86.500020 is close enough to 86.500000 (0.000020 < 0.002000)
> Set RTC to 86 (85 + 1; refsystime = 85.000000)
> Setting Hardware Clock to 00:01:26 = 86 seconds since 1969
> ioctl(RTC_SET_TIME) was successful.
> Not adjusting drift factor because the --update-drift option was not used.
> New /etc/adjtime data:
> 0.000000 85 0.000000
> 85
> UTC

> root at DD-WRT:~# hwclock --debug --hctosys
> hwclock from util-linux 2.31.53-82524
> System Time: 90.048837
> Trying to open: /dev/rtc0
> Using the rtc interface to the clock.
> Last drift adjustment done at 85 seconds after 1969
> Last calibration done at 85 seconds after 1969
> Hardware clock is on UTC time
> Assuming hardware clock is kept in UTC time.
> Waiting for clock tick...
> ioctl(3, RTC_UIE_ON, 0): Invalid argument
> Waiting in loop for time from /dev/rtc0 to change
> hwclock: ioctl(RTC_RD_TIME) to /dev/rtc0 to read the time failed: Invalid argument
> ...synchronization failed


the init for the i2c driver seems okay(?):

> usbcore: registered new interface driver usbfs
> usbcore: registered new interface driver hub
> usbcore: registered new device driver usb
> i2c-mt7621 1e000900.i2c: clock 100KHz, re-start not support
<snip>
> hub 2-0:1.0: USB hub found
> hub 2-0:1.0: 1 port detected
> usbcore: registered new interface driver usb-storage
> rtc-pcf8563 0-0051: rtc core: registered rtc-pcf8563 as rtc0

but, as always, right before /sbin/init is called:
> nvram driver (major 251) installed
> rtc-pcf8563 0-0051: hctosys: unable to read the hardware clock

i am currently putting the rtc info inside the i2c entry for the dts (pretty much identical to the LEDE mt7621.dtsi otherwise):


>                 i2c: i2c at 900 {
>                         compatible = "mediatek,mt7621-i2c";
>                         reg = <0x900 0x100>;
> 
>                         clocks = <&sysclock>;
> 
>                         resets = <&rstctrl 16>;
>                         reset-names = "i2c";
> 
>                         #address-cells = <1>;
>                         #size-cells = <0>;
> 
>                         status = "disabled";
> 
>                         pinctrl-names = "default";
>                         pinctrl-0 = <&i2c_pins>;
> 
> 
>                  pcf8563: rtc at 51 {
>                             compatible = "nxp,pcf8563";
>                             reg = <0x51>;
>                         };
>                 };


and in my dts i put a simple
> &i2c {
>  	status = “okay”;
> };


i was hoping you had some tips for what i am doing wrong. maybe the address for the pcf8563 is slightly different on the mt7621? do i need the AT24 driver or something?

Thanks,
Gagan







More information about the Lede-dev mailing list