[ARM] pxa/spitz: use leds-gpio for led driving and drop leds-spitz
[deliverable/linux.git] / arch / arm / mach-pxa / spitz.c
CommitLineData
0dd28f1d
RP
1/*
2 * Support for Sharp SL-Cxx00 Series of PDAs
3 * Models: SL-C3000 (Spitz), SL-C1000 (Akita) and SL-C3100 (Borzoi)
4 *
5 * Copyright (c) 2005 Richard Purdie
6 *
7 * Based on Sharp's 2.4 kernel patches/lubbock.c
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>
d052d1be 17#include <linux/platform_device.h>
0dd28f1d
RP
18#include <linux/delay.h>
19#include <linux/major.h>
20#include <linux/fs.h>
21#include <linux/interrupt.h>
dd5980d6 22#include <linux/gpio.h>
4fe3224f 23#include <linux/leds.h>
0dd28f1d 24#include <linux/mmc/host.h>
74617fb6 25#include <linux/pm.h>
c3f8f650 26#include <linux/backlight.h>
859b7963
EM
27#include <linux/spi/spi.h>
28#include <linux/spi/ads7846.h>
29#include <linux/spi/corgi_lcd.h>
0dd28f1d
RP
30
31#include <asm/setup.h>
32#include <asm/memory.h>
33#include <asm/mach-types.h>
a09e64fb 34#include <mach/hardware.h>
0dd28f1d
RP
35#include <asm/irq.h>
36#include <asm/io.h>
74617fb6 37#include <asm/system.h>
0dd28f1d
RP
38
39#include <asm/mach/arch.h>
40#include <asm/mach/map.h>
41#include <asm/mach/irq.h>
42
a09e64fb
RK
43#include <mach/pxa-regs.h>
44#include <mach/pxa2xx-regs.h>
5e96adec 45#include <mach/mfp-pxa27x.h>
a09e64fb 46#include <mach/pxa27x-udc.h>
afd2fc02 47#include <mach/reset.h>
f8787fdc 48#include <mach/i2c.h>
a09e64fb
RK
49#include <mach/irda.h>
50#include <mach/mmc.h>
51#include <mach/ohci.h>
52#include <mach/udc.h>
53#include <mach/pxafb.h>
859b7963 54#include <mach/pxa2xx_spi.h>
a09e64fb
RK
55#include <mach/akita.h>
56#include <mach/spitz.h>
57#include <mach/sharpsl.h>
0dd28f1d
RP
58
59#include <asm/mach/sharpsl_param.h>
60#include <asm/hardware/scoop.h>
61
62#include "generic.h"
46c41e62 63#include "devices.h"
0dd28f1d
RP
64#include "sharpsl.h"
65
5e96adec
EM
66static unsigned long spitz_pin_config[] __initdata = {
67 /* Chip Selects */
68 GPIO78_nCS_2, /* SCOOP #2 */
69 GPIO80_nCS_4, /* SCOOP #1 */
70
71 /* LCD - 16bpp Active TFT */
72 GPIO58_LCD_LDD_0,
73 GPIO59_LCD_LDD_1,
74 GPIO60_LCD_LDD_2,
75 GPIO61_LCD_LDD_3,
76 GPIO62_LCD_LDD_4,
77 GPIO63_LCD_LDD_5,
78 GPIO64_LCD_LDD_6,
79 GPIO65_LCD_LDD_7,
80 GPIO66_LCD_LDD_8,
81 GPIO67_LCD_LDD_9,
82 GPIO68_LCD_LDD_10,
83 GPIO69_LCD_LDD_11,
84 GPIO70_LCD_LDD_12,
85 GPIO71_LCD_LDD_13,
86 GPIO72_LCD_LDD_14,
87 GPIO73_LCD_LDD_15,
88 GPIO74_LCD_FCLK,
89 GPIO75_LCD_LCLK,
90 GPIO76_LCD_PCLK,
91
92 /* PC Card */
93 GPIO48_nPOE,
94 GPIO49_nPWE,
95 GPIO50_nPIOR,
96 GPIO51_nPIOW,
97 GPIO85_nPCE_1,
98 GPIO54_nPCE_2,
99 GPIO79_PSKTSEL,
100 GPIO55_nPREG,
101 GPIO56_nPWAIT,
102 GPIO57_nIOIS16,
103
104 /* MMC */
105 GPIO32_MMC_CLK,
106 GPIO112_MMC_CMD,
107 GPIO92_MMC_DAT_0,
108 GPIO109_MMC_DAT_1,
109 GPIO110_MMC_DAT_2,
110 GPIO111_MMC_DAT_3,
111
112 /* GPIOs */
113 GPIO9_GPIO, /* SPITZ_GPIO_nSD_DETECT */
114 GPIO81_GPIO, /* SPITZ_GPIO_nSD_WP */
115 GPIO41_GPIO, /* SPITZ_GPIO_USB_CONNECT */
116 GPIO37_GPIO, /* SPITZ_GPIO_USB_HOST */
117 GPIO35_GPIO, /* SPITZ_GPIO_USB_DEVICE */
118 GPIO22_GPIO, /* SPITZ_GPIO_HSYNC */
119 GPIO94_GPIO, /* SPITZ_GPIO_CF_CD */
120 GPIO105_GPIO, /* SPITZ_GPIO_CF_IRQ */
121 GPIO106_GPIO, /* SPITZ_GPIO_CF2_IRQ */
122
123 GPIO1_GPIO | WAKEUP_ON_EDGE_RISE,
124};
125
0dd28f1d
RP
126/*
127 * Spitz SCOOP Device #1
128 */
129static struct resource spitz_scoop_resources[] = {
130 [0] = {
131 .start = 0x10800000,
132 .end = 0x10800fff,
133 .flags = IORESOURCE_MEM,
134 },
135};
136
137static struct scoop_config spitz_scoop_setup = {
fff14720 138 .io_dir = SPITZ_SCP_IO_DIR,
0dd28f1d 139 .io_out = SPITZ_SCP_IO_OUT,
fff14720
EM
140 .suspend_clr = SPITZ_SCP_SUS_CLR,
141 .suspend_set = SPITZ_SCP_SUS_SET,
142 .gpio_base = SPITZ_SCP_GPIO_BASE,
0dd28f1d
RP
143};
144
145struct platform_device spitzscoop_device = {
146 .name = "sharp-scoop",
147 .id = 0,
148 .dev = {
149 .platform_data = &spitz_scoop_setup,
150 },
151 .num_resources = ARRAY_SIZE(spitz_scoop_resources),
152 .resource = spitz_scoop_resources,
153};
154
155/*
156 * Spitz SCOOP Device #2
157 */
158static struct resource spitz_scoop2_resources[] = {
159 [0] = {
160 .start = 0x08800040,
161 .end = 0x08800fff,
162 .flags = IORESOURCE_MEM,
163 },
164};
165
166static struct scoop_config spitz_scoop2_setup = {
fff14720 167 .io_dir = SPITZ_SCP2_IO_DIR,
0dd28f1d 168 .io_out = SPITZ_SCP2_IO_OUT,
fff14720
EM
169 .suspend_clr = SPITZ_SCP2_SUS_CLR,
170 .suspend_set = SPITZ_SCP2_SUS_SET,
171 .gpio_base = SPITZ_SCP2_GPIO_BASE,
0dd28f1d
RP
172};
173
174struct platform_device spitzscoop2_device = {
175 .name = "sharp-scoop",
176 .id = 1,
177 .dev = {
178 .platform_data = &spitz_scoop2_setup,
179 },
180 .num_resources = ARRAY_SIZE(spitz_scoop2_resources),
181 .resource = spitz_scoop2_resources,
182};
183
a63ae442
RP
184#define SPITZ_PWR_SD 0x01
185#define SPITZ_PWR_CF 0x02
186
187/* Power control is shared with between one of the CF slots and SD */
188static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr)
189{
190 unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR);
191
192 if (new_cpr & 0x0007) {
fff14720 193 gpio_set_value(SPITZ_GPIO_CF_POWER, 1);
a63ae442
RP
194 if (!(cpr & 0x0002) && !(cpr & 0x0004))
195 mdelay(5);
196 if (device == SPITZ_PWR_CF)
197 cpr |= 0x0002;
198 if (device == SPITZ_PWR_SD)
199 cpr |= 0x0004;
200 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
201 } else {
202 if (device == SPITZ_PWR_CF)
203 cpr &= ~0x0002;
204 if (device == SPITZ_PWR_SD)
205 cpr &= ~0x0004;
a63ae442 206 if (!(cpr & 0x0002) && !(cpr & 0x0004)) {
945b9579 207 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, 0x0000);
a63ae442 208 mdelay(1);
fff14720 209 gpio_set_value(SPITZ_GPIO_CF_POWER, 0);
945b9579
RP
210 } else {
211 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
a63ae442
RP
212 }
213 }
214}
215
a63ae442
RP
216static void spitz_pcmcia_pwr(struct device *scoop, unsigned short cpr, int nr)
217{
218 /* Only need to override behaviour for slot 0 */
219 if (nr == 0)
220 spitz_card_pwr_ctrl(SPITZ_PWR_CF, cpr);
221 else
222 write_scoop_reg(scoop, SCOOP_CPR, cpr);
223}
224
0dd28f1d
RP
225static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = {
226{
227 .dev = &spitzscoop_device.dev,
228 .irq = SPITZ_IRQ_GPIO_CF_IRQ,
229 .cd_irq = SPITZ_IRQ_GPIO_CF_CD,
230 .cd_irq_str = "PCMCIA0 CD",
231},{
232 .dev = &spitzscoop2_device.dev,
233 .irq = SPITZ_IRQ_GPIO_CF2_IRQ,
234 .cd_irq = -1,
235},
236};
237
a63ae442
RP
238static struct scoop_pcmcia_config spitz_pcmcia_config = {
239 .devs = &spitz_pcmcia_scoop[0],
240 .num_devs = 2,
a63ae442
RP
241 .power_ctrl = spitz_pcmcia_pwr,
242};
243
244EXPORT_SYMBOL(spitzscoop_device);
245EXPORT_SYMBOL(spitzscoop2_device);
246
0dd28f1d
RP
247/*
248 * Spitz Keyboard Device
249 */
250static struct platform_device spitzkbd_device = {
251 .name = "spitz-keyboard",
252 .id = -1,
253};
254
255
3179108d
RP
256/*
257 * Spitz LEDs
258 */
4fe3224f
EM
259static struct gpio_led spitz_gpio_leds[] = {
260 {
261 .name = "spitz:amber:charge",
262 .default_trigger = "sharpsl-charge",
263 .gpio = SPITZ_GPIO_LED_ORANGE,
264 },
265 {
266 .name = "spitz:green:hddactivity",
267 .default_trigger = "ide-disk",
268 .gpio = SPITZ_GPIO_LED_GREEN,
269 },
270};
271
272static struct gpio_led_platform_data spitz_gpio_leds_info = {
273 .leds = spitz_gpio_leds,
274 .num_leds = ARRAY_SIZE(spitz_gpio_leds),
275};
276
3179108d 277static struct platform_device spitzled_device = {
4fe3224f 278 .name = "leds-gpio",
3179108d 279 .id = -1,
4fe3224f
EM
280 .dev = {
281 .platform_data = &spitz_gpio_leds_info,
282 },
3179108d
RP
283};
284
859b7963
EM
285#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
286static struct pxa2xx_spi_master spitz_spi_info = {
287 .num_chipselect = 3,
288};
ca4d6cfc 289
859b7963
EM
290static struct ads7846_platform_data spitz_ads7846_info = {
291 .model = 7846,
292 .vref_delay_usecs = 100,
293 .x_plate_ohms = 419,
294 .y_plate_ohms = 486,
295 .gpio_pendown = SPITZ_GPIO_TP_INT,
296};
ca4d6cfc 297
859b7963 298static void spitz_ads7846_cs(u32 command)
ca4d6cfc 299{
859b7963 300 gpio_set_value(SPITZ_GPIO_ADS7846_CS, !(command == PXA2XX_CS_ASSERT));
ca4d6cfc
RP
301}
302
859b7963
EM
303static struct pxa2xx_spi_chip spitz_ads7846_chip = {
304 .cs_control = spitz_ads7846_cs,
305};
ca4d6cfc 306
859b7963 307static void spitz_notify_intensity(int intensity)
ca4d6cfc 308{
859b7963 309 if (machine_is_spitz() || machine_is_borzoi()) {
fff14720
EM
310 gpio_set_value(SPITZ_GPIO_BACKLIGHT_CONT, !(intensity & 0x20));
311 gpio_set_value(SPITZ_GPIO_BACKLIGHT_ON, intensity);
859b7963
EM
312 return;
313 }
ca4d6cfc 314
859b7963
EM
315 if (machine_is_akita()) {
316 /* Bit 5 is via IO-Expander */
317 if (intensity & 0x0020)
318 akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT);
319 else
320 akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_CONT);
321
322 if (intensity)
323 akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON);
324 else
325 akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_BACKLIGHT_ON);
326 return;
327 }
ca4d6cfc
RP
328}
329
859b7963 330static void spitz_bl_kick_battery(void)
ca4d6cfc 331{
859b7963 332 void (*kick_batt)(void);
ca4d6cfc 333
859b7963
EM
334 kick_batt = symbol_get(sharpsl_battery_kick);
335 if (kick_batt) {
336 kick_batt();
337 symbol_put(sharpsl_battery_kick);
338 }
ca4d6cfc
RP
339}
340
859b7963
EM
341static struct corgi_lcd_platform_data spitz_lcdcon_info = {
342 .init_mode = CORGI_LCD_MODE_VGA,
343 .max_intensity = 0x2f,
344 .default_intensity = 0x1f,
345 .limit_mask = 0x0b,
346 .notify = spitz_notify_intensity,
347 .kick_battery = spitz_bl_kick_battery,
348};
ca4d6cfc 349
859b7963 350static void spitz_lcdcon_cs(u32 command)
ca4d6cfc 351{
859b7963 352 gpio_set_value(SPITZ_GPIO_LCDCON_CS, !(command == PXA2XX_CS_ASSERT));
ca4d6cfc
RP
353}
354
859b7963
EM
355static struct pxa2xx_spi_chip spitz_lcdcon_chip = {
356 .cs_control = spitz_lcdcon_cs,
0dd28f1d
RP
357};
358
859b7963
EM
359static void spitz_max1111_cs(u32 command)
360{
361 gpio_set_value(SPITZ_GPIO_MAX1111_CS, !(command == PXA2XX_CS_ASSERT));
362}
363
364static struct pxa2xx_spi_chip spitz_max1111_chip = {
365 .cs_control = spitz_max1111_cs,
0dd28f1d
RP
366};
367
859b7963
EM
368static struct spi_board_info spitz_spi_devices[] = {
369 {
370 .modalias = "ads7846",
371 .max_speed_hz = 1200000,
372 .bus_num = 2,
373 .chip_select = 0,
374 .platform_data = &spitz_ads7846_info,
375 .controller_data= &spitz_ads7846_chip,
376 .irq = gpio_to_irq(SPITZ_GPIO_TP_INT),
377 }, {
378 .modalias = "corgi-lcd",
379 .max_speed_hz = 50000,
380 .bus_num = 2,
381 .chip_select = 1,
382 .platform_data = &spitz_lcdcon_info,
383 .controller_data= &spitz_lcdcon_chip,
384 }, {
385 .modalias = "max1111",
386 .max_speed_hz = 450000,
387 .bus_num = 2,
388 .chip_select = 2,
389 .controller_data= &spitz_max1111_chip,
0dd28f1d 390 },
0dd28f1d
RP
391};
392
859b7963
EM
393static void __init spitz_init_spi(void)
394{
395 int err;
396
397 err = gpio_request(SPITZ_GPIO_ADS7846_CS, "ADS7846_CS");
398 if (err)
399 return;
400
401 err = gpio_request(SPITZ_GPIO_LCDCON_CS, "LCDCON_CS");
402 if (err)
403 goto err_free_1;
404
405 err = gpio_request(SPITZ_GPIO_MAX1111_CS, "MAX1111_CS");
406 if (err)
407 goto err_free_2;
408
409 pxa2xx_set_spi_info(2, &spitz_spi_info);
410 spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices));
411 return;
412
413err_free_2:
414 gpio_free(SPITZ_GPIO_LCDCON_CS);
415err_free_1:
416 gpio_free(SPITZ_GPIO_ADS7846_CS);
417}
418#else
419static inline void spitz_init_spi(void) {}
420#endif
0dd28f1d
RP
421
422/*
423 * MMC/SD Device
424 *
425 * The card detect interrupt isn't debounced so we delay it by 250ms
426 * to give the card a chance to fully insert/eject.
427 */
428
429static struct pxamci_platform_data spitz_mci_platform_data;
430
40220c1a 431static int spitz_mci_init(struct device *dev, irq_handler_t spitz_detect_int, void *data)
0dd28f1d
RP
432{
433 int err;
434
dd5980d6
EM
435 err = gpio_request(SPITZ_GPIO_nSD_DETECT, "nSD_DETECT");
436 if (err)
437 goto err_out;
438
439 err = gpio_request(SPITZ_GPIO_nSD_WP, "nSD_WP");
440 if (err)
441 goto err_free_1;
442
443 gpio_direction_input(SPITZ_GPIO_nSD_DETECT);
444 gpio_direction_input(SPITZ_GPIO_nSD_WP);
0dd28f1d
RP
445
446 spitz_mci_platform_data.detect_delay = msecs_to_jiffies(250);
447
9ded96f2 448 err = request_irq(SPITZ_IRQ_GPIO_nSD_DETECT, spitz_detect_int,
dd5980d6
EM
449 IRQF_DISABLED | IRQF_TRIGGER_RISING |
450 IRQF_TRIGGER_FALLING,
9ded96f2 451 "MMC card detect", data);
dd5980d6
EM
452 if (err) {
453 pr_err("%s: MMC/SD: can't request MMC card detect IRQ\n",
454 __func__);
455 goto err_free_2;
456 }
457 return 0;
0dd28f1d 458
dd5980d6
EM
459err_free_2:
460 gpio_free(SPITZ_GPIO_nSD_WP);
461err_free_1:
462 gpio_free(SPITZ_GPIO_nSD_DETECT);
463err_out:
2687bd38 464 return err;
0dd28f1d
RP
465}
466
0dd28f1d
RP
467static void spitz_mci_setpower(struct device *dev, unsigned int vdd)
468{
469 struct pxamci_platform_data* p_d = dev->platform_data;
470
a63ae442
RP
471 if (( 1 << vdd) & p_d->ocr_mask)
472 spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0004);
473 else
474 spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0000);
0dd28f1d
RP
475}
476
477static int spitz_mci_get_ro(struct device *dev)
478{
dd5980d6 479 return gpio_get_value(SPITZ_GPIO_nSD_WP);
0dd28f1d
RP
480}
481
482static void spitz_mci_exit(struct device *dev, void *data)
483{
484 free_irq(SPITZ_IRQ_GPIO_nSD_DETECT, data);
dd5980d6
EM
485 gpio_free(SPITZ_GPIO_nSD_WP);
486 gpio_free(SPITZ_GPIO_nSD_DETECT);
0dd28f1d
RP
487}
488
489static struct pxamci_platform_data spitz_mci_platform_data = {
490 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
491 .init = spitz_mci_init,
492 .get_ro = spitz_mci_get_ro,
493 .setpower = spitz_mci_setpower,
494 .exit = spitz_mci_exit,
495};
496
497
3125c68d
RP
498/*
499 * USB Host (OHCI)
500 */
501static int spitz_ohci_init(struct device *dev)
502{
dd5980d6
EM
503 int err;
504
505 err = gpio_request(SPITZ_GPIO_USB_HOST, "USB_HOST");
506 if (err)
507 return err;
508
5e96adec
EM
509 /* Only Port 2 is connected
510 * Setup USB Port 2 Output Control Register
511 */
3125c68d
RP
512 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
513
dd5980d6 514 gpio_direction_output(SPITZ_GPIO_USB_HOST, 1);
3125c68d
RP
515
516 UHCHR = (UHCHR) &
517 ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
518
519 UHCRHDA |= UHCRHDA_NOCP;
520
521 return 0;
522}
523
524static struct pxaohci_platform_data spitz_ohci_platform_data = {
525 .port_mode = PMM_NPS_MODE,
526 .init = spitz_ohci_init,
0c27c5d5 527 .power_budget = 150,
3125c68d
RP
528};
529
530
dc07845d
RP
531/*
532 * Irda
533 */
fff14720
EM
534static int spitz_irda_startup(struct device *dev)
535{
536 int rc;
537
538 rc = gpio_request(SPITZ_GPIO_IR_ON, "IrDA on");
539 if (rc)
540 goto err;
541
542 rc = gpio_direction_output(SPITZ_GPIO_IR_ON, 1);
543 if (rc)
544 goto err_dir;
545
546 return 0;
547
548err_dir:
549 gpio_free(SPITZ_GPIO_IR_ON);
550err:
551 return rc;
552}
553
554static void spitz_irda_shutdown(struct device *dev)
555{
556 gpio_free(SPITZ_GPIO_IR_ON);
557}
558
dc07845d
RP
559static void spitz_irda_transceiver_mode(struct device *dev, int mode)
560{
fff14720 561 gpio_set_value(SPITZ_GPIO_IR_ON, mode & IR_OFF);
0fc3ff31 562 pxa2xx_transceiver_mode(dev, mode);
dc07845d
RP
563}
564
94cabd00
RP
565#ifdef CONFIG_MACH_AKITA
566static void akita_irda_transceiver_mode(struct device *dev, int mode)
567{
568 if (mode & IR_OFF)
569 akita_set_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON);
570 else
571 akita_reset_ioexp(&akitaioexp_device.dev, AKITA_IOEXP_IR_ON);
0fc3ff31 572 pxa2xx_transceiver_mode(dev, mode);
94cabd00
RP
573}
574#endif
575
dc07845d 576static struct pxaficp_platform_data spitz_ficp_platform_data = {
fff14720
EM
577 .transceiver_cap = IR_SIRMODE | IR_OFF,
578 .transceiver_mode = spitz_irda_transceiver_mode,
579 .startup = spitz_irda_startup,
580 .shutdown = spitz_irda_shutdown,
dc07845d
RP
581};
582
583
0dd28f1d
RP
584/*
585 * Spitz PXA Framebuffer
586 */
d14b272b
RP
587
588static struct pxafb_mode_info spitz_pxafb_modes[] = {
589{
590 .pixclock = 19231,
591 .xres = 480,
592 .yres = 640,
593 .bpp = 16,
594 .hsync_len = 40,
595 .left_margin = 46,
596 .right_margin = 125,
597 .vsync_len = 3,
598 .upper_margin = 1,
599 .lower_margin = 0,
600 .sync = 0,
601},{
602 .pixclock = 134617,
603 .xres = 240,
604 .yres = 320,
605 .bpp = 16,
606 .hsync_len = 20,
607 .left_margin = 20,
608 .right_margin = 46,
609 .vsync_len = 2,
610 .upper_margin = 1,
611 .lower_margin = 0,
612 .sync = 0,
613},
614};
615
616static struct pxafb_mach_info spitz_pxafb_info = {
617 .modes = &spitz_pxafb_modes[0],
618 .num_modes = 2,
619 .fixed_modes = 1,
79009a06 620 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_ALTERNATE_MAPPING,
0dd28f1d
RP
621};
622
623
624static struct platform_device *devices[] __initdata = {
625 &spitzscoop_device,
0dd28f1d 626 &spitzkbd_device,
3179108d 627 &spitzled_device,
0dd28f1d
RP
628};
629
74617fb6
RP
630static void spitz_poweroff(void)
631{
86159a98 632 arm_machine_restart('g');
74617fb6
RP
633}
634
635static void spitz_restart(char mode)
636{
637 /* Bootloader magic for a reboot */
638 if((MSC0 & 0xffff0000) == 0x7ff00000)
639 MSC0 = (MSC0 & 0xffff) | 0x7ee00000;
640
641 spitz_poweroff();
642}
643
0dd28f1d
RP
644static void __init common_init(void)
645{
86159a98 646 init_gpio_reset(SPITZ_GPIO_ON_RESET);
74617fb6
RP
647 pm_power_off = spitz_poweroff;
648 arm_pm_restart = spitz_restart;
649
0dd28f1d
RP
650 PMCR = 0x00;
651
0dd28f1d
RP
652 /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
653 PCFR |= PCFR_OPDE;
654
5e96adec 655 pxa2xx_mfp_config(ARRAY_AND_SIZE(spitz_pin_config));
0dd28f1d 656
859b7963 657 spitz_init_spi();
0dd28f1d
RP
658
659 platform_add_devices(devices, ARRAY_SIZE(devices));
660 pxa_set_mci_info(&spitz_mci_platform_data);
3125c68d 661 pxa_set_ohci_info(&spitz_ohci_platform_data);
dc07845d 662 pxa_set_ficp_info(&spitz_ficp_platform_data);
0dd28f1d 663 set_pxa_fb_info(&spitz_pxafb_info);
f8787fdc 664 pxa_set_i2c_info(NULL);
0dd28f1d
RP
665}
666
ca4d6cfc 667#if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI)
0dd28f1d
RP
668static void __init spitz_init(void)
669{
a63ae442
RP
670 platform_scoop_config = &spitz_pcmcia_config;
671
0dd28f1d
RP
672 common_init();
673
674 platform_device_register(&spitzscoop2_device);
675}
ca4d6cfc 676#endif
0dd28f1d 677
94cabd00
RP
678#ifdef CONFIG_MACH_AKITA
679/*
680 * Akita IO Expander
681 */
682struct platform_device akitaioexp_device = {
683 .name = "akita-ioexp",
684 .id = -1,
685};
686
bd8f103e
RP
687EXPORT_SYMBOL_GPL(akitaioexp_device);
688
94cabd00
RP
689static void __init akita_init(void)
690{
691 spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode;
692
693 /* We just pretend the second element of the array doesn't exist */
694 spitz_pcmcia_config.num_devs = 1;
695 platform_scoop_config = &spitz_pcmcia_config;
94cabd00
RP
696
697 platform_device_register(&akitaioexp_device);
698
699 spitzscoop_device.dev.parent = &akitaioexp_device.dev;
700 common_init();
701}
702#endif
703
0dd28f1d
RP
704static void __init fixup_spitz(struct machine_desc *desc,
705 struct tag *tags, char **cmdline, struct meminfo *mi)
706{
707 sharpsl_save_param();
708 mi->nr_banks = 1;
709 mi->bank[0].start = 0xa0000000;
710 mi->bank[0].node = 0;
711 mi->bank[0].size = (64*1024*1024);
712}
713
714#ifdef CONFIG_MACH_SPITZ
715MACHINE_START(SPITZ, "SHARP Spitz")
0dd28f1d
RP
716 .phys_io = 0x40000000,
717 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
718 .fixup = fixup_spitz,
719 .map_io = pxa_map_io,
cd49104d 720 .init_irq = pxa27x_init_irq,
0dd28f1d
RP
721 .init_machine = spitz_init,
722 .timer = &pxa_timer,
723MACHINE_END
724#endif
725
726#ifdef CONFIG_MACH_BORZOI
727MACHINE_START(BORZOI, "SHARP Borzoi")
0dd28f1d
RP
728 .phys_io = 0x40000000,
729 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
730 .fixup = fixup_spitz,
731 .map_io = pxa_map_io,
cd49104d 732 .init_irq = pxa27x_init_irq,
0dd28f1d
RP
733 .init_machine = spitz_init,
734 .timer = &pxa_timer,
735MACHINE_END
736#endif
94cabd00
RP
737
738#ifdef CONFIG_MACH_AKITA
739MACHINE_START(AKITA, "SHARP Akita")
94cabd00
RP
740 .phys_io = 0x40000000,
741 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
742 .fixup = fixup_spitz,
743 .map_io = pxa_map_io,
cd49104d 744 .init_irq = pxa27x_init_irq,
94cabd00
RP
745 .init_machine = akita_init,
746 .timer = &pxa_timer,
747MACHINE_END
748#endif
This page took 0.333622 seconds and 5 git commands to generate.