| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * linux/arch/arm/mach-pxa/zylonite.c |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 7 | 8 | * |
|---|
| 8 | 9 | * 2007-09-04: eric miao <eric.miao@marvell.com> |
|---|
| 9 | 10 | * 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. |
|---|
| 14 | 11 | */ |
|---|
| 15 | 12 | |
|---|
| 16 | 13 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 19 | 16 | #include <linux/leds.h> |
|---|
| 20 | 17 | #include <linux/init.h> |
|---|
| 21 | 18 | #include <linux/platform_device.h> |
|---|
| 22 | | -#include <linux/gpio.h> |
|---|
| 19 | +#include <linux/gpio/machine.h> |
|---|
| 23 | 20 | #include <linux/pwm.h> |
|---|
| 24 | 21 | #include <linux/pwm_backlight.h> |
|---|
| 25 | 22 | #include <linux/smc91x.h> |
|---|
| .. | .. |
|---|
| 120 | 117 | static struct platform_pwm_backlight_data zylonite_backlight_data = { |
|---|
| 121 | 118 | .max_brightness = 100, |
|---|
| 122 | 119 | .dft_brightness = 100, |
|---|
| 123 | | - .enable_gpio = -1, |
|---|
| 124 | 120 | }; |
|---|
| 125 | 121 | |
|---|
| 126 | 122 | static struct platform_device zylonite_backlight_device = { |
|---|
| .. | .. |
|---|
| 227 | 223 | static struct pxamci_platform_data zylonite_mci_platform_data = { |
|---|
| 228 | 224 | .detect_delay_ms= 200, |
|---|
| 229 | 225 | .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 | + }, |
|---|
| 233 | 244 | }; |
|---|
| 234 | 245 | |
|---|
| 235 | 246 | static struct pxamci_platform_data zylonite_mci2_platform_data = { |
|---|
| 236 | 247 | .detect_delay_ms= 200, |
|---|
| 237 | 248 | .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 | + }, |
|---|
| 241 | 260 | }; |
|---|
| 242 | 261 | |
|---|
| 243 | 262 | static struct pxamci_platform_data zylonite_mci3_platform_data = { |
|---|
| 244 | 263 | .detect_delay_ms= 200, |
|---|
| 245 | 264 | .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 | + }, |
|---|
| 249 | 276 | }; |
|---|
| 250 | 277 | |
|---|
| 251 | 278 | static void __init zylonite_init_mmc(void) |
|---|
| 252 | 279 | { |
|---|
| 280 | + gpiod_add_lookup_table(&zylonite_mci_gpio_table); |
|---|
| 253 | 281 | pxa_set_mci_info(&zylonite_mci_platform_data); |
|---|
| 282 | + gpiod_add_lookup_table(&zylonite_mci2_gpio_table); |
|---|
| 254 | 283 | 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); |
|---|
| 256 | 286 | pxa3xx_set_mci3_info(&zylonite_mci3_platform_data); |
|---|
| 287 | + } |
|---|
| 257 | 288 | } |
|---|
| 258 | 289 | #else |
|---|
| 259 | 290 | static inline void zylonite_init_mmc(void) {} |
|---|