procd: update to latest version, fixes a format string bug in processing init script...
[openwrt/staging/wigyori.git] / target / linux / omap / patches-3.12 / 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 ---
19 arch/arm/mach-davinci/board-da850-evm.c | 8 +++++++-
20 arch/arm/mach-omap2/board-omap3evm.c | 19 ++++++++++++++++++
21 arch/arm/mach-omap2/board-zoom-peripherals.c | 30 +++++++++++++++++++++++++---
22 drivers/net/wireless/ti/wlcore/debugfs.c | 2 +-
23 drivers/net/wireless/ti/wlcore/main.c | 17 ++++++++--------
24 drivers/net/wireless/ti/wlcore/wlcore.h | 5 ++---
25 include/linux/wl12xx.h | 4 ----
26 7 files changed, 64 insertions(+), 21 deletions(-)
27
28 --- a/arch/arm/mach-davinci/board-da850-evm.c
29 +++ b/arch/arm/mach-davinci/board-da850-evm.c
30 @@ -1371,7 +1371,6 @@ static const short da850_wl12xx_pins[] _
31 static struct wl12xx_platform_data da850_wl12xx_wlan_data __initdata = {
32 .irq = -1,
33 .board_ref_clock = WL12XX_REFCLOCK_38,
34 - .platform_quirks = WL12XX_PLATFORM_QUIRK_EDGE_IRQ,
35 };
36
37 static __init int da850_wl12xx_init(void)
38 @@ -1402,6 +1401,13 @@ static __init int da850_wl12xx_init(void
39 goto free_wlan_en;
40 }
41
42 + ret = irq_set_irq_type(gpio_to_irq(DA850_WLAN_IRQ),
43 + IRQ_TYPE_EDGE_RISING);
44 + if (ret) {
45 + pr_err("Could not set wl12xx irq type: %d\n", ret);
46 + goto free;
47 + }
48 +
49 da850_wl12xx_wlan_data.irq = gpio_to_irq(DA850_WLAN_IRQ);
50
51 ret = wl12xx_set_platform_data(&da850_wl12xx_wlan_data);
52 --- a/arch/arm/mach-omap2/board-omap3evm.c
53 +++ b/arch/arm/mach-omap2/board-omap3evm.c
54 @@ -627,12 +627,31 @@ static void __init omap3_evm_wl12xx_init
55
56 /* WL12xx WLAN Init */
57 omap3evm_wlan_data.irq = gpio_to_irq(OMAP3EVM_WLAN_IRQ_GPIO);
58 +
59 + ret = gpio_request_one(OMAP3EVM_WLAN_IRQ_GPIO, GPIOF_IN,
60 + "OMAP3EVM_WLAN_IRQ_GPIO");
61 + if (ret) {
62 + pr_err("error requesting wl12xx gpio: %d\n", ret);
63 + goto out;
64 + }
65 +
66 + ret = irq_set_irq_type(gpio_to_irq(OMAP3EVM_WLAN_IRQ_GPIO),
67 + IRQ_TYPE_LEVEL_HIGH);
68 + if (ret) {
69 + pr_err("error setting wl12xx irq type: %d\n", ret);
70 + goto free;
71 + }
72 +
73 ret = wl12xx_set_platform_data(&omap3evm_wlan_data);
74 if (ret)
75 pr_err("error setting wl12xx data: %d\n", ret);
76 ret = platform_device_register(&omap3evm_wlan_regulator);
77 if (ret)
78 pr_err("error registering wl12xx device: %d\n", ret);
79 +out:
80 + return;
81 +free:
82 + gpio_free(OMAP3EVM_WLAN_IRQ_GPIO);
83 #endif
84 }
85
86 --- a/arch/arm/mach-omap2/board-zoom-peripherals.c
87 +++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
88 @@ -339,16 +339,40 @@ static void enable_board_wakeup_source(v
89 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
90 }
91
92 -void __init zoom_peripherals_init(void)
93 +static void __init zoom_wilink_init(void)
94 {
95 int ret;
96
97 omap_zoom_wlan_data.irq = gpio_to_irq(OMAP_ZOOM_WLAN_IRQ_GPIO);
98 - ret = wl12xx_set_platform_data(&omap_zoom_wlan_data);
99
100 - if (ret)
101 + ret = gpio_request_one(OMAP_ZOOM_WLAN_IRQ_GPIO, GPIOF_IN,
102 + "OMAP_ZOOM_WLAN_IRQ_GPIO");
103 + if (ret) {
104 + pr_err("error requesting wl12xx gpio: %d\n", ret);
105 + goto out;
106 + }
107 +
108 + ret = irq_set_irq_type(gpio_to_irq(OMAP_ZOOM_WLAN_IRQ_GPIO),
109 + IRQ_TYPE_LEVEL_HIGH);
110 + if (ret) {
111 + pr_err("error setting wl12xx irq type: %d\n", ret);
112 + goto free;
113 + }
114 +
115 + ret = wl12xx_set_platform_data(&omap_zoom_wlan_data);
116 + if (ret) {
117 pr_err("error setting wl12xx data: %d\n", ret);
118 + goto free;
119 + }
120 +out:
121 + return;
122 +free:
123 + gpio_free(OMAP_ZOOM_WLAN_IRQ_GPIO);
124 +}
125
126 +void __init zoom_peripherals_init(void)
127 +{
128 + zoom_wilink_init();
129 omap_hsmmc_init(mmc);
130 omap_i2c_init();
131 pwm_add_table(zoom_pwm_lookup, ARRAY_SIZE(zoom_pwm_lookup));
132 --- a/drivers/net/wireless/ti/wlcore/debugfs.c
133 +++ b/drivers/net/wireless/ti/wlcore/debugfs.c
134 @@ -486,7 +486,7 @@ static ssize_t driver_state_read(struct
135 DRIVER_STATE_PRINT_HEX(irq);
136 /* TODO: ref_clock and tcxo_clock were moved to wl12xx priv */
137 DRIVER_STATE_PRINT_HEX(hw_pg_ver);
138 - DRIVER_STATE_PRINT_HEX(platform_quirks);
139 + DRIVER_STATE_PRINT_HEX(irq_flags);
140 DRIVER_STATE_PRINT_HEX(chip.id);
141 DRIVER_STATE_PRINT_STR(chip.fw_ver_str);
142 DRIVER_STATE_PRINT_STR(chip.phy_fw_ver_str);
143 --- a/drivers/net/wireless/ti/wlcore/main.c
144 +++ b/drivers/net/wireless/ti/wlcore/main.c
145 @@ -27,6 +27,7 @@
146 #include <linux/vmalloc.h>
147 #include <linux/wl12xx.h>
148 #include <linux/interrupt.h>
149 +#include <linux/irq.h>
150
151 #include "wlcore.h"
152 #include "debug.h"
153 @@ -516,7 +517,7 @@ static int wlcore_irq_locked(struct wl12
154 * In case edge triggered interrupt must be used, we cannot iterate
155 * more than once without introducing race conditions with the hardirq.
156 */
157 - if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ)
158 + if (wl->irq_flags & IRQF_TRIGGER_RISING)
159 loopcount = 1;
160
161 wl1271_debug(DEBUG_IRQ, "IRQ work");
162 @@ -5766,7 +5767,6 @@ struct ieee80211_hw *wlcore_alloc_hw(siz
163 wl->ap_ps_map = 0;
164 wl->ap_fw_ps_map = 0;
165 wl->quirks = 0;
166 - wl->platform_quirks = 0;
167 wl->system_hlid = WL12XX_SYSTEM_HLID;
168 wl->active_sta_count = 0;
169 wl->active_link_count = 0;
170 @@ -5902,7 +5902,7 @@ static void wlcore_nvs_cb(const struct f
171 struct platform_device *pdev = wl->pdev;
172 struct wlcore_platdev_data *pdev_data = pdev->dev.platform_data;
173 struct wl12xx_platform_data *pdata = pdev_data->pdata;
174 - unsigned long irqflags;
175 +
176 int ret;
177
178 if (fw) {
179 @@ -5929,16 +5929,15 @@ static void wlcore_nvs_cb(const struct f
180 wlcore_adjust_conf(wl);
181
182 wl->irq = platform_get_irq(pdev, 0);
183 - wl->platform_quirks = pdata->platform_quirks;
184 wl->if_ops = pdev_data->if_ops;
185
186 - if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ)
187 - irqflags = IRQF_TRIGGER_RISING;
188 - else
189 - irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT;
190 + wl->irq_flags = irq_get_trigger_type(wl->irq);
191 +
192 + /* Since we don't use the primary handler, we must set ONESHOT */
193 + wl->irq_flags |= IRQF_ONESHOT;
194
195 ret = request_threaded_irq(wl->irq, NULL, wlcore_irq,
196 - irqflags, pdev->name, wl);
197 + wl->irq_flags, pdev->name, wl);
198 if (ret < 0) {
199 wl1271_error("request_irq() failed: %d", ret);
200 goto out_free_nvs;
201 --- a/drivers/net/wireless/ti/wlcore/wlcore.h
202 +++ b/drivers/net/wireless/ti/wlcore/wlcore.h
203 @@ -185,6 +185,8 @@ struct wl1271 {
204
205 int irq;
206
207 + int irq_flags;
208 +
209 spinlock_t wl_lock;
210
211 enum wlcore_state state;
212 @@ -384,9 +386,6 @@ struct wl1271 {
213 /* Quirks of specific hardware revisions */
214 unsigned int quirks;
215
216 - /* Platform limitations */
217 - unsigned int platform_quirks;
218 -
219 /* number of currently active RX BA sessions */
220 int ba_rx_session_count;
221
222 --- a/include/linux/wl12xx.h
223 +++ b/include/linux/wl12xx.h
224 @@ -59,13 +59,9 @@ struct wl12xx_platform_data {
225 int irq;
226 int board_ref_clock;
227 int board_tcxo_clock;
228 - unsigned long platform_quirks;
229 bool pwr_in_suspend;
230 };
231
232 -/* Platform does not support level trigger interrupts */
233 -#define WL12XX_PLATFORM_QUIRK_EDGE_IRQ BIT(0)
234 -
235 #ifdef CONFIG_WILINK_PLATFORM_DATA
236
237 int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);