Jump to content

Recommended Posts

Posted

The NanoPi R3S contains a hardware clock (HYM8563) with the possibility to connect a backup battery. However, the current kernel adds this clock as an additional one (RTC1).  

I tried to create a device tree overlay, but it does not work. As I understand it, this is because the default Rockchip clock is not included in the device tree.  

So, if I understand correctly, the only way to make the HYM8563 the default clock is to build the kernel with this option enabled.  

Please consider changing the default kernel options to make the HYM8563 the default RTC. 
If there’s another way to make the HYM8563 the default RTC, please advise.

Posted
39 minutes ago, OleksandrK said:

Please consider changing the default kernel options to make the HYM8563 the default RTC. 

 

How would one do that exactly?

Posted

On other platforms we can usually set an alias in the DTS for the rtc. On RK I'm not seeing that as an option, but what we can do is make it so one module loads before the other. In short, we set `CONFIG_RTC_DRV_HYM8563=y` and leave `CONFIG_RTC_DRV_RK808=m`. Which will force a hierarchy in the way things load.

 

Case in point;

patrick@nanopir3s:~$ dmesg | grep rtc
[    4.646223] rtc-hym8563 1-0051: registered as rtc0
[    4.647295] rtc-hym8563 1-0051: setting system clock to 2025-08-25T01:34:16 UTC (1756085656)
[    5.548534] rk808-rtc rk808-rtc.5.auto: registered as rtc1
[    5.605731] rockchip-drm display-subsystem: [drm] Cannot find any crtc or sizes
[    5.605810] rockchip-drm display-subsystem: [drm] Cannot find any crtc or sizes

 

We may also be able to achieve this with a udev rule? I'll do a PR after further testing.

 

Posted

@OleksandrK

 

Would changing the symlink suffice?

ls -ls /dev/rtc*
0 lrwxrwxrwx 1 root root      4 Aug 25 11:14 /dev/rtc -> rtc1
0 crw------- 1 root root 252, 0 Aug 25 11:14 /dev/rtc0
0 crw------- 1 root root 252, 1 Aug 25 11:14 /dev/rtc1

 

echo 'SUBSYSTEM=="rtc", KERNEL=="rtc1", SYMLINK+="rtc" OPTIONS+="link_priority=-100"' | sudo tee /etc/udev/rules.d/10-hym8563-rtc.rules

 

This way both get loaded, but /dev/rtc is linked to rtc1 "hym8563".

 

Posted
15 hours ago, c0rnelius said:

This way both get loaded, but /dev/rtc is linked to rtc1 "hym8563"

Thanks for the help.  
But the moment when the RTC is symlinked does matter. I mean, if the symlink changes too late, some services (for example, NTP synchronization) may be affected.  

I use specific software that starts as a service and immediately begins logging its activity. So if the system time changes significantly during boot, it causes problems for this software.

 

On 8/25/2025 at 4:52 AM, c0rnelius said:

In short, we set `CONFIG_RTC_DRV_HYM8563=y` and leave `CONFIG_RTC_DRV_RK808=m`. Which will force a hierarchy in the way things load

I think this is a much better and more proper solution

Posted
4 hours ago, OleksandrK said:

I think this is a much better and more proper solution

 

For those without a battery connected wouldn't this be an issue?

 

Posted
Quote

 

`CONFIG_RTC_DRV_HYM8563=y` 

For those without a battery connected wouldn't this be an issue?

 

On orangepi-5-plus without RTC battery setting `CONFIG_RTC_DRV_HYM8563=y`  will cause the CPU Loadaverage to be always greater than 1. 

 

The rockchip64 kernel currently use `CONFIG_RTC_DRV_HYM8563=m` and blacklist rtc_hym8563 resolved the high CPU loadaverage.

Posted
8 hours ago, c0rnelius said:

For those without a battery connected wouldn't this be an issue?

No issue, because it would behave the same as the default Rockchip system clock.  
Moreover, by default `fake-hwclock` is running, so after connecting a battery the user would just need to uninstall `fake-hwclock`. That shouldn’t be a problem.

Posted
6 hours ago, JFL said:

The rockchip64 kernel currently use `CONFIG_RTC_DRV_HYM8563=m` and blacklist rtc_hym8563 resolved the high CPU loadaverage.

Interesting. I wonder how the FriendlyElec stock kernel is assembled, because according to the log the stock system doesn’t use any Rockchip clock—only the HYM8563.

Posted

Well apparently it is an issue, as stated above by @JFL. Also, after a RECALL, I'm the one who did the PR to change it from =y to =m.

https://github.com/armbian/build/pull/8300/commits/bb71177580b34c1aeaeb601696d603b6dc49d326

 

As for udev and delay, you could edit the udev system file; /lib/udev/rules.d/50-udev-default.rules

The line you want to edit is about 15 lines down. Change from rtc0 to rtc1.

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines