mac80211: refresh patch
[openwrt.git] / package / kernel / 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 @@ -5925,7 +5926,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 @@ -6066,7 +6066,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 @@ -6094,18 +6094,17 @@ 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 (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ) {
73 -               irqflags = IRQF_TRIGGER_RISING;
74 -               hardirq_fn = wlcore_hardirq;
75 -       } else {
76 -               irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT;
77 -       }
78 +       wl->irq_flags = irq_get_trigger_type(wl->irq);
79
80 +       hardirq_fn = wlcore_hardirq;
81 +
82 +       /* Since we don't use the primary handler, we must set ONESHOT */
83 +       wl->irq_flags |= IRQF_ONESHOT;
84  
85         ret = request_threaded_irq(wl->irq, hardirq_fn, wlcore_irq,
86 -                                  irqflags, pdev->name, wl);
87 +                                  wl->irq_flags, pdev->name, wl);
88         if (ret < 0) {
89                 wl1271_error("request_irq() failed: %d", ret);
90                 goto out_free_nvs;
91 --- a/drivers/net/wireless/ti/wlcore/wlcore.h
92 +++ b/drivers/net/wireless/ti/wlcore/wlcore.h
93 @@ -186,6 +186,8 @@ struct wl1271 {
94  
95         int irq;
96  
97 +       int irq_flags;
98 +
99         spinlock_t wl_lock;
100  
101         enum wlcore_state state;
102 @@ -393,9 +395,6 @@ struct wl1271 {
103         /* Quirks of specific hardware revisions */
104         unsigned int quirks;
105  
106 -       /* Platform limitations */
107 -       unsigned int platform_quirks;
108 -
109         /* number of currently active RX BA sessions */
110         int ba_rx_session_count;
111