p54spi: convert to devicetree
Subsystems (9)
PATCH 1/1 p54spi: convert to devicetree
From: Arnd Bergmann <[email protected]>
The Prism54 SPI driver hardcodes GPIO numbers and expects users to pass them as module parameters, apparently a relic from its life as a staging driver. This works because there is only one user, the Nokia N8x0 tablet.
Convert this to the gpio descriptor interface and move the gpio line information into devicetree to improve this and simplify the code at the same time.
---
As I don't have an N8x0, this is completely untested.
I listed the driver authors (Johannes and Christian) as the maintainers of the binding document, but I don't know if they actually have this hardware. It might be better to list someone who is actually using it.
Among the various chip identifications, I wasn't sure which one to use for the compatible string and the name of the binding document. I picked st,stlc4560 as that was cited as the version in the N800 on multiple websites.
--- .../bindings/net/wireless/st,stlc45xx.yaml | 64 +++++++++++++++++ MAINTAINERS | 1 + arch/arm/boot/dts/omap2.dtsi | 4 ++ arch/arm/boot/dts/omap2420-n8x0-common.dtsi | 12 ++++ arch/arm/mach-omap2/board-n8x0.c | 18 ----- drivers/net/wireless/intersil/p54/p54spi.c | 69 +++++++------------ drivers/net/wireless/intersil/p54/p54spi.h | 3 + 7 files changed, 109 insertions(+), 62 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +64 -0
@@ -0,0 +1,64 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/wireless/st,stlc45xx.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ST/Intersil/Conexant stlc45xx/p54spi/cx3110x SPI wireless device + +maintainers: + - Johannes Berg <[email protected]> + - Christian Lamparter <[email protected]> + +description: | + The SPI variant of the Intersil Prism54 wireless device was sold + under a variety of names, including ST Microelectronics STLC5460 + and Conexant CX3110x. + +allOf: + - $ref: ieee80211.yaml# + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +properties: + compatible: + enum: + - st,stlc4550 + - st,stlc4560 + - isil,p54spi + - cnxt,3110x + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + power-gpios: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + +unevaluatedProperties: false + +examples: + - | + gpio { + gpio-controller; + #gpio-cells = <1>; + #interupt-cells = <1>; + }; + spi { + #address-cells = <1>; + #size-cells = <0>; + + wifi@0 { + reg = <0>; + compatible = "st,stlc4560"; + spi-max-frequency = <48000000>; + interrupts-extended = <&gpio 23>; + power-gpios = <&gpio 1>; + }; + };
MAINTAINERS +1 -0
@@ -15754,6 +15754,7 @@ M: Christian Lamparter <[email protected]> L: [email protected] S: Maintained W: https://wireless.wiki.kernel.org/en/users/Drivers/p54 +F: Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml F: drivers/net/wireless/intersil/p54/ PACKET SOCKETS
arch/arm/boot/dts/omap2.dtsi +4 -0
@@ -129,6 +129,8 @@ i2c2: i2c@48072000 { }; mcspi1: spi@48098000 { + #address-cells = <1>; + #size-cells = <0>; compatible = "ti,omap2-mcspi"; ti,hwmods = "mcspi1"; reg = <0x48098000 0x100>;
@@ -140,6 +142,8 @@ mcspi1: spi@48098000 { }; mcspi2: spi@4809a000 { + #address-cells = <1>; + #size-cells = <0>; compatible = "ti,omap2-mcspi"; ti,hwmods = "mcspi2"; reg = <0x4809a000 0x100>;
arch/arm/boot/dts/omap2420-n8x0-common.dtsi +12 -0
@@ -109,3 +109,15 @@ partition@5 { }; }; }; + +&mcspi2 { + status = "okay"; + + wifi@0 { + reg = <0>; + compatible = "st,stlc4560"; + spi-max-frequency = <48000000>; + interrupts-extended = <&gpio3 23 IRQ_TYPE_EDGE_RISING>; + gpios = <&gpio4 1 GPIO_ACTIVE_HIGH>; /* gpio 97 */ + }; +};
arch/arm/mach-omap2/board-n8x0.c +0 -18
@@ -19,7 +19,6 @@#include <linux/spi/spi.h> #include <linux/usb/musb.h> #include <linux/mmc/host.h> -#include <linux/platform_data/spi-omap2-mcspi.h> #include <linux/platform_data/mmc-omap.h> #include <linux/mfd/menelaus.h>
@@ -142,21 +141,6 @@ static void __init n8x0_usb_init(void) {}#endif /*CONFIG_USB_MUSB_TUSB6010 */ - -static struct omap2_mcspi_device_config p54spi_mcspi_config = { - .turbo_mode =0 , -}; - -static struct spi_board_info n800_spi_board_info[]__initdata = { - { - .modalias ="p54spi" , - .bus_num =2 , - .chip_select =0 , - .max_speed_hz =48000000 , - .controller_data = &p54spi_mcspi_config, - }, -}; -#if defined(CONFIG_MENELAUS ) &&IS_ENABLED (CONFIG_MMC_OMAP )/*
@@ -585,7 +569,5 @@ omap_late_initcall(n8x0_late_initcall);void *__init n8x0_legacy_init (void ) {board_check_revision (); -spi_register_board_info (n800_spi_board_info, -ARRAY_SIZE (n800_spi_board_info));return &mmc1_data; }
drivers/net/wireless/intersil/p54/p54spi.c +25 -44
134 lines not on this page · raw message
drivers/net/wireless/intersil/p54/p54spi.h +3 -0
@@ -107,6 +107,9 @@ struct p54s_priv {enum fw_state fw_state;const struct firmware *firmware; + +struct gpio_desc *gpio_power; + int irq; };#endif /* P54SPI_H */
Signature · 1 line
2.39.2
Johannes Berg
maintainerQuoted 6 lines · Arnd Bergmann
As I don't have an N8x0, this is completely untested.
I listed the driver authors (Johannes and Christian) as the maintainers of the binding document, but I don't know if they actually have this hardware. It might be better to list someone who is actually using it.
Wow, umm, yeah I still have an N810 but ... If anyone wants the device, shout, I'll give it away. I think I checked fairly recently (within a year maybe) it still booted :-)
So yeah, it's probably not a great idea to list me there, I don't even know these details, and probably never did, I'm pretty sure I never installed a custom kernel on it.
johannes
Quoted 19 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The Prism54 SPI driver hardcodes GPIO numbers and expects users to pass them as module parameters, apparently a relic from its life as a staging driver. This works because there is only one user, the Nokia N8x0 tablet.
Convert this to the gpio descriptor interface and move the gpio line information into devicetree to improve this and simplify the code at the same time.
Signed-off-by Arnd Bergmann <[email protected]>---
As I don't have an N8x0, this is completely untested.I listed the driver authors (Johannes and Christian) as the maintainers of the binding document, but I don't know if they actually have this hardware. It might be better to list someone who is actually using it.
Quoted 6 lines
Among the various chip identifications, I wasn't sure which one to use for the compatible string and the name of the binding document. I picked st,stlc4560 as that was cited as the version in the N800 on multiple websites.
--- .../bindings/net/wireless/st,stlc45xx.yaml | 64 +++++++++++++++++
Please split bindings to separate patch.
Quoted 3 lines
MAINTAINERS | 1 + arch/arm/boot/dts/omap2.dtsi | 4 ++ arch/arm/boot/dts/omap2420-n8x0-common.dtsi | 12 ++++
DTS as well...
Quoted 15 lines
arch/arm/mach-omap2/board-n8x0.c | 18 ----- drivers/net/wireless/intersil/p54/p54spi.c | 69 +++++++------------ drivers/net/wireless/intersil/p54/p54spi.h | 3 + 7 files changed, 109 insertions(+), 62 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yamlDocumentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +3
-0@@ -0,0 +1,64 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +---
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml line 13
Quoted 10 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +10
-0+$id: http://devicetree.org/schemas/net/wireless/st,stlc45xx.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ST/Intersil/Conexant stlc45xx/p54spi/cx3110x SPI wireless device + +maintainers: + - Johannes Berg <[email protected]> + - Christian Lamparter <[email protected]> + +description: |
You can drop '|'.
Quoted 5 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +5
-0+ The SPI variant of the Intersil Prism54 wireless device was sold + under a variety of names, including ST Microelectronics STLC5460 + and Conexant CX3110x. + +allOf:
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml line 28
Quoted 10 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +10
-0+ - $ref: ieee80211.yaml# + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +properties: + compatible: + enum: + - st,stlc4550 + - st,stlc4560 + - isil,p54spi + - cnxt,3110x
Order above entries by name.
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml line 36
Quoted 8 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +8
-0+ + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + power-gpios:
If this is GPIO driving some power pin, then it should be "powerdown-gpios" (like in /bindings/gpio/gpio-consumer-common.yaml)
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml line 48
Quoted 12 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +12
-0+ maxItems: 1 + +required: + - compatible + - reg + - interrupts + +unevaluatedProperties: false + +examples: + - | + gpio {
Align example with above |, so four spaces. Or better indent entire example with four spaces.
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml line 52
Quoted 4 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +4
-0+ gpio-controller; + #gpio-cells = <1>; + #interupt-cells = <1>; + };
Drop "gpio" node. It's not needed for the example.
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml line 59
Quoted 7 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +7
-0+ spi { + #address-cells = <1>; + #size-cells = <0>; + + wifi@0 { + reg = <0>; + compatible = "st,stlc4560";
compatible before reg.
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml line 64
Quoted 5 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +5
-0+ spi-max-frequency = <48000000>; + interrupts-extended = <&gpio 23>; + power-gpios = <&gpio 1>; + }; + };
Best regards,
Krzysztof
Quoted 9 lines · Krzysztof Kozlowski
On 14/03/2023 17:30, Arnd Bergmann wrote:
Please split bindings to separate patch.
Quoted 3 lines
MAINTAINERS | 1 + arch/arm/boot/dts/omap2.dtsi | 4 ++ arch/arm/boot/dts/omap2420-n8x0-common.dtsi | 12 ++++DTS as well...
ok
Quoted 7 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml line 13
Quoted 5 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +5
-0+maintainers: + - Johannes Berg <[email protected]> + - Christian Lamparter <[email protected]> + +description: |You can drop '|'.
ok
Quoted 9 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml line 28
Quoted 7 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +7
-0+properties: + compatible: + enum: + - st,stlc4550 + - st,stlc4560 + - isil,p54spi + - cnxt,3110xOrder above entries by name.
ok
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ + power-gpios:If this is GPIO driving some power pin, then it should be "powerdown-gpios" (like in /bindings/gpio/gpio-consumer-common.yaml)
As far as I can tell, it's the opposite: the gpio turns the power on in 'high' state. I could make it GPIO_ACTIVE_LOW and call it powerdown, if you think that's better, but I don't think that is how it was meant.
Quoted 6 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml line 48
Quoted 3 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +3
-0+examples: + - | + gpio {Align example with above |, so four spaces. Or better indent entire example with four spaces.
Ok, that makes it much more readable.
Quoted 6 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml line 52
Quoted 4 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +4
-0+ gpio-controller; + #gpio-cells = <1>; + #interupt-cells = <1>; + };Drop "gpio" node. It's not needed for the example.
ok.
Quoted 9 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml line 59
Quoted 7 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +7
-0+ spi { + #address-cells = <1>; + #size-cells = <0>; + + wifi@0 { + reg = <0>; + compatible = "st,stlc4560";compatible before reg.
ok.
Arnd
Quoted 10 lines · Arnd Bergmann
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ + power-gpios:If this is GPIO driving some power pin, then it should be "powerdown-gpios" (like in /bindings/gpio/gpio-consumer-common.yaml)
As far as I can tell, it's the opposite: the gpio turns the power on in 'high' state. I could make it
GPIO_ACTIVE_LOWand call it powerdown, if you think that's better, but I don't think that is how it was meant.
Whether this is active low or high, I think does not matter. If this is pin responsible to control the power, then we use the name "powerdown-gpios". Effectively powerup GPIO is the same as powerdown, just reversed.
Best regards,
Krzysztof
Quoted 13 lines · Krzysztof Kozlowski
Quoted 10 lines · Arnd Bergmann
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ + power-gpios:If this is GPIO driving some power pin, then it should be "powerdown-gpios" (like in /bindings/gpio/gpio-consumer-common.yaml)
As far as I can tell, it's the opposite: the gpio turns the power on in 'high' state. I could make it
GPIO_ACTIVE_LOWand call it powerdown, if you think that's better, but I don't think that is how it was meant.
Quoted 4 lines
Whether this is active low or high, I think does not matter. If this is pin responsible to control the power, then we use the name "powerdown-gpios". Effectively powerup GPIO is the same as powerdown, just reversed.
Ok, so should I make this GPIO_ACTIVE_LOW and adapt the patch to call it powerdown in both the code and dt for consistency?
Arnd
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 14 lines · Arnd Bergmann
Quoted 13 lines · Krzysztof Kozlowski
Quoted 10 lines · Arnd Bergmann
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ + power-gpios:If this is GPIO driving some power pin, then it should be "powerdown-gpios" (like in /bindings/gpio/gpio-consumer-common.yaml)
As far as I can tell, it's the opposite: the gpio turns the power on in 'high' state. I could make it
GPIO_ACTIVE_LOWand call it powerdown, if you think that's better, but I don't think that is how it was meant.
Quoted 7 lines
Quoted 4 lines
Whether this is active low or high, I think does not matter. If this is pin responsible to control the power, then we use the name "powerdown-gpios". Effectively powerup GPIO is the same as powerdown, just reversed.
Ok, so should I make this
GPIO_ACTIVE_LOWand adapt the patch to call it powerdown in both the code and dt for consistency?
If you have schematics (or datasheet) then this should reflect truth. If not, then judging by the old code it is something like powerdown, so yes
- ACTIVE_LOW and reverse values in the code.
Best regards,
Krzysztof
Hi,
Quoted 8 lines · Arnd Bergmann
The Prism54 SPI driver hardcodes GPIO numbers and expects users to pass them as module parameters, apparently a relic from its life as a staging driver. This works because there is only one user, the Nokia N8x0 tablet.
Convert this to the gpio descriptor interface and move the gpio line information into devicetree to improve this and simplify the code at the same time.
Yes, this is definitely the right idea/way. From what I remember, Kalle Valo was partially involved in p54spi/stlc45xx. The details are very fuzzy. So, I could be totally wrong. From what I remember Kalle was working for Nokia (or as a contractor for Nokia?) at the time.
Quoted 1 line
Signed-off-by Arnd Bergmann <[email protected]>
I've seen the device-tree comments. That said, this is/was overdue. You can definitely have this for a v2 :).
Thanks you!
Christian
Quoted 29 lines
---
As I don't have an N8x0, this is completely untested.I listed the driver authors (Johannes and Christian) as the maintainers of the binding document, but I don't know if they actually have this hardware. It might be better to list someone who is actually using it.
Among the various chip identifications, I wasn't sure which one to use for the compatible string and the name of the binding document. I picked st,stlc4560 as that was cited as the version in the N800 on multiple websites.
--- .../bindings/net/wireless/st,stlc45xx.yaml | 64 +++++++++++++++++ MAINTAINERS | 1 + arch/arm/boot/dts/omap2.dtsi | 4 ++ arch/arm/boot/dts/omap2420-n8x0-common.dtsi | 12 ++++ arch/arm/mach-omap2/board-n8x0.c | 18 ----- drivers/net/wireless/intersil/p54/p54spi.c | 69 +++++++------------ drivers/net/wireless/intersil/p54/p54spi.h | 3 + 7 files changed, 109 insertions(+), 62 deletions(-)create mode 100644
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yamlDocumentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +1
-0@@ -0,0 +1,64 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml line 11
Quoted 10 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +10
-0+%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/wireless/st,stlc45xx.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ST/Intersil/Conexant stlc45xx/p54spi/cx3110x SPI wireless device + +maintainers: + - Johannes Berg <[email protected]> + - Christian Lamparter <[email protected]>
Can you please change that to: Christian Lamparter <[email protected]> ? (the @web.de/googlemail.com address still work too, but they are now just forwarding)
Quoted 52 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +52
-0+description: | + The SPI variant of the Intersil Prism54 wireless device was sold + under a variety of names, including ST Microelectronics STLC5460 + and Conexant CX3110x. + +allOf: + - $ref: ieee80211.yaml# + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +properties: + compatible: + enum: + - st,stlc4550 + - st,stlc4560 + - isil,p54spi + - cnxt,3110x + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + power-gpios: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + +unevaluatedProperties: false + +examples: + - | + gpio { + gpio-controller; + #gpio-cells = <1>; + #interupt-cells = <1>; + }; + spi { + #address-cells = <1>; + #size-cells = <0>; + + wifi@0 { + reg = <0>; + compatible = "st,stlc4560"; + spi-max-frequency = <48000000>; + interrupts-extended = <&gpio 23>; + power-gpios = <&gpio 1>; + }; + };
Quoted 8 lines · Christian Lamparter
Hi,
Quoted 5 lines · Arnd Bergmann
The Prism54 SPI driver hardcodes GPIO numbers and expects users to pass them as module parameters, apparently a relic from its life as a staging driver. This works because there is only one user, the Nokia N8x0 tablet.
Quoted 8 lines
Quoted 3 lines
Convert this to the gpio descriptor interface and move the gpio line information into devicetree to improve this and simplify the code at the same time.
Yes, this is definitely the right idea/way. From what I remember, Kalle Valo was partially involved in p54spi/stlc45xx. The details are very fuzzy. So, I could be totally wrong. From what I remember Kalle was working for Nokia (or as a contractor for Nokia?) at the time.
I wrote stlc45xx driver as part of my thesis when working for Nokia and I think then someone wrote p54spi after that. Oh man, this was a long time ago so hard to remember :)
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Rob Herring
maintainerQuoted 23 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The Prism54 SPI driver hardcodes GPIO numbers and expects users to pass them as module parameters, apparently a relic from its life as a staging driver. This works because there is only one user, the Nokia N8x0 tablet.
Convert this to the gpio descriptor interface and move the gpio line information into devicetree to improve this and simplify the code at the same time.
Signed-off-by Arnd Bergmann <[email protected]>---
As I don't have an N8x0, this is completely untested.I listed the driver authors (Johannes and Christian) as the maintainers of the binding document, but I don't know if they actually have this hardware. It might be better to list someone who is actually using it.
Among the various chip identifications, I wasn't sure which one to use for the compatible string and the name of the binding document. I picked st,stlc4560 as that was cited as the version in the N800 on multiple websites.
Quoted 10 lines
--- .../bindings/net/wireless/st,stlc45xx.yaml | 64 +++++++++++++++++ MAINTAINERS | 1 + arch/arm/boot/dts/omap2.dtsi | 4 ++ arch/arm/boot/dts/omap2420-n8x0-common.dtsi | 12 ++++ arch/arm/mach-omap2/board-n8x0.c | 18 ----- drivers/net/wireless/intersil/p54/p54spi.c | 69 +++++++------------ drivers/net/wireless/intersil/p54/p54spi.h | 3 + 7 files changed, 109 insertions(+), 62 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml
Binding looks fine, but I assume you'll split this into at least 3 patches?
Rob