Add support for the SPI controller implemented by the SpacemiT K1 SoC.
Signed-off-by: Alex Elder <elder@riscstar.com>
---
.../bindings/spi/spacemit,k1-spi.yaml | 94 +++++++++++++++++++
1 file changed, 94 insertions(+)
create mode 100644 Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml
diff --git a/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml b/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml
new file mode 100644
index 0000000000000..5abd4fe268da9
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml
@@ -0,0 +1,94 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/spacemit,k1-spi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SpacemiT K1 SoC Serial Peripheral Interface (SPI)
+
+maintainers:
+ - Alex Elder <elder@kernel.org>
+
+description:
+ The SpacemiT K1 SoC implements a SPI controller that has two 32-entry
+ FIFOs, for transmit and receive. Details are currently available in
+ section 18.2.1 of the K1 User Manual, found in the SpacemiT Keystone
+ K1 Documentation[1]. The controller transfers words using PIO. DMA
+ transfers are supported as well, if both TX and RX DMA channels are
+ specified,
+
+ [1] https://developer.spacemit.com/documentation
+
+allOf:
+ - $ref: /schemas/spi/spi-controller.yaml#
+
+properties:
+ compatible:
+ enum:
+ - spacemit,k1-spi
+
+ reg:
+ maxItems: 1
+
+ clocks:
+ items:
+ - description: Core clock
+ - description: Bus clock
+
+ clock-names:
+ items:
+ - const: core
+ - const: bus
+
+ resets:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ dmas:
+ items:
+ - description: RX DMA channel
+ - description: TX DMA channel
+
+ dma-names:
+ items:
+ - const: rx
+ - const: tx
+
+ spacemit,k1-ssp-id:
+ description: SPI controller number
+ $ref: /schemas/types.yaml#/definitions/uint32
+
+required:
+ - compatible
+ - reg
+ - clocks
+ - clock-names
+ - resets
+ - interrupts
+
+unevaluatedProperties: false
+
+examples:
+ - |
+
+ #include <dt-bindings/clock/spacemit,k1-syscon.h>
+ spi3: spi@d401c000 {
+ compatible = "spacemit,k1-spi";
+ reg = <0xd401c000 0x30>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ clocks = <&syscon_apbc CLK_SSP3>,
+ <&syscon_apbc CLK_SSP3_BUS>;
+ clock-names = "core",
+ "bus";
+ resets = <&syscon_apbc RESET_SSP3>;
+ interrupts-extended = <&plic 55>;
+ spacemit,k1-ssp-id = <3>;
+ dmas = <&pdma 20>,
+ <&pdma 19>;
+ dma-names = "rx",
+ "tx";
+ status = "disabled";
+ };
--
2.48.1
Hi Alex, On 17:07 Wed 17 Sep , Alex Elder wrote: > Add support for the SPI controller implemented by the SpacemiT K1 SoC. > > Signed-off-by: Alex Elder <elder@riscstar.com> > --- > .../bindings/spi/spacemit,k1-spi.yaml | 94 +++++++++++++++++++ > 1 file changed, 94 insertions(+) > create mode 100644 Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml > > diff --git a/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml b/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml > new file mode 100644 > index 0000000000000..5abd4fe268da9 > --- /dev/null > +++ b/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml > @@ -0,0 +1,94 @@ > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/spi/spacemit,k1-spi.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: SpacemiT K1 SoC Serial Peripheral Interface (SPI) > + > +maintainers: > + - Alex Elder <elder@kernel.org> > + > +description: > + The SpacemiT K1 SoC implements a SPI controller that has two 32-entry > + FIFOs, for transmit and receive. Details are currently available in > + section 18.2.1 of the K1 User Manual, found in the SpacemiT Keystone > + K1 Documentation[1]. The controller transfers words using PIO. DMA > + transfers are supported as well, if both TX and RX DMA channels are > + specified, > + > + [1] https://developer.spacemit.com/documentation > + > +allOf: > + - $ref: /schemas/spi/spi-controller.yaml# > + > +properties: > + compatible: > + enum: > + - spacemit,k1-spi one enum is effectively equal to const.. > + > + reg: > + maxItems: 1 > + > + clocks: > + items: > + - description: Core clock > + - description: Bus clock > + > + clock-names: > + items: > + - const: core > + - const: bus > + > + resets: > + maxItems: 1 > + > + interrupts: > + maxItems: 1 > + > + dmas: > + items: > + - description: RX DMA channel > + - description: TX DMA channel > + > + dma-names: > + items: > + - const: rx > + - const: tx > + > + spacemit,k1-ssp-id: > + description: SPI controller number > + $ref: /schemas/types.yaml#/definitions/uint32 could you explain a little bit why this vendor specific property should be introduced? I took a look at the code, and didn't get the reason behind.. or what's the problem of simply using "pdev->id"? we should really be careful to introduce vendor specific property.. > + > +required: > + - compatible > + - reg > + - clocks > + - clock-names > + - resets > + - interrupts > + > +unevaluatedProperties: false > + > +examples: > + - | > + > + #include <dt-bindings/clock/spacemit,k1-syscon.h> > + spi3: spi@d401c000 { label not needed for DT example > + compatible = "spacemit,k1-spi"; > + reg = <0xd401c000 0x30>; > + #address-cells = <1>; > + #size-cells = <0>; > + clocks = <&syscon_apbc CLK_SSP3>, > + <&syscon_apbc CLK_SSP3_BUS>; > + clock-names = "core", > + "bus"; > + resets = <&syscon_apbc RESET_SSP3>; > + interrupts-extended = <&plic 55>; > + spacemit,k1-ssp-id = <3>; > + dmas = <&pdma 20>, > + <&pdma 19>; > + dma-names = "rx", > + "tx"; .. > + status = "disabled"; ditto, drop it > + }; > -- > 2.48.1 > -- Yixun Lan (dlan)
On 9/17/25 6:15 PM, Yixun Lan wrote: > Hi Alex, > > On 17:07 Wed 17 Sep , Alex Elder wrote: >> Add support for the SPI controller implemented by the SpacemiT K1 SoC. >> >> Signed-off-by: Alex Elder <elder@riscstar.com> >> --- >> .../bindings/spi/spacemit,k1-spi.yaml | 94 +++++++++++++++++++ >> 1 file changed, 94 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml >> >> diff --git a/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml b/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml >> new file mode 100644 >> index 0000000000000..5abd4fe268da9 >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml >> @@ -0,0 +1,94 @@ >> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) >> +%YAML 1.2 >> +--- >> +$id: http://devicetree.org/schemas/spi/spacemit,k1-spi.yaml# >> +$schema: http://devicetree.org/meta-schemas/core.yaml# >> + >> +title: SpacemiT K1 SoC Serial Peripheral Interface (SPI) >> + >> +maintainers: >> + - Alex Elder <elder@kernel.org> >> + >> +description: >> + The SpacemiT K1 SoC implements a SPI controller that has two 32-entry >> + FIFOs, for transmit and receive. Details are currently available in >> + section 18.2.1 of the K1 User Manual, found in the SpacemiT Keystone >> + K1 Documentation[1]. The controller transfers words using PIO. DMA >> + transfers are supported as well, if both TX and RX DMA channels are >> + specified, >> + >> + [1] https://developer.spacemit.com/documentation >> + >> +allOf: >> + - $ref: /schemas/spi/spi-controller.yaml# >> + >> +properties: >> + compatible: >> + enum: >> + - spacemit,k1-spi > one enum is effectively equal to const.. OK. That's an easy fix. >> + >> + reg: >> + maxItems: 1 >> + >> + clocks: >> + items: >> + - description: Core clock >> + - description: Bus clock >> + >> + clock-names: >> + items: >> + - const: core >> + - const: bus >> + >> + resets: >> + maxItems: 1 >> + >> + interrupts: >> + maxItems: 1 >> + >> + dmas: >> + items: >> + - description: RX DMA channel >> + - description: TX DMA channel >> + >> + dma-names: >> + items: >> + - const: rx >> + - const: tx >> + >> + spacemit,k1-ssp-id: >> + description: SPI controller number >> + $ref: /schemas/types.yaml#/definitions/uint32 > could you explain a little bit why this vendor specific property should > be introduced? I took a look at the code, and didn't get the reason > behind.. or what's the problem of simply using "pdev->id"? This property was carried over from the vendor code. It is optional, and if it isn't specified, the platform device ID (-1) will be used. It's just intended to provide a well-defined ID for a particular SPI controller. > we should really be careful to introduce vendor specific property.. If there were a standard way of doing this I'd love to use it. And if it isn't necessary, please just explain to me why. I have no problem removing it. >> +required: >> + - compatible >> + - reg >> + - clocks >> + - clock-names >> + - resets >> + - interrupts >> + >> +unevaluatedProperties: false >> + >> +examples: >> + - | >> + >> + #include <dt-bindings/clock/spacemit,k1-syscon.h> >> + spi3: spi@d401c000 { > label not needed for DT example OK. >> + compatible = "spacemit,k1-spi"; >> + reg = <0xd401c000 0x30>; >> + #address-cells = <1>; >> + #size-cells = <0>; >> + clocks = <&syscon_apbc CLK_SSP3>, >> + <&syscon_apbc CLK_SSP3_BUS>; >> + clock-names = "core", >> + "bus"; >> + resets = <&syscon_apbc RESET_SSP3>; >> + interrupts-extended = <&plic 55>; >> + spacemit,k1-ssp-id = <3>; >> + dmas = <&pdma 20>, >> + <&pdma 19>; >> + dma-names = "rx", >> + "tx"; > .. >> + status = "disabled"; > ditto, drop it OK. Thanks a lot for your quick review. I'll wait a bit (probably until Monday) before I send an update. -Alex >> + }; >> -- >> 2.48.1 >> >
On Wed, Sep 17, 2025 at 06:40:31PM -0500, Alex Elder wrote: > On 9/17/25 6:15 PM, Yixun Lan wrote: > > Hi Alex, > > > > On 17:07 Wed 17 Sep , Alex Elder wrote: > > > Add support for the SPI controller implemented by the SpacemiT K1 SoC. > > > > > > Signed-off-by: Alex Elder <elder@riscstar.com> > > > --- > > > .../bindings/spi/spacemit,k1-spi.yaml | 94 +++++++++++++++++++ > > > 1 file changed, 94 insertions(+) > > > create mode 100644 Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml > > > > > > diff --git a/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml b/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml > > > new file mode 100644 > > > index 0000000000000..5abd4fe268da9 > > > --- /dev/null > > > +++ b/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml > > > @@ -0,0 +1,94 @@ > > > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) > > > +%YAML 1.2 > > > +--- > > > +$id: http://devicetree.org/schemas/spi/spacemit,k1-spi.yaml# > > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > > + > > > +title: SpacemiT K1 SoC Serial Peripheral Interface (SPI) > > > + > > > +maintainers: > > > + - Alex Elder <elder@kernel.org> > > > + > > > +description: > > > + The SpacemiT K1 SoC implements a SPI controller that has two 32-entry > > > + FIFOs, for transmit and receive. Details are currently available in > > > + section 18.2.1 of the K1 User Manual, found in the SpacemiT Keystone > > > + K1 Documentation[1]. The controller transfers words using PIO. DMA > > > + transfers are supported as well, if both TX and RX DMA channels are > > > + specified, > > > + > > > + [1] https://developer.spacemit.com/documentation > > > + > > > +allOf: > > > + - $ref: /schemas/spi/spi-controller.yaml# > > > + > > > +properties: > > > + compatible: > > > + enum: > > > + - spacemit,k1-spi > > one enum is effectively equal to const.. > > OK. That's an easy fix. > > > > + > > > + reg: > > > + maxItems: 1 > > > + > > > + clocks: > > > + items: > > > + - description: Core clock > > > + - description: Bus clock > > > + > > > + clock-names: > > > + items: > > > + - const: core > > > + - const: bus > > > + > > > + resets: > > > + maxItems: 1 > > > + > > > + interrupts: > > > + maxItems: 1 > > > + > > > + dmas: > > > + items: > > > + - description: RX DMA channel > > > + - description: TX DMA channel > > > + > > > + dma-names: > > > + items: > > > + - const: rx > > > + - const: tx > > > + > > > + spacemit,k1-ssp-id: > > > + description: SPI controller number > > > + $ref: /schemas/types.yaml#/definitions/uint32 > > could you explain a little bit why this vendor specific property should > > be introduced? I took a look at the code, and didn't get the reason > > behind.. or what's the problem of simply using "pdev->id"? > > This property was carried over from the vendor code. It is > optional, and if it isn't specified, the platform device ID (-1) > will be used. It's just intended to provide a well-defined ID > for a particular SPI controller. > > > we should really be careful to introduce vendor specific property.. > > If there were a standard way of doing this I'd love to use it. The standard way is we don't define made up device indices in DT. Well, except /aliases allows you to do that. Rob
On 9/18/25 2:57 PM, Rob Herring wrote: > On Wed, Sep 17, 2025 at 06:40:31PM -0500, Alex Elder wrote: >> On 9/17/25 6:15 PM, Yixun Lan wrote: >>> Hi Alex, >>> >>> On 17:07 Wed 17 Sep , Alex Elder wrote: >>>> Add support for the SPI controller implemented by the SpacemiT K1 SoC. >>>> >>>> Signed-off-by: Alex Elder <elder@riscstar.com> >>>> --- >>>> .../bindings/spi/spacemit,k1-spi.yaml | 94 +++++++++++++++++++ >>>> 1 file changed, 94 insertions(+) >>>> create mode 100644 Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml >>>> >>>> diff --git a/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml b/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml >>>> new file mode 100644 >>>> index 0000000000000..5abd4fe268da9 >>>> --- /dev/null >>>> +++ b/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml >>>> @@ -0,0 +1,94 @@ >>>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) >>>> +%YAML 1.2 >>>> +--- >>>> +$id: http://devicetree.org/schemas/spi/spacemit,k1-spi.yaml# >>>> +$schema: http://devicetree.org/meta-schemas/core.yaml# >>>> + >>>> +title: SpacemiT K1 SoC Serial Peripheral Interface (SPI) >>>> + >>>> +maintainers: >>>> + - Alex Elder <elder@kernel.org> >>>> + >>>> +description: >>>> + The SpacemiT K1 SoC implements a SPI controller that has two 32-entry >>>> + FIFOs, for transmit and receive. Details are currently available in >>>> + section 18.2.1 of the K1 User Manual, found in the SpacemiT Keystone >>>> + K1 Documentation[1]. The controller transfers words using PIO. DMA >>>> + transfers are supported as well, if both TX and RX DMA channels are >>>> + specified, >>>> + >>>> + [1] https://developer.spacemit.com/documentation >>>> + >>>> +allOf: >>>> + - $ref: /schemas/spi/spi-controller.yaml# >>>> + >>>> +properties: >>>> + compatible: >>>> + enum: >>>> + - spacemit,k1-spi >>> one enum is effectively equal to const.. >> >> OK. That's an easy fix. >> >>>> + >>>> + reg: >>>> + maxItems: 1 >>>> + >>>> + clocks: >>>> + items: >>>> + - description: Core clock >>>> + - description: Bus clock >>>> + >>>> + clock-names: >>>> + items: >>>> + - const: core >>>> + - const: bus >>>> + >>>> + resets: >>>> + maxItems: 1 >>>> + >>>> + interrupts: >>>> + maxItems: 1 >>>> + >>>> + dmas: >>>> + items: >>>> + - description: RX DMA channel >>>> + - description: TX DMA channel >>>> + >>>> + dma-names: >>>> + items: >>>> + - const: rx >>>> + - const: tx >>>> + >>>> + spacemit,k1-ssp-id: >>>> + description: SPI controller number >>>> + $ref: /schemas/types.yaml#/definitions/uint32 >>> could you explain a little bit why this vendor specific property should >>> be introduced? I took a look at the code, and didn't get the reason >>> behind.. or what's the problem of simply using "pdev->id"? >> >> This property was carried over from the vendor code. It is >> optional, and if it isn't specified, the platform device ID (-1) >> will be used. It's just intended to provide a well-defined ID >> for a particular SPI controller. >> >>> we should really be careful to introduce vendor specific property.. >> >> If there were a standard way of doing this I'd love to use it. > > The standard way is we don't define made up device indices in DT. Well, > except /aliases allows you to do that. Yes, Yixun already pointed out using the aliases node to accomplish this. I'm still not clear why or when something like this is needed though. I presume it's so we can say "SPI 3 is always the one that's exposed on the GPIO block" or something. -Alex > > Rob
Hi Alex, On 18:40 Wed 17 Sep , Alex Elder wrote: > On 9/17/25 6:15 PM, Yixun Lan wrote: > > Hi Alex, > > > > On 17:07 Wed 17 Sep , Alex Elder wrote: > >> Add support for the SPI controller implemented by the SpacemiT K1 SoC. > >> > >> Signed-off-by: Alex Elder <elder@riscstar.com> > >> --- > >> .../bindings/spi/spacemit,k1-spi.yaml | 94 +++++++++++++++++++ > >> 1 file changed, 94 insertions(+) > >> create mode 100644 Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml > >> > >> diff --git a/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml b/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml > >> new file mode 100644 > >> index 0000000000000..5abd4fe268da9 > >> --- /dev/null > >> +++ b/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml .. > >> + > >> + spacemit,k1-ssp-id: > >> + description: SPI controller number > >> + $ref: /schemas/types.yaml#/definitions/uint32 > > could you explain a little bit why this vendor specific property should > > be introduced? I took a look at the code, and didn't get the reason > > behind.. or what's the problem of simply using "pdev->id"? > > This property was carried over from the vendor code. It is inherit from vendor code isn't a valid reason > optional, and if it isn't specified, the platform device ID (-1) > will be used. It's just intended to provide a well-defined ID > for a particular SPI controller. > while looking at the code, it seems you can use alias to map specific id to the spi controller, it even can do non-linear map, something like spi0 = &spi3; plese check of_alias_get_id() note, I haven't actually verified on board, just look through the code > > we should really be careful to introduce vendor specific property.. > > If there were a standard way of doing this I'd love to use it. > > And if it isn't necessary, please just explain to me why. I > have no problem removing it. > on the opposite, please have explicit good reason to introduce vendor speifici property, and if there is generic way, then we shouldn't do it -- Yixun Lan (dlan)
On 9/17/25 7:16 PM, Yixun Lan wrote: > Hi Alex, > > On 18:40 Wed 17 Sep , Alex Elder wrote: >> On 9/17/25 6:15 PM, Yixun Lan wrote: >>> Hi Alex, >>> >>> On 17:07 Wed 17 Sep , Alex Elder wrote: >>>> Add support for the SPI controller implemented by the SpacemiT K1 SoC. >>>> >>>> Signed-off-by: Alex Elder <elder@riscstar.com> >>>> --- >>>> .../bindings/spi/spacemit,k1-spi.yaml | 94 +++++++++++++++++++ >>>> 1 file changed, 94 insertions(+) >>>> create mode 100644 Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml >>>> >>>> diff --git a/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml b/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml >>>> new file mode 100644 >>>> index 0000000000000..5abd4fe268da9 >>>> --- /dev/null >>>> +++ b/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml > .. >>>> + >>>> + spacemit,k1-ssp-id: >>>> + description: SPI controller number >>>> + $ref: /schemas/types.yaml#/definitions/uint32 >>> could you explain a little bit why this vendor specific property should >>> be introduced? I took a look at the code, and didn't get the reason >>> behind.. or what's the problem of simply using "pdev->id"? >> >> This property was carried over from the vendor code. It is > inherit from vendor code isn't a valid reason > >> optional, and if it isn't specified, the platform device ID (-1) >> will be used. It's just intended to provide a well-defined ID >> for a particular SPI controller. >> > while looking at the code, it seems you can use alias to map specific id > to the spi controller, it even can do non-linear map, something like > spi0 = &spi3; I've never used this before, but yes, it looks like it's exactly what I want. I'll just get rid of the "spacemit,k1-ssp-id" DT property entirely. Easy. > plese check of_alias_get_id() > > note, I haven't actually verified on board, just look through the code > >>> we should really be careful to introduce vendor specific property.. >> >> If there were a standard way of doing this I'd love to use it. Looks like you have told me the standard way of doing this. Thank you. -Alex >> >> And if it isn't necessary, please just explain to me why. I >> have no problem removing it. >> > on the opposite, please have explicit good reason to introduce vendor > speifici property, and if there is generic way, then we shouldn't do it >
On Wed, Sep 17, 2025 at 09:59:35PM -0500, Alex Elder wrote: > On 9/17/25 7:16 PM, Yixun Lan wrote: > > Hi Alex, > > > > On 18:40 Wed 17 Sep , Alex Elder wrote: > > > On 9/17/25 6:15 PM, Yixun Lan wrote: > > > > Hi Alex, > > > > > > > > On 17:07 Wed 17 Sep , Alex Elder wrote: > > > > > Add support for the SPI controller implemented by the SpacemiT K1 SoC. > > > > > > > > > > Signed-off-by: Alex Elder <elder@riscstar.com> > > > > > --- > > > > > .../bindings/spi/spacemit,k1-spi.yaml | 94 +++++++++++++++++++ > > > > > 1 file changed, 94 insertions(+) > > > > > create mode 100644 Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml > > > > > > > > > > diff --git a/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml b/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml > > > > > new file mode 100644 > > > > > index 0000000000000..5abd4fe268da9 > > > > > --- /dev/null > > > > > +++ b/Documentation/devicetree/bindings/spi/spacemit,k1-spi.yaml > > .. > > > > > + > > > > > + spacemit,k1-ssp-id: > > > > > + description: SPI controller number > > > > > + $ref: /schemas/types.yaml#/definitions/uint32 > > > > could you explain a little bit why this vendor specific property should > > > > be introduced? I took a look at the code, and didn't get the reason > > > > behind.. or what's the problem of simply using "pdev->id"? > > > > > > This property was carried over from the vendor code. It is > > inherit from vendor code isn't a valid reason > > > > > optional, and if it isn't specified, the platform device ID (-1) > > > will be used. It's just intended to provide a well-defined ID > > > for a particular SPI controller. > > > > > while looking at the code, it seems you can use alias to map specific id > > to the spi controller, it even can do non-linear map, something like > > spi0 = &spi3; > I've never used this before, but yes, it looks like it's exactly > what I want. I'll just get rid of the "spacemit,k1-ssp-id" DT > property entirely. Easy. > > > plese check of_alias_get_id() > > > > note, I haven't actually verified on board, just look through the code This is the right API that Alex what to use. I have verified it in i2c driver. - Troy > > > > > > we should really be careful to introduce vendor specific property.. > > > > > > If there were a standard way of doing this I'd love to use it. > > Looks like you have told me the standard way of doing this. > > Thank you. > > -Alex > > > > > > > And if it isn't necessary, please just explain to me why. I > > > have no problem removing it. > > > > > on the opposite, please have explicit good reason to introduce vendor > > speifici property, and if there is generic way, then we shouldn't do it > > > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv
On 9/18/25 2:43 AM, Troy Mitchell wrote: >>> while looking at the code, it seems you can use alias to map specific id >>> to the spi controller, it even can do non-linear map, something like >>> spi0 = &spi3; >> I've never used this before, but yes, it looks like it's exactly >> what I want. I'll just get rid of the "spacemit,k1-ssp-id" DT >> property entirely. Easy. >> >>> plese check of_alias_get_id() >>> >>> note, I haven't actually verified on board, just look through the code > This is the right API that Alex what to use. > I have verified it in i2c driver. Yes, thank you for confirming. I've already made the change and verified it works as desired. -Alex
© 2016 - 2025 Red Hat, Inc.