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