Skip to contentSkip to conversation

Add PWM driver for Suplus SP7021 SoC

PATCH Applied Hammer Hsieh 3 participants 7 messages Mar 22, 2022 – Apr 25, 2022

Subsystems (3)
lore
Share & tools
lore

Hammer Hsieh

author maintainer
#0 lore raw

v4 cover Add PWM driver for Suplus SP7021 SoC

This is a patch series for PWM driver for Suplus SP7021 SoC.

Sunplus SP7021 is an ARM Cortex A7 (4 cores) based SoC. It integrates many peripherals (ex: UART. I2C, SPI, SDIO, eMMC, USB, SD card and etc.) into a single chip. It is designed for industrial control.

Refer to:
https://sunplus-tibbo.atlassian.net/wiki/spaces/doc/overview
https://tibbo.com/store/plus1.html

Refer to (PWM):
https://sunplus.atlassian.net/wiki/spaces/doc/pages/461144198/12.+Pulse+Width+Modulation+PWM

Hammer Hsieh (2):
dt-bindings: pwm: Add bindings doc for Sunplus SoC SP7021 PWM Driver
pwm: sunplus-pwm: Add Sunplus SoC SP7021 PWM Driver

 .../bindings/pwm/sunplus,sp7021-pwm.yaml           |  42 ++++
 MAINTAINERS                                        |   6 +
 drivers/pwm/Kconfig                                |  11 +
 drivers/pwm/Makefile                               |   1 +
 drivers/pwm/pwm-sunplus.c                          | 232 +++++++++++++++++++++
 5 files changed, 292 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/sunplus,sp7021-pwm.yaml
 create mode 100644 drivers/pwm/pwm-sunplus.c
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH v4 1/2 dt-bindings: pwm: Add bindings doc for Sunplus SoC SP7021 PWM Driver

Add bindings doc for Sunplus SoC SP7021 PWM Driver

---
Changes in v4:
- no change

 .../bindings/pwm/sunplus,sp7021-pwm.yaml           | 42 ++++++++++++++++++++++
 MAINTAINERS                                        |  5 +++
 2 files changed, 47 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/sunplus,sp7021-pwm.yaml
Documentation/devicetree/bindings/pwm/sunplus,sp7021-pwm.yaml new file +42 -0
new file mode 100644
index 0000000..d4fc9e8
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) Sunplus Co., Ltd. 2021
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pwm/sunplus,sp7021-pwm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sunplus SoC SP7021 PWM Controller
+
+maintainers:
+  - Hammer Hsieh <[email protected]>
+
+allOf:
+  - $ref: pwm.yaml#
+
+properties:
+  compatible:
+    const: sunplus,sp7021-pwm
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  '#pwm-cells':
+    const: 2
+
+unevaluatedProperties: false
+
+required:
+  - reg
+  - clocks
+
+examples:
+  - |
+    pwm: pwm@9c007a00 {
+      compatible = "sunplus,sp7021-pwm";
+      reg = <0x9c007a00 0x80>;
+      clocks = <&clkc 0xa2>;
+      #pwm-cells = <2>;
+    };
MAINTAINERS +5 -0
index 2524b75..e1cb7eb 100644
@@ -18531,6 +18531,11 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/net/ethernet/dlink/sundance.c
 
+SUNPLUS PWM DRIVER
+M:	Hammer Hsieh <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/pwm/sunplus,sp7021-pwm.yaml
+
 SUNPLUS RTC DRIVER
 M:	Vincent Shih <[email protected]>
 L:	[email protected]
Signature · 1 line
2.7.4
maintainer Acked-by on v4 1/2
#2 lore raw

Re: [PATCH v4 1/2] dt-bindings: pwm: Add bindings doc for Sunplus SoC SP7021 PWM Driver

Quoted 4 lines · Hammer Hsieh

Add bindings doc for Sunplus SoC SP7021 PWM Driver

Quoted 9 lines

---
Changes in v4:
- no change

 .../bindings/pwm/sunplus,sp7021-pwm.yaml           | 42 ++++++++++++++++++++++
 MAINTAINERS                                        |  5 +++
 2 files changed, 47 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/sunplus,sp7021-pwm.yaml
author maintainer
#3 lore raw

PATCH v4 2/2 pwm: sunplus-pwm: Add Sunplus SoC SP7021 PWM Driver

In reply to Hammer Hsieh

Add Sunplus SoC SP7021 PWM Driver

---
Changes in v4:
- Addressed all comments from Uwe Kleine-König.
1. define name change based on datasheet.
2. apply() period calculation modified by Uwe Kleine-König recommanded.
3. use FIELD_GET / FIELD_PREP for simplify code.
- Addressed all comments from Rob Herring.
git-send-email asking encoding and press y casued message corrupted issue. just press enter to keep UTF-8 default setting.

 MAINTAINERS               |   1 +
 drivers/pwm/Kconfig       |  11 +++
 drivers/pwm/Makefile      |   1 +
 drivers/pwm/pwm-sunplus.c | 232 ++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 245 insertions(+)
 create mode 100644 drivers/pwm/pwm-sunplus.c
MAINTAINERS +1 -0
index e1cb7eb..6644bae 100644
@@ -18535,6 +18535,7 @@ SUNPLUS PWM DRIVER
 M:	Hammer Hsieh <[email protected]>
 S:	Maintained
 F:	Documentation/devicetree/bindings/pwm/sunplus,sp7021-pwm.yaml
+F:	drivers/pwm/pwm-sunplus.c
 
 SUNPLUS RTC DRIVER
 M:	Vincent Shih <[email protected]>
drivers/pwm/Kconfig +11 -0
index 21e3b05..54cfb50 100644
@@ -572,6 +572,17 @@ config PWM_SUN4I
 	  To compile this driver as a module, choose M here: the module
 	  will be called pwm-sun4i.
 
+config PWM_SUNPLUS
+	tristate "Sunplus PWM support"
+	depends on ARCH_SUNPLUS || COMPILE_TEST
+	depends on HAS_IOMEM && OF
+	help
+	  Generic PWM framework driver for the PWM controller on
+	  Sunplus SoCs.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called pwm-sunplus.
+
 config PWM_TEGRA
 	tristate "NVIDIA Tegra PWM support"
 	depends on ARCH_TEGRA || COMPILE_TEST
drivers/pwm/Makefile +1 -0
index 708840b..be58616 100644
@@ -53,6 +53,7 @@ obj-$(CONFIG_PWM_STM32)		+= pwm-stm32.o
 obj-$(CONFIG_PWM_STM32_LP)	+= pwm-stm32-lp.o
 obj-$(CONFIG_PWM_STMPE)		+= pwm-stmpe.o
 obj-$(CONFIG_PWM_SUN4I)		+= pwm-sun4i.o
+obj-$(CONFIG_PWM_SUNPLUS)	+= pwm-sunplus.o
 obj-$(CONFIG_PWM_TEGRA)		+= pwm-tegra.o
 obj-$(CONFIG_PWM_TIECAP)	+= pwm-tiecap.o
 obj-$(CONFIG_PWM_TIEHRPWM)	+= pwm-tiehrpwm.o
drivers/pwm/pwm-sunplus.c new file +232 -0

232 lines not on this page · raw message

Signature · 1 line
2.7.4
#4 lore raw
In reply to Hammer Hsieh
Quoted 17 lines · Hammer Hsieh

This is a patch series for PWM driver for Suplus SP7021 SoC.

Sunplus SP7021 is an ARM Cortex A7 (4 cores) based SoC. It integrates many peripherals (ex: UART. I2C, SPI, SDIO, eMMC, USB, SD card and etc.) into a single chip. It is designed for industrial control.

Refer to:
https://sunplus-tibbo.atlassian.net/wiki/spaces/doc/overview
https://tibbo.com/store/plus1.html

Refer to (PWM):
https://sunplus.atlassian.net/wiki/spaces/doc/pages/461144198/12.+Pulse+Width+Modulation+PWM

Hammer Hsieh (2):
dt-bindings: pwm: Add bindings doc for Sunplus SoC SP7021 PWM Driver
pwm: sunplus-pwm: Add Sunplus SoC SP7021 PWM Driver

Quoted 8 lines
 .../bindings/pwm/sunplus,sp7021-pwm.yaml           |  42 ++++
 MAINTAINERS                                        |   6 +
 drivers/pwm/Kconfig                                |  11 +
 drivers/pwm/Makefile                               |   1 +
 drivers/pwm/pwm-sunplus.c                          | 232 +++++++++++++++++++++
 5 files changed, 292 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pwm/sunplus,sp7021-pwm.yaml
 create mode 100644 drivers/pwm/pwm-sunplus.c

Applied, thanks.

Thierry

#5 lore raw
In reply to Hammer Hsieh
Quoted 5 lines · Hammer Hsieh

This is a patch series for PWM driver for Suplus SP7021 SoC.

Sunplus SP7021 is an ARM Cortex A7 (4 cores) based SoC. It integrates many peripherals (ex: UART. I2C, SPI, SDIO, eMMC, USB, SD card and etc.) into a single chip. It is designed for industrial control.

I just noticed as I was trying to do test builds that ARCH_SUNPLUS doesn't exist yet. Are there any plans to add those in the near future?

I can always use COMPILE_TEST to do test build, but I like to also do proper builds because they sometimes flag things that COMPILE_TEST misses (like this one).

Thierry

author maintainer
#6 lore raw

Yes, my colleague is working on it right now.
But he submitted too many items at a time. (clock/reset/interrupt, defconfig/, arch/arm...)
Current patch v13, still ongoing.
https://lore.kernel.org/all/[email protected]/

Thierry Reding <[email protected]> 於 2022年4月23日 週六 上午1:23寫道:

Quoted 16 lines · Hammer Hsieh
Quoted 5 lines

This is a patch series for PWM driver for Suplus SP7021 SoC.

Sunplus SP7021 is an ARM Cortex A7 (4 cores) based SoC. It integrates many peripherals (ex: UART. I2C, SPI, SDIO, eMMC, USB, SD card and etc.) into a single chip. It is designed for industrial control.

I just noticed as I was trying to do test builds that ARCH_SUNPLUS doesn't exist yet. Are there any plans to add those in the near future?

I can always use COMPILE_TEST to do test build, but I like to also do proper builds because they sometimes flag things that COMPILE_TEST misses (like this one).

Thierry