* [PATCH 0/2] pwm: spacemit: Add Support for K3 SoC
@ 2026-04-09 0:45 Yixun Lan
2026-04-09 0:45 ` [PATCH 1/2] dt-bindings: pwm: marvell,pxa-pwm: Add SpacemiT K3 PWM support Yixun Lan
2026-04-09 0:45 ` [PATCH 2/2] pwm: pxa: Add optional bus clock Yixun Lan
0 siblings, 2 replies; 5+ messages in thread
From: Yixun Lan @ 2026-04-09 0:45 UTC (permalink / raw)
To: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Duje Mihanović
Cc: linux-pwm, devicetree, linux-kernel, linux-riscv, spacemit,
Yixun Lan
The PWM controller in SpacemiT K3 SoC reuse the same IP as previous K1
generation, while the difference is that one additional bus clock is
added. Introduce a new compatible string and also adjust driver code to
support it.
Signed-off-by: Yixun Lan <dlan@kernel.org>
---
Yixun Lan (2):
dt-bindings: pwm: marvell,pxa-pwm: Add SpacemiT K3 PWM support
pwm: pxa: Add optional bus clock
.../devicetree/bindings/pwm/marvell,pxa-pwm.yaml | 53 ++++++++++++++++++++--
drivers/pwm/pwm-pxa.c | 8 +++-
2 files changed, 57 insertions(+), 4 deletions(-)
---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260401-03-k3-pwm-drv-4ea99ae355d6
Best regards,
--
Yixun Lan <dlan@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 1/2] dt-bindings: pwm: marvell,pxa-pwm: Add SpacemiT K3 PWM support 2026-04-09 0:45 [PATCH 0/2] pwm: spacemit: Add Support for K3 SoC Yixun Lan @ 2026-04-09 0:45 ` Yixun Lan 2026-04-09 15:41 ` Conor Dooley 2026-04-09 0:45 ` [PATCH 2/2] pwm: pxa: Add optional bus clock Yixun Lan 1 sibling, 1 reply; 5+ messages in thread From: Yixun Lan @ 2026-04-09 0:45 UTC (permalink / raw) To: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Duje Mihanović Cc: linux-pwm, devicetree, linux-kernel, linux-riscv, spacemit, Yixun Lan The PWM controller in SpacemiT K3 SoC reuse the same IP as previous K1 generation, while the difference is that one additional bus clock is added. Signed-off-by: Yixun Lan <dlan@kernel.org> --- .../devicetree/bindings/pwm/marvell,pxa-pwm.yaml | 53 ++++++++++++++++++++-- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/pwm/marvell,pxa-pwm.yaml b/Documentation/devicetree/bindings/pwm/marvell,pxa-pwm.yaml index 8df327e52810..3427c8ef3945 100644 --- a/Documentation/devicetree/bindings/pwm/marvell,pxa-pwm.yaml +++ b/Documentation/devicetree/bindings/pwm/marvell,pxa-pwm.yaml @@ -15,7 +15,9 @@ allOf: properties: compatible: contains: - const: spacemit,k1-pwm + enum: + - spacemit,k1-pwm + - spacemit,k3-pwm then: properties: "#pwm-cells": @@ -26,6 +28,38 @@ allOf: const: 1 description: | Used for specifying the period length in nanoseconds. + - if: + properties: + compatible: + contains: + enum: + - spacemit,k3-pwm + then: + properties: + clock-names: + items: + - const: func + - const: bus + - if: + properties: + compatible: + contains: + enum: + - spacemit,k3-pwm + then: + required: + - clock-names + properties: + clocks: + minItems: 2 + clock-names: + minItems: 2 + else: + properties: + clocks: + maxItems: 1 + clock-names: + maxItems: 1 properties: compatible: @@ -36,7 +70,9 @@ properties: - marvell,pxa168-pwm - marvell,pxa910-pwm - items: - - const: spacemit,k1-pwm + - enum: + - spacemit,k1-pwm + - spacemit,k3-pwm - const: marvell,pxa910-pwm reg: @@ -47,7 +83,18 @@ properties: description: Number of cells in a pwm specifier. clocks: - maxItems: 1 + minItems: 1 + items: + - description: The function clock + - description: An optional bus clock + + clock-names: + minItems: 1 + maxItems: 2 + oneOf: + - items: + - const: func + - const: bus resets: maxItems: 1 -- 2.53.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] dt-bindings: pwm: marvell,pxa-pwm: Add SpacemiT K3 PWM support 2026-04-09 0:45 ` [PATCH 1/2] dt-bindings: pwm: marvell,pxa-pwm: Add SpacemiT K3 PWM support Yixun Lan @ 2026-04-09 15:41 ` Conor Dooley 2026-04-09 23:43 ` Yixun Lan 0 siblings, 1 reply; 5+ messages in thread From: Conor Dooley @ 2026-04-09 15:41 UTC (permalink / raw) To: Yixun Lan Cc: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Duje Mihanović, linux-pwm, devicetree, linux-kernel, linux-riscv, spacemit [-- Attachment #1: Type: text/plain, Size: 2845 bytes --] On Thu, Apr 09, 2026 at 12:45:11AM +0000, Yixun Lan wrote: > The PWM controller in SpacemiT K3 SoC reuse the same IP as previous K1 > generation, while the difference is that one additional bus clock is > added. > > Signed-off-by: Yixun Lan <dlan@kernel.org> > --- > .../devicetree/bindings/pwm/marvell,pxa-pwm.yaml | 53 ++++++++++++++++++++-- > 1 file changed, 50 insertions(+), 3 deletions(-) > > diff --git a/Documentation/devicetree/bindings/pwm/marvell,pxa-pwm.yaml b/Documentation/devicetree/bindings/pwm/marvell,pxa-pwm.yaml > index 8df327e52810..3427c8ef3945 100644 > --- a/Documentation/devicetree/bindings/pwm/marvell,pxa-pwm.yaml > +++ b/Documentation/devicetree/bindings/pwm/marvell,pxa-pwm.yaml > @@ -15,7 +15,9 @@ allOf: > properties: > compatible: > contains: > - const: spacemit,k1-pwm > + enum: > + - spacemit,k1-pwm > + - spacemit,k3-pwm > then: > properties: > "#pwm-cells": > @@ -26,6 +28,38 @@ allOf: > const: 1 > description: | > Used for specifying the period length in nanoseconds. > + - if: > + properties: > + compatible: > + contains: > + enum: > + - spacemit,k3-pwm > + then: > + properties: > + clock-names: > + items: > + - const: func > + - const: bus This condition here doesn't appear to do anything? It just repeats what's already done unconditonally below? > + - if: > + properties: > + compatible: > + contains: > + enum: > + - spacemit,k3-pwm > + then: > + required: > + - clock-names > + properties: > + clocks: > + minItems: 2 > + clock-names: > + minItems: 2 > + else: > + properties: > + clocks: > + maxItems: 1 > + clock-names: > + maxItems: 1 > > properties: > compatible: > @@ -36,7 +70,9 @@ properties: > - marvell,pxa168-pwm > - marvell,pxa910-pwm > - items: > - - const: spacemit,k1-pwm > + - enum: > + - spacemit,k1-pwm > + - spacemit,k3-pwm > - const: marvell,pxa910-pwm > > reg: > @@ -47,7 +83,18 @@ properties: > description: Number of cells in a pwm specifier. > > clocks: > - maxItems: 1 > + minItems: 1 > + items: > + - description: The function clock > + - description: An optional bus clock > + > + clock-names: > + minItems: 1 > + maxItems: 2 > + oneOf: > + - items: > + - const: func > + - const: bus > > resets: > maxItems: 1 > > -- > 2.53.0 > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] dt-bindings: pwm: marvell,pxa-pwm: Add SpacemiT K3 PWM support 2026-04-09 15:41 ` Conor Dooley @ 2026-04-09 23:43 ` Yixun Lan 0 siblings, 0 replies; 5+ messages in thread From: Yixun Lan @ 2026-04-09 23:43 UTC (permalink / raw) To: Conor Dooley Cc: Uwe Kleine-K�nig, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Duje Mihanović, linux-pwm, devicetree, linux-kernel, linux-riscv, spacemit Hi Conor, On 16:41 Thu 09 Apr , Conor Dooley wrote: > On Thu, Apr 09, 2026 at 12:45:11AM +0000, Yixun Lan wrote: > > The PWM controller in SpacemiT K3 SoC reuse the same IP as previous K1 > > generation, while the difference is that one additional bus clock is > > added. > > > > Signed-off-by: Yixun Lan <dlan@kernel.org> > > --- > > .../devicetree/bindings/pwm/marvell,pxa-pwm.yaml | 53 ++++++++++++++++++++-- > > 1 file changed, 50 insertions(+), 3 deletions(-) > > > > diff --git a/Documentation/devicetree/bindings/pwm/marvell,pxa-pwm.yaml b/Documentation/devicetree/bindings/pwm/marvell,pxa-pwm.yaml > > index 8df327e52810..3427c8ef3945 100644 > > --- a/Documentation/devicetree/bindings/pwm/marvell,pxa-pwm.yaml > > +++ b/Documentation/devicetree/bindings/pwm/marvell,pxa-pwm.yaml > > @@ -15,7 +15,9 @@ allOf: > > properties: > > compatible: > > contains: > > - const: spacemit,k1-pwm > > + enum: > > + - spacemit,k1-pwm > > + - spacemit,k3-pwm > > then: > > properties: > > "#pwm-cells": > > @@ -26,6 +28,38 @@ allOf: > > const: 1 > > description: | > > Used for specifying the period length in nanoseconds. > > + - if: > > + properties: > > + compatible: > > + contains: > > + enum: > > + - spacemit,k3-pwm > > + then: > > + properties: > > + clock-names: > > + items: > > + - const: func > > + - const: bus > > This condition here doesn't appear to do anything? It just repeats > what's already done unconditonally below? > You right, I should merge clock-names with below.. > > + - if: > > + properties: > > + compatible: > > + contains: > > + enum: > > + - spacemit,k3-pwm > > + then: > > + required: > > + - clock-names > > + properties: > > + clocks: > > + minItems: 2 > > + clock-names: > > + minItems: 2 > > + else: > > + properties: > > + clocks: > > + maxItems: 1 > > + clock-names: > > + maxItems: 1 > > > > properties: > > compatible: > > @@ -36,7 +70,9 @@ properties: > > - marvell,pxa168-pwm > > - marvell,pxa910-pwm > > - items: > > - - const: spacemit,k1-pwm > > + - enum: > > + - spacemit,k1-pwm > > + - spacemit,k3-pwm > > - const: marvell,pxa910-pwm > > > > reg: > > @@ -47,7 +83,18 @@ properties: > > description: Number of cells in a pwm specifier. > > > > clocks: > > - maxItems: 1 > > + minItems: 1 > > + items: > > + - description: The function clock > > + - description: An optional bus clock > > + > > + clock-names: > > + minItems: 1 > > + maxItems: 2 > > + oneOf: > > + - items: > > + - const: func > > + - const: bus > > > > resets: > > maxItems: 1 > > > > -- > > 2.53.0 > > -- Yixun Lan (dlan) ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] pwm: pxa: Add optional bus clock 2026-04-09 0:45 [PATCH 0/2] pwm: spacemit: Add Support for K3 SoC Yixun Lan 2026-04-09 0:45 ` [PATCH 1/2] dt-bindings: pwm: marvell,pxa-pwm: Add SpacemiT K3 PWM support Yixun Lan @ 2026-04-09 0:45 ` Yixun Lan 1 sibling, 0 replies; 5+ messages in thread From: Yixun Lan @ 2026-04-09 0:45 UTC (permalink / raw) To: Uwe Kleine-König, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Duje Mihanović Cc: linux-pwm, devicetree, linux-kernel, linux-riscv, spacemit, Yixun Lan Add one secondary optional bus clock for the PWM PXA driver, also keep it compatible with old single clock. The SpacemiT K3 SoC require one bus clock for PWM controller, acquire and enable it during probe phase. Signed-off-by: Yixun Lan <dlan@kernel.org> --- drivers/pwm/pwm-pxa.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c index 0f5bdb0e395e..2ace31405c2d 100644 --- a/drivers/pwm/pwm-pxa.c +++ b/drivers/pwm/pwm-pxa.c @@ -53,6 +53,7 @@ struct pxa_pwm_chip { struct device *dev; struct clk *clk; + struct clk *bus_clk; void __iomem *mmio_base; }; @@ -177,7 +178,12 @@ static int pwm_probe(struct platform_device *pdev) return PTR_ERR(chip); pc = to_pxa_pwm_chip(chip); - pc->clk = devm_clk_get(dev, NULL); + pc->bus_clk = devm_clk_get_optional_enabled(dev, "bus"); + if (IS_ERR(pc->bus_clk)) + return dev_err_probe(dev, PTR_ERR(pc->bus_clk), "Failed to get bus clock\n"); + + /* Get named func clk if bus clock is valid */ + pc->clk = devm_clk_get(dev, pc->bus_clk ? "func" : NULL); if (IS_ERR(pc->clk)) return dev_err_probe(dev, PTR_ERR(pc->clk), "Failed to get clock\n"); -- 2.53.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-04-09 23:43 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-04-09 0:45 [PATCH 0/2] pwm: spacemit: Add Support for K3 SoC Yixun Lan 2026-04-09 0:45 ` [PATCH 1/2] dt-bindings: pwm: marvell,pxa-pwm: Add SpacemiT K3 PWM support Yixun Lan 2026-04-09 15:41 ` Conor Dooley 2026-04-09 23:43 ` Yixun Lan 2026-04-09 0:45 ` [PATCH 2/2] pwm: pxa: Add optional bus clock Yixun Lan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox