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