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