Skip to contentSkip to conversation

p54spi devicetree conversion

PATCH In review Arnd Bergmann 3 participants 8 messages Apr 4, 2023 – Apr 7, 2023

Subsystems (9)
lore
Share & tools
lore
#0 lore raw

v2 cover p54spi devicetree conversion

From: Arnd Bergmann <[email protected]>

I now revisited the earlier submission, hopefully addressing all of the feedback correctly. This is still untested, but if everyone is happy, it could still make it into v6.4.

Patch 3 touches both driver and platform parts, and can't easily be split up without breaking bisectability, so I think it's easiest to merge it through the soc tree, with Christian's Ack.

Tony, I see you already sent a set of pull requests, let me know if you want to pick up these patches for a future round (6.4 or 6.5), or if I should just apply them on top.

---
Changes in v2:

- split into three patches
- reverse polarity of power(down) gpio
- clean up binding

Arnd Bergmann (3):
dt-bindings: net: add st,stlc45xx
ARM: dts: omap2: add stlc4560 spi-wireless node
p54spi: convert to devicetree

 .../bindings/net/wireless/st,stlc45xx.yaml    | 58 +++++++++++++++
 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    | 71 +++++++------------
 drivers/net/wireless/intersil/p54/p54spi.h    |  3 +
 7 files changed, 104 insertions(+), 63 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml
Signature · 26 lines
2.39.2

Cc: "Aaro Koskinen" <[email protected]>
Cc: "Arnd Bergmann" <[email protected]>
Cc: "Bartosz Golaszewski" <[email protected]>
Cc: "Benoît Cousson" <[email protected]>
Cc: Christian Lamparter <[email protected]>,
Cc: "David S. Miller" <[email protected]>
Cc: "Dmitry Torokhov" <[email protected]>
Cc: "Eric Dumazet" <[email protected]>
Cc: "Felipe Balbi" <[email protected]>
Cc: "Jakub Kicinski" <[email protected]>
Cc: "Johannes Berg" <[email protected]>
Cc: "Kalle Valo <[email protected]>"
Cc: "Krzysztof Kozlowski" <[email protected]>
Cc: "Linus Walleij" <[email protected]>
Cc: "Paolo Abeni" <[email protected]>
Cc: "Rob Herring" <[email protected]>
Cc: "Tony Lindgren" <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
#1 lore raw

PATCH v2 1/3 dt-bindings: net: add st,stlc45xx

From: Arnd Bergmann <[email protected]>

---
 .../bindings/net/wireless/st,stlc45xx.yaml    | 58 +++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +58 -0
new file mode 100644
index 000000000000..99f13d8d3816
@@ -0,0 +1,58 @@
+# 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:
+  - Christian Lamparter <[email protected]>
+
+description:
+  The SPI variant of the Intersil Prism54 wireless device was sold
+  under a variety of names, including Conexant CX3110x and
+  ST Microelectronics STLC5460.
+
+allOf:
+  - $ref: ieee80211.yaml#
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+  compatible:
+    enum:
+      - cnxt,3110x
+      - isil,p54spi
+      - st,stlc4550
+      - st,stlc4560
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  powerdown-gpios:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    spi {
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	wifi@0 {
+	    compatible = "st,stlc4560";
+	    reg = <0>;
+	    spi-max-frequency = <48000000>;
+	    interrupts-extended = <&gpio 23>;
+	    powerdown-gpios = <&gpio 1>;
+	};
+    };
Signature · 1 line
2.39.2
#2 lore raw

Re: [PATCH v2 1/3] dt-bindings: net: add st,stlc45xx

Quoted 10 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

---

Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +2 -0
+required:
+  - compatible

Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml line 49

Quoted 10 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +10 -0
+  - reg
+  - interrupts
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    spi {
+	#address-cells = <1>;
+	#size-cells = <0>;

You have here inconsistent indentation - tabs/spaces. Use 4-spaces for DTS example.

Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml line 58

Quoted 9 lines
Documentation/devicetree/bindings/net/wireless/st,stlc45xx.yaml new file +9 -0
+
+	wifi@0 {
+	    compatible = "st,stlc4560";
+	    reg = <0>;
+	    spi-max-frequency = <48000000>;
+	    interrupts-extended = <&gpio 23>;
+	    powerdown-gpios = <&gpio 1>;
+	};
+    };

Best regards,
Krzysztof

#3 lore raw

PATCH v2 2/3 ARM: dts: omap2: add stlc4560 spi-wireless node

In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Converted from the platform_device creation in board-n8x0.c.

---
 arch/arm/boot/dts/omap2.dtsi                |  4 ++++
 arch/arm/boot/dts/omap2420-n8x0-common.dtsi | 12 ++++++++++++
 2 files changed, 16 insertions(+)
arch/arm/boot/dts/omap2.dtsi +4 -0
index afabb36a8ac1..fdc1790adf43 100644
@@ -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
index 63b0b4921e4e..fe9dd8bbfc85 100644
@@ -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>;
+		powerdown-gpios = <&gpio4 1 GPIO_ACTIVE_LOW>; /* gpio 97 */
+	};
+};
Signature · 1 line
2.39.2
#5 lore raw

PATCH v2 3/3 p54spi: convert to devicetree

In reply to 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 DT based probing to improve this and simplify the code at the same time.

---
 MAINTAINERS                                |  1 +
 arch/arm/mach-omap2/board-n8x0.c           | 18 ------
 drivers/net/wireless/intersil/p54/p54spi.c | 71 ++++++++--------------
 drivers/net/wireless/intersil/p54/p54spi.h |  3 +
 4 files changed, 30 insertions(+), 63 deletions(-)
MAINTAINERS +1 -0
index 4f57deee1a08..9b08dcea913a 100644
@@ -15793,6 +15793,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/mach-omap2/board-n8x0.c +0 -18
index 3353b0a923d9..6a2949f50653 100644
@@ -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 +26 -45

135 lines not on this page · raw message

drivers/net/wireless/intersil/p54/p54spi.h +3 -0
index e5619a13fd61..118785cc635a 100644
@@ -107,6 +107,9 @@ struct p54s_priv {
 
 	enum fw_state fw_state;
 	const struct firmware *firmware;
+
+	struct gpio_desc *gpio_powerdown;
+	int irq;
 };
 
 #endif /* P54SPI_H */
Signature · 1 line
2.39.2
#6 lore raw

Re: [PATCH v2 3/3] p54spi: convert to devicetree

Quoted 24 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 DT based probing to improve this and simplify the code at the same time.

---
 MAINTAINERS                                |  1 +
 arch/arm/mach-omap2/board-n8x0.c           | 18 ------
 drivers/net/wireless/intersil/p54/p54spi.c | 71 ++++++++--------------
 drivers/net/wireless/intersil/p54/p54spi.h |  3 +
 4 files changed, 30 insertions(+), 63 deletions(-)
MAINTAINERS +0 -0
index 4f57deee1a08..9b08dcea913a 100644

MAINTAINERS M: Christian Lamparter <[email protected]> · line 15797

Quoted 5 lines
MAINTAINERS +1 -0
@@ -15793,6 +15793,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/

This hunk should be rather part of your patch #1.

Best regards,
Krzysztof

#7 lore raw
In reply to Arnd Bergmann
Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

I now revisited the earlier submission, hopefully addressing all of the feedback correctly. This is still untested, but if everyone is happy, it could still make it into v6.4.

Quoted 8 lines

Patch 3 touches both driver and platform parts, and can't easily be split up without breaking bisectability, so I think it's easiest to merge it through the soc tree, with Christian's Ack.

Tony, I see you already sent a set of pull requests, let me know if you want to pick up these patches for a future round (6.4 or 6.5), or if I should just apply them on top.

I just spotted two mistakes myself, so there will have to be a v3:
Patch 1 is missing a changelog text, and patch 3 contains a typo that only now triggered in my randconfig builds.

Arnd