diff mbox series

[v12,1/2] spi: add loongson spi bindings

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

Commit Message

Yinbo Zhu June 8, 2023, 7:28 a.m. UTC
Add the Loongson platform spi binding with DT schema format using
json-schema.

Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 .../bindings/spi/loongson,ls2k-spi.yaml       | 41 +++++++++++++++++++
 MAINTAINERS                                   |  6 +++
 2 files changed, 47 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml

Comments

Krzysztof Kozlowski June 8, 2023, 7:45 a.m. UTC | #1
On 08/06/2023 09:28, Yinbo Zhu wrote:
> Add the Loongson platform spi binding with DT schema format using
> json-schema.

Please use subject prefixes matching the subsystem. You can get them for
example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory
your patch is touching.

The prefix for SPI should be: "spi: dt-bindings: ". In the same time
last "bindings" are redundant.

> 
> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  .../bindings/spi/loongson,ls2k-spi.yaml       | 41 +++++++++++++++++++
>  MAINTAINERS                                   |  6 +++
>  2 files changed, 47 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
> 
> diff --git a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
> new file mode 100644
> index 000000000000..423ee851edd5
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml

Filename based on compatible.

> @@ -0,0 +1,41 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/spi/loongson,ls2k-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:
> +    enum:
> +      - loongson,ls2k1000-spi

No compatibles for other devices? Didn't we have big discussion about this?

https://elixir.bootlin.com/linux/v6.1-rc1/source/Documentation/devicetree/bindings/writing-bindings.rst#L42

Best regards,
Krzysztof
Yinbo Zhu June 8, 2023, 8:39 a.m. UTC | #2
在 2023/6/8 下午3:45, Krzysztof Kozlowski 写道:
> On 08/06/2023 09:28, Yinbo Zhu wrote:
>> Add the Loongson platform spi binding with DT schema format using
>> json-schema.
> 
> Please use subject prefixes matching the subsystem. You can get them for
> example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory
> your patch is touching.
> 
> The prefix for SPI should be: "spi: dt-bindings: ". In the same time
> last "bindings" are redundant.


okay, I got it.

> 
>>
>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
>> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>> ---
>>   .../bindings/spi/loongson,ls2k-spi.yaml       | 41 +++++++++++++++++++
>>   MAINTAINERS                                   |  6 +++
>>   2 files changed, 47 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>> new file mode 100644
>> index 000000000000..423ee851edd5
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
> 
> Filename based on compatible.


There will be more ls2k series SoC spi device in the future thus I still
use "loongson,ls2k-spi.yaml" for cover it.

> 
>> @@ -0,0 +1,41 @@
>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/spi/loongson,ls2k-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:
>> +    enum:
>> +      - loongson,ls2k1000-spi
> 
> No compatibles for other devices? Didn't we have big discussion about this?
> 
> https://elixir.bootlin.com/linux/v6.1-rc1/source/Documentation/devicetree/bindings/writing-bindings.rst#L42


There are other ls2k SPI devices compatible, such as,
"loongson,ls2k0500-spi", "loongson,ls2k2000-spi" but currently I plan to
add ls2k1000 spi device first, Other ls2k SoC spi device adaptation may
require some additional work and I will add it later.

Thanks
Krzysztof Kozlowski June 8, 2023, 8:53 a.m. UTC | #3
On 08/06/2023 10:39, zhuyinbo wrote:
>>>
>>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
>>> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>> ---
>>>   .../bindings/spi/loongson,ls2k-spi.yaml       | 41 +++++++++++++++++++
>>>   MAINTAINERS                                   |  6 +++
>>>   2 files changed, 47 insertions(+)
>>>   create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>
>>> diff --git a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>> new file mode 100644
>>> index 000000000000..423ee851edd5
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>
>> Filename based on compatible.
> 
> 
> There will be more ls2k series SoC spi device in the future thus I still
> use "loongson,ls2k-spi.yaml" for cover it.

Add them now.

> 
>>
>>> @@ -0,0 +1,41 @@
>>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>>> +%YAML 1.2
>>> +---
>>> +$id: http://devicetree.org/schemas/spi/loongson,ls2k-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:
>>> +    enum:
>>> +      - loongson,ls2k1000-spi
>>
>> No compatibles for other devices? Didn't we have big discussion about this?
>>
>> https://elixir.bootlin.com/linux/v6.1-rc1/source/Documentation/devicetree/bindings/writing-bindings.rst#L42
> 
> 
> There are other ls2k SPI devices compatible, such as,
> "loongson,ls2k0500-spi", "loongson,ls2k2000-spi" but currently I plan to
> add ls2k1000 spi device first, Other ls2k SoC spi device adaptation may
> require some additional work and I will add it later.

Previously you claimed this serves entire family, so I don't understand
why you need to fix something. Why previously it was working for entire
family but now it does not?

Best regards,
Krzysztof
Yinbo Zhu June 8, 2023, 10 a.m. UTC | #4
在 2023/6/8 下午4:53, Krzysztof Kozlowski 写道:
> On 08/06/2023 10:39, zhuyinbo wrote:
>>>>
>>>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
>>>> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>>> ---
>>>>    .../bindings/spi/loongson,ls2k-spi.yaml       | 41 +++++++++++++++++++
>>>>    MAINTAINERS                                   |  6 +++
>>>>    2 files changed, 47 insertions(+)
>>>>    create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>> new file mode 100644
>>>> index 000000000000..423ee851edd5
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>
>>> Filename based on compatible.
>>
>>
>> There will be more ls2k series SoC spi device in the future thus I still
>> use "loongson,ls2k-spi.yaml" for cover it.
> 
> Add them now.


The 2k0500 doesn't support CCF and not use CCF to gain clock and We
internally tend to prioritize supporting 2k1000.

> 
>>
>>>
>>>> @@ -0,0 +1,41 @@
>>>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>>>> +%YAML 1.2
>>>> +---
>>>> +$id: http://devicetree.org/schemas/spi/loongson,ls2k-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:
>>>> +    enum:
>>>> +      - loongson,ls2k1000-spi
>>>
>>> No compatibles for other devices? Didn't we have big discussion about this?
>>>
>>> https://elixir.bootlin.com/linux/v6.1-rc1/source/Documentation/devicetree/bindings/writing-bindings.rst#L42
>>
>>
>> There are other ls2k SPI devices compatible, such as,
>> "loongson,ls2k0500-spi", "loongson,ls2k2000-spi" but currently I plan to
>> add ls2k1000 spi device first, Other ls2k SoC spi device adaptation may
>> require some additional work and I will add it later.
> 
> Previously you claimed this serves entire family, so I don't understand
> why you need to fix something. Why previously it was working for entire
> family but now it does not?


It can work was for ls2k1000 and ls2k0500 and it specifically refers to
spi driver. but 2k0500 doesn't implementing a clock driver and doesn't
use CCF to gain clock but can use "clock-frequency".  Is it necessary to
obtain a clock based on CCF? If it's necessary, then it seems that it
can only added 2k1000 spi first.

Thanks,
Yinbo
Krzysztof Kozlowski June 8, 2023, 10:02 a.m. UTC | #5
On 08/06/2023 12:00, zhuyinbo wrote:
> 
> 
> 在 2023/6/8 下午4:53, Krzysztof Kozlowski 写道:
>> On 08/06/2023 10:39, zhuyinbo wrote:
>>>>>
>>>>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
>>>>> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>>>> ---
>>>>>    .../bindings/spi/loongson,ls2k-spi.yaml       | 41 +++++++++++++++++++
>>>>>    MAINTAINERS                                   |  6 +++
>>>>>    2 files changed, 47 insertions(+)
>>>>>    create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>>
>>>>> diff --git a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>> new file mode 100644
>>>>> index 000000000000..423ee851edd5
>>>>> --- /dev/null
>>>>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>
>>>> Filename based on compatible.
>>>
>>>
>>> There will be more ls2k series SoC spi device in the future thus I still
>>> use "loongson,ls2k-spi.yaml" for cover it.
>>
>> Add them now.
> 
> 
> The 2k0500 doesn't support CCF and not use CCF to gain clock and We
> internally tend to prioritize supporting 2k1000.

Don't you refer now to drivers? Because how hardware can not support
clocks if it has them? How CCF is anyhow related to hardware?

> 
>>
>>>
>>>>
>>>>> @@ -0,0 +1,41 @@
>>>>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>>>>> +%YAML 1.2
>>>>> +---
>>>>> +$id: http://devicetree.org/schemas/spi/loongson,ls2k-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:
>>>>> +    enum:
>>>>> +      - loongson,ls2k1000-spi
>>>>
>>>> No compatibles for other devices? Didn't we have big discussion about this?
>>>>
>>>> https://elixir.bootlin.com/linux/v6.1-rc1/source/Documentation/devicetree/bindings/writing-bindings.rst#L42
>>>
>>>
>>> There are other ls2k SPI devices compatible, such as,
>>> "loongson,ls2k0500-spi", "loongson,ls2k2000-spi" but currently I plan to
>>> add ls2k1000 spi device first, Other ls2k SoC spi device adaptation may
>>> require some additional work and I will add it later.
>>
>> Previously you claimed this serves entire family, so I don't understand
>> why you need to fix something. Why previously it was working for entire
>> family but now it does not?
> 
> 
> It can work was for ls2k1000 and ls2k0500 and it specifically refers to
> spi driver. but 2k0500 doesn't implementing a clock driver and doesn't

We do not discuss here drivers, but bindings. Whatever your drivers are
not supporting, matters less.

> use CCF to gain clock but can use "clock-frequency".  Is it necessary to
> obtain a clock based on CCF? If it's necessary, then it seems that it
> can only added 2k1000 spi first.

Not related to bindings...

Best regards,
Krzysztof
Yinbo Zhu June 8, 2023, 11:42 a.m. UTC | #6
在 2023/6/8 下午6:02, Krzysztof Kozlowski 写道:
> On 08/06/2023 12:00, zhuyinbo wrote:
>>
>>
>> 在 2023/6/8 下午4:53, Krzysztof Kozlowski 写道:
>>> On 08/06/2023 10:39, zhuyinbo wrote:
>>>>>>
>>>>>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
>>>>>> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>>>>>> ---
>>>>>>     .../bindings/spi/loongson,ls2k-spi.yaml       | 41 +++++++++++++++++++
>>>>>>     MAINTAINERS                                   |  6 +++
>>>>>>     2 files changed, 47 insertions(+)
>>>>>>     create mode 100644 Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>>>
>>>>>> diff --git a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>>> new file mode 100644
>>>>>> index 000000000000..423ee851edd5
>>>>>> --- /dev/null
>>>>>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>>
>>>>> Filename based on compatible.
>>>>
>>>>
>>>> There will be more ls2k series SoC spi device in the future thus I still
>>>> use "loongson,ls2k-spi.yaml" for cover it.
>>>
>>> Add them now.
>>
>>
>> The 2k0500 doesn't support CCF and not use CCF to gain clock and We
>> internally tend to prioritize supporting 2k1000.
> 
> Don't you refer now to drivers? Because how hardware can not support
> clocks if it has them? How CCF is anyhow related to hardware?


The CCF (common clock framework) driver only affects the clock parameter
pass method and isn't related to clock hardware. and if dts pass a
"clock-frequency" that not need a clock driver but if dts pass a
"clocks" that need a clock driver. Currently, only 2k1000 has
implemented a clock driver.

> 
>>
>>>
>>>>
>>>>>
>>>>>> @@ -0,0 +1,41 @@
>>>>>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>>>>>> +%YAML 1.2
>>>>>> +---
>>>>>> +$id: http://devicetree.org/schemas/spi/loongson,ls2k-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:
>>>>>> +    enum:
>>>>>> +      - loongson,ls2k1000-spi
>>>>>
>>>>> No compatibles for other devices? Didn't we have big discussion about this?
>>>>>
>>>>> https://elixir.bootlin.com/linux/v6.1-rc1/source/Documentation/devicetree/bindings/writing-bindings.rst#L42
>>>>
>>>>
>>>> There are other ls2k SPI devices compatible, such as,
>>>> "loongson,ls2k0500-spi", "loongson,ls2k2000-spi" but currently I plan to
>>>> add ls2k1000 spi device first, Other ls2k SoC spi device adaptation may
>>>> require some additional work and I will add it later.
>>>
>>> Previously you claimed this serves entire family, so I don't understand
>>> why you need to fix something. Why previously it was working for entire
>>> family but now it does not?
>>
>>
>> It can work was for ls2k1000 and ls2k0500 and it specifically refers to
>> spi driver. but 2k0500 doesn't implementing a clock driver and doesn't
> 
> We do not discuss here drivers, but bindings. Whatever your drivers are
> not supporting, matters less.
> 
>> use CCF to gain clock but can use "clock-frequency".  Is it necessary to
>> obtain a clock based on CCF? If it's necessary, then it seems that it
>> can only added 2k1000 spi first.
> 
> Not related to bindings...


I may understand that what you said, and the dt-bindings only cover 
hardware and not involve the drivers. if so, I will add following:


--- a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
+++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
@@ -16,6 +16,7 @@ properties:
    compatible:
      enum:
        - loongson,ls2k1000-spi
+      - loongson,ls2k0500-spi


Thanks,
Yinbo
Krzysztof Kozlowski June 8, 2023, 11:45 a.m. UTC | #7
On 08/06/2023 13:42, zhuyinbo wrote:
>>
>>> It can work was for ls2k1000 and ls2k0500 and it specifically refers to
>>> spi driver. but 2k0500 doesn't implementing a clock driver and doesn't
>>
>> We do not discuss here drivers, but bindings. Whatever your drivers are
>> not supporting, matters less.
>>
>>> use CCF to gain clock but can use "clock-frequency".  Is it necessary to
>>> obtain a clock based on CCF? If it's necessary, then it seems that it
>>> can only added 2k1000 spi first.
>>
>> Not related to bindings...
> 
> 
> I may understand that what you said, and the dt-bindings only cover 
> hardware and not involve the drivers. if so, I will add following:
> 
> 
> --- a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
> +++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
> @@ -16,6 +16,7 @@ properties:
>     compatible:
>       enum:
>         - loongson,ls2k1000-spi
> +      - loongson,ls2k0500-spi

Aren't they compatible?

Best regards,
Krzysztof
Yinbo Zhu June 8, 2023, 12:10 p.m. UTC | #8
在 2023/6/8 下午7:45, Krzysztof Kozlowski 写道:
> On 08/06/2023 13:42, zhuyinbo wrote:
>> --- a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>> @@ -16,6 +16,7 @@ properties:
>>      compatible:
>>        enum:
>>          - loongson,ls2k1000-spi
>> +      - loongson,ls2k0500-spi
> 
> Aren't they compatible?
> 


Are you saying that the spi driver is compatible with 2k0500 ?
Yes.  and the 2k1000 spi hardware was same with 2k0500 common type spi
hardware.

but afterwards, it may be necessary to implement a clock drvier for
2k0500, because the spi driver was use "devm_clk_get_optional()" to
get clock and not use "of_property_read_u32(np, "clock-frequency",
&clk)",  But this seems to have nothing to do with bindings.


Thanks,
Yinbo
Krzysztof Kozlowski June 8, 2023, 1:26 p.m. UTC | #9
On 08/06/2023 14:10, zhuyinbo wrote:
> 
> 
> 在 2023/6/8 下午7:45, Krzysztof Kozlowski 写道:
>> On 08/06/2023 13:42, zhuyinbo wrote:
>>> --- a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>> @@ -16,6 +16,7 @@ properties:
>>>      compatible:
>>>        enum:
>>>          - loongson,ls2k1000-spi
>>> +      - loongson,ls2k0500-spi
>>
>> Aren't they compatible?
>>
> 
> 
> Are you saying that the spi driver is compatible with 2k0500 ?

Didn't you say this through 11 previous revisions?

> Yes.  and the 2k1000 spi hardware was same with 2k0500 common type spi
> hardware.
> 
> but afterwards, it may be necessary to implement a clock drvier for
> 2k0500, because the spi driver was use "devm_clk_get_optional()" to
> get clock and not use "of_property_read_u32(np, "clock-frequency",
> &clk)",  But this seems to have nothing to do with bindings.
>

Best regards,
Krzysztof
Yinbo Zhu June 9, 2023, 3:13 a.m. UTC | #10
在 2023/6/8 下午9:26, Krzysztof Kozlowski 写道:
> On 08/06/2023 14:10, zhuyinbo wrote:
>>
>>
>> 在 2023/6/8 下午7:45, Krzysztof Kozlowski 写道:
>>> On 08/06/2023 13:42, zhuyinbo wrote:
>>>> --- a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>> @@ -16,6 +16,7 @@ properties:
>>>>       compatible:
>>>>         enum:
>>>>           - loongson,ls2k1000-spi
>>>> +      - loongson,ls2k0500-spi
>>>
>>> Aren't they compatible?
>>>
>>
>>
>> Are you saying that the spi driver is compatible with 2k0500 ?
> 
> Didn't you say this through 11 previous revisions?


Yes, did I understand your meaning incorrectly ?

Thanks,
Yinbo
> 
>> Yes.  and the 2k1000 spi hardware was same with 2k0500 common type spi
>> hardware.
>>
>> but afterwards, it may be necessary to implement a clock drvier for
>> 2k0500, because the spi driver was use "devm_clk_get_optional()" to
>> get clock and not use "of_property_read_u32(np, "clock-frequency",
>> &clk)",  But this seems to have nothing to do with bindings.
Krzysztof Kozlowski June 9, 2023, 4:45 p.m. UTC | #11
On 09/06/2023 05:13, zhuyinbo wrote:
> 
> 
> 在 2023/6/8 下午9:26, Krzysztof Kozlowski 写道:
>> On 08/06/2023 14:10, zhuyinbo wrote:
>>>
>>>
>>> 在 2023/6/8 下午7:45, Krzysztof Kozlowski 写道:
>>>> On 08/06/2023 13:42, zhuyinbo wrote:
>>>>> --- a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>> @@ -16,6 +16,7 @@ properties:
>>>>>       compatible:
>>>>>         enum:
>>>>>           - loongson,ls2k1000-spi
>>>>> +      - loongson,ls2k0500-spi
>>>>
>>>> Aren't they compatible?
>>>>
>>>
>>>
>>> Are you saying that the spi driver is compatible with 2k0500 ?
>>
>> Didn't you say this through 11 previous revisions?
> 
> 
> Yes, did I understand your meaning incorrectly ?

If they are compatible, then they are not part of one enum. They could
not be as this would easily fail in testing of your DTS.

Best regards,
Krzysztof
Yinbo Zhu June 12, 2023, 7:13 a.m. UTC | #12
在 2023/6/10 上午12:45, Krzysztof Kozlowski 写道:
> On 09/06/2023 05:13, zhuyinbo wrote:
>>
>>
>> 在 2023/6/8 下午9:26, Krzysztof Kozlowski 写道:
>>> On 08/06/2023 14:10, zhuyinbo wrote:
>>>>
>>>>
>>>> 在 2023/6/8 下午7:45, Krzysztof Kozlowski 写道:
>>>>> On 08/06/2023 13:42, zhuyinbo wrote:
>>>>>> --- a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>>> @@ -16,6 +16,7 @@ properties:
>>>>>>        compatible:
>>>>>>          enum:
>>>>>>            - loongson,ls2k1000-spi
>>>>>> +      - loongson,ls2k0500-spi
>>>>>
>>>>> Aren't they compatible?
>>>>>
>>>>
>>>>
>>>> Are you saying that the spi driver is compatible with 2k0500 ?
>>>
>>> Didn't you say this through 11 previous revisions?
>>
>>
>> Yes, did I understand your meaning incorrectly ?
> 
> If they are compatible, then they are not part of one enum. They could
> not be as this would easily fail in testing of your DTS.
> 


The "loongson,ls2k0500-spi" wasn't a compatible in previous version and
I will add "loongson,ls2k0500-spi" as a compatible in spi driver and
added it as a part of the one enum in dt-binding.

Thanks,
Yinbo
Krzysztof Kozlowski June 12, 2023, 7:17 a.m. UTC | #13
On 12/06/2023 09:13, zhuyinbo wrote:
> 
> 
> 在 2023/6/10 上午12:45, Krzysztof Kozlowski 写道:
>> On 09/06/2023 05:13, zhuyinbo wrote:
>>>
>>>
>>> 在 2023/6/8 下午9:26, Krzysztof Kozlowski 写道:
>>>> On 08/06/2023 14:10, zhuyinbo wrote:
>>>>>
>>>>>
>>>>> 在 2023/6/8 下午7:45, Krzysztof Kozlowski 写道:
>>>>>> On 08/06/2023 13:42, zhuyinbo wrote:
>>>>>>> --- a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>>>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>>>> @@ -16,6 +16,7 @@ properties:
>>>>>>>        compatible:
>>>>>>>          enum:
>>>>>>>            - loongson,ls2k1000-spi
>>>>>>> +      - loongson,ls2k0500-spi
>>>>>>
>>>>>> Aren't they compatible?
>>>>>>
>>>>>
>>>>>
>>>>> Are you saying that the spi driver is compatible with 2k0500 ?
>>>>
>>>> Didn't you say this through 11 previous revisions?
>>>
>>>
>>> Yes, did I understand your meaning incorrectly ?
>>
>> If they are compatible, then they are not part of one enum. They could
>> not be as this would easily fail in testing of your DTS.
>>
> 
> 
> The "loongson,ls2k0500-spi" wasn't a compatible in previous version and
> I will add "loongson,ls2k0500-spi" as a compatible in spi driver and
> added it as a part of the one enum in dt-binding.

No, because you claimed - if I understood correctly - that they are
compatible. Don't add fake entries to the driver.


Best regards,
Krzysztof
Yinbo Zhu June 12, 2023, 7:40 a.m. UTC | #14
在 2023/6/12 下午3:17, Krzysztof Kozlowski 写道:
> On 12/06/2023 09:13, zhuyinbo wrote:
>>
>>
>> 在 2023/6/10 上午12:45, Krzysztof Kozlowski 写道:
>>> On 09/06/2023 05:13, zhuyinbo wrote:
>>>>
>>>>
>>>> 在 2023/6/8 下午9:26, Krzysztof Kozlowski 写道:
>>>>> On 08/06/2023 14:10, zhuyinbo wrote:
>>>>>>
>>>>>>
>>>>>> 在 2023/6/8 下午7:45, Krzysztof Kozlowski 写道:
>>>>>>> On 08/06/2023 13:42, zhuyinbo wrote:
>>>>>>>> --- a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>>>>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>>>>> @@ -16,6 +16,7 @@ properties:
>>>>>>>>         compatible:
>>>>>>>>           enum:
>>>>>>>>             - loongson,ls2k1000-spi
>>>>>>>> +      - loongson,ls2k0500-spi
>>>>>>>
>>>>>>> Aren't they compatible?
>>>>>>>
>>>>>>
>>>>>>
>>>>>> Are you saying that the spi driver is compatible with 2k0500 ?
>>>>>
>>>>> Didn't you say this through 11 previous revisions?
>>>>
>>>>
>>>> Yes, did I understand your meaning incorrectly ?
>>>
>>> If they are compatible, then they are not part of one enum. They could
>>> not be as this would easily fail in testing of your DTS.
>>>
>>
>>
>> The "loongson,ls2k0500-spi" wasn't a compatible in previous version and
>> I will add "loongson,ls2k0500-spi" as a compatible in spi driver and
>> added it as a part of the one enum in dt-binding.
> 
> No, because you claimed - if I understood correctly - that they are
> compatible. Don't add fake entries to the driver.
> 


I'm a bit confused, and I just need to add 'loongson,ls2k0500-spi' as
one enum in dt-bindings, but driver don't add this entry ?

Thanks,
Yinbo
Krzysztof Kozlowski June 12, 2023, 8:16 a.m. UTC | #15
On 12/06/2023 09:40, zhuyinbo wrote:
> 
> 
> 在 2023/6/12 下午3:17, Krzysztof Kozlowski 写道:
>> On 12/06/2023 09:13, zhuyinbo wrote:
>>>
>>>
>>> 在 2023/6/10 上午12:45, Krzysztof Kozlowski 写道:
>>>> On 09/06/2023 05:13, zhuyinbo wrote:
>>>>>
>>>>>
>>>>> 在 2023/6/8 下午9:26, Krzysztof Kozlowski 写道:
>>>>>> On 08/06/2023 14:10, zhuyinbo wrote:
>>>>>>>
>>>>>>>
>>>>>>> 在 2023/6/8 下午7:45, Krzysztof Kozlowski 写道:
>>>>>>>> On 08/06/2023 13:42, zhuyinbo wrote:
>>>>>>>>> --- a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>>>>>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>>>>>> @@ -16,6 +16,7 @@ properties:
>>>>>>>>>         compatible:
>>>>>>>>>           enum:
>>>>>>>>>             - loongson,ls2k1000-spi
>>>>>>>>> +      - loongson,ls2k0500-spi
>>>>>>>>
>>>>>>>> Aren't they compatible?
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Are you saying that the spi driver is compatible with 2k0500 ?
>>>>>>
>>>>>> Didn't you say this through 11 previous revisions?
>>>>>
>>>>>
>>>>> Yes, did I understand your meaning incorrectly ?
>>>>
>>>> If they are compatible, then they are not part of one enum. They could
>>>> not be as this would easily fail in testing of your DTS.
>>>>
>>>
>>>
>>> The "loongson,ls2k0500-spi" wasn't a compatible in previous version and
>>> I will add "loongson,ls2k0500-spi" as a compatible in spi driver and
>>> added it as a part of the one enum in dt-binding.
>>
>> No, because you claimed - if I understood correctly - that they are
>> compatible. Don't add fake entries to the driver.
>>
> 
> 
> I'm a bit confused, and I just need to add 'loongson,ls2k0500-spi' as
> one enum in dt-bindings, but driver don't add this entry ?

Compatibility is expressed with a list:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#compatible
so it cannot be just one enum, but "items". There are hundreds of
examples including example-schema.


Best regards,
Krzysztof
Yinbo Zhu June 12, 2023, 11:29 a.m. UTC | #16
在 2023/6/12 下午4:16, Krzysztof Kozlowski 写道:
>>>>>>>> 在 2023/6/8 下午7:45, Krzysztof Kozlowski 写道:
>>>>>>>>> On 08/06/2023 13:42, zhuyinbo wrote:
>>>>>>>>>> --- a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>>>>>>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>>>>>>> @@ -16,6 +16,7 @@ properties:
>>>>>>>>>>          compatible:
>>>>>>>>>>            enum:
>>>>>>>>>>              - loongson,ls2k1000-spi
>>>>>>>>>> +      - loongson,ls2k0500-spi
>>>>>>>>>
>>>>>>>>> Aren't they compatible?
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Are you saying that the spi driver is compatible with 2k0500 ?
>>>>>>>
>>>>>>> Didn't you say this through 11 previous revisions?
>>>>>>
>>>>>>
>>>>>> Yes, did I understand your meaning incorrectly ?
>>>>>
>>>>> If they are compatible, then they are not part of one enum. They could
>>>>> not be as this would easily fail in testing of your DTS.
>>>>>
>>>>
>>>>
>>>> The "loongson,ls2k0500-spi" wasn't a compatible in previous version and
>>>> I will add "loongson,ls2k0500-spi" as a compatible in spi driver and
>>>> added it as a part of the one enum in dt-binding.
>>>
>>> No, because you claimed - if I understood correctly - that they are
>>> compatible. Don't add fake entries to the driver.
>>>
>>
>>
>> I'm a bit confused, and I just need to add 'loongson,ls2k0500-spi' as
>> one enum in dt-bindings, but driver don't add this entry ?
> 
> Compatibility is expressed with a list:
> https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#compatible
> so it cannot be just one enum, but "items". There are hundreds of
> examples including example-schema.


Is it a description like the following?

  properties:
    compatible:
-    enum:
-      - loongson,ls2k1000-spi
+    oneOf:
+      - enum:
+          - loongson,ls2k1000-spi
+      - items:
+          - enum:
+              - loongson,ls2k1000-spi
+          - const: loongson,ls2k1000-spi
+      - items:
+          - enum:
+              - loongson,ls2k0500-spi
+          - const: loongson,ls2k1000-spi

    reg:


Thanks,
Yinbo
Krzysztof Kozlowski June 12, 2023, 6:03 p.m. UTC | #17
On 12/06/2023 13:29, zhuyinbo wrote:
> 
> 
> 在 2023/6/12 下午4:16, Krzysztof Kozlowski 写道:
>>>>>>>>> 在 2023/6/8 下午7:45, Krzysztof Kozlowski 写道:
>>>>>>>>>> On 08/06/2023 13:42, zhuyinbo wrote:
>>>>>>>>>>> --- a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>>>>>>>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>>>>>>>> @@ -16,6 +16,7 @@ properties:
>>>>>>>>>>>          compatible:
>>>>>>>>>>>            enum:
>>>>>>>>>>>              - loongson,ls2k1000-spi
>>>>>>>>>>> +      - loongson,ls2k0500-spi
>>>>>>>>>>
>>>>>>>>>> Aren't they compatible?
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Are you saying that the spi driver is compatible with 2k0500 ?
>>>>>>>>
>>>>>>>> Didn't you say this through 11 previous revisions?
>>>>>>>
>>>>>>>
>>>>>>> Yes, did I understand your meaning incorrectly ?
>>>>>>
>>>>>> If they are compatible, then they are not part of one enum. They could
>>>>>> not be as this would easily fail in testing of your DTS.
>>>>>>
>>>>>
>>>>>
>>>>> The "loongson,ls2k0500-spi" wasn't a compatible in previous version and
>>>>> I will add "loongson,ls2k0500-spi" as a compatible in spi driver and
>>>>> added it as a part of the one enum in dt-binding.
>>>>
>>>> No, because you claimed - if I understood correctly - that they are
>>>> compatible. Don't add fake entries to the driver.
>>>>
>>>
>>>
>>> I'm a bit confused, and I just need to add 'loongson,ls2k0500-spi' as
>>> one enum in dt-bindings, but driver don't add this entry ?
>>
>> Compatibility is expressed with a list:
>> https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#compatible
>> so it cannot be just one enum, but "items". There are hundreds of
>> examples including example-schema.
> 
> 
> Is it a description like the following?
> 
>   properties:
>     compatible:
> -    enum:
> -      - loongson,ls2k1000-spi
> +    oneOf:
> +      - enum:
> +          - loongson,ls2k1000-spi
> +      - items:
> +          - enum:
> +              - loongson,ls2k1000-spi
> +          - const: loongson,ls2k1000-spi

Remove this items part - it does not make sense. Device is not
compatible with itself. Rest looks ok.



Best regards,
Krzysztof
Yinbo Zhu June 13, 2023, 2:04 a.m. UTC | #18
在 2023/6/13 上午2:03, Krzysztof Kozlowski 写道:
> On 12/06/2023 13:29, zhuyinbo wrote:
>>
>>
>> 在 2023/6/12 下午4:16, Krzysztof Kozlowski 写道:
>>>>>>>>>> 在 2023/6/8 下午7:45, Krzysztof Kozlowski 写道:
>>>>>>>>>>> On 08/06/2023 13:42, zhuyinbo wrote:
>>>>>>>>>>>> --- a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>>>>>>>>> +++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
>>>>>>>>>>>> @@ -16,6 +16,7 @@ properties:
>>>>>>>>>>>>           compatible:
>>>>>>>>>>>>             enum:
>>>>>>>>>>>>               - loongson,ls2k1000-spi
>>>>>>>>>>>> +      - loongson,ls2k0500-spi
>>>>>>>>>>>
>>>>>>>>>>> Aren't they compatible?
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Are you saying that the spi driver is compatible with 2k0500 ?
>>>>>>>>>
>>>>>>>>> Didn't you say this through 11 previous revisions?
>>>>>>>>
>>>>>>>>
>>>>>>>> Yes, did I understand your meaning incorrectly ?
>>>>>>>
>>>>>>> If they are compatible, then they are not part of one enum. They could
>>>>>>> not be as this would easily fail in testing of your DTS.
>>>>>>>
>>>>>>
>>>>>>
>>>>>> The "loongson,ls2k0500-spi" wasn't a compatible in previous version and
>>>>>> I will add "loongson,ls2k0500-spi" as a compatible in spi driver and
>>>>>> added it as a part of the one enum in dt-binding.
>>>>>
>>>>> No, because you claimed - if I understood correctly - that they are
>>>>> compatible. Don't add fake entries to the driver.
>>>>>
>>>>
>>>>
>>>> I'm a bit confused, and I just need to add 'loongson,ls2k0500-spi' as
>>>> one enum in dt-bindings, but driver don't add this entry ?
>>>
>>> Compatibility is expressed with a list:
>>> https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#compatible
>>> so it cannot be just one enum, but "items". There are hundreds of
>>> examples including example-schema.
>>
>>
>> Is it a description like the following?
>>
>>    properties:
>>      compatible:
>> -    enum:
>> -      - loongson,ls2k1000-spi
>> +    oneOf:
>> +      - enum:
>> +          - loongson,ls2k1000-spi
>> +      - items:
>> +          - enum:
>> +              - loongson,ls2k1000-spi
>> +          - const: loongson,ls2k1000-spi
> 
> Remove this items part - it does not make sense. Device is not
> compatible with itself. Rest looks ok.


okay, I got it.

Thanks,
Yinbo
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
new file mode 100644
index 000000000000..423ee851edd5
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/loongson,ls2k-spi.yaml
@@ -0,0 +1,41 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/loongson,ls2k-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:
+    enum:
+      - loongson,ls2k1000-spi
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    spi0: spi@1fff0220{
+        compatible = "loongson,ls2k1000-spi";
+        reg = <0x1fff0220 0x10>;
+        clocks = <&clk 17>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index bc201627c2e0..5e604dddd87b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12186,6 +12186,12 @@  F:	Documentation/devicetree/bindings/clock/loongson,ls2k-clk.yaml
 F:	drivers/clk/clk-loongson2.c
 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,ls2k-spi.yaml
+
 LOONGSON-2 SOC SERIES GUTS DRIVER
 M:	Yinbo Zhu <zhuyinbo@loongson.cn>
 L:	loongarch@lists.linux.dev