Skip to contentSkip to conversation

wlcore: add device-tree support

PATCH Superseded Eliad Peller 10 participants 33 messages Mar 12, 2015 – Mar 20, 2015

Subsystems (7)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover wlcore: add device-tree support

Add device-tree support to the wlcore (wl12xx/wl18xx) driver.

Update the current users to use the bindings instead of pdata-quirks.

Finally, remove the deprecated wl12xx_platform_data struct (along with the da850 board file code that still uses it)

NOTE: all the platform patches were compile-tested only. I'm looking for some wl12xx card (that i should have somewhere) to test the wl12xx changes (wrt. clocks), but haven't found it yet.

v6:
* Add Luca's patches to pass irq_trigger/freq
* Support wl12xx as well
* Update all relevant platforms

Eliad Peller (4):
dt: bindings: add TI's wilink wireless device
wlcore: add device-tree support
ARM: dts: add wl12xx/wl18xx bindings
wlcore: remove wl12xx_platform_data

Luciano Coelho (2):
wlcore: set irq_trigger in board files instead of hiding behind a
quirk
wl12xx: use frequency instead of enumerations for pdata clocks

 .../devicetree/bindings/net/wireless/ti,wlcore.txt |  47 +++++++++
 arch/arm/boot/dts/am335x-evmsk.dts                 |  11 ++
 arch/arm/boot/dts/omap3-cm-t3517.dts               |  10 ++
 arch/arm/boot/dts/omap3-cm-t3730.dts               |  10 ++
 arch/arm/boot/dts/omap3-evm-common.dtsi            |  10 ++
 arch/arm/boot/dts/omap3-igep0020-rev-f.dts         |   9 ++
 arch/arm/boot/dts/omap3-igep0030-rev-g.dts         |   9 ++
 arch/arm/boot/dts/omap3-zoom3.dts                  |  10 ++
 arch/arm/boot/dts/omap4-panda-common.dtsi          |  10 ++
 arch/arm/boot/dts/omap4-sdp.dts                    |  11 ++
 arch/arm/boot/dts/omap4-var-som-om44-wlan.dtsi     |  10 ++
 arch/arm/mach-davinci/Kconfig                      |  11 --
 arch/arm/mach-davinci/board-da850-evm.c            | 112 ---------------------
 arch/arm/mach-omap2/pdata-quirks.c                 |  79 ---------------
 drivers/net/wireless/ti/wilink_platform_data.c     |  25 -----
 drivers/net/wireless/ti/wl12xx/main.c              |  63 ++++++++++--
 drivers/net/wireless/ti/wl12xx/wl12xx.h            |  28 ++++++
 drivers/net/wireless/ti/wlcore/boot.c              |   1 -
 drivers/net/wireless/ti/wlcore/debugfs.c           |   2 +-
 drivers/net/wireless/ti/wlcore/main.c              |  31 +++---
 drivers/net/wireless/ti/wlcore/sdio.c              |  64 ++++++++++--
 drivers/net/wireless/ti/wlcore/wlcore.h            |   5 +-
 drivers/net/wireless/ti/wlcore/wlcore_i.h          |   8 +-
 include/linux/wl12xx.h                             |  49 ---------
 24 files changed, 313 insertions(+), 312 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/wireless/ti,wlcore.txt
Signature · 1 line
1.8.5.2.229.g4448466.dirty
#1 lore raw

PATCH v6 1/6 wlcore: set irq_trigger in board files instead of hiding behind a quirk

From: Luciano Coelho <[email protected]>

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, have the board files set the irq_trigger explicitly.

This will allow us to use standard irq DT definitions later on.

[Eliad - rebase, add irq_trigger field and pass it, update board file changes]

---
 arch/arm/mach-davinci/board-da850-evm.c  |  2 +-
 arch/arm/mach-omap2/pdata-quirks.c       |  1 +
 drivers/net/wireless/ti/wlcore/debugfs.c |  2 +-
 drivers/net/wireless/ti/wlcore/main.c    | 27 ++++++++++++++++-----------
 drivers/net/wireless/ti/wlcore/sdio.c    |  2 +-
 drivers/net/wireless/ti/wlcore/wlcore.h  |  5 ++---
 include/linux/wl12xx.h                   |  5 +----
 7 files changed, 23 insertions(+), 21 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +1 -1
index 6b5a97d..916589c 100644
@@ -1385,8 +1385,8 @@ static const short da850_wl12xx_pins[] __initconst = {
 
 static struct wl12xx_platform_data da850_wl12xx_wlan_data __initdata = {
 	.irq			= -1,
+	.irq_trigger		= IRQ_TYPE_EDGE_RISING,
 	.board_ref_clock	= WL12XX_REFCLOCK_38,
-	.platform_quirks	= WL12XX_PLATFORM_QUIRK_EDGE_IRQ,
 };
 
 static __init int da850_wl12xx_init(void)
arch/arm/mach-omap2/pdata-quirks.c +1 -0
index 190fa43..4449f4c 100644
@@ -48,6 +48,7 @@ static void __init __used legacy_init_wl12xx(unsigned ref_clock,
 	wl12xx.board_ref_clock = ref_clock;
 	wl12xx.board_tcxo_clock = tcxo_clock;
 	wl12xx.irq = gpio_to_irq(gpio);
+	wl12xx.irq_trigger = IRQ_TYPE_LEVEL_HIGH;
 
 	res = wl12xx_set_platform_data(&wl12xx);
 	if (res) {
drivers/net/wireless/ti/wlcore/debugfs.c +1 -1
index 68f3bf2..eb43f94 100644
@@ -502,7 +502,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);
drivers/net/wireless/ti/wlcore/main.c +16 -11
index 1e13699..67518f6 100644
@@ -27,6 +27,7 @@
 #include <linux/vmalloc.h>
 #include <linux/wl12xx.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
 
 #include "wlcore.h"
 #include "debug.h"
@@ -538,7 +539,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 | IRQF_TRIGGER_FALLING))
 		loopcount = 1;
 
 	wl1271_debug(DEBUG_IRQ, "IRQ work");
@@ -6249,7 +6250,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;
@@ -6391,7 +6391,8 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
 	struct platform_device *pdev = wl->pdev;
 	struct wlcore_platdev_data *pdev_data = dev_get_platdata(&pdev->dev);
 	struct wl12xx_platform_data *pdata = pdev_data->pdata;
-	unsigned long irqflags;
+	struct resource *res;
+
 	int ret;
 	irq_handler_t hardirq_fn = NULL;
 
@@ -6418,19 +6419,23 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
 	/* adjust some runtime configuration parameters */
 	wlcore_adjust_conf(wl);
 
-	wl->irq = platform_get_irq(pdev, 0);
-	wl->platform_quirks = pdata->platform_quirks;
+	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+	if (!res) {
+		wl1271_error("Could not get IRQ resource");
+		goto out_free_nvs;
+	}
+
+	wl->irq = res->start;
+	wl->irq_flags = res->flags & IRQF_TRIGGER_MASK;
 	wl->if_ops = pdev_data->if_ops;
 
-	if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ) {
-		irqflags = IRQF_TRIGGER_RISING;
+	if (wl->irq_flags & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING))
 		hardirq_fn = wlcore_hardirq;
-	} else {
-		irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT;
-	}
+	else
+		wl->irq_flags |= IRQF_ONESHOT;
 
 	ret = request_threaded_irq(wl->irq, hardirq_fn, 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;
drivers/net/wireless/ti/wlcore/sdio.c +1 -1
index d3dd7bf..2bce00a 100644
@@ -287,7 +287,7 @@ static int wl1271_probe(struct sdio_func *func,
 	memset(res, 0x00, sizeof(res));
 
 	res[0].start = pdev_data.pdata->irq;
-	res[0].flags = IORESOURCE_IRQ;
+	res[0].flags = IORESOURCE_IRQ | pdev_data.pdata->irq_trigger;
 	res[0].name = "irq";
 
 	ret = platform_device_add_resources(glue->core, res, ARRAY_SIZE(res));
drivers/net/wireless/ti/wlcore/wlcore.h +2 -3
index d599c86..7f363fa 100644
@@ -197,6 +197,8 @@ struct wl1271 {
 
 	int irq;
 
+	int irq_flags;
+
 	spinlock_t wl_lock;
 
 	enum wlcore_state state;
@@ -404,9 +406,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;
 
include/linux/wl12xx.h +1 -4
index a9c723b..3876b67 100644
@@ -57,15 +57,12 @@ struct wl1251_platform_data {
 
 struct wl12xx_platform_data {
 	int irq;
+	u32 irq_trigger;
 	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);
Signature · 1 line
1.8.5.2.229.g4448466.dirty
#2 lore raw

PATCH v6 2/6 wl12xx: use frequency instead of enumerations for pdata clocks

In reply to Eliad Peller

From: Luciano Coelho <[email protected]>

Instead of defining an enumeration with the FW specific values for the different clock rates, use the actual frequency instead. Also add a boolean to specify whether the clock is XTAL or not.

Change all board files to reflect this.

[Eliad - small fixes, update board file changes]
---
 arch/arm/mach-davinci/board-da850-evm.c |  3 +-
 arch/arm/mach-omap2/pdata-quirks.c      | 29 ++++++++--------
 drivers/net/wireless/ti/wl12xx/main.c   | 60 ++++++++++++++++++++++++++++++---
 drivers/net/wireless/ti/wl12xx/wl12xx.h | 28 +++++++++++++++
 include/linux/wl12xx.h                  | 27 ++-------------
 5 files changed, 103 insertions(+), 44 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +2 -1
index 916589c..853b941 100644
@@ -1386,7 +1386,8 @@ static const short da850_wl12xx_pins[] __initconst = {
 static struct wl12xx_platform_data da850_wl12xx_wlan_data __initdata = {
 	.irq			= -1,
 	.irq_trigger		= IRQ_TYPE_EDGE_RISING,
-	.board_ref_clock	= WL12XX_REFCLOCK_38,
+	.ref_clock_freq		= 38400000,
+	.ref_clock_xtal		= false,
 };
 
 static __init int da850_wl12xx_init(void)
arch/arm/mach-omap2/pdata-quirks.c +14 -15
index 4449f4c..337cc22 100644
@@ -39,14 +39,14 @@ static struct twl4030_gpio_platform_data twl_gpio_auxdata;
 
 static struct wl12xx_platform_data wl12xx __initdata;
 
-static void __init __used legacy_init_wl12xx(unsigned ref_clock,
-					     unsigned tcxo_clock,
+static void __init __used legacy_init_wl12xx(u32 ref_clock_freq,
+					     u32 tcxo_clock_freq,
 					     int gpio)
 {
 	int res;
 
-	wl12xx.board_ref_clock = ref_clock;
-	wl12xx.board_tcxo_clock = tcxo_clock;
+	wl12xx.ref_clock_freq = ref_clock_freq;
+	wl12xx.tcxo_clock_freq = tcxo_clock_freq;
 	wl12xx.irq = gpio_to_irq(gpio);
 	wl12xx.irq_trigger = IRQ_TYPE_LEVEL_HIGH;
 
@@ -57,8 +57,8 @@ static void __init __used legacy_init_wl12xx(unsigned ref_clock,
 	}
 }
 #else
-static inline void legacy_init_wl12xx(unsigned ref_clock,
-				      unsigned tcxo_clock,
+static inline void legacy_init_wl12xx(u32 ref_clock_freq,
+				      u32 tcxo_clock_freq,
 				      int gpio)
 {
 }
@@ -130,7 +130,7 @@ static void __init omap3_sbc_t3730_twl_init(void)
 static void __init omap3_sbc_t3730_legacy_init(void)
 {
 	omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub");
-	legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 136);
+	legacy_init_wl12xx(38400000, 0, 136);
 }
 
 static void __init omap3_sbc_t3530_legacy_init(void)
@@ -174,12 +174,12 @@ static void __init omap3_igep0030_rev_g_legacy_init(void)
 
 static void __init omap3_evm_legacy_init(void)
 {
-	legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 149);
+	legacy_init_wl12xx(38400000, 0, 149);
 }
 
 static void __init omap3_zoom_legacy_init(void)
 {
-	legacy_init_wl12xx(WL12XX_REFCLOCK_26, 0, 162);
+	legacy_init_wl12xx(26000000, 0, 162);
 }
 
 static void am35xx_enable_emac_int(void)
@@ -246,7 +246,7 @@ static void __init omap3_sbc_t3517_legacy_init(void)
 	am35xx_emac_reset();
 	hsmmc2_internal_input_clk();
 	omap3_sbc_t3517_wifi_init();
-	legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 145);
+	legacy_init_wl12xx(38400000, 0, 145);
 }
 
 static void __init am3517_evm_legacy_init(void)
@@ -291,18 +291,17 @@ static void __init omap3_tao3530_legacy_init(void)
 #ifdef CONFIG_ARCH_OMAP4
 static void __init omap4_sdp_legacy_init(void)
 {
-	legacy_init_wl12xx(WL12XX_REFCLOCK_26,
-			   WL12XX_TCXOCLOCK_26, 53);
+	legacy_init_wl12xx(26000000, 26000000, 53);
 }
 
 static void __init omap4_panda_legacy_init(void)
 {
-	legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 53);
+	legacy_init_wl12xx(38400000, 0, 53);
 }
 
 static void __init var_som_om44_legacy_init(void)
 {
-	legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 41);
+	legacy_init_wl12xx(38400000, 0, 41);
 }
 #endif
 
@@ -317,7 +316,7 @@ static struct iommu_platform_data omap4_iommu_pdata = {
 #ifdef CONFIG_SOC_AM33XX
 static void __init am335x_evmsk_legacy_init(void)
 {
-	legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 31);
+	legacy_init_wl12xx(38400000, 0, 31);
 }
 #endif
 
drivers/net/wireless/ti/wl12xx/main.c +56 -4

78 lines not on this page · raw message

drivers/net/wireless/ti/wl12xx/wl12xx.h +28 -0
index 75c9265..5952e99a 100644
@@ -82,6 +82,34 @@ struct wl12xx_priv {
 	struct wl127x_rx_mem_pool_addr *rx_mem_addr;
 };
 
+/* Reference clock values */
+enum {
+	WL12XX_REFCLOCK_19	= 0, /* 19.2 MHz */
+	WL12XX_REFCLOCK_26	= 1, /* 26 MHz */
+	WL12XX_REFCLOCK_38	= 2, /* 38.4 MHz */
+	WL12XX_REFCLOCK_52	= 3, /* 52 MHz */
+	WL12XX_REFCLOCK_38_XTAL = 4, /* 38.4 MHz, XTAL */
+	WL12XX_REFCLOCK_26_XTAL = 5, /* 26 MHz, XTAL */
+};
+
+/* TCXO clock values */
+enum {
+	WL12XX_TCXOCLOCK_19_2	= 0, /* 19.2MHz */
+	WL12XX_TCXOCLOCK_26	= 1, /* 26 MHz */
+	WL12XX_TCXOCLOCK_38_4	= 2, /* 38.4MHz */
+	WL12XX_TCXOCLOCK_52	= 3, /* 52 MHz */
+	WL12XX_TCXOCLOCK_16_368	= 4, /* 16.368 MHz */
+	WL12XX_TCXOCLOCK_32_736	= 5, /* 32.736 MHz */
+	WL12XX_TCXOCLOCK_16_8	= 6, /* 16.8 MHz */
+	WL12XX_TCXOCLOCK_33_6	= 7, /* 33.6 MHz */
+};
+
+struct wl12xx_clock {
+	u32	freq;
+	bool	xtal;
+	u8	hw_idx;
+};
+
 struct wl12xx_fw_packet_counters {
 	/* Cumulative counter of released packets per AC */
 	u8 tx_released_pkts[NUM_TX_QUEUES];
include/linux/wl12xx.h +3 -24
index 3876b67..eea1e6d 100644
@@ -26,28 +26,6 @@
 
 #include <linux/err.h>
 
-/* Reference clock values */
-enum {
-	WL12XX_REFCLOCK_19	= 0, /* 19.2 MHz */
-	WL12XX_REFCLOCK_26	= 1, /* 26 MHz */
-	WL12XX_REFCLOCK_38	= 2, /* 38.4 MHz */
-	WL12XX_REFCLOCK_52	= 3, /* 52 MHz */
-	WL12XX_REFCLOCK_38_XTAL = 4, /* 38.4 MHz, XTAL */
-	WL12XX_REFCLOCK_26_XTAL = 5, /* 26 MHz, XTAL */
-};
-
-/* TCXO clock values */
-enum {
-	WL12XX_TCXOCLOCK_19_2	= 0, /* 19.2MHz */
-	WL12XX_TCXOCLOCK_26	= 1, /* 26 MHz */
-	WL12XX_TCXOCLOCK_38_4	= 2, /* 38.4MHz */
-	WL12XX_TCXOCLOCK_52	= 3, /* 52 MHz */
-	WL12XX_TCXOCLOCK_16_368	= 4, /* 16.368 MHz */
-	WL12XX_TCXOCLOCK_32_736	= 5, /* 32.736 MHz */
-	WL12XX_TCXOCLOCK_16_8	= 6, /* 16.8 MHz */
-	WL12XX_TCXOCLOCK_33_6	= 7, /* 33.6 MHz */
-};
-
 struct wl1251_platform_data {
 	int power_gpio;
 	/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
@@ -58,8 +36,9 @@ struct wl1251_platform_data {
 struct wl12xx_platform_data {
 	int irq;
 	u32 irq_trigger;
-	int board_ref_clock;
-	int board_tcxo_clock;
+	bool ref_clock_xtal;	/* specify whether the clock is XTAL or not */
+	u32 ref_clock_freq;	/* in Hertz */
+	u32 tcxo_clock_freq;	/* in Hertz, tcxo is always XTAL */
 	bool pwr_in_suspend;
 };
 
Signature · 1 line
1.8.5.2.229.g4448466.dirty
maintainer
#3 lore raw

PATCH v6 2/6 wl12xx: use frequency instead of enumerations for pdata clocks

Quoted 5 lines · Eliad Peller

From: Luciano Coelho <[email protected]>

Instead of defining an enumeration with the FW specific values for the different clock rates, use the actual frequency instead. Also add a boolean to specify whether the clock is XTAL or not.

Thanks for doing this. Just one comment on how we're going to get this all merged. Chances are this will cause merge conflicts between the wireless tree and the omap tree for the platform data and dts changes.

Can you please separate the wireless changes in this series so we can do this in the following sets:

1. Add support for new things to wireless driver

2. Switch platform code to use the new support

3. Remove support for platform data with a follow-up patch

The other option would be to have the whole series in a immutable branch against v3.0-rc1 that can be merged into both wirelss tree and omap tree.

Regards,

Tony

Quoted 297 lines

Change all board files to reflect this.

[Eliad - small fixes, update board file changes]
---
 arch/arm/mach-davinci/board-da850-evm.c |  3 +-
 arch/arm/mach-omap2/pdata-quirks.c      | 29 ++++++++--------
 drivers/net/wireless/ti/wl12xx/main.c   | 60 ++++++++++++++++++++++++++++++---
 drivers/net/wireless/ti/wl12xx/wl12xx.h | 28 +++++++++++++++
 include/linux/wl12xx.h                  | 27 ++-------------
 5 files changed, 103 insertions(+), 44 deletions(-)
arch/arm/mach-davinci/board-da850-evm.c +2 -1
index 916589c..853b941 100644
@@ -1386,7 +1386,8 @@ static const short da850_wl12xx_pins[] __initconst = {
 static struct wl12xx_platform_data da850_wl12xx_wlan_data __initdata = {
 	.irq			= -1,
 	.irq_trigger		= IRQ_TYPE_EDGE_RISING,
-	.board_ref_clock	= WL12XX_REFCLOCK_38,
+	.ref_clock_freq		= 38400000,
+	.ref_clock_xtal		= false,
 };
 
 static __init int da850_wl12xx_init(void)
arch/arm/mach-omap2/pdata-quirks.c +14 -15
index 4449f4c..337cc22 100644
@@ -39,14 +39,14 @@ static struct twl4030_gpio_platform_data twl_gpio_auxdata;
 
 static struct wl12xx_platform_data wl12xx __initdata;
 
-static void __init __used legacy_init_wl12xx(unsigned ref_clock,
-					     unsigned tcxo_clock,
+static void __init __used legacy_init_wl12xx(u32 ref_clock_freq,
+					     u32 tcxo_clock_freq,
 					     int gpio)
 {
 	int res;
 
-	wl12xx.board_ref_clock = ref_clock;
-	wl12xx.board_tcxo_clock = tcxo_clock;
+	wl12xx.ref_clock_freq = ref_clock_freq;
+	wl12xx.tcxo_clock_freq = tcxo_clock_freq;
 	wl12xx.irq = gpio_to_irq(gpio);
 	wl12xx.irq_trigger = IRQ_TYPE_LEVEL_HIGH;
 
@@ -57,8 +57,8 @@ static void __init __used legacy_init_wl12xx(unsigned ref_clock,
 	}
 }
 #else
-static inline void legacy_init_wl12xx(unsigned ref_clock,
-				      unsigned tcxo_clock,
+static inline void legacy_init_wl12xx(u32 ref_clock_freq,
+				      u32 tcxo_clock_freq,
 				      int gpio)
 {
 }
@@ -130,7 +130,7 @@ static void __init omap3_sbc_t3730_twl_init(void)
 static void __init omap3_sbc_t3730_legacy_init(void)
 {
 	omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub");
-	legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 136);
+	legacy_init_wl12xx(38400000, 0, 136);
 }
 
 static void __init omap3_sbc_t3530_legacy_init(void)
@@ -174,12 +174,12 @@ static void __init omap3_igep0030_rev_g_legacy_init(void)
 
 static void __init omap3_evm_legacy_init(void)
 {
-	legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 149);
+	legacy_init_wl12xx(38400000, 0, 149);
 }
 
 static void __init omap3_zoom_legacy_init(void)
 {
-	legacy_init_wl12xx(WL12XX_REFCLOCK_26, 0, 162);
+	legacy_init_wl12xx(26000000, 0, 162);
 }
 
 static void am35xx_enable_emac_int(void)
@@ -246,7 +246,7 @@ static void __init omap3_sbc_t3517_legacy_init(void)
 	am35xx_emac_reset();
 	hsmmc2_internal_input_clk();
 	omap3_sbc_t3517_wifi_init();
-	legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 145);
+	legacy_init_wl12xx(38400000, 0, 145);
 }
 
 static void __init am3517_evm_legacy_init(void)
@@ -291,18 +291,17 @@ static void __init omap3_tao3530_legacy_init(void)
 #ifdef CONFIG_ARCH_OMAP4
 static void __init omap4_sdp_legacy_init(void)
 {
-	legacy_init_wl12xx(WL12XX_REFCLOCK_26,
-			   WL12XX_TCXOCLOCK_26, 53);
+	legacy_init_wl12xx(26000000, 26000000, 53);
 }
 
 static void __init omap4_panda_legacy_init(void)
 {
-	legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 53);
+	legacy_init_wl12xx(38400000, 0, 53);
 }
 
 static void __init var_som_om44_legacy_init(void)
 {
-	legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 41);
+	legacy_init_wl12xx(38400000, 0, 41);
 }
 #endif
 
@@ -317,7 +316,7 @@ static struct iommu_platform_data omap4_iommu_pdata = {
 #ifdef CONFIG_SOC_AM33XX
 static void __init am335x_evmsk_legacy_init(void)
 {
-	legacy_init_wl12xx(WL12XX_REFCLOCK_38, 0, 31);
+	legacy_init_wl12xx(38400000, 0, 31);
 }
 #endif
 
drivers/net/wireless/ti/wl12xx/main.c +56 -4
index 144d1f8..b3f751f 100644
@@ -1770,6 +1770,40 @@ wl12xx_iface_combinations[] = {
 	},
 };
 
+static const struct wl12xx_clock wl12xx_refclock_table[] = {
+	{ 19200000,	false,	WL12XX_REFCLOCK_19	},
+	{ 26000000,	false,	WL12XX_REFCLOCK_26	},
+	{ 26000000,	true,	WL12XX_REFCLOCK_26_XTAL	},
+	{ 38400000,	false,	WL12XX_REFCLOCK_38	},
+	{ 38400000,	true,	WL12XX_REFCLOCK_38_XTAL	},
+	{ 52000000,	false,	WL12XX_REFCLOCK_52	},
+	{ 0,		false,	0 }
+};
+
+static const struct wl12xx_clock wl12xx_tcxoclock_table[] = {
+	{ 16368000,	true,	WL12XX_TCXOCLOCK_16_368	},
+	{ 16800000,	true,	WL12XX_TCXOCLOCK_16_8	},
+	{ 19200000,	true,	WL12XX_TCXOCLOCK_19_2	},
+	{ 26000000,	true,	WL12XX_TCXOCLOCK_26	},
+	{ 32736000,	true,	WL12XX_TCXOCLOCK_32_736	},
+	{ 33600000,	true,	WL12XX_TCXOCLOCK_33_6	},
+	{ 38400000,	true,	WL12XX_TCXOCLOCK_38_4	},
+	{ 52000000,	true,	WL12XX_TCXOCLOCK_52	},
+	{ 0,		false,	0 }
+};
+
+static int wl12xx_get_clock_idx(const struct wl12xx_clock *table,
+				u32 freq, bool xtal)
+{
+	int i;
+
+	for (i = 0; table[i].freq != 0; i++)
+		if ((table[i].freq == freq) && (table[i].xtal == xtal))
+			return table[i].hw_idx;
+
+	return -EINVAL;
+}
+
 static int wl12xx_setup(struct wl1271 *wl)
 {
 	struct wl12xx_priv *priv = wl->priv;
@@ -1799,7 +1833,17 @@ static int wl12xx_setup(struct wl1271 *wl)
 	wl12xx_conf_init(wl);
 
 	if (!fref_param) {
-		priv->ref_clock = pdata->board_ref_clock;
+		priv->ref_clock = wl12xx_get_clock_idx(wl12xx_refclock_table,
+						       pdata->ref_clock_freq,
+						       pdata->ref_clock_xtal);
+		if (priv->ref_clock < 0) {
+			wl1271_error("Invalid ref_clock frequency (%d Hz, %s)",
+				     pdata->ref_clock_freq,
+				     pdata->ref_clock_xtal ?
+				     "XTAL" : "not XTAL");
+
+			return priv->ref_clock;
+		}
 	} else {
 		if (!strcmp(fref_param, "19.2"))
 			priv->ref_clock = WL12XX_REFCLOCK_19;
@@ -1817,9 +1861,17 @@ static int wl12xx_setup(struct wl1271 *wl)
 			wl1271_error("Invalid fref parameter %s", fref_param);
 	}
 
-	if (!tcxo_param) {
-		priv->tcxo_clock = pdata->board_tcxo_clock;
-	} else {
+	if (!tcxo_param && pdata->tcxo_clock_freq) {
+		priv->tcxo_clock = wl12xx_get_clock_idx(wl12xx_tcxoclock_table,
+							pdata->tcxo_clock_freq,
+							true);
+		if (priv->tcxo_clock < 0) {
+			wl1271_error("Invalid tcxo_clock frequency (%d Hz)",
+				     pdata->tcxo_clock_freq);
+
+			return priv->tcxo_clock;
+		}
+	} else if (tcxo_param) {
 		if (!strcmp(tcxo_param, "19.2"))
 			priv->tcxo_clock = WL12XX_TCXOCLOCK_19_2;
 		else if (!strcmp(tcxo_param, "26"))
drivers/net/wireless/ti/wl12xx/wl12xx.h +28 -0
index 75c9265..5952e99a 100644
@@ -82,6 +82,34 @@ struct wl12xx_priv {
 	struct wl127x_rx_mem_pool_addr *rx_mem_addr;
 };
 
+/* Reference clock values */
+enum {
+	WL12XX_REFCLOCK_19	= 0, /* 19.2 MHz */
+	WL12XX_REFCLOCK_26	= 1, /* 26 MHz */
+	WL12XX_REFCLOCK_38	= 2, /* 38.4 MHz */
+	WL12XX_REFCLOCK_52	= 3, /* 52 MHz */
+	WL12XX_REFCLOCK_38_XTAL = 4, /* 38.4 MHz, XTAL */
+	WL12XX_REFCLOCK_26_XTAL = 5, /* 26 MHz, XTAL */
+};
+
+/* TCXO clock values */
+enum {
+	WL12XX_TCXOCLOCK_19_2	= 0, /* 19.2MHz */
+	WL12XX_TCXOCLOCK_26	= 1, /* 26 MHz */
+	WL12XX_TCXOCLOCK_38_4	= 2, /* 38.4MHz */
+	WL12XX_TCXOCLOCK_52	= 3, /* 52 MHz */
+	WL12XX_TCXOCLOCK_16_368	= 4, /* 16.368 MHz */
+	WL12XX_TCXOCLOCK_32_736	= 5, /* 32.736 MHz */
+	WL12XX_TCXOCLOCK_16_8	= 6, /* 16.8 MHz */
+	WL12XX_TCXOCLOCK_33_6	= 7, /* 33.6 MHz */
+};
+
+struct wl12xx_clock {
+	u32	freq;
+	bool	xtal;
+	u8	hw_idx;
+};
+
 struct wl12xx_fw_packet_counters {
 	/* Cumulative counter of released packets per AC */
 	u8 tx_released_pkts[NUM_TX_QUEUES];
include/linux/wl12xx.h +3 -24
index 3876b67..eea1e6d 100644
@@ -26,28 +26,6 @@
 
 #include <linux/err.h>
 
-/* Reference clock values */
-enum {
-	WL12XX_REFCLOCK_19	= 0, /* 19.2 MHz */
-	WL12XX_REFCLOCK_26	= 1, /* 26 MHz */
-	WL12XX_REFCLOCK_38	= 2, /* 38.4 MHz */
-	WL12XX_REFCLOCK_52	= 3, /* 52 MHz */
-	WL12XX_REFCLOCK_38_XTAL = 4, /* 38.4 MHz, XTAL */
-	WL12XX_REFCLOCK_26_XTAL = 5, /* 26 MHz, XTAL */
-};
-
-/* TCXO clock values */
-enum {
-	WL12XX_TCXOCLOCK_19_2	= 0, /* 19.2MHz */
-	WL12XX_TCXOCLOCK_26	= 1, /* 26 MHz */
-	WL12XX_TCXOCLOCK_38_4	= 2, /* 38.4MHz */
-	WL12XX_TCXOCLOCK_52	= 3, /* 52 MHz */
-	WL12XX_TCXOCLOCK_16_368	= 4, /* 16.368 MHz */
-	WL12XX_TCXOCLOCK_32_736	= 5, /* 32.736 MHz */
-	WL12XX_TCXOCLOCK_16_8	= 6, /* 16.8 MHz */
-	WL12XX_TCXOCLOCK_33_6	= 7, /* 33.6 MHz */
-};
-
 struct wl1251_platform_data {
 	int power_gpio;
 	/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
@@ -58,8 +36,9 @@ struct wl1251_platform_data {
 struct wl12xx_platform_data {
 	int irq;
 	u32 irq_trigger;
-	int board_ref_clock;
-	int board_tcxo_clock;
+	bool ref_clock_xtal;	/* specify whether the clock is XTAL or not */
+	u32 ref_clock_freq;	/* in Hertz */
+	u32 tcxo_clock_freq;	/* in Hertz, tcxo is always XTAL */
 	bool pwr_in_suspend;
 };
 
Signature · 1 line
1.8.5.2.229.g4448466.dirty
#4 lore raw

PATCH v6 2/6 wl12xx: use frequency instead of enumerations for pdata clocks

+Kalle

Quoted 11 lines · Tony Lindgren
Quoted 5 lines · Eliad Peller

From: Luciano Coelho <[email protected]>

Instead of defining an enumeration with the FW specific values for the different clock rates, use the actual frequency instead. Also add a boolean to specify whether the clock is XTAL or not.

Thanks for doing this. Just one comment on how we're going to get this all merged. Chances are this will cause merge conflicts between the wireless tree and the omap tree for the platform data and dts changes.

Quoted 9 lines

Can you please separate the wireless changes in this series so we can do this in the following sets:

1. Add support for new things to wireless driver

2. Switch platform code to use the new support

3. Remove support for platform data with a follow-up patch

the series will still be dependent on each other (e.g. (3) must come only after (2) was applied), so i'm not sure that will be very helpful?

Quoted 4 lines

The other option would be to have the whole series in a immutable branch against v3.0-rc1 that can be merged into both wirelss tree and omap tree.

i think that could be easier.

or maybe you can just take them all through the omap tree? the wlcore tree is not under active development, so i don't expect conflicts there.

Eliad.

#5 lore raw

PATCH v6 2/6 wl12xx: use frequency instead of enumerations for pdata clocks

Quoted 10 lines · On Sunday 15 March 2015 10:43:35 Eliad Peller wrote:
Quoted 5 lines

The other option would be to have the whole series in a immutable branch against v3.0-rc1 that can be merged into both wirelss tree and omap tree.

i think that could be easier.

or maybe you can just take them all through the omap tree? the wlcore tree is not under active development, so i don't expect conflicts there.

I'm fine with both these approaches.

Arnd

#6 lore raw

PATCH v6 2/6 wl12xx: use frequency instead of enumerations for pdata clocks

Quoted 6 lines · Arnd Bergmann
Quoted 5 lines · On Sunday 15 March 2015 10:43:35 Eliad Peller wrote:
Quoted 5 lines

The other option would be to have the whole series in a immutable branch against v3.0-rc1 that can be merged into both wirelss tree and omap tree.

Quoted 7 lines
Quoted 5 lines

i think that could be easier.

or maybe you can just take them all through the omap tree? the wlcore tree is not under active development, so i don't expect conflicts there.

I'm fine with both these approaches.

I prefer these going through the omap tree. Like Eliad said, drivers/net/wireless/ti does not get that many changes nowadays so the chances of this patchset conflicting with something is very small.

Signature · 1 line
Kalle Valo
maintainer
#7 lore raw

PATCH v6 2/6 wl12xx: use frequency instead of enumerations for pdata clocks

Quoted 14 lines · Kalle Valo
Quoted 12 lines · Arnd Bergmann
Quoted 10 lines · On Sunday 15 March 2015 10:43:35 Eliad Peller wrote:
Quoted 5 lines

The other option would be to have the whole series in a immutable branch against v3.0-rc1 that can be merged into both wirelss tree and omap tree.

i think that could be easier.

or maybe you can just take them all through the omap tree? the wlcore tree is not under active development, so i don't expect conflicts there.

Quoted 5 lines
Quoted 1 line

I'm fine with both these approaches.

I prefer these going through the omap tree. Like Eliad said, drivers/net/wireless/ti does not get that many changes nowadays so the chances of this patchset conflicting with something is very small.

OK great. In that case no need to rearrange the patches, I can apply them into an immutable branch once the pending issues have been fixed if Kalle acks them.

To avoid merge conflicts that branch is easiest done against v4.0-rc4. Kalle and Arnd, does that work for you guys?

I can also base it on 5b7610f23562 ("ARM: OMAP2+: Fix wl12xx on dm3730-evm with mainline u-boot") that's on top of -rc2 plus few other fixes now merged to -rc4 mainline if we need a branch based on an earlier tag.

Regards,

Tony

#8 lore raw

PATCH v6 2/6 wl12xx: use frequency instead of enumerations for pdata clocks

Quoted 8 lines · Tony Lindgren
Quoted 3 lines

I prefer these going through the omap tree. Like Eliad said, drivers/net/wireless/ti does not get that many changes nowadays so the chances of this patchset conflicting with something is very small.

OK great. In that case no need to rearrange the patches, I can apply them into an immutable branch once the pending issues have been fixed if Kalle acks them.

Quoted 7 lines

To avoid merge conflicts that branch is easiest done against v4.0-rc4. Kalle and Arnd, does that work for you guys?

I can also base it on 5b7610f23562 ("ARM: OMAP2+: Fix wl12xx on dm3730-evm with mainline u-boot") that's on top of -rc2 plus few other fixes now merged to -rc4 mainline if we need a branch based on an earlier tag.

Sorry, it seems I forgot to answer this one:

Either baseline is good for me, I can't think of any problems with either one. But please do remember that I'm a new maintainer, I might very well miss something ;)

Signature · 1 line
Kalle Valo
maintainer
#9 lore raw

PATCH v6 2/6 wl12xx: use frequency instead of enumerations for pdata clocks

Quoted 18 lines · Kalle Valo
Quoted 8 lines · Tony Lindgren
Quoted 3 lines

I prefer these going through the omap tree. Like Eliad said, drivers/net/wireless/ti does not get that many changes nowadays so the chances of this patchset conflicting with something is very small.

OK great. In that case no need to rearrange the patches, I can apply them into an immutable branch once the pending issues have been fixed if Kalle acks them.

Quoted 7 lines

To avoid merge conflicts that branch is easiest done against v4.0-rc4. Kalle and Arnd, does that work for you guys?

I can also base it on 5b7610f23562 ("ARM: OMAP2+: Fix wl12xx on dm3730-evm with mainline u-boot") that's on top of -rc2 plus few other fixes now merged to -rc4 mainline if we need a branch based on an earlier tag.

Quoted 5 lines

Sorry, it seems I forgot to answer this one:

Either baseline is good for me, I can't think of any problems with either one. But please do remember that I'm a new maintainer, I might very well miss something ;)

OK, I'll base it on -rc4 unless Arnd needs something earlier.

Regards,

Tony

#10 lore raw

PATCH v6 3/6 dt: bindings: add TI's wilink wireless device

In reply to Eliad Peller

Add device tree binding documentation for TI's wilink (wl12xx and wl18xx) wlan chip.

---
v6: add wl12xx, use IRQ_TYPE_LEVEL_HIGH

 .../devicetree/bindings/net/wireless/ti,wlcore.txt | 47 ++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/wireless/ti,wlcore.txt
Documentation/devicetree/bindings/net/wireless/ti,wlcore.txt new file +47 -0
new file mode 100644
index 0000000..2a3d90d
@@ -0,0 +1,47 @@
+TI Wilink 6/7/8 (wl12xx/wl18xx) SDIO devices
+
+This node provides properties for controlling the wilink wireless device. The
+node is expected to be specified as a child node to the SDIO controller that
+connects the device to the system.
+
+Required properties:
+ - compatible: should be one of the following:
+    * "ti,wl1271"
+    * "ti,wl1273"
+    * "ti,wl1281"
+    * "ti,wl1283"
+    * "ti,wl1801"
+    * "ti,wl1805"
+    * "ti,wl1807"
+    * "ti,wl1831"
+    * "ti,wl1835"
+    * "ti,wl1837"
+ - interrupts : specifies attributes for the out-of-band interrupt.
+
+Optional properties:
+ - interrupt-parent : the phandle for the interrupt controller to which the
+	device interrupts are connected.
+ - ref-clock-frequency : ref clock frequency in Hz
+ - tcxo-clock-frequency : tcxo clock frequency in Hz
+
+Note: the *-clock-frequency properties assume internal clocks. In case of external
+clock, new bindings (for parsing the clock nodes) have to be added.
+
+Example:
+
+&mmc3 {
+	status = "okay";
+	vmmc-supply = <&wlan_en_reg>;
+	bus-width = <4>;
+	cap-power-off-card;
+	keep-power-in-suspend;
+
+	#address-cells = <1>;
+	#size-cells = <0>;
+	wlcore: wlcore at 2 {
+		compatible = "ti,wl1835";
+		reg = <2>;
+		interrupt-parent = <&gpio0>;
+		interrupts = <19 IRQ_TYPE_LEVEL_HIGH>;
+	};
+};
Signature · 1 line
1.8.5.2.229.g4448466.dirty
#11 lore raw

PATCH v6 4/6 wlcore: add device-tree support

In reply to Eliad Peller

When running with device-tree, we no longer have a board file that can set up the platform data for wlcore.
Allow this data to be passed from DT.

---
v6: parse frequency properties, add wl12xx compatible strings

 drivers/net/wireless/ti/wlcore/sdio.c | 93 ++++++++++++++++++++++++++++++++---
 1 file changed, 87 insertions(+), 6 deletions(-)
drivers/net/wireless/ti/wlcore/sdio.c +87 -6
index 2bce00a..b55dc0e 100644
@@ -34,6 +34,8 @@
 #include <linux/wl12xx.h>
 #include <linux/pm_runtime.h>
 #include <linux/printk.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
 
 #include "wlcore.h"
 #include "wl12xx_80211.h"
@@ -214,6 +216,82 @@ static struct wl1271_if_operations sdio_ops = {
 	.set_block_size = wl1271_sdio_set_block_size,
 };
 
+#ifdef CONFIG_OF
+static const struct of_device_id wlcore_sdio_of_match_table[] = {
+	{ .compatible = "ti,wl1271" },
+	{ .compatible = "ti,wl1273" },
+	{ .compatible = "ti,wl1281" },
+	{ .compatible = "ti,wl1283" },
+	{ .compatible = "ti,wl1801" },
+	{ .compatible = "ti,wl1805" },
+	{ .compatible = "ti,wl1807" },
+	{ .compatible = "ti,wl1831" },
+	{ .compatible = "ti,wl1835" },
+	{ .compatible = "ti,wl1837" },
+	{ }
+};
+
+static struct wl12xx_platform_data *wlcore_probe_of(struct device *dev)
+{
+	struct device_node *np = dev->of_node;
+	struct wl12xx_platform_data *pdata;
+
+	if (!np || !of_match_node(wlcore_sdio_of_match_table, np))
+		return NULL;
+
+	pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
+	if (!pdata)
+		return NULL;
+
+	pdata->irq = irq_of_parse_and_map(np, 0);
+	if (!pdata->irq) {
+		dev_err(dev, "No irq in platform data\n");
+		kfree(pdata);
+		return NULL;
+	}
+
+	pdata->irq_trigger =
+		irqd_get_trigger_type(irq_get_irq_data(pdata->irq));
+
+	/* optional clock frequency params */
+	of_property_read_u32(np, "ref-clock-frequency",
+			     &pdata->ref_clock_freq);
+	of_property_read_u32(np, "tcxo-clock-frequency",
+			     &pdata->tcxo_clock_freq);
+
+	return pdata;
+}
+#else
+static struct wl12xx_platform_data *wlcore_probe_of(struct device *dev)
+{
+	return NULL;
+}
+#endif
+
+static struct wl12xx_platform_data *
+wlcore_get_platform_data(struct device *dev)
+{
+	struct wl12xx_platform_data *pdata;
+
+	/* first, look for DT data */
+	pdata = wlcore_probe_of(dev);
+	if (pdata)
+		return pdata;
+
+	/* if not found - fallback to static platform data */
+	pdata = wl12xx_get_platform_data();
+	if (!IS_ERR(pdata))
+		return kmemdup(pdata, sizeof(*pdata), GFP_KERNEL);
+
+	dev_err(dev, "No platform data set\n");
+	return NULL;
+}
+
+static void wlcore_del_platform_data(struct wl12xx_platform_data *pdata)
+{
+	kfree(pdata);
+}
+
 static int wl1271_probe(struct sdio_func *func,
 				  const struct sdio_device_id *id)
 {
@@ -245,12 +323,9 @@ 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;
 
-	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);
+	pdev_data.pdata = wlcore_get_platform_data(&func->dev);
+	if (!pdev_data.pdata)
 		goto out_free_glue;
-	}
 
 	/* if sdio can keep power while host is suspended, enable wow */
 	mmcflags = sdio_get_host_pm_caps(func);
@@ -279,7 +354,7 @@ static int wl1271_probe(struct sdio_func *func,
 	if (!glue->core) {
 		dev_err(glue->dev, "can't allocate platform_device");
 		ret = -ENOMEM;
-		goto out_free_glue;
+		goto out_free_pdata;
 	}
 
 	glue->core->dev.parent = &func->dev;
@@ -313,6 +388,9 @@ static int wl1271_probe(struct sdio_func *func,
 out_dev_put:
 	platform_device_put(glue->core);
 
+out_free_pdata:
+	wlcore_del_platform_data(pdev_data.pdata);
+
 out_free_glue:
 	kfree(glue);
 
@@ -323,11 +401,14 @@ out:
 static void wl1271_remove(struct sdio_func *func)
 {
 	struct wl12xx_sdio_glue *glue = sdio_get_drvdata(func);
+	struct wlcore_platdev_data *pdev_data = glue->core->dev.platform_data;
+	struct wl12xx_platform_data *pdata = pdev_data->pdata;
 
 	/* Undo decrement done above in wl1271_probe */
 	pm_runtime_get_noresume(&func->dev);
 
 	platform_device_unregister(glue->core);
+	wlcore_del_platform_data(pdata);
 	kfree(glue);
 }
 
Signature · 1 line
1.8.5.2.229.g4448466.dirty
#12 lore raw

PATCH v6 5/6 ARM: dts: add wl12xx/wl18xx bindings

In reply to Eliad Peller

Replace all the pdata-quirks for setting wl12xx/wl18xx platform data with proper DT definitions.

The patch was compile-tested only.

---
v6: add wl12xx definitions as well

 arch/arm/boot/dts/am335x-evmsk.dts             | 11 ++++
 arch/arm/boot/dts/omap3-cm-t3517.dts           | 10 ++++
 arch/arm/boot/dts/omap3-cm-t3730.dts           | 10 ++++
 arch/arm/boot/dts/omap3-evm-common.dtsi        | 10 ++++
 arch/arm/boot/dts/omap3-igep0020-rev-f.dts     |  9 +++
 arch/arm/boot/dts/omap3-igep0030-rev-g.dts     |  9 +++
 arch/arm/boot/dts/omap3-zoom3.dts              | 10 ++++
 arch/arm/boot/dts/omap4-panda-common.dtsi      | 10 ++++
 arch/arm/boot/dts/omap4-sdp.dts                | 11 ++++
 arch/arm/boot/dts/omap4-var-som-om44-wlan.dtsi | 10 ++++
 arch/arm/mach-omap2/pdata-quirks.c             | 79 --------------------------
 11 files changed, 100 insertions(+), 79 deletions(-)
arch/arm/boot/dts/am335x-evmsk.dts +11 -0
index df5fee6..87fc7a3 100644
@@ -15,6 +15,7 @@
 
 #include "am33xx.dtsi"
 #include <dt-bindings/pwm/pwm.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
 	model = "TI AM335x EVM-SK";
@@ -647,6 +648,16 @@
 	cap-power-off-card;
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc2_pins>;
+
+	#address-cells = <1>;
+	#size-cells = <0>;
+	wlcore: wlcore at 2 {
+		compatible = "ti,wl1271";
+		reg = <2>;
+		interrupt-parent = <&gpio1>;
+		interrupts = <31 IRQ_TYPE_LEVEL_HIGH>; /* gpio 31 */
+		ref-clock-frequency = <38400000>;
+	};
 };
 
 &mcasp1 {
arch/arm/boot/dts/omap3-cm-t3517.dts +10 -0
index 0ab748c..f5b5a1d 100644
@@ -133,6 +133,16 @@
 	non-removable;
 	bus-width = <4>;
 	cap-power-off-card;
+
+	#address-cells = <1>;
+	#size-cells = <0>;
+	wlcore: wlcore at 2 {
+		compatible = "ti,wl1271";
+		reg = <2>;
+		interrupt-parent = <&gpio5>;
+		interrupts = <17 IRQ_TYPE_LEVEL_HIGH>; /* gpio 145 */
+		ref-clock-frequency = <38400000>;
+	};
 };
 
 &dss {
arch/arm/boot/dts/omap3-cm-t3730.dts +10 -0
index 46eadb2..2294f5b 100644
@@ -73,6 +73,16 @@
 	non-removable;
 	bus-width = <4>;
 	cap-power-off-card;
+
+	#address-cells = <1>;
+	#size-cells = <0>;
+	wlcore: wlcore at 2 {
+		compatible = "ti,wl1271";
+		reg = <2>;
+		interrupt-parent = <&gpio5>;
+		interrupts = <8 IRQ_TYPE_LEVEL_HIGH>; /* gpio 136 */
+		ref-clock-frequency = <38400000>;
+	};
 };
 
 &dss {
arch/arm/boot/dts/omap3-evm-common.dtsi +10 -0
index 127f3e7..346552b 100644
@@ -106,6 +106,16 @@
 	non-removable;
 	bus-width = <4>;
 	cap-power-off-card;
+
+	#address-cells = <1>;
+	#size-cells = <0>;
+	wlcore: wlcore at 2 {
+		compatible = "ti,wl1271";
+		reg = <2>;
+		interrupt-parent = <&gpio5>;
+		interrupts = <21 IRQ_TYPE_LEVEL_HIGH>; /* gpio 149 */
+		ref-clock-frequency = <38400000>;
+	};
 };
 
 &twl_gpio {
arch/arm/boot/dts/omap3-igep0020-rev-f.dts +9 -0
index cc8bd0c..72f7cdc 100644
@@ -42,4 +42,13 @@
 	vmmc-supply = <&lbep5clwmc_wlen>;
 	bus-width = <4>;
 	non-removable;
+
+	#address-cells = <1>;
+	#size-cells = <0>;
+	wlcore: wlcore at 2 {
+		compatible = "ti,wl1835";
+		reg = <2>;
+		interrupt-parent = <&gpio6>;
+		interrupts = <17 IRQ_TYPE_LEVEL_HIGH>; /* gpio 177 */
+	};
 };
arch/arm/boot/dts/omap3-igep0030-rev-g.dts +9 -0
index 9326b28..b899e34 100644
@@ -64,4 +64,13 @@
 	vmmc-supply = <&lbep5clwmc_wlen>;
 	bus-width = <4>;
 	non-removable;
+
+	#address-cells = <1>;
+	#size-cells = <0>;
+	wlcore: wlcore at 2 {
+		compatible = "ti,wl1835";
+		reg = <2>;
+		interrupt-parent = <&gpio5>;
+		interrupts = <8 IRQ_TYPE_LEVEL_HIGH>; /* gpio 136 */
+	};
 };
arch/arm/boot/dts/omap3-zoom3.dts +10 -0
index 6644f51..131448d 100644
@@ -195,6 +195,16 @@
 	cap-power-off-card;
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc3_pins &mmc3_2_pins>;
+
+	#address-cells = <1>;
+	#size-cells = <0>;
+	wlcore: wlcore at 2 {
+		compatible = "ti,wl1271";
+		reg = <2>;
+		interrupt-parent = <&gpio6>;
+		interrupts = <2 IRQ_TYPE_LEVEL_HIGH>; /* gpio 162 */
+		ref-clock-frequency = <26000000>;
+	};
 };
 
 &uart1 {
arch/arm/boot/dts/omap4-panda-common.dtsi +10 -0
index 1505135..1228de5 100644
@@ -450,6 +450,16 @@
 	non-removable;
 	bus-width = <4>;
 	cap-power-off-card;
+
+	#address-cells = <1>;
+	#size-cells = <0>;
+	wlcore: wlcore at 2 {
+		compatible = "ti,wl1271";
+		reg = <2>;
+		interrupt-parent = <&gpio2>;
+		interrupts = <21 IRQ_TYPE_LEVEL_HIGH>; /* gpio 53 */
+		ref-clock-frequency = <38400000>;
+	};
 };
 
 &emif1 {
arch/arm/boot/dts/omap4-sdp.dts +11 -0
index 3e1da43..8c36f51 100644
@@ -487,6 +487,17 @@
 	non-removable;
 	bus-width = <4>;
 	cap-power-off-card;
+
+	#address-cells = <1>;
+	#size-cells = <0>;
+	wlcore: wlcore at 2 {
+		compatible = "ti,wl1281";
+		reg = <2>;
+		interrupt-parent = <&gpio1>;
+		interrupts = <21 IRQ_TYPE_LEVEL_HIGH>; /* gpio 53 */
+		ref-clock-frequency = <26000000>;
+		tcxo-clock-frequency = <26000000>;
+	};
 };
 
 &emif1 {
arch/arm/boot/dts/omap4-var-som-om44-wlan.dtsi +10 -0
index cc66af4..9bceeb7 100644
@@ -65,4 +65,14 @@
 	bus-width = <4>;
 	cap-power-off-card;
 	status = "okay";
+
+	#address-cells = <1>;
+	#size-cells = <0>;
+	wlcore: wlcore at 2 {
+		compatible = "ti,wl1271";
+		reg = <2>;
+		interrupt-parent = <&gpio2>;
+		interrupts = <9 IRQ_TYPE_LEVEL_HIGH>; /* gpio 41 */
+		ref-clock-frequency = <38400000>;
+	};
 };
arch/arm/mach-omap2/pdata-quirks.c +0 -79

140 lines not on this page · raw message

Signature · 1 line
1.8.5.2.229.g4448466.dirty
#13 lore raw

PATCH v6 5/6 ARM: dts: add wl12xx/wl18xx bindings

Hello Eliad,

Quoted 7 lines · Eliad Peller

Replace all the pdata-quirks for setting wl12xx/wl18xx platform data with proper DT definitions.

The patch was compile-tested only.

---

I wanted to test your series but I realized that the IGEPv2 I've access is the old revision that has another SDIO wlan module instead of a Wilink8.

Maybe Enric have the new revision? I also added to Pau Pajuel as cc who still works in the company manufacturing these boards so he should be able to test it.

But in any case, your patch looks good to me so for the arch/arm/boot/dts/omap3-igep00* changes:

Best regards,
Javier

#14 lore raw

PATCH v6 5/6 ARM: dts: add wl12xx/wl18xx bindings

Hello,

2015-03-13 9:01 GMT+01:00 Javier Martinez Canillas <[email protected]>:

Quoted 11 lines

Hello Eliad,

Quoted 7 lines · Eliad Peller

Replace all the pdata-quirks for setting wl12xx/wl18xx platform data with proper DT definitions.

The patch was compile-tested only.

---

Quoted 8 lines

I wanted to test your series but I realized that the IGEPv2 I've access is the old revision that has another SDIO wlan module instead of a Wilink8.

Maybe Enric have the new revision? I also added to Pau Pajuel as cc who still works in the company manufacturing these boards so he should be able to test it.

Sorry, now I only have an old revision too, so I can't test, cc'ing Agust? that has access to the hardware, maybe he can test it or he can provide to us a board ;)

Quoted 5 lines

But in any case, your patch looks good to me so for the arch/arm/boot/dts/omap3-igep00* changes:

For my part also looks good.

Best regards,
Enric

Quoted 2 lines

Best regards,
Javier

#15 lore raw

Re: [PATCH v6 5/6] ARM: dts: add wl12xx/wl18xx bindings

Hi,

2015-03-13 9:17 GMT+01:00 Enric Balletbo Serra <[email protected]>:

Quoted 33 lines

Hello,

2015-03-13 9:01 GMT+01:00 Javier Martinez Canillas <[email protected]>:

Quoted 11 lines

Hello Eliad,

Quoted 7 lines · Eliad Peller

Replace all the pdata-quirks for setting wl12xx/wl18xx platform data with proper DT definitions.

The patch was compile-tested only.

---

Quoted 8 lines

I wanted to test your series but I realized that the IGEPv2 I've access is the old revision that has another SDIO wlan module instead of a Wilink8.

Maybe Enric have the new revision? I also added to Pau Pajuel as cc who still works in the company manufacturing these boards so he should be able to test it.

Sorry, now I only have an old revision too, so I can't test, cc'ing Agustí that has access to the hardware, maybe he can test it or he can provide to us a board ;)

Quoted 5 lines

But in any case, your patch looks good to me so for the arch/arm/boot/dts/omap3-igep00* changes:

Quoted 10 lines

For my part also looks good.

Best regards,
Enric

Quoted 2 lines

Best regards,
Javier

I'm gonna test it this week. I added Eduard Gavin as cc too.

Cheers!

#16 lore raw

PATCH v6 5/6 ARM: dts: add wl12xx/wl18xx bindings

that would be great. thanks.
i'll try posting the updated patchset (v7, some minor changes) tomorrow.

Eliad.

Quoted 51 lines · Pau Pajuel

Hi,

2015-03-13 9:17 GMT+01:00 Enric Balletbo Serra <[email protected]>:

Quoted 34 lines

Hello,

2015-03-13 9:01 GMT+01:00 Javier Martinez Canillas <[email protected]>:

Quoted 11 lines

Hello Eliad,

Quoted 7 lines · Eliad Peller

Replace all the pdata-quirks for setting wl12xx/wl18xx platform data with proper DT definitions.

The patch was compile-tested only.

---

Quoted 8 lines

I wanted to test your series but I realized that the IGEPv2 I've access is the old revision that has another SDIO wlan module instead of a Wilink8.

Maybe Enric have the new revision? I also added to Pau Pajuel as cc who still works in the company manufacturing these boards so he should be able to test it.

Sorry, now I only have an old revision too, so I can't test, cc'ing Agust? that has access to the hardware, maybe he can test it or he can provide to us a board ;)

Quoted 5 lines

But in any case, your patch looks good to me so for the arch/arm/boot/dts/omap3-igep00* changes:

Quoted 9 lines

For my part also looks good.

Best regards,
Enric

Quoted 2 lines

Best regards,
Javier

I'm gonna test it this week. I added Eduard Gavin as cc too.

Cheers!

maintainer
#17 lore raw

PATCH v6 5/6 ARM: dts: add wl12xx/wl18xx bindings

In reply to Eliad Peller

arch/arm/mach-omap2/pdata-quirks.c static struct platform_device btwilink_device = { · line 178

Quoted 7 lines · Eliad Peller
arch/arm/mach-omap2/pdata-quirks.c +0 -4
 
-static void __init omap3_evm_legacy_init(void)
-{
-	legacy_init_wl12xx(38400000, 0, 149);
-}

FYI, at least this part conflicts with the fixes in the arm-soc tree for the v4.0-rc series as omap3 evm also needs the copy clock quirk.

arch/arm/mach-omap2/pdata-quirks.c static struct pdata_init pdata_quirks[] __initdata = { · line 422

Quoted 5 lines
arch/arm/mach-omap2/pdata-quirks.c +0 -1
@@ -419,20 +351,9 @@ static struct pdata_init pdata_quirks[] __initdata = {
 	{ "nokia,omap3-n950", hsmmc2_internal_input_clk, },
 	{ "isee,omap3-igep0020-rev-f", omap3_igep0020_rev_f_legacy_init, },
 	{ "isee,omap3-igep0030-rev-g", omap3_igep0030_rev_g_legacy_init, },
-	{ "ti,omap3-evm-37xx", omap3_evm_legacy_init, },

So this function cannot be yet removed.

With that fixed, I was able to iw dev wlan0 scan with series on omap3 evm :)

Regards,

Tony

#18 lore raw

PATCH v6 5/6 ARM: dts: add wl12xx/wl18xx bindings

Quoted 21 lines · Tony Lindgren

arch/arm/mach-omap2/pdata-quirks.c static struct platform_device btwilink_device = { · line 178

Quoted 7 lines · Eliad Peller
arch/arm/mach-omap2/pdata-quirks.c +0 -4
 
-static void __init omap3_evm_legacy_init(void)
-{
-     legacy_init_wl12xx(38400000, 0, 149);
-}

FYI, at least this part conflicts with the fixes in the arm-soc tree for the v4.0-rc series as omap3 evm also needs the copy clock quirk.

arch/arm/mach-omap2/pdata-quirks.c static struct pdata_init pdata_quirks[] __initdata = { · line 422

Quoted 5 lines
arch/arm/mach-omap2/pdata-quirks.c +0 -1
@@ -419,20 +351,9 @@ static struct pdata_init pdata_quirks[] __initdata = {
      { "nokia,omap3-n950", hsmmc2_internal_input_clk, },
      { "isee,omap3-igep0020-rev-f", omap3_igep0020_rev_f_legacy_init, },
      { "isee,omap3-igep0030-rev-g", omap3_igep0030_rev_g_legacy_init, },
-     { "ti,omap3-evm-37xx", omap3_evm_legacy_init, },

So this function cannot be yet removed.

Quoted 3 lines

With that fixed, I was able to iw dev wlan0 scan with series on omap3 evm :)

thanks for testing it!

let's continue the discussion in the other thread regarding the way to merge the patches, and i'll rebase the patches appropriately.

Eliad.

#19 lore raw

PATCH v6 6/6 wlcore: remove wl12xx_platform_data

In reply to Eliad Peller

Now that we have wlcore device-tree bindings in place (for both wl12xx and wl18xx), remove the legacy wl12xx_platform_data struct, and move its members into the platform device data (that is passed to wlcore)

Davinci 850 is the only platform that still set the platform data in the legacy way (and doesn't have DT bindings), so remove the relevant code/Kconfig option from the board file (as suggested by Sekhar Nori)

---
 arch/arm/mach-davinci/Kconfig                  |  11 ---
 arch/arm/mach-davinci/board-da850-evm.c        | 113 -------------------------
 drivers/net/wireless/ti/wilink_platform_data.c |  25 ------
 drivers/net/wireless/ti/wl12xx/main.c          |  19 ++---
 drivers/net/wireless/ti/wlcore/boot.c          |   1 -
 drivers/net/wireless/ti/wlcore/main.c          |   4 +-
 drivers/net/wireless/ti/wlcore/sdio.c          |  75 +++++-----------
 drivers/net/wireless/ti/wlcore/wlcore_i.h      |   8 +-
 include/linux/wl12xx.h                         |  25 ------
 9 files changed, 36 insertions(+), 245 deletions(-)
arch/arm/mach-davinci/Kconfig +0 -11
index 584e8d4..6bb1049 100644
@@ -198,17 +198,6 @@ config DA850_UI_SD_VIDEO_PORT
 
 endchoice
 
-config DA850_WL12XX
-	bool "AM18x wl1271 daughter board"
-	depends on MACH_DAVINCI_DA850_EVM
-	help
-	  The wl1271 daughter card for AM18x EVMs is a combo wireless
-	  connectivity add-on card, based on the LS Research TiWi module with
-	  Texas Instruments' wl1271 solution.
-	  Say Y if you want to use a wl1271 expansion card connected to the
-	  AM18x EVM.
-
-
 config MACH_MITYOMAPL138
 	bool "Critical Link MityDSP-L138/MityARM-1808 SoM"
 	depends on ARCH_DAVINCI_DA850
arch/arm/mach-davinci/board-da850-evm.c +0 -113

137 lines not on this page · raw message

drivers/net/wireless/ti/wilink_platform_data.c +0 -25
index a92bd3e..ea0e359 100644
@@ -23,31 +23,6 @@
 #include <linux/err.h>
 #include <linux/wl12xx.h>
 
-static struct wl12xx_platform_data *wl12xx_platform_data;
-
-int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
-{
-	if (wl12xx_platform_data)
-		return -EBUSY;
-	if (!data)
-		return -EINVAL;
-
-	wl12xx_platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
-	if (!wl12xx_platform_data)
-		return -ENOMEM;
-
-	return 0;
-}
-
-struct wl12xx_platform_data *wl12xx_get_platform_data(void)
-{
-	if (!wl12xx_platform_data)
-		return ERR_PTR(-ENODEV);
-
-	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)
drivers/net/wireless/ti/wl12xx/main.c +8 -11
index b3f751f..af0fe2e 100644
@@ -24,8 +24,6 @@
 
 #include <linux/err.h>
 
-#include <linux/wl12xx.h>
-
 #include "../wlcore/wlcore.h"
 #include "../wlcore/debug.h"
 #include "../wlcore/io.h"
@@ -1808,7 +1806,6 @@ static int wl12xx_setup(struct wl1271 *wl)
 {
 	struct wl12xx_priv *priv = wl->priv;
 	struct wlcore_platdev_data *pdev_data = dev_get_platdata(&wl->pdev->dev);
-	struct wl12xx_platform_data *pdata = pdev_data->pdata;
 
 	BUILD_BUG_ON(WL12XX_MAX_LINKS > WLCORE_MAX_LINKS);
 	BUILD_BUG_ON(WL12XX_MAX_AP_STATIONS > WL12XX_MAX_LINKS);
@@ -1834,12 +1831,12 @@ static int wl12xx_setup(struct wl1271 *wl)
 
 	if (!fref_param) {
 		priv->ref_clock = wl12xx_get_clock_idx(wl12xx_refclock_table,
-						       pdata->ref_clock_freq,
-						       pdata->ref_clock_xtal);
+						pdev_data->ref_clock_freq,
+						pdev_data->ref_clock_xtal);
 		if (priv->ref_clock < 0) {
 			wl1271_error("Invalid ref_clock frequency (%d Hz, %s)",
-				     pdata->ref_clock_freq,
-				     pdata->ref_clock_xtal ?
+				     pdev_data->ref_clock_freq,
+				     pdev_data->ref_clock_xtal ?
 				     "XTAL" : "not XTAL");
 
 			return priv->ref_clock;
@@ -1861,13 +1858,13 @@ static int wl12xx_setup(struct wl1271 *wl)
 			wl1271_error("Invalid fref parameter %s", fref_param);
 	}
 
-	if (!tcxo_param && pdata->tcxo_clock_freq) {
+	if (!tcxo_param && pdev_data->tcxo_clock_freq) {
 		priv->tcxo_clock = wl12xx_get_clock_idx(wl12xx_tcxoclock_table,
-							pdata->tcxo_clock_freq,
-							true);
+						pdev_data->tcxo_clock_freq,
+						true);
 		if (priv->tcxo_clock < 0) {
 			wl1271_error("Invalid tcxo_clock frequency (%d Hz)",
-				     pdata->tcxo_clock_freq);
+				     pdev_data->tcxo_clock_freq);
 
 			return priv->tcxo_clock;
 		}
drivers/net/wireless/ti/wlcore/boot.c +0 -1
index 77752b0..19b7ec7 100644
@@ -22,7 +22,6 @@
  */
 
 #include <linux/slab.h>
-#include <linux/wl12xx.h>
 #include <linux/export.h>
 
 #include "debug.h"
drivers/net/wireless/ti/wlcore/main.c +1 -3
index 67518f6..0be8079 100644
@@ -25,7 +25,6 @@
 #include <linux/firmware.h>
 #include <linux/etherdevice.h>
 #include <linux/vmalloc.h>
-#include <linux/wl12xx.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 
@@ -6390,7 +6389,6 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
 	struct wl1271 *wl = context;
 	struct platform_device *pdev = wl->pdev;
 	struct wlcore_platdev_data *pdev_data = dev_get_platdata(&pdev->dev);
-	struct wl12xx_platform_data *pdata = pdev_data->pdata;
 	struct resource *res;
 
 	int ret;
@@ -6446,7 +6444,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
drivers/net/wireless/ti/wlcore/sdio.c +20 -55

147 lines not on this page · raw message

drivers/net/wireless/ti/wlcore/wlcore_i.h +7 -1
index 3396ce5..3833799 100644
@@ -201,8 +201,14 @@ struct wl1271_if_operations {
 };
 
 struct wlcore_platdev_data {
-	struct wl12xx_platform_data *pdata;
 	struct wl1271_if_operations *if_ops;
+
+	int irq;
+	u32 irq_trigger;
+	bool ref_clock_xtal;	/* specify whether the clock is XTAL or not */
+	u32 ref_clock_freq;	/* in Hertz */
+	u32 tcxo_clock_freq;	/* in Hertz, tcxo is always XTAL */
+	bool pwr_in_suspend;
 };
 
 #define MAX_NUM_KEYS 14
include/linux/wl12xx.h +0 -25
index eea1e6d..95704cd 100644
@@ -33,21 +33,8 @@ struct wl1251_platform_data {
 	bool use_eeprom;
 };
 
-struct wl12xx_platform_data {
-	int irq;
-	u32 irq_trigger;
-	bool ref_clock_xtal;	/* specify whether the clock is XTAL or not */
-	u32 ref_clock_freq;	/* in Hertz */
-	u32 tcxo_clock_freq;	/* in Hertz, tcxo is always XTAL */
-	bool pwr_in_suspend;
-};
-
 #ifdef CONFIG_WILINK_PLATFORM_DATA
 
-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);
@@ -55,18 +42,6 @@ struct wl1251_platform_data *wl1251_get_platform_data(void);
 #else
 
 static inline
-int wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
-{
-	return -ENOSYS;
-}
-
-static inline
-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;
Signature · 1 line
1.8.5.2.229.g4448466.dirty
maintainer
#20 lore raw

PATCH v6 6/6 wlcore: remove wl12xx_platform_data

Quoted 13 lines · Eliad Peller

Now that we have wlcore device-tree bindings in place (for both wl12xx and wl18xx), remove the legacy wl12xx_platform_data struct, and move its members into the platform device data (that is passed to wlcore)

Davinci 850 is the only platform that still set the platform data in the legacy way (and doesn't have DT bindings), so remove the relevant code/Kconfig option from the board file (as suggested by Sekhar Nori)

Quoted 11 lines
---
 arch/arm/mach-davinci/Kconfig                  |  11 ---
 arch/arm/mach-davinci/board-da850-evm.c        | 113 -------------------------
 drivers/net/wireless/ti/wilink_platform_data.c |  25 ------
 drivers/net/wireless/ti/wl12xx/main.c          |  19 ++---
 drivers/net/wireless/ti/wlcore/boot.c          |   1 -
 drivers/net/wireless/ti/wlcore/main.c          |   4 +-
 drivers/net/wireless/ti/wlcore/sdio.c          |  75 +++++-----------
 drivers/net/wireless/ti/wlcore/wlcore_i.h      |   8 +-
 include/linux/wl12xx.h                         |  25 ------
 9 files changed, 36 insertions(+), 245 deletions(-)

I got a build error related to the SPI driver with this series, probably need to update this patch:

drivers/net/wireless/ti/wlcore/spi.c: In function ?wl1271_probe?:
drivers/net/wireless/ti/wlcore/spi.c:334:11: error: ?struct wlcore_platdev_data? has no member named ?pdata?

  pdev_data.pdata = dev_get_platdata(&spi->dev);
           ^

drivers/net/wireless/ti/wlcore/spi.c:335:16: error: ?struct wlcore_platdev_data? has no member named ?pdata?
if (!pdev_data.pdata) {

Regards,

Tony

#21 lore raw

PATCH v6 6/6 wlcore: remove wl12xx_platform_data

Quoted 29 lines · Tony Lindgren
Quoted 13 lines · Eliad Peller

Now that we have wlcore device-tree bindings in place (for both wl12xx and wl18xx), remove the legacy wl12xx_platform_data struct, and move its members into the platform device data (that is passed to wlcore)

Davinci 850 is the only platform that still set the platform data in the legacy way (and doesn't have DT bindings), so remove the relevant code/Kconfig option from the board file (as suggested by Sekhar Nori)

Quoted 11 lines
---
 arch/arm/mach-davinci/Kconfig                  |  11 ---
 arch/arm/mach-davinci/board-da850-evm.c        | 113 -------------------------
 drivers/net/wireless/ti/wilink_platform_data.c |  25 ------
 drivers/net/wireless/ti/wl12xx/main.c          |  19 ++---
 drivers/net/wireless/ti/wlcore/boot.c          |   1 -
 drivers/net/wireless/ti/wlcore/main.c          |   4 +-
 drivers/net/wireless/ti/wlcore/sdio.c          |  75 +++++-----------
 drivers/net/wireless/ti/wlcore/wlcore_i.h      |   8 +-
 include/linux/wl12xx.h                         |  25 ------
 9 files changed, 36 insertions(+), 245 deletions(-)

I got a build error related to the SPI driver with this series, probably need to update this patch:

Quoted 7 lines

drivers/net/wireless/ti/wlcore/spi.c: In function ?wl1271_probe?:
drivers/net/wireless/ti/wlcore/spi.c:334:11: error: ?struct wlcore_platdev_data? has no member named ?pdata?

  pdev_data.pdata = dev_get_platdata(&spi->dev);
           ^

drivers/net/wireless/ti/wlcore/spi.c:335:16: error: ?struct wlcore_platdev_data? has no member named ?pdata?
if (!pdev_data.pdata) {

yeah, i missed it :/

looks like there's no platform that defines platform data for it. i'll replace the dev_get_platdata() with a function that only parses the clock-frequency properties (the irq is taken in this case from the spi_device).
(or maybe i should just drop it, as no one actually uses it?)

thanks,
Eliad.

#22 lore raw

PATCH v6 6/6 wlcore: remove wl12xx_platform_data

Quoted 7 lines · On Sunday 15 March 2015 10:50:42 Eliad Peller wrote:

yeah, i missed it :/

looks like there's no platform that defines platform data for it. i'll replace the dev_get_platdata() with a function that only parses the clock-frequency properties (the irq is taken in this case from the spi_device).
(or maybe i should just drop it, as no one actually uses it?)

I don't think we should drop the driver, but dropping the platform_data support sounds reasonable. New users of this driver should all be using DT, and if there is a good reason to use platform_data, it's easily put back.

Arnd

maintainer
#23 lore raw

PATCH v6 6/6 wlcore: remove wl12xx_platform_data

Quoted 9 lines · Arnd Bergmann
Quoted 7 lines · On Sunday 15 March 2015 10:50:42 Eliad Peller wrote:

yeah, i missed it :/

looks like there's no platform that defines platform data for it. i'll replace the dev_get_platdata() with a function that only parses the clock-frequency properties (the irq is taken in this case from the spi_device).
(or maybe i should just drop it, as no one actually uses it?)

Quoted 4 lines

I don't think we should drop the driver, but dropping the platform_data support sounds reasonable. New users of this driver should all be using DT, and if there is a good reason to use platform_data, it's easily put back.

Well we have n8x0 and n900 using the spi driver. For those, n8x0 boot all in dts mode, but n900 still also boots in legacy mode. It seems the board-rx51-peripherals.c only passes the power_gpio though, so that should be easy to keep around.

We should keep things still working for n900 in legacy mode until the pending regressions with device tree based booting have been cleared for at least one merge cycle. I believe the last pending issues is the support for ATAG_REVISION in device tree mode as posted by Pali.

Regards,

Tony

#24 lore raw

PATCH v6 6/6 wlcore: remove wl12xx_platform_data

Hi,

Quoted 20 lines · Tony Lindgren
Quoted 9 lines · Arnd Bergmann
Quoted 7 lines · On Sunday 15 March 2015 10:50:42 Eliad Peller wrote:

yeah, i missed it :/

looks like there's no platform that defines platform data for it. i'll replace the dev_get_platdata() with a function that only parses the clock-frequency properties (the irq is taken in this case from the spi_device).
(or maybe i should just drop it, as no one actually uses it?)

Quoted 4 lines

I don't think we should drop the driver, but dropping the platform_data support sounds reasonable. New users of this driver should all be using DT, and if there is a good reason to use platform_data, it's easily put back.

Well we have n8x0 and n900 using the spi driver. For those, n8x0 boot all in dts mode, but n900 still also boots in legacy mode. It seems the board-rx51-peripherals.c only passes the power_gpio though, so that should be easy to keep around.

Quoted 4 lines

We should keep things still working for n900 in legacy mode until the pending regressions with device tree based booting have been cleared for at least one merge cycle. I believe the last pending issues is the support for ATAG_REVISION in device tree mode as posted by Pali.

mh by migrating to newer gpiod interface platform data is no longer needed (instead the boardfile would need a gpiod_lookup_table). That way all of the dirty code is in the board file and will be removed once the time comes. See for example rx51_fmtx_gpios_table.

Note: This is independent of wl12xx changes, since N900 uses wl1251.

-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150316/0634d88b/attachment.sig>

maintainer
#25 lore raw

PATCH v6 6/6 wlcore: remove wl12xx_platform_data

Quoted 28 lines · Sebastian Reichel

Hi,

Quoted 20 lines · Tony Lindgren
Quoted 9 lines · Arnd Bergmann
Quoted 7 lines · On Sunday 15 March 2015 10:50:42 Eliad Peller wrote:

yeah, i missed it :/

looks like there's no platform that defines platform data for it. i'll replace the dev_get_platdata() with a function that only parses the clock-frequency properties (the irq is taken in this case from the spi_device).
(or maybe i should just drop it, as no one actually uses it?)

Quoted 4 lines

I don't think we should drop the driver, but dropping the platform_data support sounds reasonable. New users of this driver should all be using DT, and if there is a good reason to use platform_data, it's easily put back.

Well we have n8x0 and n900 using the spi driver. For those, n8x0 boot all in dts mode, but n900 still also boots in legacy mode. It seems the board-rx51-peripherals.c only passes the power_gpio though, so that should be easy to keep around.

Quoted 4 lines

We should keep things still working for n900 in legacy mode until the pending regressions with device tree based booting have been cleared for at least one merge cycle. I believe the last pending issues is the support for ATAG_REVISION in device tree mode as posted by Pali.

Quoted 6 lines

mh by migrating to newer gpiod interface platform data is no longer needed (instead the boardfile would need a gpiod_lookup_table). That way all of the dirty code is in the board file and will be removed once the time comes. See for example rx51_fmtx_gpios_table.

Note: This is independent of wl12xx changes, since N900 uses wl1251.

Oh sorry yes sounds like that's different platform data then. In that case I see no reasons to drop the platform data for wl12xx.

Regards,

Tony

#26 lore raw

PATCH v6 6/6 wlcore: remove wl12xx_platform_data

Quoted 34 lines · Tony Lindgren
Quoted 33 lines · Sebastian Reichel

Hi,

Quoted 20 lines · Tony Lindgren
Quoted 9 lines · Arnd Bergmann
Quoted 7 lines · On Sunday 15 March 2015 10:50:42 Eliad Peller wrote:

yeah, i missed it :/

looks like there's no platform that defines platform data for it. i'll replace the dev_get_platdata() with a function that only parses the clock-frequency properties (the irq is taken in this case from the spi_device).
(or maybe i should just drop it, as no one actually uses it?)

Quoted 4 lines

I don't think we should drop the driver, but dropping the platform_data support sounds reasonable. New users of this driver should all be using DT, and if there is a good reason to use platform_data, it's easily put back.

Well we have n8x0 and n900 using the spi driver. For those, n8x0 boot all in dts mode, but n900 still also boots in legacy mode. It seems the board-rx51-peripherals.c only passes the power_gpio though, so that should be easy to keep around.

Quoted 4 lines

We should keep things still working for n900 in legacy mode until the pending regressions with device tree based booting have been cleared for at least one merge cycle. I believe the last pending issues is the support for ATAG_REVISION in device tree mode as posted by Pali.

mh by migrating to newer gpiod interface platform data is no longer needed (instead the boardfile would need a gpiod_lookup_table). That way all of the dirty code is in the board file and will be removed once the time comes. See for example rx51_fmtx_gpios_table.

Quoted 5 lines
Quoted 1 line

Note: This is independent of wl12xx changes, since N900 uses wl1251.

Oh sorry yes sounds like that's different platform data then. In that case I see no reasons to drop the platform data for wl12xx.

great.
so i'll drop the relevant wlcore_spi platform data code, and rebase the patches on top of v4.0-rc4 (probably tomorrow).

Eliad.

#27 lore raw

PATCH v6 6/6 wlcore: remove wl12xx_platform_data

In reply to Tony Lindgren
Quoted 3 lines · On Monday 16 March 2015 16:29:39 Tony Lindgren wrote:

I believe the last pending issues is the support for ATAG_REVISION in device tree mode as posted by Pali.

No. In DT boot there is missing /proc/atags file (readable by userspace processes). And also broken AES/SHA/MD5 support. Fix for crypto DT stuff I already sent.

Signature · 9 lines
Pali Roh?r
pali.rohar at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150316/aca9916c/attachment.sig>
maintainer
#28 lore raw

PATCH v6 6/6 wlcore: remove wl12xx_platform_data

Quoted 7 lines · Pali Roh?r
Quoted 3 lines · On Monday 16 March 2015 16:29:39 Tony Lindgren wrote:

I believe the last pending issues is the support for ATAG_REVISION in device tree mode as posted by Pali.

No. In DT boot there is missing /proc/atags file (readable by userspace processes).

Oh OK thanks for the update.

Quoted 2 lines

And also broken AES/SHA/MD5 support. Fix for crypto DT stuff I already sent.

But this is not a regression in mainline with legacy boot vs device tree based booting, right? Sounds like it never worked in the mainline or am thinking of some other set of patches?

Regards,

Tony

#29 lore raw

PATCH v6 6/6 wlcore: remove wl12xx_platform_data

Quoted 13 lines · On Monday 16 March 2015 22:01:43 Tony Lindgren wrote:
Quoted 6 lines · Pali Roh?r
Quoted 2 lines · On Monday 16 March 2015 16:29:39 Tony Lindgren wrote:

I believe the last pending issues is the support for ATAG_REVISION in device tree mode as posted by Pali.

No. In DT boot there is missing /proc/atags file (readable by userspace processes).

Oh OK thanks for the update.

Quoted 2 lines

And also broken AES/SHA/MD5 support. Fix for crypto DT stuff I already sent.

Quoted 7 lines

But this is not a regression in mainline with legacy boot vs device tree based booting, right? Sounds like it never worked in the mainline or am thinking of some other set of patches?

Regards,

Tony

In legacy board code are DMA channels defined. In DT files not. So I think this is regression. Omap secure devices are broken in both legacy & DT code, but non secure could work with legacy code. But all devices booted with DT are broken.

Signature · 9 lines
Pali Roh?r
pali.rohar at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150316/7f5e42a4/attachment.sig>
maintainer
#30 lore raw

PATCH v6 6/6 wlcore: remove wl12xx_platform_data

Quoted 18 lines · Pali Roh?r
Quoted 17 lines · On Monday 16 March 2015 22:01:43 Tony Lindgren wrote:
Quoted 6 lines · Pali Roh?r
Quoted 2 lines · On Monday 16 March 2015 16:29:39 Tony Lindgren wrote:

I believe the last pending issues is the support for ATAG_REVISION in device tree mode as posted by Pali.

No. In DT boot there is missing /proc/atags file (readable by userspace processes).

Oh OK thanks for the update.

Quoted 2 lines

And also broken AES/SHA/MD5 support. Fix for crypto DT stuff I already sent.

But this is not a regression in mainline with legacy boot vs device tree based booting, right? Sounds like it never worked in the mainline or am thinking of some other set of patches?

Quoted 8 lines
Quoted 3 lines

Regards,

Tony

In legacy board code are DMA channels defined. In DT files not. So I think this is regression. Omap secure devices are broken in both legacy & DT code, but non secure could work with legacy code. But all devices booted with DT are broken.

OK I'll apply the DMA channels into omap-for-v4.0/fixes in that case.

Regards,

Tony

#31 lore raw

v6 cover wlcore: add device-tree support

In reply to Eliad Peller

Hello,

Quoted 6 lines · Eliad Peller

NOTE: all the platform patches were compile-tested only. I'm looking for some wl12xx card (that i should have somewhere) to test the wl12xx changes (wrt. clocks), but haven't found it yet.

I have tested this series on a APF6 board, i.MX6 based board with a Jorjin WG7311-0A Wifi/BT module which is based on the wl1271l.

It works. I was able to power up the wlan0 interface and ping google.

Best regards,

Signature · 1 line
S?bastien Szymanski
#32 lore raw

v6 cover wlcore: add device-tree support

hi S?bastien,

Quoted 10 lines · S?bastien Szymanski

Hello,

Quoted 6 lines · Eliad Peller

NOTE: all the platform patches were compile-tested only. I'm looking for some wl12xx card (that i should have somewhere) to test the wl12xx changes (wrt. clocks), but haven't found it yet.

Quoted 5 lines

I have tested this series on a APF6 board, i.MX6 based board with a Jorjin WG7311-0A Wifi/BT module which is based on the wl1271l.

It works. I was able to power up the wlan0 interface and ping google.

thanks for testing it!

Eliad.