Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtc-hym8563 5-0051:no valid clock/calendar values available. #16

Open
kongjun0 opened this issue Aug 9, 2023 · 13 comments
Open

rtc-hym8563 5-0051:no valid clock/calendar values available. #16

kongjun0 opened this issue Aug 9, 2023 · 13 comments

Comments

@kongjun0
Copy link

kongjun0 commented Aug 9, 2023

Error reported, is there a solution
rtc-hym8563 5-0051:no valid clock/calendar values available.

@kongjun0
Copy link
Author

kongjun0 commented Aug 9, 2023

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:

@kongjun0
Copy link
Author

kongjun0 commented Aug 9, 2023

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

@kongjun0
Copy link
Author

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

@arbv
Copy link

arbv commented Aug 19, 2023

Alternatively, you can just blacklist the rtc_rk808 kernel module. This way rtc0 will be managed by rtc-hym8563.

@kongjun0
Copy link
Author

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?

@inindev
Copy link
Owner

inindev commented Aug 20, 2023

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)

@kongjun0
Copy link
Author

It's all this error report
image

@inindev
Copy link
Owner

inindev commented Aug 21, 2023

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.

@arbv
Copy link

arbv commented Aug 21, 2023

@kongjun0 I suppose that you are seeing these errors in the log because you have not installed the RTC battery.

@inindev
Copy link
Owner

inindev commented Aug 21, 2023

@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

@arbv
Copy link

arbv commented Aug 21, 2023

Most RTC batteries which have 1.25mm between pins on the connector should work.

@kongjun0
Copy link
Author

@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.

@serfreeman1337
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants