[PATCH v3 0/6] pwm: Update PWM_PXA driver for SpacemiT K1

Guodong Xu posted 6 patches 7 months, 3 weeks ago
.../bindings/pwm/marvell,pxa-pwm.yaml         |  35 +++-
arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi  |   7 +
arch/riscv/boot/dts/spacemit/k1.dtsi          | 180 ++++++++++++++++++
arch/riscv/configs/defconfig                  |   2 +
drivers/pwm/Kconfig                           |   2 +-
drivers/pwm/pwm-pxa.c                         |   7 +
6 files changed, 225 insertions(+), 8 deletions(-)
[PATCH v3 0/6] pwm: Update PWM_PXA driver for SpacemiT K1
Posted by Guodong Xu 7 months, 3 weeks ago
This patchset adds support for the SpacemiT K1 SoC in the PWM_PXA driver
and updates related device tree bindings. The changes enable PWM
functionality on the K1 platform through driver enhancements,
configuration updates, and device tree additions.

Functionality has been verified on the Banana Pi BPI-F3 board using PWM14,
configured as a pwm-backlight. Per community feedback, the actual
pwm-backlight node is not included in this patchset but can be found in
patch 7 of the v1 series, with modification of pwms property to 4-cell
format to match updated binding (#pwm-cells = <3>) since v3.

+		pwms = <&pwm14 0 2000 0>;

This patchset is based on [spacemit/for-next]
  base: https://github.com/spacemit-com/linux for-next

Plus the following dependencies:
1. Clock controller driver, posted by Heylen Chu (v8), with most of it has
   been accepted:
https://lore.kernel.org/all/20250416135406.16284-1-heylenay@4d2.org/
2. Reset controller driver, posted by Alex Elder (v5):
https://lore.kernel.org/all/20250418145401.2603648-1-elder@riscstar.com/

Major differences between v3 and v2:
 - Patch 1:
    - Added: Reviewed-by: Rob Herring (Arm) <robh@kernel.org> # v2.
    - When compatible string contains "spacemit,k1-pwm",
      #pwm-cells must be 3.
 - Patch 2:
    - Dropped the addition of a reset_control field to struct pxa_pwm_chip.
    - Using a local variable in pwm_probe() instead.
 - Patch 3:
    - In k1.dtsi, changed #pwm-cells = <1> to <3>.

Major differences between v2 and v1:
 - Dropped the addition of spacemit,k1-pwm as a compatible string in the
   PWM_PXA driver; instead, it now falls back to marvell,pxa910-pwm.
 - Removed pinctrl settings for all PWM nodes (pwm0-pwm14); only the
   pwm14_1 configuration is included in this version.
 - Changed PWM_PXA from built-in to a loadable module (=m) in the
   riscv defconfig.

v2 consists of the following patches:
Patch 1: Add spacemit,k1-pwm compatible string (with fallback to
           marvell,pxa910-pwm) and support optional resets property.
Patch 2: Add reset controller support to the PWM_PXA driver.
Patch 3: Add device tree nodes for all 20 PWM instances on K1.
Patch 4: Add pinctrl settings for PWM14.
Patch 5: Add ARCH_SPACEMIT dependency to the PWM_PXA Kconfig entry.
Patch 6: Enable PWM and PWM_PXA in riscv defconfig for SpacemiT K1.

v2:
https://lore.kernel.org/all/20250420070251.378950-1-guodong@riscstar.com/

v1:
https://lore.kernel.org/all/20250411131423.3802611-1-guodong@riscstar.com/

Best regards,
Guodong Xu

Guodong Xu (6):
  dt-bindings: pwm: marvell,pxa-pwm: Add SpacemiT K1 PWM support
  pwm: pxa: add optional reset control
  riscv: dts: spacemit: add PWM support for K1 SoC
  riscv: dts: spacemit: add pwm14_1 pinctrl setting
  pwm: Kconfig: add depends on ARCH_SPACEMIT to PWM_PXA
  riscv: defconfig: Enable PWM support for SpacemiT K1 SoC

 .../bindings/pwm/marvell,pxa-pwm.yaml         |  35 +++-
 arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi  |   7 +
 arch/riscv/boot/dts/spacemit/k1.dtsi          | 180 ++++++++++++++++++
 arch/riscv/configs/defconfig                  |   2 +
 drivers/pwm/Kconfig                           |   2 +-
 drivers/pwm/pwm-pxa.c                         |   7 +
 6 files changed, 225 insertions(+), 8 deletions(-)


base-commit: cb9c3aeae509b36afbdf46942a7a0a0dfc856ce7
prerequisite-patch-id: a5d2fb43fd88525fa6c8ee767c31adfee87f1012
prerequisite-patch-id: 8a8d0eefd0b4423d87f3c093b451a0fa60622ec4
prerequisite-patch-id: 30f92f93e5b3577bde61424303f21c709a715ec5
prerequisite-patch-id: d774b8281b5c6a822445365ee94925e1ab6c7a93
prerequisite-patch-id: 54a4f5d065eb9f212fd99efec6e7e06abbb9bad8
prerequisite-patch-id: 93962be60d1b58a98d947edf51b4af9edf513785
prerequisite-patch-id: 5f53f8bf16fb067628092daebc4831293261aa01
-- 
2.43.0
Re: [PATCH v3 0/6] pwm: Update PWM_PXA driver for SpacemiT K1
Posted by Uwe Kleine-König 6 months, 3 weeks ago
Hello,

On Tue, Apr 29, 2025 at 04:50:42PM +0800, Guodong Xu wrote:
> This patchset adds support for the SpacemiT K1 SoC in the PWM_PXA driver
> and updates related device tree bindings. The changes enable PWM
> functionality on the K1 platform through driver enhancements,
> configuration updates, and device tree additions.
> 
> Functionality has been verified on the Banana Pi BPI-F3 board using PWM14,
> configured as a pwm-backlight. Per community feedback, the actual
> pwm-backlight node is not included in this patchset but can be found in
> patch 7 of the v1 series, with modification of pwms property to 4-cell
> format to match updated binding (#pwm-cells = <3>) since v3.
> 
> +		pwms = <&pwm14 0 2000 0>;
> 
> This patchset is based on [spacemit/for-next]
>   base: https://github.com/spacemit-com/linux for-next
> 
> Plus the following dependencies:
> 1. Clock controller driver, posted by Heylen Chu (v8), with most of it has
>    been accepted:
> https://lore.kernel.org/all/20250416135406.16284-1-heylenay@4d2.org/
> 2. Reset controller driver, posted by Alex Elder (v5):
> https://lore.kernel.org/all/20250418145401.2603648-1-elder@riscstar.com/

It's not clear to me if I have to look into this github tree and the
listed dependencies. My impression is that it can go in on without these
changes. Maybe it only starts working when these are also applied, but
that shouldn't stop me applying this series, right?

There is a patch in pwm/for-6.16-rc1 (namely commit df08fff8add2 ("pwm:
pxa: Improve using dev_err_probe()")) that conflicts with this series.
I applied patches 1, 2 and 5 on top of my pwm/for-nexxt branch resolving
that conflict and rewording the commit log of patch 5. The result was
pushed to

	https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/pxa-spacemit

. If you confirm that you're happy with my modifications and it's
correct to apply them without the listed dependencies I will add the
patches to my queue for 6.17-rc1.

Best regards
Uwe
Re: [PATCH v3 0/6] pwm: Update PWM_PXA driver for SpacemiT K1
Posted by Guodong Xu 6 months, 3 weeks ago
On Tue, May 27, 2025 at 1:22 AM Uwe Kleine-König <ukleinek@kernel.org> wrote:
>
> Hello,
>
> On Tue, Apr 29, 2025 at 04:50:42PM +0800, Guodong Xu wrote:
> > This patchset adds support for the SpacemiT K1 SoC in the PWM_PXA driver
> > and updates related device tree bindings. The changes enable PWM
> > functionality on the K1 platform through driver enhancements,
> > configuration updates, and device tree additions.
> >
> > Functionality has been verified on the Banana Pi BPI-F3 board using PWM14,
> > configured as a pwm-backlight. Per community feedback, the actual
> > pwm-backlight node is not included in this patchset but can be found in
> > patch 7 of the v1 series, with modification of pwms property to 4-cell
> > format to match updated binding (#pwm-cells = <3>) since v3.
> >
> > +             pwms = <&pwm14 0 2000 0>;
> >
> > This patchset is based on [spacemit/for-next]
> >   base: https://github.com/spacemit-com/linux for-next
> >
> > Plus the following dependencies:
> > 1. Clock controller driver, posted by Heylen Chu (v8), with most of it has
> >    been accepted:
> > https://lore.kernel.org/all/20250416135406.16284-1-heylenay@4d2.org/
> > 2. Reset controller driver, posted by Alex Elder (v5):
> > https://lore.kernel.org/all/20250418145401.2603648-1-elder@riscstar.com/
>
> It's not clear to me if I have to look into this github tree and the
> listed dependencies. My impression is that it can go in on without these
> changes. Maybe it only starts working when these are also applied, but
> that shouldn't stop me applying this series, right?
>

Thanks Uwe for the review.

The dependency is in patch 3, where I added the PWM nodes (pwm0-pwm19) to
k1.dtsi. These nodes reference RESET_PWM0 to RESET_PWM19, which are only
defined after applying the spacemit reset patchset (Patch 1/6),
available here:

https://lore.kernel.org/all/20250513215345.3631593-2-elder@riscstar.com/

You're right that patches 1, 2, and 5 do not depend on that reset series
and can be applied independently.

> There is a patch in pwm/for-6.16-rc1 (namely commit df08fff8add2 ("pwm:
> pxa: Improve using dev_err_probe()")) that conflicts with this series.
> I applied patches 1, 2 and 5 on top of my pwm/for-nexxt branch resolving
> that conflict and rewording the commit log of patch 5. The result was
> pushed to
>
>         https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/pxa-spacemit
>

I've reviewed the three patches in pwm/pxa-spacemit, and they look good
to me.

Thanks again for handling the conflict and rewording the commit log.

> . If you confirm that you're happy with my modifications and it's
> correct to apply them without the listed dependencies I will add the
> patches to my queue for 6.17-rc1.
>

Yeah. And I confirm that they can be applied without the reset
dependencies.

Thanks.

BR,
Guodong

> Best regards
> Uwe
Re: [PATCH v3 0/6] pwm: Update PWM_PXA driver for SpacemiT K1
Posted by Uwe Kleine-König 6 months, 3 weeks ago
Hello Guodong,

On Tue, May 27, 2025 at 10:41:20AM +0800, Guodong Xu wrote:
> You're right that patches 1, 2, and 5 do not depend on that reset series
> and can be applied independently.
> 
> > [...]
> 
> Yeah. And I confirm that they can be applied without the reset
> dependencies.

Thanks for the confirmation, pushed as is to

	https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-nexxt

(i.e. as material for the 6.17-rc1 merge window as the PWM PR for
6.16-rc1 is already sent).

Best regards
Uwe
Re: [PATCH v3 0/6] pwm: Update PWM_PXA driver for SpacemiT K1
Posted by Guodong Xu 7 months, 1 week ago
Hi, All

On Tue, Apr 29, 2025 at 4:51 PM Guodong Xu <guodong@riscstar.com> wrote:
>
> This patchset adds support for the SpacemiT K1 SoC in the PWM_PXA driver
> and updates related device tree bindings. The changes enable PWM
> functionality on the K1 platform through driver enhancements,
> configuration updates, and device tree additions.
>

Gentle ping, any comments or concerns on this patchset?
Any feedback would be greatly appreciated.

Thanks in advance!
Best regards,
Guodong

> Functionality has been verified on the Banana Pi BPI-F3 board using PWM14,
> configured as a pwm-backlight. Per community feedback, the actual
> pwm-backlight node is not included in this patchset but can be found in
> patch 7 of the v1 series, with modification of pwms property to 4-cell
> format to match updated binding (#pwm-cells = <3>) since v3.
>
> +               pwms = <&pwm14 0 2000 0>;
>
> This patchset is based on [spacemit/for-next]
>   base: https://github.com/spacemit-com/linux for-next
>
> Plus the following dependencies:
> 1. Clock controller driver, posted by Heylen Chu (v8), with most of it has
>    been accepted:
> https://lore.kernel.org/all/20250416135406.16284-1-heylenay@4d2.org/
> 2. Reset controller driver, posted by Alex Elder (v5):
> https://lore.kernel.org/all/20250418145401.2603648-1-elder@riscstar.com/
>
> Major differences between v3 and v2:
>  - Patch 1:
>     - Added: Reviewed-by: Rob Herring (Arm) <robh@kernel.org> # v2.
>     - When compatible string contains "spacemit,k1-pwm",
>       #pwm-cells must be 3.
>  - Patch 2:
>     - Dropped the addition of a reset_control field to struct pxa_pwm_chip.
>     - Using a local variable in pwm_probe() instead.
>  - Patch 3:
>     - In k1.dtsi, changed #pwm-cells = <1> to <3>.
>
> Major differences between v2 and v1:
>  - Dropped the addition of spacemit,k1-pwm as a compatible string in the
>    PWM_PXA driver; instead, it now falls back to marvell,pxa910-pwm.
>  - Removed pinctrl settings for all PWM nodes (pwm0-pwm14); only the
>    pwm14_1 configuration is included in this version.
>  - Changed PWM_PXA from built-in to a loadable module (=m) in the
>    riscv defconfig.
>
> v2 consists of the following patches:
> Patch 1: Add spacemit,k1-pwm compatible string (with fallback to
>            marvell,pxa910-pwm) and support optional resets property.
> Patch 2: Add reset controller support to the PWM_PXA driver.
> Patch 3: Add device tree nodes for all 20 PWM instances on K1.
> Patch 4: Add pinctrl settings for PWM14.
> Patch 5: Add ARCH_SPACEMIT dependency to the PWM_PXA Kconfig entry.
> Patch 6: Enable PWM and PWM_PXA in riscv defconfig for SpacemiT K1.
>
> v2:
> https://lore.kernel.org/all/20250420070251.378950-1-guodong@riscstar.com/
>
> v1:
> https://lore.kernel.org/all/20250411131423.3802611-1-guodong@riscstar.com/
>
> Best regards,
> Guodong Xu
>
> Guodong Xu (6):
>   dt-bindings: pwm: marvell,pxa-pwm: Add SpacemiT K1 PWM support
>   pwm: pxa: add optional reset control
>   riscv: dts: spacemit: add PWM support for K1 SoC
>   riscv: dts: spacemit: add pwm14_1 pinctrl setting
>   pwm: Kconfig: add depends on ARCH_SPACEMIT to PWM_PXA
>   riscv: defconfig: Enable PWM support for SpacemiT K1 SoC
>
>  .../bindings/pwm/marvell,pxa-pwm.yaml         |  35 +++-
>  arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi  |   7 +
>  arch/riscv/boot/dts/spacemit/k1.dtsi          | 180 ++++++++++++++++++
>  arch/riscv/configs/defconfig                  |   2 +
>  drivers/pwm/Kconfig                           |   2 +-
>  drivers/pwm/pwm-pxa.c                         |   7 +
>  6 files changed, 225 insertions(+), 8 deletions(-)
>
>
> base-commit: cb9c3aeae509b36afbdf46942a7a0a0dfc856ce7
> prerequisite-patch-id: a5d2fb43fd88525fa6c8ee767c31adfee87f1012
> prerequisite-patch-id: 8a8d0eefd0b4423d87f3c093b451a0fa60622ec4
> prerequisite-patch-id: 30f92f93e5b3577bde61424303f21c709a715ec5
> prerequisite-patch-id: d774b8281b5c6a822445365ee94925e1ab6c7a93
> prerequisite-patch-id: 54a4f5d065eb9f212fd99efec6e7e06abbb9bad8
> prerequisite-patch-id: 93962be60d1b58a98d947edf51b4af9edf513785
> prerequisite-patch-id: 5f53f8bf16fb067628092daebc4831293261aa01
> --
> 2.43.0
>
Re: (subset) [PATCH v3 0/6] pwm: Update PWM_PXA driver for SpacemiT K1
Posted by Yixun Lan 5 months, 1 week ago
On Tue, 29 Apr 2025 16:50:42 +0800, Guodong Xu wrote:
> This patchset adds support for the SpacemiT K1 SoC in the PWM_PXA driver
> and updates related device tree bindings. The changes enable PWM
> functionality on the K1 platform through driver enhancements,
> configuration updates, and device tree additions.
> 
> Functionality has been verified on the Banana Pi BPI-F3 board using PWM14,
> configured as a pwm-backlight. Per community feedback, the actual
> pwm-backlight node is not included in this patchset but can be found in
> patch 7 of the v1 series, with modification of pwms property to 4-cell
> format to match updated binding (#pwm-cells = <3>) since v3.
> 
> [...]

Applied, thanks!

[3/6] riscv: dts: spacemit: add PWM support for K1 SoC
      https://github.com/spacemit-com/linux/commit/9aebdfc21f755e0d2766683aa251435fb656ea47
[4/6] riscv: dts: spacemit: add pwm14_1 pinctrl setting
      https://github.com/spacemit-com/linux/commit/8709d51024068d4c81dc785d63169d283d147cf3

Best regards,
-- 
Yixun Lan
Re: (subset) [PATCH v3 0/6] pwm: Update PWM_PXA driver for SpacemiT K1
Posted by Yixun Lan 5 months, 1 week ago
Hi Guodong,

On 22:33 Tue 08 Jul     , Yixun Lan wrote:
> 
> On Tue, 29 Apr 2025 16:50:42 +0800, Guodong Xu wrote:
> > This patchset adds support for the SpacemiT K1 SoC in the PWM_PXA driver
> > and updates related device tree bindings. The changes enable PWM
> > functionality on the K1 platform through driver enhancements,
> > configuration updates, and device tree additions.
> > 
> > Functionality has been verified on the Banana Pi BPI-F3 board using PWM14,
> > configured as a pwm-backlight. Per community feedback, the actual
> > pwm-backlight node is not included in this patchset but can be found in
> > patch 7 of the v1 series, with modification of pwms property to 4-cell
> > format to match updated binding (#pwm-cells = <3>) since v3.
> > 
> > [...]
> 
> Applied, thanks!
> 
> [3/6] riscv: dts: spacemit: add PWM support for K1 SoC
>       https://github.com/spacemit-com/linux/commit/9aebdfc21f755e0d2766683aa251435fb656ea47

found have to re-arrange the nodes according to ascending order of unit address,
so here is new version I've pushed, just FYI, please check (should have
no functionality changes)
       https://github.com/spacemit-com/linux/commit/66f56c7a64213948341521b5310064586a05c80e

> [4/6] riscv: dts: spacemit: add pwm14_1 pinctrl setting
>       https://github.com/spacemit-com/linux/commit/8709d51024068d4c81dc785d63169d283d147cf3

-- 
Yixun Lan (dlan)
Re: (subset) [PATCH v3 0/6] pwm: Update PWM_PXA driver for SpacemiT K1
Posted by Guodong Xu 5 months, 1 week ago
On Wed, Jul 9, 2025 at 2:37 PM Yixun Lan <dlan@gentoo.org> wrote:
>
> Hi Guodong,
>
> On 22:33 Tue 08 Jul     , Yixun Lan wrote:
> >
> > On Tue, 29 Apr 2025 16:50:42 +0800, Guodong Xu wrote:
> > > This patchset adds support for the SpacemiT K1 SoC in the PWM_PXA driver
> > > and updates related device tree bindings. The changes enable PWM
> > > functionality on the K1 platform through driver enhancements,
> > > configuration updates, and device tree additions.
> > >
> > > Functionality has been verified on the Banana Pi BPI-F3 board using PWM14,
> > > configured as a pwm-backlight. Per community feedback, the actual
> > > pwm-backlight node is not included in this patchset but can be found in
> > > patch 7 of the v1 series, with modification of pwms property to 4-cell
> > > format to match updated binding (#pwm-cells = <3>) since v3.
> > >
> > > [...]
> >
> > Applied, thanks!
> >
> > [3/6] riscv: dts: spacemit: add PWM support for K1 SoC
> >       https://github.com/spacemit-com/linux/commit/9aebdfc21f755e0d2766683aa251435fb656ea47
>
> found have to re-arrange the nodes according to ascending order of unit address,
> so here is new version I've pushed, just FYI, please check (should have
> no functionality changes)
>        https://github.com/spacemit-com/linux/commit/66f56c7a64213948341521b5310064586a05c80e

Looks good. Thanks Yixun.

>
> > [4/6] riscv: dts: spacemit: add pwm14_1 pinctrl setting
> >       https://github.com/spacemit-com/linux/commit/8709d51024068d4c81dc785d63169d283d147cf3
>
> --
> Yixun Lan (dlan)