2010-09-01 21:26:59

by Ohad Ben Cohen

[permalink] [raw]
Subject: [PATCH v5 0/7] 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



2010-09-15 08:26:05

by Russell King - ARM Linux

[permalink] [raw]
Subject: Re: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

On Mon, Sep 06, 2010 at 09:42:41PM +0200, Michał Mirosław wrote:
> W dniu 6 września 2010 14:07 użytkownik Russell King - ARM Linux
> <[email protected]> napisał:
> > On Sat, Sep 04, 2010 at 02:23:19PM +0200, Michał Mirosław wrote:
> >> 2010/9/1 Ohad Ben-Cohen <[email protected]>:
> >> > Add a simple mechanism to pass platform data to the
> >> > SDIO instances of wl12xx.
> [cut patch]
> >> 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.

2010-09-15 16:40:03

by Tony Lindgren

[permalink] [raw]
Subject: Re: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

* Vitaly Wool <[email protected]> [100915 01:18]:
> 2010/9/15 Ohad Ben-Cohen <[email protected]>:
> >> 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

2010-09-06 13:46:45

by Ohad Ben Cohen

[permalink] [raw]
Subject: Re: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

2010/9/6 Russell King - ARM Linux <[email protected]>:
> 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:

diff --git a/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
new file mode 100644
index 0000000..973b110
--- /dev/null
+++ b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
@@ -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.

>

2010-09-06 12:07:46

by Russell King - ARM Linux

[permalink] [raw]
Subject: Re: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

On Sat, Sep 04, 2010 at 02:23:19PM +0200, Michał Mirosław wrote:
> 2010/9/1 Ohad Ben-Cohen <[email protected]>:
> > 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 100644 drivers/net/wireless/wl12xx/wl12xx_platform_data.c
> >
> > diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
> > index 5d4ce4d..85af697 100644
> > --- a/drivers/net/wireless/Makefile
> > +++ b/drivers/net/wireless/Makefile
> > @@ -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/
> > diff --git a/drivers/net/wireless/wl12xx/Kconfig b/drivers/net/wireless/wl12xx/Kconfig
> > index 2f98058..4a8bb25 100644
> > --- a/drivers/net/wireless/wl12xx/Kconfig
> > +++ b/drivers/net/wireless/wl12xx/Kconfig
> > @@ -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
> > diff --git a/drivers/net/wireless/wl12xx/wl12xx_platform_data.c b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
> > new file mode 100644
> > index 0000000..e00973b
> > --- /dev/null
> > +++ b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
> > @@ -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);
> > diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
> > index 137ac89..3e33ae1 100644
> > --- a/include/linux/wl12xx.h
> > +++ b/include/linux/wl12xx.h
> > @@ -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
>
> 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.

2010-09-15 08:27:02

by Vitaly Wool

[permalink] [raw]
Subject: Re: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

2010/9/15 Ohad Ben-Cohen <[email protected]>:
>> 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

2010-09-01 21:28:51

by Ohad Ben Cohen

[permalink] [raw]
Subject: [PATCH v5 5/7] wireless: wl1271: make ref_clock configurable by board

The 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.

Signed-off-by: Ohad Ben-Cohen <[email protected]>
---
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(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index faa5925..4134f44 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -330,6 +330,7 @@ struct wl1271 {

void (*set_power)(bool enable);
int irq;
+ int ref_clock;

spinlock_t wl_lock;

diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.c b/drivers/net/wireless/wl12xx/wl1271_boot.c
index f36430b..95c636a 100644
--- a/drivers/net/wireless/wl12xx/wl1271_boot.c
+++ b/drivers/net/wireless/wl12xx/wl1271_boot.c
@@ -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]);
diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.h b/drivers/net/wireless/wl12xx/wl1271_boot.h
index f829699..f73b0b1 100644
--- a/drivers/net/wireless/wl12xx/wl1271_boot.h
+++ b/drivers/net/wireless/wl12xx/wl1271_boot.h
@@ -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

diff --git a/drivers/net/wireless/wl12xx/wl1271_sdio.c b/drivers/net/wireless/wl12xx/wl1271_sdio.c
index 7f4461c..824b9e8 100644
--- a/drivers/net/wireless/wl12xx/wl1271_sdio.c
+++ b/drivers/net/wireless/wl12xx/wl1271_sdio.c
@@ -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) {
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c
index de56d8d..ced0a9e 100644
--- a/drivers/net/wireless/wl12xx/wl1271_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1271_spi.c
@@ -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");
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 3e33ae1..0116d88 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -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);
--
1.7.0.4


2010-09-15 11:08:20

by Vitaly Wool

[permalink] [raw]
Subject: Re: [PATCH v5 0/7] native wl1271 support on ZOOM

On Wed, Sep 15, 2010 at 11:21 AM, Ohad Ben-Cohen <[email protected]> wrote:
> On Wed, Sep 1, 2010 at 11:26 PM, Ohad Ben-Cohen <[email protected]> wrote:
>> 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

2010-09-01 21:27:53

by Ohad Ben Cohen

[permalink] [raw]
Subject: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

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 100644 drivers/net/wireless/wl12xx/wl12xx_platform_data.c

diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
index 5d4ce4d..85af697 100644
--- a/drivers/net/wireless/Makefile
+++ b/drivers/net/wireless/Makefile
@@ -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/
diff --git a/drivers/net/wireless/wl12xx/Kconfig b/drivers/net/wireless/wl12xx/Kconfig
index 2f98058..4a8bb25 100644
--- a/drivers/net/wireless/wl12xx/Kconfig
+++ b/drivers/net/wireless/wl12xx/Kconfig
@@ -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
diff --git a/drivers/net/wireless/wl12xx/wl12xx_platform_data.c b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
new file mode 100644
index 0000000..e00973b
--- /dev/null
+++ b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
@@ -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);
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 137ac89..3e33ae1 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -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
--
1.7.0.4


2010-09-15 08:00:45

by Ohad Ben Cohen

[permalink] [raw]
Subject: Re: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

2010/9/6 Micha? Miros?aw <[email protected]>:
> W dniu 6 wrze?nia 2010 14:07 u?ytkownik Russell King - ARM Linux
> <[email protected]> napisa?:
>> On Sat, Sep 04, 2010 at 02:23:19PM +0200, Micha? Miros?aw wrote:
>>> 2010/9/1 Ohad Ben-Cohen <[email protected]>:
>>> > Add a simple mechanism to pass platform data to the
>>> > SDIO instances of wl12xx.
> [cut patch]
>>> 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.

>
> Best Regards,
> Micha? Miros?aw
>

2010-09-15 16:10:24

by Michał Mirosław

[permalink] [raw]
Subject: Re: [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?:
> On Mon, Sep 06, 2010 at 09:42:41PM +0200, Micha? Miros?aw wrote:
>> W dniu 6 wrze?nia 2010 14:07 u?ytkownik Russell King - ARM Linux
>> <[email protected]> napisa?:
>> > On Sat, Sep 04, 2010 at 02:23:19PM +0200, Micha? Miros?aw wrote:
>> >> 2010/9/1 Ohad Ben-Cohen <[email protected]>:
>> >> > Add a simple mechanism to pass platform data to the
>> >> > SDIO instances of wl12xx.
>> [cut patch]
>> >> 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

2010-09-01 21:28:04

by Ohad Ben Cohen

[permalink] [raw]
Subject: [PATCH v5 4/7] wireless: wl1271: take irq info from private board data

Remove the hard coded irq information, and instead take
the irq information from the board's platform data.

Signed-off-by: Ohad Ben-Cohen <[email protected]>
---
drivers/net/wireless/wl12xx/wl1271_sdio.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_sdio.c b/drivers/net/wireless/wl12xx/wl1271_sdio.c
index c41293a..7f4461c 100644
--- a/drivers/net/wireless/wl12xx/wl1271_sdio.c
+++ b/drivers/net/wireless/wl12xx/wl1271_sdio.c
@@ -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);
--
1.7.0.4


2010-09-04 12:23:20

by Michał Mirosław

[permalink] [raw]
Subject: Re: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

2010/9/1 Ohad Ben-Cohen <[email protected]>:
> 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 100644 drivers/net/wireless/wl12xx/wl12xx_platform_data.c
>
> diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
> index 5d4ce4d..85af697 100644
> --- a/drivers/net/wireless/Makefile
> +++ b/drivers/net/wireless/Makefile
> @@ -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/
> diff --git a/drivers/net/wireless/wl12xx/Kconfig b/drivers/net/wireless/wl12xx/Kconfig
> index 2f98058..4a8bb25 100644
> --- a/drivers/net/wireless/wl12xx/Kconfig
> +++ b/drivers/net/wireless/wl12xx/Kconfig
> @@ -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
> diff --git a/drivers/net/wireless/wl12xx/wl12xx_platform_data.c b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
> new file mode 100644
> index 0000000..e00973b
> --- /dev/null
> +++ b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
> @@ -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);
> diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
> index 137ac89..3e33ae1 100644
> --- a/include/linux/wl12xx.h
> +++ b/include/linux/wl12xx.h
> @@ -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

Why do you need all that copying? Isn't the data constant?

Best Regards,
Micha? Miros?aw

2010-09-15 16:46:50

by Ohad Ben Cohen

[permalink] [raw]
Subject: Re: [PATCH v5 0/7] native wl1271 support on ZOOM

On Wed, Sep 15, 2010 at 6:34 PM, Tony Lindgren <[email protected]> wrote:
> * John W. Linville <[email protected]> [100915 06:21]:
>> On Wed, Sep 15, 2010 at 01:08:18PM +0200, Vitaly Wool wrote:
>> > On Wed, Sep 15, 2010 at 11:21 AM, Ohad Ben-Cohen <[email protected]> wrote:
>> > > On Wed, Sep 1, 2010 at 11:26 PM, Ohad Ben-Cohen <[email protected]> wrote:
>> > >> 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. :)
>>
>> 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.

> 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.

>
> Tony
>

2010-09-01 21:27:15

by Ohad Ben Cohen

[permalink] [raw]
Subject: [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.

Signed-off-by: Ohad Ben-Cohen <[email protected]>
---
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

diff --git a/drivers/net/wireless/wl12xx/wl1251_sdio.c b/drivers/net/wireless/wl12xx/wl1251_sdio.c
index b901b61..a319df1 100644
--- a/drivers/net/wireless/wl12xx/wl1251_sdio.c
+++ b/drivers/net/wireless/wl12xx/wl1251_sdio.c
@@ -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"
diff --git a/drivers/net/wireless/wl12xx/wl1251_spi.c b/drivers/net/wireless/wl12xx/wl1251_spi.c
index 27fdfaa..a6faf3e 100644
--- a/drivers/net/wireless/wl12xx/wl1251_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1251_spi.c
@@ -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"
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c
index 4cb99c5..c3fdab7 100644
--- a/drivers/net/wireless/wl12xx/wl1271_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1271_spi.c
@@ -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"
diff --git a/include/linux/spi/wl12xx.h b/include/linux/spi/wl12xx.h
deleted file mode 100644
index a223ecb..0000000
--- a/include/linux/spi/wl12xx.h
+++ /dev/null
@@ -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
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
new file mode 100644
index 0000000..137ac89
--- /dev/null
+++ b/include/linux/wl12xx.h
@@ -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
--
1.7.0.4


2010-09-06 11:56:16

by Ohad Ben Cohen

[permalink] [raw]
Subject: Re: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

2010/9/4 Micha? Miros?aw <[email protected]>:
> 2010/9/1 Ohad Ben-Cohen <[email protected]>:
>> 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 100644 drivers/net/wireless/wl12xx/wl12xx_platform_data.c
>>
>> diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
>> index 5d4ce4d..85af697 100644
>> --- a/drivers/net/wireless/Makefile
>> +++ b/drivers/net/wireless/Makefile
>> @@ -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/
>> diff --git a/drivers/net/wireless/wl12xx/Kconfig b/drivers/net/wireless/wl12xx/Kconfig
>> index 2f98058..4a8bb25 100644
>> --- a/drivers/net/wireless/wl12xx/Kconfig
>> +++ b/drivers/net/wireless/wl12xx/Kconfig
>> @@ -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
>> diff --git a/drivers/net/wireless/wl12xx/wl12xx_platform_data.c b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
>> new file mode 100644
>> index 0000000..e00973b
>> --- /dev/null
>> +++ b/drivers/net/wireless/wl12xx/wl12xx_platform_data.c
>> @@ -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);
>> diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
>> index 137ac89..3e33ae1 100644
>> --- a/include/linux/wl12xx.h
>> +++ b/include/linux/wl12xx.h
>> @@ -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
>
> 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).

>
> Best Regards,
> Micha? Miros?aw
>

2010-09-01 21:31:11

by Ohad Ben Cohen

[permalink] [raw]
Subject: [PATCH v5 6/7] omap: zoom: add fixed regulator device for wlan

Add a fixed regulator vmmc device to enable power control
of the wl1271 wlan device.

Signed-off-by: Ohad Ben-Cohen <[email protected]>
---
arch/arm/mach-omap2/board-zoom-peripherals.c | 35 ++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
index 6b39849..de88635 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -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();
}
--
1.7.0.4


2010-09-01 21:27:30

by Ohad Ben Cohen

[permalink] [raw]
Subject: [PATCH v5 2/7] wireless: wl1271: support return value for the set power func

Make 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.

Signed-off-by: Ohad Ben-Cohen <[email protected]>
---
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(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index dd3cee6..faa5925 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -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);
diff --git a/drivers/net/wireless/wl12xx/wl1271_io.h b/drivers/net/wireless/wl12xx/wl1271_io.h
index bc806c7..c1f92e6 100644
--- a/drivers/net/wireless/wl12xx/wl1271_io.h
+++ b/drivers/net/wireless/wl12xx/wl1271_io.h
@@ -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;
}


diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 9d68f00..e6e0852 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -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);
diff --git a/drivers/net/wireless/wl12xx/wl1271_sdio.c b/drivers/net/wireless/wl12xx/wl1271_sdio.c
index 7059b5c..c41293a 100644
--- a/drivers/net/wireless/wl12xx/wl1271_sdio.c
+++ b/drivers/net/wireless/wl12xx/wl1271_sdio.c
@@ -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 = {
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c
index c3fdab7..de56d8d 100644
--- a/drivers/net/wireless/wl12xx/wl1271_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1271_spi.c
@@ -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 = {
--
1.7.0.4


2010-09-01 21:29:33

by Ohad Ben Cohen

[permalink] [raw]
Subject: [PATCH v5 7/7] omap: zoom: add mmc3/wl1271 device support

Add 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.

Signed-off-by: Ohad Ben-Cohen <[email protected]>
---
arch/arm/mach-omap2/board-zoom-peripherals.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
index de88635..7ee5663 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -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);
--
1.7.0.4


2010-09-15 13:29:44

by John W. Linville

[permalink] [raw]
Subject: Re: [PATCH v5 0/7] native wl1271 support on ZOOM

On Wed, Sep 15, 2010 at 01:08:18PM +0200, Vitaly Wool wrote:
> On Wed, Sep 15, 2010 at 11:21 AM, Ohad Ben-Cohen <[email protected]> wrote:
> > On Wed, Sep 1, 2010 at 11:26 PM, Ohad Ben-Cohen <[email protected]> wrote:
> >> 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. :)

OK, that is fine with me if the omap folks agree?

John
--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.

2010-09-15 16:34:32

by Tony Lindgren

[permalink] [raw]
Subject: Re: [PATCH v5 0/7] native wl1271 support on ZOOM

* John W. Linville <[email protected]> [100915 06:21]:
> On Wed, Sep 15, 2010 at 01:08:18PM +0200, Vitaly Wool wrote:
> > On Wed, Sep 15, 2010 at 11:21 AM, Ohad Ben-Cohen <[email protected]> wrote:
> > > On Wed, Sep 1, 2010 at 11:26 PM, Ohad Ben-Cohen <[email protected]> wrote:
> > >> 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. :)
>
> 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

2010-09-15 09:21:43

by Ohad Ben Cohen

[permalink] [raw]
Subject: Re: [PATCH v5 0/7] native wl1271 support on ZOOM

On Wed, Sep 1, 2010 at 11:26 PM, Ohad Ben-Cohen <[email protected]> wrote:
> 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.

>
> 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
>
>

2010-09-06 19:42:43

by Michał Mirosław

[permalink] [raw]
Subject: Re: [PATCH v5 3/7] wireless: wl12xx: add platform data passing support

W dniu 6 wrze?nia 2010 14:07 u?ytkownik Russell King - ARM Linux
<[email protected]> napisa?:
> On Sat, Sep 04, 2010 at 02:23:19PM +0200, Micha? Miros?aw wrote:
>> 2010/9/1 Ohad Ben-Cohen <[email protected]>:
>> > Add a simple mechanism to pass platform data to the
>> > SDIO instances of wl12xx.
[cut patch]
>> 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