diff options
Diffstat (limited to 'drivers/net/wireless')
| -rw-r--r-- | drivers/net/wireless/mac80211_hwsim.c | 5 | ||||
| -rw-r--r-- | drivers/net/wireless/ti/wilink_platform_data.c | 25 | ||||
| -rw-r--r-- | drivers/net/wireless/ti/wl12xx/main.c | 63 | ||||
| -rw-r--r-- | drivers/net/wireless/ti/wl12xx/wl12xx.h | 28 | ||||
| -rw-r--r-- | drivers/net/wireless/ti/wlcore/boot.c | 1 | ||||
| -rw-r--r-- | drivers/net/wireless/ti/wlcore/debugfs.c | 2 | ||||
| -rw-r--r-- | drivers/net/wireless/ti/wlcore/main.c | 31 | ||||
| -rw-r--r-- | drivers/net/wireless/ti/wlcore/sdio.c | 63 | ||||
| -rw-r--r-- | drivers/net/wireless/ti/wlcore/spi.c | 6 | ||||
| -rw-r--r-- | drivers/net/wireless/ti/wlcore/wlcore.h | 5 | ||||
| -rw-r--r-- | drivers/net/wireless/ti/wlcore/wlcore_i.h | 6 |
11 files changed, 168 insertions, 67 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 4a4c6586a8d2..8908be6dbc48 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
| @@ -946,7 +946,8 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw, | |||
| 946 | goto nla_put_failure; | 946 | goto nla_put_failure; |
| 947 | 947 | ||
| 948 | genlmsg_end(skb, msg_head); | 948 | genlmsg_end(skb, msg_head); |
| 949 | genlmsg_unicast(&init_net, skb, dst_portid); | 949 | if (genlmsg_unicast(&init_net, skb, dst_portid)) |
| 950 | goto err_free_txskb; | ||
| 950 | 951 | ||
| 951 | /* Enqueue the packet */ | 952 | /* Enqueue the packet */ |
| 952 | skb_queue_tail(&data->pending, my_skb); | 953 | skb_queue_tail(&data->pending, my_skb); |
| @@ -955,6 +956,8 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw, | |||
| 955 | return; | 956 | return; |
| 956 | 957 | ||
| 957 | nla_put_failure: | 958 | nla_put_failure: |
| 959 | nlmsg_free(skb); | ||
| 960 | err_free_txskb: | ||
| 958 | printk(KERN_DEBUG "mac80211_hwsim: error occurred in %s\n", __func__); | 961 | printk(KERN_DEBUG "mac80211_hwsim: error occurred in %s\n", __func__); |
| 959 | ieee80211_free_txskb(hw, my_skb); | 962 | ieee80211_free_txskb(hw, my_skb); |
| 960 | data->tx_failed++; | 963 | data->tx_failed++; |
diff --git a/drivers/net/wireless/ti/wilink_platform_data.c b/drivers/net/wireless/ti/wilink_platform_data.c index a92bd3e89796..ea0e359bdb43 100644 --- a/drivers/net/wireless/ti/wilink_platform_data.c +++ b/drivers/net/wireless/ti/wilink_platform_data.c | |||
| @@ -23,31 +23,6 @@ | |||
| 23 | #include <linux/err.h> | 23 | #include <linux/err.h> |
| 24 | #include <linux/wl12xx.h> | 24 | #include <linux/wl12xx.h> |
| 25 | 25 | ||
| 26 | static struct wl12xx_platform_data *wl12xx_platform_data; | ||
| 27 | |||
| 28 | int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data) | ||
| 29 | { | ||
| 30 | if (wl12xx_platform_data) | ||
| 31 | return -EBUSY; | ||
| 32 | if (!data) | ||
| 33 | return -EINVAL; | ||
| 34 | |||
| 35 | wl12xx_platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL); | ||
| 36 | if (!wl12xx_platform_data) | ||
| 37 | return -ENOMEM; | ||
| 38 | |||
| 39 | return 0; | ||
| 40 | } | ||
| 41 | |||
| 42 | struct wl12xx_platform_data *wl12xx_get_platform_data(void) | ||
| 43 | { | ||
| 44 | if (!wl12xx_platform_data) | ||
| 45 | return ERR_PTR(-ENODEV); | ||
| 46 | |||
| 47 | return wl12xx_platform_data; | ||
| 48 | } | ||
| 49 | EXPORT_SYMBOL(wl12xx_get_platform_data); | ||
| 50 | |||
| 51 | static struct wl1251_platform_data *wl1251_platform_data; | 26 | static struct wl1251_platform_data *wl1251_platform_data; |
| 52 | 27 | ||
| 53 | int __init wl1251_set_platform_data(const struct wl1251_platform_data *data) | 28 | int __init wl1251_set_platform_data(const struct wl1251_platform_data *data) |
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c index 144d1f8ba473..af0fe2e17151 100644 --- a/drivers/net/wireless/ti/wl12xx/main.c +++ b/drivers/net/wireless/ti/wl12xx/main.c | |||
| @@ -24,8 +24,6 @@ | |||
| 24 | 24 | ||
| 25 | #include <linux/err.h> | 25 | #include <linux/err.h> |
| 26 | 26 | ||
| 27 | #include <linux/wl12xx.h> | ||
| 28 | |||
| 29 | #include "../wlcore/wlcore.h" | 27 | #include "../wlcore/wlcore.h" |
| 30 | #include "../wlcore/debug.h" | 28 | #include "../wlcore/debug.h" |
| 31 | #include "../wlcore/io.h" | 29 | #include "../wlcore/io.h" |
| @@ -1770,11 +1768,44 @@ wl12xx_iface_combinations[] = { | |||
| 1770 | }, | 1768 | }, |
| 1771 | }; | 1769 | }; |
| 1772 | 1770 | ||
| 1771 | static const struct wl12xx_clock wl12xx_refclock_table[] = { | ||
| 1772 | { 19200000, false, WL12XX_REFCLOCK_19 }, | ||
| 1773 | { 26000000, false, WL12XX_REFCLOCK_26 }, | ||
| 1774 | { 26000000, true, WL12XX_REFCLOCK_26_XTAL }, | ||
| 1775 | { 38400000, false, WL12XX_REFCLOCK_38 }, | ||
| 1776 | { 38400000, true, WL12XX_REFCLOCK_38_XTAL }, | ||
| 1777 | { 52000000, false, WL12XX_REFCLOCK_52 }, | ||
| 1778 | { 0, false, 0 } | ||
| 1779 | }; | ||
| 1780 | |||
| 1781 | static const struct wl12xx_clock wl12xx_tcxoclock_table[] = { | ||
| 1782 | { 16368000, true, WL12XX_TCXOCLOCK_16_368 }, | ||
| 1783 | { 16800000, true, WL12XX_TCXOCLOCK_16_8 }, | ||
| 1784 | { 19200000, true, WL12XX_TCXOCLOCK_19_2 }, | ||
| 1785 | { 26000000, true, WL12XX_TCXOCLOCK_26 }, | ||
| 1786 | { 32736000, true, WL12XX_TCXOCLOCK_32_736 }, | ||
| 1787 | { 33600000, true, WL12XX_TCXOCLOCK_33_6 }, | ||
| 1788 | { 38400000, true, WL12XX_TCXOCLOCK_38_4 }, | ||
| 1789 | { 52000000, true, WL12XX_TCXOCLOCK_52 }, | ||
| 1790 | { 0, false, 0 } | ||
| 1791 | }; | ||
| 1792 | |||
| 1793 | static int wl12xx_get_clock_idx(const struct wl12xx_clock *table, | ||
| 1794 | u32 freq, bool xtal) | ||
| 1795 | { | ||
| 1796 | int i; | ||
| 1797 | |||
| 1798 | for (i = 0; table[i].freq != 0; i++) | ||
| 1799 | if ((table[i].freq == freq) && (table[i].xtal == xtal)) | ||
| 1800 | return table[i].hw_idx; | ||
| 1801 | |||
| 1802 | return -EINVAL; | ||
| 1803 | } | ||
| 1804 | |||
| 1773 | static int wl12xx_setup(struct wl1271 *wl) | 1805 | static int wl12xx_setup(struct wl1271 *wl) |
| 1774 | { | 1806 | { |
| 1775 | struct wl12xx_priv *priv = wl->priv; | 1807 | struct wl12xx_priv *priv = wl->priv; |
| 1776 | struct wlcore_platdev_data *pdev_data = dev_get_platdata(&wl->pdev->dev); | 1808 | struct wlcore_platdev_data *pdev_data = dev_get_platdata(&wl->pdev->dev); |
| 1777 | struct wl12xx_platform_data *pdata = pdev_data->pdata; | ||
| 1778 | 1809 | ||
| 1779 | BUILD_BUG_ON(WL12XX_MAX_LINKS > WLCORE_MAX_LINKS); | 1810 | BUILD_BUG_ON(WL12XX_MAX_LINKS > WLCORE_MAX_LINKS); |
| 1780 | BUILD_BUG_ON(WL12XX_MAX_AP_STATIONS > WL12XX_MAX_LINKS); | 1811 | BUILD_BUG_ON(WL12XX_MAX_AP_STATIONS > WL12XX_MAX_LINKS); |
| @@ -1799,7 +1830,17 @@ static int wl12xx_setup(struct wl1271 *wl) | |||
| 1799 | wl12xx_conf_init(wl); | 1830 | wl12xx_conf_init(wl); |
| 1800 | 1831 | ||
| 1801 | if (!fref_param) { | 1832 | if (!fref_param) { |
| 1802 | priv->ref_clock = pdata->board_ref_clock; | 1833 | priv->ref_clock = wl12xx_get_clock_idx(wl12xx_refclock_table, |
| 1834 | pdev_data->ref_clock_freq, | ||
| 1835 | pdev_data->ref_clock_xtal); | ||
| 1836 | if (priv->ref_clock < 0) { | ||
| 1837 | wl1271_error("Invalid ref_clock frequency (%d Hz, %s)", | ||
| 1838 | pdev_data->ref_clock_freq, | ||
| 1839 | pdev_data->ref_clock_xtal ? | ||
| 1840 | "XTAL" : "not XTAL"); | ||
| 1841 | |||
| 1842 | return priv->ref_clock; | ||
| 1843 | } | ||
| 1803 | } else { | 1844 | } else { |
| 1804 | if (!strcmp(fref_param, "19.2")) | 1845 | if (!strcmp(fref_param, "19.2")) |
| 1805 | priv->ref_clock = WL12XX_REFCLOCK_19; | 1846 | priv->ref_clock = WL12XX_REFCLOCK_19; |
| @@ -1817,9 +1858,17 @@ static int wl12xx_setup(struct wl1271 *wl) | |||
| 1817 | wl1271_error("Invalid fref parameter %s", fref_param); | 1858 | wl1271_error("Invalid fref parameter %s", fref_param); |
| 1818 | } | 1859 | } |
| 1819 | 1860 | ||
| 1820 | if (!tcxo_param) { | 1861 | if (!tcxo_param && pdev_data->tcxo_clock_freq) { |
| 1821 | priv->tcxo_clock = pdata->board_tcxo_clock; | 1862 | priv->tcxo_clock = wl12xx_get_clock_idx(wl12xx_tcxoclock_table, |
| 1822 | } else { | 1863 | pdev_data->tcxo_clock_freq, |
| 1864 | true); | ||
| 1865 | if (priv->tcxo_clock < 0) { | ||
| 1866 | wl1271_error("Invalid tcxo_clock frequency (%d Hz)", | ||
| 1867 | pdev_data->tcxo_clock_freq); | ||
| 1868 | |||
| 1869 | return priv->tcxo_clock; | ||
| 1870 | } | ||
| 1871 | } else if (tcxo_param) { | ||
| 1823 | if (!strcmp(tcxo_param, "19.2")) | 1872 | if (!strcmp(tcxo_param, "19.2")) |
| 1824 | priv->tcxo_clock = WL12XX_TCXOCLOCK_19_2; | 1873 | priv->tcxo_clock = WL12XX_TCXOCLOCK_19_2; |
| 1825 | else if (!strcmp(tcxo_param, "26")) | 1874 | else if (!strcmp(tcxo_param, "26")) |
diff --git a/drivers/net/wireless/ti/wl12xx/wl12xx.h b/drivers/net/wireless/ti/wl12xx/wl12xx.h index 75c92658bfea..5952e99ace1b 100644 --- a/drivers/net/wireless/ti/wl12xx/wl12xx.h +++ b/drivers/net/wireless/ti/wl12xx/wl12xx.h | |||
| @@ -82,6 +82,34 @@ struct wl12xx_priv { | |||
| 82 | struct wl127x_rx_mem_pool_addr *rx_mem_addr; | 82 | struct wl127x_rx_mem_pool_addr *rx_mem_addr; |
| 83 | }; | 83 | }; |
| 84 | 84 | ||
| 85 | /* Reference clock values */ | ||
| 86 | enum { | ||
| 87 | WL12XX_REFCLOCK_19 = 0, /* 19.2 MHz */ | ||
| 88 | WL12XX_REFCLOCK_26 = 1, /* 26 MHz */ | ||
| 89 | WL12XX_REFCLOCK_38 = 2, /* 38.4 MHz */ | ||
| 90 | WL12XX_REFCLOCK_52 = 3, /* 52 MHz */ | ||
| 91 | WL12XX_REFCLOCK_38_XTAL = 4, /* 38.4 MHz, XTAL */ | ||
| 92 | WL12XX_REFCLOCK_26_XTAL = 5, /* 26 MHz, XTAL */ | ||
| 93 | }; | ||
| 94 | |||
| 95 | /* TCXO clock values */ | ||
| 96 | enum { | ||
| 97 | WL12XX_TCXOCLOCK_19_2 = 0, /* 19.2MHz */ | ||
| 98 | WL12XX_TCXOCLOCK_26 = 1, /* 26 MHz */ | ||
| 99 | WL12XX_TCXOCLOCK_38_4 = 2, /* 38.4MHz */ | ||
| 100 | WL12XX_TCXOCLOCK_52 = 3, /* 52 MHz */ | ||
| 101 | WL12XX_TCXOCLOCK_16_368 = 4, /* 16.368 MHz */ | ||
| 102 | WL12XX_TCXOCLOCK_32_736 = 5, /* 32.736 MHz */ | ||
| 103 | WL12XX_TCXOCLOCK_16_8 = 6, /* 16.8 MHz */ | ||
| 104 | WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */ | ||
| 105 | }; | ||
| 106 | |||
| 107 | struct wl12xx_clock { | ||
| 108 | u32 freq; | ||
| 109 | bool xtal; | ||
| 110 | u8 hw_idx; | ||
| 111 | }; | ||
| 112 | |||
| 85 | struct wl12xx_fw_packet_counters { | 113 | struct wl12xx_fw_packet_counters { |
| 86 | /* Cumulative counter of released packets per AC */ | 114 | /* Cumulative counter of released packets per AC */ |
| 87 | u8 tx_released_pkts[NUM_TX_QUEUES]; | 115 | u8 tx_released_pkts[NUM_TX_QUEUES]; |
diff --git a/drivers/net/wireless/ti/wlcore/boot.c b/drivers/net/wireless/ti/wlcore/boot.c index 77752b03f189..19b7ec7b69c2 100644 --- a/drivers/net/wireless/ti/wlcore/boot.c +++ b/drivers/net/wireless/ti/wlcore/boot.c | |||
| @@ -22,7 +22,6 @@ | |||
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
| 25 | #include <linux/wl12xx.h> | ||
| 26 | #include <linux/export.h> | 25 | #include <linux/export.h> |
| 27 | 26 | ||
| 28 | #include "debug.h" | 27 | #include "debug.h" |
diff --git a/drivers/net/wireless/ti/wlcore/debugfs.c b/drivers/net/wireless/ti/wlcore/debugfs.c index 68f3bf229b5a..eb43f94a1597 100644 --- a/drivers/net/wireless/ti/wlcore/debugfs.c +++ b/drivers/net/wireless/ti/wlcore/debugfs.c | |||
| @@ -502,7 +502,7 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf, | |||
| 502 | DRIVER_STATE_PRINT_HEX(irq); | 502 | DRIVER_STATE_PRINT_HEX(irq); |
| 503 | /* TODO: ref_clock and tcxo_clock were moved to wl12xx priv */ | 503 | /* TODO: ref_clock and tcxo_clock were moved to wl12xx priv */ |
| 504 | DRIVER_STATE_PRINT_HEX(hw_pg_ver); | 504 | DRIVER_STATE_PRINT_HEX(hw_pg_ver); |
| 505 | DRIVER_STATE_PRINT_HEX(platform_quirks); | 505 | DRIVER_STATE_PRINT_HEX(irq_flags); |
| 506 | DRIVER_STATE_PRINT_HEX(chip.id); | 506 | DRIVER_STATE_PRINT_HEX(chip.id); |
| 507 | DRIVER_STATE_PRINT_STR(chip.fw_ver_str); | 507 | DRIVER_STATE_PRINT_STR(chip.fw_ver_str); |
| 508 | DRIVER_STATE_PRINT_STR(chip.phy_fw_ver_str); | 508 | 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 1e136993580f..0be807951afe 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c | |||
| @@ -25,8 +25,8 @@ | |||
| 25 | #include <linux/firmware.h> | 25 | #include <linux/firmware.h> |
| 26 | #include <linux/etherdevice.h> | 26 | #include <linux/etherdevice.h> |
| 27 | #include <linux/vmalloc.h> | 27 | #include <linux/vmalloc.h> |
| 28 | #include <linux/wl12xx.h> | ||
| 29 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
| 29 | #include <linux/irq.h> | ||
| 30 | 30 | ||
| 31 | #include "wlcore.h" | 31 | #include "wlcore.h" |
| 32 | #include "debug.h" | 32 | #include "debug.h" |
| @@ -538,7 +538,7 @@ static int wlcore_irq_locked(struct wl1271 *wl) | |||
| 538 | * In case edge triggered interrupt must be used, we cannot iterate | 538 | * In case edge triggered interrupt must be used, we cannot iterate |
| 539 | * more than once without introducing race conditions with the hardirq. | 539 | * more than once without introducing race conditions with the hardirq. |
| 540 | */ | 540 | */ |
| 541 | if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ) | 541 | if (wl->irq_flags & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) |
| 542 | loopcount = 1; | 542 | loopcount = 1; |
| 543 | 543 | ||
| 544 | wl1271_debug(DEBUG_IRQ, "IRQ work"); | 544 | wl1271_debug(DEBUG_IRQ, "IRQ work"); |
| @@ -6249,7 +6249,6 @@ struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size, u32 aggr_buf_size, | |||
| 6249 | wl->ap_ps_map = 0; | 6249 | wl->ap_ps_map = 0; |
| 6250 | wl->ap_fw_ps_map = 0; | 6250 | wl->ap_fw_ps_map = 0; |
| 6251 | wl->quirks = 0; | 6251 | wl->quirks = 0; |
| 6252 | wl->platform_quirks = 0; | ||
| 6253 | wl->system_hlid = WL12XX_SYSTEM_HLID; | 6252 | wl->system_hlid = WL12XX_SYSTEM_HLID; |
| 6254 | wl->active_sta_count = 0; | 6253 | wl->active_sta_count = 0; |
| 6255 | wl->active_link_count = 0; | 6254 | wl->active_link_count = 0; |
| @@ -6390,8 +6389,8 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context) | |||
| 6390 | struct wl1271 *wl = context; | 6389 | struct wl1271 *wl = context; |
| 6391 | struct platform_device *pdev = wl->pdev; | 6390 | struct platform_device *pdev = wl->pdev; |
| 6392 | struct wlcore_platdev_data *pdev_data = dev_get_platdata(&pdev->dev); | 6391 | struct wlcore_platdev_data *pdev_data = dev_get_platdata(&pdev->dev); |
| 6393 | struct wl12xx_platform_data *pdata = pdev_data->pdata; | 6392 | struct resource *res; |
| 6394 | unsigned long irqflags; | 6393 | |
| 6395 | int ret; | 6394 | int ret; |
| 6396 | irq_handler_t hardirq_fn = NULL; | 6395 | irq_handler_t hardirq_fn = NULL; |
| 6397 | 6396 | ||
| @@ -6418,19 +6417,23 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context) | |||
| 6418 | /* adjust some runtime configuration parameters */ | 6417 | /* adjust some runtime configuration parameters */ |
| 6419 | wlcore_adjust_conf(wl); | 6418 | wlcore_adjust_conf(wl); |
| 6420 | 6419 | ||
| 6421 | wl->irq = platform_get_irq(pdev, 0); | 6420 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
| 6422 | wl->platform_quirks = pdata->platform_quirks; | 6421 | if (!res) { |
| 6422 | wl1271_error("Could not get IRQ resource"); | ||
| 6423 | goto out_free_nvs; | ||
| 6424 | } | ||
| 6425 | |||
| 6426 | wl->irq = res->start; | ||
| 6427 | wl->irq_flags = res->flags & IRQF_TRIGGER_MASK; | ||
| 6423 | wl->if_ops = pdev_data->if_ops; | 6428 | wl->if_ops = pdev_data->if_ops; |
| 6424 | 6429 | ||
| 6425 | if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ) { | 6430 | if (wl->irq_flags & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) |
| 6426 | irqflags = IRQF_TRIGGER_RISING; | ||
| 6427 | hardirq_fn = wlcore_hardirq; | 6431 | hardirq_fn = wlcore_hardirq; |
| 6428 | } else { | 6432 | else |
| 6429 | irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT; | 6433 | wl->irq_flags |= IRQF_ONESHOT; |
| 6430 | } | ||
| 6431 | 6434 | ||
| 6432 | ret = request_threaded_irq(wl->irq, hardirq_fn, wlcore_irq, | 6435 | ret = request_threaded_irq(wl->irq, hardirq_fn, wlcore_irq, |
| 6433 | irqflags, pdev->name, wl); | 6436 | wl->irq_flags, pdev->name, wl); |
| 6434 | if (ret < 0) { | 6437 | if (ret < 0) { |
| 6435 | wl1271_error("request_irq() failed: %d", ret); | 6438 | wl1271_error("request_irq() failed: %d", ret); |
| 6436 | goto out_free_nvs; | 6439 | goto out_free_nvs; |
| @@ -6441,7 +6444,7 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context) | |||
| 6441 | if (!ret) { | 6444 | if (!ret) { |
| 6442 | wl->irq_wake_enabled = true; | 6445 | wl->irq_wake_enabled = true; |
| 6443 | device_init_wakeup(wl->dev, 1); | 6446 | device_init_wakeup(wl->dev, 1); |
| 6444 | if (pdata->pwr_in_suspend) | 6447 | if (pdev_data->pwr_in_suspend) |
| 6445 | wl->hw->wiphy->wowlan = &wlcore_wowlan_support; | 6448 | wl->hw->wiphy->wowlan = &wlcore_wowlan_support; |
| 6446 | } | 6449 | } |
| 6447 | #endif | 6450 | #endif |
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c index d3dd7bfdf3f1..ea7e07abca4e 100644 --- a/drivers/net/wireless/ti/wlcore/sdio.c +++ b/drivers/net/wireless/ti/wlcore/sdio.c | |||
| @@ -31,9 +31,10 @@ | |||
| 31 | #include <linux/mmc/card.h> | 31 | #include <linux/mmc/card.h> |
| 32 | #include <linux/mmc/host.h> | 32 | #include <linux/mmc/host.h> |
| 33 | #include <linux/gpio.h> | 33 | #include <linux/gpio.h> |
| 34 | #include <linux/wl12xx.h> | ||
| 35 | #include <linux/pm_runtime.h> | 34 | #include <linux/pm_runtime.h> |
| 36 | #include <linux/printk.h> | 35 | #include <linux/printk.h> |
| 36 | #include <linux/of.h> | ||
| 37 | #include <linux/of_irq.h> | ||
| 37 | 38 | ||
| 38 | #include "wlcore.h" | 39 | #include "wlcore.h" |
| 39 | #include "wl12xx_80211.h" | 40 | #include "wl12xx_80211.h" |
| @@ -214,6 +215,52 @@ static struct wl1271_if_operations sdio_ops = { | |||
| 214 | .set_block_size = wl1271_sdio_set_block_size, | 215 | .set_block_size = wl1271_sdio_set_block_size, |
| 215 | }; | 216 | }; |
| 216 | 217 | ||
| 218 | #ifdef CONFIG_OF | ||
| 219 | static const struct of_device_id wlcore_sdio_of_match_table[] = { | ||
| 220 | { .compatible = "ti,wl1271" }, | ||
| 221 | { .compatible = "ti,wl1273" }, | ||
| 222 | { .compatible = "ti,wl1281" }, | ||
| 223 | { .compatible = "ti,wl1283" }, | ||
| 224 | { .compatible = "ti,wl1801" }, | ||
| 225 | { .compatible = "ti,wl1805" }, | ||
| 226 | { .compatible = "ti,wl1807" }, | ||
| 227 | { .compatible = "ti,wl1831" }, | ||
| 228 | { .compatible = "ti,wl1835" }, | ||
| 229 | { .compatible = "ti,wl1837" }, | ||
| 230 | { } | ||
| 231 | }; | ||
| 232 | |||
| 233 | static int wlcore_probe_of(struct device *dev, int *irq, | ||
| 234 | struct wlcore_platdev_data *pdev_data) | ||
| 235 | { | ||
| 236 | struct device_node *np = dev->of_node; | ||
| 237 | |||
| 238 | if (!np || !of_match_node(wlcore_sdio_of_match_table, np)) | ||
| 239 | return -ENODATA; | ||
| 240 | |||
| 241 | *irq = irq_of_parse_and_map(np, 0); | ||
| 242 | if (!*irq) { | ||
| 243 | dev_err(dev, "No irq in platform data\n"); | ||
| 244 | kfree(pdev_data); | ||
| 245 | return -EINVAL; | ||
| 246 | } | ||
| 247 | |||
| 248 | /* optional clock frequency params */ | ||
| 249 | of_property_read_u32(np, "ref-clock-frequency", | ||
| 250 | &pdev_data->ref_clock_freq); | ||
| 251 | of_property_read_u32(np, "tcxo-clock-frequency", | ||
| 252 | &pdev_data->tcxo_clock_freq); | ||
| 253 | |||
| 254 | return 0; | ||
| 255 | } | ||
| 256 | #else | ||
| 257 | static int wlcore_probe_of(struct device *dev, int *irq, | ||
| 258 | struct wlcore_platdev_data *pdev_data) | ||
| 259 | { | ||
| 260 | return -ENODATA; | ||
| 261 | } | ||
| 262 | #endif | ||
| 263 | |||
| 217 | static int wl1271_probe(struct sdio_func *func, | 264 | static int wl1271_probe(struct sdio_func *func, |
| 218 | const struct sdio_device_id *id) | 265 | const struct sdio_device_id *id) |
| 219 | { | 266 | { |
| @@ -222,6 +269,7 @@ static int wl1271_probe(struct sdio_func *func, | |||
| 222 | struct resource res[1]; | 269 | struct resource res[1]; |
| 223 | mmc_pm_flag_t mmcflags; | 270 | mmc_pm_flag_t mmcflags; |
| 224 | int ret = -ENOMEM; | 271 | int ret = -ENOMEM; |
| 272 | int irq; | ||
| 225 | const char *chip_family; | 273 | const char *chip_family; |
| 226 | 274 | ||
| 227 | /* We are only able to handle the wlan function */ | 275 | /* We are only able to handle the wlan function */ |
| @@ -245,19 +293,15 @@ static int wl1271_probe(struct sdio_func *func, | |||
| 245 | /* Use block mode for transferring over one block size of data */ | 293 | /* Use block mode for transferring over one block size of data */ |
| 246 | func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE; | 294 | func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE; |
| 247 | 295 | ||
| 248 | pdev_data.pdata = wl12xx_get_platform_data(); | 296 | if (wlcore_probe_of(&func->dev, &irq, &pdev_data)) |
| 249 | if (IS_ERR(pdev_data.pdata)) { | ||
| 250 | ret = PTR_ERR(pdev_data.pdata); | ||
| 251 | dev_err(glue->dev, "missing wlan platform data: %d\n", ret); | ||
| 252 | goto out_free_glue; | 297 | goto out_free_glue; |
| 253 | } | ||
| 254 | 298 | ||
| 255 | /* if sdio can keep power while host is suspended, enable wow */ | 299 | /* if sdio can keep power while host is suspended, enable wow */ |
| 256 | mmcflags = sdio_get_host_pm_caps(func); | 300 | mmcflags = sdio_get_host_pm_caps(func); |
| 257 | dev_dbg(glue->dev, "sdio PM caps = 0x%x\n", mmcflags); | 301 | dev_dbg(glue->dev, "sdio PM caps = 0x%x\n", mmcflags); |
| 258 | 302 | ||
| 259 | if (mmcflags & MMC_PM_KEEP_POWER) | 303 | if (mmcflags & MMC_PM_KEEP_POWER) |
| 260 | pdev_data.pdata->pwr_in_suspend = true; | 304 | pdev_data.pwr_in_suspend = true; |
| 261 | 305 | ||
| 262 | sdio_set_drvdata(func, glue); | 306 | sdio_set_drvdata(func, glue); |
| 263 | 307 | ||
| @@ -286,8 +330,9 @@ static int wl1271_probe(struct sdio_func *func, | |||
| 286 | 330 | ||
| 287 | memset(res, 0x00, sizeof(res)); | 331 | memset(res, 0x00, sizeof(res)); |
| 288 | 332 | ||
| 289 | res[0].start = pdev_data.pdata->irq; | 333 | res[0].start = irq; |
| 290 | res[0].flags = IORESOURCE_IRQ; | 334 | res[0].flags = IORESOURCE_IRQ | |
| 335 | irqd_get_trigger_type(irq_get_irq_data(irq)); | ||
| 291 | res[0].name = "irq"; | 336 | res[0].name = "irq"; |
| 292 | 337 | ||
| 293 | ret = platform_device_add_resources(glue->core, res, ARRAY_SIZE(res)); | 338 | ret = platform_device_add_resources(glue->core, res, ARRAY_SIZE(res)); |
diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index 69601f6741d9..f1ac2839d97c 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c | |||
| @@ -331,11 +331,7 @@ static int wl1271_probe(struct spi_device *spi) | |||
| 331 | 331 | ||
| 332 | memset(&pdev_data, 0x00, sizeof(pdev_data)); | 332 | memset(&pdev_data, 0x00, sizeof(pdev_data)); |
| 333 | 333 | ||
| 334 | pdev_data.pdata = dev_get_platdata(&spi->dev); | 334 | /* TODO: add DT parsing when needed */ |
| 335 | if (!pdev_data.pdata) { | ||
| 336 | dev_err(&spi->dev, "no platform data\n"); | ||
| 337 | return -ENODEV; | ||
| 338 | } | ||
| 339 | 335 | ||
| 340 | pdev_data.if_ops = &spi_ops; | 336 | pdev_data.if_ops = &spi_ops; |
| 341 | 337 | ||
diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h index d599c869e6e8..7f363fa566a3 100644 --- a/drivers/net/wireless/ti/wlcore/wlcore.h +++ b/drivers/net/wireless/ti/wlcore/wlcore.h | |||
| @@ -197,6 +197,8 @@ struct wl1271 { | |||
| 197 | 197 | ||
| 198 | int irq; | 198 | int irq; |
| 199 | 199 | ||
| 200 | int irq_flags; | ||
| 201 | |||
| 200 | spinlock_t wl_lock; | 202 | spinlock_t wl_lock; |
| 201 | 203 | ||
| 202 | enum wlcore_state state; | 204 | enum wlcore_state state; |
| @@ -404,9 +406,6 @@ struct wl1271 { | |||
| 404 | /* Quirks of specific hardware revisions */ | 406 | /* Quirks of specific hardware revisions */ |
| 405 | unsigned int quirks; | 407 | unsigned int quirks; |
| 406 | 408 | ||
| 407 | /* Platform limitations */ | ||
| 408 | unsigned int platform_quirks; | ||
| 409 | |||
| 410 | /* number of currently active RX BA sessions */ | 409 | /* number of currently active RX BA sessions */ |
| 411 | int ba_rx_session_count; | 410 | int ba_rx_session_count; |
| 412 | 411 | ||
diff --git a/drivers/net/wireless/ti/wlcore/wlcore_i.h b/drivers/net/wireless/ti/wlcore/wlcore_i.h index 3396ce5a934d..39efc6d78b10 100644 --- a/drivers/net/wireless/ti/wlcore/wlcore_i.h +++ b/drivers/net/wireless/ti/wlcore/wlcore_i.h | |||
| @@ -201,8 +201,12 @@ struct wl1271_if_operations { | |||
| 201 | }; | 201 | }; |
| 202 | 202 | ||
| 203 | struct wlcore_platdev_data { | 203 | struct wlcore_platdev_data { |
| 204 | struct wl12xx_platform_data *pdata; | ||
| 205 | struct wl1271_if_operations *if_ops; | 204 | struct wl1271_if_operations *if_ops; |
| 205 | |||
| 206 | bool ref_clock_xtal; /* specify whether the clock is XTAL or not */ | ||
| 207 | u32 ref_clock_freq; /* in Hertz */ | ||
| 208 | u32 tcxo_clock_freq; /* in Hertz, tcxo is always XTAL */ | ||
| 209 | bool pwr_in_suspend; | ||
| 206 | }; | 210 | }; |
| 207 | 211 | ||
| 208 | #define MAX_NUM_KEYS 14 | 212 | #define MAX_NUM_KEYS 14 |
