aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-03-25 18:54:16 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-03-25 18:54:16 -0400
commit374da9da22ebaad0524c77905b5e89ae4619bef3 (patch)
tree78f8ebbbc2e730b8e510e3a68b5b73755196fb68 /drivers/pcmcia
parentfbae0f8912dc12b284433c05417ea76311205bbf (diff)
parent81e6ca3eb74d6bdbab181dd2db378f49f76f0d97 (diff)
Merge branch 'sa1111' into sa11x0
Conflicts: arch/arm/common/sa1111.c arch/arm/mach-sa1100/neponset.c Fixed: arch/arm/mach-sa1100/assabet.c for the neponset changes
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/sa1111_generic.c55
1 files changed, 48 insertions, 7 deletions
diff --git a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c
index 27f2fe3b7fb4..33568e18998b 100644
--- a/drivers/pcmcia/sa1111_generic.c
+++ b/drivers/pcmcia/sa1111_generic.c
@@ -22,6 +22,40 @@
22 22
23#include "sa1111_generic.h" 23#include "sa1111_generic.h"
24 24
25/*
26 * These are offsets from the above base.
27 */
28#define PCCR 0x0000
29#define PCSSR 0x0004
30#define PCSR 0x0008
31
32#define PCSR_S0_READY (1<<0)
33#define PCSR_S1_READY (1<<1)
34#define PCSR_S0_DETECT (1<<2)
35#define PCSR_S1_DETECT (1<<3)
36#define PCSR_S0_VS1 (1<<4)
37#define PCSR_S0_VS2 (1<<5)
38#define PCSR_S1_VS1 (1<<6)
39#define PCSR_S1_VS2 (1<<7)
40#define PCSR_S0_WP (1<<8)
41#define PCSR_S1_WP (1<<9)
42#define PCSR_S0_BVD1 (1<<10)
43#define PCSR_S0_BVD2 (1<<11)
44#define PCSR_S1_BVD1 (1<<12)
45#define PCSR_S1_BVD2 (1<<13)
46
47#define PCCR_S0_RST (1<<0)
48#define PCCR_S1_RST (1<<1)
49#define PCCR_S0_FLT (1<<2)
50#define PCCR_S1_FLT (1<<3)
51#define PCCR_S0_PWAITEN (1<<4)
52#define PCCR_S1_PWAITEN (1<<5)
53#define PCCR_S0_PSE (1<<6)
54#define PCCR_S1_PSE (1<<7)
55
56#define PCSSR_S0_SLEEP (1<<0)
57#define PCSSR_S1_SLEEP (1<<1)
58
25#define IDX_IRQ_S0_READY_NINT (0) 59#define IDX_IRQ_S0_READY_NINT (0)
26#define IDX_IRQ_S0_CD_VALID (1) 60#define IDX_IRQ_S0_CD_VALID (1)
27#define IDX_IRQ_S0_BVD1_STSCHG (2) 61#define IDX_IRQ_S0_BVD1_STSCHG (2)
@@ -49,7 +83,7 @@ static void sa1111_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
49void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state) 83void sa1111_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
50{ 84{
51 struct sa1111_pcmcia_socket *s = to_skt(skt); 85 struct sa1111_pcmcia_socket *s = to_skt(skt);
52 unsigned long status = sa1111_readl(s->dev->mapbase + SA1111_PCSR); 86 unsigned long status = sa1111_readl(s->dev->mapbase + PCSR);
53 87
54 switch (skt->nr) { 88 switch (skt->nr) {
55 case 0: 89 case 0:
@@ -105,10 +139,10 @@ int sa1111_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_s
105 pccr_set_mask |= PCCR_S0_FLT|PCCR_S1_FLT; 139 pccr_set_mask |= PCCR_S0_FLT|PCCR_S1_FLT;
106 140
107 local_irq_save(flags); 141 local_irq_save(flags);
108 val = sa1111_readl(s->dev->mapbase + SA1111_PCCR); 142 val = sa1111_readl(s->dev->mapbase + PCCR);
109 val &= ~pccr_skt_mask; 143 val &= ~pccr_skt_mask;
110 val |= pccr_set_mask & pccr_skt_mask; 144 val |= pccr_set_mask & pccr_skt_mask;
111 sa1111_writel(val, s->dev->mapbase + SA1111_PCCR); 145 sa1111_writel(val, s->dev->mapbase + PCCR);
112 local_irq_restore(flags); 146 local_irq_restore(flags);
113 147
114 return 0; 148 return 0;
@@ -163,12 +197,18 @@ int sa1111_pcmcia_add(struct sa1111_dev *dev, struct pcmcia_low_level *ops,
163static int pcmcia_probe(struct sa1111_dev *dev) 197static int pcmcia_probe(struct sa1111_dev *dev)
164{ 198{
165 void __iomem *base; 199 void __iomem *base;
200 int ret;
201
202 ret = sa1111_enable_device(dev);
203 if (ret)
204 return ret;
166 205
167 dev_set_drvdata(&dev->dev, NULL); 206 dev_set_drvdata(&dev->dev, NULL);
168 207
169 if (!request_mem_region(dev->res.start, 512, 208 if (!request_mem_region(dev->res.start, 512, SA1111_DRIVER_NAME(dev))) {
170 SA1111_DRIVER_NAME(dev))) 209 sa1111_disable_device(dev);
171 return -EBUSY; 210 return -EBUSY;
211 }
172 212
173 base = dev->mapbase; 213 base = dev->mapbase;
174 214
@@ -181,8 +221,8 @@ static int pcmcia_probe(struct sa1111_dev *dev)
181 /* 221 /*
182 * Initialise the suspend state. 222 * Initialise the suspend state.
183 */ 223 */
184 sa1111_writel(PCSSR_S0_SLEEP | PCSSR_S1_SLEEP, base + SA1111_PCSSR); 224 sa1111_writel(PCSSR_S0_SLEEP | PCSSR_S1_SLEEP, base + PCSSR);
185 sa1111_writel(PCCR_S0_FLT | PCCR_S1_FLT, base + SA1111_PCCR); 225 sa1111_writel(PCCR_S0_FLT | PCCR_S1_FLT, base + PCCR);
186 226
187#ifdef CONFIG_SA1100_BADGE4 227#ifdef CONFIG_SA1100_BADGE4
188 pcmcia_badge4_init(&dev->dev); 228 pcmcia_badge4_init(&dev->dev);
@@ -212,6 +252,7 @@ static int __devexit pcmcia_remove(struct sa1111_dev *dev)
212 } 252 }
213 253
214 release_mem_region(dev->res.start, 512); 254 release_mem_region(dev->res.start, 512);
255 sa1111_disable_device(dev);
215 return 0; 256 return 0;
216} 257}
217 258