* Re: [PATCH v2 7/9] wlcore: sdio: add wilink clock providers
From: Felipe Balbi @ 2013-07-02 15:34 UTC (permalink / raw)
To: Luciano Coelho
Cc: linux-wireless, tony, nsekhar, mturquette, mark.rutland, balbi,
grant.likely, rob.herring, devicetree-discuss, linux-doc,
linux-kernel, linux-omap, linux-arm-kernel
In-Reply-To: <1372776948-24840-8-git-send-email-coelho@ti.com>
[-- Attachment #1: Type: text/plain, Size: 705 bytes --]
On Tue, Jul 02, 2013 at 05:55:46PM +0300, Luciano Coelho wrote:
> Add refclock and tcxoclock as clock providers in WiLink. These clocks
> are not accesible outside the WiLink module, but they are registered
> in the clock framework anyway. Only the WiLink chip consumes these
> clocks.
>
> In theory, the WiLink chip could be connected to external clocks
> instead of using these internal clocks, so make the clock consumer
> code generic enough. If external clocks are used, then the internal
> clock device tree nodes are not necessary, but the external ones must
> be specified.
>
> Signed-off-by: Luciano Coelho <coelho@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH v2 5/9] wlcore: always use one-shot IRQ
From: Felipe Balbi @ 2013-07-02 15:32 UTC (permalink / raw)
To: Luciano Coelho
Cc: linux-wireless, tony, nsekhar, mturquette, mark.rutland, balbi,
grant.likely, rob.herring, devicetree-discuss, linux-doc,
linux-kernel, linux-omap, linux-arm-kernel
In-Reply-To: <1372776948-24840-6-git-send-email-coelho@ti.com>
[-- Attachment #1: Type: text/plain, Size: 537 bytes --]
On Tue, Jul 02, 2013 at 05:55:44PM +0300, Luciano Coelho wrote:
> Since we are now using threaded IRQs without the primary handler, we
> need to set IRQF_ONESHOT, otherwise our request will fail.
>
> Signed-off-by: Luciano Coelho <coelho@ti.com>
good to see this happening, I remember we talked about this a while back
:-)
Acked-by: Felipe Balbi <balbi@ti.com>
Still, if you call irq_set_irq_type() on board-file (since DT will do
something similar for you anyway) then you can completely drop
irq_flags.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH v2 4/9] wl12xx: use frequency instead of enumerations for pdata clocks
From: Felipe Balbi @ 2013-07-02 15:31 UTC (permalink / raw)
To: Luciano Coelho
Cc: linux-wireless, tony, nsekhar, mturquette, mark.rutland, balbi,
grant.likely, rob.herring, devicetree-discuss, linux-doc,
linux-kernel, linux-omap, linux-arm-kernel
In-Reply-To: <1372776948-24840-5-git-send-email-coelho@ti.com>
[-- Attachment #1: Type: text/plain, Size: 864 bytes --]
Hi,
On Tue, Jul 02, 2013 at 05:55:43PM +0300, Luciano Coelho wrote:
> diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c
> index 1c627da..903dcb3 100644
> --- a/drivers/net/wireless/ti/wl12xx/main.c
> +++ b/drivers/net/wireless/ti/wl12xx/main.c
> @@ -1701,6 +1701,42 @@ static struct ieee80211_sta_ht_cap wl12xx_ht_cap = {
> },
> };
>
> +static struct wl12xx_clock wl12xx_refclock_table[] = {
const
> + { 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 struct wl12xx_clock wl12xx_tcxoclock_table[] = {
const
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH v2 2/9] wlcore: use irq_flags in pdata instead of hiding it behind a quirk
From: Felipe Balbi @ 2013-07-02 15:26 UTC (permalink / raw)
To: Luciano Coelho
Cc: linux-wireless, tony, nsekhar, mturquette, mark.rutland, balbi,
grant.likely, rob.herring, devicetree-discuss, linux-doc,
linux-kernel, linux-omap, linux-arm-kernel
In-Reply-To: <1372776948-24840-3-git-send-email-coelho@ti.com>
[-- Attachment #1: Type: text/plain, Size: 2541 bytes --]
Hi,
On Tue, Jul 02, 2013 at 05:55:41PM +0300, Luciano Coelho wrote:
> The platform_quirk element in the platform data was used to change the
> way the IRQ is triggered. When set, the EDGE_IRQ quirk would change
> the irqflags used and treat edge trigger differently from the rest.
>
> Instead of hiding this irq flag setting behind the quirk, export the
> whole irq_flags element and let the board file define what to use.
> This will be more meaningful than driver-specific quirks when we
> switch to DT.
>
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: Sekhar Nori <nsekhar@ti.com>
> Signed-off-by: Luciano Coelho <coelho@ti.com>
> Acked-by: Tony Lindgren <tony@atomide.com>
> ---
> arch/arm/mach-davinci/board-da850-evm.c | 2 +-
> arch/arm/mach-omap2/board-4430sdp.c | 1 +
> arch/arm/mach-omap2/board-omap3evm.c | 1 +
> arch/arm/mach-omap2/board-omap4panda.c | 1 +
> arch/arm/mach-omap2/board-zoom-peripherals.c | 1 +
> drivers/net/wireless/ti/wlcore/debugfs.c | 2 +-
> drivers/net/wireless/ti/wlcore/main.c | 13 +++----------
> drivers/net/wireless/ti/wlcore/wlcore.h | 5 ++---
> include/linux/wl12xx.h | 5 +----
> 9 files changed, 12 insertions(+), 19 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index 8a24b6c..d2a2a98 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -1377,8 +1377,8 @@ static const short da850_wl12xx_pins[] __initconst = {
>
> static struct wl12xx_platform_data da850_wl12xx_wlan_data __initdata = {
> .irq = -1,
> + .irq_flags = IRQF_TRIGGER_RISING,
> .board_ref_clock = WL12XX_REFCLOCK_38,
> - .platform_quirks = WL12XX_PLATFORM_QUIRK_EDGE_IRQ,
> };
>
> static __init int da850_wl12xx_init(void)
> diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
> index 56a9a4f..c2334aa 100644
> --- a/arch/arm/mach-omap2/board-4430sdp.c
> +++ b/arch/arm/mach-omap2/board-4430sdp.c
> @@ -693,6 +693,7 @@ static void __init omap4_sdp4430_wifi_mux_init(void)
> }
>
> static struct wl12xx_platform_data omap4_sdp4430_wlan_data __initdata = {
> + .irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
couldn't you just call irq_set_irq_type() from the board-file itself ?
Then on your driver you can just pass IRQF_ONESHOT (to make sure heh) to
your request_threaded_irq_handler()
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* [PATCH] wireless: Convert mwifiex/pcie to dev_pm_ops from legacy pm ops
From: Shuah Khan @ 2013-07-02 15:24 UTC (permalink / raw)
To: bzhao, linville, rjw
Cc: Shuah Khan, linux-wireless, netdev, linux-kernel, shuahkhan
Convert the mwifiex/pci driver to use dev_pm_ops for power management and
remove Legacy PM handling. This change re-uses existing suspend and resume
interfaces for dev_pm_ops.
Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
---
drivers/net/wireless/mwifiex/pcie.c | 34 ++++++++++++++++++++++++++++------
1 file changed, 28 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
index 20c9c4c..b169318 100644
--- a/drivers/net/wireless/mwifiex/pcie.c
+++ b/drivers/net/wireless/mwifiex/pcie.c
@@ -85,7 +85,7 @@ static bool mwifiex_pcie_ok_to_access_hw(struct mwifiex_adapter *adapter)
* If already not suspended, this function allocates and sends a host
* sleep activate request to the firmware and turns off the traffic.
*/
-static int mwifiex_pcie_suspend(struct pci_dev *pdev, pm_message_t state)
+static int __mwifiex_pcie_suspend(struct pci_dev *pdev)
{
struct mwifiex_adapter *adapter;
struct pcie_service_card *card;
@@ -112,6 +112,13 @@ static int mwifiex_pcie_suspend(struct pci_dev *pdev, pm_message_t state)
return 0;
}
+static int mwifiex_pcie_suspend(struct device *dev)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+
+ return __mwifiex_pcie_suspend(pdev);
+}
+
/*
* Kernel needs to suspend all functions separately. Therefore all
* registered functions must have drivers with suspend and resume
@@ -120,7 +127,7 @@ static int mwifiex_pcie_suspend(struct pci_dev *pdev, pm_message_t state)
* If already not resumed, this function turns on the traffic and
* sends a host sleep cancel request to the firmware.
*/
-static int mwifiex_pcie_resume(struct pci_dev *pdev)
+static int __mwifiex_pcie_resume(struct pci_dev *pdev)
{
struct mwifiex_adapter *adapter;
struct pcie_service_card *card;
@@ -150,6 +157,13 @@ static int mwifiex_pcie_resume(struct pci_dev *pdev)
return 0;
}
+
+static int mwifiex_pcie_resume(struct device *dev)
+{
+ struct pci_dev *pdev = to_pci_dev(dev);
+
+ return __mwifiex_pcie_resume(pdev);
+}
#endif
/*
@@ -213,7 +227,7 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev)
if (user_rmmod) {
#ifdef CONFIG_PM
if (adapter->is_suspended)
- mwifiex_pcie_resume(pdev);
+ __mwifiex_pcie_resume(pdev);
#endif
for (i = 0; i < adapter->priv_num; i++)
@@ -249,6 +263,14 @@ static DEFINE_PCI_DEVICE_TABLE(mwifiex_ids) = {
MODULE_DEVICE_TABLE(pci, mwifiex_ids);
+#ifdef CONFIG_PM
+/* Power Management Hooks */
+static const struct dev_pm_ops mwifiex_pcie_pm_ops = {
+ .suspend = mwifiex_pcie_suspend,
+ .resume = mwifiex_pcie_resume,
+};
+#endif
+
/* PCI Device Driver */
static struct pci_driver __refdata mwifiex_pcie = {
.name = "mwifiex_pcie",
@@ -256,9 +278,9 @@ static struct pci_driver __refdata mwifiex_pcie = {
.probe = mwifiex_pcie_probe,
.remove = mwifiex_pcie_remove,
#ifdef CONFIG_PM
- /* Power Management Hooks */
- .suspend = mwifiex_pcie_suspend,
- .resume = mwifiex_pcie_resume,
+ .driver = {
+ .pm = &mwifiex_pcie_pm_ops,
+ },
#endif
};
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH v2 4/9] wl12xx: use frequency instead of enumerations for pdata clocks
From: Nishanth Menon @ 2013-07-02 15:02 UTC (permalink / raw)
To: Luciano Coelho
Cc: linux-wireless, tony, nsekhar, mturquette, mark.rutland, balbi,
grant.likely, rob.herring, devicetree-discuss, linux-doc,
linux-kernel, linux-omap, linux-arm-kernel
In-Reply-To: <1372776948-24840-5-git-send-email-coelho@ti.com>
On 17:55-20130702, Luciano Coelho wrote:
> 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.
>
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: Sekhar Nori <nsekhar@ti.com>
> Signed-off-by: Luciano Coelho <coelho@ti.com>
> ---
> arch/arm/mach-davinci/board-da850-evm.c | 3 +-
> arch/arm/mach-omap2/board-4430sdp.c | 5 ++-
^^
> arch/arm/mach-omap2/board-omap3evm.c | 3 +-
> arch/arm/mach-omap2/board-omap4panda.c | 3 +-
^^
Please do not add more platform data to platforms that are DT only.
> arch/arm/mach-omap2/board-zoom-peripherals.c | 3 +-
> drivers/net/wireless/ti/wl12xx/main.c | 58 +++++++++++++++++++++++++-
> drivers/net/wireless/ti/wl12xx/wl12xx.h | 28 +++++++++++++
> include/linux/wl12xx.h | 28 ++-----------
> 8 files changed, 99 insertions(+), 32 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index d2a2a98..202f3d0 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -1378,7 +1378,8 @@ static const short da850_wl12xx_pins[] __initconst = {
> static struct wl12xx_platform_data da850_wl12xx_wlan_data __initdata = {
> .irq = -1,
> .irq_flags = IRQF_TRIGGER_RISING,
> - .board_ref_clock = WL12XX_REFCLOCK_38,
> + .ref_clock_freq = 38400000,
> + .ref_clock_xtal = false,
> };
>
> static __init int da850_wl12xx_init(void)
> diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
> index c2334aa..da2b892 100644
> --- a/arch/arm/mach-omap2/board-4430sdp.c
> +++ b/arch/arm/mach-omap2/board-4430sdp.c
> @@ -694,8 +694,9 @@ static void __init omap4_sdp4430_wifi_mux_init(void)
>
> static struct wl12xx_platform_data omap4_sdp4430_wlan_data __initdata = {
> .irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
> - .board_ref_clock = WL12XX_REFCLOCK_26,
> - .board_tcxo_clock = WL12XX_TCXOCLOCK_26,
> + .ref_clock_freq = 26000000,
> + .ref_clock_xtal = false,
> + .tcxo_clock_freq = 26000000,
> };
>
> static void __init omap4_sdp4430_wifi_init(void)
> diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
> index a0c0adf..d24435c 100644
> --- a/arch/arm/mach-omap2/board-omap3evm.c
> +++ b/arch/arm/mach-omap2/board-omap3evm.c
> @@ -459,7 +459,8 @@ static struct platform_device omap3evm_wlan_regulator = {
>
> struct wl12xx_platform_data omap3evm_wlan_data __initdata = {
> .irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
> - .board_ref_clock = WL12XX_REFCLOCK_38, /* 38.4 MHz */
> + .ref_clock_freq = 38400000,
> + .ref_clock_xtal = false,
> };
> #endif
>
> diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
> index ba00862..ac6413c 100644
> --- a/arch/arm/mach-omap2/board-omap4panda.c
> +++ b/arch/arm/mach-omap2/board-omap4panda.c
> @@ -231,7 +231,8 @@ static struct platform_device omap_vwlan_device = {
>
> static struct wl12xx_platform_data omap_panda_wlan_data __initdata = {
> .irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
> - .board_ref_clock = WL12XX_REFCLOCK_38, /* 38.4 MHz */
> + .ref_clock_freq = 38400000,
> + .ref_clock_xtal = false,
> };
>
> static struct twl6040_codec_data twl6040_codec = {
> diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
> index ced012c..f4f4fe7 100644
> --- a/arch/arm/mach-omap2/board-zoom-peripherals.c
> +++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
> @@ -245,7 +245,8 @@ static struct platform_device *zoom_devices[] __initdata = {
>
> static struct wl12xx_platform_data omap_zoom_wlan_data __initdata = {
> .irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
> - .board_ref_clock = WL12XX_REFCLOCK_26, /* 26 MHz */
> + .ref_clock_freq = 26000000,
> + .ref_clock_xtal = false,
> };
>
> static struct omap2_hsmmc_info mmc[] = {
> diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c
> index 1c627da..903dcb3 100644
> --- a/drivers/net/wireless/ti/wl12xx/main.c
> +++ b/drivers/net/wireless/ti/wl12xx/main.c
> @@ -1701,6 +1701,42 @@ static struct ieee80211_sta_ht_cap wl12xx_ht_cap = {
> },
> };
>
> +static 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 struct wl12xx_clock wl12xx_tcxoclock_table[] = {
> + { 16368000, false, WL12XX_TCXOCLOCK_16_368 },
> + { 16800000, false, WL12XX_TCXOCLOCK_16_8 },
> + { 19200000, false, WL12XX_TCXOCLOCK_19_2 },
> + { 26000000, false, WL12XX_TCXOCLOCK_26 },
> + { 32736000, false, WL12XX_TCXOCLOCK_32_736 },
> + { 33600000, false, WL12XX_TCXOCLOCK_33_6 },
> + { 38400000, false, WL12XX_TCXOCLOCK_38_4 },
> + { 52000000, false, WL12XX_TCXOCLOCK_52 },
> + { 0, false, 0 }
> +};
> +
> +static int wl12xx_get_clock_idx(struct wl12xx_clock *table, u32 freq, bool xtal)
> +{
> + int i = 0;
> +
> + while(table[i].freq != 0) {
> + if ((table[i].freq == freq) &&
> + (table[i].xtal == xtal))
> + return table[i].hw_idx;
> + i++;
> + };
> +
> + return -EINVAL;
> +}
> +
> static int wl12xx_setup(struct wl1271 *wl)
> {
> struct wl12xx_priv *priv = wl->priv;
> @@ -1722,7 +1758,16 @@ 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;
> @@ -1741,7 +1786,16 @@ static int wl12xx_setup(struct wl1271 *wl)
> }
>
> if (!tcxo_param) {
> - priv->tcxo_clock = pdata->board_tcxo_clock;
> + priv->tcxo_clock = wl12xx_get_clock_idx(wl12xx_tcxoclock_table,
> + pdata->tcxo_clock_freq,
> + pdata->tcxo_clock_xtal);
> + if (priv->tcxo_clock < 0) {
> + wl1271_error("Invalid tcxo_clock frequency (%d Hz, %s)",
> + pdata->tcxo_clock_freq,
> + pdata->tcxo_clock_xtal ? "XTAL" : "not XTAL");
> +
> + return priv->tcxo_clock;
> + }
> } else {
> if (!strcmp(tcxo_param, "19.2"))
> priv->tcxo_clock = WL12XX_TCXOCLOCK_19_2;
> diff --git a/drivers/net/wireless/ti/wl12xx/wl12xx.h b/drivers/net/wireless/ti/wl12xx/wl12xx.h
> index 9e5484a..05f631b 100644
> --- a/drivers/net/wireless/ti/wl12xx/wl12xx.h
> +++ b/drivers/net/wireless/ti/wl12xx/wl12xx.h
> @@ -79,4 +79,32 @@ 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;
> +};
> +
> #endif /* __WL12XX_PRIV_H__ */
> diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
> index 1e4ed6e..4982b94 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 {
> void (*set_power)(bool enable);
> /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
> @@ -58,8 +36,10 @@ struct wl1251_platform_data {
> struct wl12xx_platform_data {
> int irq;
> unsigned long irq_flags;
> - int board_ref_clock;
> - int board_tcxo_clock;
> + int ref_clock_freq; /* in Hertz */
> + bool ref_clock_xtal; /* specify whether the clock is XTAL or not */
> + int tcxo_clock_freq; /* in Hertz */
> + bool tcxo_clock_xtal; /* specify whether the clock is XTAL or not */
> };
>
> #ifdef CONFIG_WILINK_PLATFORM_DATA
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Regards,
Nishanth Menon
^ permalink raw reply
* [PATCH v2 9/9] wlcore/wl12xx: check if we got correct clock data from DT
From: Luciano Coelho @ 2013-07-02 14:55 UTC (permalink / raw)
To: linux-wireless, tony, nsekhar
Cc: mturquette, mark.rutland, balbi, grant.likely, rob.herring,
devicetree-discuss, linux-doc, linux-kernel, linux-omap,
linux-arm-kernel, coelho
In-Reply-To: <1372776948-24840-1-git-send-email-coelho@ti.com>
The fref and the tcxo clocks settings are optional in some platforms.
WiLink8 doesn't need either, so we don't check the values. WiLink 6
only needs the fref clock, so we check that it is valid or return with
an error. WiLink7 needs both clocks, if either is not available we
return with an error.
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
drivers/net/wireless/ti/wl12xx/main.c | 20 +++++++++++++++++---
drivers/net/wireless/ti/wlcore/sdio.c | 4 ----
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c
index 903dcb3..72d13e4 100644
--- a/drivers/net/wireless/ti/wl12xx/main.c
+++ b/drivers/net/wireless/ti/wl12xx/main.c
@@ -927,6 +927,11 @@ static int wl128x_boot_clk(struct wl1271 *wl, int *selected_clock)
u16 sys_clk_cfg;
int ret;
+ if ((priv->ref_clock < 0) || (priv->tcxo_clock < 0)) {
+ wl1271_error("Missing fref and/or tcxo clock settings\n");
+ return -EINVAL;
+ }
+
/* For XTAL-only modes, FREF will be used after switching from TCXO */
if (priv->ref_clock == WL12XX_REFCLOCK_26_XTAL ||
priv->ref_clock == WL12XX_REFCLOCK_38_XTAL) {
@@ -976,6 +981,11 @@ static int wl127x_boot_clk(struct wl1271 *wl)
u32 clk;
int ret;
+ if (priv->ref_clock < 0) {
+ wl1271_error("Missing fref clock settings\n");
+ return -EINVAL;
+ }
+
if (WL127X_PG_GET_MAJOR(wl->hw_pg_ver) < 3)
wl->quirks |= WLCORE_QUIRK_END_OF_TRANSACTION;
@@ -1757,7 +1767,7 @@ static int wl12xx_setup(struct wl1271 *wl)
wlcore_set_ht_cap(wl, IEEE80211_BAND_5GHZ, &wl12xx_ht_cap);
wl12xx_conf_init(wl);
- if (!fref_param) {
+ if (!fref_param && (pdata->ref_clock_freq > 0)) {
priv->ref_clock = wl12xx_get_clock_idx(wl12xx_refclock_table,
pdata->ref_clock_freq,
pdata->ref_clock_xtal);
@@ -1768,6 +1778,8 @@ static int wl12xx_setup(struct wl1271 *wl)
return priv->ref_clock;
}
+ } else if (!fref_param) {
+ priv->ref_clock = -EINVAL;
} else {
if (!strcmp(fref_param, "19.2"))
priv->ref_clock = WL12XX_REFCLOCK_19;
@@ -1785,7 +1797,7 @@ static int wl12xx_setup(struct wl1271 *wl)
wl1271_error("Invalid fref parameter %s", fref_param);
}
- if (!tcxo_param) {
+ if (!fref_param && (pdata->tcxo_clock_freq > 0)) {
priv->tcxo_clock = wl12xx_get_clock_idx(wl12xx_tcxoclock_table,
pdata->tcxo_clock_freq,
pdata->tcxo_clock_xtal);
@@ -1796,7 +1808,9 @@ static int wl12xx_setup(struct wl1271 *wl)
return priv->tcxo_clock;
}
- } else {
+ } else if (!fref_param) {
+ priv->tcxo_clock = -EINVAL;
+ }else {
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/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c
index 60fce49..c76eb66 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -252,20 +252,16 @@ static struct wl12xx_platform_data *wlcore_get_pdata_from_of(struct device *dev)
for_each_matching_node(clock_node, wlcore_sdio_of_clk_match_table)
of_fixed_clk_setup(clock_node);
- /* TODO: make sure we have this when needed (ie. for WL6 and WL7) */
glue->refclock = of_clk_get_by_name(np, "refclock");
if (IS_ERR(glue->refclock)) {
- dev_err(dev, "couldn't find refclock on the device tree\n");
glue->refclock = NULL;
} else {
clk_prepare_enable(glue->refclock);
pdata->ref_clock_freq = clk_get_rate(glue->refclock);
}
- /* TODO: make sure we have this when needed (ie. for WL7) */
glue->tcxoclock = of_clk_get_by_name(np, "tcxoclock");
if (IS_ERR(glue->tcxoclock)) {
- dev_err(dev, "couldn't find tcxoclock on the device tree\n");
glue->tcxoclock = NULL;
} else {
clk_prepare_enable(glue->tcxoclock);
--
1.7.10.4
^ permalink raw reply related
* [PATCH v2 7/9] wlcore: sdio: add wilink clock providers
From: Luciano Coelho @ 2013-07-02 14:55 UTC (permalink / raw)
To: linux-wireless, tony, nsekhar
Cc: mturquette, mark.rutland, balbi, grant.likely, rob.herring,
devicetree-discuss, linux-doc, linux-kernel, linux-omap,
linux-arm-kernel, coelho
In-Reply-To: <1372776948-24840-1-git-send-email-coelho@ti.com>
Add refclock and tcxoclock as clock providers in WiLink. These clocks
are not accesible outside the WiLink module, but they are registered
in the clock framework anyway. Only the WiLink chip consumes these
clocks.
In theory, the WiLink chip could be connected to external clocks
instead of using these internal clocks, so make the clock consumer
code generic enough. If external clocks are used, then the internal
clock device tree nodes are not necessary, but the external ones must
be specified.
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
drivers/net/wireless/ti/wlcore/sdio.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c
index 9370d7e..980bf3d 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -34,6 +34,7 @@
#include <linux/wl12xx.h>
#include <linux/pm_runtime.h>
#include <linux/printk.h>
+#include <linux/clk-provider.h>
#include "wlcore.h"
#include "wl12xx_80211.h"
@@ -214,10 +215,15 @@ static struct wl1271_if_operations sdio_ops = {
.set_block_size = wl1271_sdio_set_block_size,
};
+static const struct of_device_id wlcore_sdio_of_clk_match_table[] = {
+ { .compatible = "ti,wilink-clock" },
+};
+
static struct wl12xx_platform_data *wlcore_get_pdata_from_of(struct device *dev)
{
struct wl12xx_platform_data *pdata;
struct device_node *np = dev->of_node;
+ struct device_node *clock_node;
if (!np) {
np = of_find_matching_node(NULL, dev->driver->of_match_table);
@@ -241,6 +247,9 @@ static struct wl12xx_platform_data *wlcore_get_pdata_from_of(struct device *dev)
goto out_free;
}
+ for_each_matching_node(clock_node, wlcore_sdio_of_clk_match_table)
+ of_fixed_clk_setup(clock_node);
+
goto out;
out_free:
--
1.7.10.4
^ permalink raw reply related
* [PATCH v2 8/9] wlcore: sdio: get clocks from device tree
From: Luciano Coelho @ 2013-07-02 14:55 UTC (permalink / raw)
To: linux-wireless, tony, nsekhar
Cc: mturquette, mark.rutland, balbi, grant.likely, rob.herring,
devicetree-discuss, linux-doc, linux-kernel, linux-omap,
linux-arm-kernel, coelho
In-Reply-To: <1372776948-24840-1-git-send-email-coelho@ti.com>
Read the clock nodes from the device tree and use them to set the
frequency for the refclock and the tcxo clock.
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
drivers/net/wireless/ti/wlcore/sdio.c | 36 +++++++++++++++++++++++++++++++--
1 file changed, 34 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c
index 980bf3d..60fce49 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -53,6 +53,7 @@ static bool dump = false;
struct wl12xx_sdio_glue {
struct device *dev;
struct platform_device *core;
+ struct clk *refclock, *tcxoclock;
};
static const struct sdio_device_id wl1271_devices[] = {
@@ -224,6 +225,7 @@ static struct wl12xx_platform_data *wlcore_get_pdata_from_of(struct device *dev)
struct wl12xx_platform_data *pdata;
struct device_node *np = dev->of_node;
struct device_node *clock_node;
+ struct wl12xx_sdio_glue *glue = sdio_get_drvdata(dev_to_sdio_func(dev));
if (!np) {
np = of_find_matching_node(NULL, dev->driver->of_match_table);
@@ -250,6 +252,26 @@ static struct wl12xx_platform_data *wlcore_get_pdata_from_of(struct device *dev)
for_each_matching_node(clock_node, wlcore_sdio_of_clk_match_table)
of_fixed_clk_setup(clock_node);
+ /* TODO: make sure we have this when needed (ie. for WL6 and WL7) */
+ glue->refclock = of_clk_get_by_name(np, "refclock");
+ if (IS_ERR(glue->refclock)) {
+ dev_err(dev, "couldn't find refclock on the device tree\n");
+ glue->refclock = NULL;
+ } else {
+ clk_prepare_enable(glue->refclock);
+ pdata->ref_clock_freq = clk_get_rate(glue->refclock);
+ }
+
+ /* TODO: make sure we have this when needed (ie. for WL7) */
+ glue->tcxoclock = of_clk_get_by_name(np, "tcxoclock");
+ if (IS_ERR(glue->tcxoclock)) {
+ dev_err(dev, "couldn't find tcxoclock on the device tree\n");
+ glue->tcxoclock = NULL;
+ } else {
+ clk_prepare_enable(glue->tcxoclock);
+ pdata->ref_clock_freq = clk_get_rate(glue->tcxoclock);
+ }
+
goto out;
out_free:
@@ -294,6 +316,8 @@ 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;
+ sdio_set_drvdata(func, glue);
+
/* The pdata allocated here is freed when the device is freed,
* so we don't need an additional out label to free it in case
* of error further on.
@@ -319,8 +343,6 @@ static int wl1271_probe(struct sdio_func *func,
if (mmcflags & MMC_PM_KEEP_POWER)
pdev_data->pwr_in_suspend = true;
- sdio_set_drvdata(func, glue);
-
/* Tell PM core that we don't need the card to be powered now */
pm_runtime_put_noidle(&func->dev);
@@ -387,6 +409,16 @@ static void wl1271_remove(struct sdio_func *func)
{
struct wl12xx_sdio_glue *glue = sdio_get_drvdata(func);
+ if (glue->refclock) {
+ clk_disable_unprepare(glue->refclock);
+ clk_put(glue->refclock);
+ }
+
+ if (glue->tcxoclock) {
+ clk_disable_unprepare(glue->tcxoclock);
+ clk_put(glue->tcxoclock);
+ }
+
/* Undo decrement done above in wl1271_probe */
pm_runtime_get_noresume(&func->dev);
--
1.7.10.4
^ permalink raw reply related
* [PATCH v2 5/9] wlcore: always use one-shot IRQ
From: Luciano Coelho @ 2013-07-02 14:55 UTC (permalink / raw)
To: linux-wireless, tony, nsekhar
Cc: mturquette, mark.rutland, balbi, grant.likely, rob.herring,
devicetree-discuss, linux-doc, linux-kernel, linux-omap,
linux-arm-kernel, coelho
In-Reply-To: <1372776948-24840-1-git-send-email-coelho@ti.com>
Since we are now using threaded IRQs without the primary handler, we
need to set IRQF_ONESHOT, otherwise our request will fail.
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
drivers/net/wireless/ti/wlcore/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index d306cd5..bc1cff3 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -5927,7 +5927,8 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
wl->irq = platform_get_irq(pdev, 0);
wl->if_ops = pdev_data->if_ops;
- wl->irq_flags = pdata->irq_flags;
+ /* Since we don't use the primary handler, we must set ONESHOT */
+ wl->irq_flags = pdata->irq_flags | IRQF_ONESHOT;
ret = request_threaded_irq(wl->irq, NULL, wlcore_irq,
wl->irq_flags, pdev->name, wl);
--
1.7.10.4
^ permalink raw reply related
* [PATCH v2 6/9] wlcore: add initial device tree support to the sdio module
From: Luciano Coelho @ 2013-07-02 14:55 UTC (permalink / raw)
To: linux-wireless, tony, nsekhar
Cc: mturquette, mark.rutland, balbi, grant.likely, rob.herring,
devicetree-discuss, linux-doc, linux-kernel, linux-omap,
linux-arm-kernel, coelho
In-Reply-To: <1372776948-24840-1-git-send-email-coelho@ti.com>
If platform data is not available, try to get the required information
from the device tree. Register an OF match table and parse the
appropriate device tree nodes.
Parse interrupt property only, for now.
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
drivers/net/wireless/ti/wlcore/sdio.c | 69 ++++++++++++++++++++++++++++++---
1 file changed, 63 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c
index 4c7e8ac..9370d7e 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -30,7 +30,7 @@
#include <linux/mmc/sdio_ids.h>
#include <linux/mmc/card.h>
#include <linux/mmc/host.h>
-#include <linux/gpio.h>
+#include <linux/of_irq.h>
#include <linux/wl12xx.h>
#include <linux/pm_runtime.h>
#include <linux/printk.h>
@@ -214,6 +214,43 @@ static struct wl1271_if_operations sdio_ops = {
.set_block_size = wl1271_sdio_set_block_size,
};
+static struct wl12xx_platform_data *wlcore_get_pdata_from_of(struct device *dev)
+{
+ struct wl12xx_platform_data *pdata;
+ struct device_node *np = dev->of_node;
+
+ if (!np) {
+ np = of_find_matching_node(NULL, dev->driver->of_match_table);
+ if (!np) {
+ dev_notice(dev, "device tree node not available\n");
+ pdata = ERR_PTR(-ENODEV);
+ goto out;
+ }
+ }
+
+ pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
+ if (!pdata) {
+ dev_err(dev, "can't allocate platform data\n");
+ pdata = ERR_PTR(-ENODEV);
+ goto out;
+ }
+
+ pdata->irq = irq_of_parse_and_map(np, 0);
+ if (pdata->irq < 0) {
+ dev_err(dev, "can't get interrupt gpio from the device tree\n");
+ goto out_free;
+ }
+
+ goto out;
+
+out_free:
+ kfree(pdata);
+ pdata = ERR_PTR(-ENODEV);
+
+out:
+ return pdata;
+}
+
static int wl1271_probe(struct sdio_func *func,
const struct sdio_device_id *id)
{
@@ -248,11 +285,22 @@ static int wl1271_probe(struct sdio_func *func,
/* Use block mode for transferring over one block size of data */
func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;
+ /* The pdata allocated here is freed when the device is freed,
+ * so we don't need an additional out label to free it in case
+ * of error further on.
+ */
+
+ /* Try to get legacy platform data from the board file */
pdev_data->pdata = wl12xx_get_platform_data();
if (IS_ERR(pdev_data->pdata)) {
- ret = PTR_ERR(pdev_data->pdata);
- dev_err(glue->dev, "missing wlan platform data: %d\n", ret);
- goto out_free_glue;
+ dev_info(&func->dev,
+ "legacy platform data not found, trying device tree\n");
+
+ pdev_data->pdata = wlcore_get_pdata_from_of(&func->dev);
+ if (IS_ERR(pdev_data->pdata)) {
+ dev_err(&func->dev, "can't get platform data\n");
+ goto out_free_glue;
+ }
}
/* if sdio can keep power while host is suspended, enable wow */
@@ -386,16 +434,25 @@ static const struct dev_pm_ops wl1271_sdio_pm_ops = {
};
#endif
+static const struct of_device_id wlcore_sdio_of_match_table[] = {
+ { .compatible = "ti,wilink6" },
+ { .compatible = "ti,wilink7" },
+ { .compatible = "ti,wilink8" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, wlcore_sdio_of_match_table);
+
static struct sdio_driver wl1271_sdio_driver = {
.name = "wl1271_sdio",
.id_table = wl1271_devices,
.probe = wl1271_probe,
.remove = wl1271_remove,
-#ifdef CONFIG_PM
.drv = {
+#ifdef CONFIG_PM
.pm = &wl1271_sdio_pm_ops,
- },
#endif
+ .of_match_table = of_match_ptr(wlcore_sdio_of_match_table),
+ },
};
static int __init wl1271_init(void)
--
1.7.10.4
^ permalink raw reply related
* [PATCH v2 4/9] wl12xx: use frequency instead of enumerations for pdata clocks
From: Luciano Coelho @ 2013-07-02 14:55 UTC (permalink / raw)
To: linux-wireless, tony, nsekhar
Cc: mturquette, mark.rutland, balbi, grant.likely, rob.herring,
devicetree-discuss, linux-doc, linux-kernel, linux-omap,
linux-arm-kernel, coelho
In-Reply-To: <1372776948-24840-1-git-send-email-coelho@ti.com>
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.
Cc: Tony Lindgren <tony@atomide.com>
Cc: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
arch/arm/mach-davinci/board-da850-evm.c | 3 +-
arch/arm/mach-omap2/board-4430sdp.c | 5 ++-
arch/arm/mach-omap2/board-omap3evm.c | 3 +-
arch/arm/mach-omap2/board-omap4panda.c | 3 +-
arch/arm/mach-omap2/board-zoom-peripherals.c | 3 +-
drivers/net/wireless/ti/wl12xx/main.c | 58 +++++++++++++++++++++++++-
drivers/net/wireless/ti/wl12xx/wl12xx.h | 28 +++++++++++++
include/linux/wl12xx.h | 28 ++-----------
8 files changed, 99 insertions(+), 32 deletions(-)
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index d2a2a98..202f3d0 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -1378,7 +1378,8 @@ static const short da850_wl12xx_pins[] __initconst = {
static struct wl12xx_platform_data da850_wl12xx_wlan_data __initdata = {
.irq = -1,
.irq_flags = IRQF_TRIGGER_RISING,
- .board_ref_clock = WL12XX_REFCLOCK_38,
+ .ref_clock_freq = 38400000,
+ .ref_clock_xtal = false,
};
static __init int da850_wl12xx_init(void)
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index c2334aa..da2b892 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -694,8 +694,9 @@ static void __init omap4_sdp4430_wifi_mux_init(void)
static struct wl12xx_platform_data omap4_sdp4430_wlan_data __initdata = {
.irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
- .board_ref_clock = WL12XX_REFCLOCK_26,
- .board_tcxo_clock = WL12XX_TCXOCLOCK_26,
+ .ref_clock_freq = 26000000,
+ .ref_clock_xtal = false,
+ .tcxo_clock_freq = 26000000,
};
static void __init omap4_sdp4430_wifi_init(void)
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index a0c0adf..d24435c 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -459,7 +459,8 @@ static struct platform_device omap3evm_wlan_regulator = {
struct wl12xx_platform_data omap3evm_wlan_data __initdata = {
.irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
- .board_ref_clock = WL12XX_REFCLOCK_38, /* 38.4 MHz */
+ .ref_clock_freq = 38400000,
+ .ref_clock_xtal = false,
};
#endif
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index ba00862..ac6413c 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -231,7 +231,8 @@ static struct platform_device omap_vwlan_device = {
static struct wl12xx_platform_data omap_panda_wlan_data __initdata = {
.irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
- .board_ref_clock = WL12XX_REFCLOCK_38, /* 38.4 MHz */
+ .ref_clock_freq = 38400000,
+ .ref_clock_xtal = false,
};
static struct twl6040_codec_data twl6040_codec = {
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
index ced012c..f4f4fe7 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -245,7 +245,8 @@ static struct platform_device *zoom_devices[] __initdata = {
static struct wl12xx_platform_data omap_zoom_wlan_data __initdata = {
.irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
- .board_ref_clock = WL12XX_REFCLOCK_26, /* 26 MHz */
+ .ref_clock_freq = 26000000,
+ .ref_clock_xtal = false,
};
static struct omap2_hsmmc_info mmc[] = {
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c
index 1c627da..903dcb3 100644
--- a/drivers/net/wireless/ti/wl12xx/main.c
+++ b/drivers/net/wireless/ti/wl12xx/main.c
@@ -1701,6 +1701,42 @@ static struct ieee80211_sta_ht_cap wl12xx_ht_cap = {
},
};
+static 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 struct wl12xx_clock wl12xx_tcxoclock_table[] = {
+ { 16368000, false, WL12XX_TCXOCLOCK_16_368 },
+ { 16800000, false, WL12XX_TCXOCLOCK_16_8 },
+ { 19200000, false, WL12XX_TCXOCLOCK_19_2 },
+ { 26000000, false, WL12XX_TCXOCLOCK_26 },
+ { 32736000, false, WL12XX_TCXOCLOCK_32_736 },
+ { 33600000, false, WL12XX_TCXOCLOCK_33_6 },
+ { 38400000, false, WL12XX_TCXOCLOCK_38_4 },
+ { 52000000, false, WL12XX_TCXOCLOCK_52 },
+ { 0, false, 0 }
+};
+
+static int wl12xx_get_clock_idx(struct wl12xx_clock *table, u32 freq, bool xtal)
+{
+ int i = 0;
+
+ while(table[i].freq != 0) {
+ if ((table[i].freq == freq) &&
+ (table[i].xtal == xtal))
+ return table[i].hw_idx;
+ i++;
+ };
+
+ return -EINVAL;
+}
+
static int wl12xx_setup(struct wl1271 *wl)
{
struct wl12xx_priv *priv = wl->priv;
@@ -1722,7 +1758,16 @@ 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;
@@ -1741,7 +1786,16 @@ static int wl12xx_setup(struct wl1271 *wl)
}
if (!tcxo_param) {
- priv->tcxo_clock = pdata->board_tcxo_clock;
+ priv->tcxo_clock = wl12xx_get_clock_idx(wl12xx_tcxoclock_table,
+ pdata->tcxo_clock_freq,
+ pdata->tcxo_clock_xtal);
+ if (priv->tcxo_clock < 0) {
+ wl1271_error("Invalid tcxo_clock frequency (%d Hz, %s)",
+ pdata->tcxo_clock_freq,
+ pdata->tcxo_clock_xtal ? "XTAL" : "not XTAL");
+
+ return priv->tcxo_clock;
+ }
} else {
if (!strcmp(tcxo_param, "19.2"))
priv->tcxo_clock = WL12XX_TCXOCLOCK_19_2;
diff --git a/drivers/net/wireless/ti/wl12xx/wl12xx.h b/drivers/net/wireless/ti/wl12xx/wl12xx.h
index 9e5484a..05f631b 100644
--- a/drivers/net/wireless/ti/wl12xx/wl12xx.h
+++ b/drivers/net/wireless/ti/wl12xx/wl12xx.h
@@ -79,4 +79,32 @@ 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;
+};
+
#endif /* __WL12XX_PRIV_H__ */
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 1e4ed6e..4982b94 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 {
void (*set_power)(bool enable);
/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
@@ -58,8 +36,10 @@ struct wl1251_platform_data {
struct wl12xx_platform_data {
int irq;
unsigned long irq_flags;
- int board_ref_clock;
- int board_tcxo_clock;
+ int ref_clock_freq; /* in Hertz */
+ bool ref_clock_xtal; /* specify whether the clock is XTAL or not */
+ int tcxo_clock_freq; /* in Hertz */
+ bool tcxo_clock_xtal; /* specify whether the clock is XTAL or not */
};
#ifdef CONFIG_WILINK_PLATFORM_DATA
--
1.7.10.4
^ permalink raw reply related
* [PATCH v2 2/9] wlcore: use irq_flags in pdata instead of hiding it behind a quirk
From: Luciano Coelho @ 2013-07-02 14:55 UTC (permalink / raw)
To: linux-wireless, tony, nsekhar
Cc: mturquette, mark.rutland, balbi, grant.likely, rob.herring,
devicetree-discuss, linux-doc, linux-kernel, linux-omap,
linux-arm-kernel, coelho
In-Reply-To: <1372776948-24840-1-git-send-email-coelho@ti.com>
The platform_quirk element in the platform data was used to change the
way the IRQ is triggered. When set, the EDGE_IRQ quirk would change
the irqflags used and treat edge trigger differently from the rest.
Instead of hiding this irq flag setting behind the quirk, export the
whole irq_flags element and let the board file define what to use.
This will be more meaningful than driver-specific quirks when we
switch to DT.
Cc: Tony Lindgren <tony@atomide.com>
Cc: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
---
arch/arm/mach-davinci/board-da850-evm.c | 2 +-
arch/arm/mach-omap2/board-4430sdp.c | 1 +
arch/arm/mach-omap2/board-omap3evm.c | 1 +
arch/arm/mach-omap2/board-omap4panda.c | 1 +
arch/arm/mach-omap2/board-zoom-peripherals.c | 1 +
drivers/net/wireless/ti/wlcore/debugfs.c | 2 +-
drivers/net/wireless/ti/wlcore/main.c | 13 +++----------
drivers/net/wireless/ti/wlcore/wlcore.h | 5 ++---
include/linux/wl12xx.h | 5 +----
9 files changed, 12 insertions(+), 19 deletions(-)
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 8a24b6c..d2a2a98 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -1377,8 +1377,8 @@ static const short da850_wl12xx_pins[] __initconst = {
static struct wl12xx_platform_data da850_wl12xx_wlan_data __initdata = {
.irq = -1,
+ .irq_flags = IRQF_TRIGGER_RISING,
.board_ref_clock = WL12XX_REFCLOCK_38,
- .platform_quirks = WL12XX_PLATFORM_QUIRK_EDGE_IRQ,
};
static __init int da850_wl12xx_init(void)
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 56a9a4f..c2334aa 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -693,6 +693,7 @@ static void __init omap4_sdp4430_wifi_mux_init(void)
}
static struct wl12xx_platform_data omap4_sdp4430_wlan_data __initdata = {
+ .irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
.board_ref_clock = WL12XX_REFCLOCK_26,
.board_tcxo_clock = WL12XX_TCXOCLOCK_26,
};
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index f76d0de..a0c0adf 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -458,6 +458,7 @@ static struct platform_device omap3evm_wlan_regulator = {
};
struct wl12xx_platform_data omap3evm_wlan_data __initdata = {
+ .irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
.board_ref_clock = WL12XX_REFCLOCK_38, /* 38.4 MHz */
};
#endif
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 1e2c75e..ba00862 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -230,6 +230,7 @@ static struct platform_device omap_vwlan_device = {
};
static struct wl12xx_platform_data omap_panda_wlan_data __initdata = {
+ .irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
.board_ref_clock = WL12XX_REFCLOCK_38, /* 38.4 MHz */
};
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
index a90375d..ced012c 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -244,6 +244,7 @@ static struct platform_device *zoom_devices[] __initdata = {
};
static struct wl12xx_platform_data omap_zoom_wlan_data __initdata = {
+ .irq_flags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
.board_ref_clock = WL12XX_REFCLOCK_26, /* 26 MHz */
};
diff --git a/drivers/net/wireless/ti/wlcore/debugfs.c b/drivers/net/wireless/ti/wlcore/debugfs.c
index c3e1f79..5eff663 100644
--- a/drivers/net/wireless/ti/wlcore/debugfs.c
+++ b/drivers/net/wireless/ti/wlcore/debugfs.c
@@ -486,7 +486,7 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf,
DRIVER_STATE_PRINT_HEX(irq);
/* TODO: ref_clock and tcxo_clock were moved to wl12xx priv */
DRIVER_STATE_PRINT_HEX(hw_pg_ver);
- DRIVER_STATE_PRINT_HEX(platform_quirks);
+ DRIVER_STATE_PRINT_HEX(irq_flags);
DRIVER_STATE_PRINT_HEX(chip.id);
DRIVER_STATE_PRINT_STR(chip.fw_ver_str);
DRIVER_STATE_PRINT_STR(chip.phy_fw_ver_str);
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index b8db55c..e7294b8 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -516,7 +516,7 @@ static int wlcore_irq_locked(struct wl1271 *wl)
* In case edge triggered interrupt must be used, we cannot iterate
* more than once without introducing race conditions with the hardirq.
*/
- if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ)
+ if (wl->irq_flags & IRQF_TRIGGER_RISING)
loopcount = 1;
wl1271_debug(DEBUG_IRQ, "IRQ work");
@@ -5765,7 +5765,6 @@ struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size, u32 aggr_buf_size,
wl->ap_ps_map = 0;
wl->ap_fw_ps_map = 0;
wl->quirks = 0;
- wl->platform_quirks = 0;
wl->system_hlid = WL12XX_SYSTEM_HLID;
wl->active_sta_count = 0;
wl->active_link_count = 0;
@@ -5901,7 +5900,6 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
struct platform_device *pdev = wl->pdev;
struct wlcore_platdev_data *pdev_data = pdev->dev.platform_data;
struct wl12xx_platform_data *pdata = pdev_data->pdata;
- unsigned long irqflags;
int ret;
if (fw) {
@@ -5928,16 +5926,11 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
wlcore_adjust_conf(wl);
wl->irq = platform_get_irq(pdev, 0);
- wl->platform_quirks = pdata->platform_quirks;
wl->if_ops = pdev_data->if_ops;
-
- if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ)
- irqflags = IRQF_TRIGGER_RISING;
- else
- irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT;
+ wl->irq_flags = pdata->irq_flags;
ret = request_threaded_irq(wl->irq, NULL, wlcore_irq,
- irqflags, pdev->name, wl);
+ wl->irq_flags, pdev->name, wl);
if (ret < 0) {
wl1271_error("request_irq() failed: %d", ret);
goto out_free_nvs;
diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h
index 0034979..8306bde 100644
--- a/drivers/net/wireless/ti/wlcore/wlcore.h
+++ b/drivers/net/wireless/ti/wlcore/wlcore.h
@@ -185,6 +185,8 @@ struct wl1271 {
int irq;
+ int irq_flags;
+
spinlock_t wl_lock;
enum wlcore_state state;
@@ -384,9 +386,6 @@ struct wl1271 {
/* Quirks of specific hardware revisions */
unsigned int quirks;
- /* Platform limitations */
- unsigned int platform_quirks;
-
/* number of currently active RX BA sessions */
int ba_rx_session_count;
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index b516b4f..04e3096 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -57,15 +57,12 @@ struct wl1251_platform_data {
struct wl12xx_platform_data {
int irq;
+ unsigned long irq_flags;
int board_ref_clock;
int board_tcxo_clock;
- unsigned long platform_quirks;
bool pwr_in_suspend;
};
-/* Platform does not support level trigger interrupts */
-#define WL12XX_PLATFORM_QUIRK_EDGE_IRQ BIT(0)
-
#ifdef CONFIG_WILINK_PLATFORM_DATA
int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
--
1.7.10.4
^ permalink raw reply related
* [PATCH v2 1/9] wl1251: split wl251 platform data to a separate structure
From: Luciano Coelho @ 2013-07-02 14:55 UTC (permalink / raw)
To: linux-wireless, tony, nsekhar
Cc: mturquette, mark.rutland, balbi, grant.likely, rob.herring,
devicetree-discuss, linux-doc, linux-kernel, linux-omap,
linux-arm-kernel, coelho
In-Reply-To: <1372776948-24840-1-git-send-email-coelho@ti.com>
Move the wl1251 part of the wl12xx platform data structure into a new
structure specifically for wl1251. Change the platform data built-in
block and board files accordingly.
Cc: Tony Lindgren <tony@atomide.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
---
arch/arm/mach-omap2/board-omap3pandora.c | 4 +--
arch/arm/mach-omap2/board-rx51-peripherals.c | 2 +-
drivers/net/wireless/ti/wilink_platform_data.c | 37 ++++++++++++++++++++----
drivers/net/wireless/ti/wl1251/sdio.c | 12 ++++----
drivers/net/wireless/ti/wl1251/spi.c | 2 +-
include/linux/wl12xx.h | 22 +++++++++++++-
6 files changed, 62 insertions(+), 17 deletions(-)
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 28133d5..bf06d95 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -540,7 +540,7 @@ static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {
static void __init pandora_wl1251_init(void)
{
- struct wl12xx_platform_data pandora_wl1251_pdata;
+ struct wl1251_platform_data pandora_wl1251_pdata;
int ret;
memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata));
@@ -554,7 +554,7 @@ static void __init pandora_wl1251_init(void)
goto fail_irq;
pandora_wl1251_pdata.use_eeprom = true;
- ret = wl12xx_set_platform_data(&pandora_wl1251_pdata);
+ ret = wl1251_set_platform_data(&pandora_wl1251_pdata);
if (ret < 0)
goto fail_irq;
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 18ca61e..733f3f2 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -80,7 +80,7 @@ enum {
RX51_SPI_MIPID, /* LCD panel */
};
-static struct wl12xx_platform_data wl1251_pdata;
+static struct wl1251_platform_data wl1251_pdata;
static struct tsc2005_platform_data tsc2005_pdata;
#if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE)
diff --git a/drivers/net/wireless/ti/wilink_platform_data.c b/drivers/net/wireless/ti/wilink_platform_data.c
index 998e958..a92bd3e 100644
--- a/drivers/net/wireless/ti/wilink_platform_data.c
+++ b/drivers/net/wireless/ti/wilink_platform_data.c
@@ -23,17 +23,17 @@
#include <linux/err.h>
#include <linux/wl12xx.h>
-static struct wl12xx_platform_data *platform_data;
+static struct wl12xx_platform_data *wl12xx_platform_data;
int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
{
- if (platform_data)
+ if (wl12xx_platform_data)
return -EBUSY;
if (!data)
return -EINVAL;
- platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
- if (!platform_data)
+ wl12xx_platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
+ if (!wl12xx_platform_data)
return -ENOMEM;
return 0;
@@ -41,9 +41,34 @@ int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
struct wl12xx_platform_data *wl12xx_get_platform_data(void)
{
- if (!platform_data)
+ if (!wl12xx_platform_data)
return ERR_PTR(-ENODEV);
- return platform_data;
+ return wl12xx_platform_data;
}
EXPORT_SYMBOL(wl12xx_get_platform_data);
+
+static struct wl1251_platform_data *wl1251_platform_data;
+
+int __init wl1251_set_platform_data(const struct wl1251_platform_data *data)
+{
+ if (wl1251_platform_data)
+ return -EBUSY;
+ if (!data)
+ return -EINVAL;
+
+ wl1251_platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
+ if (!wl1251_platform_data)
+ return -ENOMEM;
+
+ return 0;
+}
+
+struct wl1251_platform_data *wl1251_get_platform_data(void)
+{
+ if (!wl1251_platform_data)
+ return ERR_PTR(-ENODEV);
+
+ return wl1251_platform_data;
+}
+EXPORT_SYMBOL(wl1251_get_platform_data);
diff --git a/drivers/net/wireless/ti/wl1251/sdio.c b/drivers/net/wireless/ti/wl1251/sdio.c
index e2b3d9c..b75a37a 100644
--- a/drivers/net/wireless/ti/wl1251/sdio.c
+++ b/drivers/net/wireless/ti/wl1251/sdio.c
@@ -227,7 +227,7 @@ static int wl1251_sdio_probe(struct sdio_func *func,
struct wl1251 *wl;
struct ieee80211_hw *hw;
struct wl1251_sdio *wl_sdio;
- const struct wl12xx_platform_data *wl12xx_board_data;
+ const struct wl1251_platform_data *wl1251_board_data;
hw = wl1251_alloc_hw();
if (IS_ERR(hw))
@@ -254,11 +254,11 @@ static int wl1251_sdio_probe(struct sdio_func *func,
wl->if_priv = wl_sdio;
wl->if_ops = &wl1251_sdio_ops;
- wl12xx_board_data = wl12xx_get_platform_data();
- if (!IS_ERR(wl12xx_board_data)) {
- wl->set_power = wl12xx_board_data->set_power;
- wl->irq = wl12xx_board_data->irq;
- wl->use_eeprom = wl12xx_board_data->use_eeprom;
+ wl1251_board_data = wl1251_get_platform_data();
+ if (!IS_ERR(wl1251_board_data)) {
+ wl->set_power = wl1251_board_data->set_power;
+ wl->irq = wl1251_board_data->irq;
+ wl->use_eeprom = wl1251_board_data->use_eeprom;
}
if (wl->irq) {
diff --git a/drivers/net/wireless/ti/wl1251/spi.c b/drivers/net/wireless/ti/wl1251/spi.c
index c7dc6fe..6bbbfe6 100644
--- a/drivers/net/wireless/ti/wl1251/spi.c
+++ b/drivers/net/wireless/ti/wl1251/spi.c
@@ -238,7 +238,7 @@ static const struct wl1251_if_operations wl1251_spi_ops = {
static int wl1251_spi_probe(struct spi_device *spi)
{
- struct wl12xx_platform_data *pdata;
+ struct wl1251_platform_data *pdata;
struct ieee80211_hw *hw;
struct wl1251 *wl;
int ret;
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index a54fe82..b516b4f 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -48,11 +48,15 @@ enum {
WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */
};
-struct wl12xx_platform_data {
+struct wl1251_platform_data {
void (*set_power)(bool enable);
/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
int irq;
bool use_eeprom;
+};
+
+struct wl12xx_platform_data {
+ int irq;
int board_ref_clock;
int board_tcxo_clock;
unsigned long platform_quirks;
@@ -68,6 +72,10 @@ int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
struct wl12xx_platform_data *wl12xx_get_platform_data(void);
+int wl1251_set_platform_data(const struct wl1251_platform_data *data);
+
+struct wl1251_platform_data *wl1251_get_platform_data(void);
+
#else
static inline
@@ -82,6 +90,18 @@ struct wl12xx_platform_data *wl12xx_get_platform_data(void)
return ERR_PTR(-ENODATA);
}
+static inline
+int wl1251_set_platform_data(const struct wl1251_platform_data *data)
+{
+ return -ENOSYS;
+}
+
+static inline
+struct wl1251_platform_data *wl1251_get_platform_data(void)
+{
+ return ERR_PTR(-ENODATA);
+}
+
#endif
#endif
--
1.7.10.4
^ permalink raw reply related
* [PATCH v2 3/9] wlcore: remove pwr_in_suspend from platform data
From: Luciano Coelho @ 2013-07-02 14:55 UTC (permalink / raw)
To: linux-wireless, tony, nsekhar
Cc: mturquette, mark.rutland, balbi, grant.likely, rob.herring,
devicetree-discuss, linux-doc, linux-kernel, linux-omap,
linux-arm-kernel, coelho
In-Reply-To: <1372776948-24840-1-git-send-email-coelho@ti.com>
The pwr_in_suspend flag depends on the MMC settings which can be
retrieved from the SDIO subsystem, so it doesn't need to be part of
the platform data structure. Move it to the platform device data that
is passed from SDIO to wlcore.
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
drivers/net/wireless/ti/wlcore/main.c | 2 +-
drivers/net/wireless/ti/wlcore/sdio.c | 2 +-
drivers/net/wireless/ti/wlcore/wlcore_i.h | 1 +
include/linux/wl12xx.h | 1 -
4 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index e7294b8..d306cd5 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -5941,7 +5941,7 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
if (!ret) {
wl->irq_wake_enabled = true;
device_init_wakeup(wl->dev, 1);
- if (pdata->pwr_in_suspend)
+ if (pdev_data->pwr_in_suspend)
wl->hw->wiphy->wowlan = &wlcore_wowlan_support;
}
#endif
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c
index 29ef249..4c7e8ac 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -260,7 +260,7 @@ static int wl1271_probe(struct sdio_func *func,
dev_dbg(glue->dev, "sdio PM caps = 0x%x\n", mmcflags);
if (mmcflags & MMC_PM_KEEP_POWER)
- pdev_data->pdata->pwr_in_suspend = true;
+ pdev_data->pwr_in_suspend = true;
sdio_set_drvdata(func, glue);
diff --git a/drivers/net/wireless/ti/wlcore/wlcore_i.h b/drivers/net/wireless/ti/wlcore/wlcore_i.h
index e5e1464..f2c4227 100644
--- a/drivers/net/wireless/ti/wlcore/wlcore_i.h
+++ b/drivers/net/wireless/ti/wlcore/wlcore_i.h
@@ -209,6 +209,7 @@ struct wl1271_if_operations {
struct wlcore_platdev_data {
struct wl12xx_platform_data *pdata;
struct wl1271_if_operations *if_ops;
+ bool pwr_in_suspend;
};
#define MAX_NUM_KEYS 14
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 04e3096..1e4ed6e 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -60,7 +60,6 @@ struct wl12xx_platform_data {
unsigned long irq_flags;
int board_ref_clock;
int board_tcxo_clock;
- bool pwr_in_suspend;
};
#ifdef CONFIG_WILINK_PLATFORM_DATA
--
1.7.10.4
^ permalink raw reply related
* [PATCH v2 0/9] wilink: add device tree support
From: Luciano Coelho @ 2013-07-02 14:55 UTC (permalink / raw)
To: linux-wireless, tony, nsekhar
Cc: mturquette, mark.rutland, balbi, grant.likely, rob.herring,
devicetree-discuss, linux-doc, linux-kernel, linux-omap,
linux-arm-kernel, coelho
Hi,
This is a follow-up on a previous patch set that had a smaller
audience. This time, I added the lists and people who were involved
in the review of the bindings documentation, since most of my changes
in v2 are coming from discussions there.
This patch series adds device tree support to the wlcore_sdio driver,
which is used by WiLink6, WiLink7 and WiLink8.
The first patches do some clean-up to make the data needed in the
wilink device tree node smaller. The remaining patches implement the
actual device tree node parsing in wlcore_sdio.
I still need to figure out how to add the information about whether
the clocks are XTAL or not. I'll send it in a separate patche set.
The DTS file changes will be sent separately, since they need to go
via different trees.
The bindings documentation patch will also be updated and sent
separately, once the XTAL issue is solved.
Tony has acked some of the patches that touch OMAP areas. I still
need one more ack to a new patch I added (wl12xx: use frequency
instead of enumerations for pdata clocks).
Sekhar, can you please check the patches that touch the davinci board
file and ack them?
Changes in v2:
* New clean-up patch (4/9);
* Patch 6/9 (previously patch 5/5) now doesn't add the clock parsing,
since it became more complicated and I added separate patches for
that;
* 3 new patches (from 7/9 till 9/9) to handle the clock reading in the
device tree;
Please review.
--
Cheers,
Luca.
Luciano Coelho (9):
wl1251: split wl251 platform data to a separate structure
wlcore: use irq_flags in pdata instead of hiding it behind a quirk
wlcore: remove pwr_in_suspend from platform data
wl12xx: use frequency instead of enumerations for pdata clocks
wlcore: always use one-shot IRQ
wlcore: add initial device tree support to the sdio module
wlcore: sdio: add wilink clock providers
wlcore: sdio: get clocks from device tree
wlcore/wl12xx: check if we got correct clock data from DT
arch/arm/mach-davinci/board-da850-evm.c | 5 +-
arch/arm/mach-omap2/board-4430sdp.c | 6 +-
arch/arm/mach-omap2/board-omap3evm.c | 4 +-
arch/arm/mach-omap2/board-omap3pandora.c | 4 +-
arch/arm/mach-omap2/board-omap4panda.c | 4 +-
arch/arm/mach-omap2/board-rx51-peripherals.c | 2 +-
arch/arm/mach-omap2/board-zoom-peripherals.c | 4 +-
drivers/net/wireless/ti/wilink_platform_data.c | 37 ++++++--
drivers/net/wireless/ti/wl1251/sdio.c | 12 +--
drivers/net/wireless/ti/wl1251/spi.c | 2 +-
drivers/net/wireless/ti/wl12xx/main.c | 78 +++++++++++++++--
drivers/net/wireless/ti/wl12xx/wl12xx.h | 28 ++++++
drivers/net/wireless/ti/wlcore/debugfs.c | 2 +-
drivers/net/wireless/ti/wlcore/main.c | 16 ++--
drivers/net/wireless/ti/wlcore/sdio.c | 112 ++++++++++++++++++++++--
drivers/net/wireless/ti/wlcore/wlcore.h | 5 +-
drivers/net/wireless/ti/wlcore/wlcore_i.h | 1 +
include/linux/wl12xx.h | 54 ++++++------
18 files changed, 295 insertions(+), 81 deletions(-)
--
1.7.10.4
^ permalink raw reply
* Re: [PATCH 2/3] [RFC] cfg80211: Add Kconfig option for cellular BS hints
From: Arend van Spriel @ 2013-07-02 14:13 UTC (permalink / raw)
To: Johannes Berg; +Cc: Ilan Peer, linux-wireless, mcgrof
In-Reply-To: <1372773647.8615.1.camel@jlt4.sipsolutions.net>
On 07/02/2013 04:00 PM, Johannes Berg wrote:
> On Tue, 2013-07-02 at 15:55 +0200, Arend van Spriel wrote:
>> On 07/02/2013 02:28 PM, Ilan Peer wrote:
>>> Move the regulatory cellular base station hints support under
>>> a specific configuration option and make the option depend
>>> on CFG80211_CERTIFICATION_ONUS.
>>
>> This one seems not really related to the other patches. On itself it is
>> not clear to me what itch is being scratched here. Is the aim to get rid
>> of the CERTIFICATION_ONUS dependency further along the road?
>
> No, it's really just so patch 3 can add a separate option under
> CERTIFICATION_ONUS while allowing cell base station and the new option
> to be separate.
Thanks, Johannes
Missed that.
Gr. AvS
^ permalink raw reply
* Re: [PATCH 2/3] [RFC] cfg80211: Add Kconfig option for cellular BS hints
From: Johannes Berg @ 2013-07-02 14:00 UTC (permalink / raw)
To: Arend van Spriel; +Cc: Ilan Peer, linux-wireless, mcgrof
In-Reply-To: <51D2DBB9.4010500@broadcom.com>
On Tue, 2013-07-02 at 15:55 +0200, Arend van Spriel wrote:
> On 07/02/2013 02:28 PM, Ilan Peer wrote:
> > Move the regulatory cellular base station hints support under
> > a specific configuration option and make the option depend
> > on CFG80211_CERTIFICATION_ONUS.
>
> This one seems not really related to the other patches. On itself it is
> not clear to me what itch is being scratched here. Is the aim to get rid
> of the CERTIFICATION_ONUS dependency further along the road?
No, it's really just so patch 3 can add a separate option under
CERTIFICATION_ONUS while allowing cell base station and the new option
to be separate.
johannes
^ permalink raw reply
* Re: [PATCH 2/3] [RFC] cfg80211: Add Kconfig option for cellular BS hints
From: Arend van Spriel @ 2013-07-02 13:55 UTC (permalink / raw)
To: Ilan Peer; +Cc: linux-wireless, mcgrof
In-Reply-To: <1372768095-26053-3-git-send-email-ilan.peer@intel.com>
On 07/02/2013 02:28 PM, Ilan Peer wrote:
> Move the regulatory cellular base station hints support under
> a specific configuration option and make the option depend
> on CFG80211_CERTIFICATION_ONUS.
This one seems not really related to the other patches. On itself it is
not clear to me what itch is being scratched here. Is the aim to get rid
of the CERTIFICATION_ONUS dependency further along the road?
Regards,
Arend
> Signed-off-by: Ilan Peer <ilan.peer@intel.com>
> ---
> net/wireless/Kconfig | 7 +++++++
> net/wireless/reg.c | 2 +-
> 2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig
> index 16d08b3..de76078 100644
> --- a/net/wireless/Kconfig
> +++ b/net/wireless/Kconfig
> @@ -95,6 +95,13 @@ config CFG80211_CERTIFICATION_ONUS
> you are a wireless researcher and are working in a controlled
> and approved environment by your local regulatory agency.
>
> +config CFG80211_REG_CELLULAR_HINTS
> + bool "cfg80211 regulatory support for cellular base station hints"
> + depends on CFG80211 && CFG80211_CERTIFICATION_ONUS
> + ---help---
> + This option adds support for drivers that can receive regulatory
> + hints from cellular base stations
> +
> config CFG80211_DEFAULT_PS
> bool "enable powersave by default"
> depends on CFG80211
> diff --git a/net/wireless/reg.c b/net/wireless/reg.c
> index 5a24c98..2459a69 100644
> --- a/net/wireless/reg.c
> +++ b/net/wireless/reg.c
> @@ -928,7 +928,7 @@ bool reg_last_request_cell_base(void)
> return reg_request_cell_base(get_last_request());
> }
>
> -#ifdef CONFIG_CFG80211_CERTIFICATION_ONUS
> +#ifdef CONFIG_CFG80211_REG_CELLULAR_HINTS
> /* Core specific check */
> static enum reg_request_treatment
> reg_ignore_cell_hint(struct regulatory_request *pending_request)
>
^ permalink raw reply
* Re: [RFC v2] mac80211: Use libnl-configurable values for retry counts
From: Felix Fietkau @ 2013-07-02 13:50 UTC (permalink / raw)
To: Jean-Pierre Tosoni; +Cc: linux-wireless
In-Reply-To: <000001ce7728$18b07de0$4a1179a0$@acksys.fr>
On 2013-07-02 3:28 PM, Jean-Pierre Tosoni wrote:
> Hi Felix,
>
>> -----Message d'origine-----
>> De : Felix Fietkau [mailto:nbd@openwrt.org]
>> > ---
>> > What I am seeking with this patch:
>> > I believe the configuration of the retries will help making recovery
>> > much faster when an AP (in infrastructure mode) or a peer (in mesh
>> > mode) suddenly disappears.
>> I'm all for reducing retries, but I think the way you're applying the
>> limit is problematic.
>> If minstrel decides to use many retries for a high rate and you're
>> simply cutting off all retries that exceed the configured limit, you're
>> potentially inviting quite a bit of unnecessary packet loss.
>> I'm planning to remove the use of retry rate slot 4 (fallback to lowest
>> rate) from minstrel, since max_prob_rate should already provide quite
>> decent reliability.
>
> Well, on one hand, people who want to reduce retries are more concerned with
> low latency and jitter than with reliable delivery of data.
Makes sense.
> On another hand the code should work for any rate control plugin, not just
> minstrel.
But much more important than that is to not cause regressions for other
people via aggressive packet dropping.
> Finally this code is executed for each frame, and I don’t want to bloat it
> more than necessary...
If you put the code in minstrel (and minstrel_ht), it not only allows
making a better tradeoff for retry handling, the code also doesn't have
to be run for every single packet. You can run it during the rate
control stats update.
The reduction of retry attempts definitely needs to be balanced
properly. Retries with max_prob_rate can be more important than retries
with max_tp_rate, but there needs to be a minimum for each of those.
- Felix
^ permalink raw reply
* [PATCH 3/3] [RFC] cfg80211: Enable GO operation on additional channels
From: Ilan Peer @ 2013-07-02 12:28 UTC (permalink / raw)
To: linux-wireless; +Cc: mcgrof, David Spinadel, Ilan Peer
In-Reply-To: <1372768095-26053-1-git-send-email-ilan.peer@intel.com>
From: David Spinadel <david.spinadel@intel.com>
Allow GO operation on a channel marked with
IEEE80211_CHAN_INDOOR_ONLY or IEEE80211_CHAN_GO_CONCURRENT
iff there is an active station interface that is associated to
an AP operating on this channel.
Note that this is a permissive approach to the FCC definitions,
that require a clear assessment that either the platform device
is an indoor device, or the device operating the AP is an indoor
device, i.e., AC powered.
It is assumed that these restrictions are enforced by user space.
Furthermore, it is assumed, that if the conditions that allowed for
the operation of the GO on such a channel change, it is the
responsibility of user space to evacuate the GO from the channel.
Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
---
include/net/cfg80211.h | 4 +-
net/mac80211/ibss.c | 2 +-
net/wireless/Kconfig | 10 +++++
net/wireless/chan.c | 98 ++++++++++++++++++++++++++++++++++++++++++++----
net/wireless/mesh.c | 2 +-
net/wireless/nl80211.c | 8 ++--
net/wireless/trace.h | 11 ++++--
7 files changed, 118 insertions(+), 17 deletions(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index f0badeb..17d693d 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -4070,12 +4070,14 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,
* cfg80211_reg_can_beacon - check if beaconing is allowed
* @wiphy: the wiphy
* @chandef: the channel definition
+ * @p2p_go: if the interface type is a P2P GO
*
* Return: %true if there is no secondary channel or the secondary channel(s)
* can be used for beaconing (i.e. is not a radar channel etc.)
*/
bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
- struct cfg80211_chan_def *chandef);
+ struct cfg80211_chan_def *chandef,
+ bool p2p_go);
/*
* cfg80211_ch_switch_notify - update wdev channel and notify userspace
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index ea7b9c2..1e0fac1 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -82,7 +82,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0;
chandef = ifibss->chandef;
- if (!cfg80211_reg_can_beacon(local->hw.wiphy, &chandef)) {
+ if (!cfg80211_reg_can_beacon(local->hw.wiphy, &chandef, false)) {
chandef.width = NL80211_CHAN_WIDTH_20;
chandef.center_freq1 = chan->center_freq;
}
diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig
index de76078..d9e2be7 100644
--- a/net/wireless/Kconfig
+++ b/net/wireless/Kconfig
@@ -102,6 +102,16 @@ config CFG80211_REG_CELLULAR_HINTS
This option adds support for drivers that can receive regulatory
hints from cellular base stations
+config CFG80211_REG_SOFT_CONFIGURATIONS
+ bool "cfg80211 support for GO operation on additional channels"
+ depends on CFG80211 && CFG80211_CERTIFICATION_ONUS
+ ---help---
+ This option enables the operation of a P2P Group Owner on
+ additional channels, if there is a clear assessment that
+ the platform device operates in an indoor environment or
+ in case that there is an additional BSS interface which is
+ connected to an AP which is an indoor device.
+
config CFG80211_DEFAULT_PS
bool "enable powersave by default"
depends on CFG80211
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 50f6195..92d9e3c 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -457,18 +457,102 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
}
EXPORT_SYMBOL(cfg80211_chandef_usable);
+#ifdef CPTCFG_CFG80211_REG_SOFT_CONFIGURATIONS
+static int cfg80211_get_unii_band(int freq)
+{
+ /* UNII-1 */
+ if (freq >= 5150 && freq <= 5250)
+ return 0;
+
+ /* UNII-2 */
+ if (freq > 5250 && freq <= 5350)
+ return 1;
+
+ /* UNII-2E */
+ if (freq >= 5470 && freq <= 5725)
+ return 2;
+
+ /* UNII-3 */
+ if (freq > 5725 && freq <= 5825)
+ return 3;
+
+ WARN_ON(1);
+ return -EINVAL;
+}
+#endif
+
+/* For GO only, check if the channel can be used under permissive conditions
+ * mandated by the FCC, i.e., the channel is marked as:
+ * 1. Indoor only: a GO can be operational on such a channel, iff there is
+ * clear assessment that the platform device is indoor.
+ * 2. Concurrent GO: a GO can be operational on such a channel, iff there is an
+ * additional station interface connected to an AP on this channel.
+ *
+ * TODO: The function is too permissive, as it does not verify the platform
+ * device type is indeed indoor, or that the AP is indoor/AC powered.
+ */
+static bool cfg80211_can_go_use_chan(struct cfg80211_registered_device *rdev,
+ struct ieee80211_channel *chan)
+{
+#ifdef CPTCFG_CFG80211_REG_SOFT_CONFIGURATIONS
+ struct wireless_dev *wdev_iter;
+
+ ASSERT_RTNL();
+
+ if (!(chan->flags & (IEEE80211_CHAN_INDOOR_ONLY |
+ IEEE80211_CHAN_GO_CONCURRENT)))
+ return false;
+
+ if (chan->band == IEEE80211_BAND_60GHZ)
+ return false;
+
+ list_for_each_entry(wdev_iter, &rdev->wdev_list, list) {
+ struct ieee80211_channel *other_chan = NULL;
+
+ if (wdev_iter->iftype != NL80211_IFTYPE_STATION ||
+ (!netif_running(wdev_iter->netdev)))
+ continue;
+
+
+ wdev_lock(wdev_iter);
+ if (wdev_iter->current_bss)
+ other_chan = wdev_iter->current_bss->pub.channel;
+ wdev_unlock(wdev_iter);
+
+ if (!other_chan)
+ continue;
+
+ if (chan == other_chan)
+ return true;
+ else if ((chan->band == IEEE80211_BAND_5GHZ) &&
+ (cfg80211_get_unii_band(chan->center_freq) ==
+ cfg80211_get_unii_band(other_chan->center_freq)))
+ return true;
+ }
+#endif
+ return false;
+}
+
bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
- struct cfg80211_chan_def *chandef)
+ struct cfg80211_chan_def *chandef,
+ bool p2p_go)
{
+ struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
bool res;
+ u32 flags;
- trace_cfg80211_reg_can_beacon(wiphy, chandef);
+ trace_cfg80211_reg_can_beacon(wiphy, chandef, p2p_go);
+
+ flags = IEEE80211_CHAN_DISABLED | IEEE80211_CHAN_RADAR;
+
+ /* Under certain conditions a GO can operate on channels marked
+ * with IEEE80211_CHAN_PASSIVE_SCAN and IEEE80211_CHAN_NO_IBSS, so set
+ * these flags only if the conditions are not met.
+ */
+ if (!p2p_go || !cfg80211_can_go_use_chan(rdev, chandef->chan))
+ flags |= IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_NO_IBSS;
- res = cfg80211_chandef_usable(wiphy, chandef,
- IEEE80211_CHAN_DISABLED |
- IEEE80211_CHAN_PASSIVE_SCAN |
- IEEE80211_CHAN_NO_IBSS |
- IEEE80211_CHAN_RADAR);
+ res = cfg80211_chandef_usable(wiphy, chandef, flags);
trace_cfg80211_return_bool(res);
return res;
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c
index 30c4920..746c8b4 100644
--- a/net/wireless/mesh.c
+++ b/net/wireless/mesh.c
@@ -172,7 +172,7 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
setup->basic_rates = ieee80211_mandatory_rates(sband);
}
- if (!cfg80211_reg_can_beacon(&rdev->wiphy, &setup->chandef))
+ if (!cfg80211_reg_can_beacon(&rdev->wiphy, &setup->chandef, false))
return -EINVAL;
err = cfg80211_can_use_chan(rdev, wdev, setup->chandef.chan,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index cf22b22..204c160 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1801,7 +1801,8 @@ static int __nl80211_set_channel(struct cfg80211_registered_device *rdev,
result = -EBUSY;
break;
}
- if (!cfg80211_reg_can_beacon(&rdev->wiphy, &chandef)) {
+ if (!cfg80211_reg_can_beacon(&rdev->wiphy, &chandef,
+ iftype == NL80211_IFTYPE_P2P_GO)) {
result = -EINVAL;
break;
}
@@ -3150,7 +3151,8 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
} else if (!nl80211_get_ap_channel(rdev, ¶ms))
return -EINVAL;
- if (!cfg80211_reg_can_beacon(&rdev->wiphy, ¶ms.chandef))
+ if (!cfg80211_reg_can_beacon(&rdev->wiphy, ¶ms.chandef,
+ wdev->iftype == NL80211_IFTYPE_P2P_GO))
return -EINVAL;
err = cfg80211_chandef_dfs_required(wdev->wiphy, ¶ms.chandef);
@@ -6319,7 +6321,7 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
if (err)
return err;
- if (!cfg80211_reg_can_beacon(&rdev->wiphy, &ibss.chandef))
+ if (!cfg80211_reg_can_beacon(&rdev->wiphy, &ibss.chandef, false))
return -EINVAL;
switch (ibss.chandef.width) {
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index e1534baf..7be32c3 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -2115,18 +2115,21 @@ TRACE_EVENT(cfg80211_cqm_rssi_notify,
);
TRACE_EVENT(cfg80211_reg_can_beacon,
- TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef),
- TP_ARGS(wiphy, chandef),
+ TP_PROTO(struct wiphy *wiphy, struct cfg80211_chan_def *chandef,
+ bool p2p_go),
+ TP_ARGS(wiphy, chandef, p2p_go),
TP_STRUCT__entry(
WIPHY_ENTRY
CHAN_DEF_ENTRY
+ __field(bool, p2p_go)
),
TP_fast_assign(
WIPHY_ASSIGN;
CHAN_DEF_ASSIGN(chandef);
+ __entry->p2p_go = p2p_go;
),
- TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT,
- WIPHY_PR_ARG, CHAN_DEF_PR_ARG)
+ TP_printk(WIPHY_PR_FMT ", " CHAN_DEF_PR_FMT ", p2p_go=%d",
+ WIPHY_PR_ARG, CHAN_DEF_PR_ARG, __entry->p2p_go)
);
TRACE_EVENT(cfg80211_chandef_dfs_required,
--
1.7.10.4
^ permalink raw reply related
* [PATCH 2/3] [RFC] cfg80211: Add Kconfig option for cellular BS hints
From: Ilan Peer @ 2013-07-02 12:28 UTC (permalink / raw)
To: linux-wireless; +Cc: mcgrof, Ilan Peer
In-Reply-To: <1372768095-26053-1-git-send-email-ilan.peer@intel.com>
Move the regulatory cellular base station hints support under
a specific configuration option and make the option depend
on CFG80211_CERTIFICATION_ONUS.
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
---
net/wireless/Kconfig | 7 +++++++
net/wireless/reg.c | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig
index 16d08b3..de76078 100644
--- a/net/wireless/Kconfig
+++ b/net/wireless/Kconfig
@@ -95,6 +95,13 @@ config CFG80211_CERTIFICATION_ONUS
you are a wireless researcher and are working in a controlled
and approved environment by your local regulatory agency.
+config CFG80211_REG_CELLULAR_HINTS
+ bool "cfg80211 regulatory support for cellular base station hints"
+ depends on CFG80211 && CFG80211_CERTIFICATION_ONUS
+ ---help---
+ This option adds support for drivers that can receive regulatory
+ hints from cellular base stations
+
config CFG80211_DEFAULT_PS
bool "enable powersave by default"
depends on CFG80211
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 5a24c98..2459a69 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -928,7 +928,7 @@ bool reg_last_request_cell_base(void)
return reg_request_cell_base(get_last_request());
}
-#ifdef CONFIG_CFG80211_CERTIFICATION_ONUS
+#ifdef CONFIG_CFG80211_REG_CELLULAR_HINTS
/* Core specific check */
static enum reg_request_treatment
reg_ignore_cell_hint(struct regulatory_request *pending_request)
--
1.7.10.4
^ permalink raw reply related
* [PATCH 1/3] [RFC] cfg80211: Add indoor only and GO concurrent channel attributes
From: Ilan Peer @ 2013-07-02 12:28 UTC (permalink / raw)
To: linux-wireless; +Cc: mcgrof, David Spinadel, Ilan Peer
In-Reply-To: <1372768095-26053-1-git-send-email-ilan.peer@intel.com>
From: David Spinadel <david.spinadel@intel.com>
The FCC are clarifying some soft configuration requirements,
which among other includes the following:
1. Concurrent GO operation, where devices may support WFD in
bands where an authorized master (for example with DFS and
DFS and radar detection capability in the UNII band) is operating.
2. Indoor operation, where in bands requiring indoor operation, the
device must be programmed to detect indoor operation, or
- Device must be connected to AC Power
- Device must be under the control of a local master that is acting
as an AP and is connected to AC Power.
See https://apps.fcc.gov/eas/comments/GetPublishedDocument.html?id=327&tn=528122
Add support for advertising Indoor-only and Concurrent-GO channel
properties.
Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
---
include/net/cfg80211.h | 6 ++++++
include/uapi/linux/nl80211.h | 7 +++++++
net/wireless/nl80211.c | 6 ++++++
3 files changed, 19 insertions(+)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 7b0730a..f0badeb 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -110,6 +110,10 @@ enum ieee80211_band {
* channel as the control or any of the secondary channels.
* This may be due to the driver or due to regulatory bandwidth
* restrictions.
+ * @IEEE80211_CHAN_INDOOR_ONLY: Only indoor use is permitted on this channel.
+ * @IEEE80211_CHAN_GO_CONCURRENT: GO operation is allowed on this channel if
+ * it's connected concurrently to a BSS on the same channel on 2.4 or
+ * to a channel in the same UNII band on 5.2.
*/
enum ieee80211_channel_flags {
IEEE80211_CHAN_DISABLED = 1<<0,
@@ -121,6 +125,8 @@ enum ieee80211_channel_flags {
IEEE80211_CHAN_NO_OFDM = 1<<6,
IEEE80211_CHAN_NO_80MHZ = 1<<7,
IEEE80211_CHAN_NO_160MHZ = 1<<8,
+ IEEE80211_CHAN_INDOOR_ONLY = 1<<9,
+ IEEE80211_CHAN_GO_CONCURRENT = 1<<10,
};
#define IEEE80211_CHAN_NO_HT40 \
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 861e5eb..09a4f6b 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2158,6 +2158,11 @@ enum nl80211_band_attr {
* @NL80211_FREQUENCY_ATTR_NO_160MHZ: any 160 MHz (but not 80+80) channel
* using this channel as the primary or any of the secondary channels
* isn't possible
+ * @NL80211_FREQUENCY_ATTR_INDOOR_ONLY: Indoor only use is permitted
+ * on this channel in current regulatory domain.
+ * @NL80211_FREQUENCY_ATTR_GO_CONCURRENT: GO operation is allowed on this
+ * channel if it's connected concurrently to a BSS on the same channel on
+ * 2.4 or to a channel in the same UNII band on 5.2.
* @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
* currently defined
* @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
@@ -2176,6 +2181,8 @@ enum nl80211_frequency_attr {
NL80211_FREQUENCY_ATTR_NO_HT40_PLUS,
NL80211_FREQUENCY_ATTR_NO_80MHZ,
NL80211_FREQUENCY_ATTR_NO_160MHZ,
+ NL80211_FREQUENCY_ATTR_INDOOR_ONLY,
+ NL80211_FREQUENCY_ATTR_GO_CONCURRENT,
/* keep last */
__NL80211_FREQUENCY_ATTR_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 7dc3343..cf22b22 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -563,6 +563,12 @@ static int nl80211_msg_put_channel(struct sk_buff *msg,
if ((chan->flags & IEEE80211_CHAN_NO_160MHZ) &&
nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_160MHZ))
goto nla_put_failure;
+ if ((chan->flags & IEEE80211_CHAN_INDOOR_ONLY) &&
+ nla_put_flag(msg, NL80211_FREQUENCY_ATTR_INDOOR_ONLY))
+ goto nla_put_failure;
+ if ((chan->flags & IEEE80211_CHAN_GO_CONCURRENT) &&
+ nla_put_flag(msg, NL80211_FREQUENCY_ATTR_GO_CONCURRENT))
+ goto nla_put_failure;
}
if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
--
1.7.10.4
^ permalink raw reply related
* [PATCH 0/3] Enable additional channels for GO
From: Ilan Peer @ 2013-07-02 12:28 UTC (permalink / raw)
To: linux-wireless; +Cc: mcgrof, Ilan Peer
The FCC are clarifying some soft configuration requirements,
which among other includes the following:
1. Concurrent GO operation, where devices may support WFD in
bands where an authorized master (for example with DFS and
DFS and radar detection capability in the UNII band) is operating.
2. Indoor operation, where in bands requiring indoor operation, the
device must be programmed to detect indoor operation, or
- Device must be connected to AC Power
- Device must be under the control of a local master that is acting
as an AP and is connected to AC Power.
See https://apps.fcc.gov/eas/comments/GetPublishedDocument.html?id=327&tn=528122
David Spinadel (2):
[RFC] cfg80211: Add indoor only and GO concurrent channel attributes
[RFC] cfg80211: Enable GO operation on additional channels
Ilan Peer (1):
[RFC] cfg80211: Add Kconfig option for cellular BS hints
include/net/cfg80211.h | 10 ++++-
include/uapi/linux/nl80211.h | 7 +++
net/mac80211/ibss.c | 2 +-
net/wireless/Kconfig | 17 ++++++++
net/wireless/chan.c | 98 +++++++++++++++++++++++++++++++++++++++---
net/wireless/mesh.c | 2 +-
net/wireless/nl80211.c | 14 ++++--
net/wireless/reg.c | 2 +-
net/wireless/trace.h | 11 +++--
9 files changed, 145 insertions(+), 18 deletions(-)
--
1.7.10.4
^ permalink raw reply
* RE: [RFC v2] mac80211: Use libnl-configurable values for retry counts
From: Jean-Pierre Tosoni @ 2013-07-02 13:28 UTC (permalink / raw)
To: 'Felix Fietkau'; +Cc: linux-wireless
In-Reply-To: <51CF3EC9.3000707@openwrt.org>
Hi Felix,
> -----Message d'origine-----
> De : Felix Fietkau [mailto:nbd@openwrt.org]
> > ---
> > What I am seeking with this patch:
> > I believe the configuration of the retries will help making recovery
> > much faster when an AP (in infrastructure mode) or a peer (in mesh
> > mode) suddenly disappears.
> I'm all for reducing retries, but I think the way you're applying the
> limit is problematic.
> If minstrel decides to use many retries for a high rate and you're
> simply cutting off all retries that exceed the configured limit, you're
> potentially inviting quite a bit of unnecessary packet loss.
> I'm planning to remove the use of retry rate slot 4 (fallback to lowest
> rate) from minstrel, since max_prob_rate should already provide quite
> decent reliability.
Well, on one hand, people who want to reduce retries are more concerned with
low latency and jitter than with reliable delivery of data.
On another hand the code should work for any rate control plugin, not just
minstrel.
Finally this code is executed for each frame, and I dont want to bloat it
more than necessary...
I am thinking of trimming only the largest retry count in the table, but not
below 2 (one try and one retry). I'll test this today.
Do you feel this is a good path ?
Or should I just wait for the slot 4 removal ?
I could also split the trimming between 2 rates, the largest count and the
next-to-largest. Or I could use a minimum of 1 instead of 2.
>
> - Felix
Jean-Pierre
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox