blob: 423261d63d073213c5ca0f4d01e5fa25e237f2f1 [file] [log] [blame]
Jürgen Schindele326764a2006-06-29 16:01:43 +01001/*
2 * linux/arch/arm/mach-pxa/trizeps4.c
3 *
4 * Support for the Keith und Koep Trizeps4 Module Platform.
5 *
6 * Author: Jürgen Schindele
7 * Created: 20 02, 2006
8 * Copyright: Jürgen Schindele
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/init.h>
16#include <linux/kernel.h>
17#include <linux/platform_device.h>
18#include <linux/sysdev.h>
19#include <linux/interrupt.h>
20#include <linux/sched.h>
21#include <linux/bitops.h>
22#include <linux/fb.h>
23#include <linux/ioport.h>
24#include <linux/delay.h>
Jürgen Schindele642aa662008-08-18 21:45:03 +010025#include <linux/gpio.h>
26#include <linux/dm9000.h>
Jürgen Schindelec9184f52007-05-07 19:48:44 +010027#include <linux/mtd/physmap.h>
Jürgen Schindele326764a2006-06-29 16:01:43 +010028#include <linux/mtd/partitions.h>
29
30#include <asm/types.h>
31#include <asm/setup.h>
32#include <asm/memory.h>
33#include <asm/mach-types.h>
Jürgen Schindele326764a2006-06-29 16:01:43 +010034#include <asm/irq.h>
35#include <asm/sizes.h>
36
37#include <asm/mach/arch.h>
38#include <asm/mach/map.h>
39#include <asm/mach/irq.h>
40#include <asm/mach/flash.h>
41
Eric Miao51c62982009-01-02 23:17:22 +080042#include <mach/pxa27x.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010043#include <mach/trizeps4.h>
44#include <mach/audio.h>
45#include <mach/pxafb.h>
46#include <mach/mmc.h>
47#include <mach/irda.h>
48#include <mach/ohci.h>
Marek Vasutad68bb92010-11-03 16:29:35 +010049#include <mach/smemc.h>
Eric Miaof0a83702009-04-13 15:03:11 +080050#include <plat/i2c.h>
Jürgen Schindele326764a2006-06-29 16:01:43 +010051
52#include "generic.h"
Russell King46c41e62007-05-15 15:39:36 +010053#include "devices.h"
Jürgen Schindele326764a2006-06-29 16:01:43 +010054
Jürgen Schindele642aa662008-08-18 21:45:03 +010055/* comment out the following line if you want to use the
56 * Standard UART from PXA for serial / irda transmission
57 * and acivate it if you have status leds connected */
58#define STATUS_LEDS_ON_STUART_PINS 1
59
60/*****************************************************************************
61 * MultiFunctionPins of CPU
62 *****************************************************************************/
63static unsigned long trizeps4_pin_config[] __initdata = {
64 /* Chip Selects */
65 GPIO15_nCS_1, /* DiskOnChip CS */
66 GPIO93_GPIO, /* TRIZEPS4_DOC_IRQ */
67 GPIO94_GPIO, /* DOC lock */
68
69 GPIO78_nCS_2, /* DM9000 CS */
70 GPIO101_GPIO, /* TRIZEPS4_ETH_IRQ */
71
72 GPIO79_nCS_3, /* Logic CS */
73 GPIO0_GPIO | WAKEUP_ON_EDGE_RISE, /* Logic irq */
74
Eric Miaoc11b6a42010-01-04 17:00:13 +080075 /* AC97 */
76 GPIO28_AC97_BITCLK,
77 GPIO29_AC97_SDATA_IN_0,
78 GPIO30_AC97_SDATA_OUT,
79 GPIO31_AC97_SYNC,
80
Jürgen Schindele642aa662008-08-18 21:45:03 +010081 /* LCD - 16bpp Active TFT */
Eric Miaobedbda92010-01-04 11:37:14 +080082 GPIOxx_LCD_TFT_16BPP,
Jürgen Schindele642aa662008-08-18 21:45:03 +010083
84 /* UART */
85 GPIO9_FFUART_CTS,
86 GPIO10_FFUART_DCD,
87 GPIO16_FFUART_TXD,
88 GPIO33_FFUART_DSR,
89 GPIO38_FFUART_RI,
90 GPIO82_FFUART_DTR,
91 GPIO83_FFUART_RTS,
92 GPIO96_FFUART_RXD,
93
94 GPIO42_BTUART_RXD,
95 GPIO43_BTUART_TXD,
96 GPIO44_BTUART_CTS,
97 GPIO45_BTUART_RTS,
98#ifdef STATUS_LEDS_ON_STUART_PINS
99 GPIO46_GPIO,
100 GPIO47_GPIO,
101#else
102 GPIO46_STUART_RXD,
103 GPIO47_STUART_TXD,
104#endif
105 /* PCMCIA */
106 GPIO11_GPIO, /* TRIZEPS4_CD_IRQ */
107 GPIO13_GPIO, /* TRIZEPS4_READY_NINT */
108 GPIO48_nPOE,
109 GPIO49_nPWE,
110 GPIO50_nPIOR,
111 GPIO51_nPIOW,
112 GPIO54_nPCE_2,
113 GPIO55_nPREG,
114 GPIO56_nPWAIT,
115 GPIO57_nIOIS16,
116 GPIO102_nPCE_1,
117 GPIO104_PSKTSEL,
118
119 /* MultiMediaCard */
120 GPIO32_MMC_CLK,
121 GPIO92_MMC_DAT_0,
122 GPIO109_MMC_DAT_1,
123 GPIO110_MMC_DAT_2,
124 GPIO111_MMC_DAT_3,
125 GPIO112_MMC_CMD,
126 GPIO12_GPIO, /* TRIZEPS4_MMC_IRQ */
127
128 /* USB OHCI */
129 GPIO88_USBH1_PWR, /* USBHPWR1 */
130 GPIO89_USBH1_PEN, /* USBHPEN1 */
131
132 /* I2C */
133 GPIO117_I2C_SCL,
134 GPIO118_I2C_SDA,
135};
136
137static unsigned long trizeps4wl_pin_config[] __initdata = {
138 /* SSP 2 */
139 GPIO14_SSP2_SFRM,
140 GPIO19_SSP2_SCLK,
141 GPIO53_GPIO, /* TRIZEPS4_SPI_IRQ */
142 GPIO86_SSP2_RXD,
143 GPIO87_SSP2_TXD,
144};
145
146/****************************************************************************
Jürgen Schindele326764a2006-06-29 16:01:43 +0100147 * ONBOARD FLASH
Jürgen Schindele642aa662008-08-18 21:45:03 +0100148 ****************************************************************************/
Jürgen Schindele326764a2006-06-29 16:01:43 +0100149static struct mtd_partition trizeps4_partitions[] = {
150 {
151 .name = "Bootloader",
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100152 .offset = 0x00000000,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100153 .size = 0x00040000,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100154 .mask_flags = MTD_WRITEABLE /* force read-only */
Jürgen Schindele642aa662008-08-18 21:45:03 +0100155 }, {
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100156 .name = "Backup",
157 .offset = 0x00040000,
158 .size = 0x00040000,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100159 }, {
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100160 .name = "Image",
161 .offset = 0x00080000,
162 .size = 0x01080000,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100163 }, {
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100164 .name = "IPSM",
165 .offset = 0x01100000,
166 .size = 0x00e00000,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100167 }, {
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100168 .name = "Registry",
169 .offset = 0x01f00000,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100170 .size = MTDPART_SIZ_FULL,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100171 }
172};
173
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100174static struct physmap_flash_data trizeps4_flash_data[] = {
Jürgen Schindele326764a2006-06-29 16:01:43 +0100175 {
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100176 .width = 4, /* bankwidth in bytes */
Jürgen Schindele326764a2006-06-29 16:01:43 +0100177 .parts = trizeps4_partitions,
178 .nr_parts = ARRAY_SIZE(trizeps4_partitions)
179 }
180};
181
182static struct resource flash_resource = {
183 .start = PXA_CS0_PHYS,
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100184 .end = PXA_CS0_PHYS + SZ_32M - 1,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100185 .flags = IORESOURCE_MEM,
186};
187
188static struct platform_device flash_device = {
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100189 .name = "physmap-flash",
Jürgen Schindele326764a2006-06-29 16:01:43 +0100190 .id = 0,
191 .dev = {
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100192 .platform_data = trizeps4_flash_data,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100193 },
194 .resource = &flash_resource,
195 .num_resources = 1,
196};
197
Jürgen Schindele642aa662008-08-18 21:45:03 +0100198/****************************************************************************
Jürgen Schindele326764a2006-06-29 16:01:43 +0100199 * DAVICOM DM9000 Ethernet
Jürgen Schindele642aa662008-08-18 21:45:03 +0100200 ****************************************************************************/
Jürgen Schindele326764a2006-06-29 16:01:43 +0100201static struct resource dm9000_resources[] = {
202 [0] = {
203 .start = TRIZEPS4_ETH_PHYS+0x300,
204 .end = TRIZEPS4_ETH_PHYS+0x400-1,
205 .flags = IORESOURCE_MEM,
206 },
207 [1] = {
208 .start = TRIZEPS4_ETH_PHYS+0x8300,
209 .end = TRIZEPS4_ETH_PHYS+0x8400-1,
210 .flags = IORESOURCE_MEM,
211 },
212 [2] = {
213 .start = TRIZEPS4_ETH_IRQ,
214 .end = TRIZEPS4_ETH_IRQ,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100215 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100216 },
217};
218
Jürgen Schindele642aa662008-08-18 21:45:03 +0100219static struct dm9000_plat_data tri_dm9000_platdata = {
220 .flags = DM9000_PLATF_32BITONLY,
221};
222
Jürgen Schindele326764a2006-06-29 16:01:43 +0100223static struct platform_device dm9000_device = {
224 .name = "dm9000",
225 .id = -1,
226 .num_resources = ARRAY_SIZE(dm9000_resources),
227 .resource = dm9000_resources,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100228 .dev = {
229 .platform_data = &tri_dm9000_platdata,
230 }
Jürgen Schindele326764a2006-06-29 16:01:43 +0100231};
232
Jürgen Schindele642aa662008-08-18 21:45:03 +0100233/****************************************************************************
234 * LED's on GPIO pins of PXA
235 ****************************************************************************/
236static struct gpio_led trizeps4_led[] = {
237#ifdef STATUS_LEDS_ON_STUART_PINS
Jürgen Schindele326764a2006-06-29 16:01:43 +0100238 {
Jürgen Schindele642aa662008-08-18 21:45:03 +0100239 .name = "led0:orange:heartbeat", /* */
240 .default_trigger = "heartbeat",
241 .gpio = GPIO_HEARTBEAT_LED,
242 .active_low = 1,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100243 },
244 {
Jürgen Schindele642aa662008-08-18 21:45:03 +0100245 .name = "led1:yellow:cpubusy", /* */
246 .default_trigger = "cpu-busy",
247 .gpio = GPIO_SYS_BUSY_LED,
248 .active_low = 1,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100249 },
250#endif
251};
252
Jürgen Schindele642aa662008-08-18 21:45:03 +0100253static struct gpio_led_platform_data trizeps4_led_data = {
254 .leds = trizeps4_led,
255 .num_leds = ARRAY_SIZE(trizeps4_led),
256};
257
258static struct platform_device leds_devices = {
259 .name = "leds-gpio",
260 .id = -1,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100261 .dev = {
Jürgen Schindele642aa662008-08-18 21:45:03 +0100262 .platform_data = &trizeps4_led_data,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100263 },
Jürgen Schindele326764a2006-06-29 16:01:43 +0100264};
265
Jürgen Schindele642aa662008-08-18 21:45:03 +0100266static struct platform_device *trizeps4_devices[] __initdata = {
Jürgen Schindele326764a2006-06-29 16:01:43 +0100267 &flash_device,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100268 &dm9000_device,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100269 &leds_devices,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100270};
271
Jürgen Schindele642aa662008-08-18 21:45:03 +0100272static struct platform_device *trizeps4wl_devices[] __initdata = {
273 &flash_device,
274 &leds_devices,
275};
276
Jürgen Schindele326764a2006-06-29 16:01:43 +0100277static short trizeps_conxs_bcr;
278
279/* PCCARD power switching supports only 3,3V */
280void board_pcmcia_power(int power)
281{
282 if (power) {
283 /* switch power on, put in reset and enable buffers */
284 trizeps_conxs_bcr |= power;
285 trizeps_conxs_bcr |= ConXS_BCR_CF_RESET;
Jürgen Schindele642aa662008-08-18 21:45:03 +0100286 trizeps_conxs_bcr &= ~ConXS_BCR_CF_BUF_EN;
287 BCR_writew(trizeps_conxs_bcr);
Jürgen Schindele326764a2006-06-29 16:01:43 +0100288 /* wait a little */
289 udelay(2000);
290 /* take reset away */
Jürgen Schindele642aa662008-08-18 21:45:03 +0100291 trizeps_conxs_bcr &= ~ConXS_BCR_CF_RESET;
292 BCR_writew(trizeps_conxs_bcr);
Jürgen Schindele326764a2006-06-29 16:01:43 +0100293 udelay(2000);
294 } else {
295 /* put in reset */
296 trizeps_conxs_bcr |= ConXS_BCR_CF_RESET;
Jürgen Schindele642aa662008-08-18 21:45:03 +0100297 BCR_writew(trizeps_conxs_bcr);
Jürgen Schindele326764a2006-06-29 16:01:43 +0100298 udelay(1000);
299 /* switch power off */
Jürgen Schindele642aa662008-08-18 21:45:03 +0100300 trizeps_conxs_bcr &= ~0xf;
301 BCR_writew(trizeps_conxs_bcr);
Jürgen Schindele326764a2006-06-29 16:01:43 +0100302 }
Jürgen Schindele642aa662008-08-18 21:45:03 +0100303 pr_debug("%s: o%s 0x%x\n", __func__, power ? "n" : "ff",
304 trizeps_conxs_bcr);
Jürgen Schindele326764a2006-06-29 16:01:43 +0100305}
Jürgen Schindele642aa662008-08-18 21:45:03 +0100306EXPORT_SYMBOL(board_pcmcia_power);
Jürgen Schindele326764a2006-06-29 16:01:43 +0100307
308/* backlight power switching for LCD panel */
309static void board_backlight_power(int on)
310{
Jürgen Schindele642aa662008-08-18 21:45:03 +0100311 if (on)
Jürgen Schindele326764a2006-06-29 16:01:43 +0100312 trizeps_conxs_bcr |= ConXS_BCR_L_DISP;
Jürgen Schindele642aa662008-08-18 21:45:03 +0100313 else
Jürgen Schindele326764a2006-06-29 16:01:43 +0100314 trizeps_conxs_bcr &= ~ConXS_BCR_L_DISP;
Jürgen Schindele642aa662008-08-18 21:45:03 +0100315
316 pr_debug("%s: o%s 0x%x\n", __func__, on ? "n" : "ff",
317 trizeps_conxs_bcr);
318 BCR_writew(trizeps_conxs_bcr);
Jürgen Schindele326764a2006-06-29 16:01:43 +0100319}
320
Jürgen Schindele642aa662008-08-18 21:45:03 +0100321/* a I2C based RTC is known on CONXS board */
322static struct i2c_board_info trizeps4_i2c_devices[] __initdata = {
323 { I2C_BOARD_INFO("rtc-pcf8593", 0x51) }
324};
Jürgen Schindele326764a2006-06-29 16:01:43 +0100325
Jürgen Schindele642aa662008-08-18 21:45:03 +0100326/****************************************************************************
327 * MMC card slot external to module
328 ****************************************************************************/
329static int trizeps4_mci_init(struct device *dev, irq_handler_t mci_detect_int,
330 void *data)
Jürgen Schindele326764a2006-06-29 16:01:43 +0100331{
332 int err;
Jürgen Schindele326764a2006-06-29 16:01:43 +0100333
Thomas Gleixner52e405e2006-07-03 02:20:05 +0200334 err = request_irq(TRIZEPS4_MMC_IRQ, mci_detect_int,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100335 IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_SAMPLE_RANDOM,
336 "MMC card detect", data);
337 if (err) {
338 printk(KERN_ERR "trizeps4_mci_init: MMC/SD: can't request"
339 "MMC card detect IRQ\n");
340 return -1;
341 }
342 return 0;
Jürgen Schindele326764a2006-06-29 16:01:43 +0100343}
344
345static void trizeps4_mci_exit(struct device *dev, void *data)
346{
347 free_irq(TRIZEPS4_MMC_IRQ, data);
348}
349
350static struct pxamci_platform_data trizeps4_mci_platform_data = {
351 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
Eric Miaof97cab22010-04-14 07:00:42 +0800352 .detect_delay_ms= 10,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100353 .init = trizeps4_mci_init,
354 .exit = trizeps4_mci_exit,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100355 .get_ro = NULL, /* write-protection not supported */
356 .setpower = NULL, /* power-switching not supported */
Robert Jarzmik7a648252009-07-06 22:16:42 +0200357 .gpio_card_detect = -1,
358 .gpio_card_ro = -1,
359 .gpio_power = -1,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100360};
361
Jürgen Schindele642aa662008-08-18 21:45:03 +0100362/****************************************************************************
363 * IRDA mode switching on stuart
364 ****************************************************************************/
365#ifndef STATUS_LEDS_ON_STUART_PINS
366static short trizeps_conxs_ircr;
367
368static int trizeps4_irda_startup(struct device *dev)
369{
370 trizeps_conxs_ircr &= ~ConXS_IRCR_SD;
371 IRCR_writew(trizeps_conxs_ircr);
372 return 0;
373}
374
375static void trizeps4_irda_shutdown(struct device *dev)
376{
377 trizeps_conxs_ircr |= ConXS_IRCR_SD;
378 IRCR_writew(trizeps_conxs_ircr);
379}
380
381static void trizeps4_irda_transceiver_mode(struct device *dev, int mode)
382{
383 unsigned long flags;
384
385 local_irq_save(flags);
386 /* Switch mode */
387 if (mode & IR_SIRMODE)
388 trizeps_conxs_ircr &= ~ConXS_IRCR_MODE; /* Slow mode */
Mariusz Kozlowski778c4c82008-10-18 15:15:16 +0200389 else if (mode & IR_FIRMODE)
Jürgen Schindele642aa662008-08-18 21:45:03 +0100390 trizeps_conxs_ircr |= ConXS_IRCR_MODE; /* Fast mode */
391
392 /* Switch power */
393 if (mode & IR_OFF)
394 trizeps_conxs_ircr |= ConXS_IRCR_SD;
395 else
396 trizeps_conxs_ircr &= ~ConXS_IRCR_SD;
397
398 IRCR_writew(trizeps_conxs_ircr);
399 local_irq_restore(flags);
400
401 pxa2xx_transceiver_mode(dev, mode);
402}
403
Jürgen Schindele326764a2006-06-29 16:01:43 +0100404static struct pxaficp_platform_data trizeps4_ficp_platform_data = {
Marek Vasutc4bd0172009-07-17 12:50:43 +0200405 .gpio_pwdown = -1,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100406 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
407 .transceiver_mode = trizeps4_irda_transceiver_mode,
408 .startup = trizeps4_irda_startup,
409 .shutdown = trizeps4_irda_shutdown,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100410};
Jürgen Schindele642aa662008-08-18 21:45:03 +0100411#endif
Jürgen Schindele326764a2006-06-29 16:01:43 +0100412
Jürgen Schindele642aa662008-08-18 21:45:03 +0100413/****************************************************************************
414 * OHCI USB port
415 ****************************************************************************/
Jürgen Schindele326764a2006-06-29 16:01:43 +0100416static struct pxaohci_platform_data trizeps4_ohci_platform_data = {
417 .port_mode = PMM_PERPORT_MODE,
Eric Miao097b5332008-09-27 15:49:57 +0800418 .flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100419};
420
421static struct map_desc trizeps4_io_desc[] __initdata = {
422 { /* ConXS CFSR */
423 .virtual = TRIZEPS4_CFSR_VIRT,
424 .pfn = __phys_to_pfn(TRIZEPS4_CFSR_PHYS),
425 .length = 0x00001000,
426 .type = MT_DEVICE
427 },
428 { /* ConXS BCR */
429 .virtual = TRIZEPS4_BOCR_VIRT,
430 .pfn = __phys_to_pfn(TRIZEPS4_BOCR_PHYS),
431 .length = 0x00001000,
432 .type = MT_DEVICE
433 },
434 { /* ConXS IRCR */
435 .virtual = TRIZEPS4_IRCR_VIRT,
436 .pfn = __phys_to_pfn(TRIZEPS4_IRCR_PHYS),
437 .length = 0x00001000,
438 .type = MT_DEVICE
439 },
440 { /* ConXS DCR */
441 .virtual = TRIZEPS4_DICR_VIRT,
442 .pfn = __phys_to_pfn(TRIZEPS4_DICR_PHYS),
443 .length = 0x00001000,
444 .type = MT_DEVICE
445 },
446 { /* ConXS UPSR */
447 .virtual = TRIZEPS4_UPSR_VIRT,
448 .pfn = __phys_to_pfn(TRIZEPS4_UPSR_PHYS),
449 .length = 0x00001000,
450 .type = MT_DEVICE
451 }
452};
453
Richard Purdied14b2722006-09-20 22:54:21 +0100454static struct pxafb_mode_info sharp_lcd_mode = {
Jürgen Schindele642aa662008-08-18 21:45:03 +0100455 .pixclock = 78000,
456 .xres = 640,
457 .yres = 480,
458 .bpp = 8,
459 .hsync_len = 4,
460 .left_margin = 4,
461 .right_margin = 4,
462 .vsync_len = 2,
463 .upper_margin = 0,
464 .lower_margin = 0,
465 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
466 .cmap_greyscale = 0,
Richard Purdied14b2722006-09-20 22:54:21 +0100467};
468
469static struct pxafb_mach_info sharp_lcd = {
Jürgen Schindele642aa662008-08-18 21:45:03 +0100470 .modes = &sharp_lcd_mode,
471 .num_modes = 1,
472 .lcd_conn = LCD_COLOR_DSTN_16BPP | LCD_PCLK_EDGE_FALL,
473 .cmap_inverse = 0,
474 .cmap_static = 0,
475 .pxafb_backlight_power = board_backlight_power,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100476};
477
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100478static struct pxafb_mode_info toshiba_lcd_mode = {
Jürgen Schindele642aa662008-08-18 21:45:03 +0100479 .pixclock = 39720,
480 .xres = 640,
481 .yres = 480,
482 .bpp = 8,
483 .hsync_len = 63,
484 .left_margin = 12,
485 .right_margin = 12,
486 .vsync_len = 4,
487 .upper_margin = 32,
488 .lower_margin = 10,
489 .sync = 0,
490 .cmap_greyscale = 0,
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100491};
492
493static struct pxafb_mach_info toshiba_lcd = {
Jürgen Schindele642aa662008-08-18 21:45:03 +0100494 .modes = &toshiba_lcd_mode,
495 .num_modes = 1,
496 .lcd_conn = (LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL),
497 .cmap_inverse = 0,
498 .cmap_static = 0,
499 .pxafb_backlight_power = board_backlight_power,
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100500};
501
Jürgen Schindele326764a2006-06-29 16:01:43 +0100502static void __init trizeps4_init(void)
503{
Jürgen Schindele642aa662008-08-18 21:45:03 +0100504 pxa2xx_mfp_config(ARRAY_AND_SIZE(trizeps4_pin_config));
505 if (machine_is_trizeps4wl()) {
506 pxa2xx_mfp_config(ARRAY_AND_SIZE(trizeps4wl_pin_config));
507 platform_add_devices(trizeps4wl_devices,
508 ARRAY_SIZE(trizeps4wl_devices));
509 } else {
510 platform_add_devices(trizeps4_devices,
511 ARRAY_SIZE(trizeps4_devices));
512 }
Jürgen Schindele326764a2006-06-29 16:01:43 +0100513
Russell Kingcc155c62009-11-09 13:34:08 +0800514 pxa_set_ffuart_info(NULL);
515 pxa_set_btuart_info(NULL);
516 pxa_set_stuart_info(NULL);
517
Jürgen Schindele642aa662008-08-18 21:45:03 +0100518 if (0) /* dont know how to determine LCD */
519 set_pxa_fb_info(&sharp_lcd);
520 else
521 set_pxa_fb_info(&toshiba_lcd);
Jürgen Schindele326764a2006-06-29 16:01:43 +0100522
523 pxa_set_mci_info(&trizeps4_mci_platform_data);
Jürgen Schindele642aa662008-08-18 21:45:03 +0100524#ifndef STATUS_LEDS_ON_STUART_PINS
Jürgen Schindele326764a2006-06-29 16:01:43 +0100525 pxa_set_ficp_info(&trizeps4_ficp_platform_data);
Jürgen Schindele642aa662008-08-18 21:45:03 +0100526#endif
Jürgen Schindele326764a2006-06-29 16:01:43 +0100527 pxa_set_ohci_info(&trizeps4_ohci_platform_data);
Mark Brown9f19d632008-06-10 12:30:05 +0100528 pxa_set_ac97_info(NULL);
Jürgen Schindele642aa662008-08-18 21:45:03 +0100529 pxa_set_i2c_info(NULL);
530 i2c_register_board_info(0, trizeps4_i2c_devices,
531 ARRAY_SIZE(trizeps4_i2c_devices));
Jürgen Schindele326764a2006-06-29 16:01:43 +0100532
Jürgen Schindele326764a2006-06-29 16:01:43 +0100533 /* this is the reset value */
534 trizeps_conxs_bcr = 0x00A0;
Christoph Egger0846efa2010-07-04 23:31:37 +0800535
Jürgen Schindele642aa662008-08-18 21:45:03 +0100536 BCR_writew(trizeps_conxs_bcr);
537 board_backlight_power(1);
538}
Jürgen Schindele326764a2006-06-29 16:01:43 +0100539
Jürgen Schindele642aa662008-08-18 21:45:03 +0100540static void __init trizeps4_map_io(void)
541{
Marek Vasut851982c2010-10-11 02:20:19 +0200542 pxa27x_map_io();
Jürgen Schindele642aa662008-08-18 21:45:03 +0100543 iotable_init(trizeps4_io_desc, ARRAY_SIZE(trizeps4_io_desc));
544
Marek Vasutad68bb92010-11-03 16:29:35 +0100545 if ((__raw_readl(MSC0) & 0x8) && (__raw_readl(BOOT_DEF) & 0x1)) {
Jürgen Schindele642aa662008-08-18 21:45:03 +0100546 /* if flash is 16 bit wide its a Trizeps4 WL */
547 __machine_arch_type = MACH_TYPE_TRIZEPS4WL;
548 trizeps4_flash_data[0].width = 2;
549 } else {
550 /* if flash is 32 bit wide its a Trizeps4 */
551 __machine_arch_type = MACH_TYPE_TRIZEPS4;
552 trizeps4_flash_data[0].width = 4;
553 }
Jürgen Schindele326764a2006-06-29 16:01:43 +0100554}
555
556MACHINE_START(TRIZEPS4, "Keith und Koep Trizeps IV module")
557 /* MAINTAINER("Jürgen Schindele") */
Jürgen Schindele326764a2006-06-29 16:01:43 +0100558 .boot_params = TRIZEPS4_SDRAM_BASE + 0x100,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100559 .init_machine = trizeps4_init,
560 .map_io = trizeps4_map_io,
Eric Miaocd491042007-06-22 04:14:09 +0100561 .init_irq = pxa27x_init_irq,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100562 .timer = &pxa_timer,
563MACHINE_END
564
Jürgen Schindele642aa662008-08-18 21:45:03 +0100565MACHINE_START(TRIZEPS4WL, "Keith und Koep Trizeps IV-WL module")
566 /* MAINTAINER("Jürgen Schindele") */
Jürgen Schindele642aa662008-08-18 21:45:03 +0100567 .boot_params = TRIZEPS4_SDRAM_BASE + 0x100,
568 .init_machine = trizeps4_init,
569 .map_io = trizeps4_map_io,
570 .init_irq = pxa27x_init_irq,
571 .timer = &pxa_timer,
572MACHINE_END