native wl1271 support on ZOOM
Subsystems (6)
v5 cover native wl1271 support on ZOOM
This patchset adds wl1271 support on ZOOM2/3 boards.
Only basic support is included; MMC power manipulation part is submitted separately as Runtime PM migration.
Changes since v4:
- Introduce a simple (yet safe) mechanism to pass platform-specific data to the driver, as suggested by Russell King. Currently only a single device is supported; multi-device support will be introduced only when/if required
Patches are based on 2.6.36-rc3 and tested on ZOOM3.
Thanks,
Ohad Ben-Cohen (7):
wireless: wl1271: make wl12xx.h common to both spi and sdio
wireless: wl1271: support return value for the set power func
wireless: wl12xx: add platform data passing support
wireless: wl1271: take irq info from private board data
wireless: wl1271: make ref_clock configurable by board
omap: zoom: add fixed regulator device for wlan
omap: zoom: add mmc3/wl1271 device support
arch/arm/mach-omap2/board-zoom-peripherals.c | 54 ++++++++++++++++++++ drivers/net/wireless/Makefile | 2 + drivers/net/wireless/wl12xx/Kconfig | 5 ++- drivers/net/wireless/wl12xx/wl1251_sdio.c | 2 +- drivers/net/wireless/wl12xx/wl1251_spi.c | 2 +- drivers/net/wireless/wl12xx/wl1271.h | 3 +- drivers/net/wireless/wl12xx/wl1271_boot.c | 9 ++-- drivers/net/wireless/wl12xx/wl1271_boot.h | 1 - drivers/net/wireless/wl12xx/wl1271_io.h | 9 ++- drivers/net/wireless/wl12xx/wl1271_main.c | 4 +- drivers/net/wireless/wl12xx/wl1271_sdio.c | 19 ++++--- drivers/net/wireless/wl12xx/wl1271_spi.c | 8 ++- drivers/net/wireless/wl12xx/wl12xx_platform_data.c | 31 +++++++++++ include/linux/spi/wl12xx.h | 34 ------------ include/linux/wl12xx.h | 38 ++++++++++++++ 15 files changed, 164 insertions(+), 57 deletions(-) create mode 100644 drivers/net/wireless/wl12xx/wl12xx_platform_data.c delete mode 100644 include/linux/spi/wl12xx.h create mode 100644 include/linux/wl12xx.h
PATCH v5 1/7 wireless: wl1271: make wl12xx.h common to both spi and sdio
Move wl12xx.h outside of the spi-specific location, so it can be shared with both spi and sdio solutions.
--- drivers/net/wireless/wl12xx/wl1251_sdio.c | 2 +- drivers/net/wireless/wl12xx/wl1251_spi.c | 2 +- drivers/net/wireless/wl12xx/wl1271_spi.c | 2 +- include/linux/spi/wl12xx.h | 34 ----------------------------- include/linux/wl12xx.h | 34 +++++++++++++++++++++++++++++ 5 files changed, 37 insertions(+), 37 deletions(-) delete mode 100644 include/linux/spi/wl12xx.h create mode 100644 include/linux/wl12xx.h
drivers/net/wireless/wl12xx/wl1251_sdio.c +1 -1
@@ -24,7 +24,7 @@#include <linux/mmc/sdio_func.h> #include <linux/mmc/sdio_ids.h> #include <linux/platform_device.h> -#include <linux/spi/wl12xx.h> +#include <linux/wl12xx.h> #include <linux/irq.h> #include "wl1251.h"
drivers/net/wireless/wl12xx/wl1251_spi.c +1 -1
@@ -26,7 +26,7 @@#include <linux/slab.h> #include <linux/crc7.h> #include <linux/spi/spi.h> -#include <linux/spi/wl12xx.h> +#include <linux/wl12xx.h> #include "wl1251.h" #include "wl1251_reg.h"
drivers/net/wireless/wl12xx/wl1271_spi.c +1 -1
@@ -25,7 +25,7 @@#include <linux/module.h> #include <linux/crc7.h> #include <linux/spi/spi.h> -#include <linux/spi/wl12xx.h> +#include <linux/wl12xx.h> #include <linux/slab.h> #include "wl1271.h"
include/linux/spi/wl12xx.h deleted +0 -34
@@ -1,34 +0,0 @@ -/* -* This file is part of wl12xx -* -* Copyright (C) 2009 Nokia Corporation -* -* Contact: Kalle Valo <[email protected]> -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* version 2 as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA -* 02110-1301 USA -* -*/ - -#ifndef _LINUX_SPI_WL12XX_H -#define _LINUX_SPI_WL12XX_H - -struct wl12xx_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; -}; - -#endif
include/linux/wl12xx.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* This file is part of wl12xx +* +* Copyright (C) 2009 Nokia Corporation +* +* Contact: Kalle Valo <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +* 02110-1301 USA +* +*/ + +#ifndef _LINUX_WL12XX_H +#define _LINUX_WL12XX_H + +struct wl12xx_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; +}; + +#endif
Signature · 1 line
1.7.0.4
PATCH v5 2/7 wireless: wl1271: support return value for the set power func
In reply to Ohad Ben-CohenMake it possible for the set power method to indicate a success/failure return value. This is needed to support more complex power on/off operations such as bringing up (and down) sdio functions.
--- drivers/net/wireless/wl12xx/wl1271.h | 2 +- drivers/net/wireless/wl12xx/wl1271_io.h | 9 ++++++--- drivers/net/wireless/wl12xx/wl1271_main.c | 4 +++- drivers/net/wireless/wl12xx/wl1271_sdio.c | 4 +++- drivers/net/wireless/wl12xx/wl1271_spi.c | 4 +++- 5 files changed, 16 insertions(+), 7 deletions(-)
drivers/net/wireless/wl12xx/wl1271.h +1 -1
@@ -313,7 +313,7 @@ struct wl1271_if_operations { bool fixed);void (*reset)(struct wl1271 *wl);void (*init)(struct wl1271 *wl); -void (*power)(struct wl1271 *wl,bool enable); +int (*power)(struct wl1271 *wl,bool enable);struct device * (*dev)(struct wl1271 *wl);void (*enable_irq)(struct wl1271 *wl);void (*disable_irq)(struct wl1271 *wl);
drivers/net/wireless/wl12xx/wl1271_io.h +6 -3
@@ -144,10 +144,13 @@ static inline void wl1271_power_off(struct wl1271 *wl)clear_bit (WL1271_FLAG_GPIO_POWER , &wl->flags); } -static inline void wl1271_power_on (struct wl1271 *wl) +static inline int wl1271_power_on (struct wl1271 *wl) { - wl->if_ops->power (wl, true); -set_bit (WL1271_FLAG_GPIO_POWER , &wl->flags); +int ret = wl->if_ops->power (wl, true); +if (ret ==0 ) +set_bit (WL1271_FLAG_GPIO_POWER , &wl->flags); + +return ret; }
drivers/net/wireless/wl12xx/wl1271_main.c +3 -1
@@ -621,7 +621,9 @@ static int wl1271_chip_wakeup(struct wl1271 *wl)int ret =0 ;msleep (WL1271_PRE_POWER_ON_SLEEP ); -wl1271_power_on (wl); + ret =wl1271_power_on (wl); +if (ret <0 ) + goto out;msleep (WL1271_POWER_ON_SLEEP );wl1271_io_reset (wl);wl1271_io_init (wl);
drivers/net/wireless/wl12xx/wl1271_sdio.c +3 -1
@@ -152,7 +152,7 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf, } -static void wl1271_sdio_set_power (struct wl1271 *wl,bool enable) +static int wl1271_sdio_set_power (struct wl1271 *wl,bool enable) {struct sdio_func *func =wl_to_func (wl);
@@ -167,6 +167,8 @@ static void wl1271_sdio_set_power(struct wl1271 *wl, bool enable)sdio_disable_func (func);sdio_release_host (func); } + +return 0 ; }static struct wl1271_if_operations sdio_ops = {
drivers/net/wireless/wl12xx/wl1271_spi.c +3 -1
@@ -312,10 +312,12 @@ static irqreturn_t wl1271_irq(int irq, void *cookie)return IRQ_HANDLED ; } -static void wl1271_spi_set_power (struct wl1271 *wl,bool enable) +static int wl1271_spi_set_power (struct wl1271 *wl,bool enable) {if (wl->set_power) wl->set_power (enable); + +return 0 ; }static struct wl1271_if_operations spi_ops = {
Signature · 1 line
1.7.0.4
PATCH v5 3/7 wireless: wl12xx: add platform data passing support
In reply to Ohad Ben-CohenAdd a simple mechanism to pass platform data to the SDIO instances of wl12xx.
This way there is no confusion over who owns the 'embedded data', typechecking is preserved, and no possibility for the wrong driver to pick up the data.
Originally proposed by Russell King.
--- drivers/net/wireless/Makefile | 2 + drivers/net/wireless/wl12xx/Kconfig | 5 ++- drivers/net/wireless/wl12xx/wl12xx_platform_data.c | 31 ++++++++++++++++++++ include/linux/wl12xx.h | 3 ++ 4 files changed, 40 insertions(+), 1 deletions(-) create mode 100644 drivers/net/wireless/wl12xx/wl12xx_platform_data.c
drivers/net/wireless/Makefile +2 -0
@@ -50,5 +50,7 @@ obj-$(CONFIG_ATH_COMMON) += ath/ obj-$(CONFIG_MAC80211_HWSIM) += mac80211_hwsim.o obj-$(CONFIG_WL12XX) += wl12xx/ +# small builtin driver bit +obj-$(CONFIG_WL12XX_PLATFORM_DATA) += wl12xx/wl12xx_platform_data.o obj-$(CONFIG_IWM) += iwmc3200wifi/
drivers/net/wireless/wl12xx/Kconfig +4 -1
@@ -74,4 +74,7 @@ config WL1271_SDIO If you choose to build a module, it'll be called wl1271_sdio. Say N if unsure. - +config WL12XX_PLATFORM_DATA + bool + depends on WL1271_SDIO != n + default y
drivers/net/wireless/wl12xx/wl12xx_platform_data.c new file +31 -0
@@ -0,0 +1,31 @@ +#include <linux/module.h> +#include <linux/wl12xx.h> + +static struct wl12xx_platform_data *platform_data; + +int __init wl12xx_set_platform_data (const struct wl12xx_platform_data *data) +{ +if (platform_data) +return -EBUSY ; +if (!data) +return -EINVAL ; + + platform_data =kmemdup (data,sizeof (*data),GFP_KERNEL ); +if (!platform_data) +return -ENOMEM ; + +return 0 ; +} + +int wl12xx_get_platform_data (struct wl12xx_platform_data *data) +{ +if (!platform_data) +return -ENODEV ; +if (!data) +return -EINVAL ; + +memcpy (data, platform_data,sizeof (*data)); + +return 0 ; +} +EXPORT_SYMBOL (wl12xx_get_platform_data);
include/linux/wl12xx.h +3 -0
@@ -31,4 +31,7 @@ struct wl12xx_platform_data { bool use_eeprom; }; +int wl12xx_set_platform_data (const struct wl12xx_platform_data *data); +int wl12xx_get_platform_data (struct wl12xx_platform_data *data); +#endif
Signature · 1 line
1.7.0.4
PATCH v5 3/7 wireless: wl12xx: add platform data passing support
2010/9/1 Ohad Ben-Cohen <[email protected]>:
Quoted 91 lines
Add a simple mechanism to pass platform data to the SDIO instances of wl12xx.
This way there is no confusion over who owns the 'embedded data', typechecking is preserved, and no possibility for the wrong driver to pick up the data.
Originally proposed by Russell King.
Signed-off-by Ohad Ben-Cohen <[email protected]>---
?drivers/net/wireless/Makefile ? ? ? ? ? ? ? ? ? ? ?| ? ?2 + ?drivers/net/wireless/wl12xx/Kconfig ? ? ? ? ? ? ? ?| ? ?5 ++- ?drivers/net/wireless/wl12xx/wl12xx_platform_data.c | ? 31 ++++++++++++++++++++ ?include/linux/wl12xx.h ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?3 ++?4 files changed, 40 insertions(+), 1 deletions(-)
?create mode 100644drivers/net/wireless/wl12xx/wl12xx_platform_data.cdrivers/net/wireless/Makefile +0
-0@@ -50,5 +50,7 @@ obj-$(CONFIG_ATH_COMMON) ? ? ?+= ath/?obj-$(CONFIG_MAC80211_HWSIM) ? += mac80211_hwsim.o
?obj-$(CONFIG_WL12XX) ? += wl12xx/
drivers/net/wireless/Makefile +2
-0+# small builtin driver bit +obj-$(CONFIG_WL12XX_PLATFORM_DATA) ? ? += wl12xx/wl12xx_platform_data.o?obj-$(CONFIG_IWM) ? ? ?+= iwmc3200wifi/
drivers/net/wireless/wl12xx/Kconfig +0
-0@@ -74,4 +74,7 @@ config WL1271_SDIO? ? ? ? ?If you choose to build a module, it'll be called ? ? ? ? ?wl1271_sdio. Say N if unsure.
drivers/net/wireless/wl12xx/Kconfig +4
-1- +config WL12XX_PLATFORM_DATA + ? ? ? bool + ? ? ? depends on WL1271_SDIO != n + ? ? ? default ydrivers/net/wireless/wl12xx/wl12xx_platform_data.c new file +31
-0@@ -0,0 +1,31 @@ +#include <linux/module.h> +#include <linux/wl12xx.h> + +static struct wl12xx_platform_data *platform_data; + +int __init wl12xx_set_platform_data (const struct wl12xx_platform_data *data) +{ + ? ? ? if (platform_data) + ? ? ? ? ? ? ? return -EBUSY; + ? ? ? if (!data) + ? ? ? ? ? ? ? return -EINVAL; + + ? ? ? platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL); + ? ? ? if (!platform_data) + ? ? ? ? ? ? ? return -ENOMEM; + + ? ? ? return 0; +} + +int wl12xx_get_platform_data (struct wl12xx_platform_data *data) +{ + ? ? ? if (!platform_data) + ? ? ? ? ? ? ? return -ENODEV; + ? ? ? if (!data) + ? ? ? ? ? ? ? return -EINVAL; + + ? ? ? memcpy(data, platform_data, sizeof(*data)); + + ? ? ? return 0; +} +EXPORT_SYMBOL (wl12xx_get_platform_data);include/linux/wl12xx.h +3
-0@@ -31,4 +31,7 @@ struct wl12xx_platform_data { ? ? ? ?bool use_eeprom; ?}; +int wl12xx_set_platform_data (const struct wl12xx_platform_data *data); +int wl12xx_get_platform_data (struct wl12xx_platform_data *data); +
Quoted 1 line
?#endif
Why do you need all that copying? Isn't the data constant?
Best Regards,
Micha? Miros?aw
PATCH v5 3/7 wireless: wl12xx: add platform data passing support
2010/9/4 Micha? Miros?aw <[email protected]>:
Quoted 89 lines
2010/9/1 Ohad Ben-Cohen <[email protected]>:
Quoted 88 lines
Add a simple mechanism to pass platform data to the SDIO instances of wl12xx.
This way there is no confusion over who owns the 'embedded data', typechecking is preserved, and no possibility for the wrong driver to pick up the data.
Originally proposed by Russell King.
Signed-off-by Ohad Ben-Cohen <[email protected]>---
?drivers/net/wireless/Makefile ? ? ? ? ? ? ? ? ? ? ?| ? ?2 + ?drivers/net/wireless/wl12xx/Kconfig ? ? ? ? ? ? ? ?| ? ?5 ++- ?drivers/net/wireless/wl12xx/wl12xx_platform_data.c | ? 31 ++++++++++++++++++++ ?include/linux/wl12xx.h ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?3 ++?4 files changed, 40 insertions(+), 1 deletions(-)
?create mode 100644drivers/net/wireless/wl12xx/wl12xx_platform_data.cdrivers/net/wireless/Makefile +0
-0@@ -50,5 +50,7 @@ obj-$(CONFIG_ATH_COMMON) ? ? ?+= ath/?obj-$(CONFIG_MAC80211_HWSIM) ? += mac80211_hwsim.o
?obj-$(CONFIG_WL12XX) ? += wl12xx/
drivers/net/wireless/Makefile +2
-0+# small builtin driver bit +obj-$(CONFIG_WL12XX_PLATFORM_DATA) ? ? += wl12xx/wl12xx_platform_data.o?obj-$(CONFIG_IWM) ? ? ?+= iwmc3200wifi/
drivers/net/wireless/wl12xx/Kconfig +0
-0@@ -74,4 +74,7 @@ config WL1271_SDIO? ? ? ? ?If you choose to build a module, it'll be called ? ? ? ? ?wl1271_sdio. Say N if unsure.
drivers/net/wireless/wl12xx/Kconfig +4
-1- +config WL12XX_PLATFORM_DATA + ? ? ? bool + ? ? ? depends on WL1271_SDIO != n + ? ? ? default ydrivers/net/wireless/wl12xx/wl12xx_platform_data.c new file +31
-0@@ -0,0 +1,31 @@ +#include <linux/module.h> +#include <linux/wl12xx.h> + +static struct wl12xx_platform_data *platform_data; + +int __init wl12xx_set_platform_data (const struct wl12xx_platform_data *data) +{ + ? ? ? if (platform_data) + ? ? ? ? ? ? ? return -EBUSY; + ? ? ? if (!data) + ? ? ? ? ? ? ? return -EINVAL; + + ? ? ? platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL); + ? ? ? if (!platform_data) + ? ? ? ? ? ? ? return -ENOMEM; + + ? ? ? return 0; +} + +int wl12xx_get_platform_data (struct wl12xx_platform_data *data) +{ + ? ? ? if (!platform_data) + ? ? ? ? ? ? ? return -ENODEV; + ? ? ? if (!data) + ? ? ? ? ? ? ? return -EINVAL; + + ? ? ? memcpy(data, platform_data, sizeof(*data)); + + ? ? ? return 0; +} +EXPORT_SYMBOL (wl12xx_get_platform_data);include/linux/wl12xx.h +0
-0@@ -31,4 +31,7 @@ struct wl12xx_platform_data { ? ? ? ?bool use_eeprom; ?};
Quoted 6 lines
Quoted 4 lines
include/linux/wl12xx.h +3
-0+int wl12xx_set_platform_data (const struct wl12xx_platform_data *data); +int wl12xx_get_platform_data (struct wl12xx_platform_data *data); +?#endif
Why do you need all that copying? Isn't the data constant?
That was the original proposal from Russell;
AFAICT it's very similar to how platform device resources are handled
- it allows marking the original definition of the data as __initdata (need to add that) thus freeing up its space after the initialization phase completes. Later, in some scenarios, it might also allow to free up the copied data (not done now, but the copying happen only once in the lifetime of the driver so I'm fine with it).
Quoted 4 lines
Best Regards,
Micha? Miros?aw
PATCH v5 3/7 wireless: wl12xx: add platform data passing support
In reply to Michał MirosławQuoted 89 lines · Micha? Miros?aw
2010/9/1 Ohad Ben-Cohen <[email protected]>:
Quoted 88 lines
Add a simple mechanism to pass platform data to the SDIO instances of wl12xx.
This way there is no confusion over who owns the 'embedded data', typechecking is preserved, and no possibility for the wrong driver to pick up the data.
Originally proposed by Russell King.
Signed-off-by Ohad Ben-Cohen <[email protected]>---
?drivers/net/wireless/Makefile ? ? ? ? ? ? ? ? ? ? ?| ? ?2 + ?drivers/net/wireless/wl12xx/Kconfig ? ? ? ? ? ? ? ?| ? ?5 ++- ?drivers/net/wireless/wl12xx/wl12xx_platform_data.c | ? 31 ++++++++++++++++++++ ?include/linux/wl12xx.h ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?3 ++?4 files changed, 40 insertions(+), 1 deletions(-)
?create mode 100644drivers/net/wireless/wl12xx/wl12xx_platform_data.cdrivers/net/wireless/Makefile +0
-0@@ -50,5 +50,7 @@ obj-$(CONFIG_ATH_COMMON) ? ? ?+= ath/?obj-$(CONFIG_MAC80211_HWSIM) ? += mac80211_hwsim.o
?obj-$(CONFIG_WL12XX) ? += wl12xx/
drivers/net/wireless/Makefile +2
-0+# small builtin driver bit +obj-$(CONFIG_WL12XX_PLATFORM_DATA) ? ? += wl12xx/wl12xx_platform_data.o?obj-$(CONFIG_IWM) ? ? ?+= iwmc3200wifi/
drivers/net/wireless/wl12xx/Kconfig +0
-0@@ -74,4 +74,7 @@ config WL1271_SDIO? ? ? ? ?If you choose to build a module, it'll be called ? ? ? ? ?wl1271_sdio. Say N if unsure.
drivers/net/wireless/wl12xx/Kconfig +4
-1- +config WL12XX_PLATFORM_DATA + ? ? ? bool + ? ? ? depends on WL1271_SDIO != n + ? ? ? default ydrivers/net/wireless/wl12xx/wl12xx_platform_data.c new file +31
-0@@ -0,0 +1,31 @@ +#include <linux/module.h> +#include <linux/wl12xx.h> + +static struct wl12xx_platform_data *platform_data; + +int __init wl12xx_set_platform_data (const struct wl12xx_platform_data *data) +{ + ? ? ? if (platform_data) + ? ? ? ? ? ? ? return -EBUSY; + ? ? ? if (!data) + ? ? ? ? ? ? ? return -EINVAL; + + ? ? ? platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL); + ? ? ? if (!platform_data) + ? ? ? ? ? ? ? return -ENOMEM; + + ? ? ? return 0; +} + +int wl12xx_get_platform_data (struct wl12xx_platform_data *data) +{ + ? ? ? if (!platform_data) + ? ? ? ? ? ? ? return -ENODEV; + ? ? ? if (!data) + ? ? ? ? ? ? ? return -EINVAL; + + ? ? ? memcpy(data, platform_data, sizeof(*data)); + + ? ? ? return 0; +} +EXPORT_SYMBOL (wl12xx_get_platform_data);include/linux/wl12xx.h +0
-0@@ -31,4 +31,7 @@ struct wl12xx_platform_data { ? ? ? ?bool use_eeprom; ?};
Quoted 6 lines
Quoted 4 lines
include/linux/wl12xx.h +3
-0+int wl12xx_set_platform_data (const struct wl12xx_platform_data *data); +int wl12xx_get_platform_data (struct wl12xx_platform_data *data); +?#endif
Why do you need all that copying? Isn't the data constant?
The first copy is to allow platforms to have their data marked with __initdata. The second copy probably isn't necessary, but avoids problems where the driver may decide to modify the platform data.
We could instead make wl12xx_get_platform_data() return a const pointer to its own internal storage instead, or ERR pointers for the various failure cases.
PATCH v5 3/7 wireless: wl12xx: add platform data passing support
2010/9/6 Russell King - ARM Linux <[email protected]>:
Quoted 3 lines
We could instead make
wl12xx_get_platform_data()return a const pointer to its own internal storage instead, or ERR pointers for the various failure cases.
Sounds good:
(quoted diff) +0 -0
b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c new file mode 100644
index 0000000..973b110
drivers/net/wireless/wl12xx/wl12xx_platform_data.c new file +28 -0
@@ -0,0 +1,28 @@ +#include <linux/module.h> +#include <linux/err.h> +#include <linux/wl12xx.h> + +static const struct wl12xx_platform_data *platform_data; + +int __init wl12xx_set_platform_data (const struct wl12xx_platform_data *data) +{ +if (platform_data) +return -EBUSY ; +if (!data) +return -EINVAL ; + + platform_data =kmemdup (data,sizeof (*data),GFP_KERNEL ); +if (!platform_data) +return -ENOMEM ; + +return 0 ; +} + +const struct wl12xx_platform_data *wl12xx_get_platform_data (void ) +{ +if (!platform_data) +return ERR_PTR (-ENODEV ); + +return platform_data; +} +EXPORT_SYMBOL (wl12xx_get_platform_data);
I'll wait a few days to see if there's any other comment, and then post v6 with this change.
Quoted 1 line
PATCH v5 3/7 wireless: wl12xx: add platform data passing support
In reply to Russell King - ARM LinuxW dniu 6 wrze?nia 2010 14:07 u?ytkownik Russell King - ARM Linux <[email protected]> napisa?:
Quoted 4 lines · Micha? Miros?aw
Quoted 3 lines
2010/9/1 Ohad Ben-Cohen <[email protected]>:
Quoted 2 lines
Add a simple mechanism to pass platform data to the SDIO instances of wl12xx.
[cut patch]
Quoted 5 lines
Quoted 1 line
Why do you need all that copying? Isn't the data constant?
The first copy is to allow platforms to have their data marked with
__initdata. ?The second copy probably isn't necessary, but avoids problems where the driver may decide to modify the platform data.
Sorry for pushing at this, but why would you mark data that's meant to be used after init phase as __initdata?
Best Regards,
Micha? Miros?aw
PATCH v5 3/7 wireless: wl12xx: add platform data passing support
2010/9/6 Micha? Miros?aw <[email protected]>:
Quoted 7 lines
W dniu 6 wrze?nia 2010 14:07 u?ytkownik Russell King - ARM Linux <[email protected]> napisa?:
Quoted 4 lines · Micha? Miros?aw
Quoted 3 lines
2010/9/1 Ohad Ben-Cohen <[email protected]>:
Quoted 2 lines
Add a simple mechanism to pass platform data to the SDIO instances of wl12xx.
[cut patch]
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Why do you need all that copying? Isn't the data constant?
The first copy is to allow platforms to have their data marked with
__initdata. ?The second copy probably isn't necessary, but avoids problems where the driver may decide to modify the platform data.Sorry for pushing at this, but why would you mark data that's meant to be used after init phase as
__initdata?
I can remove the first copying as well if Russell is ok with it.
Both ways work for us.
Quoted 4 lines
Best Regards,
Micha? Miros?aw
PATCH v5 3/7 wireless: wl12xx: add platform data passing support
2010/9/15 Ohad Ben-Cohen <[email protected]>:
Quoted 4 lines
Quoted 2 lines
Sorry for pushing at this, but why would you mark data that's meant to be used after init phase as
__initdata?I can remove the first copying as well if Russell is ok with it.
I personally think it's not worth it. This copying basically happens only once and this point is soooo irrelevant. My position therefore
is: let's get the current implementation in, and if Michal is uncomfortable with that, he can come up with the patch. Let's concentrate on the real problems.
Thanks,
Vitaly
Tony Lindgren
maintainerPATCH v5 3/7 wireless: wl12xx: add platform data passing support
Quoted 11 lines · Vitaly Wool
2010/9/15 Ohad Ben-Cohen <[email protected]>:
Quoted 4 lines
Quoted 2 lines
Sorry for pushing at this, but why would you mark data that's meant to be used after init phase as
__initdata?I can remove the first copying as well if Russell is ok with it.
I personally think it's not worth it. This copying basically happens only once and this point is soooo irrelevant. My position therefore
is: let's get the current implementation in, and if Michal is uncomfortable with that, he can come up with the patch. Let's concentrate on the real problems.
This becomes an issue when compiling in support for multiple boards.. All the data that's not in use for the booted board should be __initdata.
Regards,
Tony
PATCH v5 3/7 wireless: wl12xx: add platform data passing support
In reply to Michał MirosławQuoted 7 lines · Micha? Miros?aw
W dniu 6 wrze?nia 2010 14:07 u?ytkownik Russell King - ARM Linux <[email protected]> napisa?:
Quoted 4 lines · Micha? Miros?aw
Quoted 3 lines
2010/9/1 Ohad Ben-Cohen <[email protected]>:
Quoted 2 lines
Add a simple mechanism to pass platform data to the SDIO instances of wl12xx.
[cut patch]
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Why do you need all that copying? Isn't the data constant?
The first copy is to allow platforms to have their data marked with
__initdata. ?The second copy probably isn't necessary, but avoids problems where the driver may decide to modify the platform data.Sorry for pushing at this, but why would you mark data that's meant to be used after init phase as
__initdata?
Because you may have many instances of the data (due to multiple platform support), and only need one of them at run-time.
PATCH v5 3/7 wireless: wl12xx: add platform data passing support
W dniu 15 wrze?nia 2010 10:25 u?ytkownik Russell King - ARM Linux <[email protected]> napisa?:
Quoted 8 lines · Micha? Miros?aw
Quoted 7 lines
W dniu 6 wrze?nia 2010 14:07 u?ytkownik Russell King - ARM Linux <[email protected]> napisa?:
Quoted 4 lines · Micha? Miros?aw
Quoted 3 lines
2010/9/1 Ohad Ben-Cohen <[email protected]>:
Quoted 2 lines
Add a simple mechanism to pass platform data to the SDIO instances of wl12xx.
[cut patch]
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Why do you need all that copying? Isn't the data constant?
The first copy is to allow platforms to have their data marked with
__initdata. ?The second copy probably isn't necessary, but avoids problems where the driver may decide to modify the platform data.Sorry for pushing at this, but why would you mark data that's meant to be used after init phase as
__initdata?Because you may have many instances of the data (due to multiple platform support), and only need one of them at run-time.
Ah. That makes sense.
Thanks,
Micha? Miros?aw
PATCH v5 4/7 wireless: wl1271: take irq info from private board data
In reply to Ohad Ben-CohenRemove the hard coded irq information, and instead take the irq information from the board's platform data.
--- drivers/net/wireless/wl12xx/wl1271_sdio.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/wireless/wl12xx/wl1271_sdio.c +7 -7
@@ -29,14 +29,12 @@#include <linux/mmc/sdio_ids.h> #include <linux/mmc/card.h> #include <linux/gpio.h> +#include <linux/wl12xx.h> #include "wl1271.h" #include "wl12xx_80211.h" #include "wl1271_io.h" - -#define RX71_WL1271_IRQ_GPIO 42 -#ifndef SDIO_VENDOR_ID_TI #define SDIO_VENDOR_ID_TI 0x0097#endif
@@ -186,6 +184,7 @@ static int __devinit wl1271_probe(struct sdio_func *func, const struct sdio_device_id *id) {struct ieee80211_hw *hw; +struct wl12xx_platform_data wlan_data;struct wl1271 *wl;int ret;
@@ -205,13 +204,14 @@ static int __devinit wl1271_probe(struct sdio_func *func,/* Grab access to FN0 for ELP reg. */ func->card->quirks |=MMC_QUIRK_LENIENT_FN0 ; - wl->irq =gpio_to_irq (RX71_WL1271_IRQ_GPIO ); -if (wl->irq <0 ) { - ret = wl->irq; -wl1271_error ("could not get irq!" ); + ret =wl12xx_get_platform_data (&wlan_data); +if (ret) { +wl1271_error ("missing wlan data (needed for irq/ref_clk)!" ); goto out_free; } + wl->irq = wlan_data.irq; + ret =request_irq (wl->irq, wl1271_irq,0 ,DRIVER_NAME , wl);if (ret <0 ) {wl1271_error ("request_irq() failed: %d" , ret);
Signature · 1 line
1.7.0.4
PATCH v5 5/7 wireless: wl1271: make ref_clock configurable by board
In reply to Ohad Ben-CohenThe wl1271 device is using a reference clock that may change between board to board.
Make the ref_clock parameter configurable by the board files that set up the device, instead of having a hard coded value in the driver source itself.
--- drivers/net/wireless/wl12xx/wl1271.h | 1 + drivers/net/wireless/wl12xx/wl1271_boot.c | 9 +++++---- drivers/net/wireless/wl12xx/wl1271_boot.h | 1 - drivers/net/wireless/wl12xx/wl1271_sdio.c | 1 + drivers/net/wireless/wl12xx/wl1271_spi.c | 2 ++ include/linux/wl12xx.h | 1 + 6 files changed, 10 insertions(+), 5 deletions(-)
drivers/net/wireless/wl12xx/wl1271.h +1 -0
@@ -330,6 +330,7 @@ struct wl1271 {void (*set_power)(bool enable);int irq; +int ref_clock;spinlock_t wl_lock;
drivers/net/wireless/wl12xx/wl1271_boot.c +5 -4
@@ -457,17 +457,18 @@ int wl1271_boot(struct wl1271 *wl) {int ret =0 ;u32 tmp, clk, pause; +int ref_clock = wl->ref_clock;wl1271_boot_hw_version (wl); -if (REF_CLOCK ==0 ||REF_CLOCK ==2 ||REF_CLOCK ==4 ) +if (ref_clock ==0 || ref_clock ==2 || ref_clock ==4 )/* ref clk: 19.2/38.4/38.4-XTAL */ clk =0x3 ; -else if (REF_CLOCK ==1 ||REF_CLOCK ==3 ) +else if (ref_clock ==1 || ref_clock ==3 )/* ref clk: 26/52 */ clk =0x5 ; -if (REF_CLOCK !=0 ) { +if (ref_clock !=0 ) {u16 val;/* Set clock type (open drain) */ val =wl1271_top_reg_read (wl,OCP_REG_CLK_TYPE );
@@ -516,7 +517,7 @@ int wl1271_boot(struct wl1271 *wl)wl1271_debug (DEBUG_BOOT ,"clk2 0x%x" , clk);/* 2 */ - clk |= (REF_CLOCK <<1 ) <<4 ; + clk |= (ref_clock <<1 ) <<4 ;wl1271_write32 (wl,DRPW_SCRATCH_START , clk);wl1271_set_partition (wl, &part_table[PART_WORK ]);
drivers/net/wireless/wl12xx/wl1271_boot.h +0 -1
@@ -46,7 +46,6 @@ struct wl1271_static_data {/* delay between retries */ #define INIT_LOOP_DELAY 50 -#define REF_CLOCK 2#define WU_COUNTER_PAUSE_VAL 0x3FF#define WELP_ARM_COMMAND_VAL 0x4
drivers/net/wireless/wl12xx/wl1271_sdio.c +1 -0
@@ -211,6 +211,7 @@ static int __devinit wl1271_probe(struct sdio_func *func, } wl->irq = wlan_data.irq; + wl->ref_clock = wlan_data.board_ref_clock; ret =request_irq (wl->irq, wl1271_irq,0 ,DRIVER_NAME , wl);if (ret <0 ) {
drivers/net/wireless/wl12xx/wl1271_spi.c +2 -0
@@ -372,6 +372,8 @@ static int __devinit wl1271_probe(struct spi_device *spi) goto out_free; } + wl->ref_clock = pdata->board_ref_clock; + wl->irq = spi->irq;if (wl->irq <0 ) {wl1271_error ("irq missing in platform data" );
include/linux/wl12xx.h +1 -0
@@ -29,6 +29,7 @@ struct wl12xx_platform_data {/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ int irq;bool use_eeprom; +int board_ref_clock; };int wl12xx_set_platform_data (const struct wl12xx_platform_data *data);
Signature · 1 line
1.7.0.4
PATCH v5 6/7 omap: zoom: add fixed regulator device for wlan
In reply to Ohad Ben-CohenAdd a fixed regulator vmmc device to enable power control of the wl1271 wlan device.
--- arch/arm/mach-omap2/board-zoom-peripherals.c | 35 ++++++++++++++++++++++++++ 1 files changed, 35 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-zoom-peripherals.c +35 -0
@@ -16,6 +16,7 @@#include <linux/gpio.h> #include <linux/i2c/twl.h> #include <linux/regulator/machine.h> +#include <linux/regulator/fixed.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -27,6 +28,8 @@#include "mux.h" #include "hsmmc.h" +#define OMAP_ZOOM_WLAN_PMENA_GPIO (101) +/* Zoom2 has Qwerty keyboard*/ static int board_keymap[] = {KEY (0 ,0 ,KEY_E ),
@@ -106,6 +109,11 @@ static struct regulator_consumer_supply zoom_vmmc2_supply = { .supply = "vmmc", }; +static struct regulator_consumer_supply zoom_vmmc3_supply = { + .supply ="vmmc" , + .dev_name ="mmci-omap-hs.2" , +}; +/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */ static struct regulator_init_data zoom_vmmc1 = { .constraints = {
@@ -151,6 +159,32 @@ static struct regulator_init_data zoom_vsim = { .consumer_supplies = &zoom_vsim_supply, }; +static struct regulator_init_data zoom_vmmc3 = { + .constraints = { + .valid_ops_mask =REGULATOR_CHANGE_STATUS , + }, + .num_consumer_supplies =1 , + .consumer_supplies = &zoom_vmmc3_supply, +}; + +static struct fixed_voltage_config zoom_vwlan = { + .supply_name ="vwl1271" , + .microvolts =1800000 ,/* 1.8V */ + .gpio =OMAP_ZOOM_WLAN_PMENA_GPIO , + .startup_delay =70000 ,/* 70msec */ + .enable_high =1 , + .enabled_at_boot =0 , + .init_data = &zoom_vmmc3, +}; + +static struct platform_device omap_vwlan_device = { + .name ="reg-fixed-voltage" , + .id =1 , + .dev = { + .platform_data = &zoom_vwlan, + }, +}; +static struct omap2_hsmmc_info mmc[]__initdata = { { .name ="external" ,
@@ -280,6 +314,7 @@ static void enable_board_wakeup_source(void)void __init zoom_peripherals_init (void ) {omap_i2c_init (); +platform_device_register (&omap_vwlan_device);usb_musb_init (&musb_board_data);enable_board_wakeup_source (); }
Signature · 1 line
1.7.0.4
PATCH v5 7/7 omap: zoom: add mmc3/wl1271 device support
In reply to Ohad Ben-CohenAdd MMC3 support on ZOOM, which is hardwired to the wl1271 device.
The wl1271 is a 4-wire, 1.8V, embedded SDIO WLAN device with an external IRQ line, and power-controlled by a GPIO-based fixed regulator.
--- arch/arm/mach-omap2/board-zoom-peripherals.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-zoom-peripherals.c +19 -0
@@ -17,6 +17,7 @@#include <linux/i2c/twl.h> #include <linux/regulator/machine.h> #include <linux/regulator/fixed.h> +#include <linux/wl12xx.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -29,6 +30,7 @@#include "hsmmc.h" #define OMAP_ZOOM_WLAN_PMENA_GPIO (101) +#define OMAP_ZOOM_WLAN_IRQ_GPIO (162)/* Zoom2 has Qwerty keyboard*/ static int board_keymap[] = {
@@ -185,6 +187,12 @@ static struct platform_device omap_vwlan_device = { }, }; +struct wl12xx_platform_data omap_zoom_wlan_data = { + .irq =OMAP_GPIO_IRQ (OMAP_ZOOM_WLAN_IRQ_GPIO ), +/* ZOOM ref clock is 26 MHz */ + .board_ref_clock =1 , +}; +static struct omap2_hsmmc_info mmc[]__initdata = { { .name ="external" ,
@@ -202,6 +210,14 @@ static struct omap2_hsmmc_info mmc[] __initdata = { .nonremovable = true, .power_saving = true, }, + { + .name = "wl1271", + .mmc = 3, + .wires = 4, + .gpio_wp = -EINVAL, + .gpio_cd = -EINVAL, + .nonremovable = true, + }, {}/* Terminator */ };
@@ -313,6 +329,9 @@ static void enable_board_wakeup_source(void)void __init zoom_peripherals_init (void ) { +if (wl12xx_set_platform_data (&omap_zoom_wlan_data)) +pr_err ("error setting wl12xx data\n" ); +omap_i2c_init ();platform_device_register (&omap_vwlan_device);usb_musb_init (&musb_board_data);
Signature · 1 line
1.7.0.4
v5 cover native wl1271 support on ZOOM
In reply to Ohad Ben-CohenQuoted 1 line · Ohad Ben-Cohen
This patchset adds wl1271 support on ZOOM2/3 boards.
Tony, John, let me please suggest merging this through the wireless tree.
wl1271 is a moving target - it keeps changing in the wireless tree and merging this patchset there will allow wl1271 developers to have everything in a single tree (and prevent merge conflicts in linux-next).
If that's ok with you, I will rebase this on top of wireless-testing and resubmit.
Quoted 40 lines
Only basic support is included; MMC power manipulation part is submitted separately as Runtime PM migration.
Changes since v4:
- Introduce a simple (yet safe) mechanism to pass platform-specific data to the driver, as suggested by Russell King. Currently only a single device is supported; multi-device support will be introduced only when/if requiredPatches are based on 2.6.36-rc3 and tested on ZOOM3.
Thanks,
Ohad Ben-Cohen (7):
?wireless: wl1271: makewl12xx.hcommon to both spi and sdio ?wireless: wl1271: support return value for the set power func ?wireless: wl12xx: add platform data passing support ?wireless: wl1271: take irq info from private board data ?wireless: wl1271: makeref_clockconfigurable by board ?omap: zoom: add fixed regulator device for wlan ?omap: zoom: add mmc3/wl1271 device support?arch/arm/mach-omap2/board-zoom-peripherals.c ? ? ? | ? 54 ++++++++++++++++++++ ?drivers/net/wireless/Makefile ? ? ? ? ? ? ? ? ? ? ?| ? ?2 + ?drivers/net/wireless/wl12xx/Kconfig ? ? ? ? ? ? ? ?| ? ?5 ++- ?drivers/net/wireless/wl12xx/wl1251_sdio.c ? ? ? ? ?| ? ?2 +- ?drivers/net/wireless/wl12xx/wl1251_spi.c ? ? ? ? ? | ? ?2 +- ?drivers/net/wireless/wl12xx/wl1271.h ? ? ? ? ? ? ? | ? ?3 +- ?drivers/net/wireless/wl12xx/wl1271_boot.c ? ? ? ? ?| ? ?9 ++-- ?drivers/net/wireless/wl12xx/wl1271_boot.h ? ? ? ? ?| ? ?1 - ?drivers/net/wireless/wl12xx/wl1271_io.h ? ? ? ? ? ?| ? ?9 ++- ?drivers/net/wireless/wl12xx/wl1271_main.c ? ? ? ? ?| ? ?4 +- ?drivers/net/wireless/wl12xx/wl1271_sdio.c ? ? ? ? ?| ? 19 ++++--- ?drivers/net/wireless/wl12xx/wl1271_spi.c ? ? ? ? ? | ? ?8 ++- ?drivers/net/wireless/wl12xx/wl12xx_platform_data.c | ? 31 +++++++++++ ?include/linux/spi/wl12xx.h ? ? ? ? ? ? ? ? ? ? ? ? | ? 34 ------------ ?include/linux/wl12xx.h ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? 38 ++++++++++++++?15 files changed, 164 insertions(+), 57 deletions(-) ?create mode 100644
drivers/net/wireless/wl12xx/wl12xx_platform_data.c?delete mode 100644include/linux/spi/wl12xx.h
?create mode 100644include/linux/wl12xx.h
v5 cover native wl1271 support on ZOOM
Quoted 9 lines · Ohad Ben-Cohen
Quoted 1 line · Ohad Ben-Cohen
This patchset adds wl1271 support on ZOOM2/3 boards.
Tony, John, let me please suggest merging this through the wireless tree.
wl1271 is a moving target - it keeps changing in the wireless tree and merging this patchset there will allow wl1271 developers to have everything in a single tree (and prevent merge conflicts in linux-next).
Thanks Ohad, that's what I was about to suggest as well. :)
Thanks,
Vitaly
v5 cover native wl1271 support on ZOOM
Quoted 4 lines · Vitaly Wool
Quoted 3 lines · Ohad Ben-Cohen
Quoted 1 line · Ohad Ben-Cohen
This patchset adds wl1271 support on ZOOM2/3 boards.
Quoted 8 lines
Quoted 6 lines
Tony, John, let me please suggest merging this through the wireless tree.
wl1271 is a moving target - it keeps changing in the wireless tree and merging this patchset there will allow wl1271 developers to have everything in a single tree (and prevent merge conflicts in linux-next).
Thanks Ohad, that's what I was about to suggest as well. :)
OK, that is fine with me if the omap folks agree?
John
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.
Tony Lindgren
maintainerv5 cover native wl1271 support on ZOOM
Quoted 7 lines · John W. Linville
Quoted 6 lines · Vitaly Wool
Quoted 5 lines · Ohad Ben-Cohen
Quoted 1 line · Ohad Ben-Cohen
This patchset adds wl1271 support on ZOOM2/3 boards.
Tony, John, let me please suggest merging this through the wireless tree.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
wl1271 is a moving target - it keeps changing in the wireless tree and merging this patchset there will allow wl1271 developers to have everything in a single tree (and prevent merge conflicts in linux-next).
Thanks Ohad, that's what I was about to suggest as well. :)
OK, that is fine with me if the omap folks agree?
Yes sounds good to me, I think there's still at least some platform_data conversation going on though.
Tony
v5 cover native wl1271 support on ZOOM
Quoted 13 lines · Tony Lindgren
Quoted 12 lines · John W. Linville
Quoted 11 lines · Vitaly Wool
Quoted 9 lines · Ohad Ben-Cohen
Quoted 1 line · Ohad Ben-Cohen
This patchset adds wl1271 support on ZOOM2/3 boards.
Tony, John, let me please suggest merging this through the wireless tree.
wl1271 is a moving target - it keeps changing in the wireless tree and merging this patchset there will allow wl1271 developers to have everything in a single tree (and prevent merge conflicts in linux-next).
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Thanks Ohad, that's what I was about to suggest as well. :)
OK, that is fine with me if the omap folks agree?
Yes sounds good to me
Great, I will rebase to wireless-testing an resubmit.
Quoted 2 lines
I think there's still at least some
platform_data
conversation going on though.
Last issue was resolved today with Russell's (and yours) latest answer.
Thanks,
Ohad.
Quoted 3 lines
Tony