Skip to contentSkip to conversation

Add support for PWM SiFive

PATCH Superseded Yash Shah 3 participants 9 messages Apr 23, 2020 – Jul 9, 2020

Subsystems (2)
lore
Share & tools
lore

Yash Shah

author
#0 lore raw

v2 cover Add support for PWM SiFive

The patch series adds support for PWM controller in SiFive SoCs

Changes in v2:
- Introduce a new patch to add the DT documentation
- Change commit message to include reference of Linux ver and commit
- Remove unnecessary function "pwm_sifive_set_invert"
- Use "dev_read_addr_ptr" instead of "dev_read_addr" to avoid cast on each readl/writel call

Yash Shah (2):
pwm: Add DT documentation for SiFive PWM Controller
pwm: Add PWM driver for SiFive SoC

 doc/device-tree-bindings/pwm/pwm-sifive.txt |  31 +++++
 drivers/pwm/Kconfig                         |   6 +
 drivers/pwm/Makefile                        |   1 +
 drivers/pwm/pwm-sifive.c                    | 172 ++++++++++++++++++++++++++++
 4 files changed, 210 insertions(+)
 create mode 100644 doc/device-tree-bindings/pwm/pwm-sifive.txt
 create mode 100644 drivers/pwm/pwm-sifive.c
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 1/2 pwm: Add DT documentation for SiFive PWM Controller

DT documentation for PWM controller added from Linux v5.6

commit: daa78cc3408e
("pwm: sifive: Add DT documentation for SiFive PWM Controller")

---
 doc/device-tree-bindings/pwm/pwm-sifive.txt | 31 +++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 doc/device-tree-bindings/pwm/pwm-sifive.txt
doc/device-tree-bindings/pwm/pwm-sifive.txt new file +31 -0
new file mode 100644
index 0000000..9a98837
@@ -0,0 +1,31 @@
+SiFive PWM controller
+
+Unlike most other PWM controllers, the SiFive PWM controller currently only
+supports one period for all channels in the PWM. All PWMs need to run at
+the same period. The period also has significant restrictions on the values
+it can achieve, which the driver rounds to the nearest achievable period.
+PWM RTL that corresponds to the IP block version numbers can be found
+here:
+
+https://github.com/sifive/sifive-blocks/tree/master/src/main/scala/devices/pwm
+
+Required properties:
+- compatible: Should be "sifive,<chip>-pwm" and "sifive,pwm<version>".
+  Supported compatible strings are: "sifive,fu540-c000-pwm" for the SiFive
+  PWM v0 as integrated onto the SiFive FU540 chip, and "sifive,pwm0" for the
+  SiFive PWM v0 IP block with no chip integration tweaks.
+- reg: physical base address and length of the controller's registers
+- clocks: Should contain a clock identifier for the PWM's parent clock.
+- #pwm-cells: Should be 3.
+- interrupts: one interrupt per PWM channel
+
+Examples:
+
+pwm:  pwm at 10020000 {
+	compatible = "sifive,fu540-c000-pwm", "sifive,pwm0";
+	reg = <0x0 0x10020000 0x0 0x1000>;
+	clocks = <&tlclk>;
+	interrupt-parent = <&plic>;
+	interrupts = <42 43 44 45>;
+	#pwm-cells = <3>;
+};
Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 1/2 pwm: Add DT documentation for SiFive PWM Controller

Hello Yash,

Am 23.04.2020 um 13:27 schrieb Yash Shah:

Quoted 10 lines

DT documentation for PWM controller added from Linux v5.6

commit: daa78cc3408e
("pwm: sifive: Add DT documentation for SiFive PWM Controller")

---
  doc/device-tree-bindings/pwm/pwm-sifive.txt | 31 +++++++++++++++++++++++++++++
  1 file changed, 31 insertions(+)

create mode 100644 doc/device-tree-bindings/pwm/pwm-sifive.txt

@Tom: Do you want to pick up this patch, or I can take it into u-boot-i2c tree (as I currently plan to send a pull request)?

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de
#3 lore raw

PATCH v2 1/2 pwm: Add DT documentation for SiFive PWM Controller

In reply to Yash Shah

Hello Yash,

Am 23.04.2020 um 13:27 schrieb Yash Shah:

Quoted 10 lines

DT documentation for PWM controller added from Linux v5.6

commit: daa78cc3408e
("pwm: sifive: Add DT documentation for SiFive PWM Controller")

---
  doc/device-tree-bindings/pwm/pwm-sifive.txt | 31 +++++++++++++++++++++++++++++
  1 file changed, 31 insertions(+)

create mode 100644 doc/device-tree-bindings/pwm/pwm-sifive.txt

Applied to u-boot-i2c.git master

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de
author
#4 lore raw

PATCH v2 2/2 pwm: Add PWM driver for SiFive SoC

In reply to Yash Shah

Adds a PWM driver for PWM chip present in SiFive's HiFive Unleashed SoC This driver is simple port of Linux pwm sifive driver from Linux v5.6

commit: 9e37a53eb051 ("pwm: sifive: Add a driver for SiFive SoC PWM")

---
 drivers/pwm/Kconfig      |   6 ++
 drivers/pwm/Makefile     |   1 +
 drivers/pwm/pwm-sifive.c | 172 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 179 insertions(+)
 create mode 100644 drivers/pwm/pwm-sifive.c
drivers/pwm/Kconfig +6 -0
index 1f36fc7..d6ea9ee 100644
@@ -40,6 +40,12 @@ config PWM_SANDBOX
 	  useful. The PWM can be enabled but is not connected to any outputs
 	  so this is not very useful.
 
+config PWM_SIFIVE
+	bool "Enable support for SiFive PWM"
+	depends on DM_PWM
+	help
+	  This PWM is found SiFive's FU540 and other SoCs.
+
 config PWM_TEGRA
 	bool "Enable support for the Tegra PWM"
 	depends on DM_PWM
drivers/pwm/Makefile +1 -0
index a837c35..c2c7fce 100644
@@ -14,5 +14,6 @@ obj-$(CONFIG_PWM_EXYNOS)	+= exynos_pwm.o
 obj-$(CONFIG_PWM_IMX)		+= pwm-imx.o pwm-imx-util.o
 obj-$(CONFIG_PWM_ROCKCHIP)	+= rk_pwm.o
 obj-$(CONFIG_PWM_SANDBOX)	+= sandbox_pwm.o
+obj-$(CONFIG_PWM_SIFIVE)	+= pwm-sifive.o
 obj-$(CONFIG_PWM_TEGRA)		+= tegra_pwm.o
 obj-$(CONFIG_PWM_SUNXI)		+= sunxi_pwm.o
drivers/pwm/pwm-sifive.c new file +172 -0

172 lines not on this page · raw message

Signature · 1 line
2.7.4
#5 lore raw

PATCH v2 2/2 pwm: Add PWM driver for SiFive SoC

Hello Yash,

Am 23.04.2020 um 13:27 schrieb Yash Shah:

Quoted 5 lines

Adds a PWM driver for PWM chip present in SiFive's HiFive Unleashed SoC This driver is simple port of Linux pwm sifive driver from Linux v5.6

commit: 9e37a53eb051 ("pwm: sifive: Add a driver for SiFive SoC PWM")

Quoted 7 lines
---
  drivers/pwm/Kconfig      |   6 ++
  drivers/pwm/Makefile     |   1 +
  drivers/pwm/pwm-sifive.c | 172 +++++++++++++++++++++++++++++++++++++++++++++++
  3 files changed, 179 insertions(+)

create mode 100644 drivers/pwm/pwm-sifive.c

@Tom: Do you want to pick up this patch, or I can take it into u-boot-i2c tree (as I currently plan to send a pull request)?

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de
#6 lore raw

PATCH v2 2/2 pwm: Add PWM driver for SiFive SoC

Quoted 16 lines · Heiko Schocher

Hello Yash,

Am 23.04.2020 um 13:27 schrieb Yash Shah:

Quoted 5 lines

Adds a PWM driver for PWM chip present in SiFive's HiFive Unleashed SoC This driver is simple port of Linux pwm sifive driver from Linux v5.6

commit: 9e37a53eb051 ("pwm: sifive: Add a driver for SiFive SoC PWM")

Quoted 7 lines
---
  drivers/pwm/Kconfig      |   6 ++
  drivers/pwm/Makefile     |   1 +
  drivers/pwm/pwm-sifive.c | 172 +++++++++++++++++++++++++++++++++++++++++++++++
  3 files changed, 179 insertions(+)

create mode 100644 drivers/pwm/pwm-sifive.c

Quoted 4 lines

@Tom: Do you want to pick up this patch, or I can take it into u-boot-i2c tree (as I currently plan to send a pull request)?

Take it via your tree, thanks.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200708/120935be/attachment.sig>
#7 lore raw

PATCH v2 2/2 pwm: Add PWM driver for SiFive SoC

In reply to Yash Shah

Hello Yash,

Am 23.04.2020 um 13:27 schrieb Yash Shah:

Quoted 5 lines

Adds a PWM driver for PWM chip present in SiFive's HiFive Unleashed SoC This driver is simple port of Linux pwm sifive driver from Linux v5.6

commit: 9e37a53eb051 ("pwm: sifive: Add a driver for SiFive SoC PWM")

Quoted 7 lines
---
  drivers/pwm/Kconfig      |   6 ++
  drivers/pwm/Makefile     |   1 +
  drivers/pwm/pwm-sifive.c | 172 +++++++++++++++++++++++++++++++++++++++++++++++
  3 files changed, 179 insertions(+)

create mode 100644 drivers/pwm/pwm-sifive.c

Applied to u-boot-i2c.git master

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de
author
#8 lore raw

v2 cover Add support for PWM SiFive

In reply to Yash Shah

Any comments or update on this series?

- Yash

Quoted 32 lines

-----Original Message-----
From: Yash Shah <[email protected]>
Sent: 23 April 2020 16:58
To: martyn.welch at collabora.co.uk; hs at denx.de; u-boot at lists.denx.de; Sachin Ghadi <[email protected]>
Cc: Yash Shah <[email protected]>
Subject: [PATCH v2 0/2] Add support for PWM SiFive

The patch series adds support for PWM controller in SiFive SoCs

Changes in v2:
- Introduce a new patch to add the DT documentation
- Change commit message to include reference of Linux ver and commit
- Remove unnecessary function "pwm_sifive_set_invert"
- Use "dev_read_addr_ptr" instead of "dev_read_addr" to avoid cast on each readl/writel call

Yash Shah (2):
pwm: Add DT documentation for SiFive PWM Controller
pwm: Add PWM driver for SiFive SoC

 doc/device-tree-bindings/pwm/pwm-sifive.txt |  31 +++++
 drivers/pwm/Kconfig                         |   6 +
 drivers/pwm/Makefile                        |   1 +
 drivers/pwm/pwm-sifive.c                    | 172
++++++++++++++++++++++++++++
 4 files changed, 210 insertions(+)
 create mode 100644 doc/device-tree-bindings/pwm/pwm-sifive.txt
 create mode 100644 drivers/pwm/pwm-sifive.c

--
2.7.4