aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-pxa/include/mach/spitz.h6
-rw-r--r--arch/arm/mach-pxa/spitz.c474
2 files changed, 311 insertions, 169 deletions
diff --git a/arch/arm/mach-pxa/include/mach/spitz.h b/arch/arm/mach-pxa/include/mach/spitz.h
index dc1ff254229e..685749a51c42 100644
--- a/arch/arm/mach-pxa/include/mach/spitz.h
+++ b/arch/arm/mach-pxa/include/mach/spitz.h
@@ -181,3 +181,9 @@
181#define SPITZ_IRQ_GPIO_CF2_IRQ IRQ_GPIO(SPITZ_GPIO_CF2_IRQ) 181#define SPITZ_IRQ_GPIO_CF2_IRQ IRQ_GPIO(SPITZ_GPIO_CF2_IRQ)
182#define SPITZ_IRQ_GPIO_nSD_INT IRQ_GPIO(SPITZ_GPIO_nSD_INT) 182#define SPITZ_IRQ_GPIO_nSD_INT IRQ_GPIO(SPITZ_GPIO_nSD_INT)
183#define SPITZ_IRQ_GPIO_nSD_DETECT IRQ_GPIO(SPITZ_GPIO_nSD_DETECT) 183#define SPITZ_IRQ_GPIO_nSD_DETECT IRQ_GPIO(SPITZ_GPIO_nSD_DETECT)
184
185/*
186 * Shared data structures
187 */
188extern struct platform_device spitzssp_device;
189extern struct sharpsl_charger_machinfo spitz_pm_machinfo;
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 5153bf3b8985..24c4d271b219 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -18,14 +18,15 @@
18#include <linux/gpio_keys.h> 18#include <linux/gpio_keys.h>
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/leds.h> 20#include <linux/leds.h>
21#include <linux/mtd/physmap.h>
22#include <linux/i2c.h> 21#include <linux/i2c.h>
23#include <linux/i2c/pca953x.h> 22#include <linux/i2c/pca953x.h>
24#include <linux/spi/spi.h> 23#include <linux/spi/spi.h>
25#include <linux/spi/ads7846.h> 24#include <linux/spi/ads7846.h>
26#include <linux/spi/corgi_lcd.h> 25#include <linux/spi/corgi_lcd.h>
26#include <linux/mtd/physmap.h>
27#include <linux/mtd/sharpsl.h> 27#include <linux/mtd/sharpsl.h>
28#include <linux/input/matrix_keypad.h> 28#include <linux/input/matrix_keypad.h>
29#include <linux/regulator/machine.h>
29 30
30#include <asm/setup.h> 31#include <asm/setup.h>
31#include <asm/mach-types.h> 32#include <asm/mach-types.h>
@@ -33,11 +34,9 @@
33#include <asm/mach/sharpsl_param.h> 34#include <asm/mach/sharpsl_param.h>
34#include <asm/hardware/scoop.h> 35#include <asm/hardware/scoop.h>
35 36
36
37#include <mach/pxa27x.h> 37#include <mach/pxa27x.h>
38#include <mach/pxa27x-udc.h> 38#include <mach/pxa27x-udc.h>
39#include <mach/reset.h> 39#include <mach/reset.h>
40#include <plat/i2c.h>
41#include <mach/irda.h> 40#include <mach/irda.h>
42#include <mach/mmc.h> 41#include <mach/mmc.h>
43#include <mach/ohci.h> 42#include <mach/ohci.h>
@@ -46,9 +45,14 @@
46#include <mach/spitz.h> 45#include <mach/spitz.h>
47#include <mach/sharpsl_pm.h> 46#include <mach/sharpsl_pm.h>
48 47
48#include <plat/i2c.h>
49
49#include "generic.h" 50#include "generic.h"
50#include "devices.h" 51#include "devices.h"
51 52
53/******************************************************************************
54 * Pin configuration
55 ******************************************************************************/
52static unsigned long spitz_pin_config[] __initdata = { 56static unsigned long spitz_pin_config[] __initdata = {
53 /* Chip Selects */ 57 /* Chip Selects */
54 GPIO78_nCS_2, /* SCOOP #2 */ 58 GPIO78_nCS_2, /* SCOOP #2 */
@@ -124,6 +128,11 @@ static unsigned long spitz_pin_config[] __initdata = {
124 GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, /* SPITZ_GPIO_RESET */ 128 GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, /* SPITZ_GPIO_RESET */
125}; 129};
126 130
131
132/******************************************************************************
133 * Scoop GPIO expander
134 ******************************************************************************/
135#if defined(CONFIG_SHARP_SCOOP) || defined(CONFIG_SHARP_SCOOP_MODULE)
127/* 136/*
128 * Spitz SCOOP Device #1 137 * Spitz SCOOP Device #1
129 */ 138 */
@@ -182,43 +191,60 @@ struct platform_device spitzscoop2_device = {
182 .resource = spitz_scoop2_resources, 191 .resource = spitz_scoop2_resources,
183}; 192};
184 193
185#define SPITZ_PWR_SD 0x01 194static void __init spitz_scoop_init(void)
186#define SPITZ_PWR_CF 0x02 195{
196 platform_device_register(&spitz_scoop1_device);
197
198 /* Akita doesn't have the second SCOOP chip */
199 if (!machine_is_akita())
200 platform_device_register(&spitzscoop2_device);
201}
187 202
188/* Power control is shared with between one of the CF slots and SD */ 203/* Power control is shared with between one of the CF slots and SD */
189static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr) 204static void spitz_card_pwr_ctrl(uint8_t enable, uint8_t new_cpr)
190{ 205{
191 unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR); 206 unsigned short cpr;
207 unsigned long flags;
192 208
193 if (new_cpr & 0x0007) { 209 if (new_cpr & 0x7) {
194 gpio_set_value(SPITZ_GPIO_CF_POWER, 1); 210 gpio_set_value(SPITZ_GPIO_CF_POWER, 1);
195 if (!(cpr & 0x0002) && !(cpr & 0x0004)) 211 mdelay(5);
196 mdelay(5); 212 }
197 if (device == SPITZ_PWR_CF) 213
198 cpr |= 0x0002; 214 local_irq_save(flags);
199 if (device == SPITZ_PWR_SD) 215
200 cpr |= 0x0004; 216 cpr = read_scoop_reg(&spitz_scoop_1_device.dev, SCOOP_CPR);
201 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr); 217
202 } else { 218 if (enable & new_cpr)
203 if (device == SPITZ_PWR_CF) 219 cpr |= new_cpr;
204 cpr &= ~0x0002; 220 else
205 if (device == SPITZ_PWR_SD) 221 cpr &= ~enable;
206 cpr &= ~0x0004; 222
207 if (!(cpr & 0x0002) && !(cpr & 0x0004)) { 223 write_scoop_reg(&spitz_scoop_1_device.dev, SCOOP_CPR, cpr);
208 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, 0x0000); 224
209 mdelay(1); 225 local_irq_restore(flags);
210 gpio_set_value(SPITZ_GPIO_CF_POWER, 0); 226
211 } else { 227 if (!(cpr & 0x7)) {
212 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr); 228 mdelay(1);
213 } 229 gpio_set_value(SPITZ_GPIO_CF_POWER, 0);
214 } 230 }
215} 231}
216 232
217static void spitz_pcmcia_pwr(struct device *scoop, unsigned short cpr, int nr) 233#else
234static inline void spitz_scoop_init(void) {}
235static inline void spitz_card_pwr_ctrl(uint8_t enable, uint8_t new_cpr) {}
236#endif
237
238/******************************************************************************
239 * PCMCIA
240 ******************************************************************************/
241#if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
242static void spitz_pcmcia_pwr(struct device *scoop, uint16_t cpr, int nr)
218{ 243{
219 /* Only need to override behaviour for slot 0 */ 244 /* Only need to override behaviour for slot 0 */
220 if (nr == 0) 245 if (nr == 0)
221 spitz_card_pwr_ctrl(SPITZ_PWR_CF, cpr); 246 spitz_card_pwr_ctrl(
247 cpr & (SCOOP_CPR_CF_3V | SCOOP_CPR_CF_XV), cpr);
222 else 248 else
223 write_scoop_reg(scoop, SCOOP_CPR, cpr); 249 write_scoop_reg(scoop, SCOOP_CPR, cpr);
224} 250}
@@ -242,9 +268,23 @@ static struct scoop_pcmcia_config spitz_pcmcia_config = {
242 .power_ctrl = spitz_pcmcia_pwr, 268 .power_ctrl = spitz_pcmcia_pwr,
243}; 269};
244 270
245/* 271static void __init spitz_pcmcia_init(void)
246 * Spitz Keyboard Device 272{
247 */ 273 /* Akita has only one PCMCIA slot used */
274 if (machine_is_akita())
275 spitz_pcmcia_config.num_devs = 1;
276
277 platform_scoop_config = &spitz_pcmcia_config;
278}
279#else
280static inline void spitz_pcmcia_init(void) {}
281#endif
282
283/******************************************************************************
284 * GPIO keyboard
285 ******************************************************************************/
286#if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE)
287
248#define SPITZ_KEY_CALENDAR KEY_F1 288#define SPITZ_KEY_CALENDAR KEY_F1
249#define SPITZ_KEY_ADDRESS KEY_F2 289#define SPITZ_KEY_ADDRESS KEY_F2
250#define SPITZ_KEY_FN KEY_F3 290#define SPITZ_KEY_FN KEY_F3
@@ -356,7 +396,18 @@ static struct platform_device spitzkbd_device = {
356 }, 396 },
357}; 397};
358 398
399static void __init spitz_mkp_init(void)
400{
401 platform_device_register(&spitzkbd_device);
402}
403#else
404static inline void spitz_mkp_init(void) {}
405#endif
359 406
407/******************************************************************************
408 * GPIO keys
409 ******************************************************************************/
410#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
360static struct gpio_keys_button spitz_gpio_keys[] = { 411static struct gpio_keys_button spitz_gpio_keys[] = {
361 { 412 {
362 .type = EV_PWR, 413 .type = EV_PWR,
@@ -393,10 +444,18 @@ static struct platform_device spitz_gpio_keys_device = {
393 }, 444 },
394}; 445};
395 446
447static void __init spitz_keys_init(void)
448{
449 platform_device_register(&spitz_gpio_keys_device);
450}
451#else
452static inline void spitz_keys_init(void) {}
453#endif
396 454
397/* 455/******************************************************************************
398 * Spitz LEDs 456 * LEDs
399 */ 457 ******************************************************************************/
458#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
400static struct gpio_led spitz_gpio_leds[] = { 459static struct gpio_led spitz_gpio_leds[] = {
401 { 460 {
402 .name = "spitz:amber:charge", 461 .name = "spitz:amber:charge",
@@ -423,11 +482,18 @@ static struct platform_device spitzled_device = {
423 }, 482 },
424}; 483};
425 484
426#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE) 485static void __init spitz_leds_init(void)
427static struct pxa2xx_spi_master spitz_spi_info = { 486{
428 .num_chipselect = 3, 487 platform_device_register(&spitzled_device);
429}; 488}
489#else
490static inline void spitz_leds_init(void) {}
491#endif
430 492
493/******************************************************************************
494 * SSP Devices
495 ******************************************************************************/
496#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
431static void spitz_wait_for_hsync(void) 497static void spitz_wait_for_hsync(void)
432{ 498{
433 while (gpio_get_value(SPITZ_GPIO_HSYNC)) 499 while (gpio_get_value(SPITZ_GPIO_HSYNC))
@@ -505,11 +571,17 @@ static struct spi_board_info spitz_spi_devices[] = {
505 }, 571 },
506}; 572};
507 573
574static struct pxa2xx_spi_master spitz_spi_info = {
575 .num_chipselect = 3,
576};
577
508static void __init spitz_init_spi(void) 578static void __init spitz_init_spi(void)
509{ 579{
580 struct corgi_lcd_platform_data *lcd_data = &spitz_lcdcon_info;
581
510 if (machine_is_akita()) { 582 if (machine_is_akita()) {
511 spitz_lcdcon_info.gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT; 583 lcd_data->gpio_backlight_cont = AKITA_GPIO_BACKLIGHT_CONT;
512 spitz_lcdcon_info.gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON; 584 lcd_data->gpio_backlight_on = AKITA_GPIO_BACKLIGHT_ON;
513 } 585 }
514 586
515 pxa2xx_set_spi_info(2, &spitz_spi_info); 587 pxa2xx_set_spi_info(2, &spitz_spi_info);
@@ -519,20 +591,22 @@ static void __init spitz_init_spi(void)
519static inline void spitz_init_spi(void) {} 591static inline void spitz_init_spi(void) {}
520#endif 592#endif
521 593
594/******************************************************************************
595 * SD/MMC card controller
596 ******************************************************************************/
597#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
522/* 598/*
523 * MMC/SD Device 599 * NOTE: The card detect interrupt isn't debounced so we delay it by 250ms to
524 * 600 * give the card a chance to fully insert/eject.
525 * The card detect interrupt isn't debounced so we delay it by 250ms
526 * to give the card a chance to fully insert/eject.
527 */ 601 */
528static void spitz_mci_setpower(struct device *dev, unsigned int vdd) 602static void spitz_mci_setpower(struct device *dev, unsigned int vdd)
529{ 603{
530 struct pxamci_platform_data* p_d = dev->platform_data; 604 struct pxamci_platform_data* p_d = dev->platform_data;
531 605
532 if (( 1 << vdd) & p_d->ocr_mask) 606 if ((1 << vdd) & p_d->ocr_mask)
533 spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0004); 607 spitz_card_pwr_ctrl(SCOOP_CPR_SD_3V, SCOOP_CPR_SD_3V);
534 else 608 else
535 spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0000); 609 spitz_card_pwr_ctrl(SCOOP_CPR_SD_3V, 0x0);
536} 610}
537 611
538static struct pxamci_platform_data spitz_mci_platform_data = { 612static struct pxamci_platform_data spitz_mci_platform_data = {
@@ -544,10 +618,18 @@ static struct pxamci_platform_data spitz_mci_platform_data = {
544 .gpio_power = -1, 618 .gpio_power = -1,
545}; 619};
546 620
621static void __init spitz_mmc_init(void)
622{
623 pxa_set_mci_info(&spitz_mci_platform_data);
624}
625#else
626static inline void spitz_mmc_init(void) {}
627#endif
547 628
548/* 629/******************************************************************************
549 * USB Host (OHCI) 630 * USB Host
550 */ 631 ******************************************************************************/
632#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
551static int spitz_ohci_init(struct device *dev) 633static int spitz_ohci_init(struct device *dev)
552{ 634{
553 int err; 635 int err;
@@ -556,9 +638,7 @@ static int spitz_ohci_init(struct device *dev)
556 if (err) 638 if (err)
557 return err; 639 return err;
558 640
559 /* Only Port 2 is connected 641 /* Only Port 2 is connected, setup USB Port 2 Output Control Register */
560 * Setup USB Port 2 Output Control Register
561 */
562 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE; 642 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
563 643
564 return gpio_direction_output(SPITZ_GPIO_USB_HOST, 1); 644 return gpio_direction_output(SPITZ_GPIO_USB_HOST, 1);
@@ -577,21 +657,39 @@ static struct pxaohci_platform_data spitz_ohci_platform_data = {
577 .power_budget = 150, 657 .power_budget = 150,
578}; 658};
579 659
660static void __init spitz_uhc_init(void)
661{
662 pxa_set_ohci_info(&spitz_ohci_platform_data);
663}
664#else
665static inline void spitz_uhc_init(void) {}
666#endif
580 667
581/* 668/******************************************************************************
582 * Irda 669 * IrDA
583 */ 670 ******************************************************************************/
584 671#if defined(CONFIG_PXA_FICP) || defined(CONFIG_PXA_FICP_MODULE)
585static struct pxaficp_platform_data spitz_ficp_platform_data = { 672static struct pxaficp_platform_data spitz_ficp_platform_data = {
586/* .gpio_pwdown is set in spitz_init() and akita_init() accordingly */
587 .transceiver_cap = IR_SIRMODE | IR_OFF, 673 .transceiver_cap = IR_SIRMODE | IR_OFF,
588}; 674};
589 675
676static void __init spitz_irda_init(void)
677{
678 if (machine_is_akita())
679 spitz_ficp_platform_data.gpio_pwdown = AKITA_GPIO_IR_ON;
680 else
681 spitz_ficp_platform_data.gpio_pwdown = SPITZ_GPIO_IR_ON;
590 682
591/* 683 pxa_set_ficp_info(&spitz_ficp_platform_data);
592 * Spitz PXA Framebuffer 684}
593 */ 685#else
686static inline void spitz_irda_init(void) {}
687#endif
594 688
689/******************************************************************************
690 * Framebuffer
691 ******************************************************************************/
692#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
595static struct pxafb_mode_info spitz_pxafb_modes[] = { 693static struct pxafb_mode_info spitz_pxafb_modes[] = {
596{ 694{
597 .pixclock = 19231, 695 .pixclock = 19231,
@@ -621,12 +719,24 @@ static struct pxafb_mode_info spitz_pxafb_modes[] = {
621}; 719};
622 720
623static struct pxafb_mach_info spitz_pxafb_info = { 721static struct pxafb_mach_info spitz_pxafb_info = {
624 .modes = &spitz_pxafb_modes[0], 722 .modes = spitz_pxafb_modes,
625 .num_modes = 2, 723 .num_modes = ARRAY_SIZE(spitz_pxafb_modes),
626 .fixed_modes = 1, 724 .fixed_modes = 1,
627 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_ALTERNATE_MAPPING, 725 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_ALTERNATE_MAPPING,
628}; 726};
629 727
728static void __init spitz_lcd_init(void)
729{
730 set_pxa_fb_info(&spitz_pxafb_info);
731}
732#else
733static inline void spitz_lcd_init(void) {}
734#endif
735
736/******************************************************************************
737 * Framebuffer
738 ******************************************************************************/
739#if defined(CONFIG_MTD_NAND_SHARPSL) || defined(CONFIG_MTD_NAND_SHARPSL_MODULE)
630static struct mtd_partition sharpsl_nand_partitions[] = { 740static struct mtd_partition sharpsl_nand_partitions[] = {
631 { 741 {
632 .name = "System Area", 742 .name = "System Area",
@@ -653,6 +763,16 @@ static struct nand_bbt_descr sharpsl_bbt = {
653 .pattern = scan_ff_pattern 763 .pattern = scan_ff_pattern
654}; 764};
655 765
766static struct nand_ecclayout spitz_akita_oobinfo = {
767 .oobfree = { {0x08, 0x09} },
768 .eccbytes = 24,
769 .eccpos = {
770 0x05, 0x01, 0x02, 0x03, 0x06, 0x07, 0x15, 0x11,
771 0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23,
772 0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37,
773 },
774};
775
656static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = { 776static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = {
657 .badblock_pattern = &sharpsl_bbt, 777 .badblock_pattern = &sharpsl_bbt,
658 .partitions = sharpsl_nand_partitions, 778 .partitions = sharpsl_nand_partitions,
@@ -661,8 +781,8 @@ static struct sharpsl_nand_platform_data sharpsl_nand_platform_data = {
661 781
662static struct resource sharpsl_nand_resources[] = { 782static struct resource sharpsl_nand_resources[] = {
663 { 783 {
664 .start = 0x0C000000, 784 .start = PXA_CS3_PHYS,
665 .end = 0x0C000FFF, 785 .end = PXA_CS3_PHYS + SZ_4K - 1,
666 .flags = IORESOURCE_MEM, 786 .flags = IORESOURCE_MEM,
667 }, 787 },
668}; 788};
@@ -672,10 +792,35 @@ static struct platform_device sharpsl_nand_device = {
672 .id = -1, 792 .id = -1,
673 .resource = sharpsl_nand_resources, 793 .resource = sharpsl_nand_resources,
674 .num_resources = ARRAY_SIZE(sharpsl_nand_resources), 794 .num_resources = ARRAY_SIZE(sharpsl_nand_resources),
675 .dev.platform_data = &sharpsl_nand_platform_data, 795 .dev = {
796 .platform_data = &sharpsl_nand_platform_data,
797 }
676}; 798};
677 799
800static void __init spitz_nand_init(void)
801{
802 if (machine_is_spitz()) {
803 sharpsl_nand_partitions[1].size = 5 * 1024 * 1024;
804 } else if (machine_is_akita()) {
805 sharpsl_nand_partitions[1].size = 58 * 1024 * 1024;
806 sharpsl_nand_bbt.len = 1;
807 sharpsl_nand_pdata.ecc_layout = &spitz_akita_oobinfo;
808 } else if (machine_is_borzoi()) {
809 sharpsl_nand_partitions[1].size = 32 * 1024 * 1024;
810 sharpsl_nand_bbt.len = 1;
811 sharpsl_nand_pdata.ecc_layout = &spitz_akita_oobinfo;
812 }
813
814 platform_device_register(&sharpsl_nand_device);
815}
816#else
817static inline void spitz_nand_init(void) {}
818#endif
678 819
820/******************************************************************************
821 * NOR Flash
822 ******************************************************************************/
823#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
679static struct mtd_partition sharpsl_rom_parts[] = { 824static struct mtd_partition sharpsl_rom_parts[] = {
680 { 825 {
681 .name ="Boot PROM Filesystem", 826 .name ="Boot PROM Filesystem",
@@ -692,8 +837,8 @@ static struct physmap_flash_data sharpsl_rom_data = {
692 837
693static struct resource sharpsl_rom_resources[] = { 838static struct resource sharpsl_rom_resources[] = {
694 { 839 {
695 .start = 0x00000000, 840 .start = PXA_CS0_PHYS,
696 .end = 0x007fffff, 841 .end = PXA_CS0_PHYS + SZ_8M - 1,
697 .flags = IORESOURCE_MEM, 842 .flags = IORESOURCE_MEM,
698 }, 843 },
699}; 844};
@@ -703,18 +848,86 @@ static struct platform_device sharpsl_rom_device = {
703 .id = -1, 848 .id = -1,
704 .resource = sharpsl_rom_resources, 849 .resource = sharpsl_rom_resources,
705 .num_resources = ARRAY_SIZE(sharpsl_rom_resources), 850 .num_resources = ARRAY_SIZE(sharpsl_rom_resources),
706 .dev.platform_data = &sharpsl_rom_data, 851 .dev = {
852 .platform_data = &sharpsl_rom_data,
853 },
854};
855
856static void __init spitz_nor_init(void)
857{
858 platform_device_register(&sharpsl_rom_device);
859}
860#else
861static inline void spitz_nor_init(void) {}
862#endif
863
864/******************************************************************************
865 * GPIO expander
866 ******************************************************************************/
867#if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
868static struct pca953x_platform_data akita_pca953x_pdata = {
869 .gpio_base = AKITA_IOEXP_GPIO_BASE,
870};
871
872static struct i2c_board_info spitz_i2c_devs[] = {
873 {
874 .type = "wm8750",
875 .addr = 0x1b,
876 }, {
877 .type = "max7310",
878 .addr = 0x18,
879 .platform_data = &akita_pca953x_pdata,
880 },
881};
882
883static struct regulator_consumer_supply isl6271a_consumers[] = {
884 {
885 .supply = "vcc_core",
886 }
707}; 887};
708 888
709static struct platform_device *devices[] __initdata = { 889static struct regulator_init_data isl6271a_info[] = {
710 &spitzscoop_device, 890 {
711 &spitzkbd_device, 891 .constraints = {
712 &spitz_gpio_keys_device, 892 .name = "vcc_core range",
713 &spitzled_device, 893 .min_uV = 850000,
714 &sharpsl_nand_device, 894 .max_uV = 1600000,
715 &sharpsl_rom_device, 895 .always_on = 1,
896 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
897 },
898 .consumer_supplies = isl6271a_consumers,
899 .num_consumer_supplies = ARRAY_SIZE(isl6271a_consumers),
900 }
716}; 901};
717 902
903static struct i2c_board_info spitz_pi2c_devs[] = {
904 {
905 .type = "isl6271a",
906 .addr = 0x0c,
907 .platform_data = &isl6271a_info,
908 },
909};
910
911static void __init spitz_i2c_init(void)
912{
913 int size = ARRAY_SIZE(spitz_i2c_devs);
914
915 /* Only Akita has the max7310 chip */
916 if (!machine_is_akita())
917 size--;
918
919 pxa_set_i2c_info(NULL);
920 pxa27x_set_i2c_power_info(NULL);
921 i2c_register_board_info(0, spitz_i2c_devs, size);
922 i2c_register_board_info(1, ARRAY_AND_SIZE(spitz_pi2c_devs));
923}
924#else
925static inline void spitz_i2c_init(void) {}
926#endif
927
928/******************************************************************************
929 * Machine init
930 ******************************************************************************/
718static void spitz_poweroff(void) 931static void spitz_poweroff(void)
719{ 932{
720 arm_machine_restart('g', NULL); 933 arm_machine_restart('g', NULL);
@@ -723,26 +936,18 @@ static void spitz_poweroff(void)
723static void spitz_restart(char mode, const char *cmd) 936static void spitz_restart(char mode, const char *cmd)
724{ 937{
725 /* Bootloader magic for a reboot */ 938 /* Bootloader magic for a reboot */
726 if((MSC0 & 0xffff0000) == 0x7ff00000) 939 if ((MSC0 & 0xffff0000) == 0x7ff00000)
727 MSC0 = (MSC0 & 0xffff) | 0x7ee00000; 940 MSC0 = (MSC0 & 0xffff) | 0x7ee00000;
728 941
729 spitz_poweroff(); 942 spitz_poweroff();
730} 943}
731 944
732static void __init common_init(void) 945static void __init spitz_init(void)
733{ 946{
734 init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0); 947 init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0);
735 pm_power_off = spitz_poweroff; 948 pm_power_off = spitz_poweroff;
736 arm_pm_restart = spitz_restart; 949 arm_pm_restart = spitz_restart;
737 950
738 if (machine_is_spitz()) {
739 sharpsl_nand_partitions[1].size = 5 * 1024 * 1024;
740 } else if (machine_is_akita()) {
741 sharpsl_nand_partitions[1].size = 58 * 1024 * 1024;
742 } else if (machine_is_borzoi()) {
743 sharpsl_nand_partitions[1].size = 32 * 1024 * 1024;
744 }
745
746 PMCR = 0x00; 951 PMCR = 0x00;
747 952
748 /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */ 953 /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
@@ -755,88 +960,19 @@ static void __init common_init(void)
755 pxa_set_stuart_info(NULL); 960 pxa_set_stuart_info(NULL);
756 961
757 spitz_init_spi(); 962 spitz_init_spi();
758 963 spitz_scoop_init();
759 platform_add_devices(devices, ARRAY_SIZE(devices)); 964 spitz_mkp_init();
760 pxa_set_mci_info(&spitz_mci_platform_data); 965 spitz_keys_init();
761 pxa_set_ohci_info(&spitz_ohci_platform_data); 966 spitz_leds_init();
762 pxa_set_ficp_info(&spitz_ficp_platform_data); 967 spitz_mmc_init();
763 set_pxa_fb_info(&spitz_pxafb_info); 968 spitz_pcmcia_init();
764 pxa_set_i2c_info(NULL); 969 spitz_irda_init();
765} 970 spitz_uhc_init();
766 971 spitz_lcd_init();
767#if defined(CONFIG_MACH_AKITA) || defined(CONFIG_MACH_BORZOI) 972 spitz_nor_init();
768static struct nand_bbt_descr sharpsl_akita_bbt = { 973 spitz_nand_init();
769 .options = 0, 974 spitz_i2c_init();
770 .offs = 4,
771 .len = 1,
772 .pattern = scan_ff_pattern
773};
774
775static struct nand_ecclayout akita_oobinfo = {
776 .eccbytes = 24,
777 .eccpos = {
778 0x5, 0x1, 0x2, 0x3, 0x6, 0x7, 0x15, 0x11,
779 0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23,
780 0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37},
781 .oobfree = {{0x08, 0x09}}
782};
783#endif
784
785#if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI)
786static void __init spitz_init(void)
787{
788 spitz_ficp_platform_data.gpio_pwdown = SPITZ_GPIO_IR_ON;
789
790#ifdef CONFIG_MACH_BORZOI
791 if (machine_is_borzoi()) {
792 sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt;
793 sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo;
794 }
795#endif
796
797 platform_scoop_config = &spitz_pcmcia_config;
798
799 common_init();
800
801 platform_device_register(&spitzscoop2_device);
802}
803#endif
804
805#ifdef CONFIG_MACH_AKITA
806/*
807 * Akita IO Expander
808 */
809static struct pca953x_platform_data akita_ioexp = {
810 .gpio_base = AKITA_IOEXP_GPIO_BASE,
811};
812
813static struct i2c_board_info akita_i2c_board_info[] = {
814 {
815 .type = "max7310",
816 .addr = 0x18,
817 .platform_data = &akita_ioexp,
818 }, {
819 .type = "wm8750",
820 .addr = 0x1b,
821 },
822};
823
824static void __init akita_init(void)
825{
826 spitz_ficp_platform_data.gpio_pwdown = AKITA_GPIO_IR_ON;
827
828 sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt;
829 sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo;
830
831 /* We just pretend the second element of the array doesn't exist */
832 spitz_pcmcia_config.num_devs = 1;
833 platform_scoop_config = &spitz_pcmcia_config;
834
835 i2c_register_board_info(0, ARRAY_AND_SIZE(akita_i2c_board_info));
836
837 common_init();
838} 975}
839#endif
840 976
841static void __init fixup_spitz(struct machine_desc *desc, 977static void __init fixup_spitz(struct machine_desc *desc,
842 struct tag *tags, char **cmdline, struct meminfo *mi) 978 struct tag *tags, char **cmdline, struct meminfo *mi)
@@ -879,7 +1015,7 @@ MACHINE_START(AKITA, "SHARP Akita")
879 .fixup = fixup_spitz, 1015 .fixup = fixup_spitz,
880 .map_io = pxa_map_io, 1016 .map_io = pxa_map_io,
881 .init_irq = pxa27x_init_irq, 1017 .init_irq = pxa27x_init_irq,
882 .init_machine = akita_init, 1018 .init_machine = spitz_init,
883 .timer = &pxa_timer, 1019 .timer = &pxa_timer,
884MACHINE_END 1020MACHINE_END
885#endif 1021#endif