Commit | Line | Data |
---|---|---|
8459c159 DO |
1 | /* |
2 | * Support for Sharp SL-C6000x PDAs | |
3 | * Model: (Tosa) | |
4 | * | |
5 | * Copyright (c) 2005 Dirk Opfer | |
6 | * | |
7 | * Based on code written by Sharp/Lineo for 2.4 kernels | |
8 | * | |
9 | * This program is free software; you can redistribute it and/or modify | |
10 | * it under the terms of the GNU General Public License version 2 as | |
11 | * published by the Free Software Foundation. | |
12 | * | |
13 | */ | |
14 | ||
15 | #include <linux/kernel.h> | |
16 | #include <linux/init.h> | |
067c9048 | 17 | #include <linux/platform_device.h> |
8459c159 DO |
18 | #include <linux/major.h> |
19 | #include <linux/fs.h> | |
20 | #include <linux/interrupt.h> | |
21 | #include <linux/mmc/host.h> | |
74617fb6 | 22 | #include <linux/pm.h> |
905f1467 | 23 | #include <linux/delay.h> |
93e9012f DB |
24 | #include <linux/gpio_keys.h> |
25 | #include <linux/input.h> | |
d4e7d09f | 26 | #include <linux/gpio.h> |
8459c159 DO |
27 | |
28 | #include <asm/setup.h> | |
8459c159 | 29 | #include <asm/mach-types.h> |
bb548dd4 | 30 | #include <asm/arch/pxa2xx-regs.h> |
2cb47342 | 31 | #include <asm/arch/mfp-pxa25x.h> |
8459c159 | 32 | #include <asm/arch/irda.h> |
481ea5a1 | 33 | #include <asm/arch/i2c.h> |
8459c159 DO |
34 | #include <asm/arch/mmc.h> |
35 | #include <asm/arch/udc.h> | |
36 | ||
37 | #include <asm/mach/arch.h> | |
8459c159 DO |
38 | #include <asm/arch/tosa.h> |
39 | ||
40 | #include <asm/hardware/scoop.h> | |
41 | #include <asm/mach/sharpsl_param.h> | |
42 | ||
43 | #include "generic.h" | |
46c41e62 | 44 | #include "devices.h" |
8459c159 | 45 | |
2cb47342 DB |
46 | static unsigned long tosa_pin_config[] = { |
47 | GPIO78_nCS_2, /* Scoop */ | |
48 | GPIO80_nCS_4, /* tg6393xb */ | |
49 | GPIO33_nCS_5, /* Scoop */ | |
50 | ||
51 | // GPIO76 CARD_VCC_ON1 | |
52 | ||
53 | GPIO19_GPIO, /* Reset out */ | |
54 | GPIO1_RST | WAKEUP_ON_EDGE_FALL, | |
55 | ||
56 | GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* WAKE_UP */ | |
57 | GPIO2_GPIO | WAKEUP_ON_EDGE_BOTH, /* AC_IN */ | |
58 | GPIO3_GPIO | WAKEUP_ON_EDGE_FALL, /* RECORD */ | |
59 | GPIO4_GPIO | WAKEUP_ON_EDGE_FALL, /* SYNC */ | |
60 | GPIO20_GPIO, /* EAR_IN */ | |
61 | GPIO22_GPIO, /* On */ | |
62 | ||
63 | GPIO5_GPIO, /* USB_IN */ | |
64 | GPIO32_GPIO, /* Pen IRQ */ | |
65 | ||
66 | GPIO7_GPIO, /* Jacket Detect */ | |
67 | GPIO14_GPIO, /* BAT0_CRG */ | |
68 | GPIO12_GPIO, /* BAT1_CRG */ | |
69 | GPIO17_GPIO, /* BAT0_LOW */ | |
70 | GPIO84_GPIO, /* BAT1_LOW */ | |
71 | GPIO38_GPIO, /* BAT_LOCK */ | |
72 | ||
73 | GPIO11_3_6MHz, | |
74 | GPIO15_GPIO, /* TC6393XB IRQ */ | |
75 | GPIO18_RDY, | |
76 | GPIO27_GPIO, /* LCD Sync */ | |
77 | ||
78 | /* MMC */ | |
79 | GPIO6_MMC_CLK, | |
80 | GPIO8_MMC_CS0, | |
81 | GPIO9_GPIO, /* Detect */ | |
c4d5f8d4 | 82 | GPIO10_GPIO, /* nSD_INT */ |
2cb47342 DB |
83 | |
84 | /* CF */ | |
85 | GPIO13_GPIO, /* CD_IRQ */ | |
86 | GPIO21_GPIO, /* Main Slot IRQ */ | |
87 | GPIO36_GPIO, /* Jacket Slot IRQ */ | |
88 | GPIO48_nPOE, | |
89 | GPIO49_nPWE, | |
90 | GPIO50_nPIOR, | |
91 | GPIO51_nPIOW, | |
92 | GPIO52_nPCE_1, | |
93 | GPIO53_nPCE_2, | |
94 | GPIO54_nPSKTSEL, | |
95 | GPIO55_nPREG, | |
96 | GPIO56_nPWAIT, | |
97 | GPIO57_nIOIS16, | |
98 | ||
99 | /* AC97 */ | |
100 | GPIO31_AC97_SYNC, | |
101 | GPIO30_AC97_SDATA_OUT, | |
102 | GPIO28_AC97_BITCLK, | |
103 | GPIO29_AC97_SDATA_IN_0, | |
104 | // GPIO79 nAUD_IRQ | |
105 | ||
106 | /* FFUART */ | |
107 | GPIO34_FFUART_RXD, | |
108 | GPIO35_FFUART_CTS, | |
109 | GPIO37_FFUART_DSR, | |
110 | GPIO39_FFUART_TXD, | |
111 | GPIO40_FFUART_DTR, | |
112 | GPIO41_FFUART_RTS, | |
113 | ||
114 | /* BTUART */ | |
115 | GPIO42_BTUART_RXD, | |
116 | GPIO43_BTUART_TXD, | |
117 | GPIO44_BTUART_CTS, | |
118 | GPIO45_BTUART_RTS, | |
119 | ||
2cb47342 | 120 | /* Keybd */ |
c867155c | 121 | GPIO58_GPIO | MFP_LPM_DRIVE_LOW, |
122 | GPIO59_GPIO | MFP_LPM_DRIVE_LOW, | |
123 | GPIO60_GPIO | MFP_LPM_DRIVE_LOW, | |
124 | GPIO61_GPIO | MFP_LPM_DRIVE_LOW, | |
125 | GPIO62_GPIO | MFP_LPM_DRIVE_LOW, | |
126 | GPIO63_GPIO | MFP_LPM_DRIVE_LOW, | |
127 | GPIO64_GPIO | MFP_LPM_DRIVE_LOW, | |
128 | GPIO65_GPIO | MFP_LPM_DRIVE_LOW, | |
129 | GPIO66_GPIO | MFP_LPM_DRIVE_LOW, | |
130 | GPIO67_GPIO | MFP_LPM_DRIVE_LOW, | |
131 | GPIO68_GPIO | MFP_LPM_DRIVE_LOW, | |
132 | GPIO69_GPIO | MFP_LPM_DRIVE_LOW, | |
133 | GPIO70_GPIO | MFP_LPM_DRIVE_LOW, | |
134 | GPIO71_GPIO | MFP_LPM_DRIVE_LOW, | |
135 | GPIO72_GPIO | MFP_LPM_DRIVE_LOW, | |
136 | GPIO73_GPIO | MFP_LPM_DRIVE_LOW, | |
137 | GPIO74_GPIO | MFP_LPM_DRIVE_LOW, | |
138 | GPIO75_GPIO | MFP_LPM_DRIVE_LOW, | |
2cb47342 DB |
139 | |
140 | /* SPI */ | |
141 | GPIO81_SSP2_CLK_OUT, | |
142 | GPIO82_SSP2_FRM_OUT, | |
143 | GPIO83_SSP2_TXD, | |
144 | }; | |
145 | ||
b032fccc DB |
146 | static unsigned long tosa_pin_irda_off[] = { |
147 | GPIO46_STUART_RXD, | |
148 | GPIO47_GPIO | MFP_LPM_DRIVE_LOW, | |
149 | }; | |
150 | ||
151 | static unsigned long tosa_pin_irda_on[] = { | |
152 | GPIO46_STUART_RXD, | |
153 | GPIO47_STUART_TXD, | |
154 | }; | |
155 | ||
156 | ||
8459c159 DO |
157 | /* |
158 | * SCOOP Device | |
159 | */ | |
160 | static struct resource tosa_scoop_resources[] = { | |
161 | [0] = { | |
162 | .start = TOSA_CF_PHYS, | |
163 | .end = TOSA_CF_PHYS + 0xfff, | |
164 | .flags = IORESOURCE_MEM, | |
165 | }, | |
166 | }; | |
167 | ||
168 | static struct scoop_config tosa_scoop_setup = { | |
169 | .io_dir = TOSA_SCOOP_IO_DIR, | |
d4e7d09f | 170 | .gpio_base = TOSA_SCOOP_GPIO_BASE, |
8459c159 DO |
171 | }; |
172 | ||
ba4eb7e6 | 173 | static struct platform_device tosascoop_device = { |
8459c159 DO |
174 | .name = "sharp-scoop", |
175 | .id = 0, | |
176 | .dev = { | |
177 | .platform_data = &tosa_scoop_setup, | |
178 | }, | |
179 | .num_resources = ARRAY_SIZE(tosa_scoop_resources), | |
180 | .resource = tosa_scoop_resources, | |
181 | }; | |
182 | ||
183 | ||
184 | /* | |
185 | * SCOOP Device Jacket | |
186 | */ | |
187 | static struct resource tosa_scoop_jc_resources[] = { | |
188 | [0] = { | |
189 | .start = TOSA_SCOOP_PHYS + 0x40, | |
190 | .end = TOSA_SCOOP_PHYS + 0xfff, | |
191 | .flags = IORESOURCE_MEM, | |
192 | }, | |
193 | }; | |
194 | ||
195 | static struct scoop_config tosa_scoop_jc_setup = { | |
196 | .io_dir = TOSA_SCOOP_JC_IO_DIR, | |
d4e7d09f | 197 | .gpio_base = TOSA_SCOOP_JC_GPIO_BASE, |
8459c159 DO |
198 | }; |
199 | ||
ba4eb7e6 | 200 | static struct platform_device tosascoop_jc_device = { |
8459c159 DO |
201 | .name = "sharp-scoop", |
202 | .id = 1, | |
203 | .dev = { | |
204 | .platform_data = &tosa_scoop_jc_setup, | |
205 | .parent = &tosascoop_device.dev, | |
206 | }, | |
207 | .num_resources = ARRAY_SIZE(tosa_scoop_jc_resources), | |
208 | .resource = tosa_scoop_jc_resources, | |
209 | }; | |
210 | ||
4c18ad20 DO |
211 | /* |
212 | * PCMCIA | |
213 | */ | |
8459c159 DO |
214 | static struct scoop_pcmcia_dev tosa_pcmcia_scoop[] = { |
215 | { | |
216 | .dev = &tosascoop_device.dev, | |
217 | .irq = TOSA_IRQ_GPIO_CF_IRQ, | |
218 | .cd_irq = TOSA_IRQ_GPIO_CF_CD, | |
219 | .cd_irq_str = "PCMCIA0 CD", | |
220 | },{ | |
221 | .dev = &tosascoop_jc_device.dev, | |
222 | .irq = TOSA_IRQ_GPIO_JC_CF_IRQ, | |
223 | .cd_irq = -1, | |
224 | }, | |
225 | }; | |
226 | ||
4c18ad20 DO |
227 | static struct scoop_pcmcia_config tosa_pcmcia_config = { |
228 | .devs = &tosa_pcmcia_scoop[0], | |
229 | .num_devs = 2, | |
4c18ad20 DO |
230 | }; |
231 | ||
a93876c1 DO |
232 | /* |
233 | * USB Device Controller | |
234 | */ | |
a93876c1 | 235 | static struct pxa2xx_udc_mach_info udc_info __initdata = { |
d4e7d09f | 236 | .gpio_pullup = TOSA_GPIO_USB_PULLUP, |
487dc922 DB |
237 | .gpio_vbus = TOSA_GPIO_USB_IN, |
238 | .gpio_vbus_inverted = 1, | |
a93876c1 DO |
239 | }; |
240 | ||
241 | /* | |
242 | * MMC/SD Device | |
243 | */ | |
244 | static struct pxamci_platform_data tosa_mci_platform_data; | |
245 | ||
40220c1a | 246 | static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void *data) |
a93876c1 DO |
247 | { |
248 | int err; | |
249 | ||
a93876c1 DO |
250 | tosa_mci_platform_data.detect_delay = msecs_to_jiffies(250); |
251 | ||
c4d5f8d4 DB |
252 | err = gpio_request(TOSA_GPIO_nSD_DETECT, "MMC/SD card detect"); |
253 | if (err) { | |
254 | printk(KERN_ERR "tosa_mci_init: can't request nSD_DETECT gpio\n"); | |
255 | goto err_gpio_detect; | |
256 | } | |
257 | err = gpio_direction_input(TOSA_GPIO_nSD_DETECT); | |
258 | if (err) | |
259 | goto err_gpio_detect_dir; | |
260 | ||
2687bd38 RK |
261 | err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int, |
262 | IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | |
a93876c1 | 263 | "MMC/SD card detect", data); |
d4e7d09f | 264 | if (err) { |
a93876c1 | 265 | printk(KERN_ERR "tosa_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); |
d4e7d09f DB |
266 | goto err_irq; |
267 | } | |
268 | ||
c4d5f8d4 | 269 | err = gpio_request(TOSA_GPIO_SD_WP, "SD Write Protect"); |
d4e7d09f DB |
270 | if (err) { |
271 | printk(KERN_ERR "tosa_mci_init: can't request SD_WP gpio\n"); | |
272 | goto err_gpio_wp; | |
273 | } | |
274 | err = gpio_direction_input(TOSA_GPIO_SD_WP); | |
275 | if (err) | |
276 | goto err_gpio_wp_dir; | |
277 | ||
c4d5f8d4 | 278 | err = gpio_request(TOSA_GPIO_PWR_ON, "SD Power"); |
d4e7d09f DB |
279 | if (err) { |
280 | printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n"); | |
281 | goto err_gpio_pwr; | |
282 | } | |
283 | err = gpio_direction_output(TOSA_GPIO_PWR_ON, 0); | |
284 | if (err) | |
285 | goto err_gpio_pwr_dir; | |
a93876c1 | 286 | |
c4d5f8d4 DB |
287 | err = gpio_request(TOSA_GPIO_nSD_INT, "SD Int"); |
288 | if (err) { | |
289 | printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n"); | |
290 | goto err_gpio_int; | |
291 | } | |
292 | err = gpio_direction_input(TOSA_GPIO_nSD_INT); | |
293 | if (err) | |
294 | goto err_gpio_int_dir; | |
295 | ||
d4e7d09f DB |
296 | return 0; |
297 | ||
c4d5f8d4 DB |
298 | err_gpio_int_dir: |
299 | gpio_free(TOSA_GPIO_nSD_INT); | |
300 | err_gpio_int: | |
d4e7d09f DB |
301 | err_gpio_pwr_dir: |
302 | gpio_free(TOSA_GPIO_PWR_ON); | |
303 | err_gpio_pwr: | |
304 | err_gpio_wp_dir: | |
305 | gpio_free(TOSA_GPIO_SD_WP); | |
306 | err_gpio_wp: | |
307 | free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data); | |
308 | err_irq: | |
c4d5f8d4 DB |
309 | err_gpio_detect_dir: |
310 | gpio_free(TOSA_GPIO_nSD_DETECT); | |
311 | err_gpio_detect: | |
2687bd38 | 312 | return err; |
a93876c1 DO |
313 | } |
314 | ||
315 | static void tosa_mci_setpower(struct device *dev, unsigned int vdd) | |
316 | { | |
317 | struct pxamci_platform_data* p_d = dev->platform_data; | |
318 | ||
319 | if (( 1 << vdd) & p_d->ocr_mask) { | |
d4e7d09f | 320 | gpio_set_value(TOSA_GPIO_PWR_ON, 1); |
a93876c1 | 321 | } else { |
d4e7d09f | 322 | gpio_set_value(TOSA_GPIO_PWR_ON, 0); |
a93876c1 DO |
323 | } |
324 | } | |
325 | ||
326 | static int tosa_mci_get_ro(struct device *dev) | |
327 | { | |
d4e7d09f | 328 | return gpio_get_value(TOSA_GPIO_SD_WP); |
a93876c1 DO |
329 | } |
330 | ||
331 | static void tosa_mci_exit(struct device *dev, void *data) | |
332 | { | |
c4d5f8d4 | 333 | gpio_free(TOSA_GPIO_nSD_INT); |
d4e7d09f DB |
334 | gpio_free(TOSA_GPIO_PWR_ON); |
335 | gpio_free(TOSA_GPIO_SD_WP); | |
a93876c1 | 336 | free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data); |
c4d5f8d4 | 337 | gpio_free(TOSA_GPIO_nSD_DETECT); |
a93876c1 DO |
338 | } |
339 | ||
340 | static struct pxamci_platform_data tosa_mci_platform_data = { | |
341 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | |
342 | .init = tosa_mci_init, | |
343 | .get_ro = tosa_mci_get_ro, | |
344 | .setpower = tosa_mci_setpower, | |
345 | .exit = tosa_mci_exit, | |
346 | }; | |
347 | ||
348 | /* | |
349 | * Irda | |
350 | */ | |
b032fccc DB |
351 | static void tosa_irda_transceiver_mode(struct device *dev, int mode) |
352 | { | |
353 | if (mode & IR_OFF) { | |
354 | gpio_set_value(TOSA_GPIO_IR_POWERDWN, 0); | |
355 | pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_irda_off)); | |
356 | gpio_direction_output(TOSA_GPIO_IRDA_TX, 0); | |
357 | } else { | |
358 | pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_irda_on)); | |
359 | gpio_set_value(TOSA_GPIO_IR_POWERDWN, 1); | |
360 | } | |
361 | } | |
362 | ||
d4e7d09f | 363 | static int tosa_irda_startup(struct device *dev) |
a93876c1 | 364 | { |
d4e7d09f DB |
365 | int ret; |
366 | ||
b032fccc DB |
367 | ret = gpio_request(TOSA_GPIO_IRDA_TX, "IrDA TX"); |
368 | if (ret) | |
369 | goto err_tx; | |
370 | ret = gpio_direction_output(TOSA_GPIO_IRDA_TX, 0); | |
371 | if (ret) | |
372 | goto err_tx_dir; | |
373 | ||
d4e7d09f DB |
374 | ret = gpio_request(TOSA_GPIO_IR_POWERDWN, "IrDA powerdown"); |
375 | if (ret) | |
b032fccc | 376 | goto err_pwr; |
d4e7d09f DB |
377 | |
378 | ret = gpio_direction_output(TOSA_GPIO_IR_POWERDWN, 0); | |
379 | if (ret) | |
b032fccc | 380 | goto err_pwr_dir; |
d4e7d09f | 381 | |
b032fccc | 382 | tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF); |
d4e7d09f | 383 | |
b032fccc DB |
384 | return 0; |
385 | ||
386 | err_pwr_dir: | |
d4e7d09f | 387 | gpio_free(TOSA_GPIO_IR_POWERDWN); |
b032fccc DB |
388 | err_pwr: |
389 | err_tx_dir: | |
390 | gpio_free(TOSA_GPIO_IRDA_TX); | |
391 | err_tx: | |
392 | return ret; | |
d4e7d09f DB |
393 | } |
394 | ||
b032fccc | 395 | static void tosa_irda_shutdown(struct device *dev) |
d4e7d09f | 396 | { |
b032fccc DB |
397 | tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF); |
398 | gpio_free(TOSA_GPIO_IR_POWERDWN); | |
399 | gpio_free(TOSA_GPIO_IRDA_TX); | |
a93876c1 DO |
400 | } |
401 | ||
402 | static struct pxaficp_platform_data tosa_ficp_platform_data = { | |
403 | .transceiver_cap = IR_SIRMODE | IR_OFF, | |
404 | .transceiver_mode = tosa_irda_transceiver_mode, | |
d4e7d09f DB |
405 | .startup = tosa_irda_startup, |
406 | .shutdown = tosa_irda_shutdown, | |
a93876c1 DO |
407 | }; |
408 | ||
409 | /* | |
410 | * Tosa Keyboard | |
411 | */ | |
412 | static struct platform_device tosakbd_device = { | |
413 | .name = "tosa-keyboard", | |
414 | .id = -1, | |
415 | }; | |
8459c159 | 416 | |
93e9012f | 417 | static struct gpio_keys_button tosa_gpio_keys[] = { |
0aa97561 DB |
418 | /* |
419 | * Two following keys are directly tied to "ON" button of tosa. Why? | |
420 | * The first one can be used as a wakeup source, the second can't; | |
421 | * also the first one is OR of ac_powered and on_button. | |
422 | */ | |
423 | { | |
424 | .type = EV_PWR, | |
425 | .code = KEY_RESERVED, | |
426 | .gpio = TOSA_GPIO_POWERON, | |
427 | .desc = "Poweron", | |
428 | .wakeup = 1, | |
429 | .active_low = 1, | |
430 | }, | |
93e9012f DB |
431 | { |
432 | .type = EV_PWR, | |
433 | .code = KEY_SUSPEND, | |
434 | .gpio = TOSA_GPIO_ON_KEY, | |
435 | .desc = "On key", | |
0aa97561 DB |
436 | /* |
437 | * can't be used as wakeup | |
438 | * .wakeup = 1, | |
439 | */ | |
93e9012f DB |
440 | .active_low = 1, |
441 | }, | |
442 | { | |
443 | .type = EV_KEY, | |
444 | .code = TOSA_KEY_RECORD, | |
445 | .gpio = TOSA_GPIO_RECORD_BTN, | |
446 | .desc = "Record Button", | |
447 | .wakeup = 1, | |
448 | .active_low = 1, | |
449 | }, | |
450 | { | |
451 | .type = EV_KEY, | |
452 | .code = TOSA_KEY_SYNC, | |
453 | .gpio = TOSA_GPIO_SYNC, | |
454 | .desc = "Sync Button", | |
455 | .wakeup = 1, | |
456 | .active_low = 1, | |
457 | }, | |
458 | }; | |
459 | ||
460 | static struct gpio_keys_platform_data tosa_gpio_keys_platform_data = { | |
461 | .buttons = tosa_gpio_keys, | |
462 | .nbuttons = ARRAY_SIZE(tosa_gpio_keys), | |
463 | }; | |
464 | ||
465 | static struct platform_device tosa_gpio_keys_device = { | |
466 | .name = "gpio-keys", | |
467 | .id = -1, | |
468 | .dev = { | |
469 | .platform_data = &tosa_gpio_keys_platform_data, | |
470 | }, | |
471 | }; | |
472 | ||
6d0cf3e0 DO |
473 | /* |
474 | * Tosa LEDs | |
475 | */ | |
ba4eb7e6 | 476 | static struct gpio_led tosa_gpio_leds[] = { |
311c736c DB |
477 | { |
478 | .name = "tosa:amber:charge", | |
479 | .default_trigger = "main-battery-charging", | |
480 | .gpio = TOSA_GPIO_CHRG_ERR_LED, | |
481 | }, | |
482 | { | |
483 | .name = "tosa:green:mail", | |
484 | .default_trigger = "nand-disk", | |
485 | .gpio = TOSA_GPIO_NOTE_LED, | |
486 | }, | |
c546106c DB |
487 | { |
488 | .name = "tosa:dual:wlan", | |
489 | .default_trigger = "none", | |
490 | .gpio = TOSA_GPIO_WLAN_LED, | |
491 | }, | |
492 | { | |
493 | .name = "tosa:blue:bluetooth", | |
494 | .default_trigger = "none", | |
495 | .gpio = TOSA_GPIO_BT_LED, | |
496 | }, | |
311c736c DB |
497 | }; |
498 | ||
ba4eb7e6 | 499 | static struct gpio_led_platform_data tosa_gpio_leds_platform_data = { |
311c736c DB |
500 | .leds = tosa_gpio_leds, |
501 | .num_leds = ARRAY_SIZE(tosa_gpio_leds), | |
502 | }; | |
503 | ||
6d0cf3e0 | 504 | static struct platform_device tosaled_device = { |
311c736c DB |
505 | .name = "leds-gpio", |
506 | .id = -1, | |
507 | .dev = { | |
508 | .platform_data = &tosa_gpio_leds_platform_data, | |
509 | }, | |
6d0cf3e0 DO |
510 | }; |
511 | ||
8459c159 DO |
512 | static struct platform_device *devices[] __initdata = { |
513 | &tosascoop_device, | |
514 | &tosascoop_jc_device, | |
a93876c1 | 515 | &tosakbd_device, |
93e9012f | 516 | &tosa_gpio_keys_device, |
6d0cf3e0 | 517 | &tosaled_device, |
8459c159 DO |
518 | }; |
519 | ||
74617fb6 RP |
520 | static void tosa_poweroff(void) |
521 | { | |
86159a98 | 522 | arm_machine_restart('g'); |
74617fb6 RP |
523 | } |
524 | ||
525 | static void tosa_restart(char mode) | |
526 | { | |
527 | /* Bootloader magic for a reboot */ | |
528 | if((MSC0 & 0xffff0000) == 0x7ff00000) | |
529 | MSC0 = (MSC0 & 0xffff) | 0x7ee00000; | |
530 | ||
531 | tosa_poweroff(); | |
532 | } | |
533 | ||
8459c159 DO |
534 | static void __init tosa_init(void) |
535 | { | |
2cb47342 | 536 | pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config)); |
b032fccc | 537 | pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_irda_off)); |
2cb47342 DB |
538 | gpio_set_wake(MFP_PIN_GPIO1, 1); |
539 | /* We can't pass to gpio-keys since it will drop the Reset altfunc */ | |
540 | ||
86159a98 DB |
541 | init_gpio_reset(TOSA_GPIO_ON_RESET); |
542 | ||
74617fb6 RP |
543 | pm_power_off = tosa_poweroff; |
544 | arm_pm_restart = tosa_restart; | |
545 | ||
8459c159 DO |
546 | PCFR |= PCFR_OPDE; |
547 | ||
a93876c1 | 548 | /* enable batt_fault */ |
8459c159 DO |
549 | PMCR = 0x01; |
550 | ||
a93876c1 DO |
551 | pxa_set_mci_info(&tosa_mci_platform_data); |
552 | pxa_set_udc_info(&udc_info); | |
553 | pxa_set_ficp_info(&tosa_ficp_platform_data); | |
481ea5a1 | 554 | pxa_set_i2c_info(NULL); |
4c18ad20 | 555 | platform_scoop_config = &tosa_pcmcia_config; |
8459c159 | 556 | |
4c18ad20 | 557 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
8459c159 DO |
558 | } |
559 | ||
560 | static void __init fixup_tosa(struct machine_desc *desc, | |
561 | struct tag *tags, char **cmdline, struct meminfo *mi) | |
562 | { | |
563 | sharpsl_save_param(); | |
564 | mi->nr_banks=1; | |
565 | mi->bank[0].start = 0xa0000000; | |
566 | mi->bank[0].node = 0; | |
567 | mi->bank[0].size = (64*1024*1024); | |
568 | } | |
569 | ||
570 | MACHINE_START(TOSA, "SHARP Tosa") | |
8459c159 DO |
571 | .phys_io = 0x40000000, |
572 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | |
573 | .fixup = fixup_tosa, | |
574 | .map_io = pxa_map_io, | |
cd49104d | 575 | .init_irq = pxa25x_init_irq, |
8459c159 DO |
576 | .init_machine = tosa_init, |
577 | .timer = &pxa_timer, | |
578 | MACHINE_END |