Skip to contentSkip to conversation

update synopsys driver for platform/devicetree support

PATCH Superseded Ben Dooks 4 participants 34 messages Jul 12, 2022 – Jul 19, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

This is a series to allow the Synopsys PWM driver to be built for device-tree/platform usage.

An open question is whether there should be some form of standard property for the number of PWMs that each device supports.

Note, the patches 5 and 6 could be grouped together as patch 6 undoes some of the bits in 5 for configuration of clock rate.

author
#1 lore raw

PATCH 1/7 pwm: change &pci->dev to dev in probe

The dwc_pwm_probe() assignes dev to be &pci->dev but then uses &pci->dev throughout the function. Change these all to the be 'dev' variable to make lines shorter.

---
 drivers/pwm/pwm-dwc.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/pwm/pwm-dwc.c +4 -6
index 7568300bb11e..c706ef9a7ba1 100644
@@ -202,14 +202,13 @@ static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id)
 	struct dwc_pwm *dwc;
 	int ret;
 
-	dwc = devm_kzalloc(&pci->dev, sizeof(*dwc), GFP_KERNEL);
+	dwc = devm_kzalloc(dev, sizeof(*dwc), GFP_KERNEL);
 	if (!dwc)
 		return -ENOMEM;
 
 	ret = pcim_enable_device(pci);
 	if (ret) {
-		dev_err(&pci->dev,
-			"Failed to enable device (%pe)\n", ERR_PTR(ret));
+		dev_err(dev, "Failed to enable device (%pe)\n", ERR_PTR(ret));
 		return ret;
 	}
 
@@ -217,14 +216,13 @@ static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id)
 
 	ret = pcim_iomap_regions(pci, BIT(0), pci_name(pci));
 	if (ret) {
-		dev_err(&pci->dev,
-			"Failed to iomap PCI BAR (%pe)\n", ERR_PTR(ret));
+		dev_err(dev, "Failed to iomap PCI BAR (%pe)\n", ERR_PTR(ret));
 		return ret;
 	}
 
 	dwc->base = pcim_iomap_table(pci)[0];
 	if (!dwc->base) {
-		dev_err(&pci->dev, "Base address missing\n");
+		dev_err(dev, "Base address missing\n");
 		return -ENOMEM;
 	}
 
Signature · 1 line
2.35.1
author
#7 lore raw

PATCH 2/7 pwm: move dwc memory alloc to own function

In reply to Ben Dooks

In preparation for adding other bus support, move the allocation of the pwm struct out of the main driver code.

---
 drivers/pwm/pwm-dwc.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)
drivers/pwm/pwm-dwc.c +17 -7
index c706ef9a7ba1..61f11e0a9319 100644
@@ -196,13 +196,29 @@ static const struct pwm_ops dwc_pwm_ops = {
 	.owner = THIS_MODULE,
 };
 
+static struct dwc_pwm *dwc_pwm_alloc(struct device *dev)
+{
+	struct dwc_pwm *dwc;
+
+	dwc = devm_kzalloc(dev, sizeof(*dwc), GFP_KERNEL);
+	if (!dwc)
+		return NULL;
+
+	dwc->chip.dev = dev;
+	dwc->chip.ops = &dwc_pwm_ops;
+	dwc->chip.npwm = DWC_TIMERS_TOTAL;
+
+	dev_set_drvdata(dev, dwc);
+	return dwc;
+}
+
 static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id)
 {
 	struct device *dev = &pci->dev;
 	struct dwc_pwm *dwc;
 	int ret;
 
-	dwc = devm_kzalloc(dev, sizeof(*dwc), GFP_KERNEL);
+	dwc = dwc_pwm_alloc(dev);
 	if (!dwc)
 		return -ENOMEM;
 
@@ -226,12 +242,6 @@ static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id)
 		return -ENOMEM;
 	}
 
-	pci_set_drvdata(pci, dwc);
-
-	dwc->chip.dev = dev;
-	dwc->chip.ops = &dwc_pwm_ops;
-	dwc->chip.npwm = DWC_TIMERS_TOTAL;
-
 	ret = pwmchip_add(&dwc->chip);
 	if (ret)
 		return ret;
Signature · 1 line
2.35.1
author
#8 lore raw

PATCH 3/7 pwm: dwc: add of/platform support

In reply to Ben Dooks

The dwc pwm controller can be used in non-PCI systems, so allow either platform or OF based probing.

---
 .../devicetree/bindings/pwm/pwm-synposys.yaml | 40 ++++++++++++++
 drivers/pwm/Kconfig                           |  5 +-
 drivers/pwm/pwm-dwc.c                         | 53 +++++++++++++++++++
 3 files changed, 96 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/pwm/pwm-synposys.yaml
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml new file +40 -0
new file mode 100644
index 000000000000..38ac0da75272
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2022 SiFive, Inc.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pwm/pwm-synposys.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Synopsys PWM controller
+
+maintainers:
+   - Ben Dooks <[email protected]>
+
+properties:
+  "#pwm-cells":
+    description: |
+      See pwm.yaml in this directory for a description of the cells format.
+
+  clocks:
+    items:
+      - description: Interface bus clock
+      - description: PWM reference clock
+
+  clock-names:
+    items:
+      - const: bus
+      - const: timer
+
+  compatible:
+    oneOf:
+      - items:
+        - const: snps,pwm
+
+required:
+  - "#pwm-cells"
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+
+additionalProperties: false
drivers/pwm/Kconfig +3 -2
index 904de8d61828..e1aa645c1084 100644
@@ -166,9 +166,10 @@ config PWM_CROS_EC
 
 config PWM_DWC
 	tristate "DesignWare PWM Controller"
-	depends on PCI
+	depends on PCI || OF
 	help
-	  PWM driver for Synopsys DWC PWM Controller attached to a PCI bus.
+	  PWM driver for Synopsys DWC PWM Controller attached to either a
+	  PCI or platform bus.
 
 	  To compile this driver as a module, choose M here: the module
 	  will be called pwm-dwc.
drivers/pwm/pwm-dwc.c +53 -0

65 lines not on this page · raw message

Signature · 1 line
2.35.1
author
#22 lore raw

PATCH 5/7 pwm: dwc: add timer clock

In reply to Ben Dooks

Add a configurable clock base rate for the pwm as when being built for non-PCI the block may be sourced from an internal clock.

---
 drivers/pwm/pwm-dwc.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/pwm/pwm-dwc.c +17 -0
index 235cb730c888..aa0486b89bdd 100644
@@ -18,6 +18,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/pci.h>
+#include <linux/clk.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/pwm.h>
@@ -35,7 +36,12 @@
 #define DWC_TIMERS_COMP_VERSION	0xac
 
 #define DWC_TIMERS_TOTAL	8
+
+#ifndef CONFIG_OF
 #define DWC_CLK_PERIOD_NS	10
+#else
+#define DWC_CLK_PERIOD_NS	dwc->clk_ns
+#endif
 
 /* Timer Control Register */
 #define DWC_TIM_CTRL_EN		BIT(0)
@@ -54,6 +60,8 @@ struct dwc_pwm_ctx {
 struct dwc_pwm {
 	struct pwm_chip chip;
 	void __iomem *base;
+	struct clk *clk;
+	unsigned int clk_ns;
 	struct dwc_pwm_ctx ctx[DWC_TIMERS_TOTAL];
 };
 #define to_dwc_pwm(p)	(container_of((p), struct dwc_pwm, chip))
@@ -336,6 +344,14 @@ static int dwc_pwm_plat_probe(struct platform_device *pdev)
 		return dev_err_probe(dev, PTR_ERR(dwc->base),
 				     "failed to map IO\n");
 
+	dwc->clk = devm_clk_get(dev, "timer");
+	if (IS_ERR(dwc->clk))
+		return dev_err_probe(dev, PTR_ERR(dwc->clk),
+				     "failed to get timer clock\n");
+
+	clk_prepare_enable(dwc->clk);
+	dwc->clk_ns = 1000000000 /clk_get_rate(dwc->clk);
+
 	ret = pwmchip_add(&dwc->chip);
 	if (ret)
 		return ret;
@@ -347,6 +363,7 @@ static int dwc_pwm_plat_remove(struct platform_device *pdev)
 {
 	struct dwc_pwm *dwc = platform_get_drvdata(pdev);
 
+	clk_disable_unprepare(dwc->clk);
 	pwmchip_remove(&dwc->chip);
 	return 0;
 }
Signature · 1 line
2.35.1
author
#24 lore raw

PATCH 6/7 pwm: dwc: remove the CONFIG_OF in timer clock

In reply to Ben Dooks

We should probably change from the #ifdef added earlier in 49a0f4692a8752c7b03cb26d54282bee5c8c71bb ("wm: dwc: add timer clock") and just have it always in the dwc data so if we have a system with both PCI and OF probing it should work

-- consider merging with original patch

---
 drivers/pwm/pwm-dwc.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/pwm/pwm-dwc.c +5 -10
index aa0486b89bdd..6a4364a5d137 100644
@@ -37,12 +37,6 @@
 
 #define DWC_TIMERS_TOTAL	8
 
-#ifndef CONFIG_OF
-#define DWC_CLK_PERIOD_NS	10
-#else
-#define DWC_CLK_PERIOD_NS	dwc->clk_ns
-#endif
-
 /* Timer Control Register */
 #define DWC_TIM_CTRL_EN		BIT(0)
 #define DWC_TIM_CTRL_MODE	BIT(1)
@@ -104,13 +98,13 @@ static int __dwc_pwm_configure_timer(struct dwc_pwm *dwc,
 	 * periods and check are the result within HW limits between 1 and
 	 * 2^32 periods.
 	 */
-	tmp = DIV_ROUND_CLOSEST_ULL(state->duty_cycle, DWC_CLK_PERIOD_NS);
+	tmp = DIV_ROUND_CLOSEST_ULL(state->duty_cycle, dwc->clk_ns);
 	if (tmp < 1 || tmp > (1ULL << 32))
 		return -ERANGE;
 	low = tmp - 1;
 
 	tmp = DIV_ROUND_CLOSEST_ULL(state->period - state->duty_cycle,
-				    DWC_CLK_PERIOD_NS);
+				    dwc->clk_ns);
 	if (tmp < 1 || tmp > (1ULL << 32))
 		return -ERANGE;
 	high = tmp - 1;
@@ -185,12 +179,12 @@ static void dwc_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
 
 	duty = dwc_pwm_readl(dwc, DWC_TIM_LD_CNT(pwm->hwpwm));
 	duty += 1;
-	duty *= DWC_CLK_PERIOD_NS;
+	duty *= dwc->clk_ns;
 	state->duty_cycle = duty;
 
 	period = dwc_pwm_readl(dwc, DWC_TIM_LD_CNT2(pwm->hwpwm));
 	period += 1;
-	period *= DWC_CLK_PERIOD_NS;
+	period *= dwc->clk_ns;
 	period += duty;
 	state->period = period;
 
@@ -213,6 +207,7 @@ static struct dwc_pwm *dwc_pwm_alloc(struct device *dev)
 	if (!dwc)
 		return NULL;
 
+	dwc->clk_ns = 10;
 	dwc->chip.dev = dev;
 	dwc->chip.ops = &dwc_pwm_ops;
 	dwc->chip.npwm = DWC_TIMERS_TOTAL;
Signature · 1 line
2.35.1
author
#30 lore raw

PATCH 7/7 pwm: dwc: add snps,pwm-number to limit pwm count

In reply to Ben Dooks

Add snps,pwm-number property to indicate if the block does not have all 8 of the PWM blocks.

Not sure if this should be a general PWM property consider optional for all PWM types, so have added a specific one here (there is only one other controller with a property for PWM count at the moment)

---
 Documentation/devicetree/bindings/pwm/pwm-synposys.yaml | 5 +++++
 drivers/pwm/pwm-dwc.c                                   | 8 ++++++++
 2 files changed, 13 insertions(+)
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml +5 -0
index 38ac0da75272..15bdf764b46a 100644
@@ -30,11 +30,16 @@ properties:
       - items:
         - const: snps,pwm
 
+  snps,pwm-number:
+    $ref: '/schemas/types.yaml#/definitions/uint32'
+    description: u32 value representing the number of PWM devices
+
 required:
   - "#pwm-cells"
   - compatible
   - reg
   - clocks
   - clock-names
+  - snps,pwm-number
 
 additionalProperties: false
drivers/pwm/pwm-dwc.c +8 -0
index 6a4364a5d137..abdde83452ad 100644
@@ -328,12 +328,20 @@ static int dwc_pwm_plat_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct dwc_pwm *dwc;
+	u32 nr_pwm;
 	int ret;
 
 	dwc = dwc_pwm_alloc(dev);
 	if (!dwc)
 		return -ENOMEM;
 
+	if (!device_property_read_u32(dev, "snps,pwm-number", &nr_pwm)) {
+		if (nr_pwm > DWC_TIMERS_TOTAL)
+			dev_err(dev, "too many PWMs specified (%d)\n", nr_pwm);
+		else
+			dwc->chip.npwm = nr_pwm;
+	}
+
 	dwc->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(dwc->base))
 		return dev_err_probe(dev, PTR_ERR(dwc->base),
Signature · 1 line
2.35.1
author
#21 lore raw

PATCH 4/7 pwm: dwc: allow driver to be built with COMPILE_TEST

In reply to Ben Dooks

Allow dwc driver to be built with COMPILE_TEST should allow better coverage when build testing.

---
 drivers/pwm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pwm/Kconfig +1 -1
index e1aa645c1084..e654655c4b3f 100644
@@ -166,7 +166,7 @@ config PWM_CROS_EC
 
 config PWM_DWC
 	tristate "DesignWare PWM Controller"
-	depends on PCI || OF
+	depends on PCI || OF || COMPILE_TEST
 	help
 	  PWM driver for Synopsys DWC PWM Controller attached to either a
 	  PCI or platform bus.
Signature · 1 line
2.35.1
#9 lore raw

Re: [PATCH 3/7] pwm: dwc: add of/platform support

In reply to Ben Dooks
Quoted 6 lines · Ben Dooks

The dwc pwm controller can be used in non-PCI systems, so allow either platform or OF based probing.

---
 .../devicetree/bindings/pwm/pwm-synposys.yaml | 40 ++++++++++++++

Bindings must be a separate patch. Preferably first in the series. Use proper subject prefix matching the subsystem.

Best regards,
Krzysztof

#31 lore raw

Re: [PATCH 7/7] pwm: dwc: add snps,pwm-number to limit pwm count

In reply to Ben Dooks
Quoted 10 lines · Ben Dooks

Add snps,pwm-number property to indicate if the block does not have all 8 of the PWM blocks.

Not sure if this should be a general PWM property consider optional for all PWM types, so have added a specific one here (there is only one other controller with a property for PWM count at the moment)

---
 Documentation/devicetree/bindings/pwm/pwm-synposys.yaml | 5 +++++

No. Please do not hide bindings patches in the code. They must be separate and checkpatch complains about it, so please be sure you run checkpatch.

Best regards,
Krzysztof

#25 lore raw

Re: [PATCH 6/7] pwm: dwc: remove the CONFIG_OF in timer clock

In reply to Ben Dooks
Quoted 6 lines · Ben Dooks

We should probably change from the #ifdef added earlier in 49a0f4692a8752c7b03cb26d54282bee5c8c71bb ("wm: dwc: add timer clock") and just have it always in the dwc data so if we have a system with both PCI and OF probing it should work

-- consider merging with original patch

Missing SoB. Please run checkpatch.

Best regards,
Krzysztof

author
#26 lore raw

Re: [PATCH 6/7] pwm: dwc: remove the CONFIG_OF in timer clock

Quoted 9 lines · Krzysztof Kozlowski
Quoted 6 lines · Ben Dooks

We should probably change from the #ifdef added earlier in 49a0f4692a8752c7b03cb26d54282bee5c8c71bb ("wm: dwc: add timer clock") and just have it always in the dwc data so if we have a system with both PCI and OF probing it should work

-- consider merging with original patch

Missing SoB. Please run checkpatch.

This was meant to be an RFC about whether it should be a single patch or merged back into the previous one.

maintainer
#12 lore raw

Re: [PATCH 3/7] pwm: dwc: add of/platform support

In reply to Ben Dooks
Quoted 11 lines · Ben Dooks

The dwc pwm controller can be used in non-PCI systems, so allow either platform or OF based probing.

---
 .../devicetree/bindings/pwm/pwm-synposys.yaml | 40 ++++++++++++++
 drivers/pwm/Kconfig                           |  5 +-
 drivers/pwm/pwm-dwc.c                         | 53 +++++++++++++++++++
 3 files changed, 96 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/pwm/pwm-synposys.yaml

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:
./Documentation/devicetree/bindings/pwm/pwm-synposys.yaml:11:4: [warning] wrong indentation: expected 2 but found 3 (indentation) ./Documentation/devicetree/bindings/pwm/pwm-synposys.yaml:31:9: [warning] wrong indentation: expected 10 but found 8 (indentation)

dtschema/dtc warnings/errors:

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/

This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit.

maintainer
#14 lore raw

Re: [PATCH 3/7] pwm: dwc: add of/platform support

In reply to Ben Dooks
Quoted 6 lines · Ben Dooks

The dwc pwm controller can be used in non-PCI systems, so allow either platform or OF based probing.

---
 .../devicetree/bindings/pwm/pwm-synposys.yaml | 40 ++++++++++++++

Use compatible string for filename.

Quoted 17 lines
 drivers/pwm/Kconfig                           |  5 +-
 drivers/pwm/pwm-dwc.c                         | 53 +++++++++++++++++++
 3 files changed, 96 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/pwm/pwm-synposys.yaml
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml new file +6 -0
new file mode 100644
index 000000000000..38ac0da75272
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2022 SiFive, Inc.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pwm/pwm-synposys.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#

Documentation/devicetree/bindings/pwm/pwm-synposys.yaml line 16

Quoted 10 lines
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml new file +10 -0
+
+title: Synopsys PWM controller
+
+maintainers:
+   - Ben Dooks <[email protected]>
+
+properties:
+  "#pwm-cells":
+    description: |
+      See pwm.yaml in this directory for a description of the cells format.

pwm.yaml doesn't define how many cells. You need to. And you don't need generic descriptions.

Documentation/devicetree/bindings/pwm/pwm-synposys.yaml line 28

Quoted 12 lines
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml new file +12 -0
+
+  clocks:
+    items:
+      - description: Interface bus clock
+      - description: PWM reference clock
+
+  clock-names:
+    items:
+      - const: bus
+      - const: timer
+
+  compatible:

Convention is compatible comes first in the list.

Documentation/devicetree/bindings/pwm/pwm-synposys.yaml line 31

Quoted 3 lines
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml new file +3 -0
+    oneOf:
+      - items:
+        - const: snps,pwm

Don't need oneOf or items. Just 'const: snps,pwm'.

That's pretty generic for a compatible. There's only 1 version of the IP or is the version discoverable?

Quoted 9 lines
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml new file +9 -0
+
+required:
+  - "#pwm-cells"
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+
+additionalProperties: false
#23 lore raw

Re: [PATCH 5/7] pwm: dwc: add timer clock

In reply to Ben Dooks
Quoted 22 lines · Ben Dooks

Add a configurable clock base rate for the pwm as when being built for non-PCI the block may be sourced from an internal clock.

---
 drivers/pwm/pwm-dwc.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/pwm/pwm-dwc.c +1 -0
index 235cb730c888..aa0486b89bdd 100644
@@ -18,6 +18,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/pci.h>
+#include <linux/clk.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
 #include <linux/pwm.h>

drivers/pwm/pwm-dwc.c line 44

Quoted 9 lines
drivers/pwm/pwm-dwc.c +5 -0
@@ -35,7 +36,12 @@
 #define DWC_TIMERS_COMP_VERSION	0xac
 
 #define DWC_TIMERS_TOTAL	8
+
+#ifndef CONFIG_OF
 #define DWC_CLK_PERIOD_NS	10
+#else
+#define DWC_CLK_PERIOD_NS	dwc->clk_ns
+#endif

Hmm, that looks wrong. If you have CONFIG_OF but use the pci device ...

IMHO it would help readability if you used ifdef. When there is an #else branch anyhow, there is no reason to use the negative variant.

Quoted 16 lines
drivers/pwm/pwm-dwc.c +3 -0
 /* Timer Control Register */
 #define DWC_TIM_CTRL_EN		BIT(0)
@@ -54,6 +60,8 @@ struct dwc_pwm_ctx {
 struct dwc_pwm {
 	struct pwm_chip chip;
 	void __iomem *base;
+	struct clk *clk;
+	unsigned int clk_ns;
 	struct dwc_pwm_ctx ctx[DWC_TIMERS_TOTAL];
 };
 #define to_dwc_pwm(p)	(container_of((p), struct dwc_pwm, chip))
@@ -336,6 +344,14 @@ static int dwc_pwm_plat_probe(struct platform_device *pdev)
 		return dev_err_probe(dev, PTR_ERR(dwc->base),
 				     "failed to map IO\n");
 
+	dwc->clk = devm_clk_get(dev, "timer");

drivers/pwm/pwm-dwc.c static int dwc_pwm_plat_probe(struct platform_device *pdev) · line 357

Quoted 10 lines
drivers/pwm/pwm-dwc.c +7 -0
+	if (IS_ERR(dwc->clk))
+		return dev_err_probe(dev, PTR_ERR(dwc->clk),
+				     "failed to get timer clock\n");
+
+	clk_prepare_enable(dwc->clk);
+	dwc->clk_ns = 1000000000 /clk_get_rate(dwc->clk);
+
 	ret = pwmchip_add(&dwc->chip);
 	if (ret)
 		return ret;

Here you're missing clk_disable_unprepare(). (Alternatively use devm_clk_get_enabled().)

drivers/pwm/pwm-dwc.c static int dwc_pwm_plat_remove(struct platform_device *pdev) · line 367

Quoted 6 lines
drivers/pwm/pwm-dwc.c +1 -0
@@ -347,6 +363,7 @@ static int dwc_pwm_plat_remove(struct platform_device *pdev)
 {
 	struct dwc_pwm *dwc = platform_get_drvdata(pdev);
 
+	clk_disable_unprepare(dwc->clk);
 	pwmchip_remove(&dwc->chip);

The order is wrong here. You must only stop the clk when the pwmchip is removed. Until that the PWM is supposed to stay functional.

drivers/pwm/pwm-dwc.c static int dwc_pwm_plat_remove(struct platform_device *pdev) · line 369

Quoted 2 lines
drivers/pwm/pwm-dwc.c +0 -0
 	return 0;
 }

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#27 lore raw

Re: [PATCH 6/7] pwm: dwc: remove the CONFIG_OF in timer clock

In reply to Ben Dooks
Quoted 7 lines · Ben Dooks
Quoted 6 lines · Krzysztof Kozlowski
Quoted 5 lines · Ben Dooks

We should probably change from the #ifdef added earlier in 49a0f4692a8752c7b03cb26d54282bee5c8c71bb ("wm: dwc: add timer clock") and just have it always in the dwc data so if we have a system with both PCI and OF probing it should work

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

-- consider merging with original patch

Missing SoB. Please run checkpatch.

This was meant to be an RFC about whether it should be a single patch or merged back into the previous one.

+1 for merging these

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
Acked-by on v1 1/7
#2 lore raw

Re: [PATCH 1/7] pwm: change &pci->dev to dev in probe

In reply to Ben Dooks
Quoted 3 lines · Ben Dooks

The dwc_pwm_probe() assignes dev to be &pci->dev but then uses &pci->dev throughout the function. Change these all to the be 'dev' variable to make lines shorter.

Looks reasonable.

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
author
#10 lore raw

Re: [PATCH 3/7] pwm: dwc: add of/platform support

In reply to Krzysztof Kozlowski
Quoted 8 lines · Krzysztof Kozlowski
Quoted 6 lines · Ben Dooks

The dwc pwm controller can be used in non-PCI systems, so allow either platform or OF based probing.

---
  .../devicetree/bindings/pwm/pwm-synposys.yaml | 40 ++++++++++++++
Quoted 5 lines

Bindings must be a separate patch. Preferably first in the series. Use proper subject prefix matching the subsystem.

Best regards,
Krzysztof

Thanks, seems counter-intuitive that one change is split up like that.

Signature · 1 line
Ben
#11 lore raw

Re: [PATCH 3/7] pwm: dwc: add of/platform support

Quoted 9 lines · Ben Dooks
Quoted 8 lines · Krzysztof Kozlowski
Quoted 6 lines · Ben Dooks

The dwc pwm controller can be used in non-PCI systems, so allow either platform or OF based probing.

---
  .../devicetree/bindings/pwm/pwm-synposys.yaml | 40 ++++++++++++++
Quoted 7 lines
Quoted 5 lines

Bindings must be a separate patch. Preferably first in the series. Use proper subject prefix matching the subsystem.

Best regards,
Krzysztof

Thanks, seems counter-intuitive that one change is split up like that.

Why? Bindings are not really related to driver implementation, they are shared with other projects. Binding reviewers usually care less about implementation, so combining it with drivers forces me to read carefully each one of 300 emails I receive...

Anyway, that's the policy since years, so nothing new here.

Best regards,
Krzysztof

author
#29 lore raw

Re: [PATCH 6/7] pwm: dwc: remove the CONFIG_OF in timer clock

In reply to Krzysztof Kozlowski
Quoted 6 lines · Krzysztof Kozlowski
Quoted 5 lines · Ben Dooks

We should probably change from the #ifdef added earlier in 49a0f4692a8752c7b03cb26d54282bee5c8c71bb ("wm: dwc: add timer clock") and just have it always in the dwc data so if we have a system with both PCI and OF probing it should work

Quoted 6 lines
Quoted 1 line

-- consider merging with original patch

Missing SoB. Please run checkpatch.

Best regards,
Krzysztof

Will be merging this with the previous patch now, thanks.

author
#3 lore raw

Re: [PATCH 1/7] pwm: change &pci->dev to dev in probe

In reply to Uwe Kleine-König
Quoted 8 lines · Uwe Kleine-König
Quoted 3 lines · Ben Dooks

The dwc_pwm_probe() assignes dev to be &pci->dev but then uses &pci->dev throughout the function. Change these all to the be 'dev' variable to make lines shorter.

Looks reasonable.

Thanks for the reviews, I'll get a new series out tomorrow.

I might avoid the last patch about number of pwms for now and just get the basic driver updates sorted.

Signature · 1 line
Ben
author
#15 lore raw

Re: [PATCH 3/7] pwm: dwc: add of/platform support

In reply to Rob Herring
Quoted 9 lines · Rob Herring
Quoted 6 lines · Ben Dooks

The dwc pwm controller can be used in non-PCI systems, so allow either platform or OF based probing.

---
  .../devicetree/bindings/pwm/pwm-synposys.yaml | 40 ++++++++++++++

Use compatible string for filename.

ok, will fix.

Quoted 22 lines
Quoted 22 lines
  drivers/pwm/Kconfig                           |  5 +-
  drivers/pwm/pwm-dwc.c                         | 53 +++++++++++++++++++
  3 files changed, 96 insertions(+), 2 deletions(-)

create mode 100644 Documentation/devicetree/bindings/pwm/pwm-synposys.yaml

Documentation/devicetree/bindings/pwm/pwm-synposys.yaml new file +11 -0
new file mode 100644
index 000000000000..38ac0da75272
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2022 SiFive, Inc.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pwm/pwm-synposys.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Synopsys PWM controller
+
+maintainers:
+   - Ben Dooks <[email protected]>
Quoted 8 lines

Documentation/devicetree/bindings/pwm/pwm-synposys.yaml line 16

Quoted 5 lines
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml new file +5 -0
+
+properties:
+  "#pwm-cells":
+    description: |
+      See pwm.yaml in this directory for a description of the cells format.

pwm.yaml doesn't define how many cells. You need to. And you don't need generic descriptions.

"#pwm-cells":
const: 1

should be sufficient then?

Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml new file +6 -0
+
+  clocks:
+    items:
+      - description: Interface bus clock
+      - description: PWM reference clock
+
Quoted 8 lines

Documentation/devicetree/bindings/pwm/pwm-synposys.yaml line 28

Quoted 6 lines
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml new file +6 -0
+  clock-names:
+    items:
+      - const: bus
+      - const: timer
+
+  compatible:

Convention is compatible comes first in the list.

ok, fixed.

Quoted 5 lines

Documentation/devicetree/bindings/pwm/pwm-synposys.yaml line 31

Quoted 3 lines
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml new file +3 -0
+    oneOf:
+      - items:
+        - const: snps,pwm

Don't need oneOf or items. Just 'const: snps,pwm'.

ok, fixed.

Quoted 2 lines

That's pretty generic for a compatible. There's only 1 version of the IP or is the version discoverable?

This IP block doesn't seem to have evolved much since being included so I don't think so at this point, most of the revision list is for the internal options and cleanup.

I will go through and check if all the compile-time properties are deal with, but that'll be adding more properiteis if they are needed.

Quoted 9 lines
Quoted 9 lines
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml new file +9 -0
+
+required:
+  - "#pwm-cells"
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+
+additionalProperties: false
author
#13 lore raw

Re: [PATCH 3/7] pwm: dwc: add of/platform support

In reply to Rob Herring
Quoted 13 lines · Rob Herring
Quoted 11 lines · Ben Dooks

The dwc pwm controller can be used in non-PCI systems, so allow either platform or OF based probing.

---
  .../devicetree/bindings/pwm/pwm-synposys.yaml | 40 ++++++++++++++
  drivers/pwm/Kconfig                           |  5 +-
  drivers/pwm/pwm-dwc.c                         | 53 +++++++++++++++++++
  3 files changed, 96 insertions(+), 2 deletions(-)

create mode 100644 Documentation/devicetree/bindings/pwm/pwm-synposys.yaml

Quoted 2 lines

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

Is the following equivalent:

Quoted 11 lines

make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/pwm/snps,pwm.yaml

yamllint warnings/errors:
./Documentation/devicetree/bindings/pwm/pwm-synposys.yaml:11:4: [warning] wrong indentation: expected 2 but found 3 (indentation) ./Documentation/devicetree/bindings/pwm/pwm-synposys.yaml:31:9: [warning] wrong indentation: expected 10 but found 8 (indentation)

dtschema/dtc warnings/errors:

doc reference errors (make refcheckdocs):

Quoted 8 lines

See https://patchwork.ozlabs.org/patch/

This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

Whoops, turns out I hadn't installed yamllint.

Quoted 4 lines

pip3 install dtschema --upgrade

Please check and re-submit.

#16 lore raw

Re: [PATCH 3/7] pwm: dwc: add of/platform support

In reply to Ben Dooks
Quoted 44 lines · Ben Dooks
Quoted 9 lines · Rob Herring
Quoted 6 lines · Ben Dooks

The dwc pwm controller can be used in non-PCI systems, so allow either platform or OF based probing.

---
  .../devicetree/bindings/pwm/pwm-synposys.yaml | 40 ++++++++++++++

Use compatible string for filename.

ok, will fix.

Quoted 22 lines
Quoted 22 lines
  drivers/pwm/Kconfig                           |  5 +-
  drivers/pwm/pwm-dwc.c                         | 53 +++++++++++++++++++
  3 files changed, 96 insertions(+), 2 deletions(-)

create mode 100644 Documentation/devicetree/bindings/pwm/pwm-synposys.yaml

Documentation/devicetree/bindings/pwm/pwm-synposys.yaml new file +11 -0
new file mode 100644
index 000000000000..38ac0da75272
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2022 SiFive, Inc.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pwm/pwm-synposys.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Synopsys PWM controller
+
+maintainers:
+   - Ben Dooks <[email protected]>
Quoted 8 lines

Documentation/devicetree/bindings/pwm/pwm-synposys.yaml line 16

Quoted 5 lines
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml new file +5 -0
+
+properties:
+  "#pwm-cells":
+    description: |
+      See pwm.yaml in this directory for a description of the cells format.

pwm.yaml doesn't define how many cells. You need to. And you don't need generic descriptions.

Quoted 4 lines

"#pwm-cells":
const: 1

should be sufficient then?

I would expect a value of (at least) 2 or (better) 3.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
author
#17 lore raw

Re: [PATCH 3/7] pwm: dwc: add of/platform support

Quoted 7 lines · Uwe Kleine-König
Quoted 6 lines · Ben Dooks
Quoted 5 lines · Rob Herring
Quoted 4 lines · Ben Dooks

The dwc pwm controller can be used in non-PCI systems, so allow either platform or OF based probing.

[snip]

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

Documentation/devicetree/bindings/pwm/pwm-synposys.yaml line 16

Quoted 4 lines
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml new file +4 -0
+properties:
+  "#pwm-cells":
+    description: |
+      See pwm.yaml in this directory for a description of the cells format.

pwm.yaml doesn't define how many cells. You need to. And you don't need generic descriptions.

Quoted 6 lines
Quoted 4 lines

"#pwm-cells":
const: 1

should be sufficient then?

I would expect a value of (at least) 2 or (better) 3.

OOPS, forgot the phandle.

I will have to check if we have any support yet for dealing with any of the pwm flags yet.

Quoted 3 lines

Best regards
Uwe

#18 lore raw

Re: [PATCH 3/7] pwm: dwc: add of/platform support

Quoted 22 lines · Ben Dooks
Quoted 7 lines · Uwe Kleine-König
Quoted 6 lines · Ben Dooks
Quoted 5 lines · Rob Herring
Quoted 4 lines · Ben Dooks

The dwc pwm controller can be used in non-PCI systems, so allow either platform or OF based probing.

[snip]

Quoted 11 lines
Quoted 11 lines
Quoted 7 lines

Documentation/devicetree/bindings/pwm/pwm-synposys.yaml line 16

Quoted 4 lines
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml new file +4 -0
+properties:
+  "#pwm-cells":
+    description: |
+      See pwm.yaml in this directory for a description of the cells format.

pwm.yaml doesn't define how many cells. You need to. And you don't need generic descriptions.

"#pwm-cells":
const: 1

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

should be sufficient then?

I would expect a value of (at least) 2 or (better) 3.

OOPS, forgot the phandle.

I will have to check if we have any support yet for dealing with any of the pwm flags yet.

I didn't double check, but given that the driver only supports inversed polarity it might not even work without passing the flag for inversed polarity. Having said that, I expect you have to only add "#pwm-cells = <3>;" to your dts and then everything should work just fine.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
author
#19 lore raw

Re: [PATCH 3/7] pwm: dwc: add of/platform support

Quoted 29 lines · Uwe Kleine-König
Quoted 28 lines · Ben Dooks
Quoted 7 lines · Uwe Kleine-König
Quoted 6 lines · Ben Dooks
Quoted 5 lines · Rob Herring
Quoted 4 lines · Ben Dooks

The dwc pwm controller can be used in non-PCI systems, so allow either platform or OF based probing.

[snip]

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

Documentation/devicetree/bindings/pwm/pwm-synposys.yaml line 16

Quoted 4 lines
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml new file +4 -0
+properties:
+  "#pwm-cells":
+    description: |
+      See pwm.yaml in this directory for a description of the cells format.

pwm.yaml doesn't define how many cells. You need to. And you don't need generic descriptions.

Quoted 6 lines
Quoted 4 lines
   "#pwm-cells":
      const: 1

should be sufficient then?

I would expect a value of (at least) 2 or (better) 3.

OOPS, forgot the phandle.

Quoted 7 lines
Quoted 2 lines

I will have to check if we have any support yet for dealing with any of the pwm flags yet.

I didn't double check, but given that the driver only supports inversed polarity it might not even work without passing the flag for inversed polarity. Having said that, I expect you have to only add "#pwm-cells = <3>;" to your dts and then everything should work just fine.

I hadn't noticed, but we've been testing with the sysfs interface as we're using qemu.

author
#20 lore raw

Re: [PATCH 3/7] pwm: dwc: add of/platform support

In reply to Uwe Kleine-König
Quoted 29 lines · Uwe Kleine-König
Quoted 28 lines · Ben Dooks
Quoted 7 lines · Uwe Kleine-König
Quoted 6 lines · Ben Dooks
Quoted 5 lines · Rob Herring
Quoted 4 lines · Ben Dooks

The dwc pwm controller can be used in non-PCI systems, so allow either platform or OF based probing.

[snip]

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

Documentation/devicetree/bindings/pwm/pwm-synposys.yaml line 16

Quoted 4 lines
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml new file +4 -0
+properties:
+  "#pwm-cells":
+    description: |
+      See pwm.yaml in this directory for a description of the cells format.

pwm.yaml doesn't define how many cells. You need to. And you don't need generic descriptions.

Quoted 6 lines
Quoted 4 lines
   "#pwm-cells":
      const: 1

should be sufficient then?

I would expect a value of (at least) 2 or (better) 3.

OOPS, forgot the phandle.

Quoted 7 lines
Quoted 2 lines

I will have to check if we have any support yet for dealing with any of the pwm flags yet.

I didn't double check, but given that the driver only supports inversed polarity it might not even work without passing the flag for inversed polarity. Having said that, I expect you have to only add "#pwm-cells = <3>;" to your dts and then everything should work just fine.

I've gone back over the documentation we have for the block, and it should have a count for high and a count for low in the PWM mode the driver puts it into. I have no idea /why/ the driver is reporting it as inversed, unless the PCI version has this automatically set....

I will go back and talk with the engineer who did the testing of the PWM to get the test-bench re-set and check this, however my expectation is we could easily do both and for the of/plat case we should just report normal polarity (and we could deal with the inversed by simply swapping the low and high values).

I also noted the v2 block supports 0 and 100% by setting a bit in the control and the timers to a given value, so that can also be added to the series (although this requires an IP generation option to be set) which we can also add.

Thnak you for pointing this out, hopefully we can have this sorted today and if so we will need to change this to a range of 2..3 for the PWM cells.

Quoted 3 lines

Best regards
Uwe

author
#28 lore raw

Re: [PATCH 6/7] pwm: dwc: remove the CONFIG_OF in timer clock

In reply to Uwe Kleine-König
Quoted 8 lines · Uwe Kleine-König
Quoted 7 lines · Ben Dooks
Quoted 6 lines · Krzysztof Kozlowski
Quoted 5 lines · Ben Dooks

We should probably change from the #ifdef added earlier in 49a0f4692a8752c7b03cb26d54282bee5c8c71bb ("wm: dwc: add timer clock") and just have it always in the dwc data so if we have a system with both PCI and OF probing it should work

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

-- consider merging with original patch

Missing SoB. Please run checkpatch.

This was meant to be an RFC about whether it should be a single patch or merged back into the previous one.

+1 for merging these

Yes, done for v2.

author
#4 lore raw

Re: [PATCH 1/7] pwm: change &pci->dev to dev in probe

In reply to Uwe Kleine-König
Quoted 8 lines · Uwe Kleine-König
Quoted 3 lines · Ben Dooks

The dwc_pwm_probe() assignes dev to be &pci->dev but then uses &pci->dev throughout the function. Change these all to the be 'dev' variable to make lines shorter.

Looks reasonable.

ack for 1/7 or the series?
I'll repost v2 this week once we've dealt with polarity.

Quoted 1 line
#5 lore raw

Re: [PATCH 1/7] pwm: change &pci->dev to dev in probe

Quoted 11 lines · Ben Dooks
Quoted 8 lines · Uwe Kleine-König
Quoted 3 lines · Ben Dooks

The dwc_pwm_probe() assignes dev to be &pci->dev but then uses &pci->dev throughout the function. Change these all to the be 'dev' variable to make lines shorter.

Looks reasonable.

ack for 1/7 or the series?

The former. For the other patches I assume they will change in v2.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#6 lore raw

Re: [PATCH 1/7] pwm: change &pci->dev to dev in probe

Hello,

Quoted 7 lines · Uwe Kleine-König
Quoted 6 lines · Ben Dooks
Quoted 5 lines · Uwe Kleine-König
Quoted 3 lines · Ben Dooks

The dwc_pwm_probe() assignes dev to be &pci->dev but then uses &pci->dev throughout the function. Change these all to the be 'dev' variable to make lines shorter.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Looks reasonable.

ack for 1/7 or the series?

The former. For the other patches I assume they will change in v2.

Oh well, and 2/7 is so obviously a preparation patch that I'll wait to see v2 for that one, too.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
maintainer
#32 lore raw

Re: [PATCH 7/7] pwm: dwc: add snps,pwm-number to limit pwm count

In reply to Ben Dooks
Quoted 18 lines · Ben Dooks

Add snps,pwm-number property to indicate if the block does not have all 8 of the PWM blocks.

Not sure if this should be a general PWM property consider optional for all PWM types, so have added a specific one here (there is only one other controller with a property for PWM count at the moment)

---
 Documentation/devicetree/bindings/pwm/pwm-synposys.yaml | 5 +++++
 drivers/pwm/pwm-dwc.c                                   | 8 ++++++++
 2 files changed, 13 insertions(+)
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml +0 -0
index 38ac0da75272..15bdf764b46a 100644

Documentation/devicetree/bindings/pwm/pwm-synposys.yaml properties: · line 35

Quoted 6 lines
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml +3 -0
@@ -30,11 +30,16 @@ properties:
       - items:
         - const: snps,pwm
 
+  snps,pwm-number:
+    $ref: '/schemas/types.yaml#/definitions/uint32'
+    description: u32 value representing the number of PWM devices

Why do we need to know this? Are you going to have a consumer to a non-existent PWM? If you do need to know how many, it should be implied by the compatible string.

Rob

author
#33 lore raw

Re: [PATCH 7/7] pwm: dwc: add snps,pwm-number to limit pwm count

Quoted 22 lines · Rob Herring
Quoted 21 lines · Ben Dooks

Add snps,pwm-number property to indicate if the block does not have all 8 of the PWM blocks.

Not sure if this should be a general PWM property consider optional for all PWM types, so have added a specific one here (there is only one other controller with a property for PWM count at the moment)

---
  Documentation/devicetree/bindings/pwm/pwm-synposys.yaml | 5 +++++
  drivers/pwm/pwm-dwc.c                                   | 8 ++++++++
  2 files changed, 13 insertions(+)
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml +0 -0
index 38ac0da75272..15bdf764b46a 100644
@@ -30,11 +30,16 @@ properties:
        - items:
          - const: snps,pwm
 
Quoted 7 lines

Documentation/devicetree/bindings/pwm/pwm-synposys.yaml properties: · line 35

Quoted 3 lines
Documentation/devicetree/bindings/pwm/pwm-synposys.yaml +3 -0
+  snps,pwm-number:
+    $ref: '/schemas/types.yaml#/definitions/uint32'
+    description: u32 value representing the number of PWM devices

Why do we need to know this? Are you going to have a consumer to a non-existent PWM? If you do need to know how many, it should be implied by the compatible string.

For this IP block it is a build time option for 1..8 timers so I thought it best we don't register non-existant timers

The system we are working on only has 1 PWM timer per block.

Signature · 1 line
Ben