-
Notifications
You must be signed in to change notification settings - Fork 882
adi,axi-pwmgen fixes backport #2824
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
Open
dlech
wants to merge
4
commits into
analogdevicesinc:main
Choose a base branch
from
dlech:adi-pwm-fixes-backport
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+203
−35
Conversation
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
Fix a shortcoming in the bindings that doesn't allow for a separate external clock. The AXI PWMGEN IP block has a compile option ASYNC_CLK_EN that allows the use of an external clock for the PWM output separate from the AXI clock that runs the peripheral. This was missed in the original bindings and so users were writing dts files where the one and only clock specified would be the external clock, if there was one, incorrectly missing the separate AXI clock. The correct bindings are that the AXI clock is always required and the external clock is optional (must be given only when HDL compile option ASYNC_CLK_EN=1). Fixes: 1edf2c2 ("dt-bindings: pwm: Add AXI PWM generator") Cc: stable@vger.kernel.org Signed-off-by: David Lechner <dlechner@baylibre.com> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20250529-pwm-axi-pwmgen-add-external-clock-v3-2-5d8809a7da91@baylibre.com Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org> (cherry picked from commit e683131) Signed-off-by: David Lechner <dlechner@baylibre.com>
Add proper support for external clock to the AXI PWM generator driver. In most cases, the HDL for this IP block is compiled with the default ASYNC_CLK_EN=1. With this option, there is a separate external clock that drives the PWM output separate from the peripheral clock. So the driver should be enabling the "axi" clock to power the peripheral and the "ext" clock to drive the PWM output. When ASYNC_CLK_EN=0, the "axi" clock is also used to drive the PWM output and there is no "ext" clock. Previously, if there was a separate external clock, users had to specify only the external clock and (incorrectly) omit the AXI clock in order to get the correct operating frequency for the PWM output. The devicetree bindings are updated to fix this shortcoming and this patch changes the driver to match the new bindings. To preserve compatibility with any existing dtbs that specify only one clock, we don't require the clock name on the first clock. Fixes: 41814fe ("pwm: Add driver for AXI PWM generator") Cc: stable@vger.kernel.org Acked-by: Nuno Sá <nuno.sa@analog.com> Reviewed-by: Trevor Gamblin <tgamblin@baylibre.com> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://lore.kernel.org/r/20250529-pwm-axi-pwmgen-add-external-clock-v3-3-5d8809a7da91@baylibre.com Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org> (cherry picked from commit a8841dc) Signed-off-by: David Lechner <dlechner@baylibre.com>
After backporting the dt-bindings fix from upstream, update the existing .dts files that use adi,axi-pwmgen-2.00.a to use the corrected clocks binding. In the HDL, ASYNC_CLK_EN=1 by default, so most projects have a separate external clock. The only exceptions are ad7606x, ad7616 and dc2677a, which have ASYNC_CLK_EN=0 and therefore only one clock. In arch/arm/boot/dts/xilinx/zynq-zed-adv7511-ad4134.dts the wrong clock was specified for the old binding so it will have a behavior change to use the correct clock for the PWM clock rate now. In arch/arm/boot/dts/xilinx/zynq-zed-adv7511-ltc2387.dts, we also drop the 0 in the phandle since #clock-cells = <0>; for &ref_clk. Signed-off-by: David Lechner <dlechner@baylibre.com>
This is the same as analogdevicesinc#2823 but has the adi,axi-pwmgen bindings clocks fixed up. We can drop this and add the fixup to the previous patch after the other PR is merged. Signed-off-by: David Lechner <dlechner@baylibre.com>
dlech
commented
Jun 18, 2025
@@ -72,8 +72,8 @@ | |||
reg = <0x44b00000 0x1000>; | |||
label = "ad463x_cnv"; | |||
#pwm-cells = <2>; | |||
clocks = <&cnv_ext_clk>; | |||
|
|||
clocks = <&clkc 15>, <&spi_clk>; |
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.
Suggested change
clocks = <&clkc 15>, <&spi_clk>; | |
clocks = <&clkc 15>, <&cnv_ext_clk>; |
oops
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.
PR Description
This is backporting a couple of fixes that were recently upstreamed to correct the clocks binding on adi,axi-pwmgen-2.00.a. Plus a patch to update all of the example .dts files that use it. A couple of .dts files had bugs in the clocks bindings as well, so those are fixed.
I intentionally added one more patch that conflicts with #2823 to remind us that it needs to get merged first so that we can fix up that .dts file as well before merging this one.
PR Type
PR Checklist