2  *  Support for Sharp SL-C6000x PDAs
 
   5  *  Copyright (c) 2005 Dirk Opfer
 
   7  *      Based on code written by Sharp/Lineo for 2.4 kernels
 
   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.
 
  15 #include <linux/kernel.h>
 
  16 #include <linux/init.h>
 
  17 #include <linux/platform_device.h>
 
  18 #include <linux/major.h>
 
  20 #include <linux/interrupt.h>
 
  21 #include <linux/delay.h>
 
  23 #include <linux/mmc/host.h>
 
  24 #include <linux/mfd/tc6393xb.h>
 
  25 #include <linux/mfd/tmio.h>
 
  26 #include <linux/mtd/nand.h>
 
  27 #include <linux/mtd/partitions.h>
 
  28 #include <linux/mtd/physmap.h>
 
  30 #include <linux/gpio_keys.h>
 
  31 #include <linux/input.h>
 
  32 #include <linux/gpio.h>
 
  33 #include <linux/pda_power.h>
 
  34 #include <linux/rfkill.h>
 
  35 #include <linux/spi/spi.h>
 
  37 #include <asm/setup.h>
 
  38 #include <asm/mach-types.h>
 
  39 #include <mach/pxa2xx-regs.h>
 
  40 #include <mach/mfp-pxa25x.h>
 
  41 #include <mach/reset.h>
 
  42 #include <mach/irda.h>
 
  46 #include <mach/tosa_bt.h>
 
  47 #include <mach/pxa2xx_spi.h>
 
  49 #include <asm/mach/arch.h>
 
  50 #include <mach/tosa.h>
 
  52 #include <asm/hardware/scoop.h>
 
  53 #include <asm/mach/sharpsl_param.h>
 
  59 static unsigned long tosa_pin_config[] = {
 
  60         GPIO78_nCS_2, /* Scoop */
 
  61         GPIO80_nCS_4, /* tg6393xb */
 
  62         GPIO33_nCS_5, /* Scoop */
 
  64         // GPIO76 CARD_VCC_ON1
 
  66         GPIO19_GPIO, /* Reset out */
 
  67         GPIO1_RST | WAKEUP_ON_EDGE_FALL,
 
  69         GPIO0_GPIO | WAKEUP_ON_EDGE_FALL, /* WAKE_UP */
 
  70         GPIO2_GPIO | WAKEUP_ON_EDGE_BOTH, /* AC_IN */
 
  71         GPIO3_GPIO | WAKEUP_ON_EDGE_FALL, /* RECORD */
 
  72         GPIO4_GPIO | WAKEUP_ON_EDGE_FALL, /* SYNC */
 
  73         GPIO20_GPIO, /* EAR_IN */
 
  76         GPIO5_GPIO, /* USB_IN */
 
  77         GPIO32_GPIO, /* Pen IRQ */
 
  79         GPIO7_GPIO, /* Jacket Detect */
 
  80         GPIO14_GPIO, /* BAT0_CRG */
 
  81         GPIO12_GPIO, /* BAT1_CRG */
 
  82         GPIO17_GPIO, /* BAT0_LOW */
 
  83         GPIO84_GPIO, /* BAT1_LOW */
 
  84         GPIO38_GPIO, /* BAT_LOCK */
 
  87         GPIO15_GPIO, /* TC6393XB IRQ */
 
  89         GPIO27_GPIO, /* LCD Sync */
 
  94         GPIO9_GPIO, /* Detect */
 
  95         GPIO10_GPIO, /* nSD_INT */
 
  98         GPIO13_GPIO, /* CD_IRQ */
 
  99         GPIO21_GPIO, /* Main Slot IRQ */
 
 100         GPIO36_GPIO, /* Jacket Slot IRQ */
 
 114         GPIO30_AC97_SDATA_OUT,
 
 116         GPIO29_AC97_SDATA_IN_0,
 
 134         GPIO58_GPIO | MFP_LPM_DRIVE_LOW,
 
 135         GPIO59_GPIO | MFP_LPM_DRIVE_LOW,
 
 136         GPIO60_GPIO | MFP_LPM_DRIVE_LOW,
 
 137         GPIO61_GPIO | MFP_LPM_DRIVE_LOW,
 
 138         GPIO62_GPIO | MFP_LPM_DRIVE_LOW,
 
 139         GPIO63_GPIO | MFP_LPM_DRIVE_LOW,
 
 140         GPIO64_GPIO | MFP_LPM_DRIVE_LOW,
 
 141         GPIO65_GPIO | MFP_LPM_DRIVE_LOW,
 
 142         GPIO66_GPIO | MFP_LPM_DRIVE_LOW,
 
 143         GPIO67_GPIO | MFP_LPM_DRIVE_LOW,
 
 144         GPIO68_GPIO | MFP_LPM_DRIVE_LOW,
 
 145         GPIO69_GPIO | MFP_LPM_DRIVE_LOW,
 
 146         GPIO70_GPIO | MFP_LPM_DRIVE_LOW,
 
 147         GPIO71_GPIO | MFP_LPM_DRIVE_LOW,
 
 148         GPIO72_GPIO | MFP_LPM_DRIVE_LOW,
 
 149         GPIO73_GPIO | MFP_LPM_DRIVE_LOW,
 
 150         GPIO74_GPIO | MFP_LPM_DRIVE_LOW,
 
 151         GPIO75_GPIO | MFP_LPM_DRIVE_LOW,
 
 158         /* IrDA is managed in other way */
 
 166 static struct resource tosa_scoop_resources[] = {
 
 168                 .start  = TOSA_CF_PHYS,
 
 169                 .end    = TOSA_CF_PHYS + 0xfff,
 
 170                 .flags  = IORESOURCE_MEM,
 
 174 static struct scoop_config tosa_scoop_setup = {
 
 175         .io_dir         = TOSA_SCOOP_IO_DIR,
 
 176         .gpio_base      = TOSA_SCOOP_GPIO_BASE,
 
 179 static struct platform_device tosascoop_device = {
 
 180         .name           = "sharp-scoop",
 
 183                 .platform_data  = &tosa_scoop_setup,
 
 185         .num_resources  = ARRAY_SIZE(tosa_scoop_resources),
 
 186         .resource       = tosa_scoop_resources,
 
 191  * SCOOP Device Jacket
 
 193 static struct resource tosa_scoop_jc_resources[] = {
 
 195                 .start          = TOSA_SCOOP_PHYS + 0x40,
 
 196                 .end            = TOSA_SCOOP_PHYS + 0xfff,
 
 197                 .flags          = IORESOURCE_MEM,
 
 201 static struct scoop_config tosa_scoop_jc_setup = {
 
 202         .io_dir         = TOSA_SCOOP_JC_IO_DIR,
 
 203         .gpio_base      = TOSA_SCOOP_JC_GPIO_BASE,
 
 206 static struct platform_device tosascoop_jc_device = {
 
 207         .name           = "sharp-scoop",
 
 210                 .platform_data  = &tosa_scoop_jc_setup,
 
 211                 .parent         = &tosascoop_device.dev,
 
 213         .num_resources  = ARRAY_SIZE(tosa_scoop_jc_resources),
 
 214         .resource       = tosa_scoop_jc_resources,
 
 220 static struct scoop_pcmcia_dev tosa_pcmcia_scoop[] = {
 
 222         .dev        = &tosascoop_device.dev,
 
 223         .irq        = TOSA_IRQ_GPIO_CF_IRQ,
 
 224         .cd_irq     = TOSA_IRQ_GPIO_CF_CD,
 
 225         .cd_irq_str = "PCMCIA0 CD",
 
 227         .dev        = &tosascoop_jc_device.dev,
 
 228         .irq        = TOSA_IRQ_GPIO_JC_CF_IRQ,
 
 233 static struct scoop_pcmcia_config tosa_pcmcia_config = {
 
 234         .devs         = &tosa_pcmcia_scoop[0],
 
 239  * USB Device Controller
 
 241 static struct pxa2xx_udc_mach_info udc_info __initdata = {
 
 242         .gpio_pullup            = TOSA_GPIO_USB_PULLUP,
 
 243         .gpio_vbus              = TOSA_GPIO_USB_IN,
 
 244         .gpio_vbus_inverted     = 1,
 
 250 static struct pxamci_platform_data tosa_mci_platform_data;
 
 252 static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void *data)
 
 256         tosa_mci_platform_data.detect_delay = msecs_to_jiffies(250);
 
 258         err = gpio_request(TOSA_GPIO_nSD_DETECT, "MMC/SD card detect");
 
 260                 printk(KERN_ERR "tosa_mci_init: can't request nSD_DETECT gpio\n");
 
 261                 goto err_gpio_detect;
 
 263         err = gpio_direction_input(TOSA_GPIO_nSD_DETECT);
 
 265                 goto err_gpio_detect_dir;
 
 267         err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int,
 
 268                           IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
 
 269                                 "MMC/SD card detect", data);
 
 271                 printk(KERN_ERR "tosa_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
 
 275         err = gpio_request(TOSA_GPIO_SD_WP, "SD Write Protect");
 
 277                 printk(KERN_ERR "tosa_mci_init: can't request SD_WP gpio\n");
 
 280         err = gpio_direction_input(TOSA_GPIO_SD_WP);
 
 282                 goto err_gpio_wp_dir;
 
 284         err = gpio_request(TOSA_GPIO_PWR_ON, "SD Power");
 
 286                 printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n");
 
 289         err = gpio_direction_output(TOSA_GPIO_PWR_ON, 0);
 
 291                 goto err_gpio_pwr_dir;
 
 293         err = gpio_request(TOSA_GPIO_nSD_INT, "SD Int");
 
 295                 printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n");
 
 298         err = gpio_direction_input(TOSA_GPIO_nSD_INT);
 
 300                 goto err_gpio_int_dir;
 
 305         gpio_free(TOSA_GPIO_nSD_INT);
 
 308         gpio_free(TOSA_GPIO_PWR_ON);
 
 311         gpio_free(TOSA_GPIO_SD_WP);
 
 313         free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data);
 
 316         gpio_free(TOSA_GPIO_nSD_DETECT);
 
 321 static void tosa_mci_setpower(struct device *dev, unsigned int vdd)
 
 323         struct pxamci_platform_data* p_d = dev->platform_data;
 
 325         if (( 1 << vdd) & p_d->ocr_mask) {
 
 326                 gpio_set_value(TOSA_GPIO_PWR_ON, 1);
 
 328                 gpio_set_value(TOSA_GPIO_PWR_ON, 0);
 
 332 static int tosa_mci_get_ro(struct device *dev)
 
 334         return gpio_get_value(TOSA_GPIO_SD_WP);
 
 337 static void tosa_mci_exit(struct device *dev, void *data)
 
 339         gpio_free(TOSA_GPIO_nSD_INT);
 
 340         gpio_free(TOSA_GPIO_PWR_ON);
 
 341         gpio_free(TOSA_GPIO_SD_WP);
 
 342         free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data);
 
 343         gpio_free(TOSA_GPIO_nSD_DETECT);
 
 346 static struct pxamci_platform_data tosa_mci_platform_data = {
 
 347         .ocr_mask       = MMC_VDD_32_33|MMC_VDD_33_34,
 
 348         .init           = tosa_mci_init,
 
 349         .get_ro         = tosa_mci_get_ro,
 
 350         .setpower       = tosa_mci_setpower,
 
 351         .exit           = tosa_mci_exit,
 
 357 static void tosa_irda_transceiver_mode(struct device *dev, int mode)
 
 360                 gpio_set_value(TOSA_GPIO_IR_POWERDWN, 0);
 
 361                 pxa2xx_transceiver_mode(dev, mode);
 
 362                 gpio_direction_output(TOSA_GPIO_IRDA_TX, 0);
 
 364                 pxa2xx_transceiver_mode(dev, mode);
 
 365                 gpio_set_value(TOSA_GPIO_IR_POWERDWN, 1);
 
 369 static int tosa_irda_startup(struct device *dev)
 
 373         ret = gpio_request(TOSA_GPIO_IRDA_TX, "IrDA TX");
 
 376         ret = gpio_direction_output(TOSA_GPIO_IRDA_TX, 0);
 
 380         ret = gpio_request(TOSA_GPIO_IR_POWERDWN, "IrDA powerdown");
 
 384         ret = gpio_direction_output(TOSA_GPIO_IR_POWERDWN, 0);
 
 388         tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
 
 393         gpio_free(TOSA_GPIO_IR_POWERDWN);
 
 396         gpio_free(TOSA_GPIO_IRDA_TX);
 
 401 static void tosa_irda_shutdown(struct device *dev)
 
 403         tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
 
 404         gpio_free(TOSA_GPIO_IR_POWERDWN);
 
 405         gpio_free(TOSA_GPIO_IRDA_TX);
 
 408 static struct pxaficp_platform_data tosa_ficp_platform_data = {
 
 409         .transceiver_cap  = IR_SIRMODE | IR_OFF,
 
 410         .transceiver_mode = tosa_irda_transceiver_mode,
 
 411         .startup = tosa_irda_startup,
 
 412         .shutdown = tosa_irda_shutdown,
 
 418 static int tosa_power_init(struct device *dev)
 
 420         int ret = gpio_request(TOSA_GPIO_AC_IN, "ac in");
 
 424         ret = gpio_direction_input(TOSA_GPIO_AC_IN);
 
 431         gpio_free(TOSA_GPIO_AC_IN);
 
 436 static void tosa_power_exit(struct device *dev)
 
 438         gpio_free(TOSA_GPIO_AC_IN);
 
 441 static int tosa_power_ac_online(void)
 
 443         return gpio_get_value(TOSA_GPIO_AC_IN) == 0;
 
 446 static char *tosa_ac_supplied_to[] = {
 
 452 static struct pda_power_pdata tosa_power_data = {
 
 453         .init                   = tosa_power_init,
 
 454         .is_ac_online           = tosa_power_ac_online,
 
 455         .exit                   = tosa_power_exit,
 
 456         .supplied_to            = tosa_ac_supplied_to,
 
 457         .num_supplicants        = ARRAY_SIZE(tosa_ac_supplied_to),
 
 460 static struct resource tosa_power_resource[] = {
 
 463                 .start          = gpio_to_irq(TOSA_GPIO_AC_IN),
 
 464                 .end            = gpio_to_irq(TOSA_GPIO_AC_IN),
 
 465                 .flags          = IORESOURCE_IRQ |
 
 466                                   IORESOURCE_IRQ_HIGHEDGE |
 
 467                                   IORESOURCE_IRQ_LOWEDGE,
 
 471 static struct platform_device tosa_power_device = {
 
 474         .dev.platform_data      = &tosa_power_data,
 
 475         .resource               = tosa_power_resource,
 
 476         .num_resources          = ARRAY_SIZE(tosa_power_resource),
 
 482 static struct platform_device tosakbd_device = {
 
 483         .name           = "tosa-keyboard",
 
 487 static struct gpio_keys_button tosa_gpio_keys[] = {
 
 489          * Two following keys are directly tied to "ON" button of tosa. Why?
 
 490          * The first one can be used as a wakeup source, the second can't;
 
 491          * also the first one is OR of ac_powered and on_button.
 
 495                 .code   = KEY_RESERVED,
 
 496                 .gpio   = TOSA_GPIO_POWERON,
 
 504                 .gpio   = TOSA_GPIO_ON_KEY,
 
 507                  * can't be used as wakeup
 
 514                 .code   = TOSA_KEY_RECORD,
 
 515                 .gpio   = TOSA_GPIO_RECORD_BTN,
 
 516                 .desc   = "Record Button",
 
 522                 .code   = TOSA_KEY_SYNC,
 
 523                 .gpio   = TOSA_GPIO_SYNC,
 
 524                 .desc   = "Sync Button",
 
 530                 .code   = SW_HEADPHONE_INSERT,
 
 531                 .gpio   = TOSA_GPIO_EAR_IN,
 
 532                 .desc   = "HeadPhone insert",
 
 534                 .debounce_interval = 300,
 
 538 static struct gpio_keys_platform_data tosa_gpio_keys_platform_data = {
 
 539         .buttons        = tosa_gpio_keys,
 
 540         .nbuttons       = ARRAY_SIZE(tosa_gpio_keys),
 
 543 static struct platform_device tosa_gpio_keys_device = {
 
 547                 .platform_data  = &tosa_gpio_keys_platform_data,
 
 554 static struct gpio_led tosa_gpio_leds[] = {
 
 556                 .name                   = "tosa:amber:charge",
 
 557                 .default_trigger        = "main-battery-charging",
 
 558                 .gpio                   = TOSA_GPIO_CHRG_ERR_LED,
 
 561                 .name                   = "tosa:green:mail",
 
 562                 .default_trigger        = "nand-disk",
 
 563                 .gpio                   = TOSA_GPIO_NOTE_LED,
 
 566                 .name                   = "tosa:dual:wlan",
 
 567                 .default_trigger        = "none",
 
 568                 .gpio                   = TOSA_GPIO_WLAN_LED,
 
 571                 .name                   = "tosa:blue:bluetooth",
 
 572                 .default_trigger        = "tosa-bt",
 
 573                 .gpio                   = TOSA_GPIO_BT_LED,
 
 577 static struct gpio_led_platform_data tosa_gpio_leds_platform_data = {
 
 578         .leds           = tosa_gpio_leds,
 
 579         .num_leds       = ARRAY_SIZE(tosa_gpio_leds),
 
 582 static struct platform_device tosaled_device = {
 
 586                 .platform_data  = &tosa_gpio_leds_platform_data,
 
 591  * Toshiba Mobile IO Controller
 
 593 static struct resource tc6393xb_resources[] = {
 
 595                 .start  = TOSA_LCDC_PHYS,
 
 596                 .end    = TOSA_LCDC_PHYS + 0x3ffffff,
 
 597                 .flags  = IORESOURCE_MEM,
 
 601                 .start  = TOSA_IRQ_GPIO_TC6393XB_INT,
 
 602                 .end    = TOSA_IRQ_GPIO_TC6393XB_INT,
 
 603                 .flags  = IORESOURCE_IRQ,
 
 608 static int tosa_tc6393xb_enable(struct platform_device *dev)
 
 612         rc = gpio_request(TOSA_GPIO_TC6393XB_REST_IN, "tc6393xb #pclr");
 
 615         rc = gpio_request(TOSA_GPIO_TC6393XB_SUSPEND, "tc6393xb #suspend");
 
 617                 goto err_req_suspend;
 
 618         rc = gpio_request(TOSA_GPIO_TC6393XB_L3V_ON, "tc6393xb l3v");
 
 621         rc = gpio_direction_output(TOSA_GPIO_TC6393XB_L3V_ON, 0);
 
 624         rc = gpio_direction_output(TOSA_GPIO_TC6393XB_SUSPEND, 0);
 
 626                 goto err_dir_suspend;
 
 627         rc = gpio_direction_output(TOSA_GPIO_TC6393XB_REST_IN, 0);
 
 633         gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 1);
 
 637         gpio_set_value(TOSA_GPIO_TC6393XB_REST_IN, 1);
 
 638         gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 1);
 
 644         gpio_free(TOSA_GPIO_TC6393XB_L3V_ON);
 
 646         gpio_free(TOSA_GPIO_TC6393XB_SUSPEND);
 
 648         gpio_free(TOSA_GPIO_TC6393XB_REST_IN);
 
 653 static int tosa_tc6393xb_disable(struct platform_device *dev)
 
 655         gpio_free(TOSA_GPIO_TC6393XB_L3V_ON);
 
 656         gpio_free(TOSA_GPIO_TC6393XB_SUSPEND);
 
 657         gpio_free(TOSA_GPIO_TC6393XB_REST_IN);
 
 662 static int tosa_tc6393xb_resume(struct platform_device *dev)
 
 664         gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 1);
 
 666         gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 1);
 
 672 static int tosa_tc6393xb_suspend(struct platform_device *dev)
 
 674         gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 0);
 
 675         gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 0);
 
 679 static struct mtd_partition tosa_nand_partition[] = {
 
 683                 .size   = 7 * 1024 * 1024,
 
 687                 .offset = MTDPART_OFS_APPEND,
 
 688                 .size   = 28 * 1024 * 1024,
 
 692                 .offset = MTDPART_OFS_APPEND,
 
 693                 .size   = MTDPART_SIZ_FULL,
 
 697 static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
 
 699 static struct nand_bbt_descr tosa_tc6393xb_nand_bbt = {
 
 703         .pattern        = scan_ff_pattern
 
 706 static struct tmio_nand_data tosa_tc6393xb_nand_config = {
 
 707         .num_partitions = ARRAY_SIZE(tosa_nand_partition),
 
 708         .partition      = tosa_nand_partition,
 
 709         .badblock_pattern = &tosa_tc6393xb_nand_bbt,
 
 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_master pxa_ssp_master_info = {
 
 824 static struct spi_board_info spi_board_info[] __initdata = {
 
 826                 .modalias       = "tosa-lcd",
 
 828                 .max_speed_hz   = 28750,
 
 835 static struct mtd_partition sharpsl_rom_parts[] = {
 
 837                 .name   ="Boot PROM Filesystem",
 
 838                 .offset = 0x00160000,
 
 839                 .size   = MTDPART_SIZ_FULL,
 
 843 static struct physmap_flash_data sharpsl_rom_data = {
 
 845         .nr_parts       = ARRAY_SIZE(sharpsl_rom_parts),
 
 846         .parts          = sharpsl_rom_parts,
 
 849 static struct resource sharpsl_rom_resources[] = {
 
 853                 .flags  = IORESOURCE_MEM,
 
 857 static struct platform_device sharpsl_rom_device = {
 
 858         .name   = "physmap-flash",
 
 860         .resource = sharpsl_rom_resources,
 
 861         .num_resources = ARRAY_SIZE(sharpsl_rom_resources),
 
 862         .dev.platform_data = &sharpsl_rom_data,
 
 865 static struct platform_device *devices[] __initdata = {
 
 867         &tosascoop_jc_device,
 
 871         &tosa_gpio_keys_device,
 
 877 static void tosa_poweroff(void)
 
 879         arm_machine_restart('g');
 
 882 static void tosa_restart(char mode)
 
 884         /* Bootloader magic for a reboot */
 
 885         if((MSC0 & 0xffff0000) == 0x7ff00000)
 
 886                 MSC0 = (MSC0 & 0xffff) | 0x7ee00000;
 
 891 static void __init tosa_init(void)
 
 895         pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config));
 
 896         gpio_set_wake(MFP_PIN_GPIO1, 1);
 
 897         /* We can't pass to gpio-keys since it will drop the Reset altfunc */
 
 899         init_gpio_reset(TOSA_GPIO_ON_RESET, 0);
 
 901         pm_power_off = tosa_poweroff;
 
 902         arm_pm_restart = tosa_restart;
 
 906         /* enable batt_fault */
 
 909         dummy = gpiochip_reserve(TOSA_SCOOP_GPIO_BASE, 12);
 
 910         dummy = gpiochip_reserve(TOSA_SCOOP_JC_GPIO_BASE, 12);
 
 911         dummy = gpiochip_reserve(TOSA_TC6393XB_GPIO_BASE, 16);
 
 913         pxa_set_mci_info(&tosa_mci_platform_data);
 
 914         pxa_set_udc_info(&udc_info);
 
 915         pxa_set_ficp_info(&tosa_ficp_platform_data);
 
 916         pxa_set_i2c_info(NULL);
 
 917         platform_scoop_config = &tosa_pcmcia_config;
 
 919         pxa2xx_set_spi_info(2, &pxa_ssp_master_info);
 
 920         spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
 
 922         clk_add_alias("CLK_CK3P6MI", &tc6393xb_device.dev, "GPIO11_CLK", NULL);
 
 924         platform_add_devices(devices, ARRAY_SIZE(devices));
 
 927 static void __init fixup_tosa(struct machine_desc *desc,
 
 928                 struct tag *tags, char **cmdline, struct meminfo *mi)
 
 930         sharpsl_save_param();
 
 932         mi->bank[0].start = 0xa0000000;
 
 933         mi->bank[0].node = 0;
 
 934         mi->bank[0].size = (64*1024*1024);
 
 937 MACHINE_START(TOSA, "SHARP Tosa")
 
 938         .phys_io        = 0x40000000,
 
 939         .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
 
 941         .map_io         = pxa_map_io,
 
 942         .init_irq       = pxa25x_init_irq,
 
 943         .init_machine   = tosa_init,