1/9] dt-bindings: pwm: Document Synopsys DesignWare snps,pwm
Subsystems (2)
PATCH v2 1/1 1/9] dt-bindings: pwm: Document Synopsys DesignWare snps,pwm
Add documentation for the bindings for Synopsys' DesignWare PWM block as we will be adding DT/platform support to the Linux driver soon.
--
v2:
- fix #pwm-cells to be 3
- fix indentation and ordering issues
--- .../devicetree/bindings/pwm/snps,pwm.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/snps,pwm.yaml
Documentation/devicetree/bindings/pwm/snps,pwm.yaml new file +40 -0
@@ -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/snps,pwm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Synopsys PWM controller + +maintainers: + - Ben Dooks <[email protected]> + +allOf: + - $ref: pwm.yaml# + +properties: + compatible: + const: snps,pwm + + "#pwm-cells": + const: 3 + + clocks: + items: + - description: Interface bus clock + - description: PWM reference clock + + clock-names: + items: + - const: bus + - const: timer + +required: + - "#pwm-cells" + - compatible + - reg + - clocks + - clock-names + +additionalProperties: false
Signature · 1 line
2.35.1
PATCH v2 1/1 2/9] dt-bindings: pwm: snps,pwm add pwm number
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/snps,pwm.yaml | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/pwm/snps,pwm.yaml +5 -0
@@ -30,11 +30,16 @@ properties: - const: bus - const: timer + 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
Signature · 1 line
2.35.1
Re: [[PATCH v2] 2/9] dt-bindings: pwm: snps,pwm add pwm number
Quoted 17 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)
Signed-off-by Ben Dooks <[email protected]>--- Documentation/devicetree/bindings/pwm/snps,pwm.yaml | 5 +++++ 1 file changed, 5 insertions(+)Documentation/devicetree/bindings/pwm/snps,pwm.yaml +0
-0
Documentation/devicetree/bindings/pwm/snps,pwm.yaml properties: · line 34
Quoted 5 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml +2
-0@@ -30,11 +30,16 @@ properties: - const: bus - const: timer + snps,pwm-number: + $ref: '/schemas/types.yaml#/definitions/uint32'
1. No quotes
2. Add minimum and maximum (it looks like there are such).
Documentation/devicetree/bindings/pwm/snps,pwm.yaml properties: · line 35
Quoted 1 line
Documentation/devicetree/bindings/pwm/snps,pwm.yaml +1
-0+ description: u32 value representing the number of PWM devices
Best regards,
Krzysztof
Re: [[PATCH v2] 2/9] dt-bindings: pwm: snps,pwm add pwm number
Quoted 21 lines · Krzysztof Kozlowski
Quoted 20 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)
Signed-off-by Ben Dooks <[email protected]>--- Documentation/devicetree/bindings/pwm/snps,pwm.yaml | 5 +++++ 1 file changed, 5 insertions(+)Documentation/devicetree/bindings/pwm/snps,pwm.yaml +0
-0@@ -30,11 +30,16 @@ properties: - const: bus - const: timer
Quoted 8 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml properties: · line 34
Quoted 2 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml +2
-0+ snps,pwm-number: + $ref: '/schemas/types.yaml#/definitions/uint32'1. No quotes
2. Add minimum and maximum (it looks like there are such).Quoted 1 line
Documentation/devicetree/bindings/pwm/snps,pwm.yaml +1
-0+ description: u32 value representing the number of PWM devices
ok, thanks.
PATCH v2 1/1 3/9] pwm: change &pci->dev to dev in probe
In reply to Ben DooksThe 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
@@ -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
PATCH v2 1/1 4/9] pwm: move dwc memory alloc to own function
In reply to Ben DooksIn 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
@@ -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
PATCH v2 1/1 5/9] pwm: dwc: add of/platform support
In reply to Ben DooksThe dwc pwm controller can be used in non-PCI systems, so allow either platform or OF based probing.
--- drivers/pwm/Kconfig | 5 ++-- drivers/pwm/pwm-dwc.c | 53 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-)
drivers/pwm/Kconfig +3 -2
@@ -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
PATCH v2 1/1 6/9] pwm: dwc: allow driver to be built with COMPILE_TEST
In reply to Ben DooksAllow dwc driver to be built with COMPILE_TEST should allow better coverage when build testing.
--- drivers/pwm/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pwm/Kconfig +2 -1
@@ -166,7 +166,8 @@ config PWM_CROS_EC config PWM_DWC tristate "DesignWare PWM Controller" - depends on PCI || OF + depends on PCI || OF || COMPILE_TEST + depends on HAS_IOMEM help PWM driver for Synopsys DWC PWM Controller attached to either a PCI or platform bus.
Signature · 1 line
2.35.1
PATCH v2 1/1 7/9] pwm: dwc: add timer clock
In reply to Ben DooksAdd a configurable clock base rate for the pwm as when being built for non-PCI the block may be sourced from an internal clock.
--
v2:
- removed the ifdef and merged the other clock patch in here
--- drivers/pwm/pwm-dwc.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
drivers/pwm/pwm-dwc.c +17 -5
@@ -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,6 @@#define DWC_TIMERS_COMP_VERSION 0xac#define DWC_TIMERS_TOTAL 8 -#define DWC_CLK_PERIOD_NS 10/* Timer Control Register */ #define DWC_TIM_CTRL_EN BIT(0)
@@ -54,6 +54,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))
@@ -96,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 ;
@@ -177,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;
@@ -205,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 ;
@@ -336,6 +339,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 +358,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
PATCH v2 1/1 8/9] pwm: dwc: add snps,pwm-number to limit pwm count
In reply to Ben DooksAdd 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)
--- drivers/pwm/pwm-dwc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/pwm/pwm-dwc.c +8 -0
@@ -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
PATCH v2 1/1 9/9] pwm: dwc: add PWM bit unset in get_state call
In reply to Ben DooksIf we are not in PWM mode, then the output is technically a 50% output based on a single timer instead of the high-low based on the two counters. Add a check for the PWM mode in dwc_pwm_get_state() and if DWC_TIM_CTRL_PWM is not set, then return a 50% cycle.
This may only be an issue on initialisation, as the rest of the code currently assumes we're always going to have the extended PWM mode using two counters.
--- drivers/pwm/pwm-dwc.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-)
drivers/pwm/pwm-dwc.c +23 -11
@@ -171,23 +171,35 @@ static void dwc_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm, {struct dwc_pwm *dwc =to_dwc_pwm (chip);u64 duty, period; +u32 ctrl, ld, ld2;pm_runtime_get_sync (chip->dev); - state->enabled = !!(dwc_pwm_readl (dwc, -DWC_TIM_CTRL (pwm->hwpwm)) &DWC_TIM_CTRL_EN ); + ctrl =dwc_pwm_readl (dwc,DWC_TIM_CTRL (pwm->hwpwm)); + ld =dwc_pwm_readl (dwc,DWC_TIM_LD_CNT (pwm->hwpwm)); + ld2 =dwc_pwm_readl (dwc,DWC_TIM_LD_CNT2 (pwm->hwpwm)); - duty =dwc_pwm_readl (dwc,DWC_TIM_LD_CNT (pwm->hwpwm)); - duty +=1 ; - duty *= dwc->clk_ns; - state->duty_cycle = duty; + state->enabled = !!(ctrl &DWC_TIM_CTRL_EN ); - period =dwc_pwm_readl (dwc,DWC_TIM_LD_CNT2 (pwm->hwpwm)); - period +=1 ; - period *= dwc->clk_ns; - period += duty; - state->period = period; +/* If we're not in PWM, technically the output is a 50-50 +* based on the timer load-count only. +*/ +if (ctrl &DWC_TIM_CTRL_PWM ) { + duty = ld; + duty +=1 ; + duty *= dwc->clk_ns; + + period = ld2; + period +=1 ; + period *= dwc->clk_ns; + period += duty; + }else { + duty = (ld +1 ) * dwc->clk_ns; + period = duty *2 ; + } + state->period = period; + state->duty_cycle = duty; state->polarity =PWM_POLARITY_INVERSED ;pm_runtime_put_sync (chip->dev);
Signature · 1 line
2.35.1
On 25/07/2022 22:21, Ben Dooks wrote:
Argh, forgot the cover note on this:
Second version of updates for the DesignWare PWM driver to move it from PCI only to both PCI and OF.
Fixes:
v2:
- fix #pwm-cells count to be 3
- fix indetation
- merge the two clock patches
- add HAS_IOMEM as a config dependency
Quoted 5 lines · Ben Dooks
Add documentation for the bindings for Synopsys' DesignWare PWM block as we will be adding DT/platform support to the Linux driver soon.
Signed-off-by Ben Dooks <[email protected]>--
This is not proper delimiter and causes the changelog to end up in commit.
Correct also wrong formatting of subject PATCH.
Quoted 22 lines
v2:
- fix #pwm-cells to be 3
- fix indentation and ordering issues--- .../devicetree/bindings/pwm/snps,pwm.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/snps,pwm.yamlDocumentation/devicetree/bindings/pwm/snps,pwm.yaml new file +8
-0@@ -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/snps,pwm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Synopsys PWM controller
Documentation/devicetree/bindings/pwm/snps,pwm.yaml line 18
Quoted 10 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml new file +10
-0+ +maintainers: + - Ben Dooks <[email protected]> + +allOf: + - $ref: pwm.yaml# + +properties: + compatible: + const: snps,pwm
This is very generic compatible. I doubt that you cover here all Synopsys PWM designs, past and future. You need a specific compatible.
Quoted 12 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml new file +12
-0+ + "#pwm-cells": + const: 3 + + clocks: + items: + - description: Interface bus clock + - description: PWM reference clock + + clock-names: + items: + - const: bus
Documentation/devicetree/bindings/pwm/snps,pwm.yaml line 40
Quoted 10 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml new file +10
-0+ - const: timer + +required: + - "#pwm-cells" + - compatible + - reg + - clocks + - clock-names + +additionalProperties: false
Missing example.
Best regards,
Krzysztof
Quoted 10 lines · Krzysztof Kozlowski
Quoted 5 lines · Ben Dooks
Add documentation for the bindings for Synopsys' DesignWare PWM block as we will be adding DT/platform support to the Linux driver soon.
Signed-off-by Ben Dooks <[email protected]>--
This is not proper delimiter and causes the changelog to end up in commit.
Correct also wrong formatting of subject PATCH.
I realised that once sent and forgot the cover letter. Maybe I'll try some more post covid recovery.
Quoted 27 lines
Quoted 27 lines
v2:
- fix #pwm-cells to be 3
- fix indentation and ordering issues--- .../devicetree/bindings/pwm/snps,pwm.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+)create mode 100644
Documentation/devicetree/bindings/pwm/snps,pwm.yamlDocumentation/devicetree/bindings/pwm/snps,pwm.yaml new file +13
-0@@ -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/snps,pwm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Synopsys PWM controller + +maintainers: + - Ben Dooks <[email protected]> + +allOf:
Quoted 8 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml line 18
Quoted 5 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml new file +5
-0+ - $ref: pwm.yaml# + +properties: + compatible: + const: snps,pwmThis is very generic compatible. I doubt that you cover here all Synopsys PWM designs, past and future. You need a specific compatible.
From what I can get from the documentation (2.13a) there hasn't been a huge external interface change and what has been added is all part of synthesis time options.
Quoted 16 lines
Quoted 16 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml new file +16
-0+ + "#pwm-cells": + const: 3 + + clocks: + items: + - description: Interface bus clock + - description: PWM reference clock + + clock-names: + items: + - const: bus + - const: timer + +required: + - "#pwm-cells"
Quoted 8 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml line 40
Quoted 6 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml new file +6
-0+ - compatible + - reg + - clocks + - clock-names + +additionalProperties: falseMissing example.
ok, thanks.
Quoted 51 lines · Ben Dooks
Quoted 10 lines · Krzysztof Kozlowski
Quoted 5 lines · Ben Dooks
Add documentation for the bindings for Synopsys' DesignWare PWM block as we will be adding DT/platform support to the Linux driver soon.
Signed-off-by Ben Dooks <[email protected]>--
This is not proper delimiter and causes the changelog to end up in commit.
Correct also wrong formatting of subject PATCH.
I realised that once sent and forgot the cover letter. Maybe I'll try some more post covid recovery.
Quoted 27 lines
Quoted 27 lines
v2:
- fix #pwm-cells to be 3
- fix indentation and ordering issues--- .../devicetree/bindings/pwm/snps,pwm.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+)create mode 100644
Documentation/devicetree/bindings/pwm/snps,pwm.yamlDocumentation/devicetree/bindings/pwm/snps,pwm.yaml new file +13
-0@@ -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/snps,pwm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Synopsys PWM controller + +maintainers: + - Ben Dooks <[email protected]> + +allOf:Quoted 8 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml line 18
Quoted 5 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml new file +5
-0+ - $ref: pwm.yaml# + +properties: + compatible: + const: snps,pwmThis is very generic compatible. I doubt that you cover here all Synopsys PWM designs, past and future. You need a specific compatible.
Quoted 3 lines
From what I can get from the documentation (2.13a) there hasn't been
a huge external interface change and what has been added is all part of synthesis time options.
But you have some specific version, right? Usually these blocks are versioned, so you must include it. I would even argue that such generic compatible should not be used as fallback at all, because it is simply to generic (PWM is not some model name but common acronym),
Best regards,
Krzysztof
Quoted 52 lines · Krzysztof Kozlowski
Quoted 51 lines · Ben Dooks
Quoted 10 lines · Krzysztof Kozlowski
Quoted 5 lines · Ben Dooks
Add documentation for the bindings for Synopsys' DesignWare PWM block as we will be adding DT/platform support to the Linux driver soon.
Signed-off-by Ben Dooks <[email protected]>--
This is not proper delimiter and causes the changelog to end up in commit.
Correct also wrong formatting of subject PATCH.
I realised that once sent and forgot the cover letter. Maybe I'll try some more post covid recovery.
Quoted 35 lines
Quoted 22 lines
v2:
- fix #pwm-cells to be 3
- fix indentation and ordering issues--- .../devicetree/bindings/pwm/snps,pwm.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+)create mode 100644
Documentation/devicetree/bindings/pwm/snps,pwm.yamlDocumentation/devicetree/bindings/pwm/snps,pwm.yaml new file +8
-0@@ -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/snps,pwm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Synopsys PWM controllerDocumentation/devicetree/bindings/pwm/snps,pwm.yaml line 18
Quoted 10 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml new file +10
-0+ +maintainers: + - Ben Dooks <[email protected]> + +allOf: + - $ref: pwm.yaml# + +properties: + compatible: + const: snps,pwmThis is very generic compatible. I doubt that you cover here all Synopsys PWM designs, past and future. You need a specific compatible.
Quoted 8 lines
Quoted 3 lines
From what I can get from the documentation (2.13a) there hasn't been
a huge external interface change and what has been added is all part of synthesis time options.But you have some specific version, right? Usually these blocks are versioned, so you must include it. I would even argue that such generic compatible should not be used as fallback at all, because it is simply to generic (PWM is not some model name but common acronym),
I suppose dw-apb-timers is the actual document name, but that's already been used for the timer mode in a number of SoCs so probably isn't going to be useful. dw-apb-timers-pwm might be a better prefix if snps,pwm is not going to be acceptable. (Yes, the block can be built as either a PWM or a generic interrupt generating timer at IP generation time)
As for the version numbers, we could have the -v.vv suffix for these blocks, but the v2.xx log has 22 entries already and only one feature for programming (which is also a configurable one so can't be just enabled by default - it's the 0/100 mode flag in the control registers).
I'm not sure what the v1.xx timers had, but I don't have access to this information and we're getting these documents as second-generation so I am not sure if we can get a v1.xx at-all (I suspect this is also going to have a number of revisions and about 1 useful register api change which would be the "new mode" double counter method which we currently rely on having being implicitly enabled by the IP builder (again this feature is still something that can be configured on IP genaration))
Given the configurability of the core, the version numbers might be usable at some point, but it does seem to be a lot of churn for what currently can be described by one boolean for the 0/100 feature that might-be available. Is there a way of saying the compatible string can be dw-apb-timers-pwm-2.[0-9][0-9][a-z] ?
Quoted 73 lines · Ben Dooks
Quoted 52 lines · Krzysztof Kozlowski
Quoted 51 lines · Ben Dooks
Quoted 10 lines · Krzysztof Kozlowski
Quoted 5 lines · Ben Dooks
Add documentation for the bindings for Synopsys' DesignWare PWM block as we will be adding DT/platform support to the Linux driver soon.
Signed-off-by Ben Dooks <[email protected]>--
This is not proper delimiter and causes the changelog to end up in commit.
Correct also wrong formatting of subject PATCH.
I realised that once sent and forgot the cover letter. Maybe I'll try some more post covid recovery.
Quoted 35 lines
Quoted 22 lines
v2:
- fix #pwm-cells to be 3
- fix indentation and ordering issues--- .../devicetree/bindings/pwm/snps,pwm.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+)create mode 100644
Documentation/devicetree/bindings/pwm/snps,pwm.yamlDocumentation/devicetree/bindings/pwm/snps,pwm.yaml new file +8
-0@@ -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/snps,pwm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Synopsys PWM controllerDocumentation/devicetree/bindings/pwm/snps,pwm.yaml line 18
Quoted 10 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml new file +10
-0+ +maintainers: + - Ben Dooks <[email protected]> + +allOf: + - $ref: pwm.yaml# + +properties: + compatible: + const: snps,pwmThis is very generic compatible. I doubt that you cover here all Synopsys PWM designs, past and future. You need a specific compatible.
Quoted 8 lines
Quoted 3 lines
From what I can get from the documentation (2.13a) there hasn't been
a huge external interface change and what has been added is all part of synthesis time options.But you have some specific version, right? Usually these blocks are versioned, so you must include it. I would even argue that such generic compatible should not be used as fallback at all, because it is simply to generic (PWM is not some model name but common acronym),
I suppose dw-apb-timers is the actual document name, but that's already been used for the timer mode in a number of SoCs so probably isn't going to be useful. dw-apb-timers-pwm might be a better prefix if snps,pwm is not going to be acceptable. (Yes, the block can be built as either a PWM or a generic interrupt generating timer at IP generation time)
As for the version numbers, we could have the -v.vv suffix for these blocks, but the v2.xx log has 22 entries already and only one feature for programming (which is also a configurable one so can't be just enabled by default - it's the 0/100 mode flag in the control registers).
Quoted 7 lines
I'm not sure what the v1.xx timers had, but I don't have access to this information and we're getting these documents as second-generation so I am not sure if we can get a v1.xx at-all (I suspect this is also going to have a number of revisions and about 1 useful register api change which would be the "new mode" double counter method which we currently rely on having being implicitly enabled by the IP builder (again this feature is still something that can be configured on IP genaration))
But why would you need v1.xx documentation?
Quoted 6 lines
Given the configurability of the core, the version numbers might be usable at some point, but it does seem to be a lot of churn for what currently can be described by one boolean for the 0/100 feature that might-be available. Is there a way of saying the compatible string can be dw-apb-timers-pwm-2.[0-9][0-9][a-z] ?
I don't understand why. Aren't you documenting here only v2.13a version?
Best regards,
Krzysztof
Quoted 63 lines · Krzysztof Kozlowski
Quoted 62 lines · Ben Dooks
Quoted 60 lines · Krzysztof Kozlowski
Quoted 51 lines · Ben Dooks
Quoted 10 lines · Krzysztof Kozlowski
Quoted 5 lines · Ben Dooks
Add documentation for the bindings for Synopsys' DesignWare PWM block as we will be adding DT/platform support to the Linux driver soon.
Signed-off-by Ben Dooks <[email protected]>--
This is not proper delimiter and causes the changelog to end up in commit.
Correct also wrong formatting of subject PATCH.
I realised that once sent and forgot the cover letter. Maybe I'll try some more post covid recovery.
Quoted 27 lines
Quoted 27 lines
v2:
- fix #pwm-cells to be 3
- fix indentation and ordering issues--- .../devicetree/bindings/pwm/snps,pwm.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+)create mode 100644
Documentation/devicetree/bindings/pwm/snps,pwm.yamlDocumentation/devicetree/bindings/pwm/snps,pwm.yaml new file +13
-0@@ -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/snps,pwm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Synopsys PWM controller + +maintainers: + - Ben Dooks <[email protected]> + +allOf:Quoted 8 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml line 18
Quoted 5 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml new file +5
-0+ - $ref: pwm.yaml# + +properties: + compatible: + const: snps,pwmThis is very generic compatible. I doubt that you cover here all Synopsys PWM designs, past and future. You need a specific compatible.
Quoted 3 lines
From what I can get from the documentation (2.13a) there hasn't been
a huge external interface change and what has been added is all part of synthesis time options.But you have some specific version, right? Usually these blocks are versioned, so you must include it. I would even argue that such generic compatible should not be used as fallback at all, because it is simply to generic (PWM is not some model name but common acronym),
Quoted 5 lines
Quoted 5 lines
I suppose dw-apb-timers is the actual document name, but that's already been used for the timer mode in a number of SoCs so probably isn't going to be useful. dw-apb-timers-pwm might be a better prefix if snps,pwm is not going to be acceptable. (Yes, the block can be built as either a PWM or a generic interrupt generating timer at IP generation time)
The first thing I'd like to get sorted is should we rename this to snps,dw-apb-timers-pwm so we can rename the file and the compatible that goes with it.
Quoted 13 lines
Quoted 5 lines
As for the version numbers, we could have the -v.vv suffix for these blocks, but the v2.xx log has 22 entries already and only one feature for programming (which is also a configurable one so can't be just enabled by default - it's the 0/100 mode flag in the control registers).
Quoted 7 lines
I'm not sure what the v1.xx timers had, but I don't have access to this information and we're getting these documents as second-generation so I am not sure if we can get a v1.xx at-all (I suspect this is also going to have a number of revisions and about 1 useful register api change which would be the "new mode" double counter method which we currently rely on having being implicitly enabled by the IP builder (again this feature is still something that can be configured on IP genaration))
Quoted 1 line
But why would you need v1.xx documentation?
I believe the driver should cover a large part of the v1.xx cores as well, we just don't have any documentation for these to verify this.
Quoted 8 lines
Quoted 6 lines
Given the configurability of the core, the version numbers might be usable at some point, but it does seem to be a lot of churn for what currently can be described by one boolean for the 0/100 feature that might-be available. Is there a way of saying the compatible string can be dw-apb-timers-pwm-2.[0-9][0-9][a-z] ?
I don't understand why. Aren't you documenting here only v2.13a version?
The document as-such should cover everything I have a log for, we've not had time to test the extension for 0or100% which was introduced in 2.11a spec. The earliest history I have is 2.02d. I will go and see if I can find someone who can go look for anything earlier.
As a note, it does look like all the v2.xx cores have the IP version register in them so we can auto-detect the version from that, at least for the DT/platform case.
Quoted 2 lines
Best regards,
Krzysztof
Quoted 70 lines · Ben Dooks
Quoted 63 lines · Krzysztof Kozlowski
Quoted 62 lines · Ben Dooks
Quoted 60 lines · Krzysztof Kozlowski
Quoted 51 lines · Ben Dooks
Quoted 10 lines · Krzysztof Kozlowski
Quoted 5 lines · Ben Dooks
Add documentation for the bindings for Synopsys' DesignWare PWM block as we will be adding DT/platform support to the Linux driver soon.
Signed-off-by Ben Dooks <[email protected]>--
This is not proper delimiter and causes the changelog to end up in commit.
Correct also wrong formatting of subject PATCH.
I realised that once sent and forgot the cover letter. Maybe I'll try some more post covid recovery.
Quoted 27 lines
Quoted 27 lines
v2:
- fix #pwm-cells to be 3
- fix indentation and ordering issues--- .../devicetree/bindings/pwm/snps,pwm.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+)create mode 100644
Documentation/devicetree/bindings/pwm/snps,pwm.yamlDocumentation/devicetree/bindings/pwm/snps,pwm.yaml new file +13
-0@@ -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/snps,pwm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Synopsys PWM controller + +maintainers: + - Ben Dooks <[email protected]> + +allOf:Quoted 8 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml line 18
Quoted 5 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml new file +5
-0+ - $ref: pwm.yaml# + +properties: + compatible: + const: snps,pwmThis is very generic compatible. I doubt that you cover here all Synopsys PWM designs, past and future. You need a specific compatible.
Quoted 3 lines
From what I can get from the documentation (2.13a) there hasn't been
a huge external interface change and what has been added is all part of synthesis time options.But you have some specific version, right? Usually these blocks are versioned, so you must include it. I would even argue that such generic compatible should not be used as fallback at all, because it is simply to generic (PWM is not some model name but common acronym),
Quoted 5 lines
Quoted 5 lines
I suppose dw-apb-timers is the actual document name, but that's already been used for the timer mode in a number of SoCs so probably isn't going to be useful. dw-apb-timers-pwm might be a better prefix if snps,pwm is not going to be acceptable. (Yes, the block can be built as either a PWM or a generic interrupt generating timer at IP generation time)
Quoted 3 lines
The first thing I'd like to get sorted is should we rename this to snps,dw-apb-timers-pwm so we can rename the file and the compatible that goes with it.
I don't have the datasheets/spec/manual for this, so I have no clue what is it. I know though that calling it generic "pwm" is a bit too generic.
For example "snps,dw-apb-timer" is not called "snps,timer" but DesignWare APB Timer.
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
As for the version numbers, we could have the -v.vv suffix for these blocks, but the v2.xx log has 22 entries already and only one feature for programming (which is also a configurable one so can't be just enabled by default - it's the 0/100 mode flag in the control registers).
I'm not sure what the v1.xx timers had, but I don't have access to this information and we're getting these documents as second-generation so I am not sure if we can get a v1.xx at-all (I suspect this is also going to have a number of revisions and about 1 useful register api change which would be the "new mode" double counter method which we currently rely on having being implicitly enabled by the IP builder (again this feature is still something that can be configured on IP genaration))
Quoted 5 lines
Quoted 1 line
But why would you need v1.xx documentation?
I believe the driver should cover a large part of the v1.xx cores as well, we just don't have any documentation for these to verify this.
Yeah, but I still don't understand what is the problem to solve in bindings for that.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Given the configurability of the core, the version numbers might be usable at some point, but it does seem to be a lot of churn for what currently can be described by one boolean for the 0/100 feature that might-be available. Is there a way of saying the compatible string can be dw-apb-timers-pwm-2.[0-9][0-9][a-z] ?
Quoted 6 lines
Quoted 1 line
I don't understand why. Aren't you documenting here only v2.13a version?
The document as-such should cover everything I have a log for, we've not had time to test the extension for 0or100% which was introduced in 2.11a spec. The earliest history I have is 2.02d. I will go and see if I can find someone who can go look for anything earlier.
Several of them might be actually compatible, so you might not need 100 different compatibles. Patterns are not allowed.
I doubt that PWM block is much more complicated than for example DW MAC, which somehow can exist with few versions defined...
Quoted 4 lines
As a note, it does look like all the v2.xx cores have the IP version register in them so we can auto-detect the version from that, at least for the DT/platform case.
Auto-detection is then preferred, so just call it -v2.02d which will cover all known v2 for you and the rest is done via autodetection.
Best regards,
Krzysztof
Quoted 52 lines · Krzysztof Kozlowski
Quoted 51 lines · Ben Dooks
Quoted 10 lines · Krzysztof Kozlowski
Quoted 5 lines · Ben Dooks
Add documentation for the bindings for Synopsys' DesignWare PWM block as we will be adding DT/platform support to the Linux driver soon.
Signed-off-by Ben Dooks <[email protected]>--
This is not proper delimiter and causes the changelog to end up in commit.
Correct also wrong formatting of subject PATCH.
I realised that once sent and forgot the cover letter. Maybe I'll try some more post covid recovery.
Quoted 35 lines
Quoted 22 lines
v2:
- fix #pwm-cells to be 3
- fix indentation and ordering issues--- .../devicetree/bindings/pwm/snps,pwm.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+)create mode 100644
Documentation/devicetree/bindings/pwm/snps,pwm.yamlDocumentation/devicetree/bindings/pwm/snps,pwm.yaml new file +8
-0@@ -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/snps,pwm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Synopsys PWM controllerDocumentation/devicetree/bindings/pwm/snps,pwm.yaml line 18
Quoted 10 lines
Documentation/devicetree/bindings/pwm/snps,pwm.yaml new file +10
-0+ +maintainers: + - Ben Dooks <[email protected]> + +allOf: + - $ref: pwm.yaml# + +properties: + compatible: + const: snps,pwmThis is very generic compatible. I doubt that you cover here all Synopsys PWM designs, past and future. You need a specific compatible.
Quoted 8 lines
Quoted 3 lines
From what I can get from the documentation (2.13a) there hasn't been
a huge external interface change and what has been added is all part of synthesis time options.But you have some specific version, right? Usually these blocks are versioned, so you must include it. I would even argue that such generic compatible should not be used as fallback at all, because it is simply to generic (PWM is not some model name but common acronym),
Thank you for the feedback, forgot to say that on the original reply.
Signature · 1 line
Ben