aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2005-11-08 14:15:43 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-11-08 14:15:43 -0500
commita63ae4427c6af66d6eda26e5da8fed53f8fbede3 (patch)
treecb30bd5993c07bae7f66564713292d8b224d591f /arch
parent1d23b65de54c35844e82bdb08bc85d8142e310ea (diff)
[ARM] 3093/1: SharpSL PCMCIA Updates for Cxx00 models
Patch from Richard Purdie The Sharp SL-Cxx00 models have a combined power control for the SD and CF slot 0. This patch adds hooks to the scoop driver to allow machines to provide a custom control function for this and such a function is added for spitz/akita/borzoi. It also moves the gpio init code into the machine files as this is machine dependent and differs between some models. A couple of warnings when compiling for collie are also fixed. Signed-off-by: Richard Purdie Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/common/scoop.c6
-rw-r--r--arch/arm/mach-pxa/corgi.c48
-rw-r--r--arch/arm/mach-pxa/poodle.c32
-rw-r--r--arch/arm/mach-pxa/spitz.c95
4 files changed, 144 insertions, 37 deletions
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index bb4eff614413..c7fdf390cef9 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -19,12 +19,6 @@
19 19
20#define SCOOP_REG(d,adr) (*(volatile unsigned short*)(d +(adr))) 20#define SCOOP_REG(d,adr) (*(volatile unsigned short*)(d +(adr)))
21 21
22/* PCMCIA to Scoop linkage structures for pxa2xx_sharpsl.c
23 There is no easy way to link multiple scoop devices into one
24 single entity for the pxa2xx_pcmcia device */
25int scoop_num;
26struct scoop_pcmcia_dev *scoop_devs;
27
28struct scoop_dev { 22struct scoop_dev {
29 void *base; 23 void *base;
30 spinlock_t scoop_lock; 24 spinlock_t scoop_lock;
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index eb5f6d744a4a..100fb31b5156 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -62,6 +62,37 @@ static struct scoop_config corgi_scoop_setup = {
62 .io_out = CORGI_SCOOP_IO_OUT, 62 .io_out = CORGI_SCOOP_IO_OUT,
63}; 63};
64 64
65struct platform_device corgiscoop_device = {
66 .name = "sharp-scoop",
67 .id = -1,
68 .dev = {
69 .platform_data = &corgi_scoop_setup,
70 },
71 .num_resources = ARRAY_SIZE(corgi_scoop_resources),
72 .resource = corgi_scoop_resources,
73};
74
75static void corgi_pcmcia_init(void)
76{
77 /* Setup default state of GPIO outputs
78 before we enable them as outputs. */
79 GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) |
80 GPIO_bit(GPIO49_nPWE) | GPIO_bit(GPIO50_nPIOR) |
81 GPIO_bit(GPIO51_nPIOW) | GPIO_bit(GPIO52_nPCE_1) |
82 GPIO_bit(GPIO53_nPCE_2);
83
84 pxa_gpio_mode(GPIO48_nPOE_MD);
85 pxa_gpio_mode(GPIO49_nPWE_MD);
86 pxa_gpio_mode(GPIO50_nPIOR_MD);
87 pxa_gpio_mode(GPIO51_nPIOW_MD);
88 pxa_gpio_mode(GPIO55_nPREG_MD);
89 pxa_gpio_mode(GPIO56_nPWAIT_MD);
90 pxa_gpio_mode(GPIO57_nIOIS16_MD);
91 pxa_gpio_mode(GPIO52_nPCE_1_MD);
92 pxa_gpio_mode(GPIO53_nPCE_2_MD);
93 pxa_gpio_mode(GPIO54_pSKTSEL_MD);
94}
95
65static struct scoop_pcmcia_dev corgi_pcmcia_scoop[] = { 96static struct scoop_pcmcia_dev corgi_pcmcia_scoop[] = {
66{ 97{
67 .dev = &corgiscoop_device.dev, 98 .dev = &corgiscoop_device.dev,
@@ -71,16 +102,14 @@ static struct scoop_pcmcia_dev corgi_pcmcia_scoop[] = {
71}, 102},
72}; 103};
73 104
74struct platform_device corgiscoop_device = { 105static struct scoop_pcmcia_config corgi_pcmcia_config = {
75 .name = "sharp-scoop", 106 .devs = &corgi_pcmcia_scoop[0],
76 .id = -1, 107 .num_devs = 1,
77 .dev = { 108 .pcmcia_init = corgi_pcmcia_init,
78 .platform_data = &corgi_scoop_setup,
79 },
80 .num_resources = ARRAY_SIZE(corgi_scoop_resources),
81 .resource = corgi_scoop_resources,
82}; 109};
83 110
111EXPORT_SYMBOL(corgiscoop_device);
112
84 113
85/* 114/*
86 * Corgi SSP Device 115 * Corgi SSP Device
@@ -294,8 +323,7 @@ static void __init corgi_init(void)
294 pxa_set_mci_info(&corgi_mci_platform_data); 323 pxa_set_mci_info(&corgi_mci_platform_data);
295 pxa_set_ficp_info(&corgi_ficp_platform_data); 324 pxa_set_ficp_info(&corgi_ficp_platform_data);
296 325
297 scoop_num = 1; 326 platform_scoop_config = &corgi_pcmcia_config;
298 scoop_devs = &corgi_pcmcia_scoop[0];
299 327
300 platform_add_devices(devices, ARRAY_SIZE(devices)); 328 platform_add_devices(devices, ARRAY_SIZE(devices));
301} 329}
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index ad6a13f95a62..eef3de26ad37 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -65,6 +65,27 @@ struct platform_device poodle_scoop_device = {
65 .resource = poodle_scoop_resources, 65 .resource = poodle_scoop_resources,
66}; 66};
67 67
68static void poodle_pcmcia_init(void)
69{
70 /* Setup default state of GPIO outputs
71 before we enable them as outputs. */
72 GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) |
73 GPIO_bit(GPIO49_nPWE) | GPIO_bit(GPIO50_nPIOR) |
74 GPIO_bit(GPIO51_nPIOW) | GPIO_bit(GPIO52_nPCE_1) |
75 GPIO_bit(GPIO53_nPCE_2);
76
77 pxa_gpio_mode(GPIO48_nPOE_MD);
78 pxa_gpio_mode(GPIO49_nPWE_MD);
79 pxa_gpio_mode(GPIO50_nPIOR_MD);
80 pxa_gpio_mode(GPIO51_nPIOW_MD);
81 pxa_gpio_mode(GPIO55_nPREG_MD);
82 pxa_gpio_mode(GPIO56_nPWAIT_MD);
83 pxa_gpio_mode(GPIO57_nIOIS16_MD);
84 pxa_gpio_mode(GPIO52_nPCE_1_MD);
85 pxa_gpio_mode(GPIO53_nPCE_2_MD);
86 pxa_gpio_mode(GPIO54_pSKTSEL_MD);
87}
88
68static struct scoop_pcmcia_dev poodle_pcmcia_scoop[] = { 89static struct scoop_pcmcia_dev poodle_pcmcia_scoop[] = {
69{ 90{
70 .dev = &poodle_scoop_device.dev, 91 .dev = &poodle_scoop_device.dev,
@@ -74,6 +95,14 @@ static struct scoop_pcmcia_dev poodle_pcmcia_scoop[] = {
74}, 95},
75}; 96};
76 97
98static struct scoop_pcmcia_config poodle_pcmcia_config = {
99 .devs = &poodle_pcmcia_scoop[0],
100 .num_devs = 1,
101 .pcmcia_init = poodle_pcmcia_init,
102};
103
104EXPORT_SYMBOL(poodle_scoop_device);
105
77 106
78/* LoCoMo device */ 107/* LoCoMo device */
79static struct resource locomo_resources[] = { 108static struct resource locomo_resources[] = {
@@ -268,8 +297,7 @@ static void __init poodle_init(void)
268 pxa_set_mci_info(&poodle_mci_platform_data); 297 pxa_set_mci_info(&poodle_mci_platform_data);
269 pxa_set_ficp_info(&poodle_ficp_platform_data); 298 pxa_set_ficp_info(&poodle_ficp_platform_data);
270 299
271 scoop_num = 1; 300 platform_scoop_config = &poodle_pcmcia_config;
272 scoop_devs = &poodle_pcmcia_scoop[0];
273 301
274 ret = platform_add_devices(devices, ARRAY_SIZE(devices)); 302 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
275 if (ret) { 303 if (ret) {
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 6c6878cd2207..4e9a699ee428 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -104,6 +104,66 @@ struct platform_device spitzscoop2_device = {
104 .resource = spitz_scoop2_resources, 104 .resource = spitz_scoop2_resources,
105}; 105};
106 106
107#define SPITZ_PWR_SD 0x01
108#define SPITZ_PWR_CF 0x02
109
110/* Power control is shared with between one of the CF slots and SD */
111static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr)
112{
113 unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR);
114
115 if (new_cpr & 0x0007) {
116 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER);
117 if (!(cpr & 0x0002) && !(cpr & 0x0004))
118 mdelay(5);
119 if (device == SPITZ_PWR_CF)
120 cpr |= 0x0002;
121 if (device == SPITZ_PWR_SD)
122 cpr |= 0x0004;
123 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
124 } else {
125 if (device == SPITZ_PWR_CF)
126 cpr &= ~0x0002;
127 if (device == SPITZ_PWR_SD)
128 cpr &= ~0x0004;
129 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
130 if (!(cpr & 0x0002) && !(cpr & 0x0004)) {
131 mdelay(1);
132 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER);
133 }
134 }
135}
136
137static void spitz_pcmcia_init(void)
138{
139 /* Setup default state of GPIO outputs
140 before we enable them as outputs. */
141 GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) |
142 GPIO_bit(GPIO49_nPWE) | GPIO_bit(GPIO50_nPIOR) |
143 GPIO_bit(GPIO51_nPIOW) | GPIO_bit(GPIO54_nPCE_2);
144 GPSR(GPIO85_nPCE_1) = GPIO_bit(GPIO85_nPCE_1);
145
146 pxa_gpio_mode(GPIO48_nPOE_MD);
147 pxa_gpio_mode(GPIO49_nPWE_MD);
148 pxa_gpio_mode(GPIO50_nPIOR_MD);
149 pxa_gpio_mode(GPIO51_nPIOW_MD);
150 pxa_gpio_mode(GPIO55_nPREG_MD);
151 pxa_gpio_mode(GPIO56_nPWAIT_MD);
152 pxa_gpio_mode(GPIO57_nIOIS16_MD);
153 pxa_gpio_mode(GPIO85_nPCE_1_MD);
154 pxa_gpio_mode(GPIO54_nPCE_2_MD);
155 pxa_gpio_mode(GPIO104_pSKTSEL_MD);
156}
157
158static void spitz_pcmcia_pwr(struct device *scoop, unsigned short cpr, int nr)
159{
160 /* Only need to override behaviour for slot 0 */
161 if (nr == 0)
162 spitz_card_pwr_ctrl(SPITZ_PWR_CF, cpr);
163 else
164 write_scoop_reg(scoop, SCOOP_CPR, cpr);
165}
166
107static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = { 167static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = {
108{ 168{
109 .dev = &spitzscoop_device.dev, 169 .dev = &spitzscoop_device.dev,
@@ -117,6 +177,16 @@ static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = {
117}, 177},
118}; 178};
119 179
180static struct scoop_pcmcia_config spitz_pcmcia_config = {
181 .devs = &spitz_pcmcia_scoop[0],
182 .num_devs = 2,
183 .pcmcia_init = spitz_pcmcia_init,
184 .power_ctrl = spitz_pcmcia_pwr,
185};
186
187EXPORT_SYMBOL(spitzscoop_device);
188EXPORT_SYMBOL(spitzscoop2_device);
189
120 190
121/* 191/*
122 * Spitz SSP Device 192 * Spitz SSP Device
@@ -235,27 +305,14 @@ static int spitz_mci_init(struct device *dev, irqreturn_t (*spitz_detect_int)(in
235 return 0; 305 return 0;
236} 306}
237 307
238/* Power control is shared with one of the CF slots so we have a mess */
239static void spitz_mci_setpower(struct device *dev, unsigned int vdd) 308static void spitz_mci_setpower(struct device *dev, unsigned int vdd)
240{ 309{
241 struct pxamci_platform_data* p_d = dev->platform_data; 310 struct pxamci_platform_data* p_d = dev->platform_data;
242 311
243 unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR); 312 if (( 1 << vdd) & p_d->ocr_mask)
244 313 spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0004);
245 if (( 1 << vdd) & p_d->ocr_mask) { 314 else
246 /* printk(KERN_DEBUG "%s: on\n", __FUNCTION__); */ 315 spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0000);
247 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER);
248 mdelay(2);
249 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | 0x04);
250 } else {
251 /* printk(KERN_DEBUG "%s: off\n", __FUNCTION__); */
252 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr & ~0x04);
253
254 if (!(cpr | 0x02)) {
255 mdelay(1);
256 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER);
257 }
258 }
259} 316}
260 317
261static int spitz_mci_get_ro(struct device *dev) 318static int spitz_mci_get_ro(struct device *dev)
@@ -351,8 +408,8 @@ static void __init common_init(void)
351 408
352static void __init spitz_init(void) 409static void __init spitz_init(void)
353{ 410{
354 scoop_num = 2; 411 platform_scoop_config = &spitz_pcmcia_config;
355 scoop_devs = &spitz_pcmcia_scoop[0]; 412
356 spitz_bl_machinfo.set_bl_intensity = spitz_bl_set_intensity; 413 spitz_bl_machinfo.set_bl_intensity = spitz_bl_set_intensity;
357 414
358 common_init(); 415 common_init();