wl1251 device tree support
Subsystems (8)
cover wl1251 device tree support
Hi,
The following patchset adds device tree support to the spi variant of the wl1251 driver.
Some notes:
The first patch is from Luciano's wilink DT support patchset [0].
The third patch (vio regulator support) is optional. N900's wifi also worked without this patch, but its probably cleaner to have it.
The patchset has been tested using DT boot with the Nokia N900 and connecting to my wlan access point.
[0] https://lkml.org/lkml/2013/7/3/333
-- Sebastian
Luciano Coelho (1):
wl1251: split wl251 platform data to a separate structure
Sebastian Reichel (3):
wl1251: move power GPIO handling into the driver
wl1251: spi: add vio regulator support
wl1251: spi: add device tree support
.../devicetree/bindings/net/wireless/ti,wl1251.txt | 36 +++++++++++ arch/arm/mach-omap2/board-omap3pandora.c | 6 +- arch/arm/mach-omap2/board-rx51-peripherals.c | 15 ++--- drivers/net/wireless/ti/wilink_platform_data.c | 37 +++++++++-- drivers/net/wireless/ti/wl1251/sdio.c | 31 +++++++--- drivers/net/wireless/ti/wl1251/spi.c | 71 ++++++++++++++++------ drivers/net/wireless/ti/wl1251/wl1251.h | 4 +- include/linux/wl12xx.h | 24 +++++++- 8 files changed, 175 insertions(+), 49 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt
Signature · 1 line
1.8.4.rc3
PATCH 1/4 wl1251: split wl251 platform data to a separate structure
From: Luciano Coelho <[email protected]>
Move the wl1251 part of the wl12xx platform data structure into a new structure specifically for wl1251. Change the platform data built-in block and board files accordingly.
--- arch/arm/mach-omap2/board-omap3pandora.c | 4 +-- arch/arm/mach-omap2/board-rx51-peripherals.c | 2 +- drivers/net/wireless/ti/wilink_platform_data.c | 37 +++++++++++++++++++++----- drivers/net/wireless/ti/wl1251/sdio.c | 12 ++++----- drivers/net/wireless/ti/wl1251/spi.c | 2 +- include/linux/wl12xx.h | 22 ++++++++++++++- 6 files changed, 62 insertions(+), 17 deletions(-)
arch/arm/mach-omap2/board-omap3pandora.c +2 -2
@@ -536,7 +536,7 @@ static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {static void __init pandora_wl1251_init (void ) { -struct wl12xx_platform_data pandora_wl1251_pdata; +struct wl1251_platform_data pandora_wl1251_pdata;int ret;memset (&pandora_wl1251_pdata,0 ,sizeof (pandora_wl1251_pdata));
@@ -550,7 +550,7 @@ static void __init pandora_wl1251_init(void) goto fail_irq; pandora_wl1251_pdata.use_eeprom = true; - ret =wl12xx_set_platform_data (&pandora_wl1251_pdata); + ret =wl1251_set_platform_data (&pandora_wl1251_pdata);if (ret <0 ) goto fail_irq;
arch/arm/mach-omap2/board-rx51-peripherals.c +1 -1
@@ -82,7 +82,7 @@ enum { RX51_SPI_MIPID, /* LCD panel */ }; -static struct wl12xx_platform_data wl1251_pdata; +static struct wl1251_platform_data wl1251_pdata;static struct tsc2005_platform_data tsc2005_pdata;#if defined(CONFIG_SENSORS_LIS3_I2C ) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE )
drivers/net/wireless/ti/wilink_platform_data.c +31 -6
@@ -23,17 +23,17 @@#include <linux/err.h> #include <linux/wl12xx.h> -static struct wl12xx_platform_data *platform_data; +static struct wl12xx_platform_data *wl12xx_platform_data;int __init wl12xx_set_platform_data (const struct wl12xx_platform_data *data) { -if (platform_data) +if (wl12xx_platform_data)return -EBUSY ;if (!data)return -EINVAL ; - platform_data =kmemdup (data,sizeof (*data),GFP_KERNEL ); -if (!platform_data) + wl12xx_platform_data =kmemdup (data,sizeof (*data),GFP_KERNEL ); +if (!wl12xx_platform_data)return -ENOMEM ;return 0 ;
@@ -41,9 +41,34 @@ int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)struct wl12xx_platform_data *wl12xx_get_platform_data (void ) { -if (!platform_data) +if (!wl12xx_platform_data)return ERR_PTR (-ENODEV ); -return platform_data; +return wl12xx_platform_data; }EXPORT_SYMBOL (wl12xx_get_platform_data); + +static struct wl1251_platform_data *wl1251_platform_data; + +int __init wl1251_set_platform_data (const struct wl1251_platform_data *data) +{ +if (wl1251_platform_data) +return -EBUSY ; +if (!data) +return -EINVAL ; + + wl1251_platform_data =kmemdup (data,sizeof (*data),GFP_KERNEL ); +if (!wl1251_platform_data) +return -ENOMEM ; + +return 0 ; +} + +struct wl1251_platform_data *wl1251_get_platform_data (void ) +{ +if (!wl1251_platform_data) +return ERR_PTR (-ENODEV ); + +return wl1251_platform_data; +} +EXPORT_SYMBOL (wl1251_get_platform_data);
drivers/net/wireless/ti/wl1251/sdio.c +6 -6
@@ -227,7 +227,7 @@ static int wl1251_sdio_probe(struct sdio_func *func,struct wl1251 *wl;struct ieee80211_hw *hw;struct wl1251_sdio *wl_sdio; -const struct wl12xx_platform_data *wl12xx_board_data; +const struct wl1251_platform_data *wl1251_board_data; hw =wl1251_alloc_hw ();if (IS_ERR (hw))
@@ -254,11 +254,11 @@ static int wl1251_sdio_probe(struct sdio_func *func, wl->if_priv = wl_sdio; wl->if_ops = &wl1251_sdio_ops; - wl12xx_board_data =wl12xx_get_platform_data (); -if (!IS_ERR (wl12xx_board_data)) { - wl->set_power = wl12xx_board_data->set_power; - wl->irq = wl12xx_board_data->irq; - wl->use_eeprom = wl12xx_board_data->use_eeprom; + wl1251_board_data =wl1251_get_platform_data (); +if (!IS_ERR (wl1251_board_data)) { + wl->set_power = wl1251_board_data->set_power; + wl->irq = wl1251_board_data->irq; + wl->use_eeprom = wl1251_board_data->use_eeprom; }if (wl->irq) {
drivers/net/wireless/ti/wl1251/spi.c +1 -1
@@ -238,7 +238,7 @@ static const struct wl1251_if_operations wl1251_spi_ops = {static int wl1251_spi_probe (struct spi_device *spi) { -struct wl12xx_platform_data *pdata; +struct wl1251_platform_data *pdata;struct ieee80211_hw *hw;struct wl1251 *wl;int ret;
include/linux/wl12xx.h +21 -1
@@ -48,11 +48,15 @@ enum { WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */ }; -struct wl12xx_platform_data { +struct wl1251_platform_data {void (*set_power)(bool enable);/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ int irq;bool use_eeprom; +}; + +struct wl12xx_platform_data { +int irq;int board_ref_clock;int board_tcxo_clock;unsigned long platform_quirks;
@@ -68,6 +72,10 @@ int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);struct wl12xx_platform_data *wl12xx_get_platform_data (void ); +int wl1251_set_platform_data (const struct wl1251_platform_data *data); + +struct wl1251_platform_data *wl1251_get_platform_data (void ); +#else static inline
@@ -82,6 +90,18 @@ struct wl12xx_platform_data *wl12xx_get_platform_data(void)return ERR_PTR (-ENODATA ); } +static inline +int wl1251_set_platform_data (const struct wl1251_platform_data *data) +{ +return -ENOSYS ; +} + +static inline +struct wl1251_platform_data *wl1251_get_platform_data (void ) +{ +return ERR_PTR (-ENODATA ); +} +#endif #endif
Signature · 1 line
1.8.4.rc3
Re: [PATCH 1/4] wl1251: split wl251 platform data to a separate structure
Quoted 10 lines · Sebastian Reichel
From: Luciano Coelho <[email protected]>
Move the wl1251 part of the wl12xx platform data structure into a new structure specifically for wl1251. Change the platform data built-in block and board files accordingly.
Cc Tony Lindgren <[email protected]>Signed-off-by Luciano Coelho <[email protected]>Acked-by Tony Lindgren <[email protected]>Reviewed-by Felipe Balbi <[email protected]>
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Tony Lindgren
maintainerRe: [PATCH 1/4] wl1251: split wl251 platform data to a separate structure
In reply to Sebastian ReichelQuoted 46 lines · Sebastian Reichel
From: Luciano Coelho <[email protected]>
Move the wl1251 part of the wl12xx platform data structure into a new structure specifically for wl1251. Change the platform data built-in block and board files accordingly.
Cc Tony Lindgren <[email protected]>Signed-off-by Luciano Coelho <[email protected]>Acked-by Tony Lindgren <[email protected]>Reviewed-by Felipe Balbi <[email protected]>--- arch/arm/mach-omap2/board-omap3pandora.c | 4 +-- arch/arm/mach-omap2/board-rx51-peripherals.c | 2 +- drivers/net/wireless/ti/wilink_platform_data.c | 37 +++++++++++++++++++++----- drivers/net/wireless/ti/wl1251/sdio.c | 12 ++++----- drivers/net/wireless/ti/wl1251/spi.c | 2 +- include/linux/wl12xx.h | 22 ++++++++++++++- 6 files changed, 62 insertions(+), 17 deletions(-)arch/arm/mach-omap2/board-omap3pandora.c +2
-2@@ -536,7 +536,7 @@ static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {static void __init pandora_wl1251_init (void ) { -struct wl12xx_platform_data pandora_wl1251_pdata; +struct wl1251_platform_data pandora_wl1251_pdata;int ret;memset (&pandora_wl1251_pdata,0 ,sizeof (pandora_wl1251_pdata));@@ -550,7 +550,7 @@ static void __init pandora_wl1251_init(void) goto fail_irq; pandora_wl1251_pdata.use_eeprom = true; - ret =wl12xx_set_platform_data (&pandora_wl1251_pdata); + ret =wl1251_set_platform_data (&pandora_wl1251_pdata);if (ret <0 ) goto fail_irq;arch/arm/mach-omap2/board-rx51-peripherals.c +0
-0
arch/arm/mach-omap2/board-rx51-peripherals.c enum { · line 88
Quoted 8 lines
arch/arm/mach-omap2/board-rx51-peripherals.c +1
-1@@ -82,7 +82,7 @@ enum { RX51_SPI_MIPID, /* LCD panel */ }; -static struct wl12xx_platform_data wl1251_pdata; +static struct wl1251_platform_data wl1251_pdata;static struct tsc2005_platform_data tsc2005_pdata;#if defined(CONFIG_SENSORS_LIS3_I2C ) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE )
If this is not going into v3.13, these will cause conflicts with the mach-omap2/board-*.c files for v3.14.
So it might be best to do a minimal header patch first that can be merged in by both linux-omap and wireless trees.
Regards,
Tony
Re: [PATCH 1/4] wl1251: split wl251 platform data to a separate structure
Quoted 7 lines · Tony Lindgren
[...]
If this is not going into v3.13, these will cause conflicts with the
mach-omap2/board-*.cfiles for v3.14.So it might be best to do a minimal header patch first that can be merged in by both linux-omap and wireless trees.
I guess this patch is pretty minimal. It also seems to be acked by the involved Maintainers, so maybe just merge Patch 1 without the other patches?
This does not solve the problem with the struct modification from the second patch, but I guess it's the more intrusive patch.
-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131114/6203cf0b/attachment.sig>
Tony Lindgren
maintainerRe: [PATCH 1/4] wl1251: split wl251 platform data to a separate structure
Quoted 9 lines · Sebastian Reichel
Quoted 7 lines · Tony Lindgren
[...]
If this is not going into v3.13, these will cause conflicts with the
mach-omap2/board-*.cfiles for v3.14.So it might be best to do a minimal header patch first that can be merged in by both linux-omap and wireless trees.
Quoted 6 lines
I guess this patch is pretty minimal. It also seems to be acked by the involved Maintainers, so maybe just merge Patch 1 without the other patches?
This does not solve the problem with the struct modification from the second patch, but I guess it's the more intrusive patch.
Once at least the first two patches are ready, how about I queue them after -rc1 and set up an immutable branch that can be merged in by linux-omap tree and the wireless tree?
Regards,
Tony
Re: [PATCH 1/4] wl1251: split wl251 platform data to a separate structure
Quoted 14 lines · Tony Lindgren
Quoted 13 lines · Sebastian Reichel
Quoted 7 lines · Tony Lindgren
[...]
If this is not going into v3.13, these will cause conflicts with the
mach-omap2/board-*.cfiles for v3.14.So it might be best to do a minimal header patch first that can be merged in by both linux-omap and wireless trees.
I guess this patch is pretty minimal. It also seems to be acked by the involved Maintainers, so maybe just merge Patch 1 without the other patches?
Quoted 6 lines
Quoted 2 lines
This does not solve the problem with the struct modification from the second patch, but I guess it's the more intrusive patch.
Once at least the first two patches are ready, how about I queue them after -rc1 and set up an immutable branch that can be merged in by linux-omap tree and the wireless tree?
That sounds reasonable to me.
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you linville at tuxdriver.com might be all we have. Be ready.
Re: [PATCH 1/4] wl1251: split wl251 platform data to a separate structure
Quoted 15 lines · John W. Linville
Quoted 14 lines · Tony Lindgren
Quoted 13 lines · Sebastian Reichel
Quoted 7 lines · Tony Lindgren
[...]
If this is not going into v3.13, these will cause conflicts with the
mach-omap2/board-*.cfiles for v3.14.So it might be best to do a minimal header patch first that can be merged in by both linux-omap and wireless trees.
I guess this patch is pretty minimal. It also seems to be acked by the involved Maintainers, so maybe just merge Patch 1 without the other patches?
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
This does not solve the problem with the struct modification from the second patch, but I guess it's the more intrusive patch.
Once at least the first two patches are ready, how about I queue them after -rc1 and set up an immutable branch that can be merged in by linux-omap tree and the wireless tree?
That sounds reasonable to me.
So what changes do you request for those patches? I will try to update them as soon as possible.
-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131115/26782d7a/attachment.sig>
Tony Lindgren
maintainerRe: [PATCH 1/4] wl1251: split wl251 platform data to a separate structure
In reply to John W. LinvilleQuoted 15 lines · John W. Linville
Quoted 14 lines · Tony Lindgren
Quoted 13 lines · Sebastian Reichel
Quoted 7 lines · Tony Lindgren
[...]
If this is not going into v3.13, these will cause conflicts with the
mach-omap2/board-*.cfiles for v3.14.So it might be best to do a minimal header patch first that can be merged in by both linux-omap and wireless trees.
I guess this patch is pretty minimal. It also seems to be acked by the involved Maintainers, so maybe just merge Patch 1 without the other patches?
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
This does not solve the problem with the struct modification from the second patch, but I guess it's the more intrusive patch.
Once at least the first two patches are ready, how about I queue them after -rc1 and set up an immutable branch that can be merged in by linux-omap tree and the wireless tree?
That sounds reasonable to me.
OK sorry it took a while, I was chasing bugs and did not get around to doing this until now. I've applied only the first two patches from the v2 set of patches later on in this thread against v3.13-rc1 into a signed tag wl1251-pdata-signed here:
http://git.kernel.org/cgit/linux/kernel/git/tmlind/linux-omap.git/tag/?id=wl1251-pdata-signed
John, please feel free to pull the branch above also into the wireless tree so you can apply the remaining wl1251 patches from Sebastian. This way things keep working without creating merge conflicts with the linux-omap tree.
Regards,
Tony
PATCH 2/4 wl1251: move power GPIO handling into the driver
In reply to Sebastian ReichelMove the power GPIO handling from the board code into the driver. This is a dependency for device tree support.
--- arch/arm/mach-omap2/board-omap3pandora.c | 2 ++ arch/arm/mach-omap2/board-rx51-peripherals.c | 11 ++-------- drivers/net/wireless/ti/wl1251/sdio.c | 21 +++++++++++++----- drivers/net/wireless/ti/wl1251/spi.c | 33 ++++++++++++++++++---------- drivers/net/wireless/ti/wl1251/wl1251.h | 2 +- include/linux/wl12xx.h | 2 +- 6 files changed, 43 insertions(+), 28 deletions(-)
arch/arm/mach-omap2/board-omap3pandora.c +2 -0
@@ -541,6 +541,8 @@ static void __init pandora_wl1251_init(void)memset (&pandora_wl1251_pdata,0 ,sizeof (pandora_wl1251_pdata)); + pandora_wl1251_pdata.power_gpio =-1 ; + ret =gpio_request_one (PANDORA_WIFI_IRQ_GPIO ,GPIOF_IN ,"wl1251 irq" );if (ret <0 ) goto fail;
arch/arm/mach-omap2/board-rx51-peripherals.c +2 -9
@@ -1164,13 +1164,7 @@ static inline void board_smc91x_init(void)#endif -static void rx51_wl1251_set_power (bool enable) -{ -gpio_set_value (RX51_WL1251_POWER_GPIO , enable); -} -static struct gpio rx51_wl1251_gpios[]__initdata = { - {RX51_WL1251_POWER_GPIO ,GPIOF_OUT_INIT_LOW ,"wl1251 power" }, {RX51_WL1251_IRQ_GPIO ,GPIOF_IN ,"wl1251 irq" }, };
@@ -1187,17 +1181,16 @@ static void __init rx51_init_wl1251(void)if (irq <0 ) goto err_irq; - wl1251_pdata.set_power = rx51_wl1251_set_power; + wl1251_pdata.power_gpio =RX51_WL1251_POWER_GPIO ; rx51_peripherals_spi_board_info[RX51_SPI_WL1251 ].irq = irq;return ; err_irq:gpio_free (RX51_WL1251_IRQ_GPIO ); -gpio_free (RX51_WL1251_POWER_GPIO ); error:printk (KERN_ERR "wl1251 board initialisation failed\n" ); - wl1251_pdata.set_power =NULL ; + wl1251_pdata.power_gpio =-1 ;/* * Now rx51_peripherals_spi_board_info[1].irq is zero and
drivers/net/wireless/ti/wl1251/sdio.c +16 -5
@@ -28,6 +28,7 @@#include <linux/wl12xx.h> #include <linux/irq.h> #include <linux/pm_runtime.h> +#include <linux/gpio.h> #include "wl1251.h"
@@ -182,8 +183,9 @@ static int wl1251_sdio_set_power(struct wl1251 *wl, bool enable)* callback in case it wants to do any additional setup, * for example enabling clock buffer for the module. */ -if (wl->set_power) - wl->set_power (true); +if (gpio_is_valid (wl->power_gpio)) +gpio_set_value (wl->power_gpio, true); + ret =pm_runtime_get_sync (&func->dev);if (ret <0 ) {
@@ -203,8 +205,8 @@ static int wl1251_sdio_set_power(struct wl1251 *wl, bool enable)if (ret <0 ) goto out; -if (wl->set_power) - wl->set_power (false); +if (gpio_is_valid (wl->power_gpio)) +gpio_set_value (wl->power_gpio, false); } out:
@@ -256,11 +258,20 @@ static int wl1251_sdio_probe(struct sdio_func *func, wl1251_board_data =wl1251_get_platform_data ();if (!IS_ERR (wl1251_board_data)) { - wl->set_power = wl1251_board_data->set_power; + wl->power_gpio = wl1251_board_data->power_gpio; wl->irq = wl1251_board_data->irq; wl->use_eeprom = wl1251_board_data->use_eeprom; } +if (gpio_is_valid (wl->power_gpio)) { + ret =devm_gpio_request (&func->dev, wl->power_gpio, +"wl1251 power" ); +if (ret) { +wl1251_error ("Failed to request gpio: %d\n" , ret); + goto disable; + } + } +if (wl->irq) {irq_set_status_flags (wl->irq,IRQ_NOAUTOEN ); ret =request_irq (wl->irq, wl1251_line_irq,0 ,"wl1251" , wl);
drivers/net/wireless/ti/wl1251/spi.c +21 -12
@@ -26,6 +26,7 @@#include <linux/crc7.h> #include <linux/spi/spi.h> #include <linux/wl12xx.h> +#include <linux/gpio.h> #include "wl1251.h" #include "reg.h"
@@ -221,8 +222,8 @@ static void wl1251_spi_disable_irq(struct wl1251 *wl)static int wl1251_spi_set_power (struct wl1251 *wl,bool enable) { -if (wl->set_power) - wl->set_power (enable); +if (gpio_is_valid (wl->power_gpio)) +gpio_set_value (wl->power_gpio, enable);return 0 ; }
@@ -271,22 +272,33 @@ static int wl1251_spi_probe(struct spi_device *spi) goto out_free; } - wl->set_power = pdata->set_power; -if (!wl->set_power) { -wl1251_error ("set power function missing in platform data" ); -return -ENODEV ; + wl->power_gpio = pdata->power_gpio; + +if (gpio_is_valid (wl->power_gpio)) { + ret =devm_gpio_request_one (&spi->dev, wl->power_gpio, +GPIOF_OUT_INIT_LOW ,"wl1251 power" ); +if (ret) { +wl1251_error ("Failed to request gpio: %d\n" , ret); + goto out_free; + } + }else { +wl1251_error ("set power gpio missing in platform data" ); + ret = -ENODEV ; + goto out_free; } wl->irq = spi->irq;if (wl->irq <0 ) {wl1251_error ("irq missing in platform data" ); -return -ENODEV ; + ret = -ENODEV ; + goto out_free; } wl->use_eeprom = pdata->use_eeprom;irq_set_status_flags (wl->irq,IRQ_NOAUTOEN ); - ret =request_irq (wl->irq, wl1251_irq,0 ,DRIVER_NAME , wl); + ret =devm_request_irq (&spi->dev, wl->irq, wl1251_irq,0 , +DRIVER_NAME , wl);if (ret <0 ) {wl1251_error ("request_irq() failed: %d" , ret); goto out_free;
@@ -296,13 +308,10 @@ static int wl1251_spi_probe(struct spi_device *spi) ret =wl1251_init_ieee80211 (wl);if (ret) - goto out_irq; + goto out_free;return 0 ; - out_irq: -free_irq (wl->irq, wl); - out_free:ieee80211_free_hw (hw);
drivers/net/wireless/ti/wl1251/wl1251.h +1 -1
@@ -275,7 +275,7 @@ struct wl1251 {void *if_priv;const struct wl1251_if_operations *if_ops; -void (*set_power)(bool enable); +int power_gpio;int irq;bool use_eeprom;
include/linux/wl12xx.h +1 -1
@@ -49,7 +49,7 @@ enum { };struct wl1251_platform_data { -void (*set_power)(bool enable); +int power_gpio;/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ int irq;bool use_eeprom;
Signature · 1 line
1.8.4.rc3
Re: [PATCH 2/4] wl1251: move power GPIO handling into the driver
Quoted 12 lines
Move the power GPIO handling from the board code into the driver. This is a dependency for device tree support.
Signed-off-by Sebastian Reichel <[email protected]>--- arch/arm/mach-omap2/board-omap3pandora.c | 2 ++ arch/arm/mach-omap2/board-rx51-peripherals.c | 11 ++-------- drivers/net/wireless/ti/wl1251/sdio.c | 21 +++++++++++++----- drivers/net/wireless/ti/wl1251/spi.c | 33 ++++++++++++++++++---------- drivers/net/wireless/ti/wl1251/wl1251.h | 2 +- include/linux/wl12xx.h | 2 +- 6 files changed, 43 insertions(+), 28 deletions(-)
...
Quoted 6 lines
include/linux/wl12xx.h +0
-0
include/linux/wl12xx.h enum { · line 55
Quoted 8 lines
include/linux/wl12xx.h +1
-1@@ -49,7 +49,7 @@ enum { };struct wl1251_platform_data { -void (*set_power)(bool enable); +int power_gpio;/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ int irq;bool use_eeprom;
What a reason for not using regulator API here with GPIO-based regulator?
---
Re: [PATCH 2/4] wl1251: move power GPIO handling into the driver
Quoted 20 lines · Alexander Shiyan
Quoted 12 lines
Move the power GPIO handling from the board code into the driver. This is a dependency for device tree support.
Signed-off-by Sebastian Reichel <[email protected]>--- arch/arm/mach-omap2/board-omap3pandora.c | 2 ++ arch/arm/mach-omap2/board-rx51-peripherals.c | 11 ++-------- drivers/net/wireless/ti/wl1251/sdio.c | 21 +++++++++++++----- drivers/net/wireless/ti/wl1251/spi.c | 33 ++++++++++++++++++---------- drivers/net/wireless/ti/wl1251/wl1251.h | 2 +- include/linux/wl12xx.h | 2 +- 6 files changed, 43 insertions(+), 28 deletions(-)...
Quoted 7 lines
include/linux/wl12xx.h +0
-0@@ -49,7 +49,7 @@ enum { };
Quoted 10 lines
include/linux/wl12xx.h enum { · line 55
Quoted 7 lines
include/linux/wl12xx.h +1
-1struct wl1251_platform_data { -void (*set_power)(bool enable); +int power_gpio;/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ int irq;bool use_eeprom;What a reason for not using regulator API here with GPIO-based regulator?
I think this pin is not used as power supply, but like an enable pin for low power states. Of course the regulator API could still be (mis?)used for this, but I think it would be the first linux device driver doing this.
Note: I don't have wl1251 documentation.
-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131027/667702b7/attachment-0001.sig>
Re: [PATCH 2/4] wl1251: move power GPIO handling into the driver
Quoted 32 lines · Sebastian Reichel
Quoted 20 lines · Alexander Shiyan
Quoted 12 lines
Move the power GPIO handling from the board code into the driver. This is a dependency for device tree support.
Signed-off-by Sebastian Reichel <[email protected]>--- arch/arm/mach-omap2/board-omap3pandora.c | 2 ++ arch/arm/mach-omap2/board-rx51-peripherals.c | 11 ++-------- drivers/net/wireless/ti/wl1251/sdio.c | 21 +++++++++++++----- drivers/net/wireless/ti/wl1251/spi.c | 33 ++++++++++++++++++---------- drivers/net/wireless/ti/wl1251/wl1251.h | 2 +- include/linux/wl12xx.h | 2 +- 6 files changed, 43 insertions(+), 28 deletions(-)...
Quoted 7 lines
include/linux/wl12xx.h +0
-0@@ -49,7 +49,7 @@ enum { };Quoted 10 lines
include/linux/wl12xx.h enum {
Quoted 7 lines
include/linux/wl12xx.h +1
-2struct wl1251_platform_data { -void (*set_power)(bool enable); +int power_gpio;/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ int irq;bool use_eeprom; --What a reason for not using regulator API here with GPIO-based regulator?
Quoted 6 lines
I think this pin is not used as power supply, but like an enable pin for low power states. Of course the regulator API could still be (mis?)used for this, but I think it would be the first linux device driver doing this.
Note: I don't have wl1251 documentation.
When wl12xx family of chips is connected through SDIO, we already have that pin set up as a regulator controlled with the help of mmc subsystem. When time comes to communicate with the chip, mmc subsystem sees this as yet another SD card and looks for associated regulator for it, and the board file has that set up as a fixed regulator controlling that pin (see pandora_vmmc3 in arch/arm/mach-omap2/board-omap3pandora.c). To prevent poweroff after first SDIO communications are over, pm_runtime calls are used in drivers/net/wireless/ti/wl1251/sdio.c .
I don't know if something similar can be done done in SPI case, but I'm sure this is not the first your-so-called regulator misuse.
Gra?vydas
Re: [PATCH 2/4] wl1251: move power GPIO handling into the driver
Quoted 9 lines · Grazvydas Ignotas
When wl12xx family of chips is connected through SDIO, we already have that pin set up as a regulator controlled with the help of mmc subsystem. When time comes to communicate with the chip, mmc subsystem sees this as yet another SD card and looks for associated regulator for it, and the board file has that set up as a fixed regulator controlling that pin (see
pandora_vmmc3inarch/arm/mach-omap2/board-omap3pandora.c). To prevent poweroff after first SDIO communications are over,pm_runtimecalls are used indrivers/net/wireless/ti/wl1251/sdio.c.
Is this actually controlling VMMC though, or is it some other control? If it's not controlling VMMC then it shouldn't say that it is.
Quoted 2 lines
I don't know if something similar can be done done in SPI case, but I'm sure this is not the first your-so-called regulator misuse.
It's not the first but that doesn't make controlling something other
than a regulator through the regulator API any less broken.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131028/67407f96/attachment.sig>
Re: [PATCH 2/4] wl1251: move power GPIO handling into the driver
Hi,
Quoted 12 lines · Mark Brown
Quoted 9 lines · Grazvydas Ignotas
When wl12xx family of chips is connected through SDIO, we already have that pin set up as a regulator controlled with the help of mmc subsystem. When time comes to communicate with the chip, mmc subsystem sees this as yet another SD card and looks for associated regulator for it, and the board file has that set up as a fixed regulator controlling that pin (see
pandora_vmmc3inarch/arm/mach-omap2/board-omap3pandora.c). To prevent poweroff after first SDIO communications are over,pm_runtimecalls are used indrivers/net/wireless/ti/wl1251/sdio.c.
Quoted 8 lines
Is this actually controlling VMMC though, or is it some other control? If it's not controlling VMMC then it shouldn't say that it is.
Quoted 2 lines
I don't know if something similar can be done done in SPI case, but I'm sure this is not the first your-so-called regulator misuse.
It's not the first but that doesn't make controlling something other than a regulator through the regulator API any less broken.
I gave it a second try to find out details for this pin:
1. The pin is named PMEN in the Nokia N900 schematics
2. PMEN is described as "Power management enable - system shutdown" in a crippled datasheet of the wl1253, which I found in the internet.
I don't think this is supposed to be handled by the regulator API.
-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131029/4efecc05/attachment.sig>
Re: [PATCH 2/4] wl1251: move power GPIO handling into the driver
Quoted 5 lines · Sebastian Reichel
1. The pin is named PMEN in the Nokia N900 schematics
2. PMEN is described as "Power management enable - system shutdown" in a crippled datasheet of the wl1253, which I found in the internet.I don't think this is supposed to be handled by the regulator API.
I agree, this sounds like a GPIO that the driver should be understanding
directly to me.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131028/76ca3c0e/attachment.sig>
Re: [PATCH 2/4] wl1251: move power GPIO handling into the driver
In reply to Sebastian ReichelQuoted 4 lines · Sebastian Reichel
Move the power GPIO handling from the board code into the driver. This is a dependency for device tree support.
Signed-off-by Sebastian Reichel <[email protected]>
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
PATCH 3/4 wl1251: spi: add vio regulator support
In reply to Sebastian ReichelThis patch adds support for requesting the regulator powering the vio pin.
The patch also adds the regulator for the all boards using the wl1251 in spi mode (only the Nokia N900).
--- arch/arm/mach-omap2/board-rx51-peripherals.c | 2 ++ drivers/net/wireless/ti/wl1251/spi.c | 19 +++++++++++++++++-- drivers/net/wireless/ti/wl1251/wl1251.h | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/board-rx51-peripherals.c +2 -0
@@ -552,6 +552,8 @@ static struct regulator_consumer_supply rx51_vio_supplies[] = {REGULATOR_SUPPLY ("vio" ,"2-0063" ),/* lis3lv02d */ REGULATOR_SUPPLY ("Vdd_IO" ,"3-001d" ), +/* wl1251 */ + REGULATOR_SUPPLY("vio", "spi4.0"), }; static struct regulator_consumer_supply rx51_vaux1_consumers[] = {
drivers/net/wireless/ti/wl1251/spi.c +17 -2
@@ -27,6 +27,7 @@#include <linux/spi/spi.h> #include <linux/wl12xx.h> #include <linux/gpio.h> +#include <linux/regulator/consumer.h> #include "wl1251.h" #include "reg.h"
@@ -306,13 +307,26 @@ static int wl1251_spi_probe(struct spi_device *spi)irq_set_irq_type (wl->irq,IRQ_TYPE_EDGE_RISING ); - ret =wl1251_init_ieee80211 (wl); + wl->vio =devm_regulator_get (&spi->dev,"vio" ); +if (IS_ERR (wl->vio)) { + ret =PTR_ERR (wl->vio); +wl1251_error ("vio regulator missing: %d" , ret); + goto out_free; + } + + ret =regulator_enable (wl->vio);if (ret) goto out_free; + ret =wl1251_init_ieee80211 (wl); +if (ret) + goto disable_regulator; +return 0 ; - out_free: +disable_regulator: +regulator_disable (wl->vio); +out_free:ieee80211_free_hw (hw);return ret;
@@ -324,6 +338,7 @@ static int wl1251_spi_remove(struct spi_device *spi)free_irq (wl->irq, wl);wl1251_free_hw (wl); +regulator_disable (wl->vio);return 0 ; }
drivers/net/wireless/ti/wl1251/wl1251.h +2 -0
@@ -279,6 +279,8 @@ struct wl1251 {int irq;bool use_eeprom; +struct regulator *vio; +spinlock_t wl_lock;enum wl1251_state state;
Signature · 1 line
1.8.4.rc3
Re: [PATCH 3/4] wl1251: spi: add vio regulator support
Quoted 7 lines · Sebastian Reichel
This patch adds support for requesting the regulator powering the vio pin.
The patch also adds the regulator for the all boards using the wl1251 in spi mode (only the Nokia N900).
Signed-off-by Sebastian Reichel <[email protected]>
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
PATCH 4/4 wl1251: spi: add device tree support
In reply to Sebastian ReichelAdd device tree support for the spi variant of wl1251 and document the binding.
--- .../devicetree/bindings/net/wireless/ti,wl1251.txt | 36 ++++++++++++++++++++++ drivers/net/wireless/ti/wl1251/spi.c | 23 ++++++++++---- 2 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +36 -0
@@ -0,0 +1,36 @@ +* Texas Instruments wl1251 controller + +The wl1251 chip can be connected via SPI or via SDIO. The linux +kernel currently only supports device tree for the SPI variant. + +Required properties: +- compatible : Should be "ti,wl1251" +- interrupts : Should contain interrupt line +- interrupt-parent : Should be the phandle for the interrupt + controller that services interrupts for this device +- vio-supply : phandle to regulator providing VIO +- power-gpio : GPIO connected to chip's PMEN pin +- For additional required properties on SPI, please consult + Documentation/devicetree/bindings/spi/spi-bus.txt + +Optional properties: +- ti,use-eeprom : If found, configuration will be loaded from eeprom. + +Examples: + +&spi1 { + wl1251_spi at 0 { + compatible = "ti,wl1251"; + + reg = <0>; + spi-max-frequency = <48000000>; + spi-cpol; + spi-cpha; + + interrupt-parent = <&gpio2>; + interrupts = <10 IRQ_TYPE_NONE>; /* gpio line 42 */ + + vio-supply = <&vio>; + power-gpio = <&gpio3 23 GPIO_ACTIVE_HIGH>; /* 87 */ + }; +};
drivers/net/wireless/ti/wl1251/spi.c +17 -6
@@ -27,6 +27,8 @@#include <linux/spi/spi.h> #include <linux/wl12xx.h> #include <linux/gpio.h> +#include <linux/of.h> +#include <linux/of_gpio.h> #include <linux/regulator/consumer.h> #include "wl1251.h"
@@ -240,13 +242,13 @@ static const struct wl1251_if_operations wl1251_spi_ops = {static int wl1251_spi_probe (struct spi_device *spi) { -struct wl1251_platform_data *pdata; +struct wl1251_platform_data *pdata = spi->dev.platform_data; +struct device_node *np = spi->dev.of_node;struct ieee80211_hw *hw;struct wl1251 *wl;int ret; - pdata = spi->dev.platform_data; -if (!pdata) { +if (!np && !pdata) {wl1251_error ("no platform data" );return -ENODEV ; }
@@ -273,7 +275,18 @@ static int wl1251_spi_probe(struct spi_device *spi) goto out_free; } - wl->power_gpio = pdata->power_gpio; +if (np) { + wl->use_eeprom =of_property_read_bool (np,"ti,use-eeprom" ); + wl->power_gpio =of_get_named_gpio (np,"power-gpio" ,0 ); + }else if (pdata) { + wl->power_gpio = pdata->power_gpio; + wl->use_eeprom = pdata->use_eeprom; + } + +if (wl->power_gpio == -EPROBE_DEFER ) { + ret = -EPROBE_DEFER ; + goto out_free; + }if (gpio_is_valid (wl->power_gpio)) { ret = devm_gpio_request_one(&spi->dev, wl->power_gpio,
@@ -295,8 +308,6 @@ static int wl1251_spi_probe(struct spi_device *spi) goto out_free; } - wl->use_eeprom = pdata->use_eeprom; -irq_set_status_flags (wl->irq,IRQ_NOAUTOEN ); ret =devm_request_irq (&spi->dev, wl->irq, wl1251_irq,0 ,DRIVER_NAME , wl);
Signature · 1 line
1.8.4.rc3
Re: [PATCH 4/4] wl1251: spi: add device tree support
Quoted 22 lines · Sebastian Reichel
Add device tree support for the spi variant of wl1251 and document the binding.
Signed-off-by Sebastian Reichel <[email protected]>---
.../devicetree/bindings/net/wireless/ti,wl1251.txt| 36 ++++++++++++++++++++++drivers/net/wireless/ti/wl1251/spi.c| 23 ++++++++++----2 files changed, 53 insertions(+), 6 deletions(-)create mode 100644
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txtDocumentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +5
-0@@ -0,0 +1,36 @@ +* Texas Instruments wl1251 controller + +The wl1251 chip can be connected via SPI or via SDIO. The linux +kernel currently only supports device tree for the SPI variant. +
Quoted 1 line
From the binding I have no idea what this chip actually does, also we don't normally reference linux kernel support in bindings specs (so please remove it).
However, what would expect the SDIO binding to look like? Or more specifically, how would you distinguish the SPI vs SDIO binding/connection? I'm wondering if the compatible should be something like "ti,wl1251-spi" and than the sdio can be "ti,wl1251-sdio"
Quoted 2 lines
+Required properties:
+- compatible : Should be "ti,wl1251"
reg is not listed as a required prop.
Quoted 5 lines
+- interrupts : Should contain interrupt line +- interrupt-parent : Should be the phandle for the interrupt + controller that services interrupts for this device +- vio-supply : phandle to regulator providing VIO +- power-gpio : GPIO connected to chip's PMEN pin
should be vendor prefixed: ti,power-gpio
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt line 17
Quoted 5 lines
+- For additional required properties on SPI, please consult
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +4
-0+ Documentation/devicetree/bindings/spi/spi-bus.txt + +Optional properties: +- ti,use-eeprom : If found, configuration will be loaded from eeprom.
can you be a bit more specific on what cfg will be loaded. Also, is this property a boolean, if so how do I know which eeprom the cfg is loaded from (is it one that is directly connected to the wl1251?
Quoted 19 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +19
-0+ +Examples: + +&spi1 { + wl1251_spi at 0 { + compatible = "ti,wl1251"; + + reg = <0>; + spi-max-frequency = <48000000>; + spi-cpol; + spi-cpha; + + interrupt-parent = <&gpio2>; + interrupts = <10 IRQ_TYPE_NONE>; /* gpio line 42 */ + + vio-supply = <&vio>; + power-gpio = <&gpio3 23 GPIO_ACTIVE_HIGH>; /* 87 */ + }; +};
Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH 4/4] wl1251: spi: add device tree support
Quoted 11 lines · Kumar Gala
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt line 5
Quoted 7 lines · Sebastian Reichel
+++
b/Documentation/devicetree/bindings/net/wireless/ti,wl1251.txtDocumentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +5
-0@@ -0,0 +1,36 @@ +* Texas Instruments wl1251 controller + +The wl1251 chip can be connected via SPI or via SDIO. The linux +kernel currently only supports device tree for the SPI variant. +From the binding I have no idea what this chip actually does, also we don't normally reference linux kernel support in bindings specs (so please remove it).
Quoted 1 line
However, what would expect the SDIO binding to look like? Or more specifically, how would you distinguish the SPI vs SDIO binding/connection? I'm wondering if the compatible should be something like "ti,wl1251-spi" and than the sdio can be "ti,wl1251-sdio"
When connected to SDIO, it doesn't act as standard SDIO device and can't be probed (standard SDIO registers missing), so information has to come some other way. That used to partially come through platform_data and partially through a callback from mmc subsystem (see pandora_wl1251_init_card() in arch/arm/mach-omap2/board-omap3pandora.c). I don't know much about DT, but maybe the information that comes from SDIO registers on "normal" SDIO devices should come through DT in this case too? I don't really know how that should be integrated with mmc subsystem though..
Quoted 13 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt line 7
Quoted 2 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +2
-0+Required properties: +- compatible : Should be "ti,wl1251"reg is not listed as a required prop.
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt line 12
Quoted 5 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +5
-0+- interrupts : Should contain interrupt line +- interrupt-parent : Should be the phandle for the interrupt + controller that services interrupts for this device +- vio-supply : phandle to regulator providing VIO +- power-gpio : GPIO connected to chip's PMEN pinshould be vendor prefixed: ti,power-gpio
Quoted 7 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt line 17
Quoted 5 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +5
-0+- For additional required properties on SPI, please consult + Documentation/devicetree/bindings/spi/spi-bus.txt + +Optional properties: +- ti,use-eeprom : If found, configuration will be loaded from eeprom.can you be a bit more specific on what cfg will be loaded. Also, is this property a boolean, if so how do I know which eeprom the cfg is loaded from (is it one that is directly connected to the wl1251?
wl1251 is a wifi chip that can have an optional eeprom connected to it to store things like calibration stuff and MAC address, and that eeprom is usually inside a single module with some additional radio related chips. If the eeprom is connected (like the module on pandora board has), the driver can issue command to the firmware running on chip to load that data on it's startup, alternatively the driver can load calibration from other storage (like it happens on N900).
Gra?vydas
Re: [PATCH 4/4] wl1251: spi: add device tree support
Quoted 14 lines · Grazvydas Ignotas
Quoted 11 lines · Kumar Gala
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt line 5
Quoted 7 lines · Sebastian Reichel
+++
b/Documentation/devicetree/bindings/net/wireless/ti,wl1251.txtDocumentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +5
-0@@ -0,0 +1,36 @@ +* Texas Instruments wl1251 controller + +The wl1251 chip can be connected via SPI or via SDIO. The linux +kernel currently only supports device tree for the SPI variant. +From the binding I have no idea what this chip actually does, also we don't normally reference linux kernel support in bindings specs (so please remove it).
Quoted 1 line
However, what would expect the SDIO binding to look like? Or more specifically, how would you distinguish the SPI vs SDIO binding/connection? I'm wondering if the compatible should be something like "ti,wl1251-spi" and than the sdio can be "ti,wl1251-sdio"
Quoted 9 lines
When connected to SDIO, it doesn't act as standard SDIO device and can't be probed (standard SDIO registers missing), so information has to come some other way. That used to partially come through
platform_dataand partially through a callback from mmc subsystem (seepandora_wl1251_init_card()inarch/arm/mach-omap2/board-omap3pandora.c). I don't know much about DT, but maybe the information that comes from SDIO registers on "normal" SDIO devices should come through DT in this case too? I don't really know how that should be integrated with mmc subsystem though..
Ok, my point is still valid that we can use a different compatible for the SDIO case even if its no standard SDIO vs the SPI case.
Quoted 22 lines
Quoted 14 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt line 7
Quoted 3 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +2
-0+Required properties: +- compatible : Should be "ti,wl1251"reg is not listed as a required prop.
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt line 12
Quoted 5 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +5
-0+- interrupts : Should contain interrupt line +- interrupt-parent : Should be the phandle for the interrupt + controller that services interrupts for this device +- vio-supply : phandle to regulator providing VIO +- power-gpio : GPIO connected to chip's PMEN pinshould be vendor prefixed: ti,power-gpio
Quoted 7 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt line 17
Quoted 5 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +5
-0+- For additional required properties on SPI, please consult + Documentation/devicetree/bindings/spi/spi-bus.txt + +Optional properties: +- ti,use-eeprom : If found, configuration will be loaded from eeprom.can you be a bit more specific on what cfg will be loaded. Also, is this property a boolean, if so how do I know which eeprom the cfg is loaded from (is it one that is directly connected to the wl1251?
Quoted 7 lines
wl1251 is a wifi chip that can have an optional eeprom connected to it to store things like calibration stuff and MAC address, and that eeprom is usually inside a single module with some additional radio related chips. If the eeprom is connected (like the module on pandora board has), the driver can issue command to the firmware running on chip to load that data on it's startup, alternatively the driver can load calibration from other storage (like it happens on N900).
So sounds like a boolean. I think just adding that its a boolean and maybe something like "configuration (calibration data, MAC addr, etc..)"
- k
Quoted 7 lines
Gra?vydas
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH 4/4] wl1251: spi: add device tree support
In reply to Kumar GalaQuoted 31 lines · On Monday 28 of October 2013 01:37:34 Kumar Gala wrote:
Quoted 20 lines · Sebastian Reichel
Add device tree support for the spi variant of wl1251 and document the binding.
Signed-off-by Sebastian Reichel <[email protected]>---
.../devicetree/bindings/net/wireless/ti,wl1251.txt| 36 ++++++++++++++++++++++drivers/net/wireless/ti/wl1251/spi.c| 23 ++++++++++---- 2 files changed, 53 insertions(+), 6deletions(-)
create mode 100644Documentation/devicetree/bindings/net/wireless/ti,wl1251.txtdiff --git
a/Documentation/devicetree/bindings/net/wireless/ti,wl1251.txtb/Documentation/devicetree/bindings/net/wireless/ti,wl1251.txtnew file mode 100644
index 0000000..5f8a154Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt line 5
Quoted 5 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +5
-0@@ -0,0 +1,36 @@ +* Texas Instruments wl1251 controller + +The wl1251 chip can be connected via SPI or via SDIO. The linux +kernel currently only supports device tree for the SPI variant. +From the binding I have no idea what this chip actually does, also we don't normally reference linux kernel support in bindings specs (so please remove it).
Quoted 5 lines
However, what would expect the SDIO binding to look like? Or more specifically, how would you distinguish the SPI vs SDIO binding/connection? I'm wondering if the compatible should be something like "ti,wl1251-spi" and than the sdio can be "ti,wl1251-sdio"
Well, you can easily distinguish an SDIO device from an SPI device by its parent node, but...
The binding for SDIO might require different set of properties (other than ones inherited from generic SDIO or SPI bindings) than one for SPI. So probably different compatible values might be justified.
Did we already have such case before? (maybe some I2C + SPI devices?)
Quoted 4 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt line 7
Quoted 2 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +2
-0+Required properties: +- compatible : Should be "ti,wl1251"reg is not listed as a required prop.
It is implied by SPI bindings, but it might be a good idea to have this stated here as well.
Quoted 8 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt line 12
Quoted 6 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +5
-0+- interrupts : Should contain interrupt line +- interrupt-parent : Should be the phandle for the interrupt + controller that services interrupts for this device +- vio-supply : phandle to regulator providing VIO +- power-gpio : GPIO connected to chip's PMEN pinshould be vendor prefixed: ti,power-gpio
Hmm, out of curiosity, is it a rule for this kind of properties? I can see both cases with and without prefixes when grepping for "-gpios" in Documentation/devicetree/bindings. We should really have such things written down somewhere.
Quoted 10 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt line 17
Quoted 6 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +5
-0+- For additional required properties on SPI, please consult + Documentation/devicetree/bindings/spi/spi-bus.txt + +Optional properties: +- ti,use-eeprom : If found, configuration will be loaded from eeprom.can you be a bit more specific on what cfg will be loaded. Also, is this property a boolean, if so how do I know which eeprom the cfg is loaded from (is it one that is directly connected to the wl1251?
Maybe one from ti,has-eeprom or ti,config-eeprom would be better name for this property?
Best regards,
Tomasz
Re: [PATCH 4/4] wl1251: spi: add device tree support
Quoted 62 lines · Tomasz Figa
Quoted 31 lines · On Monday 28 of October 2013 01:37:34 Kumar Gala wrote:
Quoted 20 lines · Sebastian Reichel
Add device tree support for the spi variant of wl1251 and document the binding.
Signed-off-by Sebastian Reichel <[email protected]>---
.../devicetree/bindings/net/wireless/ti,wl1251.txt| 36 ++++++++++++++++++++++drivers/net/wireless/ti/wl1251/spi.c
| 23 ++++++++++---- 2 files changed, 53 insertions(+), 6
deletions(-)
create mode 100644Documentation/devicetree/bindings/net/wireless/ti,wl1251.txtdiff --git
a/Documentation/devicetree/bindings/net/wireless/ti,wl1251.txtb/Documentation/devicetree/bindings/net/wireless/ti,wl1251.txtnew file mode 100644
index 0000000..5f8a154Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt line 5
Quoted 5 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +5
-0@@ -0,0 +1,36 @@ +* Texas Instruments wl1251 controller + +The wl1251 chip can be connected via SPI or via SDIO. The linux +kernel currently only supports device tree for the SPI variant. +From the binding I have no idea what this chip actually does, also we don't normally reference linux kernel support in bindings specs (so please remove it).
Quoted 5 lines
However, what would expect the SDIO binding to look like? Or more specifically, how would you distinguish the SPI vs SDIO binding/connection? I'm wondering if the compatible should be something like "ti,wl1251-spi" and than the sdio can be "ti,wl1251-sdio"
Well, you can easily distinguish an SDIO device from an SPI device by its parent node, but...
The binding for SDIO might require different set of properties (other than ones inherited from generic SDIO or SPI bindings) than one for SPI. So probably different compatible values might be justified.
Did we already have such case before? (maybe some I2C + SPI devices?)
Quoted 4 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt line 7
Quoted 2 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +2
-0+Required properties: +- compatible : Should be "ti,wl1251"reg is not listed as a required prop.
It is implied by SPI bindings, but it might be a good idea to have this stated here as well.
Quoted 7 lines
Quoted 6 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +5
-0+- interrupts : Should contain interrupt line +- interrupt-parent : Should be the phandle for the interrupt + controller that services interrupts for this device +- vio-supply : phandle to regulator providing VIO +- power-gpio : GPIO connected to chip's PMEN pin
Quoted 6 lines
Quoted 1 line
should be vendor prefixed: ti,power-gpio
Hmm, out of curiosity, is it a rule for this kind of properties? I can see both cases with and without prefixes when grepping for "-gpios" in
Documentation/devicetree/bindings. We should really have such things written down somewhere.
Agreed, it should be part of the various docs we are suppose to produce for review and binding creation guidelines.
Quoted 10 lines
Quoted 9 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt line 17
Quoted 5 lines
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +5
-0+- For additional required properties on SPI, please consult + Documentation/devicetree/bindings/spi/spi-bus.txt + +Optional properties: +- ti,use-eeprom : If found, configuration will be loaded from eeprom.can you be a bit more specific on what cfg will be loaded. Also, is this property a boolean, if so how do I know which eeprom the cfg is loaded from (is it one that is directly connected to the wl1251?
Quoted 2 lines
Maybe one from ti,has-eeprom or ti,config-eeprom would be better name for this property?
Probably, ti,wl1251-has-eeprom or something like that would be better. However, I'm not going to get too caught up on names of properties.
- k
Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
v2 cover wl1251 device tree support
In reply to Sebastian ReichelHi,
The following patchset adds device tree support to the spi variant of the wl1251 driver.
Changes since v1 [0]:
* Added some Reviewed-By: Pavel Machek
* Splitted DT binding documentation into its own patch
* Added ti, prefix to power-gpio
* Renamed ti,use-eeprom to ti,wl1251-has-eeprom
* Updated description for ti,wl1251-has-eeprom
* Removed boardcode update from regulator patch to avoid useless merge conflicts (all relevant boardcode will be removed in 3.14).
[0] https://lkml.org/lkml/2013/10/27/112
-- Sebastian
Luciano Coelho (1):
wl1251: split wl251 platform data to a separate structure
Sebastian Reichel (4):
wl1251: move power GPIO handling into the driver
wl1251: spi: add vio regulator support
wl1251: spi: add device tree support
Documentation: dt: wireless: Add wl1251
.../devicetree/bindings/net/wireless/ti,wl1251.txt | 39 ++++++++++++ arch/arm/mach-omap2/board-omap3pandora.c | 6 +- arch/arm/mach-omap2/board-rx51-peripherals.c | 13 +--- drivers/net/wireless/ti/wilink_platform_data.c | 37 +++++++++-- drivers/net/wireless/ti/wl1251/sdio.c | 31 +++++++--- drivers/net/wireless/ti/wl1251/spi.c | 71 ++++++++++++++++------ drivers/net/wireless/ti/wl1251/wl1251.h | 4 +- include/linux/wl12xx.h | 24 +++++++- 8 files changed, 176 insertions(+), 49 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt
Signature · 6 lines
1.8.4.3 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 1/5 wl1251: split wl251 platform data to a separate structure
From: Luciano Coelho <[email protected]>
Move the wl1251 part of the wl12xx platform data structure into a new structure specifically for wl1251. Change the platform data built-in block and board files accordingly.
--- arch/arm/mach-omap2/board-omap3pandora.c | 4 +-- arch/arm/mach-omap2/board-rx51-peripherals.c | 2 +- drivers/net/wireless/ti/wilink_platform_data.c | 37 +++++++++++++++++++++----- drivers/net/wireless/ti/wl1251/sdio.c | 12 ++++----- drivers/net/wireless/ti/wl1251/spi.c | 2 +- include/linux/wl12xx.h | 22 ++++++++++++++- 6 files changed, 62 insertions(+), 17 deletions(-)
arch/arm/mach-omap2/board-omap3pandora.c +2 -2
@@ -536,7 +536,7 @@ static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {static void __init pandora_wl1251_init (void ) { -struct wl12xx_platform_data pandora_wl1251_pdata; +struct wl1251_platform_data pandora_wl1251_pdata;int ret;memset (&pandora_wl1251_pdata,0 ,sizeof (pandora_wl1251_pdata));
@@ -550,7 +550,7 @@ static void __init pandora_wl1251_init(void) goto fail_irq; pandora_wl1251_pdata.use_eeprom = true; - ret =wl12xx_set_platform_data (&pandora_wl1251_pdata); + ret =wl1251_set_platform_data (&pandora_wl1251_pdata);if (ret <0 ) goto fail_irq;
arch/arm/mach-omap2/board-rx51-peripherals.c +1 -1
@@ -84,7 +84,7 @@ enum { RX51_SPI_MIPID, /* LCD panel */ }; -static struct wl12xx_platform_data wl1251_pdata; +static struct wl1251_platform_data wl1251_pdata;static struct tsc2005_platform_data tsc2005_pdata;#if defined(CONFIG_SENSORS_LIS3_I2C ) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE )
drivers/net/wireless/ti/wilink_platform_data.c +31 -6
@@ -23,17 +23,17 @@#include <linux/err.h> #include <linux/wl12xx.h> -static struct wl12xx_platform_data *platform_data; +static struct wl12xx_platform_data *wl12xx_platform_data;int __init wl12xx_set_platform_data (const struct wl12xx_platform_data *data) { -if (platform_data) +if (wl12xx_platform_data)return -EBUSY ;if (!data)return -EINVAL ; - platform_data =kmemdup (data,sizeof (*data),GFP_KERNEL ); -if (!platform_data) + wl12xx_platform_data =kmemdup (data,sizeof (*data),GFP_KERNEL ); +if (!wl12xx_platform_data)return -ENOMEM ;return 0 ;
@@ -41,9 +41,34 @@ int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)struct wl12xx_platform_data *wl12xx_get_platform_data (void ) { -if (!platform_data) +if (!wl12xx_platform_data)return ERR_PTR (-ENODEV ); -return platform_data; +return wl12xx_platform_data; }EXPORT_SYMBOL (wl12xx_get_platform_data); + +static struct wl1251_platform_data *wl1251_platform_data; + +int __init wl1251_set_platform_data (const struct wl1251_platform_data *data) +{ +if (wl1251_platform_data) +return -EBUSY ; +if (!data) +return -EINVAL ; + + wl1251_platform_data =kmemdup (data,sizeof (*data),GFP_KERNEL ); +if (!wl1251_platform_data) +return -ENOMEM ; + +return 0 ; +} + +struct wl1251_platform_data *wl1251_get_platform_data (void ) +{ +if (!wl1251_platform_data) +return ERR_PTR (-ENODEV ); + +return wl1251_platform_data; +} +EXPORT_SYMBOL (wl1251_get_platform_data);
drivers/net/wireless/ti/wl1251/sdio.c +6 -6
@@ -227,7 +227,7 @@ static int wl1251_sdio_probe(struct sdio_func *func,struct wl1251 *wl;struct ieee80211_hw *hw;struct wl1251_sdio *wl_sdio; -const struct wl12xx_platform_data *wl12xx_board_data; +const struct wl1251_platform_data *wl1251_board_data; hw =wl1251_alloc_hw ();if (IS_ERR (hw))
@@ -254,11 +254,11 @@ static int wl1251_sdio_probe(struct sdio_func *func, wl->if_priv = wl_sdio; wl->if_ops = &wl1251_sdio_ops; - wl12xx_board_data =wl12xx_get_platform_data (); -if (!IS_ERR (wl12xx_board_data)) { - wl->set_power = wl12xx_board_data->set_power; - wl->irq = wl12xx_board_data->irq; - wl->use_eeprom = wl12xx_board_data->use_eeprom; + wl1251_board_data =wl1251_get_platform_data (); +if (!IS_ERR (wl1251_board_data)) { + wl->set_power = wl1251_board_data->set_power; + wl->irq = wl1251_board_data->irq; + wl->use_eeprom = wl1251_board_data->use_eeprom; }if (wl->irq) {
drivers/net/wireless/ti/wl1251/spi.c +1 -1
@@ -238,7 +238,7 @@ static const struct wl1251_if_operations wl1251_spi_ops = {static int wl1251_spi_probe (struct spi_device *spi) { -struct wl12xx_platform_data *pdata; +struct wl1251_platform_data *pdata;struct ieee80211_hw *hw;struct wl1251 *wl;int ret;
include/linux/wl12xx.h +21 -1
@@ -48,11 +48,15 @@ enum { WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */ }; -struct wl12xx_platform_data { +struct wl1251_platform_data {void (*set_power)(bool enable);/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ int irq;bool use_eeprom; +}; + +struct wl12xx_platform_data { +int irq;int board_ref_clock;int board_tcxo_clock;unsigned long platform_quirks;
@@ -68,6 +72,10 @@ int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);struct wl12xx_platform_data *wl12xx_get_platform_data (void ); +int wl1251_set_platform_data (const struct wl1251_platform_data *data); + +struct wl1251_platform_data *wl1251_get_platform_data (void ); +#else static inline
@@ -82,6 +90,18 @@ struct wl12xx_platform_data *wl12xx_get_platform_data(void)return ERR_PTR (-ENODATA ); } +static inline +int wl1251_set_platform_data (const struct wl1251_platform_data *data) +{ +return -ENOSYS ; +} + +static inline +struct wl1251_platform_data *wl1251_get_platform_data (void ) +{ +return ERR_PTR (-ENODATA ); +} +#endif #endif
Signature · 1 line
1.8.4.3
PATCH v2 2/5 wl1251: move power GPIO handling into the driver
In reply to Sebastian ReichelMove the power GPIO handling from the board code into the driver. This is a dependency for device tree support.
--- arch/arm/mach-omap2/board-omap3pandora.c | 2 ++ arch/arm/mach-omap2/board-rx51-peripherals.c | 11 ++-------- drivers/net/wireless/ti/wl1251/sdio.c | 21 +++++++++++++----- drivers/net/wireless/ti/wl1251/spi.c | 33 ++++++++++++++++++---------- drivers/net/wireless/ti/wl1251/wl1251.h | 2 +- include/linux/wl12xx.h | 2 +- 6 files changed, 43 insertions(+), 28 deletions(-)
arch/arm/mach-omap2/board-omap3pandora.c +2 -0
@@ -541,6 +541,8 @@ static void __init pandora_wl1251_init(void)memset (&pandora_wl1251_pdata,0 ,sizeof (pandora_wl1251_pdata)); + pandora_wl1251_pdata.power_gpio =-1 ; + ret =gpio_request_one (PANDORA_WIFI_IRQ_GPIO ,GPIOF_IN ,"wl1251 irq" );if (ret <0 ) goto fail;
arch/arm/mach-omap2/board-rx51-peripherals.c +2 -9
@@ -1166,13 +1166,7 @@ static inline void board_smc91x_init(void)#endif -static void rx51_wl1251_set_power (bool enable) -{ -gpio_set_value (RX51_WL1251_POWER_GPIO , enable); -} -static struct gpio rx51_wl1251_gpios[]__initdata = { - {RX51_WL1251_POWER_GPIO ,GPIOF_OUT_INIT_LOW ,"wl1251 power" }, {RX51_WL1251_IRQ_GPIO ,GPIOF_IN ,"wl1251 irq" }, };
@@ -1189,17 +1183,16 @@ static void __init rx51_init_wl1251(void)if (irq <0 ) goto err_irq; - wl1251_pdata.set_power = rx51_wl1251_set_power; + wl1251_pdata.power_gpio =RX51_WL1251_POWER_GPIO ; rx51_peripherals_spi_board_info[RX51_SPI_WL1251 ].irq = irq;return ; err_irq:gpio_free (RX51_WL1251_IRQ_GPIO ); -gpio_free (RX51_WL1251_POWER_GPIO ); error:printk (KERN_ERR "wl1251 board initialisation failed\n" ); - wl1251_pdata.set_power =NULL ; + wl1251_pdata.power_gpio =-1 ;/* * Now rx51_peripherals_spi_board_info[1].irq is zero and
drivers/net/wireless/ti/wl1251/sdio.c +16 -5
@@ -28,6 +28,7 @@#include <linux/wl12xx.h> #include <linux/irq.h> #include <linux/pm_runtime.h> +#include <linux/gpio.h> #include "wl1251.h"
@@ -182,8 +183,9 @@ static int wl1251_sdio_set_power(struct wl1251 *wl, bool enable)* callback in case it wants to do any additional setup, * for example enabling clock buffer for the module. */ -if (wl->set_power) - wl->set_power (true); +if (gpio_is_valid (wl->power_gpio)) +gpio_set_value (wl->power_gpio, true); + ret =pm_runtime_get_sync (&func->dev);if (ret <0 ) {
@@ -203,8 +205,8 @@ static int wl1251_sdio_set_power(struct wl1251 *wl, bool enable)if (ret <0 ) goto out; -if (wl->set_power) - wl->set_power (false); +if (gpio_is_valid (wl->power_gpio)) +gpio_set_value (wl->power_gpio, false); } out:
@@ -256,11 +258,20 @@ static int wl1251_sdio_probe(struct sdio_func *func, wl1251_board_data =wl1251_get_platform_data ();if (!IS_ERR (wl1251_board_data)) { - wl->set_power = wl1251_board_data->set_power; + wl->power_gpio = wl1251_board_data->power_gpio; wl->irq = wl1251_board_data->irq; wl->use_eeprom = wl1251_board_data->use_eeprom; } +if (gpio_is_valid (wl->power_gpio)) { + ret =devm_gpio_request (&func->dev, wl->power_gpio, +"wl1251 power" ); +if (ret) { +wl1251_error ("Failed to request gpio: %d\n" , ret); + goto disable; + } + } +if (wl->irq) {irq_set_status_flags (wl->irq,IRQ_NOAUTOEN ); ret =request_irq (wl->irq, wl1251_line_irq,0 ,"wl1251" , wl);
drivers/net/wireless/ti/wl1251/spi.c +21 -12
@@ -26,6 +26,7 @@#include <linux/crc7.h> #include <linux/spi/spi.h> #include <linux/wl12xx.h> +#include <linux/gpio.h> #include "wl1251.h" #include "reg.h"
@@ -221,8 +222,8 @@ static void wl1251_spi_disable_irq(struct wl1251 *wl)static int wl1251_spi_set_power (struct wl1251 *wl,bool enable) { -if (wl->set_power) - wl->set_power (enable); +if (gpio_is_valid (wl->power_gpio)) +gpio_set_value (wl->power_gpio, enable);return 0 ; }
@@ -271,22 +272,33 @@ static int wl1251_spi_probe(struct spi_device *spi) goto out_free; } - wl->set_power = pdata->set_power; -if (!wl->set_power) { -wl1251_error ("set power function missing in platform data" ); -return -ENODEV ; + wl->power_gpio = pdata->power_gpio; + +if (gpio_is_valid (wl->power_gpio)) { + ret =devm_gpio_request_one (&spi->dev, wl->power_gpio, +GPIOF_OUT_INIT_LOW ,"wl1251 power" ); +if (ret) { +wl1251_error ("Failed to request gpio: %d\n" , ret); + goto out_free; + } + }else { +wl1251_error ("set power gpio missing in platform data" ); + ret = -ENODEV ; + goto out_free; } wl->irq = spi->irq;if (wl->irq <0 ) {wl1251_error ("irq missing in platform data" ); -return -ENODEV ; + ret = -ENODEV ; + goto out_free; } wl->use_eeprom = pdata->use_eeprom;irq_set_status_flags (wl->irq,IRQ_NOAUTOEN ); - ret =request_irq (wl->irq, wl1251_irq,0 ,DRIVER_NAME , wl); + ret =devm_request_irq (&spi->dev, wl->irq, wl1251_irq,0 , +DRIVER_NAME , wl);if (ret <0 ) {wl1251_error ("request_irq() failed: %d" , ret); goto out_free;
@@ -296,13 +308,10 @@ static int wl1251_spi_probe(struct spi_device *spi) ret =wl1251_init_ieee80211 (wl);if (ret) - goto out_irq; + goto out_free;return 0 ; - out_irq: -free_irq (wl->irq, wl); - out_free:ieee80211_free_hw (hw);
drivers/net/wireless/ti/wl1251/wl1251.h +1 -1
@@ -275,7 +275,7 @@ struct wl1251 {void *if_priv;const struct wl1251_if_operations *if_ops; -void (*set_power)(bool enable); +int power_gpio;int irq;bool use_eeprom;
include/linux/wl12xx.h +1 -1
@@ -49,7 +49,7 @@ enum { };struct wl1251_platform_data { -void (*set_power)(bool enable); +int power_gpio;/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ int irq;bool use_eeprom;
Signature · 1 line
1.8.4.3
PATCH v2 3/5 wl1251: spi: add vio regulator support
In reply to Sebastian ReichelThis patch adds support for requesting the regulator powering the vio pin.
--- drivers/net/wireless/ti/wl1251/spi.c | 19 +++++++++++++++++-- drivers/net/wireless/ti/wl1251/wl1251.h | 2 ++ 2 files changed, 19 insertions(+), 2 deletions(-)
drivers/net/wireless/ti/wl1251/spi.c +17 -2
@@ -27,6 +27,7 @@#include <linux/spi/spi.h> #include <linux/wl12xx.h> #include <linux/gpio.h> +#include <linux/regulator/consumer.h> #include "wl1251.h" #include "reg.h"
@@ -306,13 +307,26 @@ static int wl1251_spi_probe(struct spi_device *spi)irq_set_irq_type (wl->irq,IRQ_TYPE_EDGE_RISING ); - ret =wl1251_init_ieee80211 (wl); + wl->vio =devm_regulator_get (&spi->dev,"vio" ); +if (IS_ERR (wl->vio)) { + ret =PTR_ERR (wl->vio); +wl1251_error ("vio regulator missing: %d" , ret); + goto out_free; + } + + ret =regulator_enable (wl->vio);if (ret) goto out_free; + ret =wl1251_init_ieee80211 (wl); +if (ret) + goto disable_regulator; +return 0 ; - out_free: +disable_regulator: +regulator_disable (wl->vio); +out_free:ieee80211_free_hw (hw);return ret;
@@ -324,6 +338,7 @@ static int wl1251_spi_remove(struct spi_device *spi)free_irq (wl->irq, wl);wl1251_free_hw (wl); +regulator_disable (wl->vio);return 0 ; }
drivers/net/wireless/ti/wl1251/wl1251.h +2 -0
@@ -279,6 +279,8 @@ struct wl1251 {int irq;bool use_eeprom; +struct regulator *vio; +spinlock_t wl_lock;enum wl1251_state state;
Signature · 1 line
1.8.4.3
PATCH v2 4/5 wl1251: spi: add device tree support
In reply to Sebastian ReichelAdd device tree support for the spi variant of wl1251.
--- drivers/net/wireless/ti/wl1251/spi.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/net/wireless/ti/wl1251/spi.c +17 -6
@@ -27,6 +27,8 @@#include <linux/spi/spi.h> #include <linux/wl12xx.h> #include <linux/gpio.h> +#include <linux/of.h> +#include <linux/of_gpio.h> #include <linux/regulator/consumer.h> #include "wl1251.h"
@@ -240,13 +242,13 @@ static const struct wl1251_if_operations wl1251_spi_ops = {static int wl1251_spi_probe (struct spi_device *spi) { -struct wl1251_platform_data *pdata; +struct wl1251_platform_data *pdata =dev_get_platdata (&spi->dev); +struct device_node *np = spi->dev.of_node;struct ieee80211_hw *hw;struct wl1251 *wl;int ret; - pdata =dev_get_platdata (&spi->dev); -if (!pdata) { +if (!np && !pdata) {wl1251_error ("no platform data" );return -ENODEV ; }
@@ -273,7 +275,18 @@ static int wl1251_spi_probe(struct spi_device *spi) goto out_free; } - wl->power_gpio = pdata->power_gpio; +if (np) { + wl->use_eeprom =of_property_read_bool (np,"ti,wl1251-has-eeprom" ); + wl->power_gpio =of_get_named_gpio (np,"ti,power-gpio" ,0 ); + }else if (pdata) { + wl->power_gpio = pdata->power_gpio; + wl->use_eeprom = pdata->use_eeprom; + } + +if (wl->power_gpio == -EPROBE_DEFER ) { + ret = -EPROBE_DEFER ; + goto out_free; + }if (gpio_is_valid (wl->power_gpio)) { ret = devm_gpio_request_one(&spi->dev, wl->power_gpio,
@@ -295,8 +308,6 @@ static int wl1251_spi_probe(struct spi_device *spi) goto out_free; } - wl->use_eeprom = pdata->use_eeprom; -irq_set_status_flags (wl->irq,IRQ_NOAUTOEN ); ret =devm_request_irq (&spi->dev, wl->irq, wl1251_irq,0 ,DRIVER_NAME , wl);
Signature · 1 line
1.8.4.3
PATCH v2 5/5 Documentation: dt: wireless: Add wl1251
In reply to Sebastian ReichelAdd device tree binding documentation for Texas Instrument's wl1251 wireless lan chip. For now only the SPI binding is documented.
--- .../devicetree/bindings/net/wireless/ti,wl1251.txt | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +39 -0
@@ -0,0 +1,39 @@ +* Texas Instruments wl1251 wireless lan controller + +The wl1251 chip can be connected via SPI or via SDIO. This +document describes the binding for the SPI connected chip. + +Required properties: +- compatible : Should be "ti,wl1251" +- reg : Chip select address of device +- spi-max-frequency : Maximum SPI clocking speed of device in Hz +- interrupts : Should contain interrupt line +- interrupt-parent : Should be the phandle for the interrupt controller + that services interrupts for this device +- vio-supply : phandle to regulator providing VIO +- ti,power-gpio : GPIO connected to chip's PMEN pin + +Optional properties: +- ti,wl1251-has-eeprom : boolean, the wl1251 has an eeprom connected, which + provides configuration data (calibration, MAC, ...) +- Please consult Documentation/devicetree/bindings/spi/spi-bus.txt + for optional SPI connection related properties, + +Examples: + +&spi1 { + wl1251@0 { + compatible = "ti,wl1251"; + + reg = <0>; + spi-max-frequency = <48000000>; + spi-cpol; + spi-cpha; + + interrupt-parent = <&gpio2>; + interrupts = <10 IRQ_TYPE_NONE>; /* gpio line 42 */ + + vio-supply = <&vio>; + ti,power-gpio = <&gpio3 23 GPIO_ACTIVE_HIGH>; /* 87 */ + }; +};
Signature · 1 line
1.8.4.3
Hi John,
Quoted 11 lines
The following patchset adds device tree support to the spi variant of the wl1251 driver.
Luciano Coelho (1):
wl1251: split wl251 platform data to a separate structureSebastian Reichel (4):
wl1251: move power GPIO handling into the driver
wl1251: spi: add vio regulator support
wl1251: spi: add device tree support
Documentation: dt: wireless: Add wl1251
What's the status of this patchset? Tony prepared an immutable branch for patches 1+2 [0]. I think the other patches are also ok (at least there were no more complains from the DT binding maintainers). It would be nice to have wl1251 DT support in 3.14.
[0] http://www.spinics.net/lists/linux-omap/msg101165.html
-- Sebastian
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 14 lines · Sebastian Reichel
Hi John,
Quoted 11 lines
The following patchset adds device tree support to the spi variant of the wl1251 driver.
Luciano Coelho (1):
wl1251: split wl251 platform data to a separate structureSebastian Reichel (4):
wl1251: move power GPIO handling into the driver
wl1251: spi: add vio regulator support
wl1251: spi: add device tree support
Documentation: dt: wireless: Add wl1251
Quoted 8 lines
What's the status of this patchset? Tony prepared an immutable branch for patches 1+2 [0]. I think the other patches are also ok (at least there were no more complains from the DT binding maintainers). It would be nice to have wl1251 DT support in 3.14.
[0] http://www.spinics.net/lists/linux-omap/msg101165.html
-- Sebastian
ping? I can't see it on wireless-next.
-- Sebastian
Quoted 20 lines · Sebastian Reichel
Quoted 19 lines · Sebastian Reichel
Hi John,
Quoted 11 lines
The following patchset adds device tree support to the spi variant of the wl1251 driver.
Luciano Coelho (1):
wl1251: split wl251 platform data to a separate structureSebastian Reichel (4):
wl1251: move power GPIO handling into the driver
wl1251: spi: add vio regulator support
wl1251: spi: add device tree support
Documentation: dt: wireless: Add wl1251What's the status of this patchset? Tony prepared an immutable branch for patches 1+2 [0]. I think the other patches are also ok (at least there were no more complains from the DT binding maintainers). It would be nice to have wl1251 DT support in 3.14.
Quoted 5 lines
Quoted 3 lines
[0] http://www.spinics.net/lists/linux-omap/msg101165.html
-- Sebastian
ping? I can't see it on wireless-next.
I can't pull it because the branch is based on a later source than that of wireless-next.
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.
Tony Lindgren
maintainerQuoted 21 lines · John W. Linville
Quoted 20 lines · Sebastian Reichel
Quoted 19 lines · Sebastian Reichel
Hi John,
Quoted 11 lines
The following patchset adds device tree support to the spi variant of the wl1251 driver.
Luciano Coelho (1):
wl1251: split wl251 platform data to a separate structureSebastian Reichel (4):
wl1251: move power GPIO handling into the driver
wl1251: spi: add vio regulator support
wl1251: spi: add device tree support
Documentation: dt: wireless: Add wl1251What's the status of this patchset? Tony prepared an immutable branch for patches 1+2 [0]. I think the other patches are also ok (at least there were no more complains from the DT binding maintainers). It would be nice to have wl1251 DT support in 3.14.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
[0] http://www.spinics.net/lists/linux-omap/msg101165.html
-- Sebastian
ping? I can't see it on wireless-next.
I can't pull it because the branch is based on a later source than that of wireless-next.
Hmm I thought v3.13-rc1 was the base we agreed on the immutable branch. Care to explain what the issue is merging it in?
AFAIK merging it fast forwards your branch to v3.13-rc1 and then you just need to do the pull request against v3.13-rc1.
Regards,
Tony
Quoted 26 lines · Tony Lindgren
Quoted 25 lines · John W. Linville
Quoted 24 lines · Sebastian Reichel
Quoted 22 lines · Sebastian Reichel
Hi John,
Quoted 11 lines
The following patchset adds device tree support to the spi variant of the wl1251 driver.
Luciano Coelho (1):
wl1251: split wl251 platform data to a separate structureSebastian Reichel (4):
wl1251: move power GPIO handling into the driver
wl1251: spi: add vio regulator support
wl1251: spi: add device tree support
Documentation: dt: wireless: Add wl1251What's the status of this patchset? Tony prepared an immutable branch for patches 1+2 [0]. I think the other patches are also ok (at least there were no more complains from the DT binding maintainers). It would be nice to have wl1251 DT support in 3.14.
[0] http://www.spinics.net/lists/linux-omap/msg101165.html
-- Sebastian
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
ping? I can't see it on wireless-next.
I can't pull it because the branch is based on a later source than that of wireless-next.
Hmm I thought v3.13-rc1 was the base we agreed on the immutable branch. Care to explain what the issue is merging it in?
I think I was clear -- "the branch is based on a later source than that of wireless-next".
Quoted 2 lines
AFAIK merging it fast forwards your branch to v3.13-rc1 and then you just need to do the pull request against v3.13-rc1.
It's not a forward, it's a merge. And I don't want to do that in the wireless-next tree right now.
Are you sending that branch for 3.14? Is there some reason that I have to have it in wireless-next?
John
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.
Quoted 29 lines · John W. Linville
Quoted 28 lines · Tony Lindgren
Quoted 27 lines · John W. Linville
Quoted 25 lines · Sebastian Reichel
Quoted 14 lines · Sebastian Reichel
Hi John,
Quoted 11 lines
The following patchset adds device tree support to the spi variant of the wl1251 driver.
Luciano Coelho (1):
wl1251: split wl251 platform data to a separate structureSebastian Reichel (4):
wl1251: move power GPIO handling into the driver
wl1251: spi: add vio regulator support
wl1251: spi: add device tree support
Documentation: dt: wireless: Add wl1251Quoted 8 lines
What's the status of this patchset? Tony prepared an immutable branch for patches 1+2 [0]. I think the other patches are also ok (at least there were no more complains from the DT binding maintainers). It would be nice to have wl1251 DT support in 3.14.
[0] http://www.spinics.net/lists/linux-omap/msg101165.html
-- Sebastian
ping? I can't see it on wireless-next.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
I can't pull it because the branch is based on a later source than that of wireless-next.
Hmm I thought v3.13-rc1 was the base we agreed on the immutable branch. Care to explain what the issue is merging it in?
I think I was clear -- "the branch is based on a later source than that of wireless-next".
OK so it's the..
Quoted 5 lines
Quoted 2 lines
AFAIK merging it fast forwards your branch to v3.13-rc1 and then you just need to do the pull request against v3.13-rc1.
It's not a forward, it's a merge. And I don't want to do that in the wireless-next tree right now.
..merge part that you have problem. Fine with me.
Quoted 2 lines
Are you sending that branch for 3.14? Is there some reason that I have to have it in wireless-next?
The reason was for keeping things building and git bisect working.
I do have wl1251-pdata-signed as the base for branch omap-for-v3.14/omap3-board-removal. However the board removal was considered too early for v3.14, so that's been postponed. This is because people are still updating their systems to device tree based booting. So I can redo my omap-for-v3.14/omap3-board-removal against v3.14.
So if you want to, feel free to pick all the wl12xx patches to your wireless tree. AFAIK my omap-for-v3.14/omap3-board-removal is the only other user for those patches, and that I can redo that on v3.14.
So for the arch/arm/*omap* touching patches, feel free to add:
Quoted 11 lines · Tony Lindgren
[...]
The reason was for keeping things building and git bisect working.
I do have wl1251-pdata-signed as the base for branch omap-for-v3.14/omap3-board-removal. However the board removal was considered too early for v3.14, so that's been postponed. This is because people are still updating their systems to device tree based booting. So I can redo my omap-for-v3.14/omap3-board-removal against v3.14.
Quoted 8 lines
So if you want to, feel free to pick all the wl12xx patches to your wireless tree. AFAIK my omap-for-v3.14/omap3-board-removal is the only other user for those patches, and that I can redo that on v3.14.
So for the
arch/arm/*omap*touching patches, feel free to add:Acked-by Tony Lindgren <[email protected]>
Another ping. If this does not go into 3.14 via wireless tree it will become complicated for 3.15 again.
-- Sebastian
Quoted 17 lines · Sebastian Reichel
Quoted 16 lines · Tony Lindgren
[...]
The reason was for keeping things building and git bisect working.
I do have wl1251-pdata-signed as the base for branch omap-for-v3.14/omap3-board-removal. However the board removal was considered too early for v3.14, so that's been postponed. This is because people are still updating their systems to device tree based booting. So I can redo my omap-for-v3.14/omap3-board-removal against v3.14.
So if you want to, feel free to pick all the wl12xx patches to your wireless tree. AFAIK my omap-for-v3.14/omap3-board-removal is the only other user for those patches, and that I can redo that on v3.14.
Quoted 6 lines
Quoted 3 lines
So for the
arch/arm/*omap*touching patches, feel free to add:Acked-by Tony Lindgren <[email protected]>Another ping. If this does not go into 3.14 via wireless tree it will become complicated for 3.15 again.
It's too late for new networking features in 3.14. Why wouldn't Tony send it via his tree?
At any rate, I don't have the patches. If you still want them through the wireless tree (for 3.15) then you'll need to resend them.
John
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.
Tony Lindgren
maintainerQuoted 20 lines · John W. Linville
Quoted 19 lines · Sebastian Reichel
Quoted 18 lines · Tony Lindgren
[...]
The reason was for keeping things building and git bisect working.
I do have wl1251-pdata-signed as the base for branch omap-for-v3.14/omap3-board-removal. However the board removal was considered too early for v3.14, so that's been postponed. This is because people are still updating their systems to device tree based booting. So I can redo my omap-for-v3.14/omap3-board-removal against v3.14.
So if you want to, feel free to pick all the wl12xx patches to your wireless tree. AFAIK my omap-for-v3.14/omap3-board-removal is the only other user for those patches, and that I can redo that on v3.14.
So for the
arch/arm/*omap*touching patches, feel free to add:
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Acked-by Tony Lindgren <[email protected]>Another ping. If this does not go into 3.14 via wireless tree it will become complicated for 3.15 again.
It's too late for new networking features in 3.14. Why wouldn't Tony send it via his tree?
It's mostly drivers/net/wireless related to patch the wl12xx driver further.
Quoted 2 lines
At any rate, I don't have the patches. If you still want them through the wireless tree (for 3.15) then you'll need to resend them.
Sebastian, please resend the whole series to John and feel free to add my acks. It's best that John picks them all up, otherwise we'll have the same issue for v3.15. It seems that we should have just taken the merge conflict rather than going back and forth with this.
Cheers,
Tony
v2 cover wl1251 device tree support
Hi John,
The following patchset adds device tree support to the spi variant of the wl1251 driver, which is used in the Nokia N900. Tony requested, that you take the whole series even if that may introduce merge conflicts:
Quoted 4 lines
Sebastian, please resend the whole series to John and feel free to add my acks. It's best that John picks them all up, otherwise we'll have the same issue for v3.15. It seems that we should have just taken the merge conflict rather than going back and forth with this.
-- Sebastian
Luciano Coelho (1):
wl1251: split wl251 platform data to a separate structure
Sebastian Reichel (4):
wl1251: move power GPIO handling into the driver
wl1251: spi: add vio regulator support
wl1251: spi: add device tree support
Documentation: dt: wireless: Add wl1251
.../devicetree/bindings/net/wireless/ti,wl1251.txt | 39 ++++++++++++ arch/arm/mach-omap2/board-omap3pandora.c | 6 +- arch/arm/mach-omap2/board-rx51-peripherals.c | 13 +--- drivers/net/wireless/ti/wilink_platform_data.c | 37 +++++++++-- drivers/net/wireless/ti/wl1251/sdio.c | 31 +++++++--- drivers/net/wireless/ti/wl1251/spi.c | 71 ++++++++++++++++------ drivers/net/wireless/ti/wl1251/wl1251.h | 4 +- include/linux/wl12xx.h | 24 +++++++- 8 files changed, 176 insertions(+), 49 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt
Signature · 1 line
1.8.5.3
PATCH v2 1/5 wl1251: split wl251 platform data to a separate structure
From: Luciano Coelho <[email protected]>
Move the wl1251 part of the wl12xx platform data structure into a new structure specifically for wl1251. Change the platform data built-in block and board files accordingly.
--- arch/arm/mach-omap2/board-omap3pandora.c | 4 +-- arch/arm/mach-omap2/board-rx51-peripherals.c | 2 +- drivers/net/wireless/ti/wilink_platform_data.c | 37 +++++++++++++++++++++----- drivers/net/wireless/ti/wl1251/sdio.c | 12 ++++----- drivers/net/wireless/ti/wl1251/spi.c | 2 +- include/linux/wl12xx.h | 22 ++++++++++++++- 6 files changed, 62 insertions(+), 17 deletions(-)
arch/arm/mach-omap2/board-omap3pandora.c +2 -2
@@ -536,7 +536,7 @@ static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {static void __init pandora_wl1251_init (void ) { -struct wl12xx_platform_data pandora_wl1251_pdata; +struct wl1251_platform_data pandora_wl1251_pdata;int ret;memset (&pandora_wl1251_pdata,0 ,sizeof (pandora_wl1251_pdata));
@@ -550,7 +550,7 @@ static void __init pandora_wl1251_init(void) goto fail_irq; pandora_wl1251_pdata.use_eeprom = true; - ret =wl12xx_set_platform_data (&pandora_wl1251_pdata); + ret =wl1251_set_platform_data (&pandora_wl1251_pdata);if (ret <0 ) goto fail_irq;
arch/arm/mach-omap2/board-rx51-peripherals.c +1 -1
@@ -84,7 +84,7 @@ enum { RX51_SPI_MIPID, /* LCD panel */ }; -static struct wl12xx_platform_data wl1251_pdata; +static struct wl1251_platform_data wl1251_pdata;static struct tsc2005_platform_data tsc2005_pdata;#if defined(CONFIG_SENSORS_LIS3_I2C ) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE )
drivers/net/wireless/ti/wilink_platform_data.c +31 -6
@@ -23,17 +23,17 @@#include <linux/err.h> #include <linux/wl12xx.h> -static struct wl12xx_platform_data *platform_data; +static struct wl12xx_platform_data *wl12xx_platform_data;int __init wl12xx_set_platform_data (const struct wl12xx_platform_data *data) { -if (platform_data) +if (wl12xx_platform_data)return -EBUSY ;if (!data)return -EINVAL ; - platform_data =kmemdup (data,sizeof (*data),GFP_KERNEL ); -if (!platform_data) + wl12xx_platform_data =kmemdup (data,sizeof (*data),GFP_KERNEL ); +if (!wl12xx_platform_data)return -ENOMEM ;return 0 ;
@@ -41,9 +41,34 @@ int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)struct wl12xx_platform_data *wl12xx_get_platform_data (void ) { -if (!platform_data) +if (!wl12xx_platform_data)return ERR_PTR (-ENODEV ); -return platform_data; +return wl12xx_platform_data; }EXPORT_SYMBOL (wl12xx_get_platform_data); + +static struct wl1251_platform_data *wl1251_platform_data; + +int __init wl1251_set_platform_data (const struct wl1251_platform_data *data) +{ +if (wl1251_platform_data) +return -EBUSY ; +if (!data) +return -EINVAL ; + + wl1251_platform_data =kmemdup (data,sizeof (*data),GFP_KERNEL ); +if (!wl1251_platform_data) +return -ENOMEM ; + +return 0 ; +} + +struct wl1251_platform_data *wl1251_get_platform_data (void ) +{ +if (!wl1251_platform_data) +return ERR_PTR (-ENODEV ); + +return wl1251_platform_data; +} +EXPORT_SYMBOL (wl1251_get_platform_data);
drivers/net/wireless/ti/wl1251/sdio.c +6 -6
@@ -227,7 +227,7 @@ static int wl1251_sdio_probe(struct sdio_func *func,struct wl1251 *wl;struct ieee80211_hw *hw;struct wl1251_sdio *wl_sdio; -const struct wl12xx_platform_data *wl12xx_board_data; +const struct wl1251_platform_data *wl1251_board_data; hw =wl1251_alloc_hw ();if (IS_ERR (hw))
@@ -254,11 +254,11 @@ static int wl1251_sdio_probe(struct sdio_func *func, wl->if_priv = wl_sdio; wl->if_ops = &wl1251_sdio_ops; - wl12xx_board_data =wl12xx_get_platform_data (); -if (!IS_ERR (wl12xx_board_data)) { - wl->set_power = wl12xx_board_data->set_power; - wl->irq = wl12xx_board_data->irq; - wl->use_eeprom = wl12xx_board_data->use_eeprom; + wl1251_board_data =wl1251_get_platform_data (); +if (!IS_ERR (wl1251_board_data)) { + wl->set_power = wl1251_board_data->set_power; + wl->irq = wl1251_board_data->irq; + wl->use_eeprom = wl1251_board_data->use_eeprom; }if (wl->irq) {
drivers/net/wireless/ti/wl1251/spi.c +1 -1
@@ -238,7 +238,7 @@ static const struct wl1251_if_operations wl1251_spi_ops = {static int wl1251_spi_probe (struct spi_device *spi) { -struct wl12xx_platform_data *pdata; +struct wl1251_platform_data *pdata;struct ieee80211_hw *hw;struct wl1251 *wl;int ret;
include/linux/wl12xx.h +21 -1
@@ -48,11 +48,15 @@ enum { WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */ }; -struct wl12xx_platform_data { +struct wl1251_platform_data {void (*set_power)(bool enable);/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ int irq;bool use_eeprom; +}; + +struct wl12xx_platform_data { +int irq;int board_ref_clock;int board_tcxo_clock;unsigned long platform_quirks;
@@ -68,6 +72,10 @@ int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);struct wl12xx_platform_data *wl12xx_get_platform_data (void ); +int wl1251_set_platform_data (const struct wl1251_platform_data *data); + +struct wl1251_platform_data *wl1251_get_platform_data (void ); +#else static inline
@@ -82,6 +90,18 @@ struct wl12xx_platform_data *wl12xx_get_platform_data(void)return ERR_PTR (-ENODATA ); } +static inline +int wl1251_set_platform_data (const struct wl1251_platform_data *data) +{ +return -ENOSYS ; +} + +static inline +struct wl1251_platform_data *wl1251_get_platform_data (void ) +{ +return ERR_PTR (-ENODATA ); +} +#endif #endif
Signature · 1 line
1.8.5.3
PATCH v2 2/5 wl1251: move power GPIO handling into the driver
In reply to Sebastian ReichelMove the power GPIO handling from the board code into the driver. This is a dependency for device tree support.
--- arch/arm/mach-omap2/board-omap3pandora.c | 2 ++ arch/arm/mach-omap2/board-rx51-peripherals.c | 11 ++-------- drivers/net/wireless/ti/wl1251/sdio.c | 21 +++++++++++++----- drivers/net/wireless/ti/wl1251/spi.c | 33 ++++++++++++++++++---------- drivers/net/wireless/ti/wl1251/wl1251.h | 2 +- include/linux/wl12xx.h | 2 +- 6 files changed, 43 insertions(+), 28 deletions(-)
arch/arm/mach-omap2/board-omap3pandora.c +2 -0
@@ -541,6 +541,8 @@ static void __init pandora_wl1251_init(void)memset (&pandora_wl1251_pdata,0 ,sizeof (pandora_wl1251_pdata)); + pandora_wl1251_pdata.power_gpio =-1 ; + ret =gpio_request_one (PANDORA_WIFI_IRQ_GPIO ,GPIOF_IN ,"wl1251 irq" );if (ret <0 ) goto fail;
arch/arm/mach-omap2/board-rx51-peripherals.c +2 -9
@@ -1173,13 +1173,7 @@ static inline void board_smc91x_init(void)#endif -static void rx51_wl1251_set_power (bool enable) -{ -gpio_set_value (RX51_WL1251_POWER_GPIO , enable); -} -static struct gpio rx51_wl1251_gpios[]__initdata = { - {RX51_WL1251_POWER_GPIO ,GPIOF_OUT_INIT_LOW ,"wl1251 power" }, {RX51_WL1251_IRQ_GPIO ,GPIOF_IN ,"wl1251 irq" }, };
@@ -1196,17 +1190,16 @@ static void __init rx51_init_wl1251(void)if (irq <0 ) goto err_irq; - wl1251_pdata.set_power = rx51_wl1251_set_power; + wl1251_pdata.power_gpio =RX51_WL1251_POWER_GPIO ; rx51_peripherals_spi_board_info[RX51_SPI_WL1251 ].irq = irq;return ; err_irq:gpio_free (RX51_WL1251_IRQ_GPIO ); -gpio_free (RX51_WL1251_POWER_GPIO ); error:printk (KERN_ERR "wl1251 board initialisation failed\n" ); - wl1251_pdata.set_power =NULL ; + wl1251_pdata.power_gpio =-1 ;/* * Now rx51_peripherals_spi_board_info[1].irq is zero and
drivers/net/wireless/ti/wl1251/sdio.c +16 -5
@@ -28,6 +28,7 @@#include <linux/wl12xx.h> #include <linux/irq.h> #include <linux/pm_runtime.h> +#include <linux/gpio.h> #include "wl1251.h"
@@ -182,8 +183,9 @@ static int wl1251_sdio_set_power(struct wl1251 *wl, bool enable)* callback in case it wants to do any additional setup, * for example enabling clock buffer for the module. */ -if (wl->set_power) - wl->set_power (true); +if (gpio_is_valid (wl->power_gpio)) +gpio_set_value (wl->power_gpio, true); + ret =pm_runtime_get_sync (&func->dev);if (ret <0 ) {
@@ -203,8 +205,8 @@ static int wl1251_sdio_set_power(struct wl1251 *wl, bool enable)if (ret <0 ) goto out; -if (wl->set_power) - wl->set_power (false); +if (gpio_is_valid (wl->power_gpio)) +gpio_set_value (wl->power_gpio, false); } out:
@@ -256,11 +258,20 @@ static int wl1251_sdio_probe(struct sdio_func *func, wl1251_board_data =wl1251_get_platform_data ();if (!IS_ERR (wl1251_board_data)) { - wl->set_power = wl1251_board_data->set_power; + wl->power_gpio = wl1251_board_data->power_gpio; wl->irq = wl1251_board_data->irq; wl->use_eeprom = wl1251_board_data->use_eeprom; } +if (gpio_is_valid (wl->power_gpio)) { + ret =devm_gpio_request (&func->dev, wl->power_gpio, +"wl1251 power" ); +if (ret) { +wl1251_error ("Failed to request gpio: %d\n" , ret); + goto disable; + } + } +if (wl->irq) {irq_set_status_flags (wl->irq,IRQ_NOAUTOEN ); ret =request_irq (wl->irq, wl1251_line_irq,0 ,"wl1251" , wl);
drivers/net/wireless/ti/wl1251/spi.c +21 -12
@@ -26,6 +26,7 @@#include <linux/crc7.h> #include <linux/spi/spi.h> #include <linux/wl12xx.h> +#include <linux/gpio.h> #include "wl1251.h" #include "reg.h"
@@ -221,8 +222,8 @@ static void wl1251_spi_disable_irq(struct wl1251 *wl)static int wl1251_spi_set_power (struct wl1251 *wl,bool enable) { -if (wl->set_power) - wl->set_power (enable); +if (gpio_is_valid (wl->power_gpio)) +gpio_set_value (wl->power_gpio, enable);return 0 ; }
@@ -271,22 +272,33 @@ static int wl1251_spi_probe(struct spi_device *spi) goto out_free; } - wl->set_power = pdata->set_power; -if (!wl->set_power) { -wl1251_error ("set power function missing in platform data" ); -return -ENODEV ; + wl->power_gpio = pdata->power_gpio; + +if (gpio_is_valid (wl->power_gpio)) { + ret =devm_gpio_request_one (&spi->dev, wl->power_gpio, +GPIOF_OUT_INIT_LOW ,"wl1251 power" ); +if (ret) { +wl1251_error ("Failed to request gpio: %d\n" , ret); + goto out_free; + } + }else { +wl1251_error ("set power gpio missing in platform data" ); + ret = -ENODEV ; + goto out_free; } wl->irq = spi->irq;if (wl->irq <0 ) {wl1251_error ("irq missing in platform data" ); -return -ENODEV ; + ret = -ENODEV ; + goto out_free; } wl->use_eeprom = pdata->use_eeprom;irq_set_status_flags (wl->irq,IRQ_NOAUTOEN ); - ret =request_irq (wl->irq, wl1251_irq,0 ,DRIVER_NAME , wl); + ret =devm_request_irq (&spi->dev, wl->irq, wl1251_irq,0 , +DRIVER_NAME , wl);if (ret <0 ) {wl1251_error ("request_irq() failed: %d" , ret); goto out_free;
@@ -296,13 +308,10 @@ static int wl1251_spi_probe(struct spi_device *spi) ret =wl1251_init_ieee80211 (wl);if (ret) - goto out_irq; + goto out_free;return 0 ; - out_irq: -free_irq (wl->irq, wl); - out_free:ieee80211_free_hw (hw);
drivers/net/wireless/ti/wl1251/wl1251.h +1 -1
@@ -276,7 +276,7 @@ struct wl1251 {void *if_priv;const struct wl1251_if_operations *if_ops; -void (*set_power)(bool enable); +int power_gpio;int irq;bool use_eeprom;
include/linux/wl12xx.h +1 -1
@@ -49,7 +49,7 @@ enum { };struct wl1251_platform_data { -void (*set_power)(bool enable); +int power_gpio;/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ int irq;bool use_eeprom;
Signature · 1 line
1.8.5.3
PATCH v2 3/5 wl1251: spi: add vio regulator support
In reply to Sebastian ReichelThis patch adds support for requesting the regulator powering the vio pin.
--- drivers/net/wireless/ti/wl1251/spi.c | 19 +++++++++++++++++-- drivers/net/wireless/ti/wl1251/wl1251.h | 2 ++ 2 files changed, 19 insertions(+), 2 deletions(-)
drivers/net/wireless/ti/wl1251/spi.c +17 -2
@@ -27,6 +27,7 @@#include <linux/spi/spi.h> #include <linux/wl12xx.h> #include <linux/gpio.h> +#include <linux/regulator/consumer.h> #include "wl1251.h" #include "reg.h"
@@ -306,13 +307,26 @@ static int wl1251_spi_probe(struct spi_device *spi)irq_set_irq_type (wl->irq,IRQ_TYPE_EDGE_RISING ); - ret =wl1251_init_ieee80211 (wl); + wl->vio =devm_regulator_get (&spi->dev,"vio" ); +if (IS_ERR (wl->vio)) { + ret =PTR_ERR (wl->vio); +wl1251_error ("vio regulator missing: %d" , ret); + goto out_free; + } + + ret =regulator_enable (wl->vio);if (ret) goto out_free; + ret =wl1251_init_ieee80211 (wl); +if (ret) + goto disable_regulator; +return 0 ; - out_free: +disable_regulator: +regulator_disable (wl->vio); +out_free:ieee80211_free_hw (hw);return ret;
@@ -324,6 +338,7 @@ static int wl1251_spi_remove(struct spi_device *spi)free_irq (wl->irq, wl);wl1251_free_hw (wl); +regulator_disable (wl->vio);return 0 ; }
drivers/net/wireless/ti/wl1251/wl1251.h +2 -0
@@ -280,6 +280,8 @@ struct wl1251 {int irq;bool use_eeprom; +struct regulator *vio; +spinlock_t wl_lock;enum wl1251_state state;
Signature · 1 line
1.8.5.3
PATCH v2 4/5 wl1251: spi: add device tree support
In reply to Sebastian ReichelAdd device tree support for the spi variant of wl1251.
--- drivers/net/wireless/ti/wl1251/spi.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/net/wireless/ti/wl1251/spi.c +17 -6
@@ -27,6 +27,8 @@#include <linux/spi/spi.h> #include <linux/wl12xx.h> #include <linux/gpio.h> +#include <linux/of.h> +#include <linux/of_gpio.h> #include <linux/regulator/consumer.h> #include "wl1251.h"
@@ -240,13 +242,13 @@ static const struct wl1251_if_operations wl1251_spi_ops = {static int wl1251_spi_probe (struct spi_device *spi) { -struct wl1251_platform_data *pdata; +struct wl1251_platform_data *pdata =dev_get_platdata (&spi->dev); +struct device_node *np = spi->dev.of_node;struct ieee80211_hw *hw;struct wl1251 *wl;int ret; - pdata =dev_get_platdata (&spi->dev); -if (!pdata) { +if (!np && !pdata) {wl1251_error ("no platform data" );return -ENODEV ; }
@@ -273,7 +275,18 @@ static int wl1251_spi_probe(struct spi_device *spi) goto out_free; } - wl->power_gpio = pdata->power_gpio; +if (np) { + wl->use_eeprom =of_property_read_bool (np,"ti,wl1251-has-eeprom" ); + wl->power_gpio =of_get_named_gpio (np,"ti,power-gpio" ,0 ); + }else if (pdata) { + wl->power_gpio = pdata->power_gpio; + wl->use_eeprom = pdata->use_eeprom; + } + +if (wl->power_gpio == -EPROBE_DEFER ) { + ret = -EPROBE_DEFER ; + goto out_free; + }if (gpio_is_valid (wl->power_gpio)) { ret = devm_gpio_request_one(&spi->dev, wl->power_gpio,
@@ -295,8 +308,6 @@ static int wl1251_spi_probe(struct spi_device *spi) goto out_free; } - wl->use_eeprom = pdata->use_eeprom; -irq_set_status_flags (wl->irq,IRQ_NOAUTOEN ); ret =devm_request_irq (&spi->dev, wl->irq, wl1251_irq,0 ,DRIVER_NAME , wl);
Signature · 1 line
1.8.5.3
PATCH v2 5/5 Documentation: dt: wireless: Add wl1251
In reply to Sebastian ReichelAdd device tree binding documentation for Texas Instrument's wl1251 wireless lan chip. For now only the SPI binding is documented.
--- .../devicetree/bindings/net/wireless/ti,wl1251.txt | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt
Documentation/devicetree/bindings/net/wireless/ti,wl1251.txt new file +39 -0
@@ -0,0 +1,39 @@ +* Texas Instruments wl1251 wireless lan controller + +The wl1251 chip can be connected via SPI or via SDIO. This +document describes the binding for the SPI connected chip. + +Required properties: +- compatible : Should be "ti,wl1251" +- reg : Chip select address of device +- spi-max-frequency : Maximum SPI clocking speed of device in Hz +- interrupts : Should contain interrupt line +- interrupt-parent : Should be the phandle for the interrupt controller + that services interrupts for this device +- vio-supply : phandle to regulator providing VIO +- ti,power-gpio : GPIO connected to chip's PMEN pin + +Optional properties: +- ti,wl1251-has-eeprom : boolean, the wl1251 has an eeprom connected, which + provides configuration data (calibration, MAC, ...) +- Please consult Documentation/devicetree/bindings/spi/spi-bus.txt + for optional SPI connection related properties, + +Examples: + +&spi1 { + wl1251@0 { + compatible = "ti,wl1251"; + + reg = <0>; + spi-max-frequency = <48000000>; + spi-cpol; + spi-cpha; + + interrupt-parent = <&gpio2>; + interrupts = <10 IRQ_TYPE_NONE>; /* gpio line 42 */ + + vio-supply = <&vio>; + ti,power-gpio = <&gpio3 23 GPIO_ACTIVE_HIGH>; /* 87 */ + }; +};
Signature · 1 line
1.8.5.3
Hi John,
Quoted 8 lines · Sebastian Reichel
The following patchset adds device tree support to the spi variant of the wl1251 driver, which is used in the Nokia N900. Tony requested, that you take the whole series even if that may introduce merge conflicts:
Quoted 4 lines
Sebastian, please resend the whole series to John and feel free to add my acks. It's best that John picks them all up, otherwise we'll have the same issue for v3.15. It seems that we should have just taken the merge conflict rather than going back and forth with this.
ping! Is there still anything wrong with this patchset?
-- Sebastian
Hi,
Quoted 11 lines · Sebastian Reichel
Quoted 8 lines · Sebastian Reichel
The following patchset adds device tree support to the spi variant of the wl1251 driver, which is used in the Nokia N900. Tony requested, that you take the whole series even if that may introduce merge conflicts:
Quoted 4 lines
Sebastian, please resend the whole series to John and feel free to add my acks. It's best that John picks them all up, otherwise we'll have the same issue for v3.15. It seems that we should have just taken the merge conflict rather than going back and forth with this.
ping! Is there still anything wrong with this patchset?
ping! This patchset is quite old now. Please pull it into wireless-next, so that it can appear in 3.15.
-- Sebastian
John W. Linville
Reviewed-by Pavel Machek Reviewed-by Pavel Machek Acked-by Tony Lindgren Acked-by Tony Lindgren Reviewed-by Felipe Balbi Reviewed-by Sebastian Reichel Reviewed-by Pavel MachekQuoted 13 lines · Sebastian Reichel
Hi,
Quoted 10 lines · Sebastian Reichel
Quoted 8 lines · Sebastian Reichel
The following patchset adds device tree support to the spi variant of the wl1251 driver, which is used in the Nokia N900. Tony requested, that you take the whole series even if that may introduce merge conflicts:
Quoted 4 lines
Sebastian, please resend the whole series to John and feel free to add my acks. It's best that John picks them all up, otherwise we'll have the same issue for v3.15. It seems that we should have just taken the merge conflict rather than going back and forth with this.
Quoted 6 lines
Quoted 1 line
ping! Is there still anything wrong with this patchset?
ping! This patchset is quite old now. Please pull it into wireless-next, so that it can appear in 3.15.
-- Sebastian
These are already in wireless-next...
commit edb6e3ec374d5630dfc7a93ddd5c0f4864e98a9d
Author: Sebastian Reichel <[email protected]> Date: Sat Feb 15 00:05:56 2014 +0100
Documentation: dt: wireless: Add wl1251
Add device tree binding documentation for Texas Instrument's wl1251 wireless lan chip. For now only the SPI binding is documented.
commit 07bbca6f142d02b4b09d66ed3c2cde36c77057ad
Author: Sebastian Reichel <[email protected]> Date: Sat Feb 15 00:05:55 2014 +0100
wl1251: spi: add device tree support
Add device tree support for the spi variant of wl1251.
commit e4c2e09e1534835c749de362b9b38e2d8b286236
Author: Sebastian Reichel <[email protected]> Date: Sat Feb 15 00:05:54 2014 +0100
wl1251: spi: add vio regulator support
This patch adds support for requesting the regulator powering the vio pin.
commit 1d207cd30b65fdd60d952cb9e100b6f776564f06
Author: Sebastian Reichel <[email protected]> Date: Sat Feb 15 00:05:53 2014 +0100
wl1251: move power GPIO handling into the driver
Move the power GPIO handling from the board code into the driver. This is a dependency for device tree support.
commit 946651cba26779864bcdbd7e12502f5a36c2de37
Author: Luciano Coelho <[email protected]> Date: Sat Feb 15 00:05:52 2014 +0100
wl1251: split wl251 platform data to a separate structure
Move the wl1251 part of the wl12xx platform data structure into a new structure specifically for wl1251. Change the platform data built-in block and board files accordingly.
Signature · 6 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready. -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 14 lines · John W. Linville
Quoted 13 lines · Sebastian Reichel
Hi,
Quoted 10 lines · Sebastian Reichel
Quoted 8 lines · Sebastian Reichel
The following patchset adds device tree support to the spi variant of the wl1251 driver, which is used in the Nokia N900. Tony requested, that you take the whole series even if that may introduce merge conflicts:
Quoted 4 lines
Sebastian, please resend the whole series to John and feel free to add my acks. It's best that John picks them all up, otherwise we'll have the same issue for v3.15. It seems that we should have just taken the merge conflict rather than going back and forth with this.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
ping! Is there still anything wrong with this patchset?
ping! This patchset is quite old now. Please pull it into wireless-next, so that it can appear in 3.15.
-- Sebastian
These are already in wireless-next...
oops, sorry for the noise. I have checked the git repository and my mailbox before sending another ping, but overlooked the commits.
Thanks for applying them.
-- Sebastian