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
--
1.8.5.2.229.g4448466.dirty
Hello,
On 03/12/2015 01:09 PM, Eliad Peller wrote:
>
> 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,
--
S?bastien Szymanski
* Eliad Peller <[email protected]> [150312 05:09]:
> 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
> Change all board files to reflect this.
>
> Signed-off-by: Luciano Coelho <[email protected]>
> [Eliad - small fixes, update board file changes]
> Signed-off-by: Eliad Peller <[email protected]>
> ---
> 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(-)
>
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index 916589c..853b941 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -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)
> diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
> index 4449f4c..337cc22 100644
> --- a/arch/arm/mach-omap2/pdata-quirks.c
> +++ b/arch/arm/mach-omap2/pdata-quirks.c
> @@ -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
>
> diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c
> index 144d1f8..b3f751f 100644
> --- a/drivers/net/wireless/ti/wl12xx/main.c
> +++ b/drivers/net/wireless/ti/wl12xx/main.c
> @@ -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"))
> diff --git a/drivers/net/wireless/ti/wl12xx/wl12xx.h b/drivers/net/wireless/ti/wl12xx/wl12xx.h
> index 75c9265..5952e99a 100644
> --- a/drivers/net/wireless/ti/wl12xx/wl12xx.h
> +++ b/drivers/net/wireless/ti/wl12xx/wl12xx.h
> @@ -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];
> diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
> index 3876b67..eea1e6d 100644
> --- a/include/linux/wl12xx.h
> +++ b/include/linux/wl12xx.h
> @@ -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;
> };
>
> --
> 1.8.5.2.229.g4448466.dirty
>
On Fri, Mar 13, 2015 at 5:27 PM, Tony Lindgren <[email protected]> wrote:
> * Eliad Peller <[email protected]> [150312 05:09]:
>> --- a/arch/arm/mach-omap2/pdata-quirks.c
>> +++ b/arch/arm/mach-omap2/pdata-quirks.c
>>
>> -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.
>
>> @@ -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 :)
>
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.
Hi,
On Mon, Mar 16, 2015 at 08:29:39AM -0700, Tony Lindgren wrote:
> * Arnd Bergmann <[email protected]> [150315 05:10]:
> > 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.
>
> 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.
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
Add device tree binding documentation for TI's wilink
(wl12xx and wl18xx) wlan chip.
Signed-off-by: Eliad Peller <[email protected]>
---
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
diff --git a/Documentation/devicetree/bindings/net/wireless/ti,wlcore.txt b/Documentation/devicetree/bindings/net/wireless/ti,wlcore.txt
new file mode 100644
index 0000000..2a3d90d
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/ti,wlcore.txt
@@ -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@2 {
+ compatible = "ti,wl1835";
+ reg = <2>;
+ interrupt-parent = <&gpio0>;
+ interrupts = <19 IRQ_TYPE_LEVEL_HIGH>;
+ };
+};
--
1.8.5.2.229.g4448466.dirty
On Fri, Mar 13, 2015 at 5:13 PM, Tony Lindgren <[email protected]> wrote:
> * Eliad Peller <[email protected]> [150312 05:10]:
>> 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)
>>
>> Signed-off-by: Luciano Coelho <[email protected]>
>> Signed-off-by: Eliad Peller <[email protected]>
>> ---
>> 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) {
>
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.
Replace all the pdata-quirks for setting wl12xx/wl18xx
platform data with proper DT definitions.
The patch was compile-tested only.
Signed-off-by: Eliad Peller <[email protected]>
---
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(-)
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts
index df5fee6..87fc7a3 100644
--- a/arch/arm/boot/dts/am335x-evmsk.dts
+++ b/arch/arm/boot/dts/am335x-evmsk.dts
@@ -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@2 {
+ compatible = "ti,wl1271";
+ reg = <2>;
+ interrupt-parent = <&gpio1>;
+ interrupts = <31 IRQ_TYPE_LEVEL_HIGH>; /* gpio 31 */
+ ref-clock-frequency = <38400000>;
+ };
};
&mcasp1 {
diff --git a/arch/arm/boot/dts/omap3-cm-t3517.dts b/arch/arm/boot/dts/omap3-cm-t3517.dts
index 0ab748c..f5b5a1d 100644
--- a/arch/arm/boot/dts/omap3-cm-t3517.dts
+++ b/arch/arm/boot/dts/omap3-cm-t3517.dts
@@ -133,6 +133,16 @@
non-removable;
bus-width = <4>;
cap-power-off-card;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+ wlcore: wlcore@2 {
+ compatible = "ti,wl1271";
+ reg = <2>;
+ interrupt-parent = <&gpio5>;
+ interrupts = <17 IRQ_TYPE_LEVEL_HIGH>; /* gpio 145 */
+ ref-clock-frequency = <38400000>;
+ };
};
&dss {
diff --git a/arch/arm/boot/dts/omap3-cm-t3730.dts b/arch/arm/boot/dts/omap3-cm-t3730.dts
index 46eadb2..2294f5b 100644
--- a/arch/arm/boot/dts/omap3-cm-t3730.dts
+++ b/arch/arm/boot/dts/omap3-cm-t3730.dts
@@ -73,6 +73,16 @@
non-removable;
bus-width = <4>;
cap-power-off-card;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+ wlcore: wlcore@2 {
+ compatible = "ti,wl1271";
+ reg = <2>;
+ interrupt-parent = <&gpio5>;
+ interrupts = <8 IRQ_TYPE_LEVEL_HIGH>; /* gpio 136 */
+ ref-clock-frequency = <38400000>;
+ };
};
&dss {
diff --git a/arch/arm/boot/dts/omap3-evm-common.dtsi b/arch/arm/boot/dts/omap3-evm-common.dtsi
index 127f3e7..346552b 100644
--- a/arch/arm/boot/dts/omap3-evm-common.dtsi
+++ b/arch/arm/boot/dts/omap3-evm-common.dtsi
@@ -106,6 +106,16 @@
non-removable;
bus-width = <4>;
cap-power-off-card;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+ wlcore: wlcore@2 {
+ compatible = "ti,wl1271";
+ reg = <2>;
+ interrupt-parent = <&gpio5>;
+ interrupts = <21 IRQ_TYPE_LEVEL_HIGH>; /* gpio 149 */
+ ref-clock-frequency = <38400000>;
+ };
};
&twl_gpio {
diff --git a/arch/arm/boot/dts/omap3-igep0020-rev-f.dts b/arch/arm/boot/dts/omap3-igep0020-rev-f.dts
index cc8bd0c..72f7cdc 100644
--- a/arch/arm/boot/dts/omap3-igep0020-rev-f.dts
+++ b/arch/arm/boot/dts/omap3-igep0020-rev-f.dts
@@ -42,4 +42,13 @@
vmmc-supply = <&lbep5clwmc_wlen>;
bus-width = <4>;
non-removable;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+ wlcore: wlcore@2 {
+ compatible = "ti,wl1835";
+ reg = <2>;
+ interrupt-parent = <&gpio6>;
+ interrupts = <17 IRQ_TYPE_LEVEL_HIGH>; /* gpio 177 */
+ };
};
diff --git a/arch/arm/boot/dts/omap3-igep0030-rev-g.dts b/arch/arm/boot/dts/omap3-igep0030-rev-g.dts
index 9326b28..b899e34 100644
--- a/arch/arm/boot/dts/omap3-igep0030-rev-g.dts
+++ b/arch/arm/boot/dts/omap3-igep0030-rev-g.dts
@@ -64,4 +64,13 @@
vmmc-supply = <&lbep5clwmc_wlen>;
bus-width = <4>;
non-removable;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+ wlcore: wlcore@2 {
+ compatible = "ti,wl1835";
+ reg = <2>;
+ interrupt-parent = <&gpio5>;
+ interrupts = <8 IRQ_TYPE_LEVEL_HIGH>; /* gpio 136 */
+ };
};
diff --git a/arch/arm/boot/dts/omap3-zoom3.dts b/arch/arm/boot/dts/omap3-zoom3.dts
index 6644f51..131448d 100644
--- a/arch/arm/boot/dts/omap3-zoom3.dts
+++ b/arch/arm/boot/dts/omap3-zoom3.dts
@@ -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@2 {
+ compatible = "ti,wl1271";
+ reg = <2>;
+ interrupt-parent = <&gpio6>;
+ interrupts = <2 IRQ_TYPE_LEVEL_HIGH>; /* gpio 162 */
+ ref-clock-frequency = <26000000>;
+ };
};
&uart1 {
diff --git a/arch/arm/boot/dts/omap4-panda-common.dtsi b/arch/arm/boot/dts/omap4-panda-common.dtsi
index 1505135..1228de5 100644
--- a/arch/arm/boot/dts/omap4-panda-common.dtsi
+++ b/arch/arm/boot/dts/omap4-panda-common.dtsi
@@ -450,6 +450,16 @@
non-removable;
bus-width = <4>;
cap-power-off-card;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+ wlcore: wlcore@2 {
+ compatible = "ti,wl1271";
+ reg = <2>;
+ interrupt-parent = <&gpio2>;
+ interrupts = <21 IRQ_TYPE_LEVEL_HIGH>; /* gpio 53 */
+ ref-clock-frequency = <38400000>;
+ };
};
&emif1 {
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index 3e1da43..8c36f51 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -487,6 +487,17 @@
non-removable;
bus-width = <4>;
cap-power-off-card;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+ wlcore: wlcore@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 {
diff --git a/arch/arm/boot/dts/omap4-var-som-om44-wlan.dtsi b/arch/arm/boot/dts/omap4-var-som-om44-wlan.dtsi
index cc66af4..9bceeb7 100644
--- a/arch/arm/boot/dts/omap4-var-som-om44-wlan.dtsi
+++ b/arch/arm/boot/dts/omap4-var-som-om44-wlan.dtsi
@@ -65,4 +65,14 @@
bus-width = <4>;
cap-power-off-card;
status = "okay";
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+ wlcore: wlcore@2 {
+ compatible = "ti,wl1271";
+ reg = <2>;
+ interrupt-parent = <&gpio2>;
+ interrupts = <9 IRQ_TYPE_LEVEL_HIGH>; /* gpio 41 */
+ ref-clock-frequency = <38400000>;
+ };
};
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index 337cc22..4464e07 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -14,7 +14,6 @@
#include <linux/kernel.h>
#include <linux/of_platform.h>
#include <linux/ti_wilink_st.h>
-#include <linux/wl12xx.h>
#include <linux/platform_data/pinctrl-single.h>
#include <linux/platform_data/iommu-omap.h>
@@ -35,35 +34,6 @@ struct pdata_init {
struct of_dev_auxdata omap_auxdata_lookup[];
static struct twl4030_gpio_platform_data twl_gpio_auxdata;
-#if IS_ENABLED(CONFIG_WL12XX)
-
-static struct wl12xx_platform_data wl12xx __initdata;
-
-static void __init __used legacy_init_wl12xx(u32 ref_clock_freq,
- u32 tcxo_clock_freq,
- int gpio)
-{
- int res;
-
- 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;
-
- res = wl12xx_set_platform_data(&wl12xx);
- if (res) {
- pr_err("error setting wl12xx data: %d\n", res);
- return;
- }
-}
-#else
-static inline void legacy_init_wl12xx(u32 ref_clock_freq,
- u32 tcxo_clock_freq,
- int gpio)
-{
-}
-#endif
-
#ifdef CONFIG_MACH_NOKIA_N8X0
static void __init omap2420_n8x0_legacy_init(void)
{
@@ -130,7 +100,6 @@ 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(38400000, 0, 136);
}
static void __init omap3_sbc_t3530_legacy_init(void)
@@ -160,28 +129,16 @@ static struct platform_device btwilink_device = {
static void __init omap3_igep0020_rev_f_legacy_init(void)
{
- legacy_init_wl12xx(0, 0, 177);
platform_device_register(&wl18xx_device);
platform_device_register(&btwilink_device);
}
static void __init omap3_igep0030_rev_g_legacy_init(void)
{
- legacy_init_wl12xx(0, 0, 136);
platform_device_register(&wl18xx_device);
platform_device_register(&btwilink_device);
}
-static void __init omap3_evm_legacy_init(void)
-{
- legacy_init_wl12xx(38400000, 0, 149);
-}
-
-static void __init omap3_zoom_legacy_init(void)
-{
- legacy_init_wl12xx(26000000, 0, 162);
-}
-
static void am35xx_enable_emac_int(void)
{
u32 v;
@@ -246,7 +203,6 @@ static void __init omap3_sbc_t3517_legacy_init(void)
am35xx_emac_reset();
hsmmc2_internal_input_clk();
omap3_sbc_t3517_wifi_init();
- legacy_init_wl12xx(38400000, 0, 145);
}
static void __init am3517_evm_legacy_init(void)
@@ -288,23 +244,6 @@ static void __init omap3_tao3530_legacy_init(void)
}
#endif /* CONFIG_ARCH_OMAP3 */
-#ifdef CONFIG_ARCH_OMAP4
-static void __init omap4_sdp_legacy_init(void)
-{
- legacy_init_wl12xx(26000000, 26000000, 53);
-}
-
-static void __init omap4_panda_legacy_init(void)
-{
- legacy_init_wl12xx(38400000, 0, 53);
-}
-
-static void __init var_som_om44_legacy_init(void)
-{
- legacy_init_wl12xx(38400000, 0, 41);
-}
-#endif
-
#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
static struct iommu_platform_data omap4_iommu_pdata = {
.reset_name = "mmu_cache",
@@ -313,13 +252,6 @@ static struct iommu_platform_data omap4_iommu_pdata = {
};
#endif
-#ifdef CONFIG_SOC_AM33XX
-static void __init am335x_evmsk_legacy_init(void)
-{
- legacy_init_wl12xx(38400000, 0, 31);
-}
-#endif
-
#ifdef CONFIG_SOC_OMAP5
static void __init omap5_uevm_legacy_init(void)
{
@@ -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, },
- { "ti,omap3-zoom3", omap3_zoom_legacy_init, },
{ "ti,am3517-evm", am3517_evm_legacy_init, },
{ "technexion,omap3-tao3530", omap3_tao3530_legacy_init, },
#endif
-#ifdef CONFIG_ARCH_OMAP4
- { "ti,omap4-sdp", omap4_sdp_legacy_init, },
- { "ti,omap4-panda", omap4_panda_legacy_init, },
- { "variscite,var-dvk-om44", var_som_om44_legacy_init, },
- { "variscite,var-stk-om44", var_som_om44_legacy_init, },
-#endif
-#ifdef CONFIG_SOC_AM33XX
- { "ti,am335x-evmsk", am335x_evmsk_legacy_init, },
-#endif
#ifdef CONFIG_SOC_OMAP5
{ "ti,omap5-uevm", omap5_uevm_legacy_init, },
#endif
--
1.8.5.2.229.g4448466.dirty
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.
Signed-off-by: Luciano Coelho <[email protected]>
[Eliad - small fixes, update board file changes]
Signed-off-by: Eliad Peller <[email protected]>
---
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(-)
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 916589c..853b941 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -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)
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index 4449f4c..337cc22 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -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
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c
index 144d1f8..b3f751f 100644
--- a/drivers/net/wireless/ti/wl12xx/main.c
+++ b/drivers/net/wireless/ti/wl12xx/main.c
@@ -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"))
diff --git a/drivers/net/wireless/ti/wl12xx/wl12xx.h b/drivers/net/wireless/ti/wl12xx/wl12xx.h
index 75c9265..5952e99a 100644
--- a/drivers/net/wireless/ti/wl12xx/wl12xx.h
+++ b/drivers/net/wireless/ti/wl12xx/wl12xx.h
@@ -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];
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 3876b67..eea1e6d 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -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;
};
--
1.8.5.2.229.g4448466.dirty
* Arnd Bergmann <[email protected]> [150315 05:10]:
> 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.
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
Hello Eliad,
On Thu, Mar 12, 2015 at 1:09 PM, Eliad Peller <[email protected]> wrote:
> Replace all the pdata-quirks for setting wl12xx/wl18xx
> platform data with proper DT definitions.
>
> The patch was compile-tested only.
>
> Signed-off-by: Eliad Peller <[email protected]>
> ---
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:
Acked-by: Javier Martinez Canillas <[email protected]>
Best regards,
Javier
* Eliad Peller <[email protected]> [150312 05:10]:
> 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)
>
> Signed-off-by: Luciano Coelho <[email protected]>
> Signed-off-by: Eliad Peller <[email protected]>
> ---
> 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
* Eliad Peller <[email protected]> [150312 05:09]:
> --- a/arch/arm/mach-omap2/pdata-quirks.c
> +++ b/arch/arm/mach-omap2/pdata-quirks.c
>
> -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.
> @@ -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
+Kalle
On Fri, Mar 13, 2015 at 5:00 PM, Tony Lindgren <[email protected]> wrote:
> * Eliad Peller <[email protected]> [150312 05:09]:
>> 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 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?
> 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.
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.
Signed-off-by: Luciano Coelho <[email protected]>
[Eliad - rebase, add irq_trigger field and pass it,
update board file changes]
Signed-off-by: Eliad Peller <[email protected]>
---
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(-)
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 6b5a97d..916589c 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -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)
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index 190fa43..4449f4c 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -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) {
diff --git a/drivers/net/wireless/ti/wlcore/debugfs.c b/drivers/net/wireless/ti/wlcore/debugfs.c
index 68f3bf2..eb43f94 100644
--- a/drivers/net/wireless/ti/wlcore/debugfs.c
+++ b/drivers/net/wireless/ti/wlcore/debugfs.c
@@ -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);
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index 1e13699..67518f6 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -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;
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c
index d3dd7bf..2bce00a 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -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));
diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h
index d599c86..7f363fa 100644
--- a/drivers/net/wireless/ti/wlcore/wlcore.h
+++ b/drivers/net/wireless/ti/wlcore/wlcore.h
@@ -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;
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index a9c723b..3876b67 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;
+ 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);
--
1.8.5.2.229.g4448466.dirty
* Pali Rohár <[email protected]> [150316 14:15]:
> On Monday 16 March 2015 22:01:43 Tony Lindgren wrote:
> > * Pali Rohár <[email protected]> [150316 13:59]:
> > > 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.
> >
> > > 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
>
> 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
Arnd Bergmann <[email protected]> writes:
> On Sunday 15 March 2015 10:43:35 Eliad Peller wrote:
>>
>> > 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.
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.
--
Kalle Valo
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
* Kalle Valo <[email protected]> [150320 07:01]:
> Tony Lindgren <[email protected]> writes:
>
> >> 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.
>
> 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
hi Sébastien,
On Fri, Mar 13, 2015 at 6:11 PM, Sébastien Szymanski
<[email protected]> wrote:
> Hello,
>
> On 03/12/2015 01:09 PM, Eliad Peller wrote:
>>
>> 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.
>
thanks for testing it!
Eliad.
* Kalle Valo <[email protected]> [150315 23:50]:
> Arnd Bergmann <[email protected]> writes:
>
> > On Sunday 15 March 2015 10:43:35 Eliad Peller wrote:
> >>
> >> > 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.
>
> 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
* Sebastian Reichel <[email protected]> [150316 11:26]:
> Hi,
>
> On Mon, Mar 16, 2015 at 08:29:39AM -0700, Tony Lindgren wrote:
> > * Arnd Bergmann <[email protected]> [150315 05:10]:
> > > 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.
> >
> > 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.
>
> 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
On Mon, Mar 16, 2015 at 8:24 PM, Tony Lindgren <[email protected]> wrote:
> * Sebastian Reichel <[email protected]> [150316 11:26]:
>> Hi,
>>
>> On Mon, Mar 16, 2015 at 08:29:39AM -0700, Tony Lindgren wrote:
>> > * Arnd Bergmann <[email protected]> [150315 05:10]:
>> > > 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.
>> >
>> > 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.
>>
>> 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.
>
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.
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.
Signed-off-by: Ido Yariv <[email protected]>
Signed-off-by: Eliad Peller <[email protected]>
---
v6: parse frequency properties, add wl12xx compatible strings
drivers/net/wireless/ti/wlcore/sdio.c | 93 ++++++++++++++++++++++++++++++++---
1 file changed, 87 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c
index 2bce00a..b55dc0e 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -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);
}
--
1.8.5.2.229.g4448466.dirty
that would be great. thanks.
i'll try posting the updated patchset (v7, some minor changes) tomorrow.
Eliad.
On Mon, Mar 16, 2015 at 3:08 PM, Pau Pajuel <[email protected]> wrote:
> Hi,
>
> 2015-03-13 9:17 GMT+01:00 Enric Balletbo Serra <[email protected]>:
>>
>> Hello,
>>
>> 2015-03-13 9:01 GMT+01:00 Javier Martinez Canillas <[email protected]>:
>> > Hello Eliad,
>> >
>> > On Thu, Mar 12, 2015 at 1:09 PM, Eliad Peller <[email protected]> wrote:
>> >> Replace all the pdata-quirks for setting wl12xx/wl18xx
>> >> platform data with proper DT definitions.
>> >>
>> >> The patch was compile-tested only.
>> >>
>> >> Signed-off-by: Eliad Peller <[email protected]>
>> >> ---
>> >
>> > 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 ;)
>>
>> > But in any case, your patch looks good to me so for the
>> > arch/arm/boot/dts/omap3-igep00* changes:
>> >
>> > Acked-by: Javier Martinez Canillas <[email protected]>
>> >
>>
>> For my part also looks good.
>>
>> Acked-by: Enric Balletbo i Serra <[email protected]>
>>
>> Best regards,
>> Enric
>>
>> > Best regards,
>> > Javier
>
>
> I'm gonna test it this week. I added Eduard Gavin as cc too.
>
> Cheers!
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)
Signed-off-by: Luciano Coelho <[email protected]>
Signed-off-by: Eliad Peller <[email protected]>
---
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(-)
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index 584e8d4..6bb1049 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -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
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 853b941..1ed545c 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -38,7 +38,6 @@
#include <linux/regulator/fixed.h>
#include <linux/spi/spi.h>
#include <linux/spi/flash.h>
-#include <linux/wl12xx.h>
#include <mach/common.h>
#include <mach/cp_intc.h>
@@ -60,9 +59,6 @@
#define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0)
#define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1)
-#define DA850_WLAN_EN GPIO_TO_PIN(6, 9)
-#define DA850_WLAN_IRQ GPIO_TO_PIN(6, 10)
-
#define DA850_MII_MDIO_CLKEN_PIN GPIO_TO_PIN(2, 6)
static struct mtd_partition da850evm_spiflash_part[] = {
@@ -1343,110 +1339,6 @@ static __init void da850_vpif_init(void)
static __init void da850_vpif_init(void) {}
#endif
-#ifdef CONFIG_DA850_WL12XX
-
-static void wl12xx_set_power(int index, bool power_on)
-{
- static bool power_state;
-
- pr_debug("Powering %s wl12xx", power_on ? "on" : "off");
-
- if (power_on == power_state)
- return;
- power_state = power_on;
-
- if (power_on) {
- /* Power up sequence required for wl127x devices */
- gpio_set_value(DA850_WLAN_EN, 1);
- usleep_range(15000, 15000);
- gpio_set_value(DA850_WLAN_EN, 0);
- usleep_range(1000, 1000);
- gpio_set_value(DA850_WLAN_EN, 1);
- msleep(70);
- } else {
- gpio_set_value(DA850_WLAN_EN, 0);
- }
-}
-
-static struct davinci_mmc_config da850_wl12xx_mmc_config = {
- .set_power = wl12xx_set_power,
- .wires = 4,
- .max_freq = 25000000,
- .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_NONREMOVABLE |
- MMC_CAP_POWER_OFF_CARD,
-};
-
-static const short da850_wl12xx_pins[] __initconst = {
- DA850_MMCSD1_DAT_0, DA850_MMCSD1_DAT_1, DA850_MMCSD1_DAT_2,
- DA850_MMCSD1_DAT_3, DA850_MMCSD1_CLK, DA850_MMCSD1_CMD,
- DA850_GPIO6_9, DA850_GPIO6_10,
- -1
-};
-
-static struct wl12xx_platform_data da850_wl12xx_wlan_data __initdata = {
- .irq = -1,
- .irq_trigger = IRQ_TYPE_EDGE_RISING,
- .ref_clock_freq = 38400000,
- .ref_clock_xtal = false,
-};
-
-static __init int da850_wl12xx_init(void)
-{
- int ret;
-
- ret = davinci_cfg_reg_list(da850_wl12xx_pins);
- if (ret) {
- pr_err("wl12xx/mmc mux setup failed: %d\n", ret);
- goto exit;
- }
-
- ret = da850_register_mmcsd1(&da850_wl12xx_mmc_config);
- if (ret) {
- pr_err("wl12xx/mmc registration failed: %d\n", ret);
- goto exit;
- }
-
- ret = gpio_request_one(DA850_WLAN_EN, GPIOF_OUT_INIT_LOW, "wl12xx_en");
- if (ret) {
- pr_err("Could not request wl12xx enable gpio: %d\n", ret);
- goto exit;
- }
-
- ret = gpio_request_one(DA850_WLAN_IRQ, GPIOF_IN, "wl12xx_irq");
- if (ret) {
- pr_err("Could not request wl12xx irq gpio: %d\n", ret);
- goto free_wlan_en;
- }
-
- da850_wl12xx_wlan_data.irq = gpio_to_irq(DA850_WLAN_IRQ);
-
- ret = wl12xx_set_platform_data(&da850_wl12xx_wlan_data);
- if (ret) {
- pr_err("Could not set wl12xx data: %d\n", ret);
- goto free_wlan_irq;
- }
-
- return 0;
-
-free_wlan_irq:
- gpio_free(DA850_WLAN_IRQ);
-
-free_wlan_en:
- gpio_free(DA850_WLAN_EN);
-
-exit:
- return ret;
-}
-
-#else /* CONFIG_DA850_WL12XX */
-
-static __init int da850_wl12xx_init(void)
-{
- return 0;
-}
-
-#endif /* CONFIG_DA850_WL12XX */
-
#define DA850EVM_SATA_REFCLKPN_RATE (100 * 1000 * 1000)
static __init void da850_evm_init(void)
@@ -1503,11 +1395,6 @@ static __init void da850_evm_init(void)
if (ret)
pr_warn("%s: MMCSD0 registration failed: %d\n",
__func__, ret);
-
- ret = da850_wl12xx_init();
- if (ret)
- pr_warn("%s: WL12xx initialization failed: %d\n",
- __func__, ret);
}
davinci_serial_init(da8xx_serial_device);
diff --git a/drivers/net/wireless/ti/wilink_platform_data.c b/drivers/net/wireless/ti/wilink_platform_data.c
index a92bd3e..ea0e359 100644
--- a/drivers/net/wireless/ti/wilink_platform_data.c
+++ b/drivers/net/wireless/ti/wilink_platform_data.c
@@ -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)
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c
index b3f751f..af0fe2e 100644
--- a/drivers/net/wireless/ti/wl12xx/main.c
+++ b/drivers/net/wireless/ti/wl12xx/main.c
@@ -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;
}
diff --git a/drivers/net/wireless/ti/wlcore/boot.c b/drivers/net/wireless/ti/wlcore/boot.c
index 77752b0..19b7ec7 100644
--- a/drivers/net/wireless/ti/wlcore/boot.c
+++ b/drivers/net/wireless/ti/wlcore/boot.c
@@ -22,7 +22,6 @@
*/
#include <linux/slab.h>
-#include <linux/wl12xx.h>
#include <linux/export.h>
#include "debug.h"
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index 67518f6..0be8079 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -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
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c
index b55dc0e..06ea11d 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -31,7 +31,6 @@
#include <linux/mmc/card.h>
#include <linux/mmc/host.h>
#include <linux/gpio.h>
-#include <linux/wl12xx.h>
#include <linux/pm_runtime.h>
#include <linux/printk.h>
#include <linux/of.h>
@@ -231,67 +230,40 @@ static const struct of_device_id wlcore_sdio_of_match_table[] = {
{ }
};
-static struct wl12xx_platform_data *wlcore_probe_of(struct device *dev)
+static int wlcore_probe_of(struct device *dev,
+ struct wlcore_platdev_data *pdev_data)
{
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;
+ return -ENODATA;
- pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
- if (!pdata)
- return NULL;
-
- pdata->irq = irq_of_parse_and_map(np, 0);
- if (!pdata->irq) {
+ pdev_data->irq = irq_of_parse_and_map(np, 0);
+ if (!pdev_data->irq) {
dev_err(dev, "No irq in platform data\n");
- kfree(pdata);
- return NULL;
+ kfree(pdev_data);
+ return -EINVAL;
}
- pdata->irq_trigger =
- irqd_get_trigger_type(irq_get_irq_data(pdata->irq));
+ pdev_data->irq_trigger =
+ irqd_get_trigger_type(irq_get_irq_data(pdev_data->irq));
/* optional clock frequency params */
of_property_read_u32(np, "ref-clock-frequency",
- &pdata->ref_clock_freq);
+ &pdev_data->ref_clock_freq);
of_property_read_u32(np, "tcxo-clock-frequency",
- &pdata->tcxo_clock_freq);
+ &pdev_data->tcxo_clock_freq);
- return pdata;
+ return 0;
}
#else
-static struct wl12xx_platform_data *wlcore_probe_of(struct device *dev)
+static int wlcore_probe_of(struct device *dev,
+ struct wlcore_platdev_data *pdev_data)
{
- return NULL;
+ return -ENODATA;
}
#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)
{
@@ -323,8 +295,7 @@ 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 = wlcore_get_platform_data(&func->dev);
- if (!pdev_data.pdata)
+ if (wlcore_probe_of(&func->dev, &pdev_data))
goto out_free_glue;
/* if sdio can keep power while host is suspended, enable wow */
@@ -332,7 +303,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);
@@ -354,15 +325,15 @@ 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_pdata;
+ goto out_free_glue;
}
glue->core->dev.parent = &func->dev;
memset(res, 0x00, sizeof(res));
- res[0].start = pdev_data.pdata->irq;
- res[0].flags = IORESOURCE_IRQ | pdev_data.pdata->irq_trigger;
+ res[0].start = pdev_data.irq;
+ res[0].flags = IORESOURCE_IRQ | pdev_data.irq_trigger;
res[0].name = "irq";
ret = platform_device_add_resources(glue->core, res, ARRAY_SIZE(res));
@@ -388,9 +359,6 @@ 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);
@@ -401,14 +369,11 @@ 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);
}
diff --git a/drivers/net/wireless/ti/wlcore/wlcore_i.h b/drivers/net/wireless/ti/wlcore/wlcore_i.h
index 3396ce5..3833799 100644
--- a/drivers/net/wireless/ti/wlcore/wlcore_i.h
+++ b/drivers/net/wireless/ti/wlcore/wlcore_i.h
@@ -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
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index eea1e6d..95704cd 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -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;
--
1.8.5.2.229.g4448466.dirty
* Pali Rohár <[email protected]> [150316 13:59]:
> 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.
> 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
Tony Lindgren <[email protected]> writes:
>> 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.
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 ;)
--
Kalle Valo
On Monday 16 March 2015 22:01:43 Tony Lindgren wrote:
> * Pali Rohár <[email protected]> [150316 13:59]:
> > 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.
>
> > 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
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.
--
Pali Rohár
[email protected]
On Sunday 15 March 2015 10:43:35 Eliad Peller wrote:
>
> > 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
Hello,
2015-03-13 9:01 GMT+01:00 Javier Martinez Canillas <[email protected]>:
> Hello Eliad,
>
> On Thu, Mar 12, 2015 at 1:09 PM, Eliad Peller <[email protected]> wrote:
>> Replace all the pdata-quirks for setting wl12xx/wl18xx
>> platform data with proper DT definitions.
>>
>> The patch was compile-tested only.
>>
>> Signed-off-by: Eliad Peller <[email protected]>
>> ---
>
> 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 ;)
> But in any case, your patch looks good to me so for the
> arch/arm/boot/dts/omap3-igep00* changes:
>
> Acked-by: Javier Martinez Canillas <[email protected]>
>
For my part also looks good.
Acked-by: Enric Balletbo i Serra <[email protected]>
Best regards,
Enric
> Best regards,
> Javier
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.
--
Pali Rohár
[email protected]