Skip to content

Add hardware-gated Switchberry timing support - #2140

Open
ahmadexp wants to merge 5 commits into
RaspAP:masterfrom
ahmadexp:switchberry-upstream
Open

Add hardware-gated Switchberry timing support#2140
ahmadexp wants to merge 5 commits into
RaspAP:masterfrom
ahmadexp:switchberry-upstream

Conversation

@ahmadexp

Copy link
Copy Markdown

What

  • Adds a complete Switchberry timing console for PTP transparent, boundary, grandmaster and client roles; Renesas ClockMatrix control; four configurable SMA timing connectors; GNSS monitoring, receiver controls and satellite sky view; switch-port control; and a live timing Dashboard summary.
  • Enables Switchberry support only after positive KSZ9567 identification: either a bound microchip,ksz9567 DSA device or the direct-SPI 00 95 67 chip-ID signature.
  • Keeps ordinary CM4 and CM5 systems on their normal RaspAP model, UI and installation path when the KSZ9567 is absent.
  • Isolates the privileged controller and sudo rules to verified hardware, and lazy-loads the Switchberry browser modules.
  • Adds the V6 boundary-clock overlay, PTP/systemd orchestration, guarded installer, documentation and screenshots captured from a working device.

Why

Switchberry combines a Raspberry Pi Compute Module with a KSZ9567 switch, 8A34004 ClockMatrix, GNSS/PPS path and rear timing I/O. RaspAP is a strong management foundation, but these resources need hardware-aware detection and carefully validated privileged controls. Software image markers are not sufficient because the same image may run on an ordinary CM4 or CM5.

Impact

Regular RaspAP installations remain unchanged unless the KSZ9567 probe succeeds. On detected Switchberry hardware, the installer adds only the timing controller, scoped sudo drop-in, kernel/overlay support and related services. Clock-plane changes are explicit and guarded, with reboot requirements surfaced in the UI.

Validation

  • Four KSZ detection regression tests, including DSA binding, direct SPI identity, missing driver and software-only rejection
  • PHP syntax check across the repository
  • JavaScript syntax checks for the app, Dashboard and Switchberry modules
  • Bash syntax checks for all Switchberry installer scripts
  • visudo validation for both generic and hardware-only rules
  • V6 overlay compilation with dtc
  • Live hardware verification on a Switchberry V6: KSZ9567, chip ID 0x9567, TC plane, full status payload healthy

Verify the KSZ9567 before enabling Switchberry UI, services, packages, or privileged controls. Add the PTP, ClockMatrix, SMA, GNSS, dashboard, installer, and hardware orchestration needed for the Switchberry timing switch while leaving plain CM4 and CM5 systems unchanged.
@ahmadexp
ahmadexp marked this pull request as ready for review July 21, 2026 22:15
Comment thread README.md Outdated

## Contents

- [Switchberry support](#switchberry-support)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd imagine all the Switchberry support would be inside docs, and not pasted into the top of the README, for this to be accepted.

@ahmadexp ahmadexp closed this Jul 21, 2026
@ahmadexp ahmadexp reopened this Jul 21, 2026
@billz
billz requested review from Jixabon and ruralmeltdown July 22, 2026 02:08
@billz

billz commented Jul 25, 2026

Copy link
Copy Markdown
Member

@ahmadexp @geerlingguy exciting to see this. Regarding docs, we can include a brief summary of Switchberry in the README and host the bulk of the documentation at https://docs.raspap.com/. This follows the general pattern of our other core features.

Will give this a thorough test and review over the weekend. Thanks!

@billz

billz commented Aug 5, 2026

Copy link
Copy Markdown
Member

Apologies for the slow response... my "real" job has been crazy lately.

While I don't (yet) have actual Switchberry hardware to test with, I've set the $switchberrySupported flag to 'true' and had a gander at the UI. First impressions are it's very polished overall and appears to be exceptionally usable.

Screenshot 2026-08-04 at 6 33 29 PM

There's clearly a great deal of engineering and UI/UX attention given to this. I like how the installer detects the presence of switchberryctl and handles the dependencies, kernel update and so on, while non-Switchberry installs remain vanilla RaspAP. Likewise, I appreciate the way you've managed to make Switchberry coexist alongside RaspAP without changing networking 👏🏼

The other devs on this project may have their own opinions to contribute, but I'm excited to see this merged and be deployed with the finished product.

@billz

billz commented Aug 5, 2026

Copy link
Copy Markdown
Member

@ahmadexp @geerlingguy many variants of the project have done things with custom branding. it's trivial to apply and, I think, looks quite good. the installer only needs to modify RASPI_BRAND_TEXT in config.php and swap the logo for a FontAwesome icon. you could also redefine the CSS var --raspap-theme-color to match your color scheme. the end result would be something like this:

just an idea :) the Switchberry integration works great either way

@geerlingguy

Copy link
Copy Markdown

That would make it even better, good idea!

@ahmadexp

ahmadexp commented Aug 5, 2026

Copy link
Copy Markdown
Author

totally valid point @billz and thank you so much for your time. Let me encorporate your feedback.

@ahmadexp

ahmadexp commented Aug 5, 2026

Copy link
Copy Markdown
Author

Updated! Thank you @billz

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

Successfully merging this pull request may close these issues.

3 participants