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