1 // SPDX-License-Identifier: GPL-2.0-only
3 * Support for Sharp SL-C6000x PDAs
6 * Copyright (c) 2005 Dirk Opfer
8 * Based on code written by Sharp/Lineo for 2.4 kernels
11 #include <linux/clkdev.h>
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
15 #include <linux/major.h>
17 #include <linux/interrupt.h>
18 #include <linux/delay.h>
20 #include <linux/mmc/host.h>
21 #include <linux/mfd/tc6393xb.h>
22 #include <linux/mfd/tmio.h>
23 #include <linux/mtd/rawnand.h>
24 #include <linux/mtd/partitions.h>
25 #include <linux/mtd/physmap.h>
27 #include <linux/gpio_keys.h>
28 #include <linux/input.h>
29 #include <linux/gpio.h>
30 #include <linux/gpio/machine.h>
31 #include <linux/power/gpio-charger.h>
32 #include <linux/spi/spi.h>
33 #include <linux/spi/pxa2xx_spi.h>
34 #include <linux/input/matrix_keypad.h>
35 #include <linux/platform_data/i2c-pxa.h>
36 #include <linux/reboot.h>
37 #include <linux/memblock.h>
39 #include <asm/setup.h>
40 #include <asm/mach-types.h>
43 #include <mach/reset.h>
44 #include <linux/platform_data/irda-pxaficp.h>
45 #include <linux/platform_data/mmc-pxamci.h>
48 #include <mach/audio.h>
49 #include <mach/smemc.h>
51 #include <asm/mach/arch.h>
52 #include <mach/tosa.h>
54 #include <asm/hardware/scoop.h>
55 #include <asm/mach/sharpsl_param.h>
60 static unsigned long tosa_pin_config[] = {
61 GPIO78_nCS_2, /* Scoop */
62 GPIO80_nCS_4, /* tg6393xb */
63 GPIO33_nCS_5, /* Scoop */
65 // GPIO76 CARD_VCC_ON1
67 GPIO19_GPIO, /* Reset out */
68 GPIO1_RST | WAKEUP_ON_EDGE_FALL,
70 GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* WAKE_UP */
71 GPIO2_GPIO | WAKEUP_ON_EDGE_BOTH, /* AC_IN */
72 GPIO3_GPIO | WAKEUP_ON_EDGE_FALL, /* RECORD */
73 GPIO4_GPIO | WAKEUP_ON_EDGE_FALL, /* SYNC */
74 GPIO20_GPIO, /* EAR_IN */
77 GPIO5_GPIO, /* USB_IN */
78 GPIO32_GPIO, /* Pen IRQ */
80 GPIO7_GPIO, /* Jacket Detect */
81 GPIO14_GPIO, /* BAT0_CRG */
82 GPIO12_GPIO, /* BAT1_CRG */
83 GPIO17_GPIO, /* BAT0_LOW */
84 GPIO84_GPIO, /* BAT1_LOW */
85 GPIO38_GPIO, /* BAT_LOCK */
88 GPIO15_GPIO, /* TC6393XB IRQ */
90 GPIO27_GPIO, /* LCD Sync */
95 GPIO9_GPIO, /* Detect */
96 GPIO10_GPIO, /* nSD_INT */
99 GPIO13_GPIO, /* CD_IRQ */
100 GPIO21_GPIO, /* Main Slot IRQ */
101 GPIO36_GPIO, /* Jacket Slot IRQ */
115 GPIO30_AC97_SDATA_OUT,
117 GPIO29_AC97_SDATA_IN_0,
135 GPIO58_GPIO | MFP_LPM_DRIVE_LOW, /* Column 0 */
136 GPIO59_GPIO | MFP_LPM_DRIVE_LOW, /* Column 1 */
137 GPIO60_GPIO | MFP_LPM_DRIVE_LOW, /* Column 2 */
138 GPIO61_GPIO | MFP_LPM_DRIVE_LOW, /* Column 3 */
139 GPIO62_GPIO | MFP_LPM_DRIVE_LOW, /* Column 4 */
140 GPIO63_GPIO | MFP_LPM_DRIVE_LOW, /* Column 5 */
141 GPIO64_GPIO | MFP_LPM_DRIVE_LOW, /* Column 6 */
142 GPIO65_GPIO | MFP_LPM_DRIVE_LOW, /* Column 7 */
143 GPIO66_GPIO | MFP_LPM_DRIVE_LOW, /* Column 8 */
144 GPIO67_GPIO | MFP_LPM_DRIVE_LOW, /* Column 9 */
145 GPIO68_GPIO | MFP_LPM_DRIVE_LOW, /* Column 10 */
146 GPIO69_GPIO | MFP_LPM_DRIVE_LOW, /* Row 0 */
147 GPIO70_GPIO | MFP_LPM_DRIVE_LOW, /* Row 1 */
148 GPIO71_GPIO | MFP_LPM_DRIVE_LOW, /* Row 2 */
149 GPIO72_GPIO | MFP_LPM_DRIVE_LOW, /* Row 3 */
150 GPIO73_GPIO | MFP_LPM_DRIVE_LOW, /* Row 4 */
151 GPIO74_GPIO | MFP_LPM_DRIVE_LOW, /* Row 5 */
152 GPIO75_GPIO | MFP_LPM_DRIVE_LOW, /* Row 6 */
159 /* IrDA is managed in other way */
167 static struct resource tosa_scoop_resources[] = {
169 .start = TOSA_CF_PHYS,
170 .end = TOSA_CF_PHYS + 0xfff,
171 .flags = IORESOURCE_MEM,
175 static struct scoop_config tosa_scoop_setup = {
176 .io_dir = TOSA_SCOOP_IO_DIR,
177 .gpio_base = TOSA_SCOOP_GPIO_BASE,
180 static struct platform_device tosascoop_device = {
181 .name = "sharp-scoop",
184 .platform_data = &tosa_scoop_setup,
186 .num_resources = ARRAY_SIZE(tosa_scoop_resources),
187 .resource = tosa_scoop_resources,
192 * SCOOP Device Jacket
194 static struct resource tosa_scoop_jc_resources[] = {
196 .start = TOSA_SCOOP_PHYS + 0x40,
197 .end = TOSA_SCOOP_PHYS + 0xfff,
198 .flags = IORESOURCE_MEM,
202 static struct scoop_config tosa_scoop_jc_setup = {
203 .io_dir = TOSA_SCOOP_JC_IO_DIR,
204 .gpio_base = TOSA_SCOOP_JC_GPIO_BASE,
207 static struct platform_device tosascoop_jc_device = {
208 .name = "sharp-scoop",
211 .platform_data = &tosa_scoop_jc_setup,
212 .parent = &tosascoop_device.dev,
214 .num_resources = ARRAY_SIZE(tosa_scoop_jc_resources),
215 .resource = tosa_scoop_jc_resources,
221 static struct scoop_pcmcia_dev tosa_pcmcia_scoop[] = {
223 .dev = &tosascoop_device.dev,
224 .irq = TOSA_IRQ_GPIO_CF_IRQ,
225 .cd_irq = TOSA_IRQ_GPIO_CF_CD,
226 .cd_irq_str = "PCMCIA0 CD",
228 .dev = &tosascoop_jc_device.dev,
229 .irq = TOSA_IRQ_GPIO_JC_CF_IRQ,
234 static struct scoop_pcmcia_config tosa_pcmcia_config = {
235 .devs = &tosa_pcmcia_scoop[0],
240 * USB Device Controller
242 static struct gpiod_lookup_table tosa_udc_gpiod_table = {
243 .dev_id = "gpio-vbus",
245 GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_USB_IN,
246 "vbus", GPIO_ACTIVE_LOW),
247 GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_USB_PULLUP,
248 "pullup", GPIO_ACTIVE_HIGH),
253 static struct platform_device tosa_gpio_vbus = {
261 static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void *data)
265 err = gpio_request(TOSA_GPIO_nSD_INT, "SD Int");
267 printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n");
270 err = gpio_direction_input(TOSA_GPIO_nSD_INT);
272 goto err_gpio_int_dir;
277 gpio_free(TOSA_GPIO_nSD_INT);
282 static void tosa_mci_exit(struct device *dev, void *data)
284 gpio_free(TOSA_GPIO_nSD_INT);
287 static struct pxamci_platform_data tosa_mci_platform_data = {
288 .detect_delay_ms = 250,
289 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
290 .init = tosa_mci_init,
291 .exit = tosa_mci_exit,
294 static struct gpiod_lookup_table tosa_mci_gpio_table = {
295 .dev_id = "pxa2xx-mci.0",
297 GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_nSD_DETECT,
298 "cd", GPIO_ACTIVE_LOW),
299 GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_SD_WP,
300 "wp", GPIO_ACTIVE_LOW),
301 GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_PWR_ON,
302 "power", GPIO_ACTIVE_HIGH),
310 static void tosa_irda_transceiver_mode(struct device *dev, int mode)
313 gpio_set_value(TOSA_GPIO_IR_POWERDWN, 0);
314 pxa2xx_transceiver_mode(dev, mode);
315 gpio_direction_output(TOSA_GPIO_IRDA_TX, 0);
317 pxa2xx_transceiver_mode(dev, mode);
318 gpio_set_value(TOSA_GPIO_IR_POWERDWN, 1);
322 static int tosa_irda_startup(struct device *dev)
326 ret = gpio_request(TOSA_GPIO_IRDA_TX, "IrDA TX");
329 ret = gpio_direction_output(TOSA_GPIO_IRDA_TX, 0);
333 ret = gpio_request(TOSA_GPIO_IR_POWERDWN, "IrDA powerdown");
337 ret = gpio_direction_output(TOSA_GPIO_IR_POWERDWN, 0);
341 tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
346 gpio_free(TOSA_GPIO_IR_POWERDWN);
349 gpio_free(TOSA_GPIO_IRDA_TX);
354 static void tosa_irda_shutdown(struct device *dev)
356 tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
357 gpio_free(TOSA_GPIO_IR_POWERDWN);
358 gpio_free(TOSA_GPIO_IRDA_TX);
361 static struct pxaficp_platform_data tosa_ficp_platform_data = {
363 .transceiver_cap = IR_SIRMODE | IR_OFF,
364 .transceiver_mode = tosa_irda_transceiver_mode,
365 .startup = tosa_irda_startup,
366 .shutdown = tosa_irda_shutdown,
372 static struct gpiod_lookup_table tosa_power_gpiod_table = {
373 .dev_id = "gpio-charger",
375 GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_AC_IN,
376 NULL, GPIO_ACTIVE_LOW),
381 static char *tosa_ac_supplied_to[] = {
387 static struct gpio_charger_platform_data tosa_power_data = {
389 .type = POWER_SUPPLY_TYPE_MAINS,
390 .supplied_to = tosa_ac_supplied_to,
391 .num_supplicants = ARRAY_SIZE(tosa_ac_supplied_to),
394 static struct resource tosa_power_resource[] = {
397 .start = PXA_GPIO_TO_IRQ(TOSA_GPIO_AC_IN),
398 .end = PXA_GPIO_TO_IRQ(TOSA_GPIO_AC_IN),
399 .flags = IORESOURCE_IRQ |
400 IORESOURCE_IRQ_HIGHEDGE |
401 IORESOURCE_IRQ_LOWEDGE,
405 static struct platform_device tosa_power_device = {
406 .name = "gpio-charger",
408 .dev.platform_data = &tosa_power_data,
409 .resource = tosa_power_resource,
410 .num_resources = ARRAY_SIZE(tosa_power_resource),
416 static const uint32_t tosakbd_keymap[] = {
419 KEY(0, 6, KEY_BACKSPACE),
427 KEY(1, 7, KEY_COMMA),
433 KEY(2, 6, KEY_ENTER),
439 KEY(3, 4, TOSA_KEY_ADDRESSBOOK),
440 KEY(3, 5, TOSA_KEY_CANCEL),
441 KEY(3, 6, TOSA_KEY_CENTER),
442 KEY(3, 7, TOSA_KEY_OK),
443 KEY(3, 8, KEY_LEFTSHIFT),
448 KEY(4, 4, TOSA_KEY_CALENDAR),
449 KEY(4, 5, TOSA_KEY_HOMEPAGE),
450 KEY(4, 6, KEY_LEFTCTRL),
451 KEY(4, 7, TOSA_KEY_LIGHT),
452 KEY(4, 9, KEY_RIGHTSHIFT),
454 KEY(5, 1, KEY_SLASH),
457 KEY(5, 4, TOSA_KEY_MENU),
459 KEY(5, 10, TOSA_KEY_FN),
462 KEY(6, 2, KEY_SPACE),
463 KEY(6, 3, KEY_APOSTROPHE),
464 KEY(6, 4, TOSA_KEY_MAIL),
467 KEY(6, 7, KEY_RIGHT),
470 static struct matrix_keymap_data tosakbd_keymap_data = {
471 .keymap = tosakbd_keymap,
472 .keymap_size = ARRAY_SIZE(tosakbd_keymap),
475 static const int tosakbd_col_gpios[] =
476 { 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68 };
477 static const int tosakbd_row_gpios[] =
478 { 69, 70, 71, 72, 73, 74, 75 };
480 static struct matrix_keypad_platform_data tosakbd_pdata = {
481 .keymap_data = &tosakbd_keymap_data,
482 .row_gpios = tosakbd_row_gpios,
483 .col_gpios = tosakbd_col_gpios,
484 .num_row_gpios = ARRAY_SIZE(tosakbd_row_gpios),
485 .num_col_gpios = ARRAY_SIZE(tosakbd_col_gpios),
486 .col_scan_delay_us = 10,
491 static struct platform_device tosakbd_device = {
492 .name = "matrix-keypad",
495 .platform_data = &tosakbd_pdata,
499 static struct gpio_keys_button tosa_gpio_keys[] = {
501 * Two following keys are directly tied to "ON" button of tosa. Why?
502 * The first one can be used as a wakeup source, the second can't;
503 * also the first one is OR of ac_powered and on_button.
507 .code = KEY_RESERVED,
508 .gpio = TOSA_GPIO_POWERON,
516 .gpio = TOSA_GPIO_ON_KEY,
519 * can't be used as wakeup
526 .code = TOSA_KEY_RECORD,
527 .gpio = TOSA_GPIO_RECORD_BTN,
528 .desc = "Record Button",
534 .code = TOSA_KEY_SYNC,
535 .gpio = TOSA_GPIO_SYNC,
536 .desc = "Sync Button",
542 .code = SW_HEADPHONE_INSERT,
543 .gpio = TOSA_GPIO_EAR_IN,
544 .desc = "HeadPhone insert",
546 .debounce_interval = 300,
550 static struct gpio_keys_platform_data tosa_gpio_keys_platform_data = {
551 .buttons = tosa_gpio_keys,
552 .nbuttons = ARRAY_SIZE(tosa_gpio_keys),
555 static struct platform_device tosa_gpio_keys_device = {
559 .platform_data = &tosa_gpio_keys_platform_data,
566 static struct gpio_led tosa_gpio_leds[] = {
568 .name = "tosa:amber:charge",
569 .default_trigger = "main-battery-charging",
570 .gpio = TOSA_GPIO_CHRG_ERR_LED,
573 .name = "tosa:green:mail",
574 .default_trigger = "nand-disk",
575 .gpio = TOSA_GPIO_NOTE_LED,
578 .name = "tosa:dual:wlan",
579 .default_trigger = "none",
580 .gpio = TOSA_GPIO_WLAN_LED,
583 .name = "tosa:blue:bluetooth",
584 .default_trigger = "tosa-bt",
585 .gpio = TOSA_GPIO_BT_LED,
589 static struct gpio_led_platform_data tosa_gpio_leds_platform_data = {
590 .leds = tosa_gpio_leds,
591 .num_leds = ARRAY_SIZE(tosa_gpio_leds),
594 static struct platform_device tosaled_device = {
598 .platform_data = &tosa_gpio_leds_platform_data,
603 * Toshiba Mobile IO Controller
605 static struct resource tc6393xb_resources[] = {
607 .start = TOSA_LCDC_PHYS,
608 .end = TOSA_LCDC_PHYS + 0x3ffffff,
609 .flags = IORESOURCE_MEM,
613 .start = TOSA_IRQ_GPIO_TC6393XB_INT,
614 .end = TOSA_IRQ_GPIO_TC6393XB_INT,
615 .flags = IORESOURCE_IRQ,
620 static int tosa_tc6393xb_enable(struct platform_device *dev)
624 rc = gpio_request(TOSA_GPIO_TC6393XB_REST_IN, "tc6393xb #pclr");
627 rc = gpio_request(TOSA_GPIO_TC6393XB_SUSPEND, "tc6393xb #suspend");
629 goto err_req_suspend;
630 rc = gpio_request(TOSA_GPIO_TC6393XB_L3V_ON, "tc6393xb l3v");
633 rc = gpio_direction_output(TOSA_GPIO_TC6393XB_L3V_ON, 0);
636 rc = gpio_direction_output(TOSA_GPIO_TC6393XB_SUSPEND, 0);
638 goto err_dir_suspend;
639 rc = gpio_direction_output(TOSA_GPIO_TC6393XB_REST_IN, 0);
645 gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 1);
649 gpio_set_value(TOSA_GPIO_TC6393XB_REST_IN, 1);
650 gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 1);
656 gpio_free(TOSA_GPIO_TC6393XB_L3V_ON);
658 gpio_free(TOSA_GPIO_TC6393XB_SUSPEND);
660 gpio_free(TOSA_GPIO_TC6393XB_REST_IN);
665 static int tosa_tc6393xb_disable(struct platform_device *dev)
667 gpio_free(TOSA_GPIO_TC6393XB_L3V_ON);
668 gpio_free(TOSA_GPIO_TC6393XB_SUSPEND);
669 gpio_free(TOSA_GPIO_TC6393XB_REST_IN);
674 static int tosa_tc6393xb_resume(struct platform_device *dev)
676 gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 1);
678 gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 1);
684 static int tosa_tc6393xb_suspend(struct platform_device *dev)
686 gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 0);
687 gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 0);
691 static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
693 static struct nand_bbt_descr tosa_tc6393xb_nand_bbt = {
697 .pattern = scan_ff_pattern
700 static const char * const probes[] = {
707 static struct tmio_nand_data tosa_tc6393xb_nand_config = {
708 .badblock_pattern = &tosa_tc6393xb_nand_bbt,
709 .part_parsers = probes,
712 static int tosa_tc6393xb_setup(struct platform_device *dev)
716 rc = gpio_request(TOSA_GPIO_CARD_VCC_ON, "CARD_VCC_ON");
720 rc = gpio_direction_output(TOSA_GPIO_CARD_VCC_ON, 1);
727 gpio_free(TOSA_GPIO_CARD_VCC_ON);
732 static void tosa_tc6393xb_teardown(struct platform_device *dev)
734 gpio_free(TOSA_GPIO_CARD_VCC_ON);
737 #ifdef CONFIG_MFD_TC6393XB
738 static struct fb_videomode tosa_tc6393xb_lcd_mode[] = {
742 .pixclock = 0x002cdf00,/* PLL divisor */
743 .left_margin = 0x004c,
744 .right_margin = 0x005b,
745 .upper_margin = 0x0001,
746 .lower_margin = 0x000d,
749 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
750 .vmode = FB_VMODE_NONINTERLACED,
754 .pixclock = 0x00e7f203,/* PLL divisor */
755 .left_margin = 0x0024,
756 .right_margin = 0x002f,
757 .upper_margin = 0x0001,
758 .lower_margin = 0x000d,
761 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
762 .vmode = FB_VMODE_NONINTERLACED,
766 static struct tmio_fb_data tosa_tc6393xb_fb_config = {
767 .lcd_set_power = tc6393xb_lcd_set_power,
768 .lcd_mode = tc6393xb_lcd_mode,
769 .num_modes = ARRAY_SIZE(tosa_tc6393xb_lcd_mode),
770 .modes = &tosa_tc6393xb_lcd_mode[0],
776 static struct tc6393xb_platform_data tosa_tc6393xb_data = {
777 .scr_pll2cr = 0x0cc1,
780 .irq_base = IRQ_BOARD_START,
781 .gpio_base = TOSA_TC6393XB_GPIO_BASE,
782 .setup = tosa_tc6393xb_setup,
783 .teardown = tosa_tc6393xb_teardown,
785 .enable = tosa_tc6393xb_enable,
786 .disable = tosa_tc6393xb_disable,
787 .suspend = tosa_tc6393xb_suspend,
788 .resume = tosa_tc6393xb_resume,
790 .nand_data = &tosa_tc6393xb_nand_config,
791 #ifdef CONFIG_MFD_TC6393XB
792 .fb_data = &tosa_tc6393xb_fb_config,
799 static struct platform_device tc6393xb_device = {
803 .platform_data = &tosa_tc6393xb_data,
805 .num_resources = ARRAY_SIZE(tc6393xb_resources),
806 .resource = tc6393xb_resources,
809 static struct tosa_bt_data tosa_bt_data = {
810 .gpio_pwr = TOSA_GPIO_BT_PWR_EN,
811 .gpio_reset = TOSA_GPIO_BT_RESET,
814 static struct platform_device tosa_bt_device = {
817 .dev.platform_data = &tosa_bt_data,
820 static struct pxa2xx_spi_controller pxa_ssp_master_info = {
824 static struct gpiod_lookup_table tosa_lcd_gpio_table = {
827 GPIO_LOOKUP("tc6393xb",
828 TOSA_GPIO_TG_ON - TOSA_TC6393XB_GPIO_BASE,
829 "tg #pwr", GPIO_ACTIVE_HIGH),
834 static struct gpiod_lookup_table tosa_lcd_bl_gpio_table = {
835 .dev_id = "i2c-tosa-bl",
837 GPIO_LOOKUP("tc6393xb",
838 TOSA_GPIO_BL_C20MA - TOSA_TC6393XB_GPIO_BASE,
839 "backlight", GPIO_ACTIVE_HIGH),
844 static struct spi_board_info spi_board_info[] __initdata = {
846 .modalias = "tosa-lcd",
848 .max_speed_hz = 28750,
855 static struct mtd_partition sharpsl_rom_parts[] = {
857 .name ="Boot PROM Filesystem",
858 .offset = 0x00160000,
859 .size = MTDPART_SIZ_FULL,
863 static struct physmap_flash_data sharpsl_rom_data = {
865 .nr_parts = ARRAY_SIZE(sharpsl_rom_parts),
866 .parts = sharpsl_rom_parts,
869 static struct resource sharpsl_rom_resources[] = {
873 .flags = IORESOURCE_MEM,
877 static struct platform_device sharpsl_rom_device = {
878 .name = "physmap-flash",
880 .resource = sharpsl_rom_resources,
881 .num_resources = ARRAY_SIZE(sharpsl_rom_resources),
882 .dev.platform_data = &sharpsl_rom_data,
885 static struct platform_device wm9712_device = {
886 .name = "wm9712-codec",
890 static struct platform_device tosa_audio_device = {
891 .name = "tosa-audio",
895 static struct platform_device *devices[] __initdata = {
897 &tosascoop_jc_device,
901 &tosa_gpio_keys_device,
910 static void tosa_poweroff(void)
912 pxa_restart(REBOOT_GPIO, NULL);
915 static void tosa_restart(enum reboot_mode mode, const char *cmd)
917 uint32_t msc0 = __raw_readl(MSC0);
919 /* Bootloader magic for a reboot */
920 if((msc0 & 0xffff0000) == 0x7ff00000)
921 __raw_writel((msc0 & 0xffff) | 0x7ee00000, MSC0);
926 static void __init tosa_init(void)
928 pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config));
930 pxa_set_ffuart_info(NULL);
931 pxa_set_btuart_info(NULL);
932 pxa_set_stuart_info(NULL);
934 gpio_set_wake(MFP_PIN_GPIO1, 1);
935 /* We can't pass to gpio-keys since it will drop the Reset altfunc */
937 init_gpio_reset(TOSA_GPIO_ON_RESET, 0, 0);
939 pm_power_off = tosa_poweroff;
943 /* enable batt_fault */
946 gpiod_add_lookup_table(&tosa_mci_gpio_table);
947 pxa_set_mci_info(&tosa_mci_platform_data);
948 pxa_set_ficp_info(&tosa_ficp_platform_data);
949 pxa_set_i2c_info(NULL);
950 pxa_set_ac97_info(NULL);
951 platform_scoop_config = &tosa_pcmcia_config;
953 pxa2xx_set_spi_info(2, &pxa_ssp_master_info);
954 gpiod_add_lookup_table(&tosa_lcd_gpio_table);
955 gpiod_add_lookup_table(&tosa_lcd_bl_gpio_table);
956 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
958 clk_add_alias("CLK_CK3P6MI", tc6393xb_device.name, "GPIO11_CLK", NULL);
960 gpiod_add_lookup_table(&tosa_udc_gpiod_table);
961 gpiod_add_lookup_table(&tosa_power_gpiod_table);
962 platform_add_devices(devices, ARRAY_SIZE(devices));
965 static void __init fixup_tosa(struct tag *tags, char **cmdline)
967 sharpsl_save_param();
968 memblock_add(0xa0000000, SZ_64M);
971 MACHINE_START(TOSA, "SHARP Tosa")
973 .map_io = pxa25x_map_io,
974 .nr_irqs = TOSA_NR_IRQS,
975 .init_irq = pxa25x_init_irq,
976 .handle_irq = pxa25x_handle_irq,
977 .init_machine = tosa_init,
978 .init_time = pxa_timer_init,
979 .restart = tosa_restart,