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