Skip to content

Commit 078dc51

Browse files
author
Linus Walleij
committed
ARM: omap2: Rewrite WLAN quirk to use GPIO descriptors
The OMAP2 platform data quirk is using the global GPIO numberspace to obtain two WLAN GPIOs to drive power and xcvr reset GPIO lines during start-up. Rewrite the quirk to use a GPIO descriptor table so we avoid using global GPIO numbers. This gets rid of the final dependency on the legacy <linux/gpio.h> header from the OMAP2/3 platforms. Fixes: 92bf78b ("gpio: omap: use dynamic allocation of base") Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 94075d1 commit 078dc51

1 file changed

Lines changed: 28 additions & 13 deletions

File tree

arch/arm/mach-omap2/pdata-quirks.c

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <linux/davinci_emac.h>
99
#include <linux/gpio/machine.h>
1010
#include <linux/gpio/consumer.h>
11-
#include <linux/gpio.h>
1211
#include <linux/init.h>
1312
#include <linux/kernel.h>
1413
#include <linux/of_platform.h>
@@ -178,25 +177,41 @@ static void __init am35xx_emac_reset(void)
178177
omap_ctrl_readl(AM35XX_CONTROL_IP_SW_RESET); /* OCP barrier */
179178
}
180179

181-
static struct gpio cm_t3517_wlan_gpios[] __initdata = {
182-
{ 56, GPIOF_OUT_INIT_HIGH, "wlan pwr" },
183-
{ 4, GPIOF_OUT_INIT_HIGH, "xcvr noe" },
180+
static struct gpiod_lookup_table cm_t3517_wlan_gpio_table = {
181+
.dev_id = NULL,
182+
.table = {
183+
GPIO_LOOKUP("gpio-48-53", 8, "power",
184+
GPIO_ACTIVE_HIGH),
185+
GPIO_LOOKUP("gpio-0-15", 4, "noe",
186+
GPIO_ACTIVE_HIGH),
187+
{ }
188+
},
184189
};
185190

186191
static void __init omap3_sbc_t3517_wifi_init(void)
187192
{
188-
int err = gpio_request_array(cm_t3517_wlan_gpios,
189-
ARRAY_SIZE(cm_t3517_wlan_gpios));
190-
if (err) {
191-
pr_err("SBC-T3517: wl12xx gpios request failed: %d\n", err);
192-
return;
193-
}
193+
struct gpio_desc *d;
194194

195-
gpiod_export(gpio_to_desc(cm_t3517_wlan_gpios[0].gpio), 0);
196-
gpiod_export(gpio_to_desc(cm_t3517_wlan_gpios[1].gpio), 0);
195+
gpiod_add_lookup_table(&cm_t3517_wlan_gpio_table);
197196

197+
/* This asserts the RESET line (reverse polarity) */
198+
d = gpiod_get(NULL, "power", GPIOD_OUT_HIGH);
199+
if (IS_ERR(d)) {
200+
pr_err("Unable to get CM T3517 WLAN power GPIO descriptor\n");
201+
} else {
202+
gpiod_set_consumer_name(d, "wlan pwr");
203+
gpiod_export(d, 0);
204+
}
205+
206+
d = gpiod_get(NULL, "noe", GPIOD_OUT_HIGH);
207+
if (IS_ERR(d)) {
208+
pr_err("Unable to get CM T3517 WLAN XCVR NOE GPIO descriptor\n");
209+
} else {
210+
gpiod_set_consumer_name(d, "xcvr noe");
211+
gpiod_export(d, 0);
212+
}
198213
msleep(100);
199-
gpio_set_value(cm_t3517_wlan_gpios[1].gpio, 0);
214+
gpiod_set_value(d, 0);
200215
}
201216

202217
static struct gpiod_lookup_table omap3_sbc_t3517_usb_gpio_table = {

0 commit comments

Comments
 (0)