Skip to content

Add a gpclk overlay (and a -pi5 variant) - #7601

Open
pelwell wants to merge 3 commits into
raspberrypi:rpi-6.18.yfrom
pelwell:gpclk
Open

Add a gpclk overlay (and a -pi5 variant)#7601
pelwell wants to merge 3 commits into
raspberrypi:rpi-6.18.yfrom
pelwell:gpclk

Conversation

@pelwell

@pelwell pelwell commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Raspberry Pi devices support enabling a number of clocks on a number of GPIO pins - these are called GPCLKs. These overlays allow these clocks to be configured from Device Tree. In order to get the clocks enabled, a fake consumer is required - hence the creation of the clk-hog driver.

Add clk-hog, a trivial device-tree-only driver modelled on the
gpio-hog concept: a node that just claims a set of clocks (configuring
them via the standard assigned-clocks properties) and holds them
prepared/enabled for as long as the node is bound, with no other
consumer required.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Enable building the clk-hog driver as a module.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Add a generic overlay for routing a GPCLK output onto a GPIO pin and
setting its rate: gpclk for the BCM2835 GP0/GP1/GP2 clocks, and its Pi 5
counterpart gpclk-pi5 for the RP1 GP0-GP5 clocks, selected automatically
via overlay_map.dts.

Both overlays hold their clock open with a clk-hog device, so it stays
enabled for as long as the overlay is loaded, with no other consumer
required.

Every legal pin+clock combination is also exposed as its own named
override (gpclk0_4, gpclk0_20, gpclk1_5, ...), which sets the pin mux
and clock index together in one go. The RP1 pinctrl driver accepts the
same legacy numeric brcm,pins/brcm,function declarations as
pinctrl-bcm2835, so gpclk-pi5 is written the same way and shares
override names with gpclk for every combination the two chips have in
common - a line such as "dtoverlay=gpclk,gpclk0_20" has the same effect
on any Pi. RP1's extra GPCLK3-GPCLK5, and pins with no equivalent
BCM283x ALT function, are exposed the same way but only exist in
gpclk-pi5.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
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.

1 participant