Add a gpclk overlay (and a -pi5 variant) - #7601
Open
pelwell wants to merge 3 commits into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.