2013-06-25 20:33:29

by Luciano Coelho

[permalink] [raw]
Subject: [PATCH 0/5] wilink: add device tree support

Hi,

This patch series add device tree support to the wlcore_sdio driver,
which is used by WiLink6, WiLink7 and WiLink8.

The first patches do some clean-up to make the data needed in the
wilink device tree node smaller. The last patch implements the actual
device tree node parsing in wlcore_sdio.

The DTS file changes will be sent separately, since they need to go
via different trees.

--
Luca.

Luciano Coelho (5):
wl1251: split wl251 platform data to a separate structure
wlcore: use irq_flags in pdata instead of hiding it behing a quirk
wlcore: remove pwr_in_suspend from platform data
wlcore: always use one-shot IRQ
wlcore: add device tree support to the sdio module

arch/arm/mach-davinci/board-da850-evm.c | 2 +-
arch/arm/mach-omap2/board-4430sdp.c | 1 +
arch/arm/mach-omap2/board-omap3evm.c | 1 +
arch/arm/mach-omap2/board-omap3pandora.c | 4 +-
arch/arm/mach-omap2/board-omap4panda.c | 1 +
arch/arm/mach-omap2/board-rx51-peripherals.c | 2 +-
arch/arm/mach-omap2/board-zoom-peripherals.c | 1 +
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 +-
drivers/net/wireless/ti/wlcore/debugfs.c | 2 +-
drivers/net/wireless/ti/wlcore/main.c | 16 ++---
drivers/net/wireless/ti/wlcore/sdio.c | 77 +++++++++++++++++++++---
drivers/net/wireless/ti/wlcore/wlcore.h | 5 +-
drivers/net/wireless/ti/wlcore/wlcore_i.h | 1 +
include/linux/wl12xx.h | 28 +++++++--
16 files changed, 147 insertions(+), 45 deletions(-)

--
1.7.10.4



2013-06-25 20:33:32

by Luciano Coelho

[permalink] [raw]
Subject: [PATCH 2/5] wlcore: use irq_flags in pdata instead of hiding it behing a quirk

The platform_quirk element in the platform data was used to change the
way the IRQ is triggered. When set, the EDGE_IRQ quirk would change
the irqflags used and treat edge trigger differently from the rest.

Instead of hiding this irq flag setting behind the quirk, export the
whole irq_flags element and let the board file define what to use.
This will be more meaningful than driver-specific quirks when we
switch to DT.

Cc: Tony Lindgren <[email protected]>
Cc: Sekhar Nori <[email protected]>
Signed-off-by: Luciano Coelho <[email protected]>
---
arch/arm/mach-davinci/board-da850-evm.c | 2 +-
arch/arm/mach-omap2/board-4430sdp.c | 1 +
arch/arm/mach-omap2/board-omap3evm.c | 1 +
arch/arm/mach-omap2/board-omap4panda.c | 1 +
arch/arm/mach-omap2/board-zoom-peripherals.c | 1 +
drivers/net/wireless/ti/wlcore/debugfs.c | 2 +-
drivers/net/wireless/ti/wlcore/main.c | 13 +++----------
drivers/net/wireless/ti/wlcore/wlcore.h | 5 ++---
include/linux/wl12xx.h | 5 +----
9 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 8a24b6c..d2a2a98 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -1377,8 +1377,8 @@ static const short da850_wl12xx_pins[] __initconst = {

static struct wl12xx_platform_data da850_wl12xx_wlan_data __initdata = {
.irq = -1,
+ .irq_flags = IRQF_TRIGGER_RISING,
.board_ref_clock = WL12XX_REFCLOCK_38,
- .platform_quirks = WL12XX_PLATFORM_QUIRK_EDGE_IRQ,
};

static __init int da850_wl12xx_init(void)
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 56a9a4f..c2334aa 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -693,6 +693,7 @@ static void __init omap4_sdp4430_wifi_mux_init(void)
}

static struct wl12xx_platform_data omap4_sdp4430_wlan_data __initdata = {
+ .irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
.board_ref_clock = WL12XX_REFCLOCK_26,
.board_tcxo_clock = WL12XX_TCXOCLOCK_26,
};
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index f76d0de..a0c0adf 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -458,6 +458,7 @@ static struct platform_device omap3evm_wlan_regulator = {
};

struct wl12xx_platform_data omap3evm_wlan_data __initdata = {
+ .irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
.board_ref_clock = WL12XX_REFCLOCK_38, /* 38.4 MHz */
};
#endif
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 1e2c75e..ba00862 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -230,6 +230,7 @@ static struct platform_device omap_vwlan_device = {
};

static struct wl12xx_platform_data omap_panda_wlan_data __initdata = {
+ .irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
.board_ref_clock = WL12XX_REFCLOCK_38, /* 38.4 MHz */
};

diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
index a90375d..ced012c 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -244,6 +244,7 @@ static struct platform_device *zoom_devices[] __initdata = {
};

static struct wl12xx_platform_data omap_zoom_wlan_data __initdata = {
+ .irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
.board_ref_clock = WL12XX_REFCLOCK_26, /* 26 MHz */
};

diff --git a/drivers/net/wireless/ti/wlcore/debugfs.c b/drivers/net/wireless/ti/wlcore/debugfs.c
index c3e1f79..5eff663 100644
--- a/drivers/net/wireless/ti/wlcore/debugfs.c
+++ b/drivers/net/wireless/ti/wlcore/debugfs.c
@@ -486,7 +486,7 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf,
DRIVER_STATE_PRINT_HEX(irq);
/* TODO: ref_clock and tcxo_clock were moved to wl12xx priv */
DRIVER_STATE_PRINT_HEX(hw_pg_ver);
- DRIVER_STATE_PRINT_HEX(platform_quirks);
+ DRIVER_STATE_PRINT_HEX(irq_flags);
DRIVER_STATE_PRINT_HEX(chip.id);
DRIVER_STATE_PRINT_STR(chip.fw_ver_str);
DRIVER_STATE_PRINT_STR(chip.phy_fw_ver_str);
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index b8db55c..e7294b8 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -516,7 +516,7 @@ static int wlcore_irq_locked(struct wl1271 *wl)
* In case edge triggered interrupt must be used, we cannot iterate
* more than once without introducing race conditions with the hardirq.
*/
- if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ)
+ if (wl->irq_flags & IRQF_TRIGGER_RISING)
loopcount = 1;

wl1271_debug(DEBUG_IRQ, "IRQ work");
@@ -5765,7 +5765,6 @@ struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size, u32 aggr_buf_size,
wl->ap_ps_map = 0;
wl->ap_fw_ps_map = 0;
wl->quirks = 0;
- wl->platform_quirks = 0;
wl->system_hlid = WL12XX_SYSTEM_HLID;
wl->active_sta_count = 0;
wl->active_link_count = 0;
@@ -5901,7 +5900,6 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
struct platform_device *pdev = wl->pdev;
struct wlcore_platdev_data *pdev_data = pdev->dev.platform_data;
struct wl12xx_platform_data *pdata = pdev_data->pdata;
- unsigned long irqflags;
int ret;

if (fw) {
@@ -5928,16 +5926,11 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
wlcore_adjust_conf(wl);

wl->irq = platform_get_irq(pdev, 0);
- wl->platform_quirks = pdata->platform_quirks;
wl->if_ops = pdev_data->if_ops;
-
- if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ)
- irqflags = IRQF_TRIGGER_RISING;
- else
- irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT;
+ wl->irq_flags = pdata->irq_flags;

ret = request_threaded_irq(wl->irq, NULL, wlcore_irq,
- irqflags, pdev->name, wl);
+ wl->irq_flags, pdev->name, wl);
if (ret < 0) {
wl1271_error("request_irq() failed: %d", ret);
goto out_free_nvs;
diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h
index 0034979..8306bde 100644
--- a/drivers/net/wireless/ti/wlcore/wlcore.h
+++ b/drivers/net/wireless/ti/wlcore/wlcore.h
@@ -185,6 +185,8 @@ struct wl1271 {

int irq;

+ int irq_flags;
+
spinlock_t wl_lock;

enum wlcore_state state;
@@ -384,9 +386,6 @@ struct wl1271 {
/* Quirks of specific hardware revisions */
unsigned int quirks;

- /* Platform limitations */
- unsigned int platform_quirks;
-
/* number of currently active RX BA sessions */
int ba_rx_session_count;

diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index b516b4f..04e3096 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -57,15 +57,12 @@ struct wl1251_platform_data {

struct wl12xx_platform_data {
int irq;
+ unsigned long irq_flags;
int board_ref_clock;
int board_tcxo_clock;
- unsigned long platform_quirks;
bool pwr_in_suspend;
};

-/* Platform does not support level trigger interrupts */
-#define WL12XX_PLATFORM_QUIRK_EDGE_IRQ BIT(0)
-
#ifdef CONFIG_WILINK_PLATFORM_DATA

int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
--
1.7.10.4


2013-06-26 06:17:27

by Luciano Coelho

[permalink] [raw]
Subject: Re: [PATCH 2/5] wlcore: use irq_flags in pdata instead of hiding it behing a quirk

On Tue, 2013-06-25 at 23:33 +0300, Luciano Coelho wrote:
> The platform_quirk element in the platform data was used to change the
> way the IRQ is triggered. When set, the EDGE_IRQ quirk would change
> the irqflags used and treat edge trigger differently from the rest.
>
> Instead of hiding this irq flag setting behind the quirk, export the
> whole irq_flags element and let the board file define what to use.
> This will be more meaningful than driver-specific quirks when we
> switch to DT.
>
> Cc: Tony Lindgren <[email protected]>
> Cc: Sekhar Nori <[email protected]>
> Signed-off-by: Luciano Coelho <[email protected]>
> ---

(added Sekhar, forgot to remove my --suppress-cc :P)

Hey Tony and Sekhar,

Another patch with tiny changes in some board files. Is it okay if I
send it via my tree?

This is part of some clean-up work I did to make the DT implementation
simpler.

--
Cheers,
Luca.

> arch/arm/mach-davinci/board-da850-evm.c | 2 +-
> arch/arm/mach-omap2/board-4430sdp.c | 1 +
> arch/arm/mach-omap2/board-omap3evm.c | 1 +
> arch/arm/mach-omap2/board-omap4panda.c | 1 +
> arch/arm/mach-omap2/board-zoom-peripherals.c | 1 +
> drivers/net/wireless/ti/wlcore/debugfs.c | 2 +-
> drivers/net/wireless/ti/wlcore/main.c | 13 +++----------
> drivers/net/wireless/ti/wlcore/wlcore.h | 5 ++---
> include/linux/wl12xx.h | 5 +----
> 9 files changed, 12 insertions(+), 19 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index 8a24b6c..d2a2a98 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -1377,8 +1377,8 @@ static const short da850_wl12xx_pins[] __initconst = {
>
> static struct wl12xx_platform_data da850_wl12xx_wlan_data __initdata = {
> .irq = -1,
> + .irq_flags = IRQF_TRIGGER_RISING,
> .board_ref_clock = WL12XX_REFCLOCK_38,
> - .platform_quirks = WL12XX_PLATFORM_QUIRK_EDGE_IRQ,
> };
>
> static __init int da850_wl12xx_init(void)
> diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
> index 56a9a4f..c2334aa 100644
> --- a/arch/arm/mach-omap2/board-4430sdp.c
> +++ b/arch/arm/mach-omap2/board-4430sdp.c
> @@ -693,6 +693,7 @@ static void __init omap4_sdp4430_wifi_mux_init(void)
> }
>
> static struct wl12xx_platform_data omap4_sdp4430_wlan_data __initdata = {
> + .irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
> .board_ref_clock = WL12XX_REFCLOCK_26,
> .board_tcxo_clock = WL12XX_TCXOCLOCK_26,
> };
> diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
> index f76d0de..a0c0adf 100644
> --- a/arch/arm/mach-omap2/board-omap3evm.c
> +++ b/arch/arm/mach-omap2/board-omap3evm.c
> @@ -458,6 +458,7 @@ static struct platform_device omap3evm_wlan_regulator = {
> };
>
> struct wl12xx_platform_data omap3evm_wlan_data __initdata = {
> + .irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
> .board_ref_clock = WL12XX_REFCLOCK_38, /* 38.4 MHz */
> };
> #endif
> diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
> index 1e2c75e..ba00862 100644
> --- a/arch/arm/mach-omap2/board-omap4panda.c
> +++ b/arch/arm/mach-omap2/board-omap4panda.c
> @@ -230,6 +230,7 @@ static struct platform_device omap_vwlan_device = {
> };
>
> static struct wl12xx_platform_data omap_panda_wlan_data __initdata = {
> + .irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
> .board_ref_clock = WL12XX_REFCLOCK_38, /* 38.4 MHz */
> };
>
> diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
> index a90375d..ced012c 100644
> --- a/arch/arm/mach-omap2/board-zoom-peripherals.c
> +++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
> @@ -244,6 +244,7 @@ static struct platform_device *zoom_devices[] __initdata = {
> };
>
> static struct wl12xx_platform_data omap_zoom_wlan_data __initdata = {
> + .irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
> .board_ref_clock = WL12XX_REFCLOCK_26, /* 26 MHz */
> };
>
> diff --git a/drivers/net/wireless/ti/wlcore/debugfs.c b/drivers/net/wireless/ti/wlcore/debugfs.c
> index c3e1f79..5eff663 100644
> --- a/drivers/net/wireless/ti/wlcore/debugfs.c
> +++ b/drivers/net/wireless/ti/wlcore/debugfs.c
> @@ -486,7 +486,7 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf,
> DRIVER_STATE_PRINT_HEX(irq);
> /* TODO: ref_clock and tcxo_clock were moved to wl12xx priv */
> DRIVER_STATE_PRINT_HEX(hw_pg_ver);
> - DRIVER_STATE_PRINT_HEX(platform_quirks);
> + DRIVER_STATE_PRINT_HEX(irq_flags);
> DRIVER_STATE_PRINT_HEX(chip.id);
> DRIVER_STATE_PRINT_STR(chip.fw_ver_str);
> DRIVER_STATE_PRINT_STR(chip.phy_fw_ver_str);
> diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
> index b8db55c..e7294b8 100644
> --- a/drivers/net/wireless/ti/wlcore/main.c
> +++ b/drivers/net/wireless/ti/wlcore/main.c
> @@ -516,7 +516,7 @@ static int wlcore_irq_locked(struct wl1271 *wl)
> * In case edge triggered interrupt must be used, we cannot iterate
> * more than once without introducing race conditions with the hardirq.
> */
> - if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ)
> + if (wl->irq_flags & IRQF_TRIGGER_RISING)
> loopcount = 1;
>
> wl1271_debug(DEBUG_IRQ, "IRQ work");
> @@ -5765,7 +5765,6 @@ struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size, u32 aggr_buf_size,
> wl->ap_ps_map = 0;
> wl->ap_fw_ps_map = 0;
> wl->quirks = 0;
> - wl->platform_quirks = 0;
> wl->system_hlid = WL12XX_SYSTEM_HLID;
> wl->active_sta_count = 0;
> wl->active_link_count = 0;
> @@ -5901,7 +5900,6 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
> struct platform_device *pdev = wl->pdev;
> struct wlcore_platdev_data *pdev_data = pdev->dev.platform_data;
> struct wl12xx_platform_data *pdata = pdev_data->pdata;
> - unsigned long irqflags;
> int ret;
>
> if (fw) {
> @@ -5928,16 +5926,11 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
> wlcore_adjust_conf(wl);
>
> wl->irq = platform_get_irq(pdev, 0);
> - wl->platform_quirks = pdata->platform_quirks;
> wl->if_ops = pdev_data->if_ops;
> -
> - if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ)
> - irqflags = IRQF_TRIGGER_RISING;
> - else
> - irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT;
> + wl->irq_flags = pdata->irq_flags;
>
> ret = request_threaded_irq(wl->irq, NULL, wlcore_irq,
> - irqflags, pdev->name, wl);
> + wl->irq_flags, pdev->name, wl);
> if (ret < 0) {
> wl1271_error("request_irq() failed: %d", ret);
> goto out_free_nvs;
> diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h
> index 0034979..8306bde 100644
> --- a/drivers/net/wireless/ti/wlcore/wlcore.h
> +++ b/drivers/net/wireless/ti/wlcore/wlcore.h
> @@ -185,6 +185,8 @@ struct wl1271 {
>
> int irq;
>
> + int irq_flags;
> +
> spinlock_t wl_lock;
>
> enum wlcore_state state;
> @@ -384,9 +386,6 @@ struct wl1271 {
> /* Quirks of specific hardware revisions */
> unsigned int quirks;
>
> - /* Platform limitations */
> - unsigned int platform_quirks;
> -
> /* number of currently active RX BA sessions */
> int ba_rx_session_count;
>
> diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
> index b516b4f..04e3096 100644
> --- a/include/linux/wl12xx.h
> +++ b/include/linux/wl12xx.h
> @@ -57,15 +57,12 @@ struct wl1251_platform_data {
>
> struct wl12xx_platform_data {
> int irq;
> + unsigned long irq_flags;
> int board_ref_clock;
> int board_tcxo_clock;
> - unsigned long platform_quirks;
> bool pwr_in_suspend;
> };
>
> -/* Platform does not support level trigger interrupts */
> -#define WL12XX_PLATFORM_QUIRK_EDGE_IRQ BIT(0)
> -
> #ifdef CONFIG_WILINK_PLATFORM_DATA
>
> int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);



2013-06-25 20:33:34

by Luciano Coelho

[permalink] [raw]
Subject: [PATCH 1/5] 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.

Cc: Tony Lindgren <[email protected]>
Signed-off-by: Luciano Coelho <[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(-)

diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 28133d5..bf06d95 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -540,7 +540,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));
@@ -554,7 +554,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;

diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 18ca61e..733f3f2 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -80,7 +80,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)
diff --git a/drivers/net/wireless/ti/wilink_platform_data.c b/drivers/net/wireless/ti/wilink_platform_data.c
index 998e958..a92bd3e 100644
--- a/drivers/net/wireless/ti/wilink_platform_data.c
+++ b/drivers/net/wireless/ti/wilink_platform_data.c
@@ -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);
diff --git a/drivers/net/wireless/ti/wl1251/sdio.c b/drivers/net/wireless/ti/wl1251/sdio.c
index e2b3d9c..b75a37a 100644
--- a/drivers/net/wireless/ti/wl1251/sdio.c
+++ b/drivers/net/wireless/ti/wl1251/sdio.c
@@ -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) {
diff --git a/drivers/net/wireless/ti/wl1251/spi.c b/drivers/net/wireless/ti/wl1251/spi.c
index c7dc6fe..6bbbfe6 100644
--- a/drivers/net/wireless/ti/wl1251/spi.c
+++ b/drivers/net/wireless/ti/wl1251/spi.c
@@ -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;
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index a54fe82..b516b4f 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -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
--
1.7.10.4


2013-06-25 20:33:34

by Luciano Coelho

[permalink] [raw]
Subject: [PATCH 3/5] wlcore: remove pwr_in_suspend from platform data

The pwr_in_suspend flag depends on the MMC settings which can be
retrieved from the SDIO subsystem, so it doesn't need to be part of
the platform data structure. Move it to the platform device data that
is passed from SDIO to wlcore.

Signed-off-by: Luciano Coelho <[email protected]>
---
drivers/net/wireless/ti/wlcore/main.c | 2 +-
drivers/net/wireless/ti/wlcore/sdio.c | 2 +-
drivers/net/wireless/ti/wlcore/wlcore_i.h | 1 +
include/linux/wl12xx.h | 1 -
4 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index e7294b8..d306cd5 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -5941,7 +5941,7 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
if (!ret) {
wl->irq_wake_enabled = true;
device_init_wakeup(wl->dev, 1);
- if (pdata->pwr_in_suspend)
+ if (pdev_data->pwr_in_suspend)
wl->hw->wiphy->wowlan = &wlcore_wowlan_support;
}
#endif
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c
index 29ef249..4c7e8ac 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -260,7 +260,7 @@ static int wl1271_probe(struct sdio_func *func,
dev_dbg(glue->dev, "sdio PM caps = 0x%x\n", mmcflags);

if (mmcflags & MMC_PM_KEEP_POWER)
- pdev_data->pdata->pwr_in_suspend = true;
+ pdev_data->pwr_in_suspend = true;

sdio_set_drvdata(func, glue);

diff --git a/drivers/net/wireless/ti/wlcore/wlcore_i.h b/drivers/net/wireless/ti/wlcore/wlcore_i.h
index e5e1464..f2c4227 100644
--- a/drivers/net/wireless/ti/wlcore/wlcore_i.h
+++ b/drivers/net/wireless/ti/wlcore/wlcore_i.h
@@ -209,6 +209,7 @@ struct wl1271_if_operations {
struct wlcore_platdev_data {
struct wl12xx_platform_data *pdata;
struct wl1271_if_operations *if_ops;
+ bool pwr_in_suspend;
};

#define MAX_NUM_KEYS 14
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 04e3096..1e4ed6e 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -60,7 +60,6 @@ struct wl12xx_platform_data {
unsigned long irq_flags;
int board_ref_clock;
int board_tcxo_clock;
- bool pwr_in_suspend;
};

#ifdef CONFIG_WILINK_PLATFORM_DATA
--
1.7.10.4


2013-06-26 06:38:00

by Tony Lindgren

[permalink] [raw]
Subject: Re: [PATCH 1/5] wl1251: split wl251 platform data to a separate structure

* Luciano Coelho <[email protected]> [130625 23:21]:
> On Tue, 2013-06-25 at 23:33 +0300, Luciano Coelho wrote:
> > 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]>
> > ---
>
> Hey Tony,
>
> Is it okay if I send this patch via my tree? There are a couple of tiny
> changes in a couple of OMAP board files...

Yes that's fine, those should not conflict with anything else. For
the arch/arm/*omap* parts:

Acked-by: Tony Lindgren <[email protected]>

2013-06-25 20:33:35

by Luciano Coelho

[permalink] [raw]
Subject: [PATCH 4/5] wlcore: always use one-shot IRQ

Since we are now using threaded IRQs without the primary handler, we
need to set IRQF_ONESHOT, otherwise our request will fail.

Signed-off-by: Luciano Coelho <[email protected]>
---
drivers/net/wireless/ti/wlcore/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index d306cd5..bc1cff3 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -5927,7 +5927,8 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)

wl->irq = platform_get_irq(pdev, 0);
wl->if_ops = pdev_data->if_ops;
- wl->irq_flags = pdata->irq_flags;
+ /* Since we don't use the primary handler, we must set ONESHOT */
+ wl->irq_flags = pdata->irq_flags | IRQF_ONESHOT;

ret = request_threaded_irq(wl->irq, NULL, wlcore_irq,
wl->irq_flags, pdev->name, wl);
--
1.7.10.4


2013-06-26 06:38:58

by Tony Lindgren

[permalink] [raw]
Subject: Re: [PATCH 2/5] wlcore: use irq_flags in pdata instead of hiding it behing a quirk

* Luciano Coelho <[email protected]> [130625 13:39]:
> The platform_quirk element in the platform data was used to change the
> way the IRQ is triggered. When set, the EDGE_IRQ quirk would change
> the irqflags used and treat edge trigger differently from the rest.
>
> Instead of hiding this irq flag setting behind the quirk, export the
> whole irq_flags element and let the board file define what to use.
> This will be more meaningful than driver-specific quirks when we
> switch to DT.
>

Acked-by: Tony Lindgren <[email protected]>

> Cc: Sekhar Nori <[email protected]>
> Signed-off-by: Luciano Coelho <[email protected]>

2013-06-26 06:15:24

by Luciano Coelho

[permalink] [raw]
Subject: Re: [PATCH 1/5] wl1251: split wl251 platform data to a separate structure

On Tue, 2013-06-25 at 23:33 +0300, Luciano Coelho wrote:
> 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]>
> ---

Hey Tony,

Is it okay if I send this patch via my tree? There are a couple of tiny
changes in a couple of OMAP board files...

--
Luca.

> 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(-)
>
> diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
> index 28133d5..bf06d95 100644
> --- a/arch/arm/mach-omap2/board-omap3pandora.c
> +++ b/arch/arm/mach-omap2/board-omap3pandora.c
> @@ -540,7 +540,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));
> @@ -554,7 +554,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;
>
> diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
> index 18ca61e..733f3f2 100644
> --- a/arch/arm/mach-omap2/board-rx51-peripherals.c
> +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
> @@ -80,7 +80,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)
> diff --git a/drivers/net/wireless/ti/wilink_platform_data.c b/drivers/net/wireless/ti/wilink_platform_data.c
> index 998e958..a92bd3e 100644
> --- a/drivers/net/wireless/ti/wilink_platform_data.c
> +++ b/drivers/net/wireless/ti/wilink_platform_data.c
> @@ -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);
> diff --git a/drivers/net/wireless/ti/wl1251/sdio.c b/drivers/net/wireless/ti/wl1251/sdio.c
> index e2b3d9c..b75a37a 100644
> --- a/drivers/net/wireless/ti/wl1251/sdio.c
> +++ b/drivers/net/wireless/ti/wl1251/sdio.c
> @@ -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) {
> diff --git a/drivers/net/wireless/ti/wl1251/spi.c b/drivers/net/wireless/ti/wl1251/spi.c
> index c7dc6fe..6bbbfe6 100644
> --- a/drivers/net/wireless/ti/wl1251/spi.c
> +++ b/drivers/net/wireless/ti/wl1251/spi.c
> @@ -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;
> diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
> index a54fe82..b516b4f 100644
> --- a/include/linux/wl12xx.h
> +++ b/include/linux/wl12xx.h
> @@ -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



2013-06-25 20:33:36

by Luciano Coelho

[permalink] [raw]
Subject: [PATCH 5/5] wlcore: add device tree support to the sdio module

If platform data is not available, try to get the required information
from the device tree. Register an OF match table and parse the
appropriate device tree nodes.

Signed-off-by: Luciano Coelho <[email protected]>
---
drivers/net/wireless/ti/wlcore/sdio.c | 75 ++++++++++++++++++++++++++++++---
1 file changed, 69 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c
index 4c7e8ac..1ddda84 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -30,7 +30,7 @@
#include <linux/mmc/sdio_ids.h>
#include <linux/mmc/card.h>
#include <linux/mmc/host.h>
-#include <linux/gpio.h>
+#include <linux/of_irq.h>
#include <linux/wl12xx.h>
#include <linux/pm_runtime.h>
#include <linux/printk.h>
@@ -214,6 +214,49 @@ static struct wl1271_if_operations sdio_ops = {
.set_block_size = wl1271_sdio_set_block_size,
};

+static struct wl12xx_platform_data *wlcore_get_pdata_from_of(struct device *dev)
+{
+ struct wl12xx_platform_data *pdata;
+ struct device_node *np = dev->of_node;
+
+ if (!np) {
+ np = of_find_matching_node(NULL, dev->driver->of_match_table);
+ if (!np) {
+ dev_notice(dev, "device tree node not available\n");
+ pdata = ERR_PTR(-ENODEV);
+ goto out;
+ }
+ }
+
+ pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
+ if (!pdata) {
+ dev_err(dev, "can't allocate platform data\n");
+ pdata = ERR_PTR(-ENODEV);
+ goto out;
+ }
+
+ pdata->irq = irq_of_parse_and_map(np, 0);
+ if (pdata->irq < 0) {
+ dev_err(dev, "can't get interrupt gpio from the device tree\n");
+ goto out_free;
+ }
+
+ /* TODO: make sure we have this when needed (ie. for WL6 and WL7) */
+ of_property_read_u32(np, "refclock", &pdata->board_ref_clock);
+
+ /* TODO: make sure we have this when needed (ie. for WL7) */
+ of_property_read_u32(np, "tcxoclock", &pdata->board_tcxo_clock);
+
+ goto out;
+
+out_free:
+ kfree(pdata);
+ pdata = ERR_PTR(-ENODEV);
+
+out:
+ return pdata;
+}
+
static int wl1271_probe(struct sdio_func *func,
const struct sdio_device_id *id)
{
@@ -248,11 +291,22 @@ static int wl1271_probe(struct sdio_func *func,
/* Use block mode for transferring over one block size of data */
func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;

+ /* The pdata allocated here is freed when the device is freed,
+ * so we don't need an additional out label to free it in case
+ * of error further on.
+ */
+
+ /* Try to get legacy platform data from the board file */
pdev_data->pdata = wl12xx_get_platform_data();
if (IS_ERR(pdev_data->pdata)) {
- ret = PTR_ERR(pdev_data->pdata);
- dev_err(glue->dev, "missing wlan platform data: %d\n", ret);
- goto out_free_glue;
+ dev_info(&func->dev,
+ "legacy platform data not found, trying device tree\n");
+
+ pdev_data->pdata = wlcore_get_pdata_from_of(&func->dev);
+ if (IS_ERR(pdev_data->pdata)) {
+ dev_err(&func->dev, "can't get platform data\n");
+ goto out_free_glue;
+ }
}

/* if sdio can keep power while host is suspended, enable wow */
@@ -386,16 +440,25 @@ static const struct dev_pm_ops wl1271_sdio_pm_ops = {
};
#endif

+static const struct of_device_id wlcore_sdio_of_match_table[] = {
+ { .compatible = "ti,wilink6" },
+ { .compatible = "ti,wilink7" },
+ { .compatible = "ti,wilink8" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, wlcore_sdio_of_match_table);
+
static struct sdio_driver wl1271_sdio_driver = {
.name = "wl1271_sdio",
.id_table = wl1271_devices,
.probe = wl1271_probe,
.remove = wl1271_remove,
-#ifdef CONFIG_PM
.drv = {
+#ifdef CONFIG_PM
.pm = &wl1271_sdio_pm_ops,
- },
#endif
+ .of_match_table = of_match_ptr(wlcore_sdio_of_match_table),
+ },
};

static int __init wl1271_init(void)
--
1.7.10.4