.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * linux/arch/arm/mach-pxa/mainstone.c |
---|
3 | 4 | * |
---|
.. | .. |
---|
7 | 8 | * Author: Nicolas Pitre |
---|
8 | 9 | * Created: Nov 05, 2002 |
---|
9 | 10 | * Copyright: MontaVista Software Inc. |
---|
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 | #include <linux/gpio.h> |
---|
| 13 | +#include <linux/gpio/gpio-reg.h> |
---|
16 | 14 | #include <linux/gpio/machine.h> |
---|
17 | 15 | #include <linux/init.h> |
---|
18 | 16 | #include <linux/platform_device.h> |
---|
.. | .. |
---|
39 | 37 | #include <asm/mach-types.h> |
---|
40 | 38 | #include <mach/hardware.h> |
---|
41 | 39 | #include <asm/irq.h> |
---|
42 | | -#include <asm/sizes.h> |
---|
| 40 | +#include <linux/sizes.h> |
---|
43 | 41 | |
---|
44 | 42 | #include <asm/mach/arch.h> |
---|
45 | 43 | #include <asm/mach/map.h> |
---|
.. | .. |
---|
258 | 256 | static struct platform_pwm_backlight_data mainstone_backlight_data = { |
---|
259 | 257 | .max_brightness = 1023, |
---|
260 | 258 | .dft_brightness = 1023, |
---|
261 | | - .enable_gpio = -1, |
---|
262 | 259 | }; |
---|
263 | 260 | |
---|
264 | 261 | static struct platform_device mainstone_backlight_device = { |
---|
.. | .. |
---|
361 | 358 | .init = mainstone_mci_init, |
---|
362 | 359 | .setpower = mainstone_mci_setpower, |
---|
363 | 360 | .exit = mainstone_mci_exit, |
---|
364 | | - .gpio_card_detect = -1, |
---|
365 | | - .gpio_card_ro = -1, |
---|
366 | | - .gpio_power = -1, |
---|
367 | 361 | }; |
---|
368 | 362 | |
---|
369 | 363 | static void mainstone_irda_transceiver_mode(struct device *dev, int mode) |
---|
.. | .. |
---|
507 | 501 | static inline void mainstone_init_keypad(void) {} |
---|
508 | 502 | #endif |
---|
509 | 503 | |
---|
| 504 | +static int mst_pcmcia0_irqs[11] = { |
---|
| 505 | + [0 ... 10] = -1, |
---|
| 506 | + [5] = MAINSTONE_S0_CD_IRQ, |
---|
| 507 | + [8] = MAINSTONE_S0_STSCHG_IRQ, |
---|
| 508 | + [10] = MAINSTONE_S0_IRQ, |
---|
| 509 | +}; |
---|
| 510 | + |
---|
| 511 | +static int mst_pcmcia1_irqs[11] = { |
---|
| 512 | + [0 ... 10] = -1, |
---|
| 513 | + [5] = MAINSTONE_S1_CD_IRQ, |
---|
| 514 | + [8] = MAINSTONE_S1_STSCHG_IRQ, |
---|
| 515 | + [10] = MAINSTONE_S1_IRQ, |
---|
| 516 | +}; |
---|
| 517 | + |
---|
| 518 | +static struct gpiod_lookup_table mainstone_pcmcia_gpio_table = { |
---|
| 519 | + .dev_id = "pxa2xx-pcmcia", |
---|
| 520 | + .table = { |
---|
| 521 | + GPIO_LOOKUP("mst-pcmcia0", 0, "a0vpp", GPIO_ACTIVE_HIGH), |
---|
| 522 | + GPIO_LOOKUP("mst-pcmcia0", 1, "a1vpp", GPIO_ACTIVE_HIGH), |
---|
| 523 | + GPIO_LOOKUP("mst-pcmcia0", 2, "a0vcc", GPIO_ACTIVE_HIGH), |
---|
| 524 | + GPIO_LOOKUP("mst-pcmcia0", 3, "a1vcc", GPIO_ACTIVE_HIGH), |
---|
| 525 | + GPIO_LOOKUP("mst-pcmcia0", 4, "areset", GPIO_ACTIVE_HIGH), |
---|
| 526 | + GPIO_LOOKUP("mst-pcmcia0", 5, "adetect", GPIO_ACTIVE_LOW), |
---|
| 527 | + GPIO_LOOKUP("mst-pcmcia0", 6, "avs1", GPIO_ACTIVE_LOW), |
---|
| 528 | + GPIO_LOOKUP("mst-pcmcia0", 7, "avs2", GPIO_ACTIVE_LOW), |
---|
| 529 | + GPIO_LOOKUP("mst-pcmcia0", 8, "abvd1", GPIO_ACTIVE_HIGH), |
---|
| 530 | + GPIO_LOOKUP("mst-pcmcia0", 9, "abvd2", GPIO_ACTIVE_HIGH), |
---|
| 531 | + GPIO_LOOKUP("mst-pcmcia0", 10, "aready", GPIO_ACTIVE_HIGH), |
---|
| 532 | + GPIO_LOOKUP("mst-pcmcia1", 0, "b0vpp", GPIO_ACTIVE_HIGH), |
---|
| 533 | + GPIO_LOOKUP("mst-pcmcia1", 1, "b1vpp", GPIO_ACTIVE_HIGH), |
---|
| 534 | + GPIO_LOOKUP("mst-pcmcia1", 2, "b0vcc", GPIO_ACTIVE_HIGH), |
---|
| 535 | + GPIO_LOOKUP("mst-pcmcia1", 3, "b1vcc", GPIO_ACTIVE_HIGH), |
---|
| 536 | + GPIO_LOOKUP("mst-pcmcia1", 4, "breset", GPIO_ACTIVE_HIGH), |
---|
| 537 | + GPIO_LOOKUP("mst-pcmcia1", 5, "bdetect", GPIO_ACTIVE_LOW), |
---|
| 538 | + GPIO_LOOKUP("mst-pcmcia1", 6, "bvs1", GPIO_ACTIVE_LOW), |
---|
| 539 | + GPIO_LOOKUP("mst-pcmcia1", 7, "bvs2", GPIO_ACTIVE_LOW), |
---|
| 540 | + GPIO_LOOKUP("mst-pcmcia1", 8, "bbvd1", GPIO_ACTIVE_HIGH), |
---|
| 541 | + GPIO_LOOKUP("mst-pcmcia1", 9, "bbvd2", GPIO_ACTIVE_HIGH), |
---|
| 542 | + GPIO_LOOKUP("mst-pcmcia1", 10, "bready", GPIO_ACTIVE_HIGH), |
---|
| 543 | + { }, |
---|
| 544 | + }, |
---|
| 545 | +}; |
---|
| 546 | + |
---|
510 | 547 | static void __init mainstone_init(void) |
---|
511 | 548 | { |
---|
512 | 549 | int SW7 = 0; /* FIXME: get from SCR (Mst doc section 3.2.1.1) */ |
---|
513 | 550 | |
---|
514 | 551 | pxa2xx_mfp_config(ARRAY_AND_SIZE(mainstone_pin_config)); |
---|
515 | 552 | |
---|
| 553 | + /* Register board control register(s) as GPIOs */ |
---|
| 554 | + gpio_reg_init(NULL, (void __iomem *)&MST_PCMCIA0, -1, 11, |
---|
| 555 | + "mst-pcmcia0", MST_PCMCIA_INPUTS, 0, NULL, |
---|
| 556 | + NULL, mst_pcmcia0_irqs); |
---|
| 557 | + gpio_reg_init(NULL, (void __iomem *)&MST_PCMCIA1, -1, 11, |
---|
| 558 | + "mst-pcmcia1", MST_PCMCIA_INPUTS, 0, NULL, |
---|
| 559 | + NULL, mst_pcmcia1_irqs); |
---|
| 560 | + gpiod_add_lookup_table(&mainstone_pcmcia_gpio_table); |
---|
| 561 | + |
---|
516 | 562 | pxa_set_ffuart_info(NULL); |
---|
517 | 563 | pxa_set_btuart_info(NULL); |
---|
518 | 564 | pxa_set_stuart_info(NULL); |
---|