Re: [PATCH v11 1/2] dt-bindings: spi: add loongson spi

From: zhuyinbo
Date: Thu Jun 01 2023 - 05:52:18 EST




在 2023/6/1 上午3:46, Krzysztof Kozlowski 写道:
On 25/05/2023 04:22, zhuyinbo wrote:


在 2023/5/24 下午6:29, Conor Dooley 写道:
On Wed, May 24, 2023 at 05:44:38PM +0800, zhuyinbo wrote:


在 2023/5/24 下午4:56, Conor Dooley 写道:
On Mon, May 22, 2023 at 03:10:29PM +0800, Yinbo Zhu wrote:
Add the Loongson platform spi binding with DT schema format using
json-schema.

Signed-off-by: Yinbo Zhu <zhuyinbo@xxxxxxxxxxx>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>
---
.../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..d0be6e5378d7
--- /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@xxxxxxxxxxx>
+
+allOf:
+ - $ref: /schemas/spi/spi-controller.yaml#
+
+properties:
+ compatible:
+ enum:
+ - loongson,ls2k-spi

I am sorry to jump in here at such a late stage with a (potentially)
trivial question. "ls2k" is the SoC family rather than a specific model
as far as I understand.
The answer is probably yes, but do all SoCs in the family have an
identical version of the IP?


No, but the spi supported by this loongson spi driver are all the same
identical version, and other type or verion spi will be supported as
needed in the future.

Does having a catch-all compatible make sense then when not all SoCs in
the ls2k family will actually be able to use this driver?


Yes, it is make sense as it can reduce the workload of the community.
For the Loongson platform, the versions of spi peripherals are almost
the same, except for a few or individual SoCs. And we have also
discussed compatible internally, and we tend to define it this way.

So you have chosen different path than what's clearly recommended by
community, existing experience and documentation:

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

Family names are not accepted as specific compatibles. Whenever they
were accepted, it lead to problems. All the time.


Thank you for your documentation and advice and the Loongson platform
have loongson-2h (ls2h), loongson-2k (ls2k), loongson-2p (ls2p) or other
series SoC, which loongson-2 seems to be the family name you mentioned
and the "loongson,ls2k-spi" should be a speific compatible name.


https://lore.kernel.org/all/20220822181701.GA89665-robh@xxxxxxxxxx/
https://lore.kernel.org/all/78651e07-6b3e-4243-8e1f-fcd1dfb3ffe1@xxxxxxxxxxxxxxxx/
https://lore.kernel.org/all/288f56ba9cfad46354203b7698babe91@xxxxxxxx/
https://lore.kernel.org/all/106e443a-e765-51fe-b556-e4e7e2aa771c@xxxxxxxxxx/
and many many more discussions.

You should choose carefully, because we will keep NAK-ing adding
properties to circumvent missing compatibles.


I have read the documention and patch link that you mentioned and it
seems to advice that We don't have wildcard names in the compatible
string and use wildcard names that will cause issue. and the compatible
"loongson,ls2k-spi" that wasn't a wildcard names, and if the loongson-2k
spi controller hardware upgraded or changed the I will use
"loongson,ls2k-spi-version" as a compatible, such as,
"loongson,ls2k-spi-v1.1", "loongson,ls2k-spi-v1.1a" or other.


Or am I misunderstanding and all ls2k SoCs do work with this driver and
you were talking about other, future products?

Actually, in 2k500 has one special type spi was only one cs and their's
register definition was different from common type spi thus this driver
doesn't support but this driver can support another common type spi in
2k500. for this special type spi I will add support as needed in the
future.

Bindings are for hardware, not driver. What does your driver support or
does not, matters less.


okay, I got it, and the loongson spi bindings was for loongson spi
controller hardware. if the spi controller hardware not changed in
different ls2k SoC and the spi compatible should be same thus loongson
spi compatible seems to be adhere to the bindings aggrement.

Thanks