.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Handles the Mitac Mio A701 Board |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2008 Robert Jarzmik |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License as published by |
---|
8 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
9 | | - * (at your option) any later version. |
---|
10 | | - * |
---|
11 | | - * This program is distributed in the hope that it will be useful, |
---|
12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | | - * GNU General Public License for more details. |
---|
15 | | - * |
---|
16 | | - * You should have received a copy of the GNU General Public License |
---|
17 | | - * along with this program; if not, write to the Free Software |
---|
18 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
19 | | - * |
---|
20 | 6 | */ |
---|
21 | 7 | |
---|
22 | 8 | #include <linux/kernel.h> |
---|
.. | .. |
---|
31 | 17 | #include <linux/rtc.h> |
---|
32 | 18 | #include <linux/leds.h> |
---|
33 | 19 | #include <linux/gpio.h> |
---|
| 20 | +#include <linux/gpio/machine.h> |
---|
34 | 21 | #include <linux/interrupt.h> |
---|
35 | 22 | #include <linux/irq.h> |
---|
36 | 23 | #include <linux/pda_power.h> |
---|
37 | 24 | #include <linux/power_supply.h> |
---|
38 | 25 | #include <linux/wm97xx.h> |
---|
39 | 26 | #include <linux/mtd/physmap.h> |
---|
40 | | -#include <linux/usb/gpio_vbus.h> |
---|
41 | 27 | #include <linux/reboot.h> |
---|
42 | 28 | #include <linux/regulator/fixed.h> |
---|
43 | 29 | #include <linux/regulator/max1586.h> |
---|
.. | .. |
---|
190 | 176 | static struct platform_pwm_backlight_data mioa701_backlight_data = { |
---|
191 | 177 | .max_brightness = 100, |
---|
192 | 178 | .dft_brightness = 50, |
---|
193 | | - .enable_gpio = -1, |
---|
194 | 179 | }; |
---|
195 | 180 | |
---|
196 | 181 | /* |
---|
.. | .. |
---|
381 | 366 | .gpio_pullup = GPIO22_USB_ENABLE, |
---|
382 | 367 | }; |
---|
383 | 368 | |
---|
384 | | -struct gpio_vbus_mach_info gpio_vbus_data = { |
---|
385 | | - .gpio_vbus = GPIO13_nUSB_DETECT, |
---|
386 | | - .gpio_vbus_inverted = 1, |
---|
387 | | - .gpio_pullup = -1, |
---|
| 369 | +static struct gpiod_lookup_table gpio_vbus_gpiod_table = { |
---|
| 370 | + .dev_id = "gpio-vbus", |
---|
| 371 | + .table = { |
---|
| 372 | + GPIO_LOOKUP("gpio-pxa", GPIO13_nUSB_DETECT, |
---|
| 373 | + "vbus", GPIO_ACTIVE_LOW), |
---|
| 374 | + { }, |
---|
| 375 | + }, |
---|
388 | 376 | }; |
---|
389 | 377 | |
---|
390 | 378 | /* |
---|
.. | .. |
---|
397 | 385 | static struct pxamci_platform_data mioa701_mci_info = { |
---|
398 | 386 | .detect_delay_ms = 250, |
---|
399 | 387 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
---|
400 | | - .gpio_card_detect = GPIO15_SDIO_INSERT, |
---|
401 | | - .gpio_card_ro = GPIO78_SDIO_RO, |
---|
402 | | - .gpio_power = GPIO91_SDIO_EN, |
---|
| 388 | +}; |
---|
| 389 | + |
---|
| 390 | +static struct gpiod_lookup_table mioa701_mci_gpio_table = { |
---|
| 391 | + .dev_id = "pxa2xx-mci.0", |
---|
| 392 | + .table = { |
---|
| 393 | + /* Card detect on GPIO 15 */ |
---|
| 394 | + GPIO_LOOKUP("gpio-pxa", GPIO15_SDIO_INSERT, |
---|
| 395 | + "cd", GPIO_ACTIVE_LOW), |
---|
| 396 | + /* Write protect on GPIO 78 */ |
---|
| 397 | + GPIO_LOOKUP("gpio-pxa", GPIO78_SDIO_RO, |
---|
| 398 | + "wp", GPIO_ACTIVE_LOW), |
---|
| 399 | + /* Power on GPIO 91 */ |
---|
| 400 | + GPIO_LOOKUP("gpio-pxa", GPIO91_SDIO_EN, |
---|
| 401 | + "power", GPIO_ACTIVE_HIGH), |
---|
| 402 | + { }, |
---|
| 403 | + }, |
---|
403 | 404 | }; |
---|
404 | 405 | |
---|
405 | 406 | /* FlashRAM */ |
---|
.. | .. |
---|
677 | 678 | MIO_SIMPLE_DEV(pxa2xx_pcm, "pxa2xx-pcm", NULL) |
---|
678 | 679 | MIO_SIMPLE_DEV(mioa701_sound, "mioa701-wm9713", NULL) |
---|
679 | 680 | MIO_SIMPLE_DEV(mioa701_board, "mioa701-board", NULL) |
---|
680 | | -MIO_SIMPLE_DEV(gpio_vbus, "gpio-vbus", &gpio_vbus_data); |
---|
| 681 | +MIO_SIMPLE_DEV(gpio_vbus, "gpio-vbus", NULL); |
---|
681 | 682 | |
---|
682 | 683 | static struct platform_device *devices[] __initdata = { |
---|
683 | 684 | &mioa701_gpio_keys, |
---|
.. | .. |
---|
743 | 744 | pr_err("MioA701: Failed to request GPIOs: %d", rc); |
---|
744 | 745 | bootstrap_init(); |
---|
745 | 746 | pxa_set_fb_info(NULL, &mioa701_pxafb_info); |
---|
| 747 | + gpiod_add_lookup_table(&mioa701_mci_gpio_table); |
---|
746 | 748 | pxa_set_mci_info(&mioa701_mci_info); |
---|
747 | 749 | pxa_set_keypad_info(&mioa701_keypad_info); |
---|
748 | 750 | pxa_set_udc_info(&mioa701_udc_info); |
---|
749 | 751 | pxa_set_ac97_info(&mioa701_ac97_info); |
---|
750 | 752 | pm_power_off = mioa701_poweroff; |
---|
751 | 753 | pwm_add_table(mioa701_pwm_lookup, ARRAY_SIZE(mioa701_pwm_lookup)); |
---|
| 754 | + gpiod_add_lookup_table(&gpio_vbus_gpiod_table); |
---|
752 | 755 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
---|
753 | 756 | gsm_init(); |
---|
754 | 757 | |
---|