Merge branch 'for-linus' of git://github.com/dtor/input
[pandora-kernel.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         .handle_irq     = pxa25x_handle_irq,
197         .fixup          = eseries_fixup,
198         .init_machine   = e330_init,
199         .timer          = &pxa_timer,
200 MACHINE_END
201 #endif
202
203 #ifdef CONFIG_MACH_E350
204 /* -------------------- e350 t7l66xb parameters -------------------- */
205
206 static struct t7l66xb_platform_data e350_t7l66xb_info = {
207         .irq_base               = IRQ_BOARD_START,
208         .enable                 = &eseries_tmio_enable,
209         .suspend                = &eseries_tmio_suspend,
210         .resume                 = &eseries_tmio_resume,
211 };
212
213 static struct platform_device e350_t7l66xb_device = {
214         .name           = "t7l66xb",
215         .id             = -1,
216         .dev            = {
217                 .platform_data = &e350_t7l66xb_info,
218         },
219         .num_resources = 2,
220         .resource      = eseries_tmio_resources,
221 };
222
223 /* ---------------------------------------------------------- */
224
225 static struct platform_device *e350_devices[] __initdata = {
226         &e350_t7l66xb_device,
227         &e7xx_gpio_vbus,
228 };
229
230 static void __init e350_init(void)
231 {
232         pxa_set_ffuart_info(NULL);
233         pxa_set_btuart_info(NULL);
234         pxa_set_stuart_info(NULL);
235         eseries_register_clks();
236         eseries_get_tmio_gpios();
237         platform_add_devices(ARRAY_AND_SIZE(e350_devices));
238 }
239
240 MACHINE_START(E350, "Toshiba e350")
241         /* Maintainer: Ian Molton (spyro@f2s.com) */
242         .boot_params    = 0xa0000100,
243         .map_io         = pxa25x_map_io,
244         .nr_irqs        = ESERIES_NR_IRQS,
245         .init_irq       = pxa25x_init_irq,
246         .handle_irq     = pxa25x_handle_irq,
247         .fixup          = eseries_fixup,
248         .init_machine   = e350_init,
249         .timer          = &pxa_timer,
250 MACHINE_END
251 #endif
252
253 #ifdef CONFIG_MACH_E400
254 /* ------------------------ E400 LCD definitions ------------------------ */
255
256 static struct pxafb_mode_info e400_pxafb_mode_info = {
257         .pixclock       = 140703,
258         .xres           = 240,
259         .yres           = 320,
260         .bpp            = 16,
261         .hsync_len      = 4,
262         .left_margin    = 28,
263         .right_margin   = 8,
264         .vsync_len      = 3,
265         .upper_margin   = 5,
266         .lower_margin   = 6,
267         .sync           = 0,
268 };
269
270 static struct pxafb_mach_info e400_pxafb_mach_info = {
271         .modes          = &e400_pxafb_mode_info,
272         .num_modes      = 1,
273         .lcd_conn       = LCD_COLOR_TFT_16BPP,
274         .lccr3          = 0,
275         .pxafb_backlight_power  = NULL,
276 };
277
278 /* ------------------------ E400 MFP config ----------------------------- */
279
280 static unsigned long e400_pin_config[] __initdata = {
281         /* Chip selects */
282         GPIO15_nCS_1,   /* CS1 - Flash */
283         GPIO80_nCS_4,   /* CS4 - TMIO */
284
285         /* Clocks */
286         GPIO12_32KHz,
287
288         /* BTUART */
289         GPIO42_BTUART_RXD,
290         GPIO43_BTUART_TXD,
291         GPIO44_BTUART_CTS,
292
293         /* TMIO controller */
294         GPIO19_GPIO, /* t7l66xb #PCLR */
295         GPIO45_GPIO, /* t7l66xb #SUSPEND (NOT BTUART!) */
296
297         /* wakeup */
298         GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
299 };
300
301 /* ---------------------------------------------------------------------- */
302
303 static struct mtd_partition partition_a = {
304         .name = "Internal NAND flash",
305         .offset =  0,
306         .size =  MTDPART_SIZ_FULL,
307 };
308
309 static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
310
311 static struct nand_bbt_descr e400_t7l66xb_nand_bbt = {
312         .options = 0,
313         .offs = 4,
314         .len = 2,
315         .pattern = scan_ff_pattern
316 };
317
318 static struct tmio_nand_data e400_t7l66xb_nand_config = {
319         .num_partitions = 1,
320         .partition = &partition_a,
321         .badblock_pattern = &e400_t7l66xb_nand_bbt,
322 };
323
324 static struct t7l66xb_platform_data e400_t7l66xb_info = {
325         .irq_base               = IRQ_BOARD_START,
326         .enable                 = &eseries_tmio_enable,
327         .suspend                = &eseries_tmio_suspend,
328         .resume                 = &eseries_tmio_resume,
329
330         .nand_data              = &e400_t7l66xb_nand_config,
331 };
332
333 static struct platform_device e400_t7l66xb_device = {
334         .name           = "t7l66xb",
335         .id             = -1,
336         .dev            = {
337                 .platform_data = &e400_t7l66xb_info,
338         },
339         .num_resources = 2,
340         .resource      = eseries_tmio_resources,
341 };
342
343 /* ---------------------------------------------------------- */
344
345 static struct platform_device *e400_devices[] __initdata = {
346         &e400_t7l66xb_device,
347         &e7xx_gpio_vbus,
348 };
349
350 static void __init e400_init(void)
351 {
352         pxa2xx_mfp_config(ARRAY_AND_SIZE(e400_pin_config));
353         pxa_set_ffuart_info(NULL);
354         pxa_set_btuart_info(NULL);
355         pxa_set_stuart_info(NULL);
356         /* Fixme - e400 may have a switched clock */
357         eseries_register_clks();
358         eseries_get_tmio_gpios();
359         pxa_set_fb_info(NULL, &e400_pxafb_mach_info);
360         platform_add_devices(ARRAY_AND_SIZE(e400_devices));
361 }
362
363 MACHINE_START(E400, "Toshiba e400")
364         /* Maintainer: Ian Molton (spyro@f2s.com) */
365         .boot_params    = 0xa0000100,
366         .map_io         = pxa25x_map_io,
367         .nr_irqs        = ESERIES_NR_IRQS,
368         .init_irq       = pxa25x_init_irq,
369         .handle_irq     = pxa25x_handle_irq,
370         .fixup          = eseries_fixup,
371         .init_machine   = e400_init,
372         .timer          = &pxa_timer,
373 MACHINE_END
374 #endif
375
376 #ifdef CONFIG_MACH_E740
377 /* ------------------------ e740 video support --------------------------- */
378
379 static struct w100_gen_regs e740_lcd_regs = {
380         .lcd_format =            0x00008023,
381         .lcdd_cntl1 =            0x0f000000,
382         .lcdd_cntl2 =            0x0003ffff,
383         .genlcd_cntl1 =          0x00ffff03,
384         .genlcd_cntl2 =          0x003c0f03,
385         .genlcd_cntl3 =          0x000143aa,
386 };
387
388 static struct w100_mode e740_lcd_mode = {
389         .xres            = 240,
390         .yres            = 320,
391         .left_margin     = 20,
392         .right_margin    = 28,
393         .upper_margin    = 9,
394         .lower_margin    = 8,
395         .crtc_ss         = 0x80140013,
396         .crtc_ls         = 0x81150110,
397         .crtc_gs         = 0x80050005,
398         .crtc_vpos_gs    = 0x000a0009,
399         .crtc_rev        = 0x0040010a,
400         .crtc_dclk       = 0xa906000a,
401         .crtc_gclk       = 0x80050108,
402         .crtc_goe        = 0x80050108,
403         .pll_freq        = 57,
404         .pixclk_divider         = 4,
405         .pixclk_divider_rotated = 4,
406         .pixclk_src     = CLK_SRC_XTAL,
407         .sysclk_divider  = 1,
408         .sysclk_src     = CLK_SRC_PLL,
409         .crtc_ps1_active =       0x41060010,
410 };
411
412 static struct w100_gpio_regs e740_w100_gpio_info = {
413         .init_data1 = 0x21002103,
414         .gpio_dir1  = 0xffffdeff,
415         .gpio_oe1   = 0x03c00643,
416         .init_data2 = 0x003f003f,
417         .gpio_dir2  = 0xffffffff,
418         .gpio_oe2   = 0x000000ff,
419 };
420
421 static struct w100fb_mach_info e740_fb_info = {
422         .modelist   = &e740_lcd_mode,
423         .num_modes  = 1,
424         .regs       = &e740_lcd_regs,
425         .gpio       = &e740_w100_gpio_info,
426         .xtal_freq = 14318000,
427         .xtal_dbl   = 1,
428 };
429
430 static struct resource e740_fb_resources[] = {
431         [0] = {
432                 .start          = 0x0c000000,
433                 .end            = 0x0cffffff,
434                 .flags          = IORESOURCE_MEM,
435         },
436 };
437
438 static struct platform_device e740_fb_device = {
439         .name           = "w100fb",
440         .id             = -1,
441         .dev            = {
442                 .platform_data  = &e740_fb_info,
443         },
444         .num_resources  = ARRAY_SIZE(e740_fb_resources),
445         .resource       = e740_fb_resources,
446 };
447
448 /* --------------------------- MFP Pin config -------------------------- */
449
450 static unsigned long e740_pin_config[] __initdata = {
451         /* Chip selects */
452         GPIO15_nCS_1,   /* CS1 - Flash */
453         GPIO79_nCS_3,   /* CS3 - IMAGEON */
454         GPIO80_nCS_4,   /* CS4 - TMIO */
455
456         /* Clocks */
457         GPIO12_32KHz,
458
459         /* BTUART */
460         GPIO42_BTUART_RXD,
461         GPIO43_BTUART_TXD,
462         GPIO44_BTUART_CTS,
463
464         /* TMIO controller */
465         GPIO19_GPIO, /* t7l66xb #PCLR */
466         GPIO45_GPIO, /* t7l66xb #SUSPEND (NOT BTUART!) */
467
468         /* UDC */
469         GPIO13_GPIO,
470         GPIO3_GPIO,
471
472         /* IrDA */
473         GPIO38_GPIO | MFP_LPM_DRIVE_HIGH,
474
475         /* AC97 */
476         GPIO28_AC97_BITCLK,
477         GPIO29_AC97_SDATA_IN_0,
478         GPIO30_AC97_SDATA_OUT,
479         GPIO31_AC97_SYNC,
480
481         /* Audio power control */
482         GPIO16_GPIO,  /* AC97 codec AVDD2 supply (analogue power) */
483         GPIO40_GPIO,  /* Mic amp power */
484         GPIO41_GPIO,  /* Headphone amp power */
485
486         /* PC Card */
487         GPIO8_GPIO,   /* CD0 */
488         GPIO44_GPIO,  /* CD1 */
489         GPIO11_GPIO,  /* IRQ0 */
490         GPIO6_GPIO,   /* IRQ1 */
491         GPIO27_GPIO,  /* RST0 */
492         GPIO24_GPIO,  /* RST1 */
493         GPIO20_GPIO,  /* PWR0 */
494         GPIO23_GPIO,  /* PWR1 */
495         GPIO48_nPOE,
496         GPIO49_nPWE,
497         GPIO50_nPIOR,
498         GPIO51_nPIOW,
499         GPIO52_nPCE_1,
500         GPIO53_nPCE_2,
501         GPIO54_nPSKTSEL,
502         GPIO55_nPREG,
503         GPIO56_nPWAIT,
504         GPIO57_nIOIS16,
505
506         /* wakeup */
507         GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
508 };
509
510 /* -------------------- e740 t7l66xb parameters -------------------- */
511
512 static struct t7l66xb_platform_data e740_t7l66xb_info = {
513         .irq_base               = IRQ_BOARD_START,
514         .enable                 = &eseries_tmio_enable,
515         .suspend                = &eseries_tmio_suspend,
516         .resume                 = &eseries_tmio_resume,
517 };
518
519 static struct platform_device e740_t7l66xb_device = {
520         .name           = "t7l66xb",
521         .id             = -1,
522         .dev            = {
523                 .platform_data = &e740_t7l66xb_info,
524         },
525         .num_resources = 2,
526         .resource      = eseries_tmio_resources,
527 };
528
529 /* ----------------------------------------------------------------------- */
530
531 static struct platform_device *e740_devices[] __initdata = {
532         &e740_fb_device,
533         &e740_t7l66xb_device,
534         &e7xx_gpio_vbus,
535 };
536
537 static void __init e740_init(void)
538 {
539         pxa2xx_mfp_config(ARRAY_AND_SIZE(e740_pin_config));
540         pxa_set_ffuart_info(NULL);
541         pxa_set_btuart_info(NULL);
542         pxa_set_stuart_info(NULL);
543         eseries_register_clks();
544         clk_add_alias("CLK_CK48M", e740_t7l66xb_device.name,
545                         "UDCCLK", &pxa25x_device_udc.dev),
546         eseries_get_tmio_gpios();
547         platform_add_devices(ARRAY_AND_SIZE(e740_devices));
548         pxa_set_ac97_info(NULL);
549         pxa_set_ficp_info(&e7xx_ficp_platform_data);
550 }
551
552 MACHINE_START(E740, "Toshiba e740")
553         /* Maintainer: Ian Molton (spyro@f2s.com) */
554         .boot_params    = 0xa0000100,
555         .map_io         = pxa25x_map_io,
556         .nr_irqs        = ESERIES_NR_IRQS,
557         .init_irq       = pxa25x_init_irq,
558         .handle_irq     = pxa25x_handle_irq,
559         .fixup          = eseries_fixup,
560         .init_machine   = e740_init,
561         .timer          = &pxa_timer,
562 MACHINE_END
563 #endif
564
565 #ifdef CONFIG_MACH_E750
566 /* ---------------------- E750 LCD definitions -------------------- */
567
568 static struct w100_gen_regs e750_lcd_regs = {
569         .lcd_format =            0x00008003,
570         .lcdd_cntl1 =            0x00000000,
571         .lcdd_cntl2 =            0x0003ffff,
572         .genlcd_cntl1 =          0x00fff003,
573         .genlcd_cntl2 =          0x003c0f03,
574         .genlcd_cntl3 =          0x000143aa,
575 };
576
577 static struct w100_mode e750_lcd_mode = {
578         .xres            = 240,
579         .yres            = 320,
580         .left_margin     = 21,
581         .right_margin    = 22,
582         .upper_margin    = 5,
583         .lower_margin    = 4,
584         .crtc_ss         = 0x80150014,
585         .crtc_ls         = 0x8014000d,
586         .crtc_gs         = 0xc1000005,
587         .crtc_vpos_gs    = 0x00020147,
588         .crtc_rev        = 0x0040010a,
589         .crtc_dclk       = 0xa1700030,
590         .crtc_gclk       = 0x80cc0015,
591         .crtc_goe        = 0x80cc0015,
592         .crtc_ps1_active = 0x61060017,
593         .pll_freq        = 57,
594         .pixclk_divider         = 4,
595         .pixclk_divider_rotated = 4,
596         .pixclk_src     = CLK_SRC_XTAL,
597         .sysclk_divider  = 1,
598         .sysclk_src     = CLK_SRC_PLL,
599 };
600
601 static struct w100_gpio_regs e750_w100_gpio_info = {
602         .init_data1 = 0x01192f1b,
603         .gpio_dir1  = 0xd5ffdeff,
604         .gpio_oe1   = 0x000020bf,
605         .init_data2 = 0x010f010f,
606         .gpio_dir2  = 0xffffffff,
607         .gpio_oe2   = 0x000001cf,
608 };
609
610 static struct w100fb_mach_info e750_fb_info = {
611         .modelist   = &e750_lcd_mode,
612         .num_modes  = 1,
613         .regs       = &e750_lcd_regs,
614         .gpio       = &e750_w100_gpio_info,
615         .xtal_freq  = 14318000,
616         .xtal_dbl   = 1,
617 };
618
619 static struct resource e750_fb_resources[] = {
620         [0] = {
621                 .start          = 0x0c000000,
622                 .end            = 0x0cffffff,
623                 .flags          = IORESOURCE_MEM,
624         },
625 };
626
627 static struct platform_device e750_fb_device = {
628         .name           = "w100fb",
629         .id             = -1,
630         .dev            = {
631                 .platform_data  = &e750_fb_info,
632         },
633         .num_resources  = ARRAY_SIZE(e750_fb_resources),
634         .resource       = e750_fb_resources,
635 };
636
637 /* -------------------- e750 MFP parameters -------------------- */
638
639 static unsigned long e750_pin_config[] __initdata = {
640         /* Chip selects */
641         GPIO15_nCS_1,   /* CS1 - Flash */
642         GPIO79_nCS_3,   /* CS3 - IMAGEON */
643         GPIO80_nCS_4,   /* CS4 - TMIO */
644
645         /* Clocks */
646         GPIO11_3_6MHz,
647
648         /* BTUART */
649         GPIO42_BTUART_RXD,
650         GPIO43_BTUART_TXD,
651         GPIO44_BTUART_CTS,
652
653         /* TMIO controller */
654         GPIO19_GPIO, /* t7l66xb #PCLR */
655         GPIO45_GPIO, /* t7l66xb #SUSPEND (NOT BTUART!) */
656
657         /* UDC */
658         GPIO13_GPIO,
659         GPIO3_GPIO,
660
661         /* IrDA */
662         GPIO38_GPIO | MFP_LPM_DRIVE_HIGH,
663
664         /* AC97 */
665         GPIO28_AC97_BITCLK,
666         GPIO29_AC97_SDATA_IN_0,
667         GPIO30_AC97_SDATA_OUT,
668         GPIO31_AC97_SYNC,
669
670         /* Audio power control */
671         GPIO4_GPIO,  /* Headphone amp power */
672         GPIO7_GPIO,  /* Speaker amp power */
673         GPIO37_GPIO, /* Headphone detect */
674
675         /* PC Card */
676         GPIO8_GPIO,   /* CD0 */
677         GPIO44_GPIO,  /* CD1 */
678         GPIO11_GPIO,  /* IRQ0 */
679         GPIO6_GPIO,   /* IRQ1 */
680         GPIO27_GPIO,  /* RST0 */
681         GPIO24_GPIO,  /* RST1 */
682         GPIO20_GPIO,  /* PWR0 */
683         GPIO23_GPIO,  /* PWR1 */
684         GPIO48_nPOE,
685         GPIO49_nPWE,
686         GPIO50_nPIOR,
687         GPIO51_nPIOW,
688         GPIO52_nPCE_1,
689         GPIO53_nPCE_2,
690         GPIO54_nPSKTSEL,
691         GPIO55_nPREG,
692         GPIO56_nPWAIT,
693         GPIO57_nIOIS16,
694
695         /* wakeup */
696         GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
697 };
698
699 /* ----------------- e750 tc6393xb parameters ------------------ */
700
701 static struct tc6393xb_platform_data e750_tc6393xb_info = {
702         .irq_base       = IRQ_BOARD_START,
703         .scr_pll2cr     = 0x0cc1,
704         .scr_gper       = 0,
705         .gpio_base      = -1,
706         .suspend        = &eseries_tmio_suspend,
707         .resume         = &eseries_tmio_resume,
708         .enable         = &eseries_tmio_enable,
709         .disable        = &eseries_tmio_disable,
710 };
711
712 static struct platform_device e750_tc6393xb_device = {
713         .name           = "tc6393xb",
714         .id             = -1,
715         .dev            = {
716                 .platform_data = &e750_tc6393xb_info,
717         },
718         .num_resources = 2,
719         .resource      = eseries_tmio_resources,
720 };
721
722 /* ------------------------------------------------------------- */
723
724 static struct platform_device *e750_devices[] __initdata = {
725         &e750_fb_device,
726         &e750_tc6393xb_device,
727         &e7xx_gpio_vbus,
728 };
729
730 static void __init e750_init(void)
731 {
732         pxa2xx_mfp_config(ARRAY_AND_SIZE(e750_pin_config));
733         pxa_set_ffuart_info(NULL);
734         pxa_set_btuart_info(NULL);
735         pxa_set_stuart_info(NULL);
736         clk_add_alias("CLK_CK3P6MI", e750_tc6393xb_device.name,
737                         "GPIO11_CLK", NULL),
738         eseries_get_tmio_gpios();
739         platform_add_devices(ARRAY_AND_SIZE(e750_devices));
740         pxa_set_ac97_info(NULL);
741         pxa_set_ficp_info(&e7xx_ficp_platform_data);
742 }
743
744 MACHINE_START(E750, "Toshiba e750")
745         /* Maintainer: Ian Molton (spyro@f2s.com) */
746         .boot_params    = 0xa0000100,
747         .map_io         = pxa25x_map_io,
748         .nr_irqs        = ESERIES_NR_IRQS,
749         .init_irq       = pxa25x_init_irq,
750         .handle_irq     = pxa25x_handle_irq,
751         .fixup          = eseries_fixup,
752         .init_machine   = e750_init,
753         .timer          = &pxa_timer,
754 MACHINE_END
755 #endif
756
757 #ifdef CONFIG_MACH_E800
758 /* ------------------------ e800 LCD definitions ------------------------- */
759
760 static unsigned long e800_pin_config[] __initdata = {
761         /* AC97 */
762         GPIO28_AC97_BITCLK,
763         GPIO29_AC97_SDATA_IN_0,
764         GPIO30_AC97_SDATA_OUT,
765         GPIO31_AC97_SYNC,
766 };
767
768 static struct w100_gen_regs e800_lcd_regs = {
769         .lcd_format =            0x00008003,
770         .lcdd_cntl1 =            0x02a00000,
771         .lcdd_cntl2 =            0x0003ffff,
772         .genlcd_cntl1 =          0x000ff2a3,
773         .genlcd_cntl2 =          0x000002a3,
774         .genlcd_cntl3 =          0x000102aa,
775 };
776
777 static struct w100_mode e800_lcd_mode[2] = {
778         [0] = {
779                 .xres            = 480,
780                 .yres            = 640,
781                 .left_margin     = 52,
782                 .right_margin    = 148,
783                 .upper_margin    = 2,
784                 .lower_margin    = 6,
785                 .crtc_ss         = 0x80350034,
786                 .crtc_ls         = 0x802b0026,
787                 .crtc_gs         = 0x80160016,
788                 .crtc_vpos_gs    = 0x00020003,
789                 .crtc_rev        = 0x0040001d,
790                 .crtc_dclk       = 0xe0000000,
791                 .crtc_gclk       = 0x82a50049,
792                 .crtc_goe        = 0x80ee001c,
793                 .crtc_ps1_active = 0x00000000,
794                 .pll_freq        = 128,
795                 .pixclk_divider         = 4,
796                 .pixclk_divider_rotated = 6,
797                 .pixclk_src     = CLK_SRC_PLL,
798                 .sysclk_divider  = 0,
799                 .sysclk_src     = CLK_SRC_PLL,
800         },
801         [1] = {
802                 .xres            = 240,
803                 .yres            = 320,
804                 .left_margin     = 15,
805                 .right_margin    = 88,
806                 .upper_margin    = 0,
807                 .lower_margin    = 7,
808                 .crtc_ss         = 0xd010000f,
809                 .crtc_ls         = 0x80070003,
810                 .crtc_gs         = 0x80000000,
811                 .crtc_vpos_gs    = 0x01460147,
812                 .crtc_rev        = 0x00400003,
813                 .crtc_dclk       = 0xa1700030,
814                 .crtc_gclk       = 0x814b0008,
815                 .crtc_goe        = 0x80cc0015,
816                 .crtc_ps1_active = 0x00000000,
817                 .pll_freq        = 100,
818                 .pixclk_divider         = 6, /* Wince uses 14 which gives a */
819                 .pixclk_divider_rotated = 6, /* 7MHz Pclk. We use a 14MHz one */
820                 .pixclk_src     = CLK_SRC_PLL,
821                 .sysclk_divider  = 0,
822                 .sysclk_src     = CLK_SRC_PLL,
823         }
824 };
825
826
827 static struct w100_gpio_regs e800_w100_gpio_info = {
828         .init_data1 = 0xc13fc019,
829         .gpio_dir1  = 0x3e40df7f,
830         .gpio_oe1   = 0x003c3000,
831         .init_data2 = 0x00000000,
832         .gpio_dir2  = 0x00000000,
833         .gpio_oe2   = 0x00000000,
834 };
835
836 static struct w100_mem_info e800_w100_mem_info = {
837         .ext_cntl        = 0x09640011,
838         .sdram_mode_reg  = 0x00600021,
839         .ext_timing_cntl = 0x10001545,
840         .io_cntl         = 0x7ddd7333,
841         .size            = 0x1fffff,
842 };
843
844 static void e800_tg_change(struct w100fb_par *par)
845 {
846         unsigned long tmp;
847
848         tmp = w100fb_gpio_read(W100_GPIO_PORT_A);
849         if (par->mode->xres == 480)
850                 tmp |= 0x100;
851         else
852                 tmp &= ~0x100;
853         w100fb_gpio_write(W100_GPIO_PORT_A, tmp);
854 }
855
856 static struct w100_tg_info e800_tg_info = {
857         .change = e800_tg_change,
858 };
859
860 static struct w100fb_mach_info e800_fb_info = {
861         .modelist   = e800_lcd_mode,
862         .num_modes  = 2,
863         .regs       = &e800_lcd_regs,
864         .gpio       = &e800_w100_gpio_info,
865         .mem        = &e800_w100_mem_info,
866         .tg         = &e800_tg_info,
867         .xtal_freq  = 16000000,
868 };
869
870 static struct resource e800_fb_resources[] = {
871         [0] = {
872                 .start          = 0x0c000000,
873                 .end            = 0x0cffffff,
874                 .flags          = IORESOURCE_MEM,
875         },
876 };
877
878 static struct platform_device e800_fb_device = {
879         .name           = "w100fb",
880         .id             = -1,
881         .dev            = {
882                 .platform_data  = &e800_fb_info,
883         },
884         .num_resources  = ARRAY_SIZE(e800_fb_resources),
885         .resource       = e800_fb_resources,
886 };
887
888 /* --------------------------- UDC definitions --------------------------- */
889
890 static struct gpio_vbus_mach_info e800_udc_info = {
891         .gpio_vbus   = GPIO_E800_USB_DISC,
892         .gpio_pullup = GPIO_E800_USB_PULLUP,
893         .gpio_pullup_inverted = 1
894 };
895
896 static struct platform_device e800_gpio_vbus = {
897         .name   = "gpio-vbus",
898         .id     = -1,
899         .dev    = {
900                 .platform_data  = &e800_udc_info,
901         },
902 };
903
904
905 /* ----------------- e800 tc6393xb parameters ------------------ */
906
907 static struct tc6393xb_platform_data e800_tc6393xb_info = {
908         .irq_base       = IRQ_BOARD_START,
909         .scr_pll2cr     = 0x0cc1,
910         .scr_gper       = 0,
911         .gpio_base      = -1,
912         .suspend        = &eseries_tmio_suspend,
913         .resume         = &eseries_tmio_resume,
914         .enable         = &eseries_tmio_enable,
915         .disable        = &eseries_tmio_disable,
916 };
917
918 static struct platform_device e800_tc6393xb_device = {
919         .name           = "tc6393xb",
920         .id             = -1,
921         .dev            = {
922                 .platform_data = &e800_tc6393xb_info,
923         },
924         .num_resources = 2,
925         .resource      = eseries_tmio_resources,
926 };
927
928 /* ----------------------------------------------------------------------- */
929
930 static struct platform_device *e800_devices[] __initdata = {
931         &e800_fb_device,
932         &e800_tc6393xb_device,
933         &e800_gpio_vbus,
934 };
935
936 static void __init e800_init(void)
937 {
938         pxa2xx_mfp_config(ARRAY_AND_SIZE(e800_pin_config));
939         pxa_set_ffuart_info(NULL);
940         pxa_set_btuart_info(NULL);
941         pxa_set_stuart_info(NULL);
942         clk_add_alias("CLK_CK3P6MI", e800_tc6393xb_device.name,
943                         "GPIO11_CLK", NULL),
944         eseries_get_tmio_gpios();
945         platform_add_devices(ARRAY_AND_SIZE(e800_devices));
946         pxa_set_ac97_info(NULL);
947 }
948
949 MACHINE_START(E800, "Toshiba e800")
950         /* Maintainer: Ian Molton (spyro@f2s.com) */
951         .boot_params    = 0xa0000100,
952         .map_io         = pxa25x_map_io,
953         .nr_irqs        = ESERIES_NR_IRQS,
954         .init_irq       = pxa25x_init_irq,
955         .handle_irq     = pxa25x_handle_irq,
956         .fixup          = eseries_fixup,
957         .init_machine   = e800_init,
958         .timer          = &pxa_timer,
959 MACHINE_END
960 #endif