Linux Audio

Check our new training course

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