diff options
| author | Russell King <rmk+kernel@armlinux.org.uk> | 2016-08-31 03:49:47 -0400 |
|---|---|---|
| committer | Russell King <rmk+kernel@armlinux.org.uk> | 2018-03-24 10:17:08 -0400 |
| commit | 780febd5b709fd9db80830ea656de96bbe3e5001 (patch) | |
| tree | b943d3bec7901264f84342b11b4ac31dcb20038e | |
| parent | 29786e9b6551b822de66aa64b07e21eeb36ded89 (diff) | |
ARM: sa1100/cerf: convert to generic CF sockets
Convert Cerf to use the generic CF socket support.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
| -rw-r--r-- | arch/arm/mach-sa1100/cerf.c | 18 | ||||
| -rw-r--r-- | drivers/pcmcia/Makefile | 1 | ||||
| -rw-r--r-- | drivers/pcmcia/sa1100_cerf.c | 86 | ||||
| -rw-r--r-- | drivers/pcmcia/sa1100_generic.c | 3 | ||||
| -rw-r--r-- | drivers/pcmcia/sa1100_generic.h | 1 |
5 files changed, 15 insertions, 94 deletions
diff --git a/arch/arm/mach-sa1100/cerf.c b/arch/arm/mach-sa1100/cerf.c index 2d25ececb415..b2a4b41626ef 100644 --- a/arch/arm/mach-sa1100/cerf.c +++ b/arch/arm/mach-sa1100/cerf.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
| 14 | #include <linux/gpio/machine.h> | ||
| 14 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
| 15 | #include <linux/tty.h> | 16 | #include <linux/tty.h> |
| 16 | #include <linux/platform_data/sa11x0-serial.h> | 17 | #include <linux/platform_data/sa11x0-serial.h> |
| @@ -45,6 +46,19 @@ static struct platform_device cerfuart2_device = { | |||
| 45 | .resource = cerfuart2_resources, | 46 | .resource = cerfuart2_resources, |
| 46 | }; | 47 | }; |
| 47 | 48 | ||
| 49 | /* Compact Flash */ | ||
| 50 | static struct gpiod_lookup_table cerf_cf_gpio_table = { | ||
| 51 | .dev_id = "sa11x0-pcmcia.1", | ||
| 52 | .table = { | ||
| 53 | GPIO_LOOKUP("gpio", 19, "bvd2", GPIO_ACTIVE_HIGH), | ||
| 54 | GPIO_LOOKUP("gpio", 20, "bvd1", GPIO_ACTIVE_HIGH), | ||
| 55 | GPIO_LOOKUP("gpio", 21, "reset", GPIO_ACTIVE_HIGH), | ||
| 56 | GPIO_LOOKUP("gpio", 22, "ready", GPIO_ACTIVE_HIGH), | ||
| 57 | GPIO_LOOKUP("gpio", 23, "detect", GPIO_ACTIVE_LOW), | ||
| 58 | { }, | ||
| 59 | }, | ||
| 60 | }; | ||
| 61 | |||
| 48 | /* LEDs */ | 62 | /* LEDs */ |
| 49 | struct gpio_led cerf_gpio_leds[] = { | 63 | struct gpio_led cerf_gpio_leds[] = { |
| 50 | { | 64 | { |
| @@ -151,9 +165,6 @@ static void __init cerf_map_io(void) | |||
| 151 | sa1100_register_uart(0, 3); | 165 | sa1100_register_uart(0, 3); |
| 152 | sa1100_register_uart(1, 2); /* disable this and the uart2 device for sa1100_fir */ | 166 | sa1100_register_uart(1, 2); /* disable this and the uart2 device for sa1100_fir */ |
| 153 | sa1100_register_uart(2, 1); | 167 | sa1100_register_uart(2, 1); |
| 154 | |||
| 155 | /* set some GPDR bits here while it's safe */ | ||
| 156 | GPDR |= CERF_GPIO_CF_RESET; | ||
| 157 | } | 168 | } |
| 158 | 169 | ||
| 159 | static struct mcp_plat_data cerf_mcp_data = { | 170 | static struct mcp_plat_data cerf_mcp_data = { |
| @@ -167,6 +178,7 @@ static void __init cerf_init(void) | |||
| 167 | platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices)); | 178 | platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices)); |
| 168 | sa11x0_register_mtd(&cerf_flash_data, &cerf_flash_resource, 1); | 179 | sa11x0_register_mtd(&cerf_flash_data, &cerf_flash_resource, 1); |
| 169 | sa11x0_register_mcp(&cerf_mcp_data); | 180 | sa11x0_register_mcp(&cerf_mcp_data); |
| 181 | sa11x0_register_pcmcia(1, &cerf_cf_gpio_table); | ||
| 170 | } | 182 | } |
| 171 | 183 | ||
| 172 | MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube") | 184 | MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube") |
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index 130a06649b41..da31af9b3158 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile | |||
| @@ -46,7 +46,6 @@ sa1111_cs-$(CONFIG_SA1100_JORNADA720) += sa1111_jornada720.o | |||
| 46 | sa1111_cs-$(CONFIG_ARCH_LUBBOCK) += sa1111_lubbock.o | 46 | sa1111_cs-$(CONFIG_ARCH_LUBBOCK) += sa1111_lubbock.o |
| 47 | 47 | ||
| 48 | sa1100_cs-y += sa1100_generic.o | 48 | sa1100_cs-y += sa1100_generic.o |
| 49 | sa1100_cs-$(CONFIG_SA1100_CERF) += sa1100_cerf.o | ||
| 50 | sa1100_cs-$(CONFIG_SA1100_COLLIE) += pxa2xx_sharpsl.o | 49 | sa1100_cs-$(CONFIG_SA1100_COLLIE) += pxa2xx_sharpsl.o |
| 51 | sa1100_cs-$(CONFIG_SA1100_H3100) += sa1100_h3600.o | 50 | sa1100_cs-$(CONFIG_SA1100_H3100) += sa1100_h3600.o |
| 52 | sa1100_cs-$(CONFIG_SA1100_H3600) += sa1100_h3600.o | 51 | sa1100_cs-$(CONFIG_SA1100_H3600) += sa1100_h3600.o |
diff --git a/drivers/pcmcia/sa1100_cerf.c b/drivers/pcmcia/sa1100_cerf.c deleted file mode 100644 index 2a54081d161d..000000000000 --- a/drivers/pcmcia/sa1100_cerf.c +++ /dev/null | |||
| @@ -1,86 +0,0 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 2 | /* | ||
| 3 | * drivers/pcmcia/sa1100_cerf.c | ||
| 4 | * | ||
| 5 | * PCMCIA implementation routines for CerfBoard | ||
| 6 | * Based off the Assabet. | ||
| 7 | * | ||
| 8 | */ | ||
| 9 | #include <linux/module.h> | ||
| 10 | #include <linux/kernel.h> | ||
| 11 | #include <linux/device.h> | ||
| 12 | #include <linux/init.h> | ||
| 13 | #include <linux/delay.h> | ||
| 14 | #include <linux/gpio.h> | ||
| 15 | |||
| 16 | #include <mach/hardware.h> | ||
| 17 | #include <asm/mach-types.h> | ||
| 18 | #include <asm/irq.h> | ||
| 19 | #include <mach/cerf.h> | ||
| 20 | #include "sa1100_generic.h" | ||
| 21 | |||
| 22 | #define CERF_SOCKET 1 | ||
| 23 | |||
| 24 | static int cerf_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | ||
| 25 | { | ||
| 26 | int ret; | ||
| 27 | |||
| 28 | ret = gpio_request_one(CERF_GPIO_CF_RESET, GPIOF_OUT_INIT_LOW, "CF_RESET"); | ||
| 29 | if (ret) | ||
| 30 | return ret; | ||
| 31 | |||
| 32 | skt->stat[SOC_STAT_CD].gpio = CERF_GPIO_CF_CD; | ||
| 33 | skt->stat[SOC_STAT_CD].name = "CF_CD"; | ||
| 34 | skt->stat[SOC_STAT_BVD1].gpio = CERF_GPIO_CF_BVD1; | ||
| 35 | skt->stat[SOC_STAT_BVD1].name = "CF_BVD1"; | ||
| 36 | skt->stat[SOC_STAT_BVD2].gpio = CERF_GPIO_CF_BVD2; | ||
| 37 | skt->stat[SOC_STAT_BVD2].name = "CF_BVD2"; | ||
| 38 | skt->stat[SOC_STAT_RDY].gpio = CERF_GPIO_CF_IRQ; | ||
| 39 | skt->stat[SOC_STAT_RDY].name = "CF_IRQ"; | ||
| 40 | |||
| 41 | return 0; | ||
| 42 | } | ||
| 43 | |||
| 44 | static void cerf_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | ||
| 45 | { | ||
| 46 | gpio_free(CERF_GPIO_CF_RESET); | ||
| 47 | } | ||
| 48 | |||
| 49 | static int | ||
| 50 | cerf_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | ||
| 51 | const socket_state_t *state) | ||
| 52 | { | ||
| 53 | switch (state->Vcc) { | ||
| 54 | case 0: | ||
| 55 | case 50: | ||
| 56 | case 33: | ||
| 57 | break; | ||
| 58 | |||
| 59 | default: | ||
| 60 | printk(KERN_ERR "%s(): unrecognized Vcc %u\n", | ||
| 61 | __func__, state->Vcc); | ||
| 62 | return -1; | ||
| 63 | } | ||
| 64 | |||
| 65 | gpio_set_value(CERF_GPIO_CF_RESET, !!(state->flags & SS_RESET)); | ||
| 66 | |||
| 67 | return 0; | ||
| 68 | } | ||
| 69 | |||
| 70 | static struct pcmcia_low_level cerf_pcmcia_ops = { | ||
| 71 | .owner = THIS_MODULE, | ||
| 72 | .hw_init = cerf_pcmcia_hw_init, | ||
| 73 | .hw_shutdown = cerf_pcmcia_hw_shutdown, | ||
| 74 | .socket_state = soc_common_cf_socket_state, | ||
| 75 | .configure_socket = cerf_pcmcia_configure_socket, | ||
| 76 | }; | ||
| 77 | |||
| 78 | int pcmcia_cerf_init(struct device *dev) | ||
| 79 | { | ||
| 80 | int ret = -ENODEV; | ||
| 81 | |||
| 82 | if (machine_is_cerf()) | ||
| 83 | ret = sa11xx_drv_pcmcia_probe(dev, &cerf_pcmcia_ops, CERF_SOCKET, 1); | ||
| 84 | |||
| 85 | return ret; | ||
| 86 | } | ||
diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c index 1987d94361e9..110365e998b8 100644 --- a/drivers/pcmcia/sa1100_generic.c +++ b/drivers/pcmcia/sa1100_generic.c | |||
| @@ -98,9 +98,6 @@ static struct pcmcia_low_level sa11x0_cf_ops = { | |||
| 98 | int __init pcmcia_collie_init(struct device *dev); | 98 | int __init pcmcia_collie_init(struct device *dev); |
| 99 | 99 | ||
| 100 | static int (*sa11x0_pcmcia_legacy_hw_init[])(struct device *dev) = { | 100 | static int (*sa11x0_pcmcia_legacy_hw_init[])(struct device *dev) = { |
| 101 | #ifdef CONFIG_SA1100_CERF | ||
| 102 | pcmcia_cerf_init, | ||
| 103 | #endif | ||
| 104 | #if defined(CONFIG_SA1100_H3100) || defined(CONFIG_SA1100_H3600) | 101 | #if defined(CONFIG_SA1100_H3100) || defined(CONFIG_SA1100_H3600) |
| 105 | pcmcia_h3600_init, | 102 | pcmcia_h3600_init, |
| 106 | #endif | 103 | #endif |
diff --git a/drivers/pcmcia/sa1100_generic.h b/drivers/pcmcia/sa1100_generic.h index 597c796f7dad..bce9e73a4651 100644 --- a/drivers/pcmcia/sa1100_generic.h +++ b/drivers/pcmcia/sa1100_generic.h | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | */ | 7 | */ |
| 8 | extern int pcmcia_adsbitsy_init(struct device *); | 8 | extern int pcmcia_adsbitsy_init(struct device *); |
| 9 | extern int pcmcia_badge4_init(struct device *); | 9 | extern int pcmcia_badge4_init(struct device *); |
| 10 | extern int pcmcia_cerf_init(struct device *); | ||
| 11 | extern int pcmcia_flexanet_init(struct device *); | 10 | extern int pcmcia_flexanet_init(struct device *); |
| 12 | extern int pcmcia_freebird_init(struct device *); | 11 | extern int pcmcia_freebird_init(struct device *); |
| 13 | extern int pcmcia_gcplus_init(struct device *); | 12 | extern int pcmcia_gcplus_init(struct device *); |
