Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Hardware definitions for the Toshiba eseries PDAs
0004  *
0005  * Copyright (c) 2003 Ian Molton <spyro@f2s.com>
0006  */
0007 
0008 #include <linux/clkdev.h>
0009 #include <linux/kernel.h>
0010 #include <linux/init.h>
0011 #include <linux/clk-provider.h>
0012 #include <linux/gpio/machine.h>
0013 #include <linux/gpio.h>
0014 #include <linux/delay.h>
0015 #include <linux/platform_device.h>
0016 #include <linux/mfd/tc6387xb.h>
0017 #include <linux/mfd/tc6393xb.h>
0018 #include <linux/mfd/t7l66xb.h>
0019 #include <linux/mtd/rawnand.h>
0020 #include <linux/mtd/partitions.h>
0021 #include <linux/memblock.h>
0022 #include <linux/gpio/machine.h>
0023 
0024 #include <video/w100fb.h>
0025 
0026 #include <asm/setup.h>
0027 #include <asm/mach/arch.h>
0028 #include <asm/mach-types.h>
0029 
0030 #include "pxa25x.h"
0031 #include "eseries-gpio.h"
0032 #include "eseries-irq.h"
0033 #include <linux/platform_data/asoc-pxa.h>
0034 #include <linux/platform_data/video-pxafb.h>
0035 #include "udc.h"
0036 #include <linux/platform_data/irda-pxaficp.h>
0037 
0038 #include "devices.h"
0039 #include "generic.h"
0040 
0041 /* Only e800 has 128MB RAM */
0042 void __init eseries_fixup(struct tag *tags, char **cmdline)
0043 {
0044     if (machine_is_e800())
0045         memblock_add(0xa0000000, SZ_128M);
0046     else
0047         memblock_add(0xa0000000, SZ_64M);
0048 }
0049 
0050 static struct gpiod_lookup_table e7xx_gpio_vbus_gpiod_table __maybe_unused = {
0051     .dev_id = "gpio-vbus",
0052     .table = {
0053         GPIO_LOOKUP("gpio-pxa", GPIO_E7XX_USB_DISC,
0054                 "vbus", GPIO_ACTIVE_HIGH),
0055         GPIO_LOOKUP("gpio-pxa", GPIO_E7XX_USB_PULLUP,
0056                 "pullup", GPIO_ACTIVE_LOW),
0057         { },
0058     },
0059 };
0060 
0061 static struct platform_device e7xx_gpio_vbus __maybe_unused = {
0062     .name   = "gpio-vbus",
0063     .id = -1,
0064 };
0065 
0066 struct pxaficp_platform_data e7xx_ficp_platform_data = {
0067     .gpio_pwdown        = GPIO_E7XX_IR_OFF,
0068     .transceiver_cap    = IR_SIRMODE | IR_OFF,
0069 };
0070 
0071 int eseries_tmio_enable(struct platform_device *dev)
0072 {
0073     /* Reset - bring SUSPEND high before PCLR */
0074     gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
0075     gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
0076     msleep(1);
0077     gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
0078     msleep(1);
0079     gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 1);
0080     msleep(1);
0081     return 0;
0082 }
0083 
0084 void eseries_tmio_disable(struct platform_device *dev)
0085 {
0086     gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
0087     gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
0088 }
0089 
0090 int eseries_tmio_suspend(struct platform_device *dev)
0091 {
0092     gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
0093     return 0;
0094 }
0095 
0096 int eseries_tmio_resume(struct platform_device *dev)
0097 {
0098     gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
0099     msleep(1);
0100     return 0;
0101 }
0102 
0103 void eseries_get_tmio_gpios(void)
0104 {
0105     gpio_request(GPIO_ESERIES_TMIO_SUSPEND, NULL);
0106     gpio_request(GPIO_ESERIES_TMIO_PCLR, NULL);
0107     gpio_direction_output(GPIO_ESERIES_TMIO_SUSPEND, 0);
0108     gpio_direction_output(GPIO_ESERIES_TMIO_PCLR, 0);
0109 }
0110 
0111 /* TMIO controller uses the same resources on all e-series machines. */
0112 struct resource eseries_tmio_resources[] = {
0113     [0] = {
0114         .start  = PXA_CS4_PHYS,
0115         .end    = PXA_CS4_PHYS + 0x1fffff,
0116         .flags  = IORESOURCE_MEM,
0117     },
0118     [1] = {
0119         .start  = PXA_GPIO_TO_IRQ(GPIO_ESERIES_TMIO_IRQ),
0120         .end    = PXA_GPIO_TO_IRQ(GPIO_ESERIES_TMIO_IRQ),
0121         .flags  = IORESOURCE_IRQ,
0122     },
0123 };
0124 
0125 /* Some e-series hardware cannot control the 32K clock */
0126 static void __init __maybe_unused eseries_register_clks(void)
0127 {
0128     clk_register_fixed_rate(NULL, "CLK_CK32K", NULL, 0, 32768);
0129 }
0130 
0131 #ifdef CONFIG_MACH_E330
0132 /* -------------------- e330 tc6387xb parameters -------------------- */
0133 
0134 static struct tc6387xb_platform_data e330_tc6387xb_info = {
0135     .enable   = &eseries_tmio_enable,
0136     .suspend  = &eseries_tmio_suspend,
0137     .resume   = &eseries_tmio_resume,
0138 };
0139 
0140 static struct platform_device e330_tc6387xb_device = {
0141     .name           = "tc6387xb",
0142     .id             = -1,
0143     .dev            = {
0144         .platform_data = &e330_tc6387xb_info,
0145     },
0146     .num_resources = 2,
0147     .resource      = eseries_tmio_resources,
0148 };
0149 
0150 /* --------------------------------------------------------------- */
0151 
0152 static struct platform_device *e330_devices[] __initdata = {
0153     &e330_tc6387xb_device,
0154     &e7xx_gpio_vbus,
0155 };
0156 
0157 static void __init e330_init(void)
0158 {
0159     pxa_set_ffuart_info(NULL);
0160     pxa_set_btuart_info(NULL);
0161     pxa_set_stuart_info(NULL);
0162     eseries_register_clks();
0163     eseries_get_tmio_gpios();
0164     gpiod_add_lookup_table(&e7xx_gpio_vbus_gpiod_table);
0165     platform_add_devices(ARRAY_AND_SIZE(e330_devices));
0166 }
0167 
0168 MACHINE_START(E330, "Toshiba e330")
0169     /* Maintainer: Ian Molton (spyro@f2s.com) */
0170     .atag_offset    = 0x100,
0171     .map_io     = pxa25x_map_io,
0172     .nr_irqs    = ESERIES_NR_IRQS,
0173     .init_irq   = pxa25x_init_irq,
0174     .handle_irq = pxa25x_handle_irq,
0175     .fixup      = eseries_fixup,
0176     .init_machine   = e330_init,
0177     .init_time  = pxa_timer_init,
0178     .restart    = pxa_restart,
0179 MACHINE_END
0180 #endif
0181 
0182 #ifdef CONFIG_MACH_E350
0183 /* -------------------- e350 t7l66xb parameters -------------------- */
0184 
0185 static struct t7l66xb_platform_data e350_t7l66xb_info = {
0186     .irq_base               = IRQ_BOARD_START,
0187     .enable                 = &eseries_tmio_enable,
0188     .suspend                = &eseries_tmio_suspend,
0189     .resume                 = &eseries_tmio_resume,
0190 };
0191 
0192 static struct platform_device e350_t7l66xb_device = {
0193     .name           = "t7l66xb",
0194     .id             = -1,
0195     .dev            = {
0196         .platform_data = &e350_t7l66xb_info,
0197     },
0198     .num_resources = 2,
0199     .resource      = eseries_tmio_resources,
0200 };
0201 
0202 /* ---------------------------------------------------------- */
0203 
0204 static struct platform_device *e350_devices[] __initdata = {
0205     &e350_t7l66xb_device,
0206     &e7xx_gpio_vbus,
0207 };
0208 
0209 static void __init e350_init(void)
0210 {
0211     pxa_set_ffuart_info(NULL);
0212     pxa_set_btuart_info(NULL);
0213     pxa_set_stuart_info(NULL);
0214     eseries_register_clks();
0215     eseries_get_tmio_gpios();
0216     gpiod_add_lookup_table(&e7xx_gpio_vbus_gpiod_table);
0217     platform_add_devices(ARRAY_AND_SIZE(e350_devices));
0218 }
0219 
0220 MACHINE_START(E350, "Toshiba e350")
0221     /* Maintainer: Ian Molton (spyro@f2s.com) */
0222     .atag_offset    = 0x100,
0223     .map_io     = pxa25x_map_io,
0224     .nr_irqs    = ESERIES_NR_IRQS,
0225     .init_irq   = pxa25x_init_irq,
0226     .handle_irq = pxa25x_handle_irq,
0227     .fixup      = eseries_fixup,
0228     .init_machine   = e350_init,
0229     .init_time  = pxa_timer_init,
0230     .restart    = pxa_restart,
0231 MACHINE_END
0232 #endif
0233 
0234 #ifdef CONFIG_MACH_E400
0235 /* ------------------------ E400 LCD definitions ------------------------ */
0236 
0237 static struct pxafb_mode_info e400_pxafb_mode_info = {
0238     .pixclock       = 140703,
0239     .xres           = 240,
0240     .yres           = 320,
0241     .bpp            = 16,
0242     .hsync_len      = 4,
0243     .left_margin    = 28,
0244     .right_margin   = 8,
0245     .vsync_len      = 3,
0246     .upper_margin   = 5,
0247     .lower_margin   = 6,
0248     .sync           = 0,
0249 };
0250 
0251 static struct pxafb_mach_info e400_pxafb_mach_info = {
0252     .modes          = &e400_pxafb_mode_info,
0253     .num_modes      = 1,
0254     .lcd_conn   = LCD_COLOR_TFT_16BPP,
0255     .lccr3          = 0,
0256     .pxafb_backlight_power  = NULL,
0257 };
0258 
0259 /* ------------------------ E400 MFP config ----------------------------- */
0260 
0261 static unsigned long e400_pin_config[] __initdata = {
0262     /* Chip selects */
0263     GPIO15_nCS_1,   /* CS1 - Flash */
0264     GPIO80_nCS_4,   /* CS4 - TMIO */
0265 
0266     /* Clocks */
0267     GPIO12_32KHz,
0268 
0269     /* BTUART */
0270     GPIO42_BTUART_RXD,
0271     GPIO43_BTUART_TXD,
0272     GPIO44_BTUART_CTS,
0273 
0274     /* TMIO controller */
0275     GPIO19_GPIO, /* t7l66xb #PCLR */
0276     GPIO45_GPIO, /* t7l66xb #SUSPEND (NOT BTUART!) */
0277 
0278     /* wakeup */
0279     GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
0280 };
0281 
0282 /* ---------------------------------------------------------------------- */
0283 
0284 static struct mtd_partition partition_a = {
0285     .name = "Internal NAND flash",
0286     .offset =  0,
0287     .size =  MTDPART_SIZ_FULL,
0288 };
0289 
0290 static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
0291 
0292 static struct nand_bbt_descr e400_t7l66xb_nand_bbt = {
0293     .options = 0,
0294     .offs = 4,
0295     .len = 2,
0296     .pattern = scan_ff_pattern
0297 };
0298 
0299 static struct tmio_nand_data e400_t7l66xb_nand_config = {
0300     .num_partitions = 1,
0301     .partition = &partition_a,
0302     .badblock_pattern = &e400_t7l66xb_nand_bbt,
0303 };
0304 
0305 static struct t7l66xb_platform_data e400_t7l66xb_info = {
0306     .irq_base       = IRQ_BOARD_START,
0307     .enable                 = &eseries_tmio_enable,
0308     .suspend                = &eseries_tmio_suspend,
0309     .resume                 = &eseries_tmio_resume,
0310 
0311     .nand_data              = &e400_t7l66xb_nand_config,
0312 };
0313 
0314 static struct platform_device e400_t7l66xb_device = {
0315     .name           = "t7l66xb",
0316     .id             = -1,
0317     .dev            = {
0318         .platform_data = &e400_t7l66xb_info,
0319     },
0320     .num_resources = 2,
0321     .resource      = eseries_tmio_resources,
0322 };
0323 
0324 /* ---------------------------------------------------------- */
0325 
0326 static struct platform_device *e400_devices[] __initdata = {
0327     &e400_t7l66xb_device,
0328     &e7xx_gpio_vbus,
0329 };
0330 
0331 static void __init e400_init(void)
0332 {
0333     pxa2xx_mfp_config(ARRAY_AND_SIZE(e400_pin_config));
0334     pxa_set_ffuart_info(NULL);
0335     pxa_set_btuart_info(NULL);
0336     pxa_set_stuart_info(NULL);
0337     /* Fixme - e400 may have a switched clock */
0338     eseries_register_clks();
0339     eseries_get_tmio_gpios();
0340     pxa_set_fb_info(NULL, &e400_pxafb_mach_info);
0341     gpiod_add_lookup_table(&e7xx_gpio_vbus_gpiod_table);
0342     platform_add_devices(ARRAY_AND_SIZE(e400_devices));
0343 }
0344 
0345 MACHINE_START(E400, "Toshiba e400")
0346     /* Maintainer: Ian Molton (spyro@f2s.com) */
0347     .atag_offset    = 0x100,
0348     .map_io     = pxa25x_map_io,
0349     .nr_irqs    = ESERIES_NR_IRQS,
0350     .init_irq   = pxa25x_init_irq,
0351     .handle_irq = pxa25x_handle_irq,
0352     .fixup      = eseries_fixup,
0353     .init_machine   = e400_init,
0354     .init_time  = pxa_timer_init,
0355     .restart    = pxa_restart,
0356 MACHINE_END
0357 #endif
0358 
0359 #ifdef CONFIG_MACH_E740
0360 /* ------------------------ e740 video support --------------------------- */
0361 
0362 static struct w100_gen_regs e740_lcd_regs = {
0363     .lcd_format =            0x00008023,
0364     .lcdd_cntl1 =            0x0f000000,
0365     .lcdd_cntl2 =            0x0003ffff,
0366     .genlcd_cntl1 =          0x00ffff03,
0367     .genlcd_cntl2 =          0x003c0f03,
0368     .genlcd_cntl3 =          0x000143aa,
0369 };
0370 
0371 static struct w100_mode e740_lcd_mode = {
0372     .xres            = 240,
0373     .yres            = 320,
0374     .left_margin     = 20,
0375     .right_margin    = 28,
0376     .upper_margin    = 9,
0377     .lower_margin    = 8,
0378     .crtc_ss         = 0x80140013,
0379     .crtc_ls         = 0x81150110,
0380     .crtc_gs         = 0x80050005,
0381     .crtc_vpos_gs    = 0x000a0009,
0382     .crtc_rev        = 0x0040010a,
0383     .crtc_dclk       = 0xa906000a,
0384     .crtc_gclk       = 0x80050108,
0385     .crtc_goe        = 0x80050108,
0386     .pll_freq        = 57,
0387     .pixclk_divider         = 4,
0388     .pixclk_divider_rotated = 4,
0389     .pixclk_src     = CLK_SRC_XTAL,
0390     .sysclk_divider  = 1,
0391     .sysclk_src     = CLK_SRC_PLL,
0392     .crtc_ps1_active =       0x41060010,
0393 };
0394 
0395 static struct w100_gpio_regs e740_w100_gpio_info = {
0396     .init_data1 = 0x21002103,
0397     .gpio_dir1  = 0xffffdeff,
0398     .gpio_oe1   = 0x03c00643,
0399     .init_data2 = 0x003f003f,
0400     .gpio_dir2  = 0xffffffff,
0401     .gpio_oe2   = 0x000000ff,
0402 };
0403 
0404 static struct w100fb_mach_info e740_fb_info = {
0405     .modelist   = &e740_lcd_mode,
0406     .num_modes  = 1,
0407     .regs       = &e740_lcd_regs,
0408     .gpio       = &e740_w100_gpio_info,
0409     .xtal_freq = 14318000,
0410     .xtal_dbl   = 1,
0411 };
0412 
0413 static struct resource e740_fb_resources[] = {
0414     [0] = {
0415         .start          = 0x0c000000,
0416         .end            = 0x0cffffff,
0417         .flags          = IORESOURCE_MEM,
0418     },
0419 };
0420 
0421 static struct platform_device e740_fb_device = {
0422     .name           = "w100fb",
0423     .id             = -1,
0424     .dev            = {
0425         .platform_data  = &e740_fb_info,
0426     },
0427     .num_resources  = ARRAY_SIZE(e740_fb_resources),
0428     .resource       = e740_fb_resources,
0429 };
0430 
0431 /* --------------------------- MFP Pin config -------------------------- */
0432 
0433 static unsigned long e740_pin_config[] __initdata = {
0434     /* Chip selects */
0435     GPIO15_nCS_1,   /* CS1 - Flash */
0436     GPIO79_nCS_3,   /* CS3 - IMAGEON */
0437     GPIO80_nCS_4,   /* CS4 - TMIO */
0438 
0439     /* Clocks */
0440     GPIO12_32KHz,
0441 
0442     /* BTUART */
0443     GPIO42_BTUART_RXD,
0444     GPIO43_BTUART_TXD,
0445     GPIO44_BTUART_CTS,
0446 
0447     /* TMIO controller */
0448     GPIO19_GPIO, /* t7l66xb #PCLR */
0449     GPIO45_GPIO, /* t7l66xb #SUSPEND (NOT BTUART!) */
0450 
0451     /* UDC */
0452     GPIO13_GPIO,
0453     GPIO3_GPIO,
0454 
0455     /* IrDA */
0456     GPIO38_GPIO | MFP_LPM_DRIVE_HIGH,
0457 
0458     /* AC97 */
0459     GPIO28_AC97_BITCLK,
0460     GPIO29_AC97_SDATA_IN_0,
0461     GPIO30_AC97_SDATA_OUT,
0462     GPIO31_AC97_SYNC,
0463 
0464     /* Audio power control */
0465     GPIO16_GPIO,  /* AC97 codec AVDD2 supply (analogue power) */
0466     GPIO40_GPIO,  /* Mic amp power */
0467     GPIO41_GPIO,  /* Headphone amp power */
0468 
0469     /* PC Card */
0470     GPIO8_GPIO,   /* CD0 */
0471     GPIO44_GPIO,  /* CD1 */
0472     GPIO11_GPIO,  /* IRQ0 */
0473     GPIO6_GPIO,   /* IRQ1 */
0474     GPIO27_GPIO,  /* RST0 */
0475     GPIO24_GPIO,  /* RST1 */
0476     GPIO20_GPIO,  /* PWR0 */
0477     GPIO23_GPIO,  /* PWR1 */
0478     GPIO48_nPOE,
0479     GPIO49_nPWE,
0480     GPIO50_nPIOR,
0481     GPIO51_nPIOW,
0482     GPIO52_nPCE_1,
0483     GPIO53_nPCE_2,
0484     GPIO54_nPSKTSEL,
0485     GPIO55_nPREG,
0486     GPIO56_nPWAIT,
0487     GPIO57_nIOIS16,
0488 
0489     /* wakeup */
0490     GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
0491 };
0492 
0493 /* -------------------- e740 t7l66xb parameters -------------------- */
0494 
0495 static struct t7l66xb_platform_data e740_t7l66xb_info = {
0496     .irq_base       = IRQ_BOARD_START,
0497     .enable                 = &eseries_tmio_enable,
0498     .suspend                = &eseries_tmio_suspend,
0499     .resume                 = &eseries_tmio_resume,
0500 };
0501 
0502 static struct platform_device e740_t7l66xb_device = {
0503     .name           = "t7l66xb",
0504     .id             = -1,
0505     .dev            = {
0506         .platform_data = &e740_t7l66xb_info,
0507     },
0508     .num_resources = 2,
0509     .resource      = eseries_tmio_resources,
0510 };
0511 
0512 static struct platform_device e740_audio_device = {
0513     .name       = "e740-audio",
0514     .id     = -1,
0515 };
0516 
0517 static struct gpiod_lookup_table e740_audio_gpio_table = {
0518     .dev_id = "e740-audio",
0519     .table = {
0520         GPIO_LOOKUP("gpio-pxa",  GPIO_E740_WM9705_nAVDD2, "Audio power",  GPIO_ACTIVE_HIGH),
0521         GPIO_LOOKUP("gpio-pxa",  GPIO_E740_AMP_ON, "Output amp",  GPIO_ACTIVE_HIGH),
0522         GPIO_LOOKUP("gpio-pxa",  GPIO_E740_MIC_ON, "Mic amp", GPIO_ACTIVE_HIGH),
0523         { },
0524     },
0525 };
0526 
0527 /* ----------------------------------------------------------------------- */
0528 
0529 static struct platform_device *e740_devices[] __initdata = {
0530     &e740_fb_device,
0531     &e740_t7l66xb_device,
0532     &e7xx_gpio_vbus,
0533     &e740_audio_device,
0534 };
0535 
0536 static void __init e740_init(void)
0537 {
0538     pxa2xx_mfp_config(ARRAY_AND_SIZE(e740_pin_config));
0539     pxa_set_ffuart_info(NULL);
0540     pxa_set_btuart_info(NULL);
0541     pxa_set_stuart_info(NULL);
0542     eseries_register_clks();
0543     clk_add_alias("CLK_CK48M", e740_t7l66xb_device.name,
0544             "UDCCLK", &pxa25x_device_udc.dev),
0545     eseries_get_tmio_gpios();
0546     gpiod_add_lookup_table(&e7xx_gpio_vbus_gpiod_table);
0547     gpiod_add_lookup_table(&e740_audio_gpio_table);
0548     platform_add_devices(ARRAY_AND_SIZE(e740_devices));
0549     pxa_set_ac97_info(NULL);
0550     pxa_set_ficp_info(&e7xx_ficp_platform_data);
0551 }
0552 
0553 MACHINE_START(E740, "Toshiba e740")
0554     /* Maintainer: Ian Molton (spyro@f2s.com) */
0555     .atag_offset    = 0x100,
0556     .map_io     = pxa25x_map_io,
0557     .nr_irqs    = ESERIES_NR_IRQS,
0558     .init_irq   = pxa25x_init_irq,
0559     .handle_irq = pxa25x_handle_irq,
0560     .fixup      = eseries_fixup,
0561     .init_machine   = e740_init,
0562     .init_time  = pxa_timer_init,
0563     .restart    = pxa_restart,
0564 MACHINE_END
0565 #endif
0566 
0567 #ifdef CONFIG_MACH_E750
0568 /* ---------------------- E750 LCD definitions -------------------- */
0569 
0570 static struct w100_gen_regs e750_lcd_regs = {
0571     .lcd_format =            0x00008003,
0572     .lcdd_cntl1 =            0x00000000,
0573     .lcdd_cntl2 =            0x0003ffff,
0574     .genlcd_cntl1 =          0x00fff003,
0575     .genlcd_cntl2 =          0x003c0f03,
0576     .genlcd_cntl3 =          0x000143aa,
0577 };
0578 
0579 static struct w100_mode e750_lcd_mode = {
0580     .xres            = 240,
0581     .yres            = 320,
0582     .left_margin     = 21,
0583     .right_margin    = 22,
0584     .upper_margin    = 5,
0585     .lower_margin    = 4,
0586     .crtc_ss         = 0x80150014,
0587     .crtc_ls         = 0x8014000d,
0588     .crtc_gs         = 0xc1000005,
0589     .crtc_vpos_gs    = 0x00020147,
0590     .crtc_rev        = 0x0040010a,
0591     .crtc_dclk       = 0xa1700030,
0592     .crtc_gclk       = 0x80cc0015,
0593     .crtc_goe        = 0x80cc0015,
0594     .crtc_ps1_active = 0x61060017,
0595     .pll_freq        = 57,
0596     .pixclk_divider         = 4,
0597     .pixclk_divider_rotated = 4,
0598     .pixclk_src     = CLK_SRC_XTAL,
0599     .sysclk_divider  = 1,
0600     .sysclk_src     = CLK_SRC_PLL,
0601 };
0602 
0603 static struct w100_gpio_regs e750_w100_gpio_info = {
0604     .init_data1 = 0x01192f1b,
0605     .gpio_dir1  = 0xd5ffdeff,
0606     .gpio_oe1   = 0x000020bf,
0607     .init_data2 = 0x010f010f,
0608     .gpio_dir2  = 0xffffffff,
0609     .gpio_oe2   = 0x000001cf,
0610 };
0611 
0612 static struct w100fb_mach_info e750_fb_info = {
0613     .modelist   = &e750_lcd_mode,
0614     .num_modes  = 1,
0615     .regs       = &e750_lcd_regs,
0616     .gpio       = &e750_w100_gpio_info,
0617     .xtal_freq  = 14318000,
0618     .xtal_dbl   = 1,
0619 };
0620 
0621 static struct resource e750_fb_resources[] = {
0622     [0] = {
0623         .start          = 0x0c000000,
0624         .end            = 0x0cffffff,
0625         .flags          = IORESOURCE_MEM,
0626     },
0627 };
0628 
0629 static struct platform_device e750_fb_device = {
0630     .name           = "w100fb",
0631     .id             = -1,
0632     .dev            = {
0633         .platform_data  = &e750_fb_info,
0634     },
0635     .num_resources  = ARRAY_SIZE(e750_fb_resources),
0636     .resource       = e750_fb_resources,
0637 };
0638 
0639 /* -------------------- e750 MFP parameters -------------------- */
0640 
0641 static unsigned long e750_pin_config[] __initdata = {
0642     /* Chip selects */
0643     GPIO15_nCS_1,   /* CS1 - Flash */
0644     GPIO79_nCS_3,   /* CS3 - IMAGEON */
0645     GPIO80_nCS_4,   /* CS4 - TMIO */
0646 
0647     /* Clocks */
0648     GPIO11_3_6MHz,
0649 
0650     /* BTUART */
0651     GPIO42_BTUART_RXD,
0652     GPIO43_BTUART_TXD,
0653     GPIO44_BTUART_CTS,
0654 
0655     /* TMIO controller */
0656     GPIO19_GPIO, /* t7l66xb #PCLR */
0657     GPIO45_GPIO, /* t7l66xb #SUSPEND (NOT BTUART!) */
0658 
0659     /* UDC */
0660     GPIO13_GPIO,
0661     GPIO3_GPIO,
0662 
0663     /* IrDA */
0664     GPIO38_GPIO | MFP_LPM_DRIVE_HIGH,
0665 
0666     /* AC97 */
0667     GPIO28_AC97_BITCLK,
0668     GPIO29_AC97_SDATA_IN_0,
0669     GPIO30_AC97_SDATA_OUT,
0670     GPIO31_AC97_SYNC,
0671 
0672     /* Audio power control */
0673     GPIO4_GPIO,  /* Headphone amp power */
0674     GPIO7_GPIO,  /* Speaker amp power */
0675     GPIO37_GPIO, /* Headphone detect */
0676 
0677     /* PC Card */
0678     GPIO8_GPIO,   /* CD0 */
0679     GPIO44_GPIO,  /* CD1 */
0680     /* GPIO11_GPIO,  IRQ0 */
0681     GPIO6_GPIO,   /* IRQ1 */
0682     GPIO27_GPIO,  /* RST0 */
0683     GPIO24_GPIO,  /* RST1 */
0684     GPIO20_GPIO,  /* PWR0 */
0685     GPIO23_GPIO,  /* PWR1 */
0686     GPIO48_nPOE,
0687     GPIO49_nPWE,
0688     GPIO50_nPIOR,
0689     GPIO51_nPIOW,
0690     GPIO52_nPCE_1,
0691     GPIO53_nPCE_2,
0692     GPIO54_nPSKTSEL,
0693     GPIO55_nPREG,
0694     GPIO56_nPWAIT,
0695     GPIO57_nIOIS16,
0696 
0697     /* wakeup */
0698     GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
0699 };
0700 
0701 /* ----------------- e750 tc6393xb parameters ------------------ */
0702 
0703 static struct tc6393xb_platform_data e750_tc6393xb_info = {
0704     .irq_base       = IRQ_BOARD_START,
0705     .scr_pll2cr     = 0x0cc1,
0706     .scr_gper       = 0,
0707     .suspend        = &eseries_tmio_suspend,
0708     .resume         = &eseries_tmio_resume,
0709     .enable         = &eseries_tmio_enable,
0710     .disable        = &eseries_tmio_disable,
0711 };
0712 
0713 static struct platform_device e750_tc6393xb_device = {
0714     .name           = "tc6393xb",
0715     .id             = -1,
0716     .dev            = {
0717         .platform_data = &e750_tc6393xb_info,
0718     },
0719     .num_resources = 2,
0720     .resource      = eseries_tmio_resources,
0721 };
0722 
0723 static struct gpiod_lookup_table e750_audio_gpio_table = {
0724     .dev_id = "e750-audio",
0725     .table = {
0726         GPIO_LOOKUP("gpio-pxa",  GPIO_E750_HP_AMP_OFF, "Output amp",  GPIO_ACTIVE_LOW),
0727         GPIO_LOOKUP("gpio-pxa",  GPIO_E750_SPK_AMP_OFF, "Mic amp", GPIO_ACTIVE_LOW),
0728         { },
0729     },
0730 };
0731 
0732 static struct platform_device e750_audio_device = {
0733     .name       = "e750-audio",
0734     .id     = -1,
0735 };
0736 
0737 /* ------------------------------------------------------------- */
0738 
0739 static struct platform_device *e750_devices[] __initdata = {
0740     &e750_fb_device,
0741     &e750_tc6393xb_device,
0742     &e7xx_gpio_vbus,
0743     &e750_audio_device,
0744 };
0745 
0746 static void __init e750_init(void)
0747 {
0748     pxa2xx_mfp_config(ARRAY_AND_SIZE(e750_pin_config));
0749     pxa_set_ffuart_info(NULL);
0750     pxa_set_btuart_info(NULL);
0751     pxa_set_stuart_info(NULL);
0752     clk_add_alias("CLK_CK3P6MI", e750_tc6393xb_device.name,
0753             "GPIO11_CLK", NULL),
0754     eseries_get_tmio_gpios();
0755     gpiod_add_lookup_table(&e7xx_gpio_vbus_gpiod_table);
0756     gpiod_add_lookup_table(&e750_audio_gpio_table);
0757     platform_add_devices(ARRAY_AND_SIZE(e750_devices));
0758     pxa_set_ac97_info(NULL);
0759     pxa_set_ficp_info(&e7xx_ficp_platform_data);
0760 }
0761 
0762 MACHINE_START(E750, "Toshiba e750")
0763     /* Maintainer: Ian Molton (spyro@f2s.com) */
0764     .atag_offset    = 0x100,
0765     .map_io     = pxa25x_map_io,
0766     .nr_irqs    = ESERIES_NR_IRQS,
0767     .init_irq   = pxa25x_init_irq,
0768     .handle_irq = pxa25x_handle_irq,
0769     .fixup      = eseries_fixup,
0770     .init_machine   = e750_init,
0771     .init_time  = pxa_timer_init,
0772     .restart    = pxa_restart,
0773 MACHINE_END
0774 #endif
0775 
0776 #ifdef CONFIG_MACH_E800
0777 /* ------------------------ e800 LCD definitions ------------------------- */
0778 
0779 static unsigned long e800_pin_config[] __initdata = {
0780     /* AC97 */
0781     GPIO28_AC97_BITCLK,
0782     GPIO29_AC97_SDATA_IN_0,
0783     GPIO30_AC97_SDATA_OUT,
0784     GPIO31_AC97_SYNC,
0785 
0786     /* tc6393xb */
0787     GPIO11_3_6MHz,
0788 };
0789 
0790 static struct w100_gen_regs e800_lcd_regs = {
0791     .lcd_format =            0x00008003,
0792     .lcdd_cntl1 =            0x02a00000,
0793     .lcdd_cntl2 =            0x0003ffff,
0794     .genlcd_cntl1 =          0x000ff2a3,
0795     .genlcd_cntl2 =          0x000002a3,
0796     .genlcd_cntl3 =          0x000102aa,
0797 };
0798 
0799 static struct w100_mode e800_lcd_mode[2] = {
0800     [0] = {
0801         .xres            = 480,
0802         .yres            = 640,
0803         .left_margin     = 52,
0804         .right_margin    = 148,
0805         .upper_margin    = 2,
0806         .lower_margin    = 6,
0807         .crtc_ss         = 0x80350034,
0808         .crtc_ls         = 0x802b0026,
0809         .crtc_gs         = 0x80160016,
0810         .crtc_vpos_gs    = 0x00020003,
0811         .crtc_rev        = 0x0040001d,
0812         .crtc_dclk       = 0xe0000000,
0813         .crtc_gclk       = 0x82a50049,
0814         .crtc_goe        = 0x80ee001c,
0815         .crtc_ps1_active = 0x00000000,
0816         .pll_freq        = 128,
0817         .pixclk_divider         = 4,
0818         .pixclk_divider_rotated = 6,
0819         .pixclk_src     = CLK_SRC_PLL,
0820         .sysclk_divider  = 0,
0821         .sysclk_src     = CLK_SRC_PLL,
0822     },
0823     [1] = {
0824         .xres            = 240,
0825         .yres            = 320,
0826         .left_margin     = 15,
0827         .right_margin    = 88,
0828         .upper_margin    = 0,
0829         .lower_margin    = 7,
0830         .crtc_ss         = 0xd010000f,
0831         .crtc_ls         = 0x80070003,
0832         .crtc_gs         = 0x80000000,
0833         .crtc_vpos_gs    = 0x01460147,
0834         .crtc_rev        = 0x00400003,
0835         .crtc_dclk       = 0xa1700030,
0836         .crtc_gclk       = 0x814b0008,
0837         .crtc_goe        = 0x80cc0015,
0838         .crtc_ps1_active = 0x00000000,
0839         .pll_freq        = 100,
0840         .pixclk_divider         = 6, /* Wince uses 14 which gives a */
0841         .pixclk_divider_rotated = 6, /* 7MHz Pclk. We use a 14MHz one */
0842         .pixclk_src     = CLK_SRC_PLL,
0843         .sysclk_divider  = 0,
0844         .sysclk_src     = CLK_SRC_PLL,
0845     }
0846 };
0847 
0848 
0849 static struct w100_gpio_regs e800_w100_gpio_info = {
0850     .init_data1 = 0xc13fc019,
0851     .gpio_dir1  = 0x3e40df7f,
0852     .gpio_oe1   = 0x003c3000,
0853     .init_data2 = 0x00000000,
0854     .gpio_dir2  = 0x00000000,
0855     .gpio_oe2   = 0x00000000,
0856 };
0857 
0858 static struct w100_mem_info e800_w100_mem_info = {
0859     .ext_cntl        = 0x09640011,
0860     .sdram_mode_reg  = 0x00600021,
0861     .ext_timing_cntl = 0x10001545,
0862     .io_cntl         = 0x7ddd7333,
0863     .size            = 0x1fffff,
0864 };
0865 
0866 static void e800_tg_change(struct w100fb_par *par)
0867 {
0868     unsigned long tmp;
0869 
0870     tmp = w100fb_gpio_read(W100_GPIO_PORT_A);
0871     if (par->mode->xres == 480)
0872         tmp |= 0x100;
0873     else
0874         tmp &= ~0x100;
0875     w100fb_gpio_write(W100_GPIO_PORT_A, tmp);
0876 }
0877 
0878 static struct w100_tg_info e800_tg_info = {
0879     .change = e800_tg_change,
0880 };
0881 
0882 static struct w100fb_mach_info e800_fb_info = {
0883     .modelist   = e800_lcd_mode,
0884     .num_modes  = 2,
0885     .regs       = &e800_lcd_regs,
0886     .gpio       = &e800_w100_gpio_info,
0887     .mem        = &e800_w100_mem_info,
0888     .tg         = &e800_tg_info,
0889     .xtal_freq  = 16000000,
0890 };
0891 
0892 static struct resource e800_fb_resources[] = {
0893     [0] = {
0894         .start          = 0x0c000000,
0895         .end            = 0x0cffffff,
0896         .flags          = IORESOURCE_MEM,
0897     },
0898 };
0899 
0900 static struct platform_device e800_fb_device = {
0901     .name           = "w100fb",
0902     .id             = -1,
0903     .dev            = {
0904         .platform_data  = &e800_fb_info,
0905     },
0906     .num_resources  = ARRAY_SIZE(e800_fb_resources),
0907     .resource       = e800_fb_resources,
0908 };
0909 
0910 /* --------------------------- UDC definitions --------------------------- */
0911 
0912 static struct gpiod_lookup_table e800_gpio_vbus_gpiod_table = {
0913     .dev_id = "gpio-vbus",
0914     .table = {
0915         GPIO_LOOKUP("gpio-pxa", GPIO_E800_USB_DISC,
0916                 "vbus", GPIO_ACTIVE_HIGH),
0917         GPIO_LOOKUP("gpio-pxa", GPIO_E800_USB_PULLUP,
0918                 "pullup", GPIO_ACTIVE_LOW),
0919         { },
0920     },
0921 };
0922 
0923 static struct platform_device e800_gpio_vbus = {
0924     .name   = "gpio-vbus",
0925     .id = -1,
0926 };
0927 
0928 
0929 /* ----------------- e800 tc6393xb parameters ------------------ */
0930 
0931 static struct tc6393xb_platform_data e800_tc6393xb_info = {
0932     .irq_base       = IRQ_BOARD_START,
0933     .scr_pll2cr     = 0x0cc1,
0934     .scr_gper       = 0,
0935     .suspend        = &eseries_tmio_suspend,
0936     .resume         = &eseries_tmio_resume,
0937     .enable         = &eseries_tmio_enable,
0938     .disable        = &eseries_tmio_disable,
0939 };
0940 
0941 static struct platform_device e800_tc6393xb_device = {
0942     .name           = "tc6393xb",
0943     .id             = -1,
0944     .dev            = {
0945         .platform_data = &e800_tc6393xb_info,
0946     },
0947     .num_resources = 2,
0948     .resource      = eseries_tmio_resources,
0949 };
0950 
0951 static struct gpiod_lookup_table e800_audio_gpio_table = {
0952     .dev_id = "e800-audio",
0953     .table = {
0954         GPIO_LOOKUP("gpio-pxa",  GPIO_E800_HP_AMP_OFF, "Output amp",  GPIO_ACTIVE_LOW),
0955         GPIO_LOOKUP("gpio-pxa",  GPIO_E800_SPK_AMP_ON, "Mic amp", GPIO_ACTIVE_HIGH),
0956         { },
0957     },
0958 };
0959 
0960 static struct platform_device e800_audio_device = {
0961     .name       = "e800-audio",
0962     .id     = -1,
0963 };
0964 
0965 /* ----------------------------------------------------------------------- */
0966 
0967 static struct platform_device *e800_devices[] __initdata = {
0968     &e800_fb_device,
0969     &e800_tc6393xb_device,
0970     &e800_gpio_vbus,
0971     &e800_audio_device,
0972 };
0973 
0974 static void __init e800_init(void)
0975 {
0976     pxa2xx_mfp_config(ARRAY_AND_SIZE(e800_pin_config));
0977     pxa_set_ffuart_info(NULL);
0978     pxa_set_btuart_info(NULL);
0979     pxa_set_stuart_info(NULL);
0980     clk_add_alias("CLK_CK3P6MI", e800_tc6393xb_device.name,
0981             "GPIO11_CLK", NULL),
0982     eseries_get_tmio_gpios();
0983     gpiod_add_lookup_table(&e800_gpio_vbus_gpiod_table);
0984     gpiod_add_lookup_table(&e800_audio_gpio_table);
0985     platform_add_devices(ARRAY_AND_SIZE(e800_devices));
0986     pxa_set_ac97_info(NULL);
0987 }
0988 
0989 MACHINE_START(E800, "Toshiba e800")
0990     /* Maintainer: Ian Molton (spyro@f2s.com) */
0991     .atag_offset    = 0x100,
0992     .map_io     = pxa25x_map_io,
0993     .nr_irqs    = ESERIES_NR_IRQS,
0994     .init_irq   = pxa25x_init_irq,
0995     .handle_irq = pxa25x_handle_irq,
0996     .fixup      = eseries_fixup,
0997     .init_machine   = e800_init,
0998     .init_time  = pxa_timer_init,
0999     .restart    = pxa_restart,
1000 MACHINE_END
1001 #endif