1 // SPDX-License-Identifier: GPL-2.0-only
3 * Support for Sharp SL-Cxx00 Series of PDAs
4 * Models: SL-C3000 (Spitz), SL-C1000 (Akita) and SL-C3100 (Borzoi)
6 * Copyright (c) 2005 Richard Purdie
8 * Based on Sharp's 2.4 kernel patches/lubbock.c
11 #include <linux/kernel.h>
12 #include <linux/platform_device.h>
13 #include <linux/delay.h>
14 #include <linux/gpio_keys.h>
15 #include <linux/gpio.h>
16 #include <linux/gpio/machine.h>
17 #include <linux/gpio/property.h>
18 #include <linux/leds.h>
19 #include <linux/i2c.h>
20 #include <linux/platform_data/i2c-pxa.h>
21 #include <linux/platform_data/pca953x.h>
22 #include <linux/property.h>
23 #include <linux/spi/spi.h>
24 #include <linux/spi/ads7846.h>
25 #include <linux/spi/corgi_lcd.h>
26 #include <linux/mtd/sharpsl.h>
27 #include <linux/mtd/physmap.h>
28 #include <linux/input-event-codes.h>
29 #include <linux/input/matrix_keypad.h>
30 #include <linux/regulator/machine.h>
32 #include <linux/property.h>
33 #include <linux/reboot.h>
34 #include <linux/memblock.h>
36 #include <asm/setup.h>
37 #include <asm/mach-types.h>
38 #include <asm/mach/arch.h>
39 #include <asm/mach/sharpsl_param.h>
40 #include <asm/hardware/scoop.h>
43 #include "pxa27x-udc.h"
45 #include <linux/platform_data/mmc-pxamci.h>
46 #include <linux/platform_data/usb-ohci-pxa27x.h>
47 #include <linux/platform_data/video-pxafb.h>
49 #include "sharpsl_pm.h"
55 /******************************************************************************
57 ******************************************************************************/
58 static unsigned long spitz_pin_config[] __initdata = {
60 GPIO78_nCS_2, /* SCOOP #2 */
61 GPIO79_nCS_3, /* NAND */
62 GPIO80_nCS_4, /* SCOOP #1 */
64 /* LCD - 16bpp Active TFT */
80 GPIO28_I2S_BITCLK_OUT,
94 GPIO9_GPIO, /* SPITZ_GPIO_nSD_DETECT */
95 GPIO16_GPIO, /* SPITZ_GPIO_SYNC */
96 GPIO81_GPIO, /* SPITZ_GPIO_nSD_WP */
97 GPIO41_GPIO, /* SPITZ_GPIO_USB_CONNECT */
98 GPIO37_GPIO, /* SPITZ_GPIO_USB_HOST */
99 GPIO35_GPIO, /* SPITZ_GPIO_USB_DEVICE */
100 GPIO22_GPIO, /* SPITZ_GPIO_HSYNC */
101 GPIO94_GPIO, /* SPITZ_GPIO_CF_CD */
102 GPIO105_GPIO, /* SPITZ_GPIO_CF_IRQ */
103 GPIO106_GPIO, /* SPITZ_GPIO_CF2_IRQ */
105 /* GPIO matrix keypad */
106 GPIO88_GPIO, /* column 0 */
107 GPIO23_GPIO, /* column 1 */
108 GPIO24_GPIO, /* column 2 */
109 GPIO25_GPIO, /* column 3 */
110 GPIO26_GPIO, /* column 4 */
111 GPIO27_GPIO, /* column 5 */
112 GPIO52_GPIO, /* column 6 */
113 GPIO103_GPIO, /* column 7 */
114 GPIO107_GPIO, /* column 8 */
115 GPIO108_GPIO, /* column 9 */
116 GPIO114_GPIO, /* column 10 */
117 GPIO12_GPIO, /* row 0 */
118 GPIO17_GPIO, /* row 1 */
119 GPIO91_GPIO, /* row 2 */
120 GPIO34_GPIO, /* row 3 */
121 GPIO36_GPIO, /* row 4 */
122 GPIO38_GPIO, /* row 5 */
123 GPIO39_GPIO, /* row 6 */
129 GPIO0_GPIO | WAKEUP_ON_EDGE_RISE, /* SPITZ_GPIO_KEY_INT */
130 GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, /* SPITZ_GPIO_RESET */
133 static const struct software_node spitz_scoop_1_gpiochip_node = {
134 .name = "sharp-scoop.0",
138 static const struct software_node spitz_scoop_2_gpiochip_node = {
139 .name = "sharp-scoop.1",
143 static const struct software_node akita_max7310_gpiochip_node = {
144 .name = "i2c-max7310",
147 /******************************************************************************
148 * Scoop GPIO expander
149 ******************************************************************************/
150 #if defined(CONFIG_SHARP_SCOOP) || defined(CONFIG_SHARP_SCOOP_MODULE)
151 /* SCOOP Device #1 */
152 static struct resource spitz_scoop_1_resources[] = {
156 .flags = IORESOURCE_MEM,
160 static struct scoop_config spitz_scoop_1_setup = {
161 .io_dir = SPITZ_SCP_IO_DIR,
162 .io_out = SPITZ_SCP_IO_OUT,
163 .suspend_clr = SPITZ_SCP_SUS_CLR,
164 .suspend_set = SPITZ_SCP_SUS_SET,
165 .gpio_base = SPITZ_SCP_GPIO_BASE,
168 struct platform_device spitz_scoop_1_device = {
169 .name = "sharp-scoop",
172 .platform_data = &spitz_scoop_1_setup,
174 .num_resources = ARRAY_SIZE(spitz_scoop_1_resources),
175 .resource = spitz_scoop_1_resources,
178 /* SCOOP Device #2 */
179 static struct resource spitz_scoop_2_resources[] = {
183 .flags = IORESOURCE_MEM,
187 static struct scoop_config spitz_scoop_2_setup = {
188 .io_dir = SPITZ_SCP2_IO_DIR,
189 .io_out = SPITZ_SCP2_IO_OUT,
190 .suspend_clr = SPITZ_SCP2_SUS_CLR,
191 .suspend_set = SPITZ_SCP2_SUS_SET,
192 .gpio_base = SPITZ_SCP2_GPIO_BASE,
195 struct platform_device spitz_scoop_2_device = {
196 .name = "sharp-scoop",
199 .platform_data = &spitz_scoop_2_setup,
201 .num_resources = ARRAY_SIZE(spitz_scoop_2_resources),
202 .resource = spitz_scoop_2_resources,
205 static void __init spitz_scoop_init(void)
207 platform_device_register(&spitz_scoop_1_device);
209 /* Akita doesn't have the second SCOOP chip */
210 if (!machine_is_akita())
211 platform_device_register(&spitz_scoop_2_device);
214 /* Power control is shared with between one of the CF slots and SD */
215 static void __maybe_unused spitz_card_pwr_ctrl(uint8_t enable, uint8_t new_cpr)
221 gpio_set_value(SPITZ_GPIO_CF_POWER, 1);
225 local_irq_save(flags);
227 cpr = read_scoop_reg(&spitz_scoop_1_device.dev, SCOOP_CPR);
229 if (enable & new_cpr)
234 write_scoop_reg(&spitz_scoop_1_device.dev, SCOOP_CPR, cpr);
236 local_irq_restore(flags);
240 gpio_set_value(SPITZ_GPIO_CF_POWER, 0);
245 static inline void spitz_scoop_init(void) {}
246 static inline void spitz_card_pwr_ctrl(uint8_t enable, uint8_t new_cpr) {}
249 /******************************************************************************
251 ******************************************************************************/
252 #if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
253 static void spitz_pcmcia_pwr(struct device *scoop, uint16_t cpr, int nr)
255 /* Only need to override behaviour for slot 0 */
258 cpr & (SCOOP_CPR_CF_3V | SCOOP_CPR_CF_XV), cpr);
260 write_scoop_reg(scoop, SCOOP_CPR, cpr);
263 static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = {
265 .dev = &spitz_scoop_1_device.dev,
266 .irq = SPITZ_IRQ_GPIO_CF_IRQ,
267 .cd_irq = SPITZ_IRQ_GPIO_CF_CD,
268 .cd_irq_str = "PCMCIA0 CD",
270 .dev = &spitz_scoop_2_device.dev,
271 .irq = SPITZ_IRQ_GPIO_CF2_IRQ,
276 static struct scoop_pcmcia_config spitz_pcmcia_config = {
277 .devs = &spitz_pcmcia_scoop[0],
279 .power_ctrl = spitz_pcmcia_pwr,
282 static void __init spitz_pcmcia_init(void)
284 /* Akita has only one PCMCIA slot used */
285 if (machine_is_akita())
286 spitz_pcmcia_config.num_devs = 1;
288 platform_scoop_config = &spitz_pcmcia_config;
291 static inline void spitz_pcmcia_init(void) {}
294 /******************************************************************************
296 ******************************************************************************/
297 #if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE)
299 #define SPITZ_KEY_CALENDAR KEY_F1
300 #define SPITZ_KEY_ADDRESS KEY_F2
301 #define SPITZ_KEY_FN KEY_F3
302 #define SPITZ_KEY_CANCEL KEY_F4
303 #define SPITZ_KEY_EXOK KEY_F5
304 #define SPITZ_KEY_EXCANCEL KEY_F6
305 #define SPITZ_KEY_EXJOGDOWN KEY_F7
306 #define SPITZ_KEY_EXJOGUP KEY_F8
307 #define SPITZ_KEY_JAP1 KEY_LEFTALT
308 #define SPITZ_KEY_JAP2 KEY_RIGHTCTRL
309 #define SPITZ_KEY_SYNC KEY_F9
310 #define SPITZ_KEY_MAIL KEY_F10
311 #define SPITZ_KEY_OK KEY_F11
312 #define SPITZ_KEY_MENU KEY_F12
314 static const uint32_t spitz_keymap[] = {
315 KEY(0, 0, KEY_LEFTCTRL),
323 KEY(0, 8, KEY_BACKSPACE),
324 KEY(0, 9, SPITZ_KEY_EXOK), /* EXOK */
325 KEY(0, 10, SPITZ_KEY_EXCANCEL), /* EXCANCEL */
334 KEY(1, 9, SPITZ_KEY_EXJOGDOWN), /* EXJOGDOWN */
335 KEY(1, 10, SPITZ_KEY_EXJOGUP), /* EXJOGUP */
344 KEY(3, 0, SPITZ_KEY_ADDRESS), /* ADDRESS */
352 KEY(3, 9, KEY_RIGHTSHIFT),
353 KEY(4, 0, SPITZ_KEY_CALENDAR), /* CALENDAR */
360 KEY(4, 8, KEY_ENTER),
361 KEY(4, 9, KEY_LEFTSHIFT),
362 KEY(5, 0, SPITZ_KEY_MAIL), /* MAIL */
365 KEY(5, 3, KEY_MINUS),
366 KEY(5, 4, KEY_SPACE),
367 KEY(5, 5, KEY_COMMA),
369 KEY(5, 10, SPITZ_KEY_FN), /* FN */
370 KEY(6, 0, KEY_SYSRQ),
371 KEY(6, 1, SPITZ_KEY_JAP1), /* JAP1 */
372 KEY(6, 2, SPITZ_KEY_JAP2), /* JAP2 */
373 KEY(6, 3, SPITZ_KEY_CANCEL), /* CANCEL */
374 KEY(6, 4, SPITZ_KEY_OK), /* OK */
375 KEY(6, 5, SPITZ_KEY_MENU), /* MENU */
378 KEY(6, 8, KEY_RIGHT),
381 static const struct matrix_keymap_data spitz_keymap_data = {
382 .keymap = spitz_keymap,
383 .keymap_size = ARRAY_SIZE(spitz_keymap),
386 static const uint32_t spitz_row_gpios[] =
387 { 12, 17, 91, 34, 36, 38, 39 };
388 static const uint32_t spitz_col_gpios[] =
389 { 88, 23, 24, 25, 26, 27, 52, 103, 107, 108, 114 };
391 static struct matrix_keypad_platform_data spitz_mkp_pdata = {
392 .keymap_data = &spitz_keymap_data,
393 .row_gpios = spitz_row_gpios,
394 .col_gpios = spitz_col_gpios,
395 .num_row_gpios = ARRAY_SIZE(spitz_row_gpios),
396 .num_col_gpios = ARRAY_SIZE(spitz_col_gpios),
397 .col_scan_delay_us = 10,
402 static struct platform_device spitz_mkp_device = {
403 .name = "matrix-keypad",
406 .platform_data = &spitz_mkp_pdata,
410 static void __init spitz_mkp_init(void)
412 platform_device_register(&spitz_mkp_device);
415 static inline void spitz_mkp_init(void) {}
418 /******************************************************************************
420 ******************************************************************************/
421 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
422 static struct gpio_keys_button spitz_gpio_keys[] = {
426 .gpio = SPITZ_GPIO_ON_KEY,
430 /* Two buttons detecting the lid state */
434 .gpio = SPITZ_GPIO_SWA,
435 .desc = "Display Down",
440 .gpio = SPITZ_GPIO_SWB,
441 .desc = "Lid Closed",
445 static struct gpio_keys_platform_data spitz_gpio_keys_platform_data = {
446 .buttons = spitz_gpio_keys,
447 .nbuttons = ARRAY_SIZE(spitz_gpio_keys),
450 static struct platform_device spitz_gpio_keys_device = {
454 .platform_data = &spitz_gpio_keys_platform_data,
458 static void __init spitz_keys_init(void)
460 platform_device_register(&spitz_gpio_keys_device);
463 static inline void spitz_keys_init(void) {}
466 /******************************************************************************
468 ******************************************************************************/
469 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
470 static const struct software_node spitz_gpio_leds_node = {
471 .name = "spitz-leds",
474 static const struct property_entry spitz_orange_led_props[] = {
475 PROPERTY_ENTRY_STRING("linux,default-trigger", "sharpsl-charge"),
476 PROPERTY_ENTRY_GPIO("gpios",
477 &spitz_scoop_1_gpiochip_node, 6, GPIO_ACTIVE_HIGH),
481 static const struct software_node spitz_orange_led_node = {
482 .name = "spitz:amber:charge",
483 .parent = &spitz_gpio_leds_node,
484 .properties = spitz_orange_led_props,
487 static const struct property_entry spitz_green_led_props[] = {
488 PROPERTY_ENTRY_STRING("linux,default-trigger", "disk-activity"),
489 PROPERTY_ENTRY_GPIO("gpios",
490 &spitz_scoop_1_gpiochip_node, 0, GPIO_ACTIVE_HIGH),
494 static const struct software_node spitz_green_led_node = {
495 .name = "spitz:green:hddactivity",
496 .parent = &spitz_gpio_leds_node,
497 .properties = spitz_green_led_props,
500 static const struct software_node *spitz_gpio_leds_swnodes[] = {
501 &spitz_gpio_leds_node,
502 &spitz_orange_led_node,
503 &spitz_green_led_node,
507 static void __init spitz_leds_init(void)
509 struct platform_device_info led_info = {
511 .id = PLATFORM_DEVID_NONE,
513 struct platform_device *led_dev;
516 err = software_node_register_node_group(spitz_gpio_leds_swnodes);
518 pr_err("failed to register LED software nodes: %d\n", err);
522 led_info.fwnode = software_node_fwnode(&spitz_gpio_leds_node);
524 led_dev = platform_device_register_full(&led_info);
525 err = PTR_ERR_OR_ZERO(led_dev);
527 pr_err("failed to create LED device: %d\n", err);
530 static inline void spitz_leds_init(void) {}
533 /******************************************************************************
535 ******************************************************************************/
536 #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
538 static const struct property_entry spitz_ads7846_props[] = {
539 PROPERTY_ENTRY_STRING("compatible", "ti,ads7846"),
540 PROPERTY_ENTRY_U32("touchscreen-max-pressure", 1024),
541 PROPERTY_ENTRY_U16("ti,x-plate-ohms", 419),
542 PROPERTY_ENTRY_U16("ti,y-plate-ohms", 486),
543 PROPERTY_ENTRY_U16("ti,vref-delay-usecs", 100),
544 PROPERTY_ENTRY_GPIO("pendown-gpios", &pxa2xx_gpiochip_node,
545 SPITZ_GPIO_TP_INT, GPIO_ACTIVE_LOW),
546 PROPERTY_ENTRY_GPIO("ti,hsync-gpios", &pxa2xx_gpiochip_node,
547 SPITZ_GPIO_HSYNC, GPIO_ACTIVE_LOW),
551 static const struct software_node spitz_ads7846_swnode = {
553 .properties = spitz_ads7846_props,
556 static const struct property_entry spitz_lcdcon_props[] = {
557 PROPERTY_ENTRY_GPIO("BL_CONT-gpios",
558 &spitz_scoop_2_gpiochip_node, 6, GPIO_ACTIVE_LOW),
559 PROPERTY_ENTRY_GPIO("BL_ON-gpios",
560 &spitz_scoop_2_gpiochip_node, 7, GPIO_ACTIVE_HIGH),
564 static const struct property_entry akita_lcdcon_props[] = {
565 PROPERTY_ENTRY_GPIO("BL_ON-gpios",
566 &akita_max7310_gpiochip_node, 3, GPIO_ACTIVE_HIGH),
567 PROPERTY_ENTRY_GPIO("BL_CONT-gpios",
568 &akita_max7310_gpiochip_node, 4, GPIO_ACTIVE_LOW),
572 static struct software_node spitz_lcdcon_node = {
573 .name = "spitz-lcdcon",
576 static struct corgi_lcd_platform_data spitz_lcdcon_info = {
577 .init_mode = CORGI_LCD_MODE_VGA,
578 .max_intensity = 0x2f,
579 .default_intensity = 0x1f,
581 .kick_battery = sharpsl_battery_kick,
584 static struct spi_board_info spitz_spi_devices[] = {
586 .modalias = "ads7846",
587 .max_speed_hz = 1200000,
590 .swnode = &spitz_ads7846_swnode,
591 .irq = PXA_GPIO_TO_IRQ(SPITZ_GPIO_TP_INT),
593 .modalias = "corgi-lcd",
594 .max_speed_hz = 50000,
597 .platform_data = &spitz_lcdcon_info,
598 .swnode = &spitz_lcdcon_node,
600 .modalias = "max1111",
601 .max_speed_hz = 450000,
607 static const struct software_node_ref_args spitz_spi_gpio_refs[] = {
608 SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, SPITZ_GPIO_ADS7846_CS,
610 SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, SPITZ_GPIO_LCDCON_CS,
612 SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, SPITZ_GPIO_MAX1111_CS,
616 static const struct property_entry spitz_spi_properties[] = {
617 PROPERTY_ENTRY_REF_ARRAY("gpios", spitz_spi_gpio_refs),
621 static const struct platform_device_info spitz_spi_device_info = {
622 .name = "pxa2xx-spi",
623 /* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1 */
625 .properties = spitz_spi_properties,
628 static void __init spitz_spi_init(void)
630 struct platform_device *pd;
633 pd = platform_device_register_full(&spitz_spi_device_info);
634 err = PTR_ERR_OR_ZERO(pd);
636 pr_err("pxa2xx-spi: failed to instantiate SPI controller: %d\n",
639 spitz_lcdcon_node.properties = machine_is_akita() ?
640 akita_lcdcon_props : spitz_lcdcon_props;
641 spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices));
644 static inline void spitz_spi_init(void) {}
647 /******************************************************************************
648 * SD/MMC card controller
649 ******************************************************************************/
650 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
652 * NOTE: The card detect interrupt isn't debounced so we delay it by 250ms to
653 * give the card a chance to fully insert/eject.
655 static int spitz_mci_setpower(struct device *dev, unsigned int vdd)
657 struct pxamci_platform_data* p_d = dev->platform_data;
659 if ((1 << vdd) & p_d->ocr_mask)
660 spitz_card_pwr_ctrl(SCOOP_CPR_SD_3V, SCOOP_CPR_SD_3V);
662 spitz_card_pwr_ctrl(SCOOP_CPR_SD_3V, 0x0);
667 static struct pxamci_platform_data spitz_mci_platform_data = {
668 .detect_delay_ms = 250,
669 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
670 .setpower = spitz_mci_setpower,
673 static const struct property_entry spitz_mci_props[] __initconst = {
674 PROPERTY_ENTRY_GPIO("cd-gpios", &pxa2xx_gpiochip_node,
675 SPITZ_GPIO_nSD_DETECT, GPIO_ACTIVE_LOW),
676 PROPERTY_ENTRY_GPIO("wp-gpios", &pxa2xx_gpiochip_node,
677 SPITZ_GPIO_nSD_WP, GPIO_ACTIVE_LOW),
681 static void __init spitz_mmc_init(void)
683 pxa_set_mci_info(&spitz_mci_platform_data, spitz_mci_props);
686 static inline void spitz_mmc_init(void) {}
689 /******************************************************************************
691 ******************************************************************************/
692 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
693 static int spitz_ohci_init(struct device *dev)
697 err = gpio_request(SPITZ_GPIO_USB_HOST, "USB_HOST");
701 /* Only Port 2 is connected, setup USB Port 2 Output Control Register */
702 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
704 return gpio_direction_output(SPITZ_GPIO_USB_HOST, 1);
707 static void spitz_ohci_exit(struct device *dev)
709 gpio_free(SPITZ_GPIO_USB_HOST);
712 static struct pxaohci_platform_data spitz_ohci_platform_data = {
713 .port_mode = PMM_NPS_MODE,
714 .init = spitz_ohci_init,
715 .exit = spitz_ohci_exit,
716 .flags = ENABLE_PORT_ALL | NO_OC_PROTECTION,
720 static void __init spitz_uhc_init(void)
722 pxa_set_ohci_info(&spitz_ohci_platform_data);
725 static inline void spitz_uhc_init(void) {}
728 /******************************************************************************
730 ******************************************************************************/
731 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
732 static struct pxafb_mode_info spitz_pxafb_modes[] = {
760 static struct pxafb_mach_info spitz_pxafb_info = {
761 .modes = spitz_pxafb_modes,
762 .num_modes = ARRAY_SIZE(spitz_pxafb_modes),
764 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_ALTERNATE_MAPPING,
767 static void __init spitz_lcd_init(void)
769 pxa_set_fb_info(NULL, &spitz_pxafb_info);
772 static inline void spitz_lcd_init(void) {}
775 /******************************************************************************
777 ******************************************************************************/
778 #if defined(CONFIG_MTD_NAND_SHARPSL) || defined(CONFIG_MTD_NAND_SHARPSL_MODULE)
779 static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
781 static struct nand_bbt_descr spitz_nand_bbt = {
785 .pattern = scan_ff_pattern
788 static int akita_ooblayout_ecc(struct mtd_info *mtd, int section,
789 struct mtd_oob_region *oobregion)
794 switch (section % 3) {
796 oobregion->offset = 5;
797 oobregion->length = 1;
801 oobregion->offset = 1;
802 oobregion->length = 3;
806 oobregion->offset = 6;
807 oobregion->length = 2;
811 oobregion->offset += (section / 3) * 0x10;
816 static int akita_ooblayout_free(struct mtd_info *mtd, int section,
817 struct mtd_oob_region *oobregion)
822 oobregion->offset = 8;
823 oobregion->length = 9;
828 static const struct mtd_ooblayout_ops akita_ooblayout_ops = {
829 .ecc = akita_ooblayout_ecc,
830 .free = akita_ooblayout_free,
833 static const char * const probes[] = {
840 static struct sharpsl_nand_platform_data spitz_nand_pdata = {
841 .badblock_pattern = &spitz_nand_bbt,
842 .part_parsers = probes,
845 static struct resource spitz_nand_resources[] = {
847 .start = PXA_CS3_PHYS,
848 .end = PXA_CS3_PHYS + SZ_4K - 1,
849 .flags = IORESOURCE_MEM,
853 static struct platform_device spitz_nand_device = {
854 .name = "sharpsl-nand",
856 .resource = spitz_nand_resources,
857 .num_resources = ARRAY_SIZE(spitz_nand_resources),
859 .platform_data = &spitz_nand_pdata,
863 static void __init spitz_nand_init(void)
865 if (machine_is_akita() || machine_is_borzoi()) {
866 spitz_nand_bbt.len = 1;
867 spitz_nand_pdata.ecc_layout = &akita_ooblayout_ops;
870 platform_device_register(&spitz_nand_device);
873 static inline void spitz_nand_init(void) {}
876 /******************************************************************************
878 ******************************************************************************/
879 #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
880 static struct mtd_partition spitz_rom_parts[] = {
882 .name ="Boot PROM Filesystem",
883 .offset = 0x00140000,
884 .size = MTDPART_SIZ_FULL,
888 static struct physmap_flash_data spitz_rom_data = {
890 .nr_parts = ARRAY_SIZE(spitz_rom_parts),
891 .parts = spitz_rom_parts,
894 static struct resource spitz_rom_resources[] = {
896 .start = PXA_CS0_PHYS,
897 .end = PXA_CS0_PHYS + SZ_8M - 1,
898 .flags = IORESOURCE_MEM,
902 static struct platform_device spitz_rom_device = {
903 .name = "physmap-flash",
905 .resource = spitz_rom_resources,
906 .num_resources = ARRAY_SIZE(spitz_rom_resources),
908 .platform_data = &spitz_rom_data,
912 static void __init spitz_nor_init(void)
914 platform_device_register(&spitz_rom_device);
917 static inline void spitz_nor_init(void) {}
920 /******************************************************************************
922 ******************************************************************************/
923 #if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
924 static struct pca953x_platform_data akita_pca953x_pdata = {
925 .gpio_base = AKITA_IOEXP_GPIO_BASE,
928 static struct i2c_board_info spitz_i2c_devs[] = {
935 .platform_data = &akita_pca953x_pdata,
939 static struct regulator_consumer_supply isl6271a_consumers[] = {
940 REGULATOR_SUPPLY("vcc_core", NULL),
943 static struct regulator_init_data isl6271a_info[] = {
946 .name = "vcc_core range",
950 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
952 .consumer_supplies = isl6271a_consumers,
953 .num_consumer_supplies = ARRAY_SIZE(isl6271a_consumers),
957 static struct i2c_board_info spitz_pi2c_devs[] = {
961 .platform_data = &isl6271a_info,
965 static void __init spitz_i2c_init(void)
967 int size = ARRAY_SIZE(spitz_i2c_devs);
969 /* Only Akita has the max7310 chip */
970 if (!machine_is_akita())
973 pxa_set_i2c_info(NULL);
974 pxa27x_set_i2c_power_info(NULL);
975 i2c_register_board_info(0, spitz_i2c_devs, size);
976 i2c_register_board_info(1, ARRAY_AND_SIZE(spitz_pi2c_devs));
979 static inline void spitz_i2c_init(void) {}
982 static const struct property_entry spitz_audio_props[] = {
983 PROPERTY_ENTRY_GPIO("mute-l-gpios", &spitz_scoop_1_gpiochip_node, 3,
985 PROPERTY_ENTRY_GPIO("mute-r-gpios", &spitz_scoop_1_gpiochip_node, 4,
987 PROPERTY_ENTRY_GPIO("mic-gpios", &spitz_scoop_2_gpiochip_node, 8,
992 static const struct property_entry akita_audio_props[] = {
993 PROPERTY_ENTRY_GPIO("mute-l-gpios", &spitz_scoop_1_gpiochip_node, 3,
995 PROPERTY_ENTRY_GPIO("mute-r-gpios", &spitz_scoop_1_gpiochip_node, 4,
997 PROPERTY_ENTRY_GPIO("mic-gpios", &akita_max7310_gpiochip_node, 2,
1002 /******************************************************************************
1004 ******************************************************************************/
1005 static inline void spitz_audio_init(void)
1007 struct platform_device_info audio_info = {
1008 .name = "spitz-audio",
1009 .id = PLATFORM_DEVID_NONE,
1010 .properties = machine_is_akita() ?
1011 akita_audio_props : spitz_audio_props,
1014 platform_device_register_full(&audio_info);
1017 /******************************************************************************
1019 ******************************************************************************/
1020 static void spitz_poweroff(void)
1022 pxa_restart(REBOOT_GPIO, NULL);
1025 static void spitz_restart(enum reboot_mode mode, const char *cmd)
1027 uint32_t msc0 = __raw_readl(MSC0);
1028 /* Bootloader magic for a reboot */
1029 if ((msc0 & 0xffff0000) == 0x7ff00000)
1030 __raw_writel((msc0 & 0xffff) | 0x7ee00000, MSC0);
1035 static void __init spitz_init(void)
1037 software_node_register(&spitz_scoop_1_gpiochip_node);
1038 if (machine_is_akita())
1039 software_node_register(&akita_max7310_gpiochip_node);
1041 software_node_register(&spitz_scoop_2_gpiochip_node);
1043 init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0);
1044 pm_power_off = spitz_poweroff;
1048 /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
1051 pxa2xx_mfp_config(ARRAY_AND_SIZE(spitz_pin_config));
1053 pxa_set_ffuart_info(NULL);
1054 pxa_set_btuart_info(NULL);
1055 pxa_set_stuart_info(NULL);
1063 spitz_pcmcia_init();
1071 regulator_has_full_constraints();
1074 static void __init spitz_fixup(struct tag *tags, char **cmdline)
1076 sharpsl_save_param();
1077 memblock_add(0xa0000000, SZ_64M);
1080 #ifdef CONFIG_MACH_SPITZ
1081 MACHINE_START(SPITZ, "SHARP Spitz")
1082 .fixup = spitz_fixup,
1083 .map_io = pxa27x_map_io,
1084 .nr_irqs = PXA_NR_IRQS,
1085 .init_irq = pxa27x_init_irq,
1086 .init_machine = spitz_init,
1087 .init_time = pxa_timer_init,
1088 .restart = spitz_restart,
1092 #ifdef CONFIG_MACH_BORZOI
1093 MACHINE_START(BORZOI, "SHARP Borzoi")
1094 .fixup = spitz_fixup,
1095 .map_io = pxa27x_map_io,
1096 .nr_irqs = PXA_NR_IRQS,
1097 .init_irq = pxa27x_init_irq,
1098 .init_machine = spitz_init,
1099 .init_time = pxa_timer_init,
1100 .restart = spitz_restart,
1104 #ifdef CONFIG_MACH_AKITA
1105 MACHINE_START(AKITA, "SHARP Akita")
1106 .fixup = spitz_fixup,
1107 .map_io = pxa27x_map_io,
1108 .nr_irqs = PXA_NR_IRQS,
1109 .init_irq = pxa27x_init_irq,
1110 .init_machine = spitz_init,
1111 .init_time = pxa_timer_init,
1112 .restart = spitz_restart,