diff mbox series

[v4,1/5] dt-bindings: mfd: Add aspeed pwm-tach binding

Message ID 20221123061635.32025-2-billy_tsai@aspeedtech.com
State Changes Requested, archived
Headers show
Series Support pwm/tach driver for aspeed ast26xx | expand

Checks

Context Check Description
robh/checkpatch success
robh/patch-applied success
robh/dt-meta-schema fail build log

Commit Message

Billy Tsai Nov. 23, 2022, 6:16 a.m. UTC
Add device binding for aspeed pwm-tach device which is a multi-function
device include pwm and tach function.

Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
---
 .../bindings/mfd/aspeed,ast2600-pwm-tach.yaml | 73 +++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml

Comments

Krzysztof Kozlowski Nov. 23, 2022, 8:24 a.m. UTC | #1
On 23/11/2022 07:16, Billy Tsai wrote:
> Add device binding for aspeed pwm-tach device which is a multi-function
> device include pwm and tach function.

Subject: drop second, redundant "bindings".
Also use proper PATCH prefix.

> 
> Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
> ---
>  .../bindings/mfd/aspeed,ast2600-pwm-tach.yaml | 73 +++++++++++++++++++
>  1 file changed, 73 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml
> 
> diff --git a/Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml b/Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml
> new file mode 100644
> index 000000000000..e2a7be2e0a18
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml
> @@ -0,0 +1,73 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +# Copyright (C) 2021 Aspeed, Inc.
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mfd/aspeed,ast2600-pwm-tach.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: PWM Tach controller
> +
> +description: |
> +  The PWM Tach controller is represented as a multi-function device which
> +  includes:
> +    PWM
> +    Tach
> +
> +maintainers:
> +  - Billy Tsai <billy_tsai@aspeedtech.com>
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +          - aspeed,ast2600-pwm-tach
> +      - const: syscon
> +      - const: simple-mfd
> +
> +  reg:
> +    maxItems: 1
> +
> +  clocks:
> +    maxItems: 1
> +
> +  resets:
> +    maxItems: 1

If this is simple-mfd then it cannot take clocks or resets.  Usually the
recommendation for such case is: This is not simple-mfd, drop it. Drop
also syscon and make a proper device.

However I am surprised to see such change, so I have no clue why this
was done.

> +
> +  pwm:
> +    type: object
> +    $ref: "/schemas/pwm/aspeed,ast2600-pwm.yaml"

Drop quotes.

There is no such file. Are you sure you ordered the patches correctly?

> +
> +  tach:
> +    type: object
> +    $ref: "/schemas/hwmon/aspeed,ast2600-tach.yaml"

Drop quotes.

There is no such file.

> +
> +required:
> +  - compatible
> +  - reg
> +  - clocks
> +  - resets

Best regards,
Krzysztof
Krzysztof Kozlowski Nov. 23, 2022, 8:27 a.m. UTC | #2
On 23/11/2022 09:24, Krzysztof Kozlowski wrote:
> On 23/11/2022 07:16, Billy Tsai wrote:
>> Add device binding for aspeed pwm-tach device which is a multi-function
>> device include pwm and tach function.
> 
> Subject: drop second, redundant "bindings".
> Also use proper PATCH prefix.
> 
>>
>> Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
>> ---
>>  .../bindings/mfd/aspeed,ast2600-pwm-tach.yaml | 73 +++++++++++++++++++
>>  1 file changed, 73 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml b/Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml
>> new file mode 100644
>> index 000000000000..e2a7be2e0a18
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml
>> @@ -0,0 +1,73 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +# Copyright (C) 2021 Aspeed, Inc.
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/mfd/aspeed,ast2600-pwm-tach.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: PWM Tach controller
>> +
>> +description: |
>> +  The PWM Tach controller is represented as a multi-function device which
>> +  includes:
>> +    PWM
>> +    Tach
>> +
>> +maintainers:
>> +  - Billy Tsai <billy_tsai@aspeedtech.com>
>> +
>> +properties:
>> +  compatible:
>> +    items:
>> +      - enum:
>> +          - aspeed,ast2600-pwm-tach
>> +      - const: syscon
>> +      - const: simple-mfd
>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  clocks:
>> +    maxItems: 1
>> +
>> +  resets:
>> +    maxItems: 1
> 
> If this is simple-mfd then it cannot take clocks or resets.  Usually the
> recommendation for such case is: This is not simple-mfd, drop it. Drop
> also syscon and make a proper device.
> 
> However I am surprised to see such change, so I have no clue why this
> was done.

Actually now I see it was like that in previous patch, I just missed it
during previous review. Anyway this must be fixed.

Best regards,
Krzysztof
Rob Herring (Arm) Nov. 23, 2022, 3:07 p.m. UTC | #3
On Wed, 23 Nov 2022 14:16:31 +0800, Billy Tsai wrote:
> Add device binding for aspeed pwm-tach device which is a multi-function
> device include pwm and tach function.
> 
> Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
> ---
>  .../bindings/mfd/aspeed,ast2600-pwm-tach.yaml | 73 +++++++++++++++++++
>  1 file changed, 73 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.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:

dtschema/dtc warnings/errors:
./Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml: Unable to find schema file matching $id: http://devicetree.org/schemas/pwm/aspeed,ast2600-pwm.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.example.dtb: pwm-tach@1e610000: pwm: False schema does not allow {'compatible': ['aspeed,ast2600-pwm'], '#pwm-cells': [[3]], 'pinctrl-names': ['default'], 'pinctrl-0': [[4294967295]]}
	From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.example.dtb: pwm-tach@1e610000: tach: False schema does not allow {'compatible': ['aspeed,ast2600-tach'], 'pinctrl-names': ['default'], 'pinctrl-0': [[4294967295]]}
	From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml
Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.example.dtb:0:0: /example-0/pwm-tach@1e610000/pwm: failed to match any schema with compatible: ['aspeed,ast2600-pwm']
Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.example.dtb:0:0: /example-0/pwm-tach@1e610000/tach: failed to match any schema with compatible: ['aspeed,ast2600-tach']

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20221123061635.32025-2-billy_tsai@aspeedtech.com

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 after running the above command.
Billy Tsai Dec. 9, 2022, 12:54 a.m. UTC | #4
On 2022/11/23, 4:27 PM, "Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org> wrote:

    On 23/11/2022 09:24, Krzysztof Kozlowski wrote:
    > > On 23/11/2022 07:16, Billy Tsai wrote:
    > >> Add device binding for aspeed pwm-tach device which is a multi-function
    > >> device include pwm and tach function.
    > > 
    > > Subject: drop second, redundant "bindings".
    > > Also use proper PATCH prefix.
    > > 
    > >>
    > >> Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
    > >> ---
    > >>  .../bindings/mfd/aspeed,ast2600-pwm-tach.yaml | 73 +++++++++++++++++++
    > >>  1 file changed, 73 insertions(+)
    > >>  create mode 100644 Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml
    > >>
    > >> diff --git a/Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml b/Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml
    > >> new file mode 100644
    > >> index 000000000000..e2a7be2e0a18
    > >> --- /dev/null
    > >> +++ b/Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml
    > >> @@ -0,0 +1,73 @@
    > >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
    > >> +# Copyright (C) 2021 Aspeed, Inc.
    > >> +%YAML 1.2
    > >> +---
    > >> +$id: http://devicetree.org/schemas/mfd/aspeed,ast2600-pwm-tach.yaml#
    > >> +$schema: http://devicetree.org/meta-schemas/core.yaml#
    > >> +
    > >> +title: PWM Tach controller
    > >> +
    > >> +description: |
    > >> +  The PWM Tach controller is represented as a multi-function device which
    > >> +  includes:
    > >> +    PWM
    > >> +    Tach
    > >> +
    > >> +maintainers:
    > >> +  - Billy Tsai <billy_tsai@aspeedtech.com>
    > >> +
    > >> +properties:
    > >> +  compatible:
    > >> +    items:
    > >> +      - enum:
    > >> +          - aspeed,ast2600-pwm-tach
    > >> +      - const: syscon
    > >> +      - const: simple-mfd
    > >> +
    > >> +  reg:
    > >> +    maxItems: 1
    > >> +
    > >> +  clocks:
    > >> +    maxItems: 1
    > >> +
    > >> +  resets:
    > >> +    maxItems: 1
    > > 
    > > If this is simple-mfd then it cannot take clocks or resets.  Usually the
    > > recommendation for such case is: This is not simple-mfd, drop it. Drop
    > > also syscon and make a proper device.
    > > 
    > > However I am surprised to see such change, so I have no clue why this
    > > was done.

    > Actually now I see it was like that in previous patch, I just missed it
    > during previous review. Anyway this must be fixed.

I have two module (PWM and TACH) but share with the same base address,
The PWM will use the offset (N*0x10) + 0x0 and 0x04.
The TACH will use the offset (N*0x10) + 0x8 and 0x0c.
The range of the N is 0~15.
Can you give me some advice to fix this problem without using simple-mfd?

Thanks

Best Regards,
Billy Tsai
Krzysztof Kozlowski Dec. 9, 2022, 7:48 a.m. UTC | #5
On 09/12/2022 01:54, Billy Tsai wrote:
>     > > However I am surprised to see such change, so I have no clue why this
>     > > was done.
> 
>     > Actually now I see it was like that in previous patch, I just missed it
>     > during previous review. Anyway this must be fixed.
> 
> I have two module (PWM and TACH) but share with the same base address,
> The PWM will use the offset (N*0x10) + 0x0 and 0x04.
> The TACH will use the offset (N*0x10) + 0x8 and 0x0c.
> The range of the N is 0~15.
> Can you give me some advice to fix this problem without using simple-mfd?


Use regular driver which populates children.

Best regards,
Krzysztof
Billy Tsai Jan. 6, 2023, 3:31 a.m. UTC | #6
On 2022/12/9, 3:48 PM, "Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org <mailto:krzysztof.kozlowski@linaro.org>> wrote:


  On 09/12/2022 01:54, Billy Tsai wrote:
  > > > > However I am surprised to see such change, so I have no clue why this
  > > > > was done.
  > > 
  > > > Actually now I see it was like that in previous patch, I just missed it
  > > > during previous review. Anyway this must be fixed.
  > > 
  > > I have two module (PWM and TACH) but share with the same base address,
  > > The PWM will use the offset (N*0x10) + 0x0 and 0x04.
  > > The TACH will use the offset (N*0x10) + 0x8 and 0x0c.
  > > The range of the N is 0~15.
  > > Can you give me some advice to fix this problem without using simple-mfd?


  > Use regular driver which populates children.

I think that my scenario meets the definition in mfd.txt: 
- A range of memory registers containing "miscellaneous system registers" also
  known as a system controller "syscon" or any other memory range containing a
  mix of unrelated hardware devices.
Can you tell me the considerations for not using simple-mfd?

Thanks

Best Regards, 
Billy Tsai
Krzysztof Kozlowski June 8, 2023, 6:43 a.m. UTC | #7
On 23/11/2022 09:24, Krzysztof Kozlowski wrote:
> On 23/11/2022 07:16, Billy Tsai wrote:
>> Add device binding for aspeed pwm-tach device which is a multi-function
>> device include pwm and tach function.
> 
> Subject: drop second, redundant "bindings".

Where did you implement this comment in your v6?

> Also use proper PATCH prefix.

Where did you implement this comment in your v6?

> 


Best regards,
Krzysztof
Krzysztof Kozlowski June 8, 2023, 7:20 a.m. UTC | #8
On 08/06/2023 09:15, Billy Tsai wrote:
>         On 23/11/2022 09:24, Krzysztof Kozlowski wrote:
>         >> On 23/11/2022 07:16, Billy Tsai wrote:
>         >>> Add device binding for aspeed pwm-tach device which is a multi-function
>         >>> device include pwm and tach function.
>         >>
>         >> Subject: drop second, redundant "bindings".
> 
>         > Where did you implement this comment in your v6?
> 
> Sorry, I guess by "Subject: drop second, redundant "bindings"" you meant to remove the second "bindings" string from my subject. So I change the subject from "dt-bindings: hwmon: Add bindings for aspeed tach controller" and "dt-bindings: pwm: Add bindings for aspeed pwm controller" in v4 to "dt-bindings: hwmon: Add ASPEED TACH Control documentation" and "dt-bindings: pwm: Add ASPEED PWM Control documentation" in v6.

A nit, subject: drop second/last, redundant "documentation". The
"dt-bindings" prefix is already stating that these are bindings and
documentation.

> If I have misunderstood your comment, please let me know.

You replaced one redundant with other redundant. I only asked to drop
it, not replace it.


Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml b/Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml
new file mode 100644
index 000000000000..e2a7be2e0a18
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/aspeed,ast2600-pwm-tach.yaml
@@ -0,0 +1,73 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2021 Aspeed, Inc.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/aspeed,ast2600-pwm-tach.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: PWM Tach controller
+
+description: |
+  The PWM Tach controller is represented as a multi-function device which
+  includes:
+    PWM
+    Tach
+
+maintainers:
+  - Billy Tsai <billy_tsai@aspeedtech.com>
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - aspeed,ast2600-pwm-tach
+      - const: syscon
+      - const: simple-mfd
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  pwm:
+    type: object
+    $ref: "/schemas/pwm/aspeed,ast2600-pwm.yaml"
+
+  tach:
+    type: object
+    $ref: "/schemas/hwmon/aspeed,ast2600-tach.yaml"
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - resets
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/ast2600-clock.h>
+    pwm_tach: pwm-tach@1e610000 {
+      compatible = "aspeed,ast2600-pwm-tach", "syscon", "simple-mfd";
+      reg = <0x1e610000 0x100>;
+      clocks = <&syscon ASPEED_CLK_AHB>;
+      resets = <&syscon ASPEED_RESET_PWM>;
+
+      pwm: pwm {
+        compatible = "aspeed,ast2600-pwm";
+        #pwm-cells = <3>;
+        pinctrl-names = "default";
+        pinctrl-0 = <&pinctrl_pwm0_default>;
+      };
+
+      tach: tach {
+        compatible = "aspeed,ast2600-tach";
+        pinctrl-names = "default";
+        pinctrl-0 = <&pinctrl_tach0_default>;
+      };
+    };