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