AA: mac80211: backport package from trunk r39886
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 901-wlcore-set-irq_flags-in-the-board-files.patch
1 The platform_quirk element in the platform data was used to change the
2 way the IRQ is triggered. When set, the EDGE_IRQ quirk would change
3 the irqflags used and treat edge trigger differently from the rest.
4
5 Instead of hiding this irq flag setting behind the quirk, have the
6 board files set the flags during initialization. This will be more
7 meaningful than driver-specific quirks when we switch to DT.
8
9 Additionally, fix missing gpio_request() calls in the boarding files
10 (so that setting the flags actually works).
11
12 Cc: Tony Lindgren <tony@atomide.com>
13 Cc: Sekhar Nori <nsekhar@ti.com>
14 Signed-off-by: Luciano Coelho <coelho@ti.com>
15 Reviewed-by: Felipe Balbi <balbi@ti.com>
16 Acked-by: Sekhar Nori <nsekhar@ti.com>
17
18 --- a/drivers/net/wireless/ti/wlcore/debugfs.c
19 +++ b/drivers/net/wireless/ti/wlcore/debugfs.c
20 @@ -502,7 +502,7 @@ static ssize_t driver_state_read(struct
21 DRIVER_STATE_PRINT_HEX(irq);
22 /* TODO: ref_clock and tcxo_clock were moved to wl12xx priv */
23 DRIVER_STATE_PRINT_HEX(hw_pg_ver);
24 - DRIVER_STATE_PRINT_HEX(platform_quirks);
25 + DRIVER_STATE_PRINT_HEX(irq_flags);
26 DRIVER_STATE_PRINT_HEX(chip.id);
27 DRIVER_STATE_PRINT_STR(chip.fw_ver_str);
28 DRIVER_STATE_PRINT_STR(chip.phy_fw_ver_str);
29 --- a/drivers/net/wireless/ti/wlcore/main.c
30 +++ b/drivers/net/wireless/ti/wlcore/main.c
31 @@ -27,6 +27,7 @@
32 #include <linux/vmalloc.h>
33 #include <linux/wl12xx.h>
34 #include <linux/interrupt.h>
35 +#include <linux/irq.h>
36
37 #include "wlcore.h"
38 #include "debug.h"
39 @@ -528,7 +529,7 @@ static int wlcore_irq_locked(struct wl12
40 * In case edge triggered interrupt must be used, we cannot iterate
41 * more than once without introducing race conditions with the hardirq.
42 */
43 - if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ)
44 + if (wl->irq_flags & IRQF_TRIGGER_RISING)
45 loopcount = 1;
46
47 wl1271_debug(DEBUG_IRQ, "IRQ work");
48 @@ -5934,7 +5935,6 @@ struct ieee80211_hw *wlcore_alloc_hw(siz
49 wl->ap_ps_map = 0;
50 wl->ap_fw_ps_map = 0;
51 wl->quirks = 0;
52 - wl->platform_quirks = 0;
53 wl->system_hlid = WL12XX_SYSTEM_HLID;
54 wl->active_sta_count = 0;
55 wl->active_link_count = 0;
56 @@ -6075,7 +6075,7 @@ static void wlcore_nvs_cb(const struct f
57 struct platform_device *pdev = wl->pdev;
58 struct wlcore_platdev_data *pdev_data = dev_get_platdata(&pdev->dev);
59 struct wl12xx_platform_data *pdata = pdev_data->pdata;
60 - unsigned long irqflags;
61 +
62 int ret;
63 irq_handler_t hardirq_fn = NULL;
64
65 @@ -6103,29 +6103,19 @@ static void wlcore_nvs_cb(const struct f
66 wlcore_adjust_conf(wl);
67
68 wl->irq = platform_get_irq(pdev, 0);
69 - wl->platform_quirks = pdata->platform_quirks;
70 wl->if_ops = pdev_data->if_ops;
71
72 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
73 - irqflags = IRQF_TRIGGER_RISING;
74 + wl->irq_flags = irq_get_trigger_type(wl->irq) | IRQF_ONESHOT;
75 hardirq_fn = wlcore_hardirq;
76 -#else
77 - if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ) {
78 - irqflags = IRQF_TRIGGER_RISING;
79 - hardirq_fn = wlcore_hardirq;
80 - } else {
81 - irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT;
82 - }
83 -#endif
84
85 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
86 ret = compat_request_threaded_irq(&wl->irq_compat, wl->irq,
87 hardirq_fn, wlcore_irq,
88 - irqflags,
89 + wl->irqflags,
90 pdev->name, wl);
91 #else
92 ret = request_threaded_irq(wl->irq, hardirq_fn, wlcore_irq,
93 - irqflags, pdev->name, wl);
94 + wl->irq_flags, pdev->name, wl);
95 #endif
96 if (ret < 0) {
97 wl1271_error("request_irq() failed: %d", ret);
98 --- a/drivers/net/wireless/ti/wlcore/wlcore.h
99 +++ b/drivers/net/wireless/ti/wlcore/wlcore.h
100 @@ -188,6 +188,8 @@ struct wl1271 {
101
102 int irq;
103
104 + int irq_flags;
105 +
106 spinlock_t wl_lock;
107
108 enum wlcore_state state;
109 @@ -395,9 +397,6 @@ struct wl1271 {
110 /* Quirks of specific hardware revisions */
111 unsigned int quirks;
112
113 - /* Platform limitations */
114 - unsigned int platform_quirks;
115 -
116 /* number of currently active RX BA sessions */
117 int ba_rx_session_count;
118