diff options
author | Imre Kaloz <kaloz@openwrt.org> | 2014-03-18 18:54:27 +0000 |
---|---|---|
committer | Imre Kaloz <kaloz@openwrt.org> | 2014-03-18 18:54:27 +0000 |
commit | 7777f1ed2c60c4642014270860907e59647baf00 (patch) | |
tree | 322fb9ef5f66790238b90c2b68df7d5b806f06e3 /package/kernel | |
parent | 4cc6898f944b6e51df2f61dfb9e3fc22c39d8119 (diff) | |
download | upstream-7777f1ed2c60c4642014270860907e59647baf00.tar.gz upstream-7777f1ed2c60c4642014270860907e59647baf00.tar.bz2 upstream-7777f1ed2c60c4642014270860907e59647baf00.zip |
[mac80211][omap]: switch to the newer DT bindings for wl1xxx
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@39946 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/kernel')
9 files changed, 139 insertions, 760 deletions
diff --git a/package/kernel/mac80211/patches/900-wl1251-split-wl251-platform-data-to-a-separate-structure.patch b/package/kernel/mac80211/patches/900-wl1251-split-wl251-platform-data-to-a-separate-structure.patch deleted file mode 100644 index a8af257c34..0000000000 --- a/package/kernel/mac80211/patches/900-wl1251-split-wl251-platform-data-to-a-separate-structure.patch +++ /dev/null @@ -1,109 +0,0 @@ -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> -Reviewed-by: Felipe Balbi <balbi@ti.com> - ---- 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(cons - - 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); ---- 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 - 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 - 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) { ---- a/drivers/net/wireless/ti/wl1251/spi.c -+++ b/drivers/net/wireless/ti/wl1251/spi.c -@@ -241,7 +241,7 @@ static const struct wl1251_if_operations - - 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/package/kernel/mac80211/patches/900-wlcore-Add-support-for-DT-platform-data.patch b/package/kernel/mac80211/patches/900-wlcore-Add-support-for-DT-platform-data.patch new file mode 100644 index 0000000000..967768af05 --- /dev/null +++ b/package/kernel/mac80211/patches/900-wlcore-Add-support-for-DT-platform-data.patch @@ -0,0 +1,139 @@ +When running with DT, we no longer have a board file that can set up the +platform data for wlcore. Allow this data to be passed from DT. + +Since some platforms use a gpio-irq, add support for passing either the +irq number or the gpio number. For the latter case, the driver will +request the gpio and convert it to the irq number. If an irq is +specified, it'll be used as is. + +[Arik - the pdev_data pointer does not belong to us and is freed when +the device is released. Dereference to our private data first.] + +Signed-off-by: Ido Yariv <ido@wizery.com> +Signed-off-by: Arik Nemtsov <arik@wizery.com> +--- + drivers/net/wireless/ti/wlcore/sdio.c | 71 ++++++++++++++++++++++++++++++++--- + include/linux/wl12xx.h | 3 +- + 2 files changed, 67 insertions(+), 7 deletions(-) + +--- 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/of.h> + + #include "wlcore.h" + #include "wl12xx_80211.h" +@@ -214,6 +215,61 @@ static struct wl1271_if_operations sdio_ + .set_block_size = wl1271_sdio_set_block_size, + }; + ++static const struct of_device_id wlcore_of_match[] = { ++ { ++ .compatible = "wlcore", ++ }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, wlcore_of_match); ++ ++static struct wl12xx_platform_data *get_platform_data(struct device *dev) ++{ ++ struct wl12xx_platform_data *pdata; ++ struct device_node *np; ++ u32 gpio; ++ ++ pdata = wl12xx_get_platform_data(); ++ if (!IS_ERR(pdata)) ++ return kmemdup(pdata, sizeof(*pdata), GFP_KERNEL); ++ ++ np = of_find_matching_node(NULL, wlcore_of_match); ++ if (!np) { ++ dev_err(dev, "No platform data set\n"); ++ return NULL; ++ } ++ ++ pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); ++ if (!pdata) { ++ dev_err(dev, "Can't allocate platform data\n"); ++ return NULL; ++ } ++ ++ if (of_property_read_u32(np, "irq", &pdata->irq)) { ++ if (!of_property_read_u32(np, "gpio", &gpio) && ++ !gpio_request_one(gpio, GPIOF_IN, "wlcore_irq")) { ++ pdata->gpio = gpio; ++ pdata->irq = gpio_to_irq(gpio); ++ } ++ } ++ ++ /* Optional fields */ ++ pdata->use_eeprom = of_property_read_bool(np, "use-eeprom"); ++ of_property_read_u32(np, "board-ref-clock", &pdata->board_ref_clock); ++ of_property_read_u32(np, "board-tcxo-clock", &pdata->board_tcxo_clock); ++ of_property_read_u32(np, "platform-quirks", &pdata->platform_quirks); ++ ++ return pdata; ++} ++ ++static void del_platform_data(struct wl12xx_platform_data *pdata) ++{ ++ if (pdata->gpio) ++ gpio_free(pdata->gpio); ++ ++ kfree(pdata); ++} ++ + static int wl1271_probe(struct sdio_func *func, + const struct sdio_device_id *id) + { +@@ -248,12 +304,9 @@ static int wl1271_probe(struct sdio_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 = 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); +@@ -282,7 +335,7 @@ static int wl1271_probe(struct sdio_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; +@@ -316,6 +369,9 @@ static int wl1271_probe(struct sdio_func + out_dev_put: + platform_device_put(glue->core); + ++out_free_pdata: ++ del_platform_data(pdev_data->pdata); ++ + out_free_glue: + kfree(glue); + +@@ -329,11 +385,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); ++ del_platform_data(pdata); + kfree(glue); + } + diff --git a/package/kernel/mac80211/patches/901-wlcore-set-irq_flags-in-the-board-files.patch b/package/kernel/mac80211/patches/901-wlcore-set-irq_flags-in-the-board-files.patch deleted file mode 100644 index f2789a9c55..0000000000 --- a/package/kernel/mac80211/patches/901-wlcore-set-irq_flags-in-the-board-files.patch +++ /dev/null @@ -1,118 +0,0 @@ -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 flags during initialization. This will be more -meaningful than driver-specific quirks when we switch to DT. - -Additionally, fix missing gpio_request() calls in the boarding files -(so that setting the flags actually works). - -Cc: Tony Lindgren <tony@atomide.com> -Cc: Sekhar Nori <nsekhar@ti.com> -Signed-off-by: Luciano Coelho <coelho@ti.com> -Reviewed-by: Felipe Balbi <balbi@ti.com> -Acked-by: Sekhar Nori <nsekhar@ti.com> - ---- 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 - 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); ---- 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" -@@ -528,7 +529,7 @@ static int wlcore_irq_locked(struct wl12 - * 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"); -@@ -5934,7 +5935,6 @@ struct ieee80211_hw *wlcore_alloc_hw(siz - 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; -@@ -6075,7 +6075,7 @@ static void wlcore_nvs_cb(const struct f - 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; -+ - int ret; - irq_handler_t hardirq_fn = NULL; - -@@ -6103,29 +6103,19 @@ static void wlcore_nvs_cb(const struct f - 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 LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) -- irqflags = IRQF_TRIGGER_RISING; -+ wl->irq_flags = irq_get_trigger_type(wl->irq) | IRQF_ONESHOT; - hardirq_fn = wlcore_hardirq; --#else -- if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ) { -- irqflags = IRQF_TRIGGER_RISING; -- hardirq_fn = wlcore_hardirq; -- } else { -- irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT; -- } --#endif - - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31) - ret = compat_request_threaded_irq(&wl->irq_compat, wl->irq, - hardirq_fn, wlcore_irq, -- irqflags, -+ wl->irqflags, - pdev->name, wl); - #else - ret = request_threaded_irq(wl->irq, hardirq_fn, wlcore_irq, -- irqflags, pdev->name, wl); -+ wl->irq_flags, pdev->name, wl); - #endif - if (ret < 0) { - wl1271_error("request_irq() failed: %d", ret); ---- a/drivers/net/wireless/ti/wlcore/wlcore.h -+++ b/drivers/net/wireless/ti/wlcore/wlcore.h -@@ -188,6 +188,8 @@ struct wl1271 { - - int irq; - -+ int irq_flags; -+ - spinlock_t wl_lock; - - enum wlcore_state state; -@@ -395,9 +397,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/package/kernel/mac80211/patches/902-wlcore-remove-pwr_in_suspend-from-platform-data.patch b/package/kernel/mac80211/patches/902-wlcore-remove-pwr_in_suspend-from-platform-data.patch deleted file mode 100644 index 639437754b..0000000000 --- a/package/kernel/mac80211/patches/902-wlcore-remove-pwr_in_suspend-from-platform-data.patch +++ /dev/null @@ -1,48 +0,0 @@ -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> -Reviewed-by: Felipe Balbi <balbi@ti.com> - ---- a/drivers/net/wireless/ti/wlcore/main.c -+++ b/drivers/net/wireless/ti/wlcore/main.c -@@ -6074,7 +6074,6 @@ static void wlcore_nvs_cb(const struct f - 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; - - int ret; - irq_handler_t hardirq_fn = NULL; -@@ -6127,7 +6126,7 @@ static void wlcore_nvs_cb(const struct f - 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 ---- 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 - 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); - ---- 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/package/kernel/mac80211/patches/903-wl12xx-use-frequency-instead-of-enumerations-for-pdata-clocks.patch b/package/kernel/mac80211/patches/903-wl12xx-use-frequency-instead-of-enumerations-for-pdata-clocks.patch deleted file mode 100644 index 4b20932f53..0000000000 --- a/package/kernel/mac80211/patches/903-wl12xx-use-frequency-instead-of-enumerations-for-pdata-clocks.patch +++ /dev/null @@ -1,131 +0,0 @@ -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. - -Additionally, this reverts commit 26f45c (ARM: OMAP2+: Legacy support -for wl12xx when booted with devicetree), since this is not be needed -anymore, now that DT support for WiLink is implemented. - -Cc: Tony Lindgren <tony@atomide.com> -Cc: Sekhar Nori <nsekhar@ti.com> -Signed-off-by: Luciano Coelho <coelho@ti.com> -Reviewed-by: Felipe Balbi <balbi@ti.com> - ---- a/drivers/net/wireless/ti/wl12xx/main.c -+++ b/drivers/net/wireless/ti/wl12xx/main.c -@@ -1711,6 +1711,43 @@ static struct ieee80211_sta_ht_cap wl12x - }, - }; - -+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 = 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; -@@ -1732,7 +1769,16 @@ static int wl12xx_setup(struct wl1271 *w - 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; -@@ -1751,7 +1797,15 @@ static int wl12xx_setup(struct wl1271 *w - } - - if (!tcxo_param) { -- priv->tcxo_clock = pdata->board_tcxo_clock; -+ 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 (!strcmp(tcxo_param, "19.2")) - priv->tcxo_clock = WL12XX_TCXOCLOCK_19_2; ---- 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/package/kernel/mac80211/patches/904-wlcore-add-initial-device-tree-support-to-the-sdio-module.patch b/package/kernel/mac80211/patches/904-wlcore-add-initial-device-tree-support-to-the-sdio-module.patch deleted file mode 100644 index 9e1d19070f..0000000000 --- a/package/kernel/mac80211/patches/904-wlcore-add-initial-device-tree-support-to-the-sdio-module.patch +++ /dev/null @@ -1,118 +0,0 @@ -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> -Reviewed-by: Felipe Balbi <balbi@ti.com> - ---- 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_ - .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 - /* 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_sd - }; - #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) diff --git a/package/kernel/mac80211/patches/905-wlcore-sdio-add-wilink-clock-providers.patch b/package/kernel/mac80211/patches/905-wlcore-sdio-add-wilink-clock-providers.patch deleted file mode 100644 index be1f9ada43..0000000000 --- a/package/kernel/mac80211/patches/905-wlcore-sdio-add-wilink-clock-providers.patch +++ /dev/null @@ -1,50 +0,0 @@ -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> -Reviewed-by: Felipe Balbi <balbi@ti.com> - ---- 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_ - .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 *wlco - 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: diff --git a/package/kernel/mac80211/patches/906-wlcore-sdio-get-clocks-from-device-tree.patch b/package/kernel/mac80211/patches/906-wlcore-sdio-get-clocks-from-device-tree.patch deleted file mode 100644 index 09ff4aff96..0000000000 --- a/package/kernel/mac80211/patches/906-wlcore-sdio-get-clocks-from-device-tree.patch +++ /dev/null @@ -1,90 +0,0 @@ -Read the clock nodes from the device tree and use them to set the -frequency for the refclock and the tcxo clock. - -Also, call sdio_set_drvdata() earlier, so the glue is already set in -the driver data when we call wlcore_get_pdata_from_of() and we don't -need to pass it as a parameter. - -Signed-off-by: Luciano Coelho <coelho@ti.com> -Reviewed-by: Felipe Balbi <balbi@ti.com> - ---- 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 *wlco - 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 *wlco - 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 - /* 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 - 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_fu - { - 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); - diff --git a/package/kernel/mac80211/patches/907-wlcore-wl12xx-check-if-we-got-correct-clock-data-from-DT.patch b/package/kernel/mac80211/patches/907-wlcore-wl12xx-check-if-we-got-correct-clock-data-from-DT.patch deleted file mode 100644 index 6b09177ded..0000000000 --- a/package/kernel/mac80211/patches/907-wlcore-wl12xx-check-if-we-got-correct-clock-data-from-DT.patch +++ /dev/null @@ -1,96 +0,0 @@ -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> -Reviewed-by: Felipe Balbi <balbi@ti.com> - ---- a/drivers/net/wireless/ti/wl12xx/main.c -+++ b/drivers/net/wireless/ti/wl12xx/main.c -@@ -930,6 +930,11 @@ static int wl128x_boot_clk(struct wl1271 - 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) { -@@ -979,6 +984,11 @@ static int wl127x_boot_clk(struct wl1271 - 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; - -@@ -1768,7 +1778,7 @@ static int wl12xx_setup(struct wl1271 *w - 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); -@@ -1779,6 +1789,8 @@ static int wl12xx_setup(struct wl1271 *w - - 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; -@@ -1796,7 +1808,7 @@ static int wl12xx_setup(struct wl1271 *w - 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, - true); -@@ -1806,7 +1818,9 @@ static int wl12xx_setup(struct wl1271 *w - - 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")) ---- 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 *wlco - 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); |