Merge commit 'v2.6.39' into 20110526
[linux-2.6.git] / arch / arm / mach-pxa / eseries.c
1 /*
2  * Hardware definitions for the Toshiba eseries PDAs
3  *
4  * Copyright (c) 2003 Ian Molton <spyro@f2s.com>
5  *
6  * This file is licensed under
7  * the terms of the GNU General Public License version 2. This program
8  * is licensed "as is" without any warranty of any kind, whether express
9  * or implied.
10  *
11  */
12
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/gpio.h>
16 #include <linux/delay.h>
17 #include <linux/platform_device.h>
18 #include <linux/mfd/tc6387xb.h>
19 #include <linux/mfd/tc6393xb.h>
20 #include <linux/mfd/t7l66xb.h>
21 #include <linux/mtd/nand.h>
22 #include <linux/mtd/partitions.h>
23 #include <linux/usb/gpio_vbus.h>
24
25 #include <video/w100fb.h>
26
27 #include <asm/setup.h>
28 #include <asm/mach/arch.h>
29 #include <asm/mach-types.h>
30
31 #include <mach/pxa25x.h>
32 #include <mach/eseries-gpio.h>
33 #include <mach/eseries-irq.h>
34 #include <mach/audio.h>
35 #include <mach/pxafb.h>
36 #include <mach/udc.h>
37 #include <mach/irda.h>
38
39 #include "devices.h"
40 #include "generic.h"
41 #include "clock.h"
42
43 /* Only e800 has 128MB RAM */
44 void __init eseries_fixup(struct machine_desc *desc,
45         struct tag *tags, char **cmdline, struct meminfo *mi)
46 {
47         mi->nr_banks=1;
48         mi->bank[0].start = 0xa0000000;
49         if (machine_is_e800())
50                 mi->bank[0].size = (128*1024*1024);
51         else
52                 mi->bank[0].size = (64*1024*1024);
53 }
54
55 struct gpio_vbus_mach_info e7xx_udc_info = {
56         .gpio_vbus   = GPIO_E7XX_USB_DISC,
57         .gpio_pullup = GPIO_E7XX_USB_PULLUP,
58         .gpio_pullup_inverted = 1
59 };
60
61 static struct platform_device e7xx_gpio_vbus = {
62         .name   = "gpio-vbus",
63         .id     = -1,
64         .dev    = {
65                 .platform_data  = &e7xx_udc_info,
66         },
67 };
68
69 struct pxaficp_platform_data e7xx_ficp_platform_data = {
70         .gpio_pwdown            = GPIO_E7XX_IR_OFF,
71         .transceiver_cap        = IR_SIRMODE | IR_OFF,
72 };
73
74 int eseries_tmio_enable(struct platform_device *dev)
75 {
76         /* Reset - bring SUSPEND high before PCLR */
77         gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
78         gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
79         msleep(1);
80         gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
81         msleep(1);
82         gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 1);
83         msleep(1);
84         return 0;
85 }
86
87 int eseries_tmio_disable(struct platform_device *dev)
88 {
89         gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
90         gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
91         return 0;
92 }
93
94 int eseries_tmio_suspend(struct platform_device *dev)
95 {
96         gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
97         return 0;
98 }
99
100 int eseries_tmio_resume(struct platform_device *dev)
101 {
102         gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
103         msleep(1);
104         return 0;
105 }
106
107 void eseries_get_tmio_gpios(void)
108 {
109         gpio_request(GPIO_ESERIES_TMIO_SUSPEND, NULL);
110         gpio_request(GPIO_ESERIES_TMIO_PCLR, NULL);
111         gpio_direction_output(GPIO_ESERIES_TMIO_SUSPEND, 0);
112         gpio_direction_output(GPIO_ESERIES_TMIO_PCLR, 0);
113 }
114
115 /* TMIO controller uses the same resources on all e-series machines. */
116 struct resource eseries_tmio_resources[] = {
117         [0] = {
118                 .start  = PXA_CS4_PHYS,
119                 .end    = PXA_CS4_PHYS + 0x1fffff,
120                 .flags  = IORESOURCE_MEM,
121         },
122         [1] = {
123                 .start  = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
124                 .end    = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
125                 .flags  = IORESOURCE_IRQ,
126         },
127 };
128
129 /* Some e-series hardware cannot control the 32K clock */
130 static void clk_32k_dummy(struct clk *clk)
131 {
132 }
133
134 static const struct clkops clk_32k_dummy_ops = {
135         .enable         = clk_32k_dummy,
136         .disable        = clk_32k_dummy,
137 };
138
139 static struct clk tmio_dummy_clk = {
140         .ops    = &clk_32k_dummy_ops,
141         .rate   = 32768,
142 };
143
144 static struct clk_lookup eseries_clkregs[] = {
145         INIT_CLKREG(&tmio_dummy_clk, NULL, "CLK_CK32K"),
146 };
147
148 void eseries_register_clks(void)
149 {
150         clkdev_add_table(eseries_clkregs, ARRAY_SIZE(eseries_clkregs));
151 }
152
153 #ifdef CONFIG_MACH_E330
154 /* -------------------- e330 tc6387xb parameters -------------------- */
155
156 static struct tc6387xb_platform_data e330_tc6387xb_info = {
157         .enable   = &eseries_tmio_enable,
158         .disable  = &eseries_tmio_disable,
159         .suspend  = &eseries_tmio_suspend,
160         .resume   = &eseries_tmio_resume,
161 };
162
163 static struct platform_device e330_tc6387xb_device = {
164         .name           = "tc6387xb",
165         .id             = -1,
166         .dev            = {
167                 .platform_data = &e330_tc6387xb_info,
168         },
169         .num_resources = 2,
170         .resource      = eseries_tmio_resources,
171 };
172
173 /* --------------------------------------------------------------- */
174
175 static struct platform_device *e330_devices[] __initdata = {
176         &e330_tc6387xb_device,
177         &e7xx_gpio_vbus,
178 };
179
180 static void __init e330_init(void)
181 {
182         pxa_set_ffuart_info(NULL);
183         pxa_set_btuart_info(NULL);
184         pxa_set_stuart_info(NULL);
185         eseries_register_clks();
186         eseries_get_tmio_gpios();
187         platform_add_devices(ARRAY_AND_SIZE(e330_devices));
188 }
189
190 MACHINE_START(E330, "Toshiba e330")
191         /* Maintainer: Ian Molton (spyro@f2s.com) */
192         .boot_params    = 0xa0000100,
193         .map_io         = pxa25x_map_io,
194         .nr_irqs        = ESERIES_NR_IRQS,
195         .init_irq       = pxa25x_init_irq,
196         .fixup          = eseries_fixup,
197         .init_machine   = e330_init,
198         .timer          = &pxa_timer,
199 MACHINE_END
200 #endif
201
202 #ifdef CONFIG_MACH_E350
203 /* -------------------- e350 t7l66xb parameters -------------------- */
204
205 static struct t7l66xb_platform_data e350_t7l66xb_info = {
206         .irq_base               = IRQ_BOARD_START,
207         .enable                 = &eseries_tmio_enable,
208         .suspend                = &eseries_tmio_suspend,
209         .resume                 = &eseries_tmio_resume,
210 };
211
212 static struct platform_device e350_t7l66xb_device = {
213         .name           = "t7l66xb",
214         .id             = -1,
215         .dev            = {
216                 .platform_data = &e350_t7l66xb_info,
217         },
218         .num_resources = 2,
219         .resource      = eseries_tmio_resources,
220 };
221
222 /* ---------------------------------------------------------- */
223
224 static struct platform_device *e350_devices[] __initdata = {
225         &e350_t7l66xb_device,
226         &e7xx_gpio_vbus,
227 };
228
229 static void __init e350_init(void)
230 {
231         pxa_set_ffuart_info(NULL);
232         pxa_set_btuart_info(NULL);
233         pxa_set_stuart_info(NULL);
234         eseries_register_clks();
235         eseries_get_tmio_gpios();
236         platform_add_devices(ARRAY_AND_SIZE(e350_devices));
237 }
238
239 MACHINE_START(E350, "Toshiba e350")
240         /* Maintainer: Ian Molton (spyro@f2s.com) */
241         .boot_params    = 0xa0000100,
242         .map_io         = pxa25x_map_io,
243         .nr_irqs        = ESERIES_NR_IRQS,
244         .init_irq       = pxa25x_init_irq,
245         .fixup          = eseries_fixup,
246         .init_machine   = e350_init,
247         .timer          = &pxa_timer,
248 MACHINE_END
249 #endif
250
251 #ifdef CONFIG_MACH_E400
252 /* ------------------------ E400 LCD definitions ------------------------ */
253
254 static struct pxafb_mode_info e400_pxafb_mode_info = {
255         .pixclock       = 140703,
256         .xres           = 240,
257         .yres           = 320,
258         .bpp            = 16,
259         .hsync_len      = 4,
260         .left_margin    = 28,
261         .right_margin   = 8,
262         .vsync_len      = 3,
263         .upper_margin   = 5,
264         .lower_margin   = 6,
265         .sync           = 0,
266 };
267
268 static struct pxafb_mach_info e400_pxafb_mach_info = {
269         .modes          = &e400_pxafb_mode_info,
270         .num_modes      = 1,
271         .lcd_conn       = LCD_COLOR_TFT_16BPP,
272         .lccr3          = 0,
273         .pxafb_backlight_power  = NULL,
274 };
275
276 /* ------------------------ E400 MFP config ----------------------------- */
277
278 static unsigned long e400_pin_config[] __initdata = {
279         /* Chip selects */
280         GPIO15_nCS_1,   /* CS1 - Flash */
281         GPIO80_nCS_4,   /* CS4 - TMIO */
282
283         /* Clocks */
284         GPIO12_32KHz,
285
286         /* BTUART */
287         GPIO42_BTUART_RXD,
288         GPIO43_BTUART_TXD,
289         GPIO44_BTUART_CTS,
290
291         /* TMIO controller */
292         GPIO19_GPIO, /* t7l66xb #PCLR */
293         GPIO45_GPIO, /* t7l66xb #SUSPEND (NOT BTUART!) */
294
295         /* wakeup */
296         GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
297 };
298
299 /* ---------------------------------------------------------------------- */
300
301 static struct mtd_partition partition_a = {
302         .name = "Internal NAND flash",
303         .offset =  0,
304         .size =  MTDPART_SIZ_FULL,
305 };
306
307 static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
308
309 static struct nand_bbt_descr e400_t7l66xb_nand_bbt = {
310         .options = 0,
311         .offs = 4,
312         .len = 2,
313         .pattern = scan_ff_pattern
314 };
315
316 static struct tmio_nand_data e400_t7l66xb_nand_config = {
317         .num_partitions = 1,
318         .partition = &partition_a,
319         .badblock_pattern = &e400_t7l66xb_nand_bbt,
320 };
321
322 static struct t7l66xb_platform_data e400_t7l66xb_info = {
323         .irq_base               = IRQ_BOARD_START,
324         .enable                 = &eseries_tmio_enable,
325         .suspend                = &eseries_tmio_suspend,
326         .resume                 = &eseries_tmio_resume,
327
328         .nand_data              = &e400_t7l66xb_nand_config,
329 };
330
331 static struct platform_device e400_t7l66xb_device = {
332         .name           = "t7l66xb",
333         .id             = -1,
334         .dev            = {
335                 .platform_data = &e400_t7l66xb_info,
336         },
337         .num_resources = 2,
338         .resource      = eseries_tmio_resources,
339 };
340
341 /* ---------------------------------------------------------- */
342
343 static struct platform_device *e400_devices[] __initdata = {
344         &e400_t7l66xb_device,
345         &e7xx_gpio_vbus,
346 };
347
348 static void __init e400_init(void)
349 {
350         pxa2xx_mfp_config(ARRAY_AND_SIZE(e400_pin_config));
351         pxa_set_ffuart_info(NULL);
352         pxa_set_btuart_info(NULL);
353         pxa_set_stuart_info(NULL);
354         /* Fixme - e400 may have a switched clock */
355         eseries_register_clks();
356         eseries_get_tmio_gpios();
357         pxa_set_fb_info(NULL, &e400_pxafb_mach_info);
358         platform_add_devices(ARRAY_AND_SIZE(e400_devices));
359 }
360
361 MACHINE_START(E400, "Toshiba e400")
362         /* Maintainer: Ian Molton (spyro@f2s.com) */
363         .boot_params    = 0xa0000100,
364         .map_io         = pxa25x_map_io,
365         .nr_irqs        = ESERIES_NR_IRQS,
366         .init_irq       = pxa25x_init_irq,
367         .fixup          = eseries_fixup,
368         .init_machine   = e400_init,
369         .timer          = &pxa_timer,
370 MACHINE_END
371 #endif
372
373 #ifdef CONFIG_MACH_E740
374 /* ------------------------ e740 video support --------------------------- */
375
376 static struct w100_gen_regs e740_lcd_regs = {
377         .lcd_format =            0x00008023,
378         .lcdd_cntl1 =            0x0f000000,
379         .lcdd_cntl2 =            0x0003ffff,
380         .genlcd_cntl1 =          0x00ffff03,
381         .genlcd_cntl2 =          0x003c0f03,
382         .genlcd_cntl3 =          0x000143aa,
383 };
384
385 static struct w100_mode e740_lcd_mode = {
386         .xres            = 240,
387         .yres            = 320,
388         .left_margin     = 20,
389         .right_margin    = 28,
390         .upper_margin    = 9,
391         .lower_margin    = 8,
392         .crtc_ss         = 0x80140013,
393         .crtc_ls         = 0x81150110,
394         .crtc_gs         = 0x80050005,
395         .crtc_vpos_gs    = 0x000a0009,
396         .crtc_rev        = 0x0040010a,
397         .crtc_dclk       = 0xa906000a,
398         .crtc_gclk       = 0x80050108,
399         .crtc_goe        = 0x80050108,
400         .pll_freq        = 57,
401         .pixclk_divider         = 4,
402         .pixclk_divider_rotated = 4,
403         .pixclk_src     = CLK_SRC_XTAL,
404         .sysclk_divider  = 1,
405         .sysclk_src     = CLK_SRC_PLL,
406         .crtc_ps1_active =       0x41060010,
407 };
408
409 static struct w100_gpio_regs e740_w100_gpio_info = {
410         .init_data1 = 0x21002103,
411         .gpio_dir1  = 0xffffdeff,
412         .gpio_oe1   = 0x03c00643,
413         .init_data2 = 0x003f003f,
414         .gpio_dir2  = 0xffffffff,
415         .gpio_oe2   = 0x000000ff,
416 };
417
418 static struct w100fb_mach_info e740_fb_info = {
419         .modelist   = &e740_lcd_mode,
420         .num_modes  = 1,
421         .regs       = &e740_lcd_regs,
422         .gpio       = &e740_w100_gpio_info,
423         .xtal_freq = 14318000,
424         .xtal_dbl   = 1,
425 };
426
427 static struct resource e740_fb_resources[] = {
428         [0] = {
429                 .start          = 0x0c000000,
430                 .end            = 0x0cffffff,
431                 .flags          = IORESOURCE_MEM,
432         },
433 };
434
435 static struct platform_device e740_fb_device = {
436         .name           = "w100fb",
437         .id             = -1,
438         .dev            = {
439                 .platform_data  = &e740_fb_info,
440         },
441         .num_resources  = ARRAY_SIZE(e740_fb_resources),
442         .resource       = e740_fb_resources,
443 };
444
445 /* --------------------------- MFP Pin config -------------------------- */
446
447 static unsigned long e740_pin_config[] __initdata = {
448         /* Chip selects */
449         GPIO15_nCS_1,   /* CS1 - Flash */
450         GPIO79_nCS_3,   /* CS3 - IMAGEON */
451         GPIO80_nCS_4,   /* CS4 - TMIO */
452
453         /* Clocks */
454         GPIO12_32KHz,
455
456         /* BTUART */
457         GPIO42_BTUART_RXD,
458         GPIO43_BTUART_TXD,
459         GPIO44_BTUART_CTS,
460
461         /* TMIO controller */
462         GPIO19_GPIO, /* t7l66xb #PCLR */
463         GPIO45_GPIO, /* t7l66xb #SUSPEND (NOT BTUART!) */
464
465         /* UDC */
466         GPIO13_GPIO,
467         GPIO3_GPIO,
468
469         /* IrDA */
470         GPIO38_GPIO | MFP_LPM_DRIVE_HIGH,
471
472         /* AC97 */
473         GPIO28_AC97_BITCLK,
474         GPIO29_AC97_SDATA_IN_0,
475         GPIO30_AC97_SDATA_OUT,
476         GPIO31_AC97_SYNC,
477
478         /* Audio power control */
479         GPIO16_GPIO,  /* AC97 codec AVDD2 supply (analogue power) */
480         GPIO40_GPIO,  /* Mic amp power */
481         GPIO41_GPIO,  /* Headphone amp power */
482
483         /* PC Card */
484         GPIO8_GPIO,   /* CD0 */
485         GPIO44_GPIO,  /* CD1 */
486         GPIO11_GPIO,  /* IRQ0 */
487         GPIO6_GPIO,   /* IRQ1 */
488         GPIO27_GPIO,  /* RST0 */
489         GPIO24_GPIO,  /* RST1 */
490         GPIO20_GPIO,  /* PWR0 */
491         GPIO23_GPIO,  /* PWR1 */
492         GPIO48_nPOE,
493         GPIO49_nPWE,
494         GPIO50_nPIOR,
495         GPIO51_nPIOW,
496         GPIO52_nPCE_1,
497         GPIO53_nPCE_2,
498         GPIO54_nPSKTSEL,
499         GPIO55_nPREG,
500         GPIO56_nPWAIT,
501         GPIO57_nIOIS16,
502
503         /* wakeup */
504         GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
505 };
506
507 /* -------------------- e740 t7l66xb parameters -------------------- */
508
509 static struct t7l66xb_platform_data e740_t7l66xb_info = {
510         .irq_base               = IRQ_BOARD_START,
511         .enable                 = &eseries_tmio_enable,
512         .suspend                = &eseries_tmio_suspend,
513         .resume                 = &eseries_tmio_resume,
514 };
515
516 static struct platform_device e740_t7l66xb_device = {
517         .name           = "t7l66xb",
518         .id             = -1,
519         .dev            = {
520                 .platform_data = &e740_t7l66xb_info,
521         },
522         .num_resources = 2,
523         .resource      = eseries_tmio_resources,
524 };
525
526 /* ----------------------------------------------------------------------- */
527
528 static struct platform_device *e740_devices[] __initdata = {
529         &e740_fb_device,
530         &e740_t7l66xb_device,
531         &e7xx_gpio_vbus,
532 };
533
534 static void __init e740_init(void)
535 {
536         pxa2xx_mfp_config(ARRAY_AND_SIZE(e740_pin_config));
537         pxa_set_ffuart_info(NULL);
538         pxa_set_btuart_info(NULL);
539         pxa_set_stuart_info(NULL);
540         eseries_register_clks();
541         clk_add_alias("CLK_CK48M", e740_t7l66xb_device.name,
542                         "UDCCLK", &pxa25x_device_udc.dev),
543         eseries_get_tmio_gpios();
544         platform_add_devices(ARRAY_AND_SIZE(e740_devices));
545         pxa_set_ac97_info(NULL);
546         pxa_set_ficp_info(&e7xx_ficp_platform_data);
547 }
548
549 MACHINE_START(E740, "Toshiba e740")
550         /* Maintainer: Ian Molton (spyro@f2s.com) */
551         .boot_params    = 0xa0000100,
552         .map_io         = pxa25x_map_io,
553         .nr_irqs        = ESERIES_NR_IRQS,
554         .init_irq       = pxa25x_init_irq,
555         .fixup          = eseries_fixup,
556         .init_machine   = e740_init,
557         .timer          = &pxa_timer,
558 MACHINE_END
559 #endif
560
561 #ifdef CONFIG_MACH_E750
562 /* ---------------------- E750 LCD definitions -------------------- */
563
564 static struct w100_gen_regs e750_lcd_regs = {
565         .lcd_format =            0x00008003,
566         .lcdd_cntl1 =            0x00000000,
567         .lcdd_cntl2 =            0x0003ffff,
568         .genlcd_cntl1 =          0x00fff003,
569         .genlcd_cntl2 =          0x003c0f03,
570         .genlcd_cntl3 =          0x000143aa,
571 };
572
573 static struct w100_mode e750_lcd_mode = {
574         .xres            = 240,
575         .yres            = 320,
576         .left_margin     = 21,
577         .right_margin    = 22,
578         .upper_margin    = 5,
579         .lower_margin    = 4,
580         .crtc_ss         = 0x80150014,
581         .crtc_ls         = 0x8014000d,
582         .crtc_gs         = 0xc1000005,
583         .crtc_vpos_gs    = 0x00020147,
584         .crtc_rev        = 0x0040010a,
585         .crtc_dclk       = 0xa1700030,
586         .crtc_gclk       = 0x80cc0015,
587         .crtc_goe        = 0x80cc0015,
588         .crtc_ps1_active = 0x61060017,
589         .pll_freq        = 57,
590         .pixclk_divider         = 4,
591         .pixclk_divider_rotated = 4,
592         .pixclk_src     = CLK_SRC_XTAL,
593         .sysclk_divider  = 1,
594         .sysclk_src     = CLK_SRC_PLL,
595 };
596
597 static struct w100_gpio_regs e750_w100_gpio_info = {
598         .init_data1 = 0x01192f1b,
599         .gpio_dir1  = 0xd5ffdeff,
600         .gpio_oe1   = 0x000020bf,
601         .init_data2 = 0x010f010f,
602         .gpio_dir2  = 0xffffffff,
603         .gpio_oe2   = 0x000001cf,
604 };
605
606 static struct w100fb_mach_info e750_fb_info = {
607         .modelist   = &e750_lcd_mode,
608         .num_modes  = 1,
609         .regs       = &e750_lcd_regs,
610         .gpio       = &e750_w100_gpio_info,
611         .xtal_freq  = 14318000,
612         .xtal_dbl   = 1,
613 };
614
615 static struct resource e750_fb_resources[] = {
616         [0] = {
617                 .start          = 0x0c000000,
618                 .end            = 0x0cffffff,
619                 .flags          = IORESOURCE_MEM,
620         },
621 };
622
623 static struct platform_device e750_fb_device = {
624         .name           = "w100fb",
625         .id             = -1,
626         .dev            = {
627                 .platform_data  = &e750_fb_info,
628         },
629         .num_resources  = ARRAY_SIZE(e750_fb_resources),
630         .resource       = e750_fb_resources,
631 };
632
633 /* -------------------- e750 MFP parameters -------------------- */
634
635 static unsigned long e750_pin_config[] __initdata = {
636         /* Chip selects */
637         GPIO15_nCS_1,   /* CS1 - Flash */
638         GPIO79_nCS_3,   /* CS3 - IMAGEON */
639         GPIO80_nCS_4,   /* CS4 - TMIO */
640
641         /* Clocks */
642         GPIO11_3_6MHz,
643
644         /* BTUART */
645         GPIO42_BTUART_RXD,
646         GPIO43_BTUART_TXD,
647         GPIO44_BTUART_CTS,
648
649         /* TMIO controller */
650         GPIO19_GPIO, /* t7l66xb #PCLR */
651         GPIO45_GPIO, /* t7l66xb #SUSPEND (NOT BTUART!) */
652
653         /* UDC */
654         GPIO13_GPIO,
655         GPIO3_GPIO,
656
657         /* IrDA */
658         GPIO38_GPIO | MFP_LPM_DRIVE_HIGH,
659
660         /* AC97 */
661         GPIO28_AC97_BITCLK,
662         GPIO29_AC97_SDATA_IN_0,
663         GPIO30_AC97_SDATA_OUT,
664         GPIO31_AC97_SYNC,
665
666         /* Audio power control */
667         GPIO4_GPIO,  /* Headphone amp power */
668         GPIO7_GPIO,  /* Speaker amp power */
669         GPIO37_GPIO, /* Headphone detect */
670
671         /* PC Card */
672         GPIO8_GPIO,   /* CD0 */
673         GPIO44_GPIO,  /* CD1 */
674         GPIO11_GPIO,  /* IRQ0 */
675         GPIO6_GPIO,   /* IRQ1 */
676         GPIO27_GPIO,  /* RST0 */
677         GPIO24_GPIO,  /* RST1 */
678         GPIO20_GPIO,  /* PWR0 */
679         GPIO23_GPIO,  /* PWR1 */
680         GPIO48_nPOE,
681         GPIO49_nPWE,
682         GPIO50_nPIOR,
683         GPIO51_nPIOW,
684         GPIO52_nPCE_1,
685         GPIO53_nPCE_2,
686         GPIO54_nPSKTSEL,
687         GPIO55_nPREG,
688         GPIO56_nPWAIT,
689         GPIO57_nIOIS16,
690
691         /* wakeup */
692         GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
693 };
694
695 /* ----------------- e750 tc6393xb parameters ------------------ */
696
697 static struct tc6393xb_platform_data e750_tc6393xb_info = {
698         .irq_base       = IRQ_BOARD_START,
699         .scr_pll2cr     = 0x0cc1,
700         .scr_gper       = 0,
701         .gpio_base      = -1,
702         .suspend        = &eseries_tmio_suspend,
703         .resume         = &eseries_tmio_resume,
704         .enable         = &eseries_tmio_enable,
705         .disable        = &eseries_tmio_disable,
706 };
707
708 static struct platform_device e750_tc6393xb_device = {
709         .name           = "tc6393xb",
710         .id             = -1,
711         .dev            = {
712                 .platform_data = &e750_tc6393xb_info,
713         },
714         .num_resources = 2,
715         .resource      = eseries_tmio_resources,
716 };
717
718 /* ------------------------------------------------------------- */
719
720 static struct platform_device *e750_devices[] __initdata = {
721         &e750_fb_device,
722         &e750_tc6393xb_device,
723         &e7xx_gpio_vbus,
724 };
725
726 static void __init e750_init(void)
727 {
728         pxa2xx_mfp_config(ARRAY_AND_SIZE(e750_pin_config));
729         pxa_set_ffuart_info(NULL);
730         pxa_set_btuart_info(NULL);
731         pxa_set_stuart_info(NULL);
732         clk_add_alias("CLK_CK3P6MI", e750_tc6393xb_device.name,
733                         "GPIO11_CLK", NULL),
734         eseries_get_tmio_gpios();
735         platform_add_devices(ARRAY_AND_SIZE(e750_devices));
736         pxa_set_ac97_info(NULL);
737         pxa_set_ficp_info(&e7xx_ficp_platform_data);
738 }
739
740 MACHINE_START(E750, "Toshiba e750")
741         /* Maintainer: Ian Molton (spyro@f2s.com) */
742         .boot_params    = 0xa0000100,
743         .map_io         = pxa25x_map_io,
744         .nr_irqs        = ESERIES_NR_IRQS,
745         .init_irq       = pxa25x_init_irq,
746         .fixup          = eseries_fixup,
747         .init_machine   = e750_init,
748         .timer          = &pxa_timer,
749 MACHINE_END
750 #endif
751
752 #ifdef CONFIG_MACH_E800
753 /* ------------------------ e800 LCD definitions ------------------------- */
754
755 static unsigned long e800_pin_config[] __initdata = {
756         /* AC97 */
757         GPIO28_AC97_BITCLK,
758         GPIO29_AC97_SDATA_IN_0,
759         GPIO30_AC97_SDATA_OUT,
760         GPIO31_AC97_SYNC,
761 };
762
763 static struct w100_gen_regs e800_lcd_regs = {
764         .lcd_format =            0x00008003,
765         .lcdd_cntl1 =            0x02a00000,
766         .lcdd_cntl2 =            0x0003ffff,
767         .genlcd_cntl1 =          0x000ff2a3,
768         .genlcd_cntl2 =          0x000002a3,
769         .genlcd_cntl3 =          0x000102aa,
770 };
771
772 static struct w100_mode e800_lcd_mode[2] = {
773         [0] = {
774                 .xres            = 480,
775                 .yres            = 640,
776                 .left_margin     = 52,
777                 .right_margin    = 148,
778                 .upper_margin    = 2,
779                 .lower_margin    = 6,
780                 .crtc_ss         = 0x80350034,
781                 .crtc_ls         = 0x802b0026,
782                 .crtc_gs         = 0x80160016,
783                 .crtc_vpos_gs    = 0x00020003,
784                 .crtc_rev        = 0x0040001d,
785                 .crtc_dclk       = 0xe0000000,
786                 .crtc_gclk       = 0x82a50049,
787                 .crtc_goe        = 0x80ee001c,
788                 .crtc_ps1_active = 0x00000000,
789                 .pll_freq        = 128,
790                 .pixclk_divider         = 4,
791                 .pixclk_divider_rotated = 6,
792                 .pixclk_src     = CLK_SRC_PLL,
793                 .sysclk_divider  = 0,
794                 .sysclk_src     = CLK_SRC_PLL,
795         },
796         [1] = {
797                 .xres            = 240,
798                 .yres            = 320,
799                 .left_margin     = 15,
800                 .right_margin    = 88,
801                 .upper_margin    = 0,
802                 .lower_margin    = 7,
803                 .crtc_ss         = 0xd010000f,
804                 .crtc_ls         = 0x80070003,
805                 .crtc_gs         = 0x80000000,
806                 .crtc_vpos_gs    = 0x01460147,
807                 .crtc_rev        = 0x00400003,
808                 .crtc_dclk       = 0xa1700030,
809                 .crtc_gclk       = 0x814b0008,
810                 .crtc_goe        = 0x80cc0015,
811                 .crtc_ps1_active = 0x00000000,
812                 .pll_freq        = 100,
813                 .pixclk_divider         = 6, /* Wince uses 14 which gives a */
814                 .pixclk_divider_rotated = 6, /* 7MHz Pclk. We use a 14MHz one */
815                 .pixclk_src     = CLK_SRC_PLL,
816                 .sysclk_divider  = 0,
817                 .sysclk_src     = CLK_SRC_PLL,
818         }
819 };
820
821
822 static struct w100_gpio_regs e800_w100_gpio_info = {
823         .init_data1 = 0xc13fc019,
824         .gpio_dir1  = 0x3e40df7f,
825         .gpio_oe1   = 0x003c3000,
826         .init_data2 = 0x00000000,
827         .gpio_dir2  = 0x00000000,
828         .gpio_oe2   = 0x00000000,
829 };
830
831 static struct w100_mem_info e800_w100_mem_info = {
832         .ext_cntl        = 0x09640011,
833         .sdram_mode_reg  = 0x00600021,
834         .ext_timing_cntl = 0x10001545,
835         .io_cntl         = 0x7ddd7333,
836         .size            = 0x1fffff,
837 };
838
839 static void e800_tg_change(struct w100fb_par *par)
840 {
841         unsigned long tmp;
842
843         tmp = w100fb_gpio_read(W100_GPIO_PORT_A);
844         if (par->mode->xres == 480)
845                 tmp |= 0x100;
846         else
847                 tmp &= ~0x100;
848         w100fb_gpio_write(W100_GPIO_PORT_A, tmp);
849 }
850
851 static struct w100_tg_info e800_tg_info = {
852         .change = e800_tg_change,
853 };
854
855 static struct w100fb_mach_info e800_fb_info = {
856         .modelist   = e800_lcd_mode,
857         .num_modes  = 2,
858         .regs       = &e800_lcd_regs,
859         .gpio       = &e800_w100_gpio_info,
860         .mem        = &e800_w100_mem_info,
861         .tg         = &e800_tg_info,
862         .xtal_freq  = 16000000,
863 };
864
865 static struct resource e800_fb_resources[] = {
866         [0] = {
867                 .start          = 0x0c000000,
868                 .end            = 0x0cffffff,
869                 .flags          = IORESOURCE_MEM,
870         },
871 };
872
873 static struct platform_device e800_fb_device = {
874         .name           = "w100fb",
875         .id             = -1,
876         .dev            = {
877                 .platform_data  = &e800_fb_info,
878         },
879         .num_resources  = ARRAY_SIZE(e800_fb_resources),
880         .resource       = e800_fb_resources,
881 };
882
883 /* --------------------------- UDC definitions --------------------------- */
884
885 static struct gpio_vbus_mach_info e800_udc_info = {
886         .gpio_vbus   = GPIO_E800_USB_DISC,
887         .gpio_pullup = GPIO_E800_USB_PULLUP,
888         .gpio_pullup_inverted = 1
889 };
890
891 static struct platform_device e800_gpio_vbus = {
892         .name   = "gpio-vbus",
893         .id     = -1,
894         .dev    = {
895                 .platform_data  = &e800_udc_info,
896         },
897 };
898
899
900 /* ----------------- e800 tc6393xb parameters ------------------ */
901
902 static struct tc6393xb_platform_data e800_tc6393xb_info = {
903         .irq_base       = IRQ_BOARD_START,
904         .scr_pll2cr     = 0x0cc1,
905         .scr_gper       = 0,
906         .gpio_base      = -1,
907         .suspend        = &eseries_tmio_suspend,
908         .resume         = &eseries_tmio_resume,
909         .enable         = &eseries_tmio_enable,
910         .disable        = &eseries_tmio_disable,
911 };
912
913 static struct platform_device e800_tc6393xb_device = {
914         .name           = "tc6393xb",
915         .id             = -1,
916         .dev            = {
917                 .platform_data = &e800_tc6393xb_info,
918         },
919         .num_resources = 2,
920         .resource      = eseries_tmio_resources,
921 };
922
923 /* ----------------------------------------------------------------------- */
924
925 static struct platform_device *e800_devices[] __initdata = {
926         &e800_fb_device,
927         &e800_tc6393xb_device,
928         &e800_gpio_vbus,
929 };
930
931 static void __init e800_init(void)
932 {
933         pxa2xx_mfp_config(ARRAY_AND_SIZE(e800_pin_config));
934         pxa_set_ffuart_info(NULL);
935         pxa_set_btuart_info(NULL);
936         pxa_set_stuart_info(NULL);
937         clk_add_alias("CLK_CK3P6MI", e800_tc6393xb_device.name,
938                         "GPIO11_CLK", NULL),
939         eseries_get_tmio_gpios();
940         platform_add_devices(ARRAY_AND_SIZE(e800_devices));
941         pxa_set_ac97_info(NULL);
942 }
943
944 MACHINE_START(E800, "Toshiba e800")
945         /* Maintainer: Ian Molton (spyro@f2s.com) */
946         .boot_params    = 0xa0000100,
947         .map_io         = pxa25x_map_io,
948         .nr_irqs        = ESERIES_NR_IRQS,
949         .init_irq       = pxa25x_init_irq,
950         .fixup          = eseries_fixup,
951         .init_machine   = e800_init,
952         .timer          = &pxa_timer,
953 MACHINE_END
954 #endif