Skip to contentSkip to conversation

WLAN support for omap4 when booted with devicetree

PATCH New Tony Lindgren 3 participants 14 messages Apr 26, 2013

Subsystems (4)
lore
Share & tools
lore

Tony Lindgren

author maintainer
#0 lore raw

cover WLAN support for omap4 when booted with devicetree

Hi all,

Here are some patches against linux next to make WLAN to work with device tree. Note that we still are initializing wl12xx with pdata, but so far it looks like only minimal binding for it is needed.

There are various fixes pending posted recently, but at least the fix "[PATCH] mmc: omap_hsmmc: Fix the DT pbias workaround for MMC controllers 2 to 5" is needed.

Please test on blaze/sdp if you have a chance, I don't have the connectivity card on mine.

Regards,

Tony

---

Tony Lindgren (3):
ARM: OMAP2+: Legacy support for wl12xx when booted with devicetree
ARM: dts: Add muxing for wl12xx on the SDIO bus for pandaboard
ARM: dts: Add muxing for wl12xx on the SDIO bus for blaze

 arch/arm/boot/dts/omap4-panda-common.dtsi |   43 ++++++++++++++++++++++++++++-
 arch/arm/boot/dts/omap4-sdp.dts           |   39 ++++++++++++++++++++++++++
 arch/arm/mach-omap2/devices.c             |   39 ++++++++++++++++++++++++++
 3 files changed, 119 insertions(+), 2 deletions(-)
Signature · 1 line
Signature
author maintainer
#1 lore raw

PATCH 1/3 ARM: OMAP2+: Legacy support for wl12xx when booted with devicetree

Without WLAN we cannot switch omap4 to use device tree only booting. This patch can be reverted when the binding for wl12xx is added.

Cc Luciano Coelho <[email protected]>
Cc Benoit Cousson <[email protected]>
Cc Rajendra Nayak <[email protected]>
Cc devicetree-discuss at lists.ozlabs.org
---
 arch/arm/mach-omap2/devices.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
arch/arm/mach-omap2/devices.c +39 -0
index 73762ac..69c520e 100644
@@ -15,6 +15,7 @@
 #include <linux/io.h>
 #include <linux/clk.h>
 #include <linux/err.h>
+#include <linux/gpio.h>
 #include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/pinctrl/machine.h>
@@ -22,6 +23,7 @@
 #include <linux/platform_data/omap_ocp2scp.h>
 #include <linux/platform_data/mailbox-omap.h>
 #include <linux/usb/omap_control_usb.h>
+#include <linux/wl12xx.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/map.h>
@@ -640,6 +642,40 @@ static void __init omap_init_ocp2scp(void)
 static inline void omap_init_ocp2scp(void) { }
 #endif
 
+#if IS_ENABLED(CONFIG_WL12XX)
+
+static struct wl12xx_platform_data wl12xx __initdata;
+
+void __init omap_init_wl12xx_of(void)
+{
+	int ret;
+
+	if (!of_have_populated_dt())
+		return;
+
+	if (of_machine_is_compatible("ti,omap4-sdp")) {
+		wl12xx.board_ref_clock = WL12XX_REFCLOCK_26;
+		wl12xx.board_tcxo_clock = WL12XX_TCXOCLOCK_26;
+		wl12xx.irq = gpio_to_irq(53);
+	} else if (of_machine_is_compatible("ti,omap4-panda")) {
+		wl12xx.board_ref_clock = WL12XX_REFCLOCK_38;
+		wl12xx.irq = gpio_to_irq(53);
+	} else {
+		return;
+	}
+
+	ret = wl12xx_set_platform_data(&wl12xx);
+	if (ret) {
+		pr_err("error setting wl12xx data: %d\n", ret);
+		return;
+	}
+}
+#else
+static inline omap_init_wl12xx_of(void)
+{
+}
+#endif
+
 /*-------------------------------------------------------------------------*/
 
 static int __init omap2_init_devices(void)
@@ -664,6 +700,9 @@ static int __init omap2_init_devices(void)
 		omap_init_mcspi();
 		omap_init_sham();
 		omap_init_aes();
+	} else {
+		/* These can be removed when bindings are done */
+		omap_init_wl12xx_of();
 	}
 	omap_init_sti();
 	omap_init_rng();
#2 lore raw

PATCH 1/3 ARM: OMAP2+: Legacy support for wl12xx when booted with devicetree

Quoted 10 lines · Tony Lindgren

Without WLAN we cannot switch omap4 to use device tree only booting. This patch can be reverted when the binding for wl12xx is added.

Cc Luciano Coelho <[email protected]>
Cc Benoit Cousson <[email protected]>
Cc Rajendra Nayak <[email protected]>
Cc devicetree-discuss at lists.ozlabs.org

---

Signature · 1 line
Luca.
#3 lore raw

PATCH 1/3 ARM: OMAP2+: Legacy support for wl12xx when booted with devicetree

In reply to Tony Lindgren

Op 26 apr. 2013, om 05:52 heeft Tony Lindgren <[email protected]> het volgende geschreven:

Quoted 3 lines

Without WLAN we cannot switch omap4 to use device tree only booting. This patch can be reverted when the binding for wl12xx is added.

How much boards am I allowed to add to this? I need to get the wl12xx wifi expansionboards for beagleboard, beagleboard xM and beaglebone working with DT :)

regards,

Koen

#4 lore raw

PATCH 1/3 ARM: OMAP2+: Legacy support for wl12xx when booted with devicetree

Hi Koen,

Quoted 7 lines · Koen Kooi

Op 26 apr. 2013, om 05:52 heeft Tony Lindgren <[email protected]> het volgende geschreven:

Quoted 3 lines

Without WLAN we cannot switch omap4 to use device tree only booting. This patch can be reverted when the binding for wl12xx is added.

How much boards am I allowed to add to this? I need to get the wl12xx wifi expansionboards for beagleboard, beagleboard xM and beaglebone working with DT :)

Do you know where I can get a wl12xx wifi expansion board for beaglebone?

Signature · 1 line
Luca.
#5 lore raw

PATCH 1/3 ARM: OMAP2+: Legacy support for wl12xx when booted with devicetree

Quoted 5 lines · Luciano Coelho

Hi Koen,

Quoted 2 lines · Koen Kooi

Op 26 apr. 2013, om 05:52 heeft Tony Lindgren <[email protected]> het volgende geschreven:

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Without WLAN we cannot switch omap4 to use device tree only booting. This patch can be reverted when the binding for wl12xx is added.

How much boards am I allowed to add to this? I need to get the wl12xx wifi expansionboards for beagleboard, beagleboard xM and beaglebone working with DT :)

Do you know where I can get a wl12xx wifi expansion board for beaglebone?

Uhmmm, never mind. I somehow thought this was with the WiLink 8 chip, but you said wl12xx, so it's not. ;)

Signature · 1 line
Luca.
author maintainer
#6 lore raw

PATCH 1/3 ARM: OMAP2+: Legacy support for wl12xx when booted with devicetree

In reply to Koen Kooi
Quoted 8 lines · Koen Kooi

Op 26 apr. 2013, om 05:52 heeft Tony Lindgren <[email protected]> het volgende geschreven:

Quoted 3 lines

Without WLAN we cannot switch omap4 to use device tree only booting. This patch can be reverted when the binding for wl12xx is added.

How much boards am I allowed to add to this? I need to get the wl12xx wifi expansionboards for beagleboard, beagleboard xM and beaglebone working with DT :)

As long as it's trivial changes, go for it. It will be gone after we have the binding for wl12xx.

But let's not add the bluetooth serial port hack.. And let's not churn the board-*.c files, at this point pretty much the next step is to start dropping the board-*.c files.

Regards,

Tony

author maintainer
#7 lore raw

PATCH 2/3 ARM: dts: Add muxing for wl12xx on the SDIO bus for pandaboard

In reply to Tony Lindgren

This is needed to get wl12xx working with device tree based booting.

Note that we claim the various GPIO inputs in the regulator as the proper muxing is needed to enable and disable the regulator.

Also, we want to use non-removable instead of ti,non-removable as the ti,non-removable also sets no_regulator_off_init which is really not what we want as then wl12xx won't get powered up and down which is needed for resetting it.

Cc Luciano Coelho <[email protected]>
Cc Benoit Cousson <[email protected]>
Cc Rajendra Nayak <[email protected]>
Cc devicetree-discuss at lists.ozlabs.org
---
 arch/arm/boot/dts/omap4-panda-common.dtsi |   43 ++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)
arch/arm/boot/dts/omap4-panda-common.dtsi +42 -1
index 628f744..16b23bf 100644
@@ -86,6 +86,19 @@
 		clock-names = "main_clk";
 		clock-frequency = <19200000>;
 	};
+
+	/* regulator for wl12xx on sdio5 */
+	wl12xx_vmmc: wl12xx_vmmc {
+		pinctrl-names = "default";
+		pinctrl-0 = <&wl12xx_gpio>;
+		compatible = "regulator-fixed";
+		regulator-name = "vwl1271";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		gpio = <&gpio2 11 0>;
+		startup-delay-us = <70000>;
+		enable-active-high;
+	};
 };
 
 &omap4_pmx_core {
@@ -185,6 +198,30 @@
 			0xf0 0x118     /* i2c4_sda PULLUP | INPUTENABLE | MODE0 */
 		>;
 	};
+
+	/* wl12xx GPIO outputs for WLAN_EN, BT_EN, FM_EN, BT_WAKEUP */
+	wl12xx_gpio: pinmux_wl12xx_gpio {
+		pinctrl-single,pins = <
+			0x26 0x3	/* gpmc_a19.gpio_43 OUTPUT | MODE3 */
+			0x2c 0x3	/* gpmc_a22.gpio_46 OUTPUT | MODE3 */
+			0x30 0xb	/* gpmc_a24.gpio_48 OUTPUT | MODE3 */
+			0x32 0xb	/* gpmc_a25.gpio_49 OUTPUT | MODE3 */
+		>;
+	};
+
+	/* wl12xx GPIO inputs and SDIO pins */
+	wl12xx_pins: pinmux_wl12xx_pins {
+		pinctrl-single,pins = <
+			0x38 0x103	/* gpmc_ncs2.gpio_52 INPUT | MODE3 */
+			0x3a 0x103	/* gpmc_ncs3.gpio_53 INPUT | MODE3 */
+			0x108 0x118	/* sdmmc5_clk.sdmmc5_clk INPUT_PULLUP | MODE0 */
+			0x10a 0x118	/* sdmmc5_cmd.sdmmc5_cmd INPUT_PULLUP | MODE0 */
+			0x10c 0x118	/* sdmmc5_dat0.sdmmc5_dat0 INPUT_PULLUP | MODE0 */
+			0x10e 0x118	/* sdmmc5_dat1.sdmmc5_dat1 INPUT_PULLUP | MODE0 */
+			0x110 0x118	/* sdmmc5_dat2.sdmmc5_dat2 INPUT_PULLUP | MODE0 */
+			0x112 0x118	/* sdmmc5_dat3.sdmmc5_dat3 INPUT_PULLUP | MODE0 */
+      		>;
+	};
 };
 
 &i2c1 {
@@ -264,8 +301,12 @@
 };
 
 &mmc5 {
-	ti,non-removable;
+	pinctrl-names = "default";
+	pinctrl-0 = <&wl12xx_pins>;
+	vmmc-supply = <&wl12xx_vmmc>;
+	non-removable;
 	bus-width = <4>;
+	cap-power-off-card;
 };
 
 &emif1 {
#8 lore raw

PATCH 2/3 ARM: dts: Add muxing for wl12xx on the SDIO bus for pandaboard

Quoted 12 lines · Tony Lindgren

This is needed to get wl12xx working with device tree based booting.

Note that we claim the various GPIO inputs in the regulator as the proper muxing is needed to enable and disable the regulator.

Also, we want to use non-removable instead of ti,non-removable as the ti,non-removable also sets no_regulator_off_init which is really not what we want as then wl12xx won't get powered up and down which is needed for resetting it.

Quoted 6 lines
Cc Luciano Coelho <[email protected]>
Cc Benoit Cousson <[email protected]>
Cc Rajendra Nayak <[email protected]>
Cc devicetree-discuss at lists.ozlabs.org

---

I tried this now and it seems to work fine too. So:

Except that with linux-next I'm getting some problems with the interrupts when trying to use wl12xx. It's not related to this patch though, and I'm investigating it right now.

Also, I found one small whitespace problem in this patch:

[...]

arch/arm/boot/dts/omap4-panda-common.dtsi line 223

Quoted 12 lines
arch/arm/boot/dts/omap4-panda-common.dtsi +12 -0
+	/* wl12xx GPIO inputs and SDIO pins */
+	wl12xx_pins: pinmux_wl12xx_pins {
+		pinctrl-single,pins = <
+			0x38 0x103	/* gpmc_ncs2.gpio_52 INPUT | MODE3 */
+			0x3a 0x103	/* gpmc_ncs3.gpio_53 INPUT | MODE3 */
+			0x108 0x118	/* sdmmc5_clk.sdmmc5_clk INPUT_PULLUP | MODE0 */
+			0x10a 0x118	/* sdmmc5_cmd.sdmmc5_cmd INPUT_PULLUP | MODE0 */
+			0x10c 0x118	/* sdmmc5_dat0.sdmmc5_dat0 INPUT_PULLUP | MODE0 */
+			0x10e 0x118	/* sdmmc5_dat1.sdmmc5_dat1 INPUT_PULLUP | MODE0 */
+			0x110 0x118	/* sdmmc5_dat2.sdmmc5_dat2 INPUT_PULLUP | MODE0 */
+			0x112 0x118	/* sdmmc5_dat3.sdmmc5_dat3 INPUT_PULLUP | MODE0 */
+      		>;

git am reports a "space before tab in indent" here.

Signature · 1 line
Luca.
author maintainer
#9 lore raw

PATCH 2/3 ARM: dts: Add muxing for wl12xx on the SDIO bus for pandaboard

Quoted 20 lines · Luciano Coelho
Quoted 12 lines · Tony Lindgren

This is needed to get wl12xx working with device tree based booting.

Note that we claim the various GPIO inputs in the regulator as the proper muxing is needed to enable and disable the regulator.

Also, we want to use non-removable instead of ti,non-removable as the ti,non-removable also sets no_regulator_off_init which is really not what we want as then wl12xx won't get powered up and down which is needed for resetting it.

Quoted 6 lines
Cc Luciano Coelho <[email protected]>
Cc Benoit Cousson <[email protected]>
Cc Rajendra Nayak <[email protected]>
Cc devicetree-discuss at lists.ozlabs.org

---

Quoted 7 lines

I tried this now and it seems to work fine too. So:

Except that with linux-next I'm getting some problems with the interrupts when trying to use wl12xx. It's not related to this patch though, and I'm investigating it right now.

One thing I was worried is the early use of gpio_to_irq() that's probably not safe always. We could fix that by moving the gpio_to_irq() call to the driver if that's a problem.

But if the gpio_to_irq() is not the issue, can you please just add a minimal binding to the wl12xx code so we can get rid of the pdata init for the DT booting?

We can pass the clock reference the same way as we've discussed already regarding the USB transceiver patch. Or you might be able to find it out in the driver probe just by doing clk_get() and clk_get_rate() on the source clock.

And the GPIO is just a standard resource that already has a binding.

Quoted 17 lines

Also, I found one small whitespace problem in this patch:

[...]

arch/arm/boot/dts/omap4-panda-common.dtsi line 223

Quoted 12 lines
arch/arm/boot/dts/omap4-panda-common.dtsi +12 -0
+	/* wl12xx GPIO inputs and SDIO pins */
+	wl12xx_pins: pinmux_wl12xx_pins {
+		pinctrl-single,pins = <
+			0x38 0x103	/* gpmc_ncs2.gpio_52 INPUT | MODE3 */
+			0x3a 0x103	/* gpmc_ncs3.gpio_53 INPUT | MODE3 */
+			0x108 0x118	/* sdmmc5_clk.sdmmc5_clk INPUT_PULLUP | MODE0 */
+			0x10a 0x118	/* sdmmc5_cmd.sdmmc5_cmd INPUT_PULLUP | MODE0 */
+			0x10c 0x118	/* sdmmc5_dat0.sdmmc5_dat0 INPUT_PULLUP | MODE0 */
+			0x10e 0x118	/* sdmmc5_dat1.sdmmc5_dat1 INPUT_PULLUP | MODE0 */
+			0x110 0x118	/* sdmmc5_dat2.sdmmc5_dat2 INPUT_PULLUP | MODE0 */
+			0x112 0x118	/* sdmmc5_dat3.sdmmc5_dat3 INPUT_PULLUP | MODE0 */
+      		>;

git am reports a "space before tab in indent" here.

OK thanks, will fix.

Regards,

Tony

author maintainer
#10 lore raw

PATCH 3/3 ARM: dts: Add muxing for wl12xx on the SDIO bus for blaze

In reply to Tony Lindgren

This should work assuming the board-4430sdp.c works, but it seems that I don't have the "1283 PG 2.21 connectivity device" on my blaze. Anybody got a spare connectivity device for blaze?

Also, if somebody has the schematics, please provide a patch for the missing GPIO muxes for blaze, see the the panda for what's currently missing.

Cc Luciano Coelho <[email protected]>
Cc Benoit Cousson <[email protected]>
Cc Rajendra Nayak <[email protected]>
Cc Ruslan Bilovol <[email protected]>
Cc devicetree-discuss at lists.ozlabs.org
---
 arch/arm/boot/dts/omap4-sdp.dts |   39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)
arch/arm/boot/dts/omap4-sdp.dts +38 -1
index a35d9cd..c13c483 100644
@@ -140,6 +140,19 @@
 			"DMic", "Digital Mic",
 			"Digital Mic", "Digital Mic1 Bias";
 	};
+
+	/* regulator for wl12xx on sdio5 */
+	wl12xx_vmmc: wl12xx_vmmc {
+		pinctrl-names = "default";
+		pinctrl-0 = <&wl12xx_gpio>;
+		compatible = "regulator-fixed";
+		regulator-name = "vwl1271";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		gpio = <&gpio2 22 0>;
+		startup-delay-us = <70000>;
+		enable-active-high;
+	};
 };
 
 &omap4_pmx_core {
@@ -275,6 +288,26 @@
 			0xf0 0x118     /* i2c4_sda PULLUP | INPUTENABLE | MODE0 */
 		>;
 	};
+
+	/* wl12xx GPIO output for WLAN_EN */
+	wl12xx_gpio: pinmux_wl12xx_gpio {
+		pinctrl-single,pins = <
+			0x3c 0x3	/* gpmc_nwp.gpio_54 OUTPUT | MODE3 */
+		>;
+	};
+
+	/* wl12xx GPIO inputs and SDIO pins */
+	wl12xx_pins: pinmux_wl12xx_pins {
+		pinctrl-single,pins = <
+			0x3a 0x103	/* gpmc_ncs3.gpio_53 INPUT | MODE3 */
+			0x108 0x118	/* sdmmc5_clk.sdmmc5_clk INPUT_PULLUP | MODE0 */
+			0x10a 0x118	/* sdmmc5_cmd.sdmmc5_cmd INPUT_PULLUP | MODE0 */
+			0x10c 0x118	/* sdmmc5_dat0.sdmmc5_dat0 INPUT_PULLUP | MODE0 */
+			0x10e 0x118	/* sdmmc5_dat1.sdmmc5_dat1 INPUT_PULLUP | MODE0 */
+			0x110 0x118	/* sdmmc5_dat2.sdmmc5_dat2 INPUT_PULLUP | MODE0 */
+			0x112 0x118	/* sdmmc5_dat3.sdmmc5_dat3 INPUT_PULLUP | MODE0 */
+      		>;
+	};
 };
 
 &i2c1 {
@@ -400,8 +433,12 @@
 };
 
 &mmc5 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&wl12xx_pins>;
+	vmmc-supply = <&wl12xx_vmmc>;
+	non-removable;
 	bus-width = <4>;
-	ti,non-removable;
+	cap-power-off-card;
 };
 
 &emif1 {
#11 lore raw

PATCH 3/3 ARM: dts: Add muxing for wl12xx on the SDIO bus for blaze

Quoted 8 lines · Tony Lindgren

This should work assuming the board-4430sdp.c works, but it seems that I don't have the "1283 PG 2.21 connectivity device" on my blaze. Anybody got a spare connectivity device for blaze?

Also, if somebody has the schematics, please provide a patch for the missing GPIO muxes for blaze, see the the panda for what's currently missing.

Quoted 7 lines
Cc Luciano Coelho <[email protected]>
Cc Benoit Cousson <[email protected]>
Cc Rajendra Nayak <[email protected]>
Cc Ruslan Bilovol <[email protected]>
Cc devicetree-discuss at lists.ozlabs.org

---

Signature · 1 line
Luca.
#12 lore raw

cover WLAN support for omap4 when booted with devicetree

In reply to Tony Lindgren
Quoted 1 line · Tony Lindgren

Hi all,

Hi Tony,

Quoted 3 lines

Here are some patches against linux next to make WLAN to work with device tree. Note that we still are initializing wl12xx with pdata, but so far it looks like only minimal binding for it is needed.

Thanks for doing this! I've been out on vacation for the past 3 weeks, so I didn't manage to finish the wl12xx DT stuff in time for 3.10. :(

Quoted 3 lines

There are various fixes pending posted recently, but at least the fix "[PATCH] mmc: omap_hsmmc: Fix the DT pbias workaround for MMC controllers 2 to 5" is needed.

I managed to apply the OMAP2+ and the blaze patches. There were conflicts with the panda patch, so I skipped it for now. I'll come back to it a bit later.

Quoted 2 lines

Please test on blaze/sdp if you have a chance, I don't have the connectivity card on mine.

I tested this on Blaze and it seems to work fine! The driver gets probed and I can power the chip on and off (by putting the interface up and down) without any problems. :)

BTW, did you (or anyone else) manage to get ethernet to work on Blaze (or Panda) with DT?

Signature · 1 line
Luca.
author maintainer
#13 lore raw

cover WLAN support for omap4 when booted with devicetree

Quoted 6 lines · Luciano Coelho
Quoted 1 line · Tony Lindgren

Hi all,

Hi Tony,

Quoted 6 lines
Quoted 3 lines

Here are some patches against linux next to make WLAN to work with device tree. Note that we still are initializing wl12xx with pdata, but so far it looks like only minimal binding for it is needed.

Thanks for doing this! I've been out on vacation for the past 3 weeks, so I didn't manage to finish the wl12xx DT stuff in time for 3.10. :(

OK I was wondering what happened..

Quoted 7 lines
Quoted 3 lines

There are various fixes pending posted recently, but at least the fix "[PATCH] mmc: omap_hsmmc: Fix the DT pbias workaround for MMC controllers 2 to 5" is needed.

I managed to apply the OMAP2+ and the blaze patches. There were conflicts with the panda patch, so I skipped it for now. I'll come back to it a bit later.

OK

Quoted 6 lines
Quoted 2 lines

Please test on blaze/sdp if you have a chance, I don't have the connectivity card on mine.

I tested this on Blaze and it seems to work fine! The driver gets probed and I can power the chip on and off (by putting the interface up and down) without any problems. :)

OK great thanks! It took me few hours of debugging to figure out that it does not work on my blaze as I did not have the wl12xx card in it :)

Also can you fill in the missing GPIO lines for blaze from the schematics?

Quoted 2 lines

BTW, did you (or anyone else) manage to get ethernet to work on Blaze (or Panda) with DT?

Yes that needs the two GPIO fixes posted by Jon Hunter last week. One for patching in the GPIO trigger type to both omap4-sdp.dts, and the other one is "gpio/omap: ensure gpio context is initialised".

Regards,

Tony