blob: 9892464d7abc0eebe2f1ca6c28066bab2ff8d9c4 [file] [log] [blame]
Dirk Opfer8459c152005-11-06 14:27:52 +00001/*
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>
Dirk Opfer067c9042005-11-21 15:17:06 +000017#include <linux/platform_device.h>
Dirk Opfer8459c152005-11-06 14:27:52 +000018#include <linux/major.h>
19#include <linux/fs.h>
20#include <linux/interrupt.h>
21#include <linux/mmc/host.h>
Richard Purdie74617fb2006-06-19 19:57:12 +010022#include <linux/pm.h>
Russell King905f1462006-06-20 23:27:37 +010023#include <linux/delay.h>
Dmitry Baryshkov93e9012f2008-01-21 01:04:20 -050024#include <linux/gpio_keys.h>
25#include <linux/input.h>
Dmitry Baryshkovd4e7d092008-04-12 20:16:16 +010026#include <linux/gpio.h>
Dirk Opfer8459c152005-11-06 14:27:52 +000027
28#include <asm/setup.h>
Dirk Opfer8459c152005-11-06 14:27:52 +000029#include <asm/mach-types.h>
eric miaobb548dd2008-01-30 09:39:48 +010030#include <asm/arch/pxa2xx-regs.h>
Dmitry Baryshkov2cb47342008-04-10 11:00:32 +010031#include <asm/arch/mfp-pxa25x.h>
Dirk Opfer8459c152005-11-06 14:27:52 +000032#include <asm/arch/irda.h>
Dmitry Baryshkov481ea5a2008-04-10 15:43:18 +010033#include <asm/arch/i2c.h>
Dirk Opfer8459c152005-11-06 14:27:52 +000034#include <asm/arch/mmc.h>
35#include <asm/arch/udc.h>
36
37#include <asm/mach/arch.h>
Dirk Opfer8459c152005-11-06 14:27:52 +000038#include <asm/arch/tosa.h>
39
40#include <asm/hardware/scoop.h>
41#include <asm/mach/sharpsl_param.h>
42
43#include "generic.h"
Russell King46c41e62007-05-15 15:39:36 +010044#include "devices.h"
Dirk Opfer8459c152005-11-06 14:27:52 +000045
Dmitry Baryshkov2cb47342008-04-10 11:00:32 +010046static 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 */
Dmitry Baryshkovc4d5f8d2008-06-09 13:23:50 +010082 GPIO10_GPIO, /* nSD_INT */
Dmitry Baryshkov2cb47342008-04-10 11:00:32 +010083
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
120 /* IrDA */
121 GPIO46_STUART_RXD,
122 GPIO47_STUART_TXD,
123
124 /* Keybd */
eric miaoc8671552008-05-26 03:28:50 +0100125 GPIO58_GPIO | MFP_LPM_DRIVE_LOW,
126 GPIO59_GPIO | MFP_LPM_DRIVE_LOW,
127 GPIO60_GPIO | MFP_LPM_DRIVE_LOW,
128 GPIO61_GPIO | MFP_LPM_DRIVE_LOW,
129 GPIO62_GPIO | MFP_LPM_DRIVE_LOW,
130 GPIO63_GPIO | MFP_LPM_DRIVE_LOW,
131 GPIO64_GPIO | MFP_LPM_DRIVE_LOW,
132 GPIO65_GPIO | MFP_LPM_DRIVE_LOW,
133 GPIO66_GPIO | MFP_LPM_DRIVE_LOW,
134 GPIO67_GPIO | MFP_LPM_DRIVE_LOW,
135 GPIO68_GPIO | MFP_LPM_DRIVE_LOW,
136 GPIO69_GPIO | MFP_LPM_DRIVE_LOW,
137 GPIO70_GPIO | MFP_LPM_DRIVE_LOW,
138 GPIO71_GPIO | MFP_LPM_DRIVE_LOW,
139 GPIO72_GPIO | MFP_LPM_DRIVE_LOW,
140 GPIO73_GPIO | MFP_LPM_DRIVE_LOW,
141 GPIO74_GPIO | MFP_LPM_DRIVE_LOW,
142 GPIO75_GPIO | MFP_LPM_DRIVE_LOW,
Dmitry Baryshkov2cb47342008-04-10 11:00:32 +0100143
144 /* SPI */
145 GPIO81_SSP2_CLK_OUT,
146 GPIO82_SSP2_FRM_OUT,
147 GPIO83_SSP2_TXD,
148};
149
Dirk Opfer8459c152005-11-06 14:27:52 +0000150/*
151 * SCOOP Device
152 */
153static struct resource tosa_scoop_resources[] = {
154 [0] = {
155 .start = TOSA_CF_PHYS,
156 .end = TOSA_CF_PHYS + 0xfff,
157 .flags = IORESOURCE_MEM,
158 },
159};
160
161static struct scoop_config tosa_scoop_setup = {
162 .io_dir = TOSA_SCOOP_IO_DIR,
Dmitry Baryshkovd4e7d092008-04-12 20:16:16 +0100163 .gpio_base = TOSA_SCOOP_GPIO_BASE,
Dirk Opfer8459c152005-11-06 14:27:52 +0000164};
165
Dmitry Baryshkovba4eb7e2008-04-19 10:42:25 +0100166static struct platform_device tosascoop_device = {
Dirk Opfer8459c152005-11-06 14:27:52 +0000167 .name = "sharp-scoop",
168 .id = 0,
169 .dev = {
170 .platform_data = &tosa_scoop_setup,
171 },
172 .num_resources = ARRAY_SIZE(tosa_scoop_resources),
173 .resource = tosa_scoop_resources,
174};
175
176
177/*
178 * SCOOP Device Jacket
179 */
180static struct resource tosa_scoop_jc_resources[] = {
181 [0] = {
182 .start = TOSA_SCOOP_PHYS + 0x40,
183 .end = TOSA_SCOOP_PHYS + 0xfff,
184 .flags = IORESOURCE_MEM,
185 },
186};
187
188static struct scoop_config tosa_scoop_jc_setup = {
189 .io_dir = TOSA_SCOOP_JC_IO_DIR,
Dmitry Baryshkovd4e7d092008-04-12 20:16:16 +0100190 .gpio_base = TOSA_SCOOP_JC_GPIO_BASE,
Dirk Opfer8459c152005-11-06 14:27:52 +0000191};
192
Dmitry Baryshkovba4eb7e2008-04-19 10:42:25 +0100193static struct platform_device tosascoop_jc_device = {
Dirk Opfer8459c152005-11-06 14:27:52 +0000194 .name = "sharp-scoop",
195 .id = 1,
196 .dev = {
197 .platform_data = &tosa_scoop_jc_setup,
198 .parent = &tosascoop_device.dev,
199 },
200 .num_resources = ARRAY_SIZE(tosa_scoop_jc_resources),
201 .resource = tosa_scoop_jc_resources,
202};
203
Dirk Opfer4c18ad22005-11-08 19:15:50 +0000204/*
205 * PCMCIA
206 */
Dirk Opfer8459c152005-11-06 14:27:52 +0000207static struct scoop_pcmcia_dev tosa_pcmcia_scoop[] = {
208{
209 .dev = &tosascoop_device.dev,
210 .irq = TOSA_IRQ_GPIO_CF_IRQ,
211 .cd_irq = TOSA_IRQ_GPIO_CF_CD,
212 .cd_irq_str = "PCMCIA0 CD",
213},{
214 .dev = &tosascoop_jc_device.dev,
215 .irq = TOSA_IRQ_GPIO_JC_CF_IRQ,
216 .cd_irq = -1,
217},
218};
219
Dirk Opfer4c18ad22005-11-08 19:15:50 +0000220static struct scoop_pcmcia_config tosa_pcmcia_config = {
221 .devs = &tosa_pcmcia_scoop[0],
222 .num_devs = 2,
Dirk Opfer4c18ad22005-11-08 19:15:50 +0000223};
224
Dirk Opfera93876c2005-11-08 19:15:30 +0000225/*
226 * USB Device Controller
227 */
Dirk Opfera93876c2005-11-08 19:15:30 +0000228static struct pxa2xx_udc_mach_info udc_info __initdata = {
Dmitry Baryshkovd4e7d092008-04-12 20:16:16 +0100229 .gpio_pullup = TOSA_GPIO_USB_PULLUP,
Dmitry Baryshkov487dc922007-12-21 12:18:01 +0300230 .gpio_vbus = TOSA_GPIO_USB_IN,
231 .gpio_vbus_inverted = 1,
Dirk Opfera93876c2005-11-08 19:15:30 +0000232};
233
234/*
235 * MMC/SD Device
236 */
237static struct pxamci_platform_data tosa_mci_platform_data;
238
David Howells40220c12006-10-09 12:19:47 +0100239static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void *data)
Dirk Opfera93876c2005-11-08 19:15:30 +0000240{
241 int err;
242
Dirk Opfera93876c2005-11-08 19:15:30 +0000243 tosa_mci_platform_data.detect_delay = msecs_to_jiffies(250);
244
Dmitry Baryshkovc4d5f8d2008-06-09 13:23:50 +0100245 err = gpio_request(TOSA_GPIO_nSD_DETECT, "MMC/SD card detect");
246 if (err) {
247 printk(KERN_ERR "tosa_mci_init: can't request nSD_DETECT gpio\n");
248 goto err_gpio_detect;
249 }
250 err = gpio_direction_input(TOSA_GPIO_nSD_DETECT);
251 if (err)
252 goto err_gpio_detect_dir;
253
Russell King2687bd32008-01-23 14:05:58 +0000254 err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int,
255 IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
Dirk Opfera93876c2005-11-08 19:15:30 +0000256 "MMC/SD card detect", data);
Dmitry Baryshkovd4e7d092008-04-12 20:16:16 +0100257 if (err) {
Dirk Opfera93876c2005-11-08 19:15:30 +0000258 printk(KERN_ERR "tosa_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
Dmitry Baryshkovd4e7d092008-04-12 20:16:16 +0100259 goto err_irq;
260 }
Dirk Opfera93876c2005-11-08 19:15:30 +0000261
Dmitry Baryshkovc4d5f8d2008-06-09 13:23:50 +0100262 err = gpio_request(TOSA_GPIO_SD_WP, "SD Write Protect");
Dmitry Baryshkovd4e7d092008-04-12 20:16:16 +0100263 if (err) {
264 printk(KERN_ERR "tosa_mci_init: can't request SD_WP gpio\n");
265 goto err_gpio_wp;
266 }
267 err = gpio_direction_input(TOSA_GPIO_SD_WP);
268 if (err)
269 goto err_gpio_wp_dir;
270
Dmitry Baryshkovc4d5f8d2008-06-09 13:23:50 +0100271 err = gpio_request(TOSA_GPIO_PWR_ON, "SD Power");
Dmitry Baryshkovd4e7d092008-04-12 20:16:16 +0100272 if (err) {
273 printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n");
274 goto err_gpio_pwr;
275 }
276 err = gpio_direction_output(TOSA_GPIO_PWR_ON, 0);
277 if (err)
278 goto err_gpio_pwr_dir;
279
Dmitry Baryshkovc4d5f8d2008-06-09 13:23:50 +0100280 err = gpio_request(TOSA_GPIO_nSD_INT, "SD Int");
281 if (err) {
282 printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n");
283 goto err_gpio_int;
284 }
285 err = gpio_direction_input(TOSA_GPIO_nSD_INT);
286 if (err)
287 goto err_gpio_int_dir;
288
Dmitry Baryshkovd4e7d092008-04-12 20:16:16 +0100289 return 0;
290
Dmitry Baryshkovc4d5f8d2008-06-09 13:23:50 +0100291err_gpio_int_dir:
292 gpio_free(TOSA_GPIO_nSD_INT);
293err_gpio_int:
Dmitry Baryshkovd4e7d092008-04-12 20:16:16 +0100294err_gpio_pwr_dir:
295 gpio_free(TOSA_GPIO_PWR_ON);
296err_gpio_pwr:
297err_gpio_wp_dir:
298 gpio_free(TOSA_GPIO_SD_WP);
299err_gpio_wp:
300 free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data);
301err_irq:
Dmitry Baryshkovc4d5f8d2008-06-09 13:23:50 +0100302err_gpio_detect_dir:
303 gpio_free(TOSA_GPIO_nSD_DETECT);
304err_gpio_detect:
Russell King2687bd32008-01-23 14:05:58 +0000305 return err;
Dirk Opfera93876c2005-11-08 19:15:30 +0000306}
307
308static void tosa_mci_setpower(struct device *dev, unsigned int vdd)
309{
310 struct pxamci_platform_data* p_d = dev->platform_data;
311
312 if (( 1 << vdd) & p_d->ocr_mask) {
Dmitry Baryshkovd4e7d092008-04-12 20:16:16 +0100313 gpio_set_value(TOSA_GPIO_PWR_ON, 1);
Dirk Opfera93876c2005-11-08 19:15:30 +0000314 } else {
Dmitry Baryshkovd4e7d092008-04-12 20:16:16 +0100315 gpio_set_value(TOSA_GPIO_PWR_ON, 0);
Dirk Opfera93876c2005-11-08 19:15:30 +0000316 }
317}
318
319static int tosa_mci_get_ro(struct device *dev)
320{
Dmitry Baryshkovd4e7d092008-04-12 20:16:16 +0100321 return gpio_get_value(TOSA_GPIO_SD_WP);
Dirk Opfera93876c2005-11-08 19:15:30 +0000322}
323
324static void tosa_mci_exit(struct device *dev, void *data)
325{
Dmitry Baryshkovc4d5f8d2008-06-09 13:23:50 +0100326 gpio_free(TOSA_GPIO_nSD_INT);
Dmitry Baryshkovd4e7d092008-04-12 20:16:16 +0100327 gpio_free(TOSA_GPIO_PWR_ON);
328 gpio_free(TOSA_GPIO_SD_WP);
Dirk Opfera93876c2005-11-08 19:15:30 +0000329 free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data);
Dmitry Baryshkovc4d5f8d2008-06-09 13:23:50 +0100330 gpio_free(TOSA_GPIO_nSD_DETECT);
Dirk Opfera93876c2005-11-08 19:15:30 +0000331}
332
333static struct pxamci_platform_data tosa_mci_platform_data = {
334 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
335 .init = tosa_mci_init,
336 .get_ro = tosa_mci_get_ro,
337 .setpower = tosa_mci_setpower,
338 .exit = tosa_mci_exit,
339};
340
341/*
342 * Irda
343 */
Dmitry Baryshkovd4e7d092008-04-12 20:16:16 +0100344static int tosa_irda_startup(struct device *dev)
345{
346 int ret;
347
348 ret = gpio_request(TOSA_GPIO_IR_POWERDWN, "IrDA powerdown");
349 if (ret)
350 return ret;
351
352 ret = gpio_direction_output(TOSA_GPIO_IR_POWERDWN, 0);
353 if (ret)
354 gpio_free(TOSA_GPIO_IR_POWERDWN);
355
356 return ret;
357 }
358
359static void tosa_irda_shutdown(struct device *dev)
360{
361 gpio_free(TOSA_GPIO_IR_POWERDWN);
362}
363
Dirk Opfera93876c2005-11-08 19:15:30 +0000364static void tosa_irda_transceiver_mode(struct device *dev, int mode)
365{
Dmitry Baryshkovd4e7d092008-04-12 20:16:16 +0100366 gpio_set_value(TOSA_GPIO_IR_POWERDWN, !(mode & IR_OFF));
Dirk Opfera93876c2005-11-08 19:15:30 +0000367}
368
369static struct pxaficp_platform_data tosa_ficp_platform_data = {
370 .transceiver_cap = IR_SIRMODE | IR_OFF,
371 .transceiver_mode = tosa_irda_transceiver_mode,
Dmitry Baryshkovd4e7d092008-04-12 20:16:16 +0100372 .startup = tosa_irda_startup,
373 .shutdown = tosa_irda_shutdown,
Dirk Opfera93876c2005-11-08 19:15:30 +0000374};
375
376/*
377 * Tosa Keyboard
378 */
379static struct platform_device tosakbd_device = {
380 .name = "tosa-keyboard",
381 .id = -1,
382};
Dirk Opfer8459c152005-11-06 14:27:52 +0000383
Dmitry Baryshkov93e9012f2008-01-21 01:04:20 -0500384static struct gpio_keys_button tosa_gpio_keys[] = {
Dmitry Baryshkov0aa975612008-04-12 20:02:50 +0100385 /*
386 * Two following keys are directly tied to "ON" button of tosa. Why?
387 * The first one can be used as a wakeup source, the second can't;
388 * also the first one is OR of ac_powered and on_button.
389 */
390 {
391 .type = EV_PWR,
392 .code = KEY_RESERVED,
393 .gpio = TOSA_GPIO_POWERON,
394 .desc = "Poweron",
395 .wakeup = 1,
396 .active_low = 1,
397 },
Dmitry Baryshkov93e9012f2008-01-21 01:04:20 -0500398 {
399 .type = EV_PWR,
400 .code = KEY_SUSPEND,
401 .gpio = TOSA_GPIO_ON_KEY,
402 .desc = "On key",
Dmitry Baryshkov0aa975612008-04-12 20:02:50 +0100403 /*
404 * can't be used as wakeup
405 * .wakeup = 1,
406 */
Dmitry Baryshkov93e9012f2008-01-21 01:04:20 -0500407 .active_low = 1,
408 },
409 {
410 .type = EV_KEY,
411 .code = TOSA_KEY_RECORD,
412 .gpio = TOSA_GPIO_RECORD_BTN,
413 .desc = "Record Button",
414 .wakeup = 1,
415 .active_low = 1,
416 },
417 {
418 .type = EV_KEY,
419 .code = TOSA_KEY_SYNC,
420 .gpio = TOSA_GPIO_SYNC,
421 .desc = "Sync Button",
422 .wakeup = 1,
423 .active_low = 1,
424 },
425};
426
427static struct gpio_keys_platform_data tosa_gpio_keys_platform_data = {
428 .buttons = tosa_gpio_keys,
429 .nbuttons = ARRAY_SIZE(tosa_gpio_keys),
430};
431
432static struct platform_device tosa_gpio_keys_device = {
433 .name = "gpio-keys",
434 .id = -1,
435 .dev = {
436 .platform_data = &tosa_gpio_keys_platform_data,
437 },
438};
439
Dirk Opfer6d0cf3e2006-03-31 02:31:12 -0800440/*
441 * Tosa LEDs
442 */
Dmitry Baryshkovba4eb7e2008-04-19 10:42:25 +0100443static struct gpio_led tosa_gpio_leds[] = {
Dmitry Baryshkov311c7362008-04-12 20:17:02 +0100444 {
445 .name = "tosa:amber:charge",
446 .default_trigger = "main-battery-charging",
447 .gpio = TOSA_GPIO_CHRG_ERR_LED,
448 },
449 {
450 .name = "tosa:green:mail",
451 .default_trigger = "nand-disk",
452 .gpio = TOSA_GPIO_NOTE_LED,
453 },
Dmitry Baryshkovc5461062008-04-19 10:42:06 +0100454 {
455 .name = "tosa:dual:wlan",
456 .default_trigger = "none",
457 .gpio = TOSA_GPIO_WLAN_LED,
458 },
459 {
460 .name = "tosa:blue:bluetooth",
461 .default_trigger = "none",
462 .gpio = TOSA_GPIO_BT_LED,
463 },
Dmitry Baryshkov311c7362008-04-12 20:17:02 +0100464};
465
Dmitry Baryshkovba4eb7e2008-04-19 10:42:25 +0100466static struct gpio_led_platform_data tosa_gpio_leds_platform_data = {
Dmitry Baryshkov311c7362008-04-12 20:17:02 +0100467 .leds = tosa_gpio_leds,
468 .num_leds = ARRAY_SIZE(tosa_gpio_leds),
469};
470
Dirk Opfer6d0cf3e2006-03-31 02:31:12 -0800471static struct platform_device tosaled_device = {
Dmitry Baryshkov311c7362008-04-12 20:17:02 +0100472 .name = "leds-gpio",
473 .id = -1,
474 .dev = {
475 .platform_data = &tosa_gpio_leds_platform_data,
476 },
Dirk Opfer6d0cf3e2006-03-31 02:31:12 -0800477};
478
Dirk Opfer8459c152005-11-06 14:27:52 +0000479static struct platform_device *devices[] __initdata = {
480 &tosascoop_device,
481 &tosascoop_jc_device,
Dirk Opfera93876c2005-11-08 19:15:30 +0000482 &tosakbd_device,
Dmitry Baryshkov93e9012f2008-01-21 01:04:20 -0500483 &tosa_gpio_keys_device,
Dirk Opfer6d0cf3e2006-03-31 02:31:12 -0800484 &tosaled_device,
Dirk Opfer8459c152005-11-06 14:27:52 +0000485};
486
Richard Purdie74617fb2006-06-19 19:57:12 +0100487static void tosa_poweroff(void)
488{
Dmitry Baryshkov86159a92008-05-22 16:21:48 +0100489 arm_machine_restart('g');
Richard Purdie74617fb2006-06-19 19:57:12 +0100490}
491
492static void tosa_restart(char mode)
493{
494 /* Bootloader magic for a reboot */
495 if((MSC0 & 0xffff0000) == 0x7ff00000)
496 MSC0 = (MSC0 & 0xffff) | 0x7ee00000;
497
498 tosa_poweroff();
499}
500
Dirk Opfer8459c152005-11-06 14:27:52 +0000501static void __init tosa_init(void)
502{
Dmitry Baryshkov2cb47342008-04-10 11:00:32 +0100503 pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config));
504 gpio_set_wake(MFP_PIN_GPIO1, 1);
505 /* We can't pass to gpio-keys since it will drop the Reset altfunc */
506
Dmitry Baryshkov86159a92008-05-22 16:21:48 +0100507 init_gpio_reset(TOSA_GPIO_ON_RESET);
508
Richard Purdie74617fb2006-06-19 19:57:12 +0100509 pm_power_off = tosa_poweroff;
510 arm_pm_restart = tosa_restart;
511
Dirk Opfer8459c152005-11-06 14:27:52 +0000512 PCFR |= PCFR_OPDE;
513
Dirk Opfera93876c2005-11-08 19:15:30 +0000514 /* enable batt_fault */
Dirk Opfer8459c152005-11-06 14:27:52 +0000515 PMCR = 0x01;
516
Dirk Opfera93876c2005-11-08 19:15:30 +0000517 pxa_set_mci_info(&tosa_mci_platform_data);
518 pxa_set_udc_info(&udc_info);
519 pxa_set_ficp_info(&tosa_ficp_platform_data);
Dmitry Baryshkov481ea5a2008-04-10 15:43:18 +0100520 pxa_set_i2c_info(NULL);
Dirk Opfer4c18ad22005-11-08 19:15:50 +0000521 platform_scoop_config = &tosa_pcmcia_config;
Dirk Opfer8459c152005-11-06 14:27:52 +0000522
Dirk Opfer4c18ad22005-11-08 19:15:50 +0000523 platform_add_devices(devices, ARRAY_SIZE(devices));
Dirk Opfer8459c152005-11-06 14:27:52 +0000524}
525
526static void __init fixup_tosa(struct machine_desc *desc,
527 struct tag *tags, char **cmdline, struct meminfo *mi)
528{
529 sharpsl_save_param();
530 mi->nr_banks=1;
531 mi->bank[0].start = 0xa0000000;
532 mi->bank[0].node = 0;
533 mi->bank[0].size = (64*1024*1024);
534}
535
536MACHINE_START(TOSA, "SHARP Tosa")
Dirk Opfer8459c152005-11-06 14:27:52 +0000537 .phys_io = 0x40000000,
538 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
539 .fixup = fixup_tosa,
540 .map_io = pxa_map_io,
Eric Miaocd491042007-06-22 04:14:09 +0100541 .init_irq = pxa25x_init_irq,
Dirk Opfer8459c152005-11-06 14:27:52 +0000542 .init_machine = tosa_init,
543 .timer = &pxa_timer,
544MACHINE_END