hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/arm/mach-pxa/mioa701.c
....@@ -1,22 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Handles the Mitac Mio A701 Board
34 *
45 * 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
- *
206 */
217
228 #include <linux/kernel.h>
....@@ -31,13 +17,13 @@
3117 #include <linux/rtc.h>
3218 #include <linux/leds.h>
3319 #include <linux/gpio.h>
20
+#include <linux/gpio/machine.h>
3421 #include <linux/interrupt.h>
3522 #include <linux/irq.h>
3623 #include <linux/pda_power.h>
3724 #include <linux/power_supply.h>
3825 #include <linux/wm97xx.h>
3926 #include <linux/mtd/physmap.h>
40
-#include <linux/usb/gpio_vbus.h>
4127 #include <linux/reboot.h>
4228 #include <linux/regulator/fixed.h>
4329 #include <linux/regulator/max1586.h>
....@@ -190,7 +176,6 @@
190176 static struct platform_pwm_backlight_data mioa701_backlight_data = {
191177 .max_brightness = 100,
192178 .dft_brightness = 50,
193
- .enable_gpio = -1,
194179 };
195180
196181 /*
....@@ -381,10 +366,13 @@
381366 .gpio_pullup = GPIO22_USB_ENABLE,
382367 };
383368
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
+ },
388376 };
389377
390378 /*
....@@ -397,9 +385,22 @@
397385 static struct pxamci_platform_data mioa701_mci_info = {
398386 .detect_delay_ms = 250,
399387 .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
+ },
403404 };
404405
405406 /* FlashRAM */
....@@ -677,7 +678,7 @@
677678 MIO_SIMPLE_DEV(pxa2xx_pcm, "pxa2xx-pcm", NULL)
678679 MIO_SIMPLE_DEV(mioa701_sound, "mioa701-wm9713", NULL)
679680 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);
681682
682683 static struct platform_device *devices[] __initdata = {
683684 &mioa701_gpio_keys,
....@@ -743,12 +744,14 @@
743744 pr_err("MioA701: Failed to request GPIOs: %d", rc);
744745 bootstrap_init();
745746 pxa_set_fb_info(NULL, &mioa701_pxafb_info);
747
+ gpiod_add_lookup_table(&mioa701_mci_gpio_table);
746748 pxa_set_mci_info(&mioa701_mci_info);
747749 pxa_set_keypad_info(&mioa701_keypad_info);
748750 pxa_set_udc_info(&mioa701_udc_info);
749751 pxa_set_ac97_info(&mioa701_ac97_info);
750752 pm_power_off = mioa701_poweroff;
751753 pwm_add_table(mioa701_pwm_lookup, ARRAY_SIZE(mioa701_pwm_lookup));
754
+ gpiod_add_lookup_table(&gpio_vbus_gpiod_table);
752755 platform_add_devices(devices, ARRAY_SIZE(devices));
753756 gsm_init();
754757