diff mbox series

[v1,1/2] dt-bindings: spi: add loongson spi

Message ID 20230308025908.21491-2-zhuyinbo@loongson.cn
State Superseded
Headers show
Series spi: loongson: add bus driver for the loongson spi | expand

Commit Message

Yinbo Zhu March 8, 2023, 2:59 a.m. UTC
Add the Loongson platform spi binding with DT schema format using
json-schema.

Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
---
 .../bindings/spi/loongson,ls-spi.yaml         | 47 +++++++++++++++++++
 MAINTAINERS                                   |  6 +++
 2 files changed, 53 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml

Comments

Krzysztof Kozlowski March 8, 2023, 11:30 a.m. UTC | #1
On 08/03/2023 03:59, Yinbo Zhu wrote:
> Add the Loongson platform spi binding with DT schema format using
> json-schema.
> 
> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
> ---
>  .../bindings/spi/loongson,ls-spi.yaml         | 47 +++++++++++++++++++
>  MAINTAINERS                                   |  6 +++
>  2 files changed, 53 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml

Filename matching the compatible.

> 
> diff --git a/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml b/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
> new file mode 100644
> index 000000000000..8a13a96b3818
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
> @@ -0,0 +1,47 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +
> +%YAML 1.2
> +---
> +$id: "http://devicetree.org/schemas/spi/loongson,ls-spi.yaml#"
> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"

Drop the quotes. What was the base of your code here?

> +
> +title: Loongson SPI controller
> +
> +maintainers:
> +  - Yinbo Zhu <zhuyinbo@loongson.cn>
> +
> +allOf:
> +  - $ref: /schemas/spi/spi-controller.yaml#
> +
> +properties:
> +  compatible:
> +    const: loongson,ls2k-spi
> +
> +  reg:
> +    maxItems: 1
> +
> +  clocks:
> +    maxItems: 1
> +
> +  clock-names:
> +    const: boot

Drop clock-names, not needed for single entry.

> +
> +required:
> +  - compatible
> +  - reg
> +  - clocks
> +  - clock-names
> +
> +unevaluatedProperties: false


Best regards,
Krzysztof
Rob Herring (Arm) March 8, 2023, 2:06 p.m. UTC | #2
On Wed, 08 Mar 2023 10:59:07 +0800, Yinbo Zhu wrote:
> Add the Loongson platform spi binding with DT schema format using
> json-schema.
> 
> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
> ---
>  .../bindings/spi/loongson,ls-spi.yaml         | 47 +++++++++++++++++++
>  MAINTAINERS                                   |  6 +++
>  2 files changed, 53 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls-spi.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:
Error: Documentation/devicetree/bindings/spi/loongson,ls-spi.example.dts:22.28-29 syntax error
FATAL ERROR: Unable to parse input tree
make[1]: *** [scripts/Makefile.lib:419: Documentation/devicetree/bindings/spi/loongson,ls-spi.example.dtb] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1512: dt_binding_check] Error 2

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230308025908.21491-2-zhuyinbo@loongson.cn

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

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 yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
Yinbo Zhu March 9, 2023, 2:08 a.m. UTC | #3
在 2023/3/8 下午7:30, Krzysztof Kozlowski 写道:
> On 08/03/2023 03:59, Yinbo Zhu wrote:
>> Add the Loongson platform spi binding with DT schema format using
>> json-schema.
>>
>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
>> ---
>>   .../bindings/spi/loongson,ls-spi.yaml         | 47 +++++++++++++++++++
>>   MAINTAINERS                                   |  6 +++
>>   2 files changed, 53 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
> Filename matching the compatible.

loongson,ls-spi.yaml is for ls2k-spi and ls7a-spi, I will add following 
desription:


properties:
   compatible:
     enum:
       - loongson,ls2k-spi
       - loongson,ls7a-spi
>
>> diff --git a/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml b/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
>> new file mode 100644
>> index 000000000000..8a13a96b3818
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
>> @@ -0,0 +1,47 @@
>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>> +
>> +%YAML 1.2
>> +---
>> +$id: "http://devicetree.org/schemas/spi/loongson,ls-spi.yaml#"
>> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
> Drop the quotes. What was the base of your code here?

okay, I will drop the quotes.    and I don't got it  about the code base 
that you said.

you meaning is advice me add a line  as follows ?

allOf:
   - $ref: /schemas/spi/spi-controller.yaml#

>
>> +
>> +title: Loongson SPI controller
>> +
>> +maintainers:
>> +  - Yinbo Zhu <zhuyinbo@loongson.cn>
>> +
>> +allOf:
>> +  - $ref: /schemas/spi/spi-controller.yaml#
>> +
>> +properties:
>> +  compatible:
>> +    const: loongson,ls2k-spi
>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  clocks:
>> +    maxItems: 1
>> +
>> +  clock-names:
>> +    const: boot
> Drop clock-names, not needed for single entry.

if drop the clock-names entry, the yaml file will compile fail.


root@user-pc:/home/user/workspace/test/code/www.kernel.org/linux# make 
DT_CHECKER_FLAGS=-m dt_binding_check 
DT_SCHEMA_FILES=Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
   LINT    Documentation/devicetree/bindings
   CHKDT   Documentation/devicetree/bindings/processed-schema.json
   SCHEMA  Documentation/devicetree/bindings/processed-schema.json
   DTEX Documentation/devicetree/bindings/spi/loongson,ls-spi.example.dts
   DTC_CHK Documentation/devicetree/bindings/spi/loongson,ls-spi.example.dtb
/home/user/workspace/test/code/www.kernel.org/linux/Documentation/devicetree/bindings/spi/loongson,ls-spi.example.dtb: 
spi@1fff0220: Unevaluated properties are not allowed ('clock-names' was 
unexpected)
     From schema: 
/home/user/workspace/test/code/www.kernel.org/linux/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
root@user-pc:/home/user/workspace/test/code/www.kernel.org/linux#

>
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +  - clocks
>> +  - clock-names
>> +
>> +unevaluatedProperties: false
>
> Best regards,
> Krzysztof
Krzysztof Kozlowski March 9, 2023, 6:23 a.m. UTC | #4
On 09/03/2023 03:08, zhuyinbo wrote:
> 
> 在 2023/3/8 下午7:30, Krzysztof Kozlowski 写道:
>> On 08/03/2023 03:59, Yinbo Zhu wrote:
>>> Add the Loongson platform spi binding with DT schema format using
>>> json-schema.
>>>
>>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
>>> ---
>>>   .../bindings/spi/loongson,ls-spi.yaml         | 47 +++++++++++++++++++
>>>   MAINTAINERS                                   |  6 +++
>>>   2 files changed, 53 insertions(+)
>>>   create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
>> Filename matching the compatible.
> 
> loongson,ls-spi.yaml is for ls2k-spi and ls7a-spi, I will add following 
> desription:
> 
> 
> properties:
>    compatible:
>      enum:
>        - loongson,ls2k-spi
>        - loongson,ls7a-spi

OK then.

>>
>>> diff --git a/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml b/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
>>> new file mode 100644
>>> index 000000000000..8a13a96b3818
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
>>> @@ -0,0 +1,47 @@
>>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>>> +
>>> +%YAML 1.2
>>> +---
>>> +$id: "http://devicetree.org/schemas/spi/loongson,ls-spi.yaml#"
>>> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
>> Drop the quotes. What was the base of your code here?
> 
> okay, I will drop the quotes.    and I don't got it  about the code base 
> that you said.
> 
> you meaning is advice me add a line  as follows ?

I meant, from which other file did you copy it?

>>> +
>>> +  clock-names:
>>> +    const: boot
>> Drop clock-names, not needed for single entry.
> 
> if drop the clock-names entry, the yaml file will compile fail.

Obviously you have to also drop it from DTS and driver...


Best regards,
Krzysztof
Yinbo Zhu March 9, 2023, 7:22 a.m. UTC | #5
在 2023/3/9 下午2:23, Krzysztof Kozlowski 写道:
> On 09/03/2023 03:08, zhuyinbo wrote:
>> 在 2023/3/8 下午7:30, Krzysztof Kozlowski 写道:
>>> On 08/03/2023 03:59, Yinbo Zhu wrote:
>>>> Add the Loongson platform spi binding with DT schema format using
>>>> json-schema.
>>>>
>>>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
>>>> ---
>>>>    .../bindings/spi/loongson,ls-spi.yaml         | 47 +++++++++++++++++++
>>>>    MAINTAINERS                                   |  6 +++
>>>>    2 files changed, 53 insertions(+)
>>>>    create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
>>> Filename matching the compatible.
>> loongson,ls-spi.yaml is for ls2k-spi and ls7a-spi, I will add following
>> desription:
>>
>>
>> properties:
>>     compatible:
>>       enum:
>>         - loongson,ls2k-spi
>>         - loongson,ls7a-spi
> OK then.

I was to explain why that yaml was name as "loongson,ls-spi.yaml"  
rather than "loongson,ls2k-spi.yaml"

because that need consider about  yaml filename to match 
"loongson,ls2k-spi" and "loongson,ls7a-spi".

>
>>>> diff --git a/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml b/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
>>>> new file mode 100644
>>>> index 000000000000..8a13a96b3818
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
>>>> @@ -0,0 +1,47 @@
>>>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>>>> +
>>>> +%YAML 1.2
>>>> +---
>>>> +$id: "http://devicetree.org/schemas/spi/loongson,ls-spi.yaml#"
>>>> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
>>> Drop the quotes. What was the base of your code here?
>> okay, I will drop the quotes.    and I don't got it  about the code base
>> that you said.
>>
>> you meaning is advice me add a line  as follows ?
> I meant, from which other file did you copy it?
okay,  but I maybe forgot it,  I should be refer other spi yaml file.
>
>>>> +
>>>> +  clock-names:
>>>> +    const: boot
>>> Drop clock-names, not needed for single entry.
>> if drop the clock-names entry, the yaml file will compile fail.
> Obviously you have to also drop it from DTS and driver...

drop clock-names should be not  affect my driver,  but I notice other 
lots of arm64 platform dts

was keep clock-names and clock in dts when use grep search "clock-names".

[zhuyinbo@localhost www.kernel.org]$ grep -rns "clock-names" arch/arm64/

arch/arm64/boot/dts/sprd/sc9863a.dtsi:280:            clock-names = 
"apb_pclk";
arch/arm64/boot/dts/sprd/sc9863a.dtsi:305:            clock-names = 
"apb_pclk";
arch/arm64/boot/dts/sprd/sc9863a.dtsi:330:            clock-names = 
"apb_pclk";
arch/arm64/boot/dts/sprd/sc9863a.dtsi:367:            clock-names = 
"apb_pclk";

>
>
> Best regards,
> Krzysztof
Yinbo Zhu March 10, 2023, 2:31 a.m. UTC | #6
在 2023/3/8 下午10:06, Rob Herring 写道:
> On Wed, 08 Mar 2023 10:59:07 +0800, Yinbo Zhu wrote:
>> Add the Loongson platform spi binding with DT schema format using
>> json-schema.
>>
>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
>> ---
>>   .../bindings/spi/loongson,ls-spi.yaml         | 47 +++++++++++++++++++
>>   MAINTAINERS                                   |  6 +++
>>   2 files changed, 53 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls-spi.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:
> Error: Documentation/devicetree/bindings/spi/loongson,ls-spi.example.dts:22.28-29 syntax error
> FATAL ERROR: Unable to parse input tree
> make[1]: *** [scripts/Makefile.lib:419: Documentation/devicetree/bindings/spi/loongson,ls-spi.example.dtb] Error 1
> make[1]: *** Waiting for unfinished jobs....
> make: *** [Makefile:1512: dt_binding_check] Error 2
>
> doc reference errors (make refcheckdocs):

This yaml patch need depend on

https://lore.kernel.org/all/20230307115022.12846-1-zhuyinbo@loongson.cn/

, then yaml  compile will be successfull.

>
> See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230308025908.21491-2-zhuyinbo@loongson.cn
>
> The base for the series is generally the latest rc1. A different dependency
> should be noted in *this* patch.
>
> 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 yourself. Note
> that DT_SCHEMA_FILES can be set to your schema file to speed up checking
> your schema. However, it must be unset to test all examples with your schema.
Krzysztof Kozlowski March 10, 2023, 9:08 a.m. UTC | #7
On 10/03/2023 03:31, zhuyinbo wrote:
> 
> 在 2023/3/8 下午10:06, Rob Herring 写道:
>> On Wed, 08 Mar 2023 10:59:07 +0800, Yinbo Zhu wrote:
>>> Add the Loongson platform spi binding with DT schema format using
>>> json-schema.
>>>
>>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
>>> ---
>>>   .../bindings/spi/loongson,ls-spi.yaml         | 47 +++++++++++++++++++
>>>   MAINTAINERS                                   |  6 +++
>>>   2 files changed, 53 insertions(+)
>>>   create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls-spi.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:
>> Error: Documentation/devicetree/bindings/spi/loongson,ls-spi.example.dts:22.28-29 syntax error
>> FATAL ERROR: Unable to parse input tree
>> make[1]: *** [scripts/Makefile.lib:419: Documentation/devicetree/bindings/spi/loongson,ls-spi.example.dtb] Error 1
>> make[1]: *** Waiting for unfinished jobs....
>> make: *** [Makefile:1512: dt_binding_check] Error 2
>>
>> doc reference errors (make refcheckdocs):
> 
> This yaml patch need depend on
> 
> https://lore.kernel.org/all/20230307115022.12846-1-zhuyinbo@loongson.cn/
> 
> , then yaml  compile will be successfull.

Nothing in the patch changelog (where it is preferred), not even cover
letter, mention dependencies.

Best regards,
Krzysztof
Yinbo Zhu March 10, 2023, 9:33 a.m. UTC | #8
在 2023/3/10 下午5:08, Krzysztof Kozlowski 写道:
> On 10/03/2023 03:31, zhuyinbo wrote:
>> 在 2023/3/8 下午10:06, Rob Herring 写道:
>>> On Wed, 08 Mar 2023 10:59:07 +0800, Yinbo Zhu wrote:
>>>> Add the Loongson platform spi binding with DT schema format using
>>>> json-schema.
>>>>
>>>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
>>>> ---
>>>>    .../bindings/spi/loongson,ls-spi.yaml         | 47 +++++++++++++++++++
>>>>    MAINTAINERS                                   |  6 +++
>>>>    2 files changed, 53 insertions(+)
>>>>    create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls-spi.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:
>>> Error: Documentation/devicetree/bindings/spi/loongson,ls-spi.example.dts:22.28-29 syntax error
>>> FATAL ERROR: Unable to parse input tree
>>> make[1]: *** [scripts/Makefile.lib:419: Documentation/devicetree/bindings/spi/loongson,ls-spi.example.dtb] Error 1
>>> make[1]: *** Waiting for unfinished jobs....
>>> make: *** [Makefile:1512: dt_binding_check] Error 2
>>>
>>> doc reference errors (make refcheckdocs):
>> This yaml patch need depend on
>>
>> https://lore.kernel.org/all/20230307115022.12846-1-zhuyinbo@loongson.cn/
>>
>> , then yaml  compile will be successfull.
> Nothing in the patch changelog (where it is preferred), not even cover
> letter, mention dependencies.

okay, I will add it in changelog  in next version.

>
> Best regards,
> Krzysztof
Yinbo Zhu March 13, 2023, 2:09 a.m. UTC | #9
在 2023/3/9 下午3:22, zhuyinbo 写道:
>
> 在 2023/3/9 下午2:23, Krzysztof Kozlowski 写道:
>> On 09/03/2023 03:08, zhuyinbo wrote:
>>> 在 2023/3/8 下午7:30, Krzysztof Kozlowski 写道:
>>>> On 08/03/2023 03:59, Yinbo Zhu wrote:
>>>>> Add the Loongson platform spi binding with DT schema format using
>>>>> json-schema.
>>>>>
>>>>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
>>>>> ---
>>>>>    .../bindings/spi/loongson,ls-spi.yaml         | 47 
>>>>> +++++++++++++++++++
>>>>>    MAINTAINERS                                   |  6 +++
>>>>>    2 files changed, 53 insertions(+)
>>>>>    create mode 100644 
>>>>> Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
>>>> Filename matching the compatible.
>>> loongson,ls-spi.yaml is for ls2k-spi and ls7a-spi, I will add following
>>> desription:
>>>
>>>
>>> properties:
>>>     compatible:
>>>       enum:
>>>         - loongson,ls2k-spi
>>>         - loongson,ls7a-spi
>> OK then.
>
> I was to explain why that yaml was name as "loongson,ls-spi.yaml" 
> rather than "loongson,ls2k-spi.yaml"
>
> because that need consider about  yaml filename to match 
> "loongson,ls2k-spi" and "loongson,ls7a-spi".
>
>>
>>>>> diff --git 
>>>>> a/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml 
>>>>> b/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
>>>>> new file mode 100644
>>>>> index 000000000000..8a13a96b3818
>>>>> --- /dev/null
>>>>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
>>>>> @@ -0,0 +1,47 @@
>>>>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>>>>> +
>>>>> +%YAML 1.2
>>>>> +---
>>>>> +$id: "http://devicetree.org/schemas/spi/loongson,ls-spi.yaml#"
>>>>> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
>>>> Drop the quotes. What was the base of your code here?
>>> okay, I will drop the quotes.    and I don't got it  about the code 
>>> base
>>> that you said.
>>>
>>> you meaning is advice me add a line  as follows ?
>> I meant, from which other file did you copy it?
> okay,  but I maybe forgot it,  I should be refer other spi yaml file.
>>
>>>>> +
>>>>> +  clock-names:
>>>>> +    const: boot
>>>> Drop clock-names, not needed for single entry.
>>> if drop the clock-names entry, the yaml file will compile fail.
>> Obviously you have to also drop it from DTS and driver...
>
> drop clock-names should be not  affect my driver,  but I notice other 
> lots of arm64 platform dts
>
> was keep clock-names and clock in dts when use grep search "clock-names".
>
> [zhuyinbo@localhost www.kernel.org]$ grep -rns "clock-names" arch/arm64/
>
> arch/arm64/boot/dts/sprd/sc9863a.dtsi:280:            clock-names = 
> "apb_pclk";
> arch/arm64/boot/dts/sprd/sc9863a.dtsi:305:            clock-names = 
> "apb_pclk";
> arch/arm64/boot/dts/sprd/sc9863a.dtsi:330:            clock-names = 
> "apb_pclk";
> arch/arm64/boot/dts/sprd/sc9863a.dtsi:367:            clock-names = 
> "apb_pclk";

so , if you think it is okay I will keep clock-names and clock in yaml 
file like other platform.

>
>>
>>
>> Best regards,
>> Krzysztof
Krzysztof Kozlowski March 13, 2023, 6:42 a.m. UTC | #10
On 13/03/2023 03:09, zhuyinbo wrote:
> 
> 在 2023/3/9 下午3:22, zhuyinbo 写道:
>>
>> 在 2023/3/9 下午2:23, Krzysztof Kozlowski 写道:
>>> On 09/03/2023 03:08, zhuyinbo wrote:
>>>> 在 2023/3/8 下午7:30, Krzysztof Kozlowski 写道:
>>>>> On 08/03/2023 03:59, Yinbo Zhu wrote:
>>>>>> Add the Loongson platform spi binding with DT schema format using
>>>>>> json-schema.
>>>>>>
>>>>>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
>>>>>> ---
>>>>>>    .../bindings/spi/loongson,ls-spi.yaml         | 47 
>>>>>> +++++++++++++++++++
>>>>>>    MAINTAINERS                                   |  6 +++
>>>>>>    2 files changed, 53 insertions(+)
>>>>>>    create mode 100644 
>>>>>> Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
>>>>> Filename matching the compatible.
>>>> loongson,ls-spi.yaml is for ls2k-spi and ls7a-spi, I will add following
>>>> desription:
>>>>
>>>>
>>>> properties:
>>>>     compatible:
>>>>       enum:
>>>>         - loongson,ls2k-spi
>>>>         - loongson,ls7a-spi
>>> OK then.
>>
>> I was to explain why that yaml was name as "loongson,ls-spi.yaml" 
>> rather than "loongson,ls2k-spi.yaml"
>>
>> because that need consider about  yaml filename to match 
>> "loongson,ls2k-spi" and "loongson,ls7a-spi".
>>
>>>
>>>>>> diff --git 
>>>>>> a/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml 
>>>>>> b/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
>>>>>> new file mode 100644
>>>>>> index 000000000000..8a13a96b3818
>>>>>> --- /dev/null
>>>>>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
>>>>>> @@ -0,0 +1,47 @@
>>>>>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>>>>>> +
>>>>>> +%YAML 1.2
>>>>>> +---
>>>>>> +$id: "http://devicetree.org/schemas/spi/loongson,ls-spi.yaml#"
>>>>>> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
>>>>> Drop the quotes. What was the base of your code here?
>>>> okay, I will drop the quotes.    and I don't got it  about the code 
>>>> base
>>>> that you said.
>>>>
>>>> you meaning is advice me add a line  as follows ?
>>> I meant, from which other file did you copy it?
>> okay,  but I maybe forgot it,  I should be refer other spi yaml file.
>>>
>>>>>> +
>>>>>> +  clock-names:
>>>>>> +    const: boot
>>>>> Drop clock-names, not needed for single entry.
>>>> if drop the clock-names entry, the yaml file will compile fail.
>>> Obviously you have to also drop it from DTS and driver...
>>
>> drop clock-names should be not  affect my driver,  but I notice other 
>> lots of arm64 platform dts
>>
>> was keep clock-names and clock in dts when use grep search "clock-names".
>>
>> [zhuyinbo@localhost www.kernel.org]$ grep -rns "clock-names" arch/arm64/
>>
>> arch/arm64/boot/dts/sprd/sc9863a.dtsi:280:            clock-names = 
>> "apb_pclk";
>> arch/arm64/boot/dts/sprd/sc9863a.dtsi:305:            clock-names = 
>> "apb_pclk";
>> arch/arm64/boot/dts/sprd/sc9863a.dtsi:330:            clock-names = 
>> "apb_pclk";
>> arch/arm64/boot/dts/sprd/sc9863a.dtsi:367:            clock-names = 
>> "apb_pclk";
> 
> so , if you think it is okay I will keep clock-names and clock in yaml 
> file like other platform.

No, it's not ok.

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml b/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
new file mode 100644
index 000000000000..8a13a96b3818
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
@@ -0,0 +1,47 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/spi/loongson,ls-spi.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Loongson SPI controller
+
+maintainers:
+  - Yinbo Zhu <zhuyinbo@loongson.cn>
+
+allOf:
+  - $ref: /schemas/spi/spi-controller.yaml#
+
+properties:
+  compatible:
+    const: loongson,ls2k-spi
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    const: boot
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/loongson,ls2k-clk.h>
+    spi0: spi@1fff0220{
+        compatible = "loongson,ls2k-spi";
+        reg = <0x1fff0220 0x10>;
+        clocks = <&clk LOONGSON2_BOOT_CLK>;
+        clock-names = "boot";
+        #address-cells = <1>;
+        #size-cells = <0>;
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index 631fac6ab555..0efb739e793f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12156,6 +12156,12 @@  S:	Maintained
 F:	Documentation/devicetree/bindings/clock/loongson,ls2k-clk.yaml
 F:	include/dt-bindings/clock/loongson,ls2k-clk.h
 
+LOONGSON SPI DRIVER
+M:	Yinbo Zhu <zhuyinbo@loongson.cn>
+L:	linux-spi@vger.kernel.org
+S:	Maintained
+F:	Documentation/devicetree/bindings/spi/loongson,ls-spi.yaml
+
 LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)
 M:	Sathya Prakash <sathya.prakash@broadcom.com>
 M:	Sreekanth Reddy <sreekanth.reddy@broadcom.com>