diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2007-10-15 13:55:44 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2007-10-15 13:56:02 -0400 |
commit | 0181b61a988424b5cc44fe09e6968142359c815e (patch) | |
tree | 2575ee900a39ffaa169ad5aeb8aa6ddee11cfbe5 /drivers/pcmcia | |
parent | 92633b72d18ca4f25de1f28e436a882159491e7e (diff) | |
parent | 87944f3361fc033b73617aa663135c6e468957a7 (diff) |
Merge branch 'pxa' into devel
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r-- | drivers/pcmcia/Makefile | 1 | ||||
-rw-r--r-- | drivers/pcmcia/pxa2xx_cm_x270.c | 175 | ||||
-rw-r--r-- | drivers/pcmcia/pxa2xx_lubbock.c | 31 | ||||
-rw-r--r-- | drivers/pcmcia/pxa2xx_mainstone.c | 18 |
4 files changed, 177 insertions, 48 deletions
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index 4276965517f2..dc7a4cb5d270 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile | |||
@@ -69,4 +69,5 @@ sa1100_cs-$(CONFIG_SA1100_SIMPAD) += sa1100_simpad.o | |||
69 | pxa2xx_cs-$(CONFIG_ARCH_LUBBOCK) += pxa2xx_lubbock.o sa1111_generic.o | 69 | pxa2xx_cs-$(CONFIG_ARCH_LUBBOCK) += pxa2xx_lubbock.o sa1111_generic.o |
70 | pxa2xx_cs-$(CONFIG_MACH_MAINSTONE) += pxa2xx_mainstone.o | 70 | pxa2xx_cs-$(CONFIG_MACH_MAINSTONE) += pxa2xx_mainstone.o |
71 | pxa2xx_cs-$(CONFIG_PXA_SHARPSL) += pxa2xx_sharpsl.o | 71 | pxa2xx_cs-$(CONFIG_PXA_SHARPSL) += pxa2xx_sharpsl.o |
72 | pxa2xx_cs-$(CONFIG_MACH_ARMCORE) += pxa2xx_cm_x270.o | ||
72 | 73 | ||
diff --git a/drivers/pcmcia/pxa2xx_cm_x270.c b/drivers/pcmcia/pxa2xx_cm_x270.c new file mode 100644 index 000000000000..fbf2f3a6984c --- /dev/null +++ b/drivers/pcmcia/pxa2xx_cm_x270.c | |||
@@ -0,0 +1,175 @@ | |||
1 | /* | ||
2 | * linux/drivers/pcmcia/pxa/pxa_cm_x270.c | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * Compulab Ltd., 2003, 2007 | ||
9 | * Mike Rapoport <mike@compulab.co.il> | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/sched.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/irq.h> | ||
17 | #include <linux/delay.h> | ||
18 | |||
19 | #include <pcmcia/ss.h> | ||
20 | #include <asm/hardware.h> | ||
21 | |||
22 | #include <asm/arch/pxa-regs.h> | ||
23 | #include <asm/arch/cm-x270.h> | ||
24 | |||
25 | #include "soc_common.h" | ||
26 | |||
27 | static struct pcmcia_irqs irqs[] = { | ||
28 | { 0, PCMCIA_S0_CD_VALID, "PCMCIA0 CD" }, | ||
29 | { 1, PCMCIA_S1_CD_VALID, "PCMCIA1 CD" }, | ||
30 | }; | ||
31 | |||
32 | static int cmx270_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | ||
33 | { | ||
34 | GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) | | ||
35 | GPIO_bit(GPIO49_nPWE) | | ||
36 | GPIO_bit(GPIO50_nPIOR) | | ||
37 | GPIO_bit(GPIO51_nPIOW) | | ||
38 | GPIO_bit(GPIO85_nPCE_1) | | ||
39 | GPIO_bit(GPIO54_nPCE_2); | ||
40 | |||
41 | pxa_gpio_mode(GPIO48_nPOE_MD); | ||
42 | pxa_gpio_mode(GPIO49_nPWE_MD); | ||
43 | pxa_gpio_mode(GPIO50_nPIOR_MD); | ||
44 | pxa_gpio_mode(GPIO51_nPIOW_MD); | ||
45 | pxa_gpio_mode(GPIO85_nPCE_1_MD); | ||
46 | pxa_gpio_mode(GPIO54_nPCE_2_MD); | ||
47 | pxa_gpio_mode(GPIO55_nPREG_MD); | ||
48 | pxa_gpio_mode(GPIO56_nPWAIT_MD); | ||
49 | pxa_gpio_mode(GPIO57_nIOIS16_MD); | ||
50 | |||
51 | /* Reset signal */ | ||
52 | pxa_gpio_mode(GPIO53_nPCE_2 | GPIO_OUT); | ||
53 | GPCR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2); | ||
54 | |||
55 | set_irq_type(PCMCIA_S0_CD_VALID, IRQ_TYPE_EDGE_BOTH); | ||
56 | set_irq_type(PCMCIA_S1_CD_VALID, IRQ_TYPE_EDGE_BOTH); | ||
57 | |||
58 | /* irq's for slots: */ | ||
59 | set_irq_type(PCMCIA_S0_RDYINT, IRQ_TYPE_EDGE_FALLING); | ||
60 | set_irq_type(PCMCIA_S1_RDYINT, IRQ_TYPE_EDGE_FALLING); | ||
61 | |||
62 | skt->irq = (skt->nr == 0) ? PCMCIA_S0_RDYINT : PCMCIA_S1_RDYINT; | ||
63 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
64 | } | ||
65 | |||
66 | static void cmx270_pcmcia_shutdown(struct soc_pcmcia_socket *skt) | ||
67 | { | ||
68 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
69 | |||
70 | set_irq_type(IRQ_TO_GPIO(PCMCIA_S0_CD_VALID), IRQ_TYPE_NONE); | ||
71 | set_irq_type(IRQ_TO_GPIO(PCMCIA_S1_CD_VALID), IRQ_TYPE_NONE); | ||
72 | |||
73 | set_irq_type(IRQ_TO_GPIO(PCMCIA_S0_RDYINT), IRQ_TYPE_NONE); | ||
74 | set_irq_type(IRQ_TO_GPIO(PCMCIA_S1_RDYINT), IRQ_TYPE_NONE); | ||
75 | } | ||
76 | |||
77 | |||
78 | static void cmx270_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | ||
79 | struct pcmcia_state *state) | ||
80 | { | ||
81 | state->detect = (PCC_DETECT(skt->nr) == 0) ? 1 : 0; | ||
82 | state->ready = (PCC_READY(skt->nr) == 0) ? 0 : 1; | ||
83 | state->bvd1 = 1; | ||
84 | state->bvd2 = 1; | ||
85 | state->vs_3v = 0; | ||
86 | state->vs_Xv = 0; | ||
87 | state->wrprot = 0; /* not available */ | ||
88 | } | ||
89 | |||
90 | |||
91 | static int cmx270_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | ||
92 | const socket_state_t *state) | ||
93 | { | ||
94 | GPSR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE); | ||
95 | pxa_gpio_mode(GPIO49_nPWE | GPIO_OUT); | ||
96 | |||
97 | switch (skt->nr) { | ||
98 | case 0: | ||
99 | if (state->flags & SS_RESET) { | ||
100 | GPCR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE); | ||
101 | GPSR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2); | ||
102 | udelay(10); | ||
103 | GPCR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2); | ||
104 | GPSR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE); | ||
105 | } | ||
106 | break; | ||
107 | case 1: | ||
108 | if (state->flags & SS_RESET) { | ||
109 | GPCR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE); | ||
110 | GPSR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2); | ||
111 | udelay(10); | ||
112 | GPCR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2); | ||
113 | GPSR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE); | ||
114 | } | ||
115 | break; | ||
116 | } | ||
117 | |||
118 | pxa_gpio_mode(GPIO49_nPWE_MD); | ||
119 | |||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | static void cmx270_pcmcia_socket_init(struct soc_pcmcia_socket *skt) | ||
124 | { | ||
125 | } | ||
126 | |||
127 | static void cmx270_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | ||
128 | { | ||
129 | } | ||
130 | |||
131 | |||
132 | static struct pcmcia_low_level cmx270_pcmcia_ops = { | ||
133 | .owner = THIS_MODULE, | ||
134 | .hw_init = cmx270_pcmcia_hw_init, | ||
135 | .hw_shutdown = cmx270_pcmcia_shutdown, | ||
136 | .socket_state = cmx270_pcmcia_socket_state, | ||
137 | .configure_socket = cmx270_pcmcia_configure_socket, | ||
138 | .socket_init = cmx270_pcmcia_socket_init, | ||
139 | .socket_suspend = cmx270_pcmcia_socket_suspend, | ||
140 | .nr = 2, | ||
141 | }; | ||
142 | |||
143 | static struct platform_device *cmx270_pcmcia_device; | ||
144 | |||
145 | static int __init cmx270_pcmcia_init(void) | ||
146 | { | ||
147 | int ret; | ||
148 | |||
149 | cmx270_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); | ||
150 | |||
151 | if (!cmx270_pcmcia_device) | ||
152 | return -ENOMEM; | ||
153 | |||
154 | cmx270_pcmcia_device->dev.platform_data = &cmx270_pcmcia_ops; | ||
155 | |||
156 | printk(KERN_INFO "Registering cm-x270 PCMCIA interface.\n"); | ||
157 | ret = platform_device_add(cmx270_pcmcia_device); | ||
158 | |||
159 | if (ret) | ||
160 | platform_device_put(cmx270_pcmcia_device); | ||
161 | |||
162 | return ret; | ||
163 | } | ||
164 | |||
165 | static void __exit cmx270_pcmcia_exit(void) | ||
166 | { | ||
167 | platform_device_unregister(cmx270_pcmcia_device); | ||
168 | } | ||
169 | |||
170 | module_init(cmx270_pcmcia_init); | ||
171 | module_exit(cmx270_pcmcia_exit); | ||
172 | |||
173 | MODULE_LICENSE("GPL"); | ||
174 | MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>"); | ||
175 | MODULE_DESCRIPTION("CM-x270 PCMCIA driver"); | ||
diff --git a/drivers/pcmcia/pxa2xx_lubbock.c b/drivers/pcmcia/pxa2xx_lubbock.c index 5e9b9a3fd027..1510d6cde3e2 100644 --- a/drivers/pcmcia/pxa2xx_lubbock.c +++ b/drivers/pcmcia/pxa2xx_lubbock.c | |||
@@ -30,35 +30,6 @@ | |||
30 | #include "sa1111_generic.h" | 30 | #include "sa1111_generic.h" |
31 | 31 | ||
32 | static int | 32 | static int |
33 | lubbock_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | ||
34 | { | ||
35 | /* | ||
36 | * Setup default state of GPIO outputs | ||
37 | * before we enable them as outputs. | ||
38 | */ | ||
39 | GPSR(GPIO48_nPOE) = | ||
40 | GPIO_bit(GPIO48_nPOE) | | ||
41 | GPIO_bit(GPIO49_nPWE) | | ||
42 | GPIO_bit(GPIO50_nPIOR) | | ||
43 | GPIO_bit(GPIO51_nPIOW) | | ||
44 | GPIO_bit(GPIO52_nPCE_1) | | ||
45 | GPIO_bit(GPIO53_nPCE_2); | ||
46 | |||
47 | pxa_gpio_mode(GPIO48_nPOE_MD); | ||
48 | pxa_gpio_mode(GPIO49_nPWE_MD); | ||
49 | pxa_gpio_mode(GPIO50_nPIOR_MD); | ||
50 | pxa_gpio_mode(GPIO51_nPIOW_MD); | ||
51 | pxa_gpio_mode(GPIO52_nPCE_1_MD); | ||
52 | pxa_gpio_mode(GPIO53_nPCE_2_MD); | ||
53 | pxa_gpio_mode(GPIO54_pSKTSEL_MD); | ||
54 | pxa_gpio_mode(GPIO55_nPREG_MD); | ||
55 | pxa_gpio_mode(GPIO56_nPWAIT_MD); | ||
56 | pxa_gpio_mode(GPIO57_nIOIS16_MD); | ||
57 | |||
58 | return sa1111_pcmcia_hw_init(skt); | ||
59 | } | ||
60 | |||
61 | static int | ||
62 | lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | 33 | lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, |
63 | const socket_state_t *state) | 34 | const socket_state_t *state) |
64 | { | 35 | { |
@@ -230,7 +201,7 @@ lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |||
230 | 201 | ||
231 | static struct pcmcia_low_level lubbock_pcmcia_ops = { | 202 | static struct pcmcia_low_level lubbock_pcmcia_ops = { |
232 | .owner = THIS_MODULE, | 203 | .owner = THIS_MODULE, |
233 | .hw_init = lubbock_pcmcia_hw_init, | 204 | .hw_init = sa1111_pcmcia_hw_init, |
234 | .hw_shutdown = sa1111_pcmcia_hw_shutdown, | 205 | .hw_shutdown = sa1111_pcmcia_hw_shutdown, |
235 | .socket_state = sa1111_pcmcia_socket_state, | 206 | .socket_state = sa1111_pcmcia_socket_state, |
236 | .configure_socket = lubbock_pcmcia_configure_socket, | 207 | .configure_socket = lubbock_pcmcia_configure_socket, |
diff --git a/drivers/pcmcia/pxa2xx_mainstone.c b/drivers/pcmcia/pxa2xx_mainstone.c index 383107ba4bd3..36c671c5fb65 100644 --- a/drivers/pcmcia/pxa2xx_mainstone.c +++ b/drivers/pcmcia/pxa2xx_mainstone.c | |||
@@ -43,24 +43,6 @@ static int mst_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
43 | * Setup default state of GPIO outputs | 43 | * Setup default state of GPIO outputs |
44 | * before we enable them as outputs. | 44 | * before we enable them as outputs. |
45 | */ | 45 | */ |
46 | GPSR(GPIO48_nPOE) = | ||
47 | GPIO_bit(GPIO48_nPOE) | | ||
48 | GPIO_bit(GPIO49_nPWE) | | ||
49 | GPIO_bit(GPIO50_nPIOR) | | ||
50 | GPIO_bit(GPIO51_nPIOW) | | ||
51 | GPIO_bit(GPIO85_nPCE_1) | | ||
52 | GPIO_bit(GPIO54_nPCE_2); | ||
53 | |||
54 | pxa_gpio_mode(GPIO48_nPOE_MD); | ||
55 | pxa_gpio_mode(GPIO49_nPWE_MD); | ||
56 | pxa_gpio_mode(GPIO50_nPIOR_MD); | ||
57 | pxa_gpio_mode(GPIO51_nPIOW_MD); | ||
58 | pxa_gpio_mode(GPIO85_nPCE_1_MD); | ||
59 | pxa_gpio_mode(GPIO54_nPCE_2_MD); | ||
60 | pxa_gpio_mode(GPIO79_pSKTSEL_MD); | ||
61 | pxa_gpio_mode(GPIO55_nPREG_MD); | ||
62 | pxa_gpio_mode(GPIO56_nPWAIT_MD); | ||
63 | pxa_gpio_mode(GPIO57_nIOIS16_MD); | ||
64 | 46 | ||
65 | skt->irq = (skt->nr == 0) ? MAINSTONE_S0_IRQ : MAINSTONE_S1_IRQ; | 47 | skt->irq = (skt->nr == 0) ? MAINSTONE_S0_IRQ : MAINSTONE_S1_IRQ; |
66 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 48 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |