Skip to content

sun60iw2: fix RTC on Orange Pi Zero 3W (use SoC RTC, drop phantom hym8563) - #10576

Merged
igorpecovnik merged 1 commit into
armbian:mainfrom
periqles:rtc-fix-zero3w-v2
Sep 1, 2026
Merged

sun60iw2: fix RTC on Orange Pi Zero 3W (use SoC RTC, drop phantom hym8563)#10576
igorpecovnik merged 1 commit into
armbian:mainfrom
periqles:rtc-fix-zero3w-v2

Conversation

@periqles

@periqles periqles commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Description

Every Zero 3W boot currently starts in 1970 with rtc-hym8563 15-0051: could not init device, -22. Root cause: the board DTS enables an external hym8563 RTC that is not
populated on this board (schematic has no external RTC — only the SoC VCC-RTC domain),
while the SoC's own RTC (rtc-v201 @0x7090000, driver already built in) is explicitly
disabled with a /*Disable soc rtc*/ comment — likely inherited from a reference design.

Consequences of the wrong clock until NTP syncs: apt refuses repos ("Release file not
valid yet"), wrong early-boot timestamps, and no timekeeping at all for offline use.

Fix

  • Enable the SoC RTC node, disable the phantom hym8563 (DTS patch 0009).
  • Point RTC_HCTOSYS_DEVICE and RTC_SYSTOHC_DEVICE at rtc0, so the kernel restores the
    system clock from the RTC at boot and writes NTP-corrected time back to it every ~11 min.
    (With the phantom gone the SoC RTC registers as rtc0; rtc0 is also the kernel default and
    remains correct for family boards where a real external RTC registers first. Note this
    config is family-wide for sun60iw2 — reasoned through the 4 Pro / Cubie A7Z cases.)

Testing (Orange Pi Zero 3W hardware)

  • /dev/rtc0 registers as sunxi-rtc 7090000.rtc; probe error gone
  • Time set via RTC_SET_TIME is held and correctly advanced across reboots
  • systemd-timesyncd keeps the RTC updated after NTP sync (11-min kernel sync)

Follow-up candidate (not this PR): the same phantom node pattern may exist on other
sun60iw2 family DTs.

Summary by CodeRabbit

  • Bug Fixes
    • Improved system timekeeping by using the board’s built-in RTC for reading and saving system time.
    • Disabled the unavailable external RTC configuration to prevent incorrect or phantom clock detection.
    • Enabled reliable RTC support on Orange Pi Zero 3W devices.

…8563)

The Zero 3W device tree disables the SoC's working on-die RTC and
enables an external hym8563 (on s_twi2) that is not populated on the
board, so every boot starts in 1970 with a probe error and a wrong
clock until NTP syncs (breaking apt on fresh boots, among other things).

- 0009: enable the SoC RTC (allwinner,rtc-v201, driver already =y),
  disable the phantom hym8563 node.
- kernel config: point RTC_HCTOSYS_DEVICE and RTC_SYSTOHC_DEVICE at
  rtc0 - with the phantom gone the SoC RTC registers as rtc0, so the
  kernel both restores the system clock from it at boot and keeps it
  updated via the periodic NTP sync.

Verified on hardware: /dev/rtc0 registers, time survives reboots, probe
error gone.
@github-actions github-actions Bot added the size/medium PR with more then 50 and less then 250 lines label Aug 31, 2026
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2a226d05-a0d4-40fa-9ff8-4bcd86030162

📥 Commits

Reviewing files that changed from the base of the PR and between ee00ac7 and 741efdb.

📒 Files selected for processing (2)
  • config/kernel/linux-sun60iw2-vendor.config
  • patch/kernel/archive/sun60iw2-opi-vendor/0009-orangepizero3w-use-soc-rtc-drop-phantom-hym8563.patch

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The Orange Pi Zero 3W device tree now enables the SoC RTC and disables the phantom external RTC. Kernel RTC settings now use rtc0 for system time synchronization.

Changes

RTC source selection

Layer / File(s) Summary
Enable SoC RTC and disable phantom RTC
patch/kernel/archive/sun60iw2-opi-vendor/0009-orangepizero3w-use-soc-rtc-drop-phantom-hym8563.patch
The device tree enables the SoC RTC and disables the external hym8563 RTC node.
Select rtc0 for system time
config/kernel/linux-sun60iw2-vendor.config
Kernel boot-time clock reading and system-time-to-hardware-clock synchronization now use rtc0.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 741ef

This localized change enables the SoC RTC, disables the unpopulated external RTC, and directs system time synchronization to rtc0. No actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: shkolnik

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing the Orange Pi Zero 3W RTC by using the SoC RTC and disabling the phantom hym8563 device.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added 08 Milestone: Third quarter release Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... labels Aug 31, 2026
@periqles

periqles commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

the Orange Pi 4 Pro DTS has the identical pattern (&rtc disabled + hym8563 node on s_twi2). If the 4 Pro doesn't populate the external RTC either (no hardware to test it), it has the same 1970-boot bug and the same two-line fix applies. Worth a check by a 4 Pro owner; happy to extend this PR or follow up if confirmed.

@github-actions github-actions Bot added the Ready to merge Reviewed, tested and ready for merge label Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

✅ This PR has been reviewed and approved — all set for merge!

@github-actions github-actions Bot removed the Needs review Seeking for review label Sep 1, 2026
@igorpecovnik
igorpecovnik merged commit ec66463 into armbian:main Sep 1, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

08 Milestone: Third quarter release Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... Ready to merge Reviewed, tested and ready for merge size/medium PR with more then 50 and less then 250 lines

Development

Successfully merging this pull request may close these issues.

3 participants