Re: [LEDE-DEV] [PATCH] ramips: Add I2C driver to the default kernel config
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@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.50 (0.461765 > 0.001000) > 86.500020 is close enough to 86.50 (0.20 < 0.002000) > Set RTC to 86 (85 + 1; refsystime = 85.00) > 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.00 85 0.00 > 85 > UTC > root@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 > 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@900 { > compatible = "mediatek,mt7621-i2c"; > reg = <0x900 0x100>; > > clocks = <>; > > resets = < 16>; > reset-names = "i2c"; > > #address-cells = <1>; > #size-cells = <0>; > > status = "disabled"; > > pinctrl-names = "default"; > pinctrl-0 = <_pins>; > > > pcf8563: rtc@51 { > compatible = "nxp,pcf8563"; > reg = <0x51>; > }; > }; and in my dts i put a simple > { > 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 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] [PATCH] ramips: Add I2C driver to the default kernel config
I made a commit that added the RTC driver to the kernel config with the intent that it would fix hctosys. Unfortunately while the RTC driver is in there, it's connected through I2C, the driver for which comes in module form and is thus loaded late. After this commit, it works fine. Signed-off by: Rosen Penev--- target/linux/ramips/image/mt7621.mk | 12 +--- target/linux/ramips/modules.mk| 16 target/linux/ramips/mt7621/config-4.4 | 2 ++ 3 files changed, 7 insertions(+), 23 deletions(-) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 6d9a727..fd28e19 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -30,7 +30,7 @@ define Device/11acnas DTS := 11ACNAS IMAGE_SIZE := $(ralink_default_fw_size_16M) DEVICE_TITLE := WeVO 11AC NAS Router - DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-i2c-mt7621 kmod-mt76 + DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-mt76 endef TARGET_DEVICES += 11acnas @@ -83,7 +83,7 @@ define Device/newifi-d1 DTS := Newifi-D1 IMAGE_SIZE := $(ralink_default_fw_size_32M) DEVICE_TITLE := Newifi D1 - DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-i2c-mt7621 + DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport endef TARGET_DEVICES += newifi-d1 @@ -91,8 +91,7 @@ define Device/pbr-m1 DTS := PBR-M1 IMAGE_SIZE := $(ralink_default_fw_size_16M) DEVICE_TITLE := PBR-M1 - DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core kmod-ata-ahci \ - kmod-i2c-mt7621 + DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core kmod-ata-ahci endef TARGET_DEVICES += pbr-m1 @@ -157,7 +156,7 @@ define Device/w2914nsv2 DTS := W2914NSV2 IMAGE_SIZE := $(ralink_default_fw_size_16M) DEVICE_TITLE := WeVO W2914NS v2 - DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-i2c-mt7621 kmod-mt76 + DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-mt76 endef TARGET_DEVICES += w2914nsv2 @@ -179,8 +178,7 @@ define Device/witi DTS := WITI IMAGE_SIZE := $(ralink_default_fw_size_16M) DEVICE_TITLE := MQmaker WiTi - DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core kmod-ata-ahci \ - kmod-i2c-mt7621 + DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core kmod-ata-ahci endef TARGET_DEVICES += witi diff --git a/target/linux/ramips/modules.mk b/target/linux/ramips/modules.mk index 99c5a9d..c2b6f50 100644 --- a/target/linux/ramips/modules.mk +++ b/target/linux/ramips/modules.mk @@ -58,22 +58,6 @@ endef $(eval $(call KernelPackage,i2c-ralink)) -I2C_MT7621_MODULES:= \ - CONFIG_I2C_MT7621:drivers/i2c/busses/i2c-mt7621 - -define KernelPackage/i2c-mt7621 - $(call i2c_defaults,$(I2C_MT7621_MODULES),59) - TITLE:=MT7621 I2C Controller - DEPENDS:=kmod-i2c-core \ - @(TARGET_ramips_mt7621||TARGET_ramips_mt7628||TARGET_ramips_mt7688) -endef - -define KernelPackage/i2c-mt7621/description - Kernel modules for enable mt7621 i2c controller. -endef - -$(eval $(call KernelPackage,i2c-mt7621)) - define KernelPackage/dma-ralink SUBMENU:=Other modules TITLE:=Ralink GDMA Engine diff --git a/target/linux/ramips/mt7621/config-4.4 b/target/linux/ramips/mt7621/config-4.4 index 73c3b39..383370b 100644 --- a/target/linux/ramips/mt7621/config-4.4 +++ b/target/linux/ramips/mt7621/config-4.4 @@ -115,6 +115,8 @@ CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y CONFIG_HIGHMEM=y CONFIG_HW_HAS_PCI=y CONFIG_HZ_PERIODIC=y +CONFIG_I2C=y +CONFIG_I2C_MT7621=y # CONFIG_IMG_MDC_DMA is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_IRQCHIP=y -- 2.9.3 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
Re: [LEDE-DEV] [PATCH] ramips: Add I2C driver to the default kernel config
On 2017-01-13 04:05, Rosen Penev wrote: > I made a commit that added the RTC driver to the kernel config with > the intent that it would fix hctosys. Unfortunately while the RTC > driver is in there, it's connected through I2C, the driver for which > comes in module form and is thus loaded late. After this commit, it > works fine. > > Signed-off by: Rosen PenevPlease remove kmod-i2c-mt7621 from modules.mk as well. - Felix ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
Re: [LEDE-DEV] [PATCH] ramips: Add I2C driver to the default kernel config
Just a thought: Isn't there a way to simply have a hotplug handler which calls /sbin/hwclock instead of forcing RTC modules to be built-in? Cheers Daniel On Thu, Jan 12, 2017 at 07:05:00PM -0800, Rosen Penev wrote: > I made a commit that added the RTC driver to the kernel config with > the intent that it would fix hctosys. Unfortunately while the RTC > driver is in there, it's connected through I2C, the driver for which > comes in module form and is thus loaded late. After this commit, it > works fine. > > Signed-off by: Rosen Penev> --- > target/linux/ramips/image/mt7621.mk | 12 +--- > target/linux/ramips/mt7621/config-4.4 | 2 ++ > 2 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/target/linux/ramips/image/mt7621.mk > b/target/linux/ramips/image/mt7621.mk > index 6d9a727..fd28e19 100644 > --- a/target/linux/ramips/image/mt7621.mk > +++ b/target/linux/ramips/image/mt7621.mk > @@ -30,7 +30,7 @@ define Device/11acnas >DTS := 11ACNAS >IMAGE_SIZE := $(ralink_default_fw_size_16M) >DEVICE_TITLE := WeVO 11AC NAS Router > - DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-i2c-mt7621 > kmod-mt76 > + DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-mt76 > endef > TARGET_DEVICES += 11acnas > > @@ -83,7 +83,7 @@ define Device/newifi-d1 >DTS := Newifi-D1 >IMAGE_SIZE := $(ralink_default_fw_size_32M) >DEVICE_TITLE := Newifi D1 > - DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-i2c-mt7621 > + DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport > endef > TARGET_DEVICES += newifi-d1 > > @@ -91,8 +91,7 @@ define Device/pbr-m1 >DTS := PBR-M1 >IMAGE_SIZE := $(ralink_default_fw_size_16M) >DEVICE_TITLE := PBR-M1 > - DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core > kmod-ata-ahci \ > - kmod-i2c-mt7621 > + DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core > kmod-ata-ahci > endef > TARGET_DEVICES += pbr-m1 > > @@ -157,7 +156,7 @@ define Device/w2914nsv2 >DTS := W2914NSV2 >IMAGE_SIZE := $(ralink_default_fw_size_16M) >DEVICE_TITLE := WeVO W2914NS v2 > - DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-i2c-mt7621 > kmod-mt76 > + DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-mt76 > endef > TARGET_DEVICES += w2914nsv2 > > @@ -179,8 +178,7 @@ define Device/witi >DTS := WITI >IMAGE_SIZE := $(ralink_default_fw_size_16M) >DEVICE_TITLE := MQmaker WiTi > - DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core > kmod-ata-ahci \ > - kmod-i2c-mt7621 > + DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core > kmod-ata-ahci > endef > TARGET_DEVICES += witi > > diff --git a/target/linux/ramips/mt7621/config-4.4 > b/target/linux/ramips/mt7621/config-4.4 > index 73c3b39..383370b 100644 > --- a/target/linux/ramips/mt7621/config-4.4 > +++ b/target/linux/ramips/mt7621/config-4.4 > @@ -115,6 +115,8 @@ CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y > CONFIG_HIGHMEM=y > CONFIG_HW_HAS_PCI=y > CONFIG_HZ_PERIODIC=y > +CONFIG_I2C=y > +CONFIG_I2C_MT7621=y > # CONFIG_IMG_MDC_DMA is not set > CONFIG_INITRAMFS_SOURCE="" > CONFIG_IRQCHIP=y > -- > 2.9.3 > > > ___ > Lede-dev mailing list > Lede-dev@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/lede-dev ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] [PATCH] ramips: Add I2C driver to the default kernel config
I made a commit that added the RTC driver to the kernel config with the intent that it would fix hctosys. Unfortunately while the RTC driver is in there, it's connected through I2C, the driver for which comes in module form and is thus loaded late. After this commit, it works fine. Signed-off by: Rosen Penev--- target/linux/ramips/image/mt7621.mk | 12 +--- target/linux/ramips/mt7621/config-4.4 | 2 ++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 6d9a727..fd28e19 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -30,7 +30,7 @@ define Device/11acnas DTS := 11ACNAS IMAGE_SIZE := $(ralink_default_fw_size_16M) DEVICE_TITLE := WeVO 11AC NAS Router - DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-i2c-mt7621 kmod-mt76 + DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-mt76 endef TARGET_DEVICES += 11acnas @@ -83,7 +83,7 @@ define Device/newifi-d1 DTS := Newifi-D1 IMAGE_SIZE := $(ralink_default_fw_size_32M) DEVICE_TITLE := Newifi D1 - DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-i2c-mt7621 + DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport endef TARGET_DEVICES += newifi-d1 @@ -91,8 +91,7 @@ define Device/pbr-m1 DTS := PBR-M1 IMAGE_SIZE := $(ralink_default_fw_size_16M) DEVICE_TITLE := PBR-M1 - DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core kmod-ata-ahci \ - kmod-i2c-mt7621 + DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core kmod-ata-ahci endef TARGET_DEVICES += pbr-m1 @@ -157,7 +156,7 @@ define Device/w2914nsv2 DTS := W2914NSV2 IMAGE_SIZE := $(ralink_default_fw_size_16M) DEVICE_TITLE := WeVO W2914NS v2 - DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-i2c-mt7621 kmod-mt76 + DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-mt76 endef TARGET_DEVICES += w2914nsv2 @@ -179,8 +178,7 @@ define Device/witi DTS := WITI IMAGE_SIZE := $(ralink_default_fw_size_16M) DEVICE_TITLE := MQmaker WiTi - DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core kmod-ata-ahci \ - kmod-i2c-mt7621 + DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core kmod-ata-ahci endef TARGET_DEVICES += witi diff --git a/target/linux/ramips/mt7621/config-4.4 b/target/linux/ramips/mt7621/config-4.4 index 73c3b39..383370b 100644 --- a/target/linux/ramips/mt7621/config-4.4 +++ b/target/linux/ramips/mt7621/config-4.4 @@ -115,6 +115,8 @@ CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y CONFIG_HIGHMEM=y CONFIG_HW_HAS_PCI=y CONFIG_HZ_PERIODIC=y +CONFIG_I2C=y +CONFIG_I2C_MT7621=y # CONFIG_IMG_MDC_DMA is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_IRQCHIP=y -- 2.9.3 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev