mfd: tc6393xb: Make disable callback return void
[linux-2.6-microblaze.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/clkdev.h>
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/clk-provider.h>
17 #include <linux/gpio/machine.h>
18 #include <linux/gpio.h>
19 #include <linux/delay.h>
20 #include <linux/platform_device.h>
21 #include <linux/mfd/tc6387xb.h>
22 #include <linux/mfd/tc6393xb.h>
23 #include <linux/mfd/t7l66xb.h>
24 #include <linux/mtd/rawnand.h>
25 #include <linux/mtd/partitions.h>
26 #include <linux/memblock.h>
27 #include <linux/gpio/machine.h>
28
29 #include <video/w100fb.h>
30
31 #include <asm/setup.h>
32 #include <asm/mach/arch.h>
33 #include <asm/mach-types.h>
34
35 #include "pxa25x.h"
36 #include "eseries-gpio.h"
37 #include "eseries-irq.h"
38 #include <linux/platform_data/asoc-pxa.h>
39 #include <linux/platform_data/video-pxafb.h>
40 #include "udc.h"
41 #include <linux/platform_data/irda-pxaficp.h>
42
43 #include "devices.h"
44 #include "generic.h"
45
46 /* Only e800 has 128MB RAM */
47 void __init eseries_fixup(struct tag *tags, char **cmdline)
48 {
49         if (machine_is_e800())
50                 memblock_add(0xa0000000, SZ_128M);
51         else
52                 memblock_add(0xa0000000, SZ_64M);
53 }
54
55 static struct gpiod_lookup_table e7xx_gpio_vbus_gpiod_table __maybe_unused = {
56         .dev_id = "gpio-vbus",
57         .table = {
58                 GPIO_LOOKUP("gpio-pxa", GPIO_E7XX_USB_DISC,
59                             "vbus", GPIO_ACTIVE_HIGH),
60                 GPIO_LOOKUP("gpio-pxa", GPIO_E7XX_USB_PULLUP,
61                             "pullup", GPIO_ACTIVE_LOW),
62                 { },
63         },
64 };
65
66 static struct platform_device e7xx_gpio_vbus __maybe_unused = {
67         .name   = "gpio-vbus",
68         .id     = -1,
69 };
70
71 struct pxaficp_platform_data e7xx_ficp_platform_data = {
72         .gpio_pwdown            = GPIO_E7XX_IR_OFF,
73         .transceiver_cap        = IR_SIRMODE | IR_OFF,
74 };
75
76 int eseries_tmio_enable(struct platform_device *dev)
77 {
78         /* Reset - bring SUSPEND high before PCLR */
79         gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
80         gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
81         msleep(1);
82         gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
83         msleep(1);
84         gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 1);
85         msleep(1);
86         return 0;
87 }
88
89 void eseries_tmio_disable(struct platform_device *dev)
90 {
91         gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
92         gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0);
93 }
94
95 int eseries_tmio_suspend(struct platform_device *dev)
96 {
97         gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0);
98         return 0;
99 }
100
101 int eseries_tmio_resume(struct platform_device *dev)
102 {
103         gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1);
104         msleep(1);
105         return 0;
106 }
107
108 void eseries_get_tmio_gpios(void)
109 {
110         gpio_request(GPIO_ESERIES_TMIO_SUSPEND, NULL);
111         gpio_request(GPIO_ESERIES_TMIO_PCLR, NULL);
112         gpio_direction_output(GPIO_ESERIES_TMIO_SUSPEND, 0);
113         gpio_direction_output(GPIO_ESERIES_TMIO_PCLR, 0);
114 }
115
116 /* TMIO controller uses the same resources on all e-series machines. */
117 struct resource eseries_tmio_resources[] = {
118         [0] = {
119                 .start  = PXA_CS4_PHYS,
120                 .end    = PXA_CS4_PHYS + 0x1fffff,
121                 .flags  = IORESOURCE_MEM,
122         },
123         [1] = {
124                 .start  = PXA_GPIO_TO_IRQ(GPIO_ESERIES_TMIO_IRQ),
125                 .end    = PXA_GPIO_TO_IRQ(GPIO_ESERIES_TMIO_IRQ),
126                 .flags  = IORESOURCE_IRQ,
127         },
128 };
129
130 /* Some e-series hardware cannot control the 32K clock */
131 static void __init __maybe_unused eseries_register_clks(void)
132 {
133         clk_register_fixed_rate(NULL, "CLK_CK32K", NULL, 0, 32768);
134 }
135
136 #ifdef CONFIG_MACH_E330
137 /* -------------------- e330 tc6387xb parameters -------------------- */
138
139 static struct tc6387xb_platform_data e330_tc6387xb_info = {
140         .enable   = &eseries_tmio_enable,
141         .suspend  = &eseries_tmio_suspend,
142         .resume   = &eseries_tmio_resume,
143 };
144
145 static struct platform_device e330_tc6387xb_device = {
146         .name           = "tc6387xb",
147         .id             = -1,
148         .dev            = {
149                 .platform_data = &e330_tc6387xb_info,
150         },
151         .num_resources = 2,
152         .resource      = eseries_tmio_resources,
153 };
154
155 /* --------------------------------------------------------------- */
156
157 static struct platform_device *e330_devices[] __initdata = {
158         &e330_tc6387xb_device,
159         &e7xx_gpio_vbus,
160 };
161
162 static void __init e330_init(void)
163 {
164         pxa_set_ffuart_info(NULL);
165         pxa_set_btuart_info(NULL);
166         pxa_set_stuart_info(NULL);
167         eseries_register_clks();
168         eseries_get_tmio_gpios();
169         gpiod_add_lookup_table(&e7xx_gpio_vbus_gpiod_table);
170         platform_add_devices(ARRAY_AND_SIZE(e330_devices));
171 }
172
173 MACHINE_START(E330, "Toshiba e330")
174         /* Maintainer: Ian Molton (spyro@f2s.com) */
175         .atag_offset    = 0x100,
176         .map_io         = pxa25x_map_io,
177         .nr_irqs        = ESERIES_NR_IRQS,
178         .init_irq       = pxa25x_init_irq,
179         .handle_irq     = pxa25x_handle_irq,
180         .fixup          = eseries_fixup,
181         .init_machine   = e330_init,
182         .init_time      = pxa_timer_init,
183         .restart        = pxa_restart,
184 MACHINE_END
185 #endif
186
187 #ifdef CONFIG_MACH_E350
188 /* -------------------- e350 t7l66xb parameters -------------------- */
189
190 static struct t7l66xb_platform_data e350_t7l66xb_info = {
191         .irq_base               = IRQ_BOARD_START,
192         .enable                 = &eseries_tmio_enable,
193         .suspend                = &eseries_tmio_suspend,
194         .resume                 = &eseries_tmio_resume,
195 };
196
197 static struct platform_device e350_t7l66xb_device = {
198         .name           = "t7l66xb",
199         .id             = -1,
200         .dev            = {
201                 .platform_data = &e350_t7l66xb_info,
202         },
203         .num_resources = 2,
204         .resource      = eseries_tmio_resources,
205 };
206
207 /* ---------------------------------------------------------- */
208
209 static struct platform_device *e350_devices[] __initdata = {
210         &e350_t7l66xb_device,
211         &e7xx_gpio_vbus,
212 };
213
214 static void __init e350_init(void)
215 {
216         pxa_set_ffuart_info(NULL);
217         pxa_set_btuart_info(NULL);
218         pxa_set_stuart_info(NULL);
219         eseries_register_clks();
220         eseries_get_tmio_gpios();
221         gpiod_add_lookup_table(&e7xx_gpio_vbus_gpiod_table);
222         platform_add_devices(ARRAY_AND_SIZE(e350_devices));
223 }
224
225 MACHINE_START(E350, "Toshiba e350")
226         /* Maintainer: Ian Molton (spyro@f2s.com) */
227         .atag_offset    = 0x100,
228         .map_io         = pxa25x_map_io,
229         .nr_irqs        = ESERIES_NR_IRQS,
230         .init_irq       = pxa25x_init_irq,
231         .handle_irq     = pxa25x_handle_irq,
232         .fixup          = eseries_fixup,
233         .init_machine   = e350_init,
234         .init_time      = pxa_timer_init,
235         .restart        = pxa_restart,
236 MACHINE_END
237 #endif
238
239 #ifdef CONFIG_MACH_E400
240 /* ------------------------ E400 LCD definitions ------------------------ */
241
242 static struct pxafb_mode_info e400_pxafb_mode_info = {
243         .pixclock       = 140703,
244         .xres           = 240,
245         .yres           = 320,
246         .bpp            = 16,
247         .hsync_len      = 4,
248         .left_margin    = 28,
249         .right_margin   = 8,
250         .vsync_len      = 3,
251         .upper_margin   = 5,
252         .lower_margin   = 6,
253         .sync           = 0,
254 };
255
256 static struct pxafb_mach_info e400_pxafb_mach_info = {
257         .modes          = &e400_pxafb_mode_info,
258         .num_modes      = 1,
259         .lcd_conn       = LCD_COLOR_TFT_16BPP,
260         .lccr3          = 0,
261         .pxafb_backlight_power  = NULL,
262 };
263
264 /* ------------------------ E400 MFP config ----------------------------- */
265
266 static unsigned long e400_pin_config[] __initdata = {
267         /* Chip selects */
268         GPIO15_nCS_1,   /* CS1 - Flash */
269         GPIO80_nCS_4,   /* CS4 - TMIO */
270
271         /* Clocks */
272         GPIO12_32KHz,
273
274         /* BTUART */
275         GPIO42_BTUART_RXD,
276         GPIO43_BTUART_TXD,
277         GPIO44_BTUART_CTS,
278
279         /* TMIO controller */
280         GPIO19_GPIO, /* t7l66xb #PCLR */
281         GPIO45_GPIO, /* t7l66xb #SUSPEND (NOT BTUART!) */
282
283         /* wakeup */
284         GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
285 };
286
287 /* ---------------------------------------------------------------------- */
288
289 static struct mtd_partition partition_a = {
290         .name = "Internal NAND flash",
291         .offset =  0,
292         .size =  MTDPART_SIZ_FULL,
293 };
294
295 static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
296
297 static struct nand_bbt_descr e400_t7l66xb_nand_bbt = {
298         .options = 0,
299         .offs = 4,
300         .len = 2,
301         .pattern = scan_ff_pattern
302 };
303
304 static struct tmio_nand_data e400_t7l66xb_nand_config = {
305         .num_partitions = 1,
306         .partition = &partition_a,
307         .badblock_pattern = &e400_t7l66xb_nand_bbt,
308 };
309
310 static struct t7l66xb_platform_data e400_t7l66xb_info = {
311         .irq_base               = IRQ_BOARD_START,
312         .enable                 = &eseries_tmio_enable,
313         .suspend                = &eseries_tmio_suspend,
314         .resume                 = &eseries_tmio_resume,
315
316         .nand_data              = &e400_t7l66xb_nand_config,
317 };
318
319 static struct platform_device e400_t7l66xb_device = {
320         .name           = "t7l66xb",
321         .id             = -1,
322         .dev            = {
323                 .platform_data = &e400_t7l66xb_info,
324         },
325         .num_resources = 2,
326         .resource      = eseries_tmio_resources,
327 };
328
329 /* ---------------------------------------------------------- */
330
331 static struct platform_device *e400_devices[] __initdata = {
332         &e400_t7l66xb_device,
333         &e7xx_gpio_vbus,
334 };
335
336 static void __init e400_init(void)
337 {
338         pxa2xx_mfp_config(ARRAY_AND_SIZE(e400_pin_config));
339         pxa_set_ffuart_info(NULL);
340         pxa_set_btuart_info(NULL);
341         pxa_set_stuart_info(NULL);
342         /* Fixme - e400 may have a switched clock */
343         eseries_register_clks();
344         eseries_get_tmio_gpios();
345         pxa_set_fb_info(NULL, &e400_pxafb_mach_info);
346         gpiod_add_lookup_table(&e7xx_gpio_vbus_gpiod_table);
347         platform_add_devices(ARRAY_AND_SIZE(e400_devices));
348 }
349
350 MACHINE_START(E400, "Toshiba e400")
351         /* Maintainer: Ian Molton (spyro@f2s.com) */
352         .atag_offset    = 0x100,
353         .map_io         = pxa25x_map_io,
354         .nr_irqs        = ESERIES_NR_IRQS,
355         .init_irq       = pxa25x_init_irq,
356         .handle_irq     = pxa25x_handle_irq,
357         .fixup          = eseries_fixup,
358         .init_machine   = e400_init,
359         .init_time      = pxa_timer_init,
360         .restart        = pxa_restart,
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 static struct platform_device e740_audio_device = {
518         .name           = "e740-audio",
519         .id             = -1,
520 };
521
522 static struct gpiod_lookup_table e740_audio_gpio_table = {
523         .dev_id = "e740-audio",
524         .table = {
525                 GPIO_LOOKUP("gpio-pxa",  GPIO_E740_WM9705_nAVDD2, "Audio power",  GPIO_ACTIVE_HIGH),
526                 GPIO_LOOKUP("gpio-pxa",  GPIO_E740_AMP_ON, "Output amp",  GPIO_ACTIVE_HIGH),
527                 GPIO_LOOKUP("gpio-pxa",  GPIO_E740_MIC_ON, "Mic amp", GPIO_ACTIVE_HIGH),
528                 { },
529         },
530 };
531
532 /* ----------------------------------------------------------------------- */
533
534 static struct platform_device *e740_devices[] __initdata = {
535         &e740_fb_device,
536         &e740_t7l66xb_device,
537         &e7xx_gpio_vbus,
538         &e740_audio_device,
539 };
540
541 static void __init e740_init(void)
542 {
543         pxa2xx_mfp_config(ARRAY_AND_SIZE(e740_pin_config));
544         pxa_set_ffuart_info(NULL);
545         pxa_set_btuart_info(NULL);
546         pxa_set_stuart_info(NULL);
547         eseries_register_clks();
548         clk_add_alias("CLK_CK48M", e740_t7l66xb_device.name,
549                         "UDCCLK", &pxa25x_device_udc.dev),
550         eseries_get_tmio_gpios();
551         gpiod_add_lookup_table(&e7xx_gpio_vbus_gpiod_table);
552         gpiod_add_lookup_table(&e740_audio_gpio_table);
553         platform_add_devices(ARRAY_AND_SIZE(e740_devices));
554         pxa_set_ac97_info(NULL);
555         pxa_set_ficp_info(&e7xx_ficp_platform_data);
556 }
557
558 MACHINE_START(E740, "Toshiba e740")
559         /* Maintainer: Ian Molton (spyro@f2s.com) */
560         .atag_offset    = 0x100,
561         .map_io         = pxa25x_map_io,
562         .nr_irqs        = ESERIES_NR_IRQS,
563         .init_irq       = pxa25x_init_irq,
564         .handle_irq     = pxa25x_handle_irq,
565         .fixup          = eseries_fixup,
566         .init_machine   = e740_init,
567         .init_time      = pxa_timer_init,
568         .restart        = pxa_restart,
569 MACHINE_END
570 #endif
571
572 #ifdef CONFIG_MACH_E750
573 /* ---------------------- E750 LCD definitions -------------------- */
574
575 static struct w100_gen_regs e750_lcd_regs = {
576         .lcd_format =            0x00008003,
577         .lcdd_cntl1 =            0x00000000,
578         .lcdd_cntl2 =            0x0003ffff,
579         .genlcd_cntl1 =          0x00fff003,
580         .genlcd_cntl2 =          0x003c0f03,
581         .genlcd_cntl3 =          0x000143aa,
582 };
583
584 static struct w100_mode e750_lcd_mode = {
585         .xres            = 240,
586         .yres            = 320,
587         .left_margin     = 21,
588         .right_margin    = 22,
589         .upper_margin    = 5,
590         .lower_margin    = 4,
591         .crtc_ss         = 0x80150014,
592         .crtc_ls         = 0x8014000d,
593         .crtc_gs         = 0xc1000005,
594         .crtc_vpos_gs    = 0x00020147,
595         .crtc_rev        = 0x0040010a,
596         .crtc_dclk       = 0xa1700030,
597         .crtc_gclk       = 0x80cc0015,
598         .crtc_goe        = 0x80cc0015,
599         .crtc_ps1_active = 0x61060017,
600         .pll_freq        = 57,
601         .pixclk_divider         = 4,
602         .pixclk_divider_rotated = 4,
603         .pixclk_src     = CLK_SRC_XTAL,
604         .sysclk_divider  = 1,
605         .sysclk_src     = CLK_SRC_PLL,
606 };
607
608 static struct w100_gpio_regs e750_w100_gpio_info = {
609         .init_data1 = 0x01192f1b,
610         .gpio_dir1  = 0xd5ffdeff,
611         .gpio_oe1   = 0x000020bf,
612         .init_data2 = 0x010f010f,
613         .gpio_dir2  = 0xffffffff,
614         .gpio_oe2   = 0x000001cf,
615 };
616
617 static struct w100fb_mach_info e750_fb_info = {
618         .modelist   = &e750_lcd_mode,
619         .num_modes  = 1,
620         .regs       = &e750_lcd_regs,
621         .gpio       = &e750_w100_gpio_info,
622         .xtal_freq  = 14318000,
623         .xtal_dbl   = 1,
624 };
625
626 static struct resource e750_fb_resources[] = {
627         [0] = {
628                 .start          = 0x0c000000,
629                 .end            = 0x0cffffff,
630                 .flags          = IORESOURCE_MEM,
631         },
632 };
633
634 static struct platform_device e750_fb_device = {
635         .name           = "w100fb",
636         .id             = -1,
637         .dev            = {
638                 .platform_data  = &e750_fb_info,
639         },
640         .num_resources  = ARRAY_SIZE(e750_fb_resources),
641         .resource       = e750_fb_resources,
642 };
643
644 /* -------------------- e750 MFP parameters -------------------- */
645
646 static unsigned long e750_pin_config[] __initdata = {
647         /* Chip selects */
648         GPIO15_nCS_1,   /* CS1 - Flash */
649         GPIO79_nCS_3,   /* CS3 - IMAGEON */
650         GPIO80_nCS_4,   /* CS4 - TMIO */
651
652         /* Clocks */
653         GPIO11_3_6MHz,
654
655         /* BTUART */
656         GPIO42_BTUART_RXD,
657         GPIO43_BTUART_TXD,
658         GPIO44_BTUART_CTS,
659
660         /* TMIO controller */
661         GPIO19_GPIO, /* t7l66xb #PCLR */
662         GPIO45_GPIO, /* t7l66xb #SUSPEND (NOT BTUART!) */
663
664         /* UDC */
665         GPIO13_GPIO,
666         GPIO3_GPIO,
667
668         /* IrDA */
669         GPIO38_GPIO | MFP_LPM_DRIVE_HIGH,
670
671         /* AC97 */
672         GPIO28_AC97_BITCLK,
673         GPIO29_AC97_SDATA_IN_0,
674         GPIO30_AC97_SDATA_OUT,
675         GPIO31_AC97_SYNC,
676
677         /* Audio power control */
678         GPIO4_GPIO,  /* Headphone amp power */
679         GPIO7_GPIO,  /* Speaker amp power */
680         GPIO37_GPIO, /* Headphone detect */
681
682         /* PC Card */
683         GPIO8_GPIO,   /* CD0 */
684         GPIO44_GPIO,  /* CD1 */
685         /* GPIO11_GPIO,  IRQ0 */
686         GPIO6_GPIO,   /* IRQ1 */
687         GPIO27_GPIO,  /* RST0 */
688         GPIO24_GPIO,  /* RST1 */
689         GPIO20_GPIO,  /* PWR0 */
690         GPIO23_GPIO,  /* PWR1 */
691         GPIO48_nPOE,
692         GPIO49_nPWE,
693         GPIO50_nPIOR,
694         GPIO51_nPIOW,
695         GPIO52_nPCE_1,
696         GPIO53_nPCE_2,
697         GPIO54_nPSKTSEL,
698         GPIO55_nPREG,
699         GPIO56_nPWAIT,
700         GPIO57_nIOIS16,
701
702         /* wakeup */
703         GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,
704 };
705
706 /* ----------------- e750 tc6393xb parameters ------------------ */
707
708 static struct tc6393xb_platform_data e750_tc6393xb_info = {
709         .irq_base       = IRQ_BOARD_START,
710         .scr_pll2cr     = 0x0cc1,
711         .scr_gper       = 0,
712         .suspend        = &eseries_tmio_suspend,
713         .resume         = &eseries_tmio_resume,
714         .enable         = &eseries_tmio_enable,
715         .disable        = &eseries_tmio_disable,
716 };
717
718 static struct platform_device e750_tc6393xb_device = {
719         .name           = "tc6393xb",
720         .id             = -1,
721         .dev            = {
722                 .platform_data = &e750_tc6393xb_info,
723         },
724         .num_resources = 2,
725         .resource      = eseries_tmio_resources,
726 };
727
728 static struct gpiod_lookup_table e750_audio_gpio_table = {
729         .dev_id = "e750-audio",
730         .table = {
731                 GPIO_LOOKUP("gpio-pxa",  GPIO_E750_HP_AMP_OFF, "Output amp",  GPIO_ACTIVE_LOW),
732                 GPIO_LOOKUP("gpio-pxa",  GPIO_E750_SPK_AMP_OFF, "Mic amp", GPIO_ACTIVE_LOW),
733                 { },
734         },
735 };
736
737 static struct platform_device e750_audio_device = {
738         .name           = "e750-audio",
739         .id             = -1,
740 };
741
742 /* ------------------------------------------------------------- */
743
744 static struct platform_device *e750_devices[] __initdata = {
745         &e750_fb_device,
746         &e750_tc6393xb_device,
747         &e7xx_gpio_vbus,
748         &e750_audio_device,
749 };
750
751 static void __init e750_init(void)
752 {
753         pxa2xx_mfp_config(ARRAY_AND_SIZE(e750_pin_config));
754         pxa_set_ffuart_info(NULL);
755         pxa_set_btuart_info(NULL);
756         pxa_set_stuart_info(NULL);
757         clk_add_alias("CLK_CK3P6MI", e750_tc6393xb_device.name,
758                         "GPIO11_CLK", NULL),
759         eseries_get_tmio_gpios();
760         gpiod_add_lookup_table(&e7xx_gpio_vbus_gpiod_table);
761         gpiod_add_lookup_table(&e750_audio_gpio_table);
762         platform_add_devices(ARRAY_AND_SIZE(e750_devices));
763         pxa_set_ac97_info(NULL);
764         pxa_set_ficp_info(&e7xx_ficp_platform_data);
765 }
766
767 MACHINE_START(E750, "Toshiba e750")
768         /* Maintainer: Ian Molton (spyro@f2s.com) */
769         .atag_offset    = 0x100,
770         .map_io         = pxa25x_map_io,
771         .nr_irqs        = ESERIES_NR_IRQS,
772         .init_irq       = pxa25x_init_irq,
773         .handle_irq     = pxa25x_handle_irq,
774         .fixup          = eseries_fixup,
775         .init_machine   = e750_init,
776         .init_time      = pxa_timer_init,
777         .restart        = pxa_restart,
778 MACHINE_END
779 #endif
780
781 #ifdef CONFIG_MACH_E800
782 /* ------------------------ e800 LCD definitions ------------------------- */
783
784 static unsigned long e800_pin_config[] __initdata = {
785         /* AC97 */
786         GPIO28_AC97_BITCLK,
787         GPIO29_AC97_SDATA_IN_0,
788         GPIO30_AC97_SDATA_OUT,
789         GPIO31_AC97_SYNC,
790
791         /* tc6393xb */
792         GPIO11_3_6MHz,
793 };
794
795 static struct w100_gen_regs e800_lcd_regs = {
796         .lcd_format =            0x00008003,
797         .lcdd_cntl1 =            0x02a00000,
798         .lcdd_cntl2 =            0x0003ffff,
799         .genlcd_cntl1 =          0x000ff2a3,
800         .genlcd_cntl2 =          0x000002a3,
801         .genlcd_cntl3 =          0x000102aa,
802 };
803
804 static struct w100_mode e800_lcd_mode[2] = {
805         [0] = {
806                 .xres            = 480,
807                 .yres            = 640,
808                 .left_margin     = 52,
809                 .right_margin    = 148,
810                 .upper_margin    = 2,
811                 .lower_margin    = 6,
812                 .crtc_ss         = 0x80350034,
813                 .crtc_ls         = 0x802b0026,
814                 .crtc_gs         = 0x80160016,
815                 .crtc_vpos_gs    = 0x00020003,
816                 .crtc_rev        = 0x0040001d,
817                 .crtc_dclk       = 0xe0000000,
818                 .crtc_gclk       = 0x82a50049,
819                 .crtc_goe        = 0x80ee001c,
820                 .crtc_ps1_active = 0x00000000,
821                 .pll_freq        = 128,
822                 .pixclk_divider         = 4,
823                 .pixclk_divider_rotated = 6,
824                 .pixclk_src     = CLK_SRC_PLL,
825                 .sysclk_divider  = 0,
826                 .sysclk_src     = CLK_SRC_PLL,
827         },
828         [1] = {
829                 .xres            = 240,
830                 .yres            = 320,
831                 .left_margin     = 15,
832                 .right_margin    = 88,
833                 .upper_margin    = 0,
834                 .lower_margin    = 7,
835                 .crtc_ss         = 0xd010000f,
836                 .crtc_ls         = 0x80070003,
837                 .crtc_gs         = 0x80000000,
838                 .crtc_vpos_gs    = 0x01460147,
839                 .crtc_rev        = 0x00400003,
840                 .crtc_dclk       = 0xa1700030,
841                 .crtc_gclk       = 0x814b0008,
842                 .crtc_goe        = 0x80cc0015,
843                 .crtc_ps1_active = 0x00000000,
844                 .pll_freq        = 100,
845                 .pixclk_divider         = 6, /* Wince uses 14 which gives a */
846                 .pixclk_divider_rotated = 6, /* 7MHz Pclk. We use a 14MHz one */
847                 .pixclk_src     = CLK_SRC_PLL,
848                 .sysclk_divider  = 0,
849                 .sysclk_src     = CLK_SRC_PLL,
850         }
851 };
852
853
854 static struct w100_gpio_regs e800_w100_gpio_info = {
855         .init_data1 = 0xc13fc019,
856         .gpio_dir1  = 0x3e40df7f,
857         .gpio_oe1   = 0x003c3000,
858         .init_data2 = 0x00000000,
859         .gpio_dir2  = 0x00000000,
860         .gpio_oe2   = 0x00000000,
861 };
862
863 static struct w100_mem_info e800_w100_mem_info = {
864         .ext_cntl        = 0x09640011,
865         .sdram_mode_reg  = 0x00600021,
866         .ext_timing_cntl = 0x10001545,
867         .io_cntl         = 0x7ddd7333,
868         .size            = 0x1fffff,
869 };
870
871 static void e800_tg_change(struct w100fb_par *par)
872 {
873         unsigned long tmp;
874
875         tmp = w100fb_gpio_read(W100_GPIO_PORT_A);
876         if (par->mode->xres == 480)
877                 tmp |= 0x100;
878         else
879                 tmp &= ~0x100;
880         w100fb_gpio_write(W100_GPIO_PORT_A, tmp);
881 }
882
883 static struct w100_tg_info e800_tg_info = {
884         .change = e800_tg_change,
885 };
886
887 static struct w100fb_mach_info e800_fb_info = {
888         .modelist   = e800_lcd_mode,
889         .num_modes  = 2,
890         .regs       = &e800_lcd_regs,
891         .gpio       = &e800_w100_gpio_info,
892         .mem        = &e800_w100_mem_info,
893         .tg         = &e800_tg_info,
894         .xtal_freq  = 16000000,
895 };
896
897 static struct resource e800_fb_resources[] = {
898         [0] = {
899                 .start          = 0x0c000000,
900                 .end            = 0x0cffffff,
901                 .flags          = IORESOURCE_MEM,
902         },
903 };
904
905 static struct platform_device e800_fb_device = {
906         .name           = "w100fb",
907         .id             = -1,
908         .dev            = {
909                 .platform_data  = &e800_fb_info,
910         },
911         .num_resources  = ARRAY_SIZE(e800_fb_resources),
912         .resource       = e800_fb_resources,
913 };
914
915 /* --------------------------- UDC definitions --------------------------- */
916
917 static struct gpiod_lookup_table e800_gpio_vbus_gpiod_table = {
918         .dev_id = "gpio-vbus",
919         .table = {
920                 GPIO_LOOKUP("gpio-pxa", GPIO_E800_USB_DISC,
921                             "vbus", GPIO_ACTIVE_HIGH),
922                 GPIO_LOOKUP("gpio-pxa", GPIO_E800_USB_PULLUP,
923                             "pullup", GPIO_ACTIVE_LOW),
924                 { },
925         },
926 };
927
928 static struct platform_device e800_gpio_vbus = {
929         .name   = "gpio-vbus",
930         .id     = -1,
931 };
932
933
934 /* ----------------- e800 tc6393xb parameters ------------------ */
935
936 static struct tc6393xb_platform_data e800_tc6393xb_info = {
937         .irq_base       = IRQ_BOARD_START,
938         .scr_pll2cr     = 0x0cc1,
939         .scr_gper       = 0,
940         .suspend        = &eseries_tmio_suspend,
941         .resume         = &eseries_tmio_resume,
942         .enable         = &eseries_tmio_enable,
943         .disable        = &eseries_tmio_disable,
944 };
945
946 static struct platform_device e800_tc6393xb_device = {
947         .name           = "tc6393xb",
948         .id             = -1,
949         .dev            = {
950                 .platform_data = &e800_tc6393xb_info,
951         },
952         .num_resources = 2,
953         .resource      = eseries_tmio_resources,
954 };
955
956 static struct gpiod_lookup_table e800_audio_gpio_table = {
957         .dev_id = "e800-audio",
958         .table = {
959                 GPIO_LOOKUP("gpio-pxa",  GPIO_E800_HP_AMP_OFF, "Output amp",  GPIO_ACTIVE_LOW),
960                 GPIO_LOOKUP("gpio-pxa",  GPIO_E800_SPK_AMP_ON, "Mic amp", GPIO_ACTIVE_HIGH),
961                 { },
962         },
963 };
964
965 static struct platform_device e800_audio_device = {
966         .name           = "e800-audio",
967         .id             = -1,
968 };
969
970 /* ----------------------------------------------------------------------- */
971
972 static struct platform_device *e800_devices[] __initdata = {
973         &e800_fb_device,
974         &e800_tc6393xb_device,
975         &e800_gpio_vbus,
976         &e800_audio_device,
977 };
978
979 static void __init e800_init(void)
980 {
981         pxa2xx_mfp_config(ARRAY_AND_SIZE(e800_pin_config));
982         pxa_set_ffuart_info(NULL);
983         pxa_set_btuart_info(NULL);
984         pxa_set_stuart_info(NULL);
985         clk_add_alias("CLK_CK3P6MI", e800_tc6393xb_device.name,
986                         "GPIO11_CLK", NULL),
987         eseries_get_tmio_gpios();
988         gpiod_add_lookup_table(&e800_gpio_vbus_gpiod_table);
989         gpiod_add_lookup_table(&e800_audio_gpio_table);
990         platform_add_devices(ARRAY_AND_SIZE(e800_devices));
991         pxa_set_ac97_info(NULL);
992 }
993
994 MACHINE_START(E800, "Toshiba e800")
995         /* Maintainer: Ian Molton (spyro@f2s.com) */
996         .atag_offset    = 0x100,
997         .map_io         = pxa25x_map_io,
998         .nr_irqs        = ESERIES_NR_IRQS,
999         .init_irq       = pxa25x_init_irq,
1000         .handle_irq     = pxa25x_handle_irq,
1001         .fixup          = eseries_fixup,
1002         .init_machine   = e800_init,
1003         .init_time      = pxa_timer_init,
1004         .restart        = pxa_restart,
1005 MACHINE_END
1006 #endif