-
Notifications
You must be signed in to change notification settings - Fork 7.6k
drivers: pinctrl: enable the AFIO clock on the CH32V003/20x/30x #89138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The Alternate Function IO (AFIO) block must have the clock enabled before configuring. Some remappings seem to work without, but some like EXTI do not. Fix. Signed-off-by: Michael Hope <michaelh@juju.nz>
98c5430
to
dab3769
Compare
@recalci FYI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer this one and it seems it seems it hasnt broken anything on linkW.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR ensures that the AFIO block clock is enabled via the clock control subsystem rather than relying on in-function remapping logic, which is necessary for proper EXTI support. Key changes include removing the direct clock enable in pin configuration and introducing a dedicated SYS_INIT-based clock initialization function.
- Removed inline clock enabling in pin configuration.
- Added a new clock initialization function that leverages device tree settings.
- Applied the changes consistently across both CH32V003 and CH32V20x/30x drivers.
Reviewed Changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
drivers/pinctrl/pinctrl_wch_afio.c | Removed direct clock enable from pin configuration and added a dedicated clock initialization function with SYS_INIT |
drivers/pinctrl/pinctrl_wch_20x_30x_afio.c | Applied similar clock initialization changes consistent with the CH32V003 implementation |
Files not reviewed (2)
- dts/riscv/wch/ch32v0/ch32v003.dtsi: Language not supported
- dts/riscv/wch/ch32v208/ch32v208.dtsi: Language not supported
The Alternate Function IO (AFIO) block must have the clock enabled before use. Some remappings seem to work without, but some like EXTI do not. Fix.
This is the same as #83353 and parts of #87397 but moves the definition to Devicetree.
This is needed by the GPIO EXTI support in #89139