Open kongjun0 opened 1 year ago
Since the default kernel rtc device is rtc0, and when we use external rtc in Allwinner platform, the external rtc is usually initialized to rtc1, so we also need to modify the following kernel configuration to set the value to rtc1:
diff --git a/arch/arm/configs/sunxi_defconfig b/arch/arm/configs/sunxi_defconfig index 4c88bbb8..4dbee1a9 100644 --- a/arch/arm/configs/sunxi_defconfig +++ b/arch/arm/configs/sunxi_defconfig @@ -1027,11 +1027,12 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y CONFIG_LEDS_TRIGGER_PANIC=y CONFIG_LEDS_TRIGGER_NETDEV=y CONFIG_RTC_CLASS=y +CONFIG_RTC_HCTOSYS_DEVICE="rtc1" CONFIG_RTC_INTF_DEV_UIE_EMUL=y CONFIG_RTC_DRV_TEST=m CONFIG_RTC_DRV_ABB5ZES3=m CONFIG_RTC_DRV_ABX80X=m -CONFIG_RTC_DRV_DS1307=m +CONFIG_RTC_DRV_DS1307=y CONFIG_RTC_DRV_DS1307_CENTURY=y CONFIG_RTC_DRV_DS1374=m CONFIG_RTC_DRV_DS1374_WDT=y
Since the default kernel rtc device is rtc0, and when we use external rtc in Allwinner platform, the external rtc is usually initialized to rtc1, so we also need to modify the following kernel configuration to set the value to rtc1:
CONFIG_RTC_HCTOSYS_DEVICE="rtc1" CONFIG_RTC_SYSTOHC_DEVICE="rtc1" The kernel configuration:
diff --git a/arch/arm/configs/sunxi_defconfig b/arch/arm/configs/sunxi_defconfig index 4c88bbb8..4dbee1a9 100644 --- a/arch/arm/configs/sunxi_defconfig +++ b/arch/arm/configs/sunxi_defconfig @@ -1027,11 +1027,12 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y CONFIG_LEDS_TRIGGER_PANIC=y CONFIG_LEDS_TRIGGER_NETDEV=y CONFIG_RTC_CLASS=y +CONFIG_RTC_HCTOSYS_DEVICE="rtc1" CONFIG_RTC_INTF_DEV_UIE_EMUL=y CONFIG_RTC_DRV_TEST=m CONFIG_RTC_DRV_ABB5ZES3=m CONFIG_RTC_DRV_ABX80X=m -CONFIG_RTC_DRV_DS1307=m +CONFIG_RTC_DRV_DS1307=y CONFIG_RTC_DRV_DS1307_CENTURY=y CONFIG_RTC_DRV_DS1374=m CONFIG_RTC_DRV_DS1374_WDT=y
Alternatively, you can just blacklist the rtc_rk808
kernel module. This way rtc0 will be managed by rtc-hym8563.
Alternatively, you can just blacklist the
rtc_rk808
kernel module. This way rtc0 will be managed by rtc-hym8563.
how just blacklist the rtc_rk808 kernel module?
Since the default kernel rtc device is rtc0, and when we use external rtc in Allwinner platform, the external rtc is usually initialized to rtc1, so we also need to modify the following kernel configuration to set the value to rtc1:
The nanopi-r5c and r5s are Rockchip based devices. I am unclear on your Allwinner reference here.
Additionally the nanopi images here load the RTC correctly:
[ 5.645210] rtc-hym8563 5-0051: registered as rtc0
[ 5.647207] rtc-hym8563 5-0051: setting system clock to 2023-08-20T07:58:19 UTC (1692518299)
It's all this error report
This article does a good job of describing how to blacklist a module: https://www.networkworld.com/article/3270624/blacklisting-modules-on-linux.html
I am interested to see the output of lsmod
on your system.
@kongjun0 I suppose that you are seeing these errors in the log because you have not installed the RTC battery.
@kongjun0 I suppose that you are seeing these errors in the log because you have not installed the RTC battery.
Good call, I had not even thought about this. These are the batteries I use:
https://www.amazon.com/gp/product/B08QCGKCZL https://shop.allnetchina.cn/products/rtc-battery-for-rock-pi-4?variant=15416681529446
Most RTC batteries which have 1.25mm between pins on the connector should work.
@kongjun0 I suppose that you are seeing these errors in the log because you have not installed the RTC battery.
rtc button battery installed,The official explanation is that the kernel defaults to rtc0 time. The 8563 with the battery installed is rtc1, or it is selected as rtc1 when compiling the kernel, otherwise it will always report an error. If you can install rtc and point to rtc1 after booting, it should be no problem. You can query rtc1 with the command time, rtc0 does not work.
rtc-rk808
can be disabled with initcall_blacklist=rk808_rtc_driver_init
kernel parameter. This way system will always sync with rtc-hym8563
and have a valid time set with every boot.
Fixed my Nanopi R5C issue at last where rk808 sometimes registered before hym8563 and used as default rtc0.
Error reported, is there a solution rtc-hym8563 5-0051:no valid clock/calendar values available.