blob: 3dd13b44c311534dfae7338fbff5ee6f037d374a [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>
Jürgen Schindele326764a2006-06-29 16:01:43 +010018#include <linux/interrupt.h>
Ulf Hansson40d727a2017-01-13 14:14:02 +010019#include <linux/leds.h>
Paul Gortmakerdc280942011-07-31 16:17:29 -040020#include <linux/export.h>
Jürgen Schindele326764a2006-06-29 16:01:43 +010021#include <linux/sched.h>
22#include <linux/bitops.h>
23#include <linux/fb.h>
24#include <linux/ioport.h>
25#include <linux/delay.h>
Jürgen Schindele642aa662008-08-18 21:45:03 +010026#include <linux/gpio.h>
27#include <linux/dm9000.h>
Jürgen Schindelec9184f52007-05-07 19:48:44 +010028#include <linux/mtd/physmap.h>
Jürgen Schindele326764a2006-06-29 16:01:43 +010029#include <linux/mtd/partitions.h>
Robert Jarzmika927ef82015-07-11 21:33:06 +020030#include <linux/regulator/machine.h>
Sebastian Andrzej Siewiorb4593962011-02-23 12:38:16 +010031#include <linux/i2c/pxa-i2c.h>
Jürgen Schindele326764a2006-06-29 16:01:43 +010032
33#include <asm/types.h>
34#include <asm/setup.h>
35#include <asm/memory.h>
36#include <asm/mach-types.h>
Jürgen Schindele326764a2006-06-29 16:01:43 +010037#include <asm/irq.h>
38#include <asm/sizes.h>
39
40#include <asm/mach/arch.h>
41#include <asm/mach/map.h>
42#include <asm/mach/irq.h>
43#include <asm/mach/flash.h>
44
Arnd Bergmann4c25c5d2015-01-30 10:45:33 +010045#include "pxa27x.h"
Russell Kinga09e64f2008-08-05 16:14:15 +010046#include <mach/trizeps4.h>
47#include <mach/audio.h>
Arnd Bergmann293b2da2012-08-24 15:16:48 +020048#include <linux/platform_data/video-pxafb.h>
49#include <linux/platform_data/mmc-pxamci.h>
50#include <linux/platform_data/irda-pxaficp.h>
51#include <linux/platform_data/usb-ohci-pxa27x.h>
Marek Vasutad68bb92010-11-03 16:29:35 +010052#include <mach/smemc.h>
Jürgen Schindele326764a2006-06-29 16:01:43 +010053
54#include "generic.h"
Russell King46c41e62007-05-15 15:39:36 +010055#include "devices.h"
Jürgen Schindele326764a2006-06-29 16:01:43 +010056
Jürgen Schindele642aa662008-08-18 21:45:03 +010057/* comment out the following line if you want to use the
58 * Standard UART from PXA for serial / irda transmission
59 * and acivate it if you have status leds connected */
60#define STATUS_LEDS_ON_STUART_PINS 1
61
62/*****************************************************************************
63 * MultiFunctionPins of CPU
64 *****************************************************************************/
65static unsigned long trizeps4_pin_config[] __initdata = {
66 /* Chip Selects */
67 GPIO15_nCS_1, /* DiskOnChip CS */
68 GPIO93_GPIO, /* TRIZEPS4_DOC_IRQ */
69 GPIO94_GPIO, /* DOC lock */
70
71 GPIO78_nCS_2, /* DM9000 CS */
72 GPIO101_GPIO, /* TRIZEPS4_ETH_IRQ */
73
74 GPIO79_nCS_3, /* Logic CS */
75 GPIO0_GPIO | WAKEUP_ON_EDGE_RISE, /* Logic irq */
76
Eric Miaoc11b6a42010-01-04 17:00:13 +080077 /* AC97 */
78 GPIO28_AC97_BITCLK,
79 GPIO29_AC97_SDATA_IN_0,
80 GPIO30_AC97_SDATA_OUT,
81 GPIO31_AC97_SYNC,
82
Jürgen Schindele642aa662008-08-18 21:45:03 +010083 /* LCD - 16bpp Active TFT */
Eric Miaobedbda92010-01-04 11:37:14 +080084 GPIOxx_LCD_TFT_16BPP,
Jürgen Schindele642aa662008-08-18 21:45:03 +010085
86 /* UART */
87 GPIO9_FFUART_CTS,
88 GPIO10_FFUART_DCD,
89 GPIO16_FFUART_TXD,
90 GPIO33_FFUART_DSR,
91 GPIO38_FFUART_RI,
92 GPIO82_FFUART_DTR,
93 GPIO83_FFUART_RTS,
94 GPIO96_FFUART_RXD,
95
96 GPIO42_BTUART_RXD,
97 GPIO43_BTUART_TXD,
98 GPIO44_BTUART_CTS,
99 GPIO45_BTUART_RTS,
100#ifdef STATUS_LEDS_ON_STUART_PINS
101 GPIO46_GPIO,
102 GPIO47_GPIO,
103#else
104 GPIO46_STUART_RXD,
105 GPIO47_STUART_TXD,
106#endif
107 /* PCMCIA */
108 GPIO11_GPIO, /* TRIZEPS4_CD_IRQ */
109 GPIO13_GPIO, /* TRIZEPS4_READY_NINT */
110 GPIO48_nPOE,
111 GPIO49_nPWE,
112 GPIO50_nPIOR,
113 GPIO51_nPIOW,
114 GPIO54_nPCE_2,
115 GPIO55_nPREG,
116 GPIO56_nPWAIT,
117 GPIO57_nIOIS16,
118 GPIO102_nPCE_1,
119 GPIO104_PSKTSEL,
120
121 /* MultiMediaCard */
122 GPIO32_MMC_CLK,
123 GPIO92_MMC_DAT_0,
124 GPIO109_MMC_DAT_1,
125 GPIO110_MMC_DAT_2,
126 GPIO111_MMC_DAT_3,
127 GPIO112_MMC_CMD,
128 GPIO12_GPIO, /* TRIZEPS4_MMC_IRQ */
129
130 /* USB OHCI */
131 GPIO88_USBH1_PWR, /* USBHPWR1 */
132 GPIO89_USBH1_PEN, /* USBHPEN1 */
133
134 /* I2C */
135 GPIO117_I2C_SCL,
136 GPIO118_I2C_SDA,
137};
138
139static unsigned long trizeps4wl_pin_config[] __initdata = {
140 /* SSP 2 */
141 GPIO14_SSP2_SFRM,
142 GPIO19_SSP2_SCLK,
143 GPIO53_GPIO, /* TRIZEPS4_SPI_IRQ */
144 GPIO86_SSP2_RXD,
145 GPIO87_SSP2_TXD,
146};
147
148/****************************************************************************
Jürgen Schindele326764a2006-06-29 16:01:43 +0100149 * ONBOARD FLASH
Jürgen Schindele642aa662008-08-18 21:45:03 +0100150 ****************************************************************************/
Jürgen Schindele326764a2006-06-29 16:01:43 +0100151static struct mtd_partition trizeps4_partitions[] = {
152 {
153 .name = "Bootloader",
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100154 .offset = 0x00000000,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100155 .size = 0x00040000,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100156 .mask_flags = MTD_WRITEABLE /* force read-only */
Jürgen Schindele642aa662008-08-18 21:45:03 +0100157 }, {
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100158 .name = "Backup",
159 .offset = 0x00040000,
160 .size = 0x00040000,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100161 }, {
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100162 .name = "Image",
163 .offset = 0x00080000,
164 .size = 0x01080000,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100165 }, {
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100166 .name = "IPSM",
167 .offset = 0x01100000,
168 .size = 0x00e00000,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100169 }, {
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100170 .name = "Registry",
171 .offset = 0x01f00000,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100172 .size = MTDPART_SIZ_FULL,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100173 }
174};
175
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100176static struct physmap_flash_data trizeps4_flash_data[] = {
Jürgen Schindele326764a2006-06-29 16:01:43 +0100177 {
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100178 .width = 4, /* bankwidth in bytes */
Jürgen Schindele326764a2006-06-29 16:01:43 +0100179 .parts = trizeps4_partitions,
180 .nr_parts = ARRAY_SIZE(trizeps4_partitions)
181 }
182};
183
184static struct resource flash_resource = {
185 .start = PXA_CS0_PHYS,
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100186 .end = PXA_CS0_PHYS + SZ_32M - 1,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100187 .flags = IORESOURCE_MEM,
188};
189
190static struct platform_device flash_device = {
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100191 .name = "physmap-flash",
Jürgen Schindele326764a2006-06-29 16:01:43 +0100192 .id = 0,
193 .dev = {
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100194 .platform_data = trizeps4_flash_data,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100195 },
196 .resource = &flash_resource,
197 .num_resources = 1,
198};
199
Jürgen Schindele642aa662008-08-18 21:45:03 +0100200/****************************************************************************
Jürgen Schindele326764a2006-06-29 16:01:43 +0100201 * DAVICOM DM9000 Ethernet
Jürgen Schindele642aa662008-08-18 21:45:03 +0100202 ****************************************************************************/
Jürgen Schindele326764a2006-06-29 16:01:43 +0100203static struct resource dm9000_resources[] = {
204 [0] = {
205 .start = TRIZEPS4_ETH_PHYS+0x300,
206 .end = TRIZEPS4_ETH_PHYS+0x400-1,
207 .flags = IORESOURCE_MEM,
208 },
209 [1] = {
210 .start = TRIZEPS4_ETH_PHYS+0x8300,
211 .end = TRIZEPS4_ETH_PHYS+0x8400-1,
212 .flags = IORESOURCE_MEM,
213 },
214 [2] = {
215 .start = TRIZEPS4_ETH_IRQ,
216 .end = TRIZEPS4_ETH_IRQ,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100217 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100218 },
219};
220
Jürgen Schindele642aa662008-08-18 21:45:03 +0100221static struct dm9000_plat_data tri_dm9000_platdata = {
222 .flags = DM9000_PLATF_32BITONLY,
223};
224
Jürgen Schindele326764a2006-06-29 16:01:43 +0100225static struct platform_device dm9000_device = {
226 .name = "dm9000",
227 .id = -1,
228 .num_resources = ARRAY_SIZE(dm9000_resources),
229 .resource = dm9000_resources,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100230 .dev = {
231 .platform_data = &tri_dm9000_platdata,
232 }
Jürgen Schindele326764a2006-06-29 16:01:43 +0100233};
234
Jürgen Schindele642aa662008-08-18 21:45:03 +0100235/****************************************************************************
236 * LED's on GPIO pins of PXA
237 ****************************************************************************/
238static struct gpio_led trizeps4_led[] = {
239#ifdef STATUS_LEDS_ON_STUART_PINS
Jürgen Schindele326764a2006-06-29 16:01:43 +0100240 {
Jürgen Schindele642aa662008-08-18 21:45:03 +0100241 .name = "led0:orange:heartbeat", /* */
242 .default_trigger = "heartbeat",
243 .gpio = GPIO_HEARTBEAT_LED,
244 .active_low = 1,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100245 },
246 {
Jürgen Schindele642aa662008-08-18 21:45:03 +0100247 .name = "led1:yellow:cpubusy", /* */
248 .default_trigger = "cpu-busy",
249 .gpio = GPIO_SYS_BUSY_LED,
250 .active_low = 1,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100251 },
252#endif
253};
254
Jürgen Schindele642aa662008-08-18 21:45:03 +0100255static struct gpio_led_platform_data trizeps4_led_data = {
256 .leds = trizeps4_led,
257 .num_leds = ARRAY_SIZE(trizeps4_led),
258};
259
260static struct platform_device leds_devices = {
261 .name = "leds-gpio",
262 .id = -1,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100263 .dev = {
Jürgen Schindele642aa662008-08-18 21:45:03 +0100264 .platform_data = &trizeps4_led_data,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100265 },
Jürgen Schindele326764a2006-06-29 16:01:43 +0100266};
267
Jürgen Schindele642aa662008-08-18 21:45:03 +0100268static struct platform_device *trizeps4_devices[] __initdata = {
Jürgen Schindele326764a2006-06-29 16:01:43 +0100269 &flash_device,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100270 &dm9000_device,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100271 &leds_devices,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100272};
273
Jürgen Schindele642aa662008-08-18 21:45:03 +0100274static struct platform_device *trizeps4wl_devices[] __initdata = {
275 &flash_device,
276 &leds_devices,
277};
278
Jürgen Schindele326764a2006-06-29 16:01:43 +0100279static short trizeps_conxs_bcr;
280
281/* PCCARD power switching supports only 3,3V */
282void board_pcmcia_power(int power)
283{
284 if (power) {
285 /* switch power on, put in reset and enable buffers */
286 trizeps_conxs_bcr |= power;
287 trizeps_conxs_bcr |= ConXS_BCR_CF_RESET;
Jürgen Schindele642aa662008-08-18 21:45:03 +0100288 trizeps_conxs_bcr &= ~ConXS_BCR_CF_BUF_EN;
289 BCR_writew(trizeps_conxs_bcr);
Jürgen Schindele326764a2006-06-29 16:01:43 +0100290 /* wait a little */
291 udelay(2000);
292 /* take reset away */
Jürgen Schindele642aa662008-08-18 21:45:03 +0100293 trizeps_conxs_bcr &= ~ConXS_BCR_CF_RESET;
294 BCR_writew(trizeps_conxs_bcr);
Jürgen Schindele326764a2006-06-29 16:01:43 +0100295 udelay(2000);
296 } else {
297 /* put in reset */
298 trizeps_conxs_bcr |= ConXS_BCR_CF_RESET;
Jürgen Schindele642aa662008-08-18 21:45:03 +0100299 BCR_writew(trizeps_conxs_bcr);
Jürgen Schindele326764a2006-06-29 16:01:43 +0100300 udelay(1000);
301 /* switch power off */
Jürgen Schindele642aa662008-08-18 21:45:03 +0100302 trizeps_conxs_bcr &= ~0xf;
303 BCR_writew(trizeps_conxs_bcr);
Jürgen Schindele326764a2006-06-29 16:01:43 +0100304 }
Jürgen Schindele642aa662008-08-18 21:45:03 +0100305 pr_debug("%s: o%s 0x%x\n", __func__, power ? "n" : "ff",
306 trizeps_conxs_bcr);
Jürgen Schindele326764a2006-06-29 16:01:43 +0100307}
Jürgen Schindele642aa662008-08-18 21:45:03 +0100308EXPORT_SYMBOL(board_pcmcia_power);
Jürgen Schindele326764a2006-06-29 16:01:43 +0100309
310/* backlight power switching for LCD panel */
311static void board_backlight_power(int on)
312{
Jürgen Schindele642aa662008-08-18 21:45:03 +0100313 if (on)
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 else
Jürgen Schindele326764a2006-06-29 16:01:43 +0100316 trizeps_conxs_bcr &= ~ConXS_BCR_L_DISP;
Jürgen Schindele642aa662008-08-18 21:45:03 +0100317
318 pr_debug("%s: o%s 0x%x\n", __func__, on ? "n" : "ff",
319 trizeps_conxs_bcr);
320 BCR_writew(trizeps_conxs_bcr);
Jürgen Schindele326764a2006-06-29 16:01:43 +0100321}
322
Jürgen Schindele642aa662008-08-18 21:45:03 +0100323/* a I2C based RTC is known on CONXS board */
324static struct i2c_board_info trizeps4_i2c_devices[] __initdata = {
325 { I2C_BOARD_INFO("rtc-pcf8593", 0x51) }
326};
Jürgen Schindele326764a2006-06-29 16:01:43 +0100327
Jürgen Schindele642aa662008-08-18 21:45:03 +0100328/****************************************************************************
329 * MMC card slot external to module
330 ****************************************************************************/
331static int trizeps4_mci_init(struct device *dev, irq_handler_t mci_detect_int,
332 void *data)
Jürgen Schindele326764a2006-06-29 16:01:43 +0100333{
334 int err;
Jürgen Schindele326764a2006-06-29 16:01:43 +0100335
Thomas Gleixner52e405e2006-07-03 02:20:05 +0200336 err = request_irq(TRIZEPS4_MMC_IRQ, mci_detect_int,
Michael Opdenackered7936f2013-12-09 11:22:22 +0100337 IRQF_TRIGGER_RISING, "MMC card detect", data);
Jürgen Schindele642aa662008-08-18 21:45:03 +0100338 if (err) {
339 printk(KERN_ERR "trizeps4_mci_init: MMC/SD: can't request"
340 "MMC card detect IRQ\n");
341 return -1;
342 }
343 return 0;
Jürgen Schindele326764a2006-06-29 16:01:43 +0100344}
345
346static void trizeps4_mci_exit(struct device *dev, void *data)
347{
348 free_irq(TRIZEPS4_MMC_IRQ, data);
349}
350
351static struct pxamci_platform_data trizeps4_mci_platform_data = {
352 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
Eric Miaof97cab22010-04-14 07:00:42 +0800353 .detect_delay_ms= 10,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100354 .init = trizeps4_mci_init,
355 .exit = trizeps4_mci_exit,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100356 .get_ro = NULL, /* write-protection not supported */
357 .setpower = NULL, /* power-switching not supported */
Robert Jarzmik7a648252009-07-06 22:16:42 +0200358 .gpio_card_detect = -1,
359 .gpio_card_ro = -1,
360 .gpio_power = -1,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100361};
362
Jürgen Schindele642aa662008-08-18 21:45:03 +0100363/****************************************************************************
364 * IRDA mode switching on stuart
365 ****************************************************************************/
366#ifndef STATUS_LEDS_ON_STUART_PINS
367static short trizeps_conxs_ircr;
368
369static int trizeps4_irda_startup(struct device *dev)
370{
371 trizeps_conxs_ircr &= ~ConXS_IRCR_SD;
372 IRCR_writew(trizeps_conxs_ircr);
373 return 0;
374}
375
376static void trizeps4_irda_shutdown(struct device *dev)
377{
378 trizeps_conxs_ircr |= ConXS_IRCR_SD;
379 IRCR_writew(trizeps_conxs_ircr);
380}
381
382static void trizeps4_irda_transceiver_mode(struct device *dev, int mode)
383{
384 unsigned long flags;
385
386 local_irq_save(flags);
387 /* Switch mode */
388 if (mode & IR_SIRMODE)
389 trizeps_conxs_ircr &= ~ConXS_IRCR_MODE; /* Slow mode */
Mariusz Kozlowski778c4c82008-10-18 15:15:16 +0200390 else if (mode & IR_FIRMODE)
Jürgen Schindele642aa662008-08-18 21:45:03 +0100391 trizeps_conxs_ircr |= ConXS_IRCR_MODE; /* Fast mode */
392
393 /* Switch power */
394 if (mode & IR_OFF)
395 trizeps_conxs_ircr |= ConXS_IRCR_SD;
396 else
397 trizeps_conxs_ircr &= ~ConXS_IRCR_SD;
398
399 IRCR_writew(trizeps_conxs_ircr);
400 local_irq_restore(flags);
401
402 pxa2xx_transceiver_mode(dev, mode);
403}
404
Jürgen Schindele326764a2006-06-29 16:01:43 +0100405static struct pxaficp_platform_data trizeps4_ficp_platform_data = {
Marek Vasutc4bd0172009-07-17 12:50:43 +0200406 .gpio_pwdown = -1,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100407 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
408 .transceiver_mode = trizeps4_irda_transceiver_mode,
409 .startup = trizeps4_irda_startup,
410 .shutdown = trizeps4_irda_shutdown,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100411};
Jürgen Schindele642aa662008-08-18 21:45:03 +0100412#endif
Jürgen Schindele326764a2006-06-29 16:01:43 +0100413
Jürgen Schindele642aa662008-08-18 21:45:03 +0100414/****************************************************************************
415 * OHCI USB port
416 ****************************************************************************/
Jürgen Schindele326764a2006-06-29 16:01:43 +0100417static struct pxaohci_platform_data trizeps4_ohci_platform_data = {
418 .port_mode = PMM_PERPORT_MODE,
Eric Miao097b5332008-09-27 15:49:57 +0800419 .flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100420};
421
422static struct map_desc trizeps4_io_desc[] __initdata = {
423 { /* ConXS CFSR */
424 .virtual = TRIZEPS4_CFSR_VIRT,
425 .pfn = __phys_to_pfn(TRIZEPS4_CFSR_PHYS),
426 .length = 0x00001000,
427 .type = MT_DEVICE
428 },
429 { /* ConXS BCR */
430 .virtual = TRIZEPS4_BOCR_VIRT,
431 .pfn = __phys_to_pfn(TRIZEPS4_BOCR_PHYS),
432 .length = 0x00001000,
433 .type = MT_DEVICE
434 },
435 { /* ConXS IRCR */
436 .virtual = TRIZEPS4_IRCR_VIRT,
437 .pfn = __phys_to_pfn(TRIZEPS4_IRCR_PHYS),
438 .length = 0x00001000,
439 .type = MT_DEVICE
440 },
441 { /* ConXS DCR */
442 .virtual = TRIZEPS4_DICR_VIRT,
443 .pfn = __phys_to_pfn(TRIZEPS4_DICR_PHYS),
444 .length = 0x00001000,
445 .type = MT_DEVICE
446 },
447 { /* ConXS UPSR */
448 .virtual = TRIZEPS4_UPSR_VIRT,
449 .pfn = __phys_to_pfn(TRIZEPS4_UPSR_PHYS),
450 .length = 0x00001000,
451 .type = MT_DEVICE
452 }
453};
454
Richard Purdied14b2722006-09-20 22:54:21 +0100455static struct pxafb_mode_info sharp_lcd_mode = {
Jürgen Schindele642aa662008-08-18 21:45:03 +0100456 .pixclock = 78000,
457 .xres = 640,
458 .yres = 480,
459 .bpp = 8,
460 .hsync_len = 4,
461 .left_margin = 4,
462 .right_margin = 4,
463 .vsync_len = 2,
464 .upper_margin = 0,
465 .lower_margin = 0,
466 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
467 .cmap_greyscale = 0,
Richard Purdied14b2722006-09-20 22:54:21 +0100468};
469
470static struct pxafb_mach_info sharp_lcd = {
Jürgen Schindele642aa662008-08-18 21:45:03 +0100471 .modes = &sharp_lcd_mode,
472 .num_modes = 1,
473 .lcd_conn = LCD_COLOR_DSTN_16BPP | LCD_PCLK_EDGE_FALL,
474 .cmap_inverse = 0,
475 .cmap_static = 0,
476 .pxafb_backlight_power = board_backlight_power,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100477};
478
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100479static struct pxafb_mode_info toshiba_lcd_mode = {
Jürgen Schindele642aa662008-08-18 21:45:03 +0100480 .pixclock = 39720,
481 .xres = 640,
482 .yres = 480,
483 .bpp = 8,
484 .hsync_len = 63,
485 .left_margin = 12,
486 .right_margin = 12,
487 .vsync_len = 4,
488 .upper_margin = 32,
489 .lower_margin = 10,
490 .sync = 0,
491 .cmap_greyscale = 0,
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100492};
493
494static struct pxafb_mach_info toshiba_lcd = {
Jürgen Schindele642aa662008-08-18 21:45:03 +0100495 .modes = &toshiba_lcd_mode,
496 .num_modes = 1,
497 .lcd_conn = (LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL),
498 .cmap_inverse = 0,
499 .cmap_static = 0,
500 .pxafb_backlight_power = board_backlight_power,
Jürgen Schindelec9184f52007-05-07 19:48:44 +0100501};
502
Jürgen Schindele326764a2006-06-29 16:01:43 +0100503static void __init trizeps4_init(void)
504{
Jürgen Schindele642aa662008-08-18 21:45:03 +0100505 pxa2xx_mfp_config(ARRAY_AND_SIZE(trizeps4_pin_config));
506 if (machine_is_trizeps4wl()) {
507 pxa2xx_mfp_config(ARRAY_AND_SIZE(trizeps4wl_pin_config));
508 platform_add_devices(trizeps4wl_devices,
509 ARRAY_SIZE(trizeps4wl_devices));
510 } else {
511 platform_add_devices(trizeps4_devices,
512 ARRAY_SIZE(trizeps4_devices));
513 }
Jürgen Schindele326764a2006-06-29 16:01:43 +0100514
Russell Kingcc155c62009-11-09 13:34:08 +0800515 pxa_set_ffuart_info(NULL);
516 pxa_set_btuart_info(NULL);
517 pxa_set_stuart_info(NULL);
518
Jürgen Schindele642aa662008-08-18 21:45:03 +0100519 if (0) /* dont know how to determine LCD */
Russell King - ARM Linux4321e1a2011-02-15 15:37:30 +0800520 pxa_set_fb_info(NULL, &sharp_lcd);
Jürgen Schindele642aa662008-08-18 21:45:03 +0100521 else
Russell King - ARM Linux4321e1a2011-02-15 15:37:30 +0800522 pxa_set_fb_info(NULL, &toshiba_lcd);
Jürgen Schindele326764a2006-06-29 16:01:43 +0100523
524 pxa_set_mci_info(&trizeps4_mci_platform_data);
Jürgen Schindele642aa662008-08-18 21:45:03 +0100525#ifndef STATUS_LEDS_ON_STUART_PINS
Jürgen Schindele326764a2006-06-29 16:01:43 +0100526 pxa_set_ficp_info(&trizeps4_ficp_platform_data);
Jürgen Schindele642aa662008-08-18 21:45:03 +0100527#endif
Jürgen Schindele326764a2006-06-29 16:01:43 +0100528 pxa_set_ohci_info(&trizeps4_ohci_platform_data);
Mark Brown9f19d632008-06-10 12:30:05 +0100529 pxa_set_ac97_info(NULL);
Jürgen Schindele642aa662008-08-18 21:45:03 +0100530 pxa_set_i2c_info(NULL);
531 i2c_register_board_info(0, trizeps4_i2c_devices,
532 ARRAY_SIZE(trizeps4_i2c_devices));
Jürgen Schindele326764a2006-06-29 16:01:43 +0100533
Jürgen Schindele326764a2006-06-29 16:01:43 +0100534 /* this is the reset value */
535 trizeps_conxs_bcr = 0x00A0;
Christoph Egger0846efa2010-07-04 23:31:37 +0800536
Jürgen Schindele642aa662008-08-18 21:45:03 +0100537 BCR_writew(trizeps_conxs_bcr);
538 board_backlight_power(1);
Robert Jarzmika927ef82015-07-11 21:33:06 +0200539
540 regulator_has_full_constraints();
Jürgen Schindele642aa662008-08-18 21:45:03 +0100541}
Jürgen Schindele326764a2006-06-29 16:01:43 +0100542
Jürgen Schindele642aa662008-08-18 21:45:03 +0100543static void __init trizeps4_map_io(void)
544{
Marek Vasut851982c2010-10-11 02:20:19 +0200545 pxa27x_map_io();
Jürgen Schindele642aa662008-08-18 21:45:03 +0100546 iotable_init(trizeps4_io_desc, ARRAY_SIZE(trizeps4_io_desc));
547
Marek Vasutad68bb92010-11-03 16:29:35 +0100548 if ((__raw_readl(MSC0) & 0x8) && (__raw_readl(BOOT_DEF) & 0x1)) {
Jürgen Schindele642aa662008-08-18 21:45:03 +0100549 /* if flash is 16 bit wide its a Trizeps4 WL */
550 __machine_arch_type = MACH_TYPE_TRIZEPS4WL;
551 trizeps4_flash_data[0].width = 2;
552 } else {
553 /* if flash is 32 bit wide its a Trizeps4 */
554 __machine_arch_type = MACH_TYPE_TRIZEPS4;
555 trizeps4_flash_data[0].width = 4;
556 }
Jürgen Schindele326764a2006-06-29 16:01:43 +0100557}
558
559MACHINE_START(TRIZEPS4, "Keith und Koep Trizeps IV module")
560 /* MAINTAINER("Jürgen Schindele") */
Nicolas Pitre7375aba2011-07-05 22:38:15 -0400561 .atag_offset = 0x100,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100562 .init_machine = trizeps4_init,
563 .map_io = trizeps4_map_io,
Rob Herring4e611092012-01-03 16:53:48 -0600564 .nr_irqs = PXA_NR_IRQS,
Eric Miaocd491042007-06-22 04:14:09 +0100565 .init_irq = pxa27x_init_irq,
Eric Miao8a97ae22011-05-18 21:30:04 +0800566 .handle_irq = pxa27x_handle_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700567 .init_time = pxa_timer_init,
Russell King271a74f2011-11-04 14:15:53 +0000568 .restart = pxa_restart,
Jürgen Schindele326764a2006-06-29 16:01:43 +0100569MACHINE_END
570
Jürgen Schindele642aa662008-08-18 21:45:03 +0100571MACHINE_START(TRIZEPS4WL, "Keith und Koep Trizeps IV-WL module")
572 /* MAINTAINER("Jürgen Schindele") */
Nicolas Pitre7375aba2011-07-05 22:38:15 -0400573 .atag_offset = 0x100,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100574 .init_machine = trizeps4_init,
575 .map_io = trizeps4_map_io,
Rob Herring4e611092012-01-03 16:53:48 -0600576 .nr_irqs = PXA_NR_IRQS,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100577 .init_irq = pxa27x_init_irq,
Eric Miao8a97ae22011-05-18 21:30:04 +0800578 .handle_irq = pxa27x_handle_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700579 .init_time = pxa_timer_init,
Russell King271a74f2011-11-04 14:15:53 +0000580 .restart = pxa_restart,
Jürgen Schindele642aa662008-08-18 21:45:03 +0100581MACHINE_END