forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/arch/arm/mach-pxa/zylonite.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * linux/arch/arm/mach-pxa/zylonite.c
34 *
....@@ -7,10 +8,6 @@
78 *
89 * 2007-09-04: eric miao <eric.miao@marvell.com>
910 * rewrite to align with latest kernel
10
- *
11
- * This program is free software; you can redistribute it and/or modify
12
- * it under the terms of the GNU General Public License version 2 as
13
- * published by the Free Software Foundation.
1411 */
1512
1613 #include <linux/module.h>
....@@ -19,7 +16,7 @@
1916 #include <linux/leds.h>
2017 #include <linux/init.h>
2118 #include <linux/platform_device.h>
22
-#include <linux/gpio.h>
19
+#include <linux/gpio/machine.h>
2320 #include <linux/pwm.h>
2421 #include <linux/pwm_backlight.h>
2522 #include <linux/smc91x.h>
....@@ -120,7 +117,6 @@
120117 static struct platform_pwm_backlight_data zylonite_backlight_data = {
121118 .max_brightness = 100,
122119 .dft_brightness = 100,
123
- .enable_gpio = -1,
124120 };
125121
126122 static struct platform_device zylonite_backlight_device = {
....@@ -227,33 +223,68 @@
227223 static struct pxamci_platform_data zylonite_mci_platform_data = {
228224 .detect_delay_ms= 200,
229225 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
230
- .gpio_card_detect = EXT_GPIO(0),
231
- .gpio_card_ro = EXT_GPIO(2),
232
- .gpio_power = -1,
226
+};
227
+
228
+#define PCA9539A_MCI_CD 0
229
+#define PCA9539A_MCI1_CD 1
230
+#define PCA9539A_MCI_WP 2
231
+#define PCA9539A_MCI1_WP 3
232
+#define PCA9539A_MCI3_CD 30
233
+#define PCA9539A_MCI3_WP 31
234
+
235
+static struct gpiod_lookup_table zylonite_mci_gpio_table = {
236
+ .dev_id = "pxa2xx-mci.0",
237
+ .table = {
238
+ GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI_CD,
239
+ "cd", GPIO_ACTIVE_LOW),
240
+ GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI_WP,
241
+ "wp", GPIO_ACTIVE_LOW),
242
+ { },
243
+ },
233244 };
234245
235246 static struct pxamci_platform_data zylonite_mci2_platform_data = {
236247 .detect_delay_ms= 200,
237248 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
238
- .gpio_card_detect = EXT_GPIO(1),
239
- .gpio_card_ro = EXT_GPIO(3),
240
- .gpio_power = -1,
249
+};
250
+
251
+static struct gpiod_lookup_table zylonite_mci2_gpio_table = {
252
+ .dev_id = "pxa2xx-mci.1",
253
+ .table = {
254
+ GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI1_CD,
255
+ "cd", GPIO_ACTIVE_LOW),
256
+ GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI1_WP,
257
+ "wp", GPIO_ACTIVE_LOW),
258
+ { },
259
+ },
241260 };
242261
243262 static struct pxamci_platform_data zylonite_mci3_platform_data = {
244263 .detect_delay_ms= 200,
245264 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
246
- .gpio_card_detect = EXT_GPIO(30),
247
- .gpio_card_ro = EXT_GPIO(31),
248
- .gpio_power = -1,
265
+};
266
+
267
+static struct gpiod_lookup_table zylonite_mci3_gpio_table = {
268
+ .dev_id = "pxa2xx-mci.2",
269
+ .table = {
270
+ GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI3_CD,
271
+ "cd", GPIO_ACTIVE_LOW),
272
+ GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI3_WP,
273
+ "wp", GPIO_ACTIVE_LOW),
274
+ { },
275
+ },
249276 };
250277
251278 static void __init zylonite_init_mmc(void)
252279 {
280
+ gpiod_add_lookup_table(&zylonite_mci_gpio_table);
253281 pxa_set_mci_info(&zylonite_mci_platform_data);
282
+ gpiod_add_lookup_table(&zylonite_mci2_gpio_table);
254283 pxa3xx_set_mci2_info(&zylonite_mci2_platform_data);
255
- if (cpu_is_pxa310())
284
+ if (cpu_is_pxa310()) {
285
+ gpiod_add_lookup_table(&zylonite_mci3_gpio_table);
256286 pxa3xx_set_mci3_info(&zylonite_mci3_platform_data);
287
+ }
257288 }
258289 #else
259290 static inline void zylonite_init_mmc(void) {}