diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2016-08-31 03:49:48 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2018-04-06 10:53:00 -0400 |
commit | 80c799dbf88d0b404e1304b469eb157e4e9e0fbf (patch) | |
tree | 084defad3fe34bb8690ba9a2589b3a8abd630dd3 | |
parent | a00315d1b334d9f869975d53e3b3b3eb37c6c17e (diff) |
ARM: sa1100/nanoengine: convert to generic CF sockets
Convert nanoengine to use the generic CF socket support.
Makefile fix from Arnd Bergmann <arnd@arndb.de>.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r-- | arch/arm/mach-sa1100/nanoengine.c | 23 | ||||
-rw-r--r-- | drivers/pcmcia/Makefile | 1 | ||||
-rw-r--r-- | drivers/pcmcia/sa1100_generic.c | 3 | ||||
-rw-r--r-- | drivers/pcmcia/sa1100_generic.h | 1 | ||||
-rw-r--r-- | drivers/pcmcia/sa1100_nanoengine.c | 133 |
5 files changed, 23 insertions, 138 deletions
diff --git a/arch/arm/mach-sa1100/nanoengine.c b/arch/arm/mach-sa1100/nanoengine.c index f1cb3784d525..4d35258a7b32 100644 --- a/arch/arm/mach-sa1100/nanoengine.c +++ b/arch/arm/mach-sa1100/nanoengine.c | |||
@@ -12,6 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/gpio/machine.h> | ||
15 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
16 | #include <linux/platform_data/sa11x0-serial.h> | 17 | #include <linux/platform_data/sa11x0-serial.h> |
17 | #include <linux/mtd/mtd.h> | 18 | #include <linux/mtd/mtd.h> |
@@ -99,8 +100,30 @@ static void __init nanoengine_map_io(void) | |||
99 | Ser2HSCR0 = 0; | 100 | Ser2HSCR0 = 0; |
100 | } | 101 | } |
101 | 102 | ||
103 | static struct gpiod_lookup_table nanoengine_pcmcia0_gpio_table = { | ||
104 | .dev_id = "sa11x0-pcmcia.0", | ||
105 | .table = { | ||
106 | GPIO_LOOKUP("gpio", 11, "ready", GPIO_ACTIVE_HIGH), | ||
107 | GPIO_LOOKUP("gpio", 13, "detect", GPIO_ACTIVE_LOW), | ||
108 | GPIO_LOOKUP("gpio", 15, "reset", GPIO_ACTIVE_HIGH), | ||
109 | { }, | ||
110 | }, | ||
111 | }; | ||
112 | |||
113 | static struct gpiod_lookup_table nanoengine_pcmcia1_gpio_table = { | ||
114 | .dev_id = "sa11x0-pcmcia.1", | ||
115 | .table = { | ||
116 | GPIO_LOOKUP("gpio", 12, "ready", GPIO_ACTIVE_HIGH), | ||
117 | GPIO_LOOKUP("gpio", 14, "detect", GPIO_ACTIVE_LOW), | ||
118 | GPIO_LOOKUP("gpio", 16, "reset", GPIO_ACTIVE_HIGH), | ||
119 | { }, | ||
120 | }, | ||
121 | }; | ||
122 | |||
102 | static void __init nanoengine_init(void) | 123 | static void __init nanoengine_init(void) |
103 | { | 124 | { |
125 | sa11x0_register_pcmcia(0, &nanoengine_pcmcia0_gpio_table); | ||
126 | sa11x0_register_pcmcia(1, &nanoengine_pcmcia1_gpio_table); | ||
104 | sa11x0_register_mtd(&nanoengine_flash_data, nanoengine_flash_resources, | 127 | sa11x0_register_mtd(&nanoengine_flash_data, nanoengine_flash_resources, |
105 | ARRAY_SIZE(nanoengine_flash_resources)); | 128 | ARRAY_SIZE(nanoengine_flash_resources)); |
106 | } | 129 | } |
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index da31af9b3158..722871ac51b4 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile | |||
@@ -49,7 +49,6 @@ sa1100_cs-y += sa1100_generic.o | |||
49 | sa1100_cs-$(CONFIG_SA1100_COLLIE) += pxa2xx_sharpsl.o | 49 | sa1100_cs-$(CONFIG_SA1100_COLLIE) += pxa2xx_sharpsl.o |
50 | sa1100_cs-$(CONFIG_SA1100_H3100) += sa1100_h3600.o | 50 | sa1100_cs-$(CONFIG_SA1100_H3100) += sa1100_h3600.o |
51 | sa1100_cs-$(CONFIG_SA1100_H3600) += sa1100_h3600.o | 51 | sa1100_cs-$(CONFIG_SA1100_H3600) += sa1100_h3600.o |
52 | sa1100_cs-$(CONFIG_SA1100_NANOENGINE) += sa1100_nanoengine.o | ||
53 | sa1100_cs-$(CONFIG_SA1100_SHANNON) += sa1100_shannon.o | 52 | sa1100_cs-$(CONFIG_SA1100_SHANNON) += sa1100_shannon.o |
54 | sa1100_cs-$(CONFIG_SA1100_SIMPAD) += sa1100_simpad.o | 53 | sa1100_cs-$(CONFIG_SA1100_SIMPAD) += sa1100_simpad.o |
55 | 54 | ||
diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c index 110365e998b8..59a670f330b7 100644 --- a/drivers/pcmcia/sa1100_generic.c +++ b/drivers/pcmcia/sa1100_generic.c | |||
@@ -101,9 +101,6 @@ static int (*sa11x0_pcmcia_legacy_hw_init[])(struct device *dev) = { | |||
101 | #if defined(CONFIG_SA1100_H3100) || defined(CONFIG_SA1100_H3600) | 101 | #if defined(CONFIG_SA1100_H3100) || defined(CONFIG_SA1100_H3600) |
102 | pcmcia_h3600_init, | 102 | pcmcia_h3600_init, |
103 | #endif | 103 | #endif |
104 | #ifdef CONFIG_SA1100_NANOENGINE | ||
105 | pcmcia_nanoengine_init, | ||
106 | #endif | ||
107 | #ifdef CONFIG_SA1100_SHANNON | 104 | #ifdef CONFIG_SA1100_SHANNON |
108 | pcmcia_shannon_init, | 105 | pcmcia_shannon_init, |
109 | #endif | 106 | #endif |
diff --git a/drivers/pcmcia/sa1100_generic.h b/drivers/pcmcia/sa1100_generic.h index bce9e73a4651..1e255c173cd8 100644 --- a/drivers/pcmcia/sa1100_generic.h +++ b/drivers/pcmcia/sa1100_generic.h | |||
@@ -12,7 +12,6 @@ extern int pcmcia_freebird_init(struct device *); | |||
12 | extern int pcmcia_gcplus_init(struct device *); | 12 | extern int pcmcia_gcplus_init(struct device *); |
13 | extern int pcmcia_graphicsmaster_init(struct device *); | 13 | extern int pcmcia_graphicsmaster_init(struct device *); |
14 | extern int pcmcia_h3600_init(struct device *); | 14 | extern int pcmcia_h3600_init(struct device *); |
15 | extern int pcmcia_nanoengine_init(struct device *); | ||
16 | extern int pcmcia_pangolin_init(struct device *); | 15 | extern int pcmcia_pangolin_init(struct device *); |
17 | extern int pcmcia_pfs168_init(struct device *); | 16 | extern int pcmcia_pfs168_init(struct device *); |
18 | extern int pcmcia_shannon_init(struct device *); | 17 | extern int pcmcia_shannon_init(struct device *); |
diff --git a/drivers/pcmcia/sa1100_nanoengine.c b/drivers/pcmcia/sa1100_nanoengine.c deleted file mode 100644 index 35c30ff41e81..000000000000 --- a/drivers/pcmcia/sa1100_nanoengine.c +++ /dev/null | |||
@@ -1,133 +0,0 @@ | |||
1 | /* | ||
2 | * drivers/pcmcia/sa1100_nanoengine.c | ||
3 | * | ||
4 | * PCMCIA implementation routines for BSI nanoEngine. | ||
5 | * | ||
6 | * In order to have a fully functional pcmcia subsystem in a BSE nanoEngine | ||
7 | * board you should carefully read this: | ||
8 | * http://cambuca.ldhs.cetuc.puc-rio.br/nanoengine/ | ||
9 | * | ||
10 | * Copyright (C) 2010 Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br> | ||
11 | * | ||
12 | * Based on original work for kernel 2.4 by | ||
13 | * Miguel Freitas <miguel@cpti.cetuc.puc-rio.br> | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify | ||
16 | * it under the terms of the GNU General Public License version 2 as | ||
17 | * published by the Free Software Foundation. | ||
18 | * | ||
19 | */ | ||
20 | #include <linux/device.h> | ||
21 | #include <linux/errno.h> | ||
22 | #include <linux/gpio.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | #include <linux/irq.h> | ||
25 | #include <linux/init.h> | ||
26 | #include <linux/kernel.h> | ||
27 | #include <linux/module.h> | ||
28 | #include <linux/signal.h> | ||
29 | |||
30 | #include <asm/mach-types.h> | ||
31 | #include <asm/irq.h> | ||
32 | |||
33 | #include <mach/hardware.h> | ||
34 | #include <mach/nanoengine.h> | ||
35 | |||
36 | #include "sa1100_generic.h" | ||
37 | |||
38 | struct nanoengine_pins { | ||
39 | unsigned output_pins; | ||
40 | unsigned clear_outputs; | ||
41 | int gpio_rst; | ||
42 | int gpio_cd; | ||
43 | int gpio_rdy; | ||
44 | }; | ||
45 | |||
46 | static struct nanoengine_pins nano_skts[] = { | ||
47 | { | ||
48 | .gpio_rst = GPIO_PC_RESET0, | ||
49 | .gpio_cd = GPIO_PC_CD0, | ||
50 | .gpio_rdy = GPIO_PC_READY0, | ||
51 | }, { | ||
52 | .gpio_rst = GPIO_PC_RESET1, | ||
53 | .gpio_cd = GPIO_PC_CD1, | ||
54 | .gpio_rdy = GPIO_PC_READY1, | ||
55 | } | ||
56 | }; | ||
57 | |||
58 | unsigned num_nano_pcmcia_sockets = ARRAY_SIZE(nano_skts); | ||
59 | |||
60 | static int nanoengine_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | ||
61 | { | ||
62 | unsigned i = skt->nr; | ||
63 | int ret; | ||
64 | |||
65 | if (i >= num_nano_pcmcia_sockets) | ||
66 | return -ENXIO; | ||
67 | |||
68 | ret = gpio_request_one(nano_skts[i].gpio_rst, GPIOF_OUT_INIT_LOW, | ||
69 | i ? "PC RST1" : "PC RST0"); | ||
70 | if (ret) | ||
71 | return ret; | ||
72 | |||
73 | skt->stat[SOC_STAT_CD].gpio = nano_skts[i].gpio_cd; | ||
74 | skt->stat[SOC_STAT_CD].name = i ? "PC CD1" : "PC CD0"; | ||
75 | skt->stat[SOC_STAT_RDY].gpio = nano_skts[i].gpio_rdy; | ||
76 | skt->stat[SOC_STAT_RDY].name = i ? "PC RDY1" : "PC RDY0"; | ||
77 | |||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | static void nanoengine_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | ||
82 | { | ||
83 | gpio_free(nano_skts[skt->nr].gpio_rst); | ||
84 | } | ||
85 | |||
86 | static int nanoengine_pcmcia_configure_socket( | ||
87 | struct soc_pcmcia_socket *skt, const socket_state_t *state) | ||
88 | { | ||
89 | unsigned i = skt->nr; | ||
90 | |||
91 | if (i >= num_nano_pcmcia_sockets) | ||
92 | return -ENXIO; | ||
93 | |||
94 | gpio_set_value(nano_skts[skt->nr].gpio_rst, !!(state->flags & SS_RESET)); | ||
95 | |||
96 | return 0; | ||
97 | } | ||
98 | |||
99 | static void nanoengine_pcmcia_socket_state( | ||
100 | struct soc_pcmcia_socket *skt, struct pcmcia_state *state) | ||
101 | { | ||
102 | unsigned i = skt->nr; | ||
103 | |||
104 | if (i >= num_nano_pcmcia_sockets) | ||
105 | return; | ||
106 | |||
107 | state->bvd1 = 1; | ||
108 | state->bvd2 = 1; | ||
109 | state->vs_3v = 1; /* Can only apply 3.3V */ | ||
110 | state->vs_Xv = 0; | ||
111 | } | ||
112 | |||
113 | static struct pcmcia_low_level nanoengine_pcmcia_ops = { | ||
114 | .owner = THIS_MODULE, | ||
115 | |||
116 | .hw_init = nanoengine_pcmcia_hw_init, | ||
117 | .hw_shutdown = nanoengine_pcmcia_hw_shutdown, | ||
118 | |||
119 | .configure_socket = nanoengine_pcmcia_configure_socket, | ||
120 | .socket_state = nanoengine_pcmcia_socket_state, | ||
121 | }; | ||
122 | |||
123 | int pcmcia_nanoengine_init(struct device *dev) | ||
124 | { | ||
125 | int ret = -ENODEV; | ||
126 | |||
127 | if (machine_is_nanoengine()) | ||
128 | ret = sa11xx_drv_pcmcia_probe( | ||
129 | dev, &nanoengine_pcmcia_ops, 0, 2); | ||
130 | |||
131 | return ret; | ||
132 | } | ||
133 | |||