blob: 6cb972e2f1e77e5ef64137dad21b72f6a4553398 [file] [log] [blame]
Steve Birtles3ad09202008-02-09 04:49:55 +01001/*
2 * linux/arch/arm/mach-at91/board-yl-9200.c
3 *
Andrew Victore3ba22d2008-05-24 17:06:45 +01004 * Adapted from various board files in arch/arm/mach-at91
5 *
6 * Modifications for YL-9200 platform:
7 * Copyright (C) 2007 S. Birtles
Steve Birtles3ad09202008-02-09 04:49:55 +01008 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/types.h>
Russell King2f8163b2011-07-26 10:53:52 +010025#include <linux/gpio.h>
Steve Birtles3ad09202008-02-09 04:49:55 +010026#include <linux/init.h>
27#include <linux/mm.h>
28#include <linux/module.h>
Andrew Victore3ba22d2008-05-24 17:06:45 +010029#include <linux/dma-mapping.h>
Steve Birtles3ad09202008-02-09 04:49:55 +010030#include <linux/platform_device.h>
31#include <linux/spi/spi.h>
Steve Birtles3ad09202008-02-09 04:49:55 +010032#include <linux/spi/ads7846.h>
33#include <linux/mtd/physmap.h>
Andrew Victore3ba22d2008-05-24 17:06:45 +010034#include <linux/gpio_keys.h>
35#include <linux/input.h>
Steve Birtles3ad09202008-02-09 04:49:55 +010036
Steve Birtles3ad09202008-02-09 04:49:55 +010037#include <asm/setup.h>
38#include <asm/mach-types.h>
39#include <asm/irq.h>
40
41#include <asm/mach/arch.h>
42#include <asm/mach/map.h>
43#include <asm/mach/irq.h>
44
Andrew Victore5052402008-09-21 21:30:02 +010045#include <mach/hardware.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010046#include <mach/board.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010047#include <mach/at91rm9200_mc.h>
Jean-Christophe PLAGNIOL-VILLARDf363c402012-02-13 12:58:53 +080048#include <mach/at91_ramc.h>
Jean-Christophe PLAGNIOL-VILLARDe57556e32011-04-24 11:40:22 +080049#include <mach/cpu.h>
Steve Birtles3ad09202008-02-09 04:49:55 +010050
51#include "generic.h"
Steve Birtles3ad09202008-02-09 04:49:55 +010052
Steve Birtles3ad09202008-02-09 04:49:55 +010053
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +080054static void __init yl9200_init_early(void)
Steve Birtles3ad09202008-02-09 04:49:55 +010055{
Jean-Christophe PLAGNIOL-VILLARDe57556e32011-04-24 11:40:22 +080056 /* Set cpu type: PQFP */
57 at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
58
Steve Birtles3ad09202008-02-09 04:49:55 +010059 /* Initialize processor: 18.432 MHz crystal */
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +080060 at91_initialize(18432000);
Steve Birtles3ad09202008-02-09 04:49:55 +010061}
62
Steve Birtles3ad09202008-02-09 04:49:55 +010063/*
Andrew Victore3ba22d2008-05-24 17:06:45 +010064 * LEDs
65 */
66static struct gpio_led yl9200_leds[] = {
67 { /* D2 */
68 .name = "led2",
69 .gpio = AT91_PIN_PB17,
70 .active_low = 1,
71 .default_trigger = "timer",
72 },
73 { /* D3 */
74 .name = "led3",
75 .gpio = AT91_PIN_PB16,
76 .active_low = 1,
77 .default_trigger = "heartbeat",
78 },
79 { /* D4 */
80 .name = "led4",
81 .gpio = AT91_PIN_PB15,
82 .active_low = 1,
83 },
84 { /* D5 */
85 .name = "led5",
86 .gpio = AT91_PIN_PB8,
87 .active_low = 1,
88 }
89};
90
91/*
92 * Ethernet
93 */
Jamie Iles84e0cdb2011-03-08 20:17:06 +000094static struct macb_platform_data __initdata yl9200_eth_data = {
Andrew Victore3ba22d2008-05-24 17:06:45 +010095 .phy_irq_pin = AT91_PIN_PB28,
96 .is_rmii = 1,
97};
98
99/*
100 * USB Host
101 */
102static struct at91_usbh_data __initdata yl9200_usbh_data = {
103 .ports = 1, /* PQFP version of AT91RM9200 */
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +0800104 .vbus_pin = {-EINVAL, -EINVAL},
105 .overcurrent_pin= {-EINVAL, -EINVAL},
Andrew Victore3ba22d2008-05-24 17:06:45 +0100106};
107
108/*
109 * USB Device
110 */
111static struct at91_udc_data __initdata yl9200_udc_data = {
112 .pullup_pin = AT91_PIN_PC4,
113 .vbus_pin = AT91_PIN_PC5,
114 .pullup_active_low = 1, /* Active Low due to PNP transistor (pg 7) */
Steve Birtles3ad09202008-02-09 04:49:55 +0100115
116};
Andrew Victore3ba22d2008-05-24 17:06:45 +0100117
118/*
119 * MMC
120 */
Ludovic Desroches4cf33262012-05-21 12:23:27 +0200121static struct mci_platform_data __initdata yl9200_mci0_data = {
122 .slot[0] = {
123 .bus_width = 4,
124 .detect_pin = AT91_PIN_PB9,
125 .wp_pin = -EINVAL,
126 },
Steve Birtles3ad09202008-02-09 04:49:55 +0100127};
128
Andrew Victore3ba22d2008-05-24 17:06:45 +0100129/*
130 * NAND Flash
131 */
132static struct mtd_partition __initdata yl9200_nand_partition[] = {
Steve Birtles3ad09202008-02-09 04:49:55 +0100133 {
134 .name = "AT91 NAND partition 1, boot",
135 .offset = 0,
Andrew Victore5052402008-09-21 21:30:02 +0100136 .size = SZ_256K
Steve Birtles3ad09202008-02-09 04:49:55 +0100137 },
138 {
139 .name = "AT91 NAND partition 2, kernel",
Andrew Victore5052402008-09-21 21:30:02 +0100140 .offset = MTDPART_OFS_NXTBLK,
141 .size = (2 * SZ_1M) - SZ_256K
Steve Birtles3ad09202008-02-09 04:49:55 +0100142 },
143 {
144 .name = "AT91 NAND partition 3, filesystem",
Andrew Victore5052402008-09-21 21:30:02 +0100145 .offset = MTDPART_OFS_NXTBLK,
Steve Birtles3ad09202008-02-09 04:49:55 +0100146 .size = 14 * SZ_1M
147 },
148 {
149 .name = "AT91 NAND partition 4, storage",
Andrew Victore5052402008-09-21 21:30:02 +0100150 .offset = MTDPART_OFS_NXTBLK,
151 .size = SZ_16M
Steve Birtles3ad09202008-02-09 04:49:55 +0100152 },
153 {
154 .name = "AT91 NAND partition 5, ext-fs",
Andrew Victore5052402008-09-21 21:30:02 +0100155 .offset = MTDPART_OFS_NXTBLK,
156 .size = SZ_32M
Andrew Victore3ba22d2008-05-24 17:06:45 +0100157 }
Steve Birtles3ad09202008-02-09 04:49:55 +0100158};
159
David Woodhouseff877ea2008-07-25 10:40:14 -0400160static struct atmel_nand_data __initdata yl9200_nand_data = {
Andrew Victore3ba22d2008-05-24 17:06:45 +0100161 .ale = 6,
162 .cle = 7,
Jean-Christophe PLAGNIOL-VILLARD63b4c292011-11-25 01:51:06 +0800163 .det_pin = -EINVAL,
Andrew Victore3ba22d2008-05-24 17:06:45 +0100164 .rdy_pin = AT91_PIN_PC14, /* R/!B (Sheet10) */
165 .enable_pin = AT91_PIN_PC15, /* !CE (Sheet10) */
Jean-Christophe PLAGNIOL-VILLARDbf4289c2011-12-29 14:43:24 +0800166 .ecc_mode = NAND_ECC_SOFT,
Dmitry Eremin-Solenikov1754aab2011-05-29 17:49:22 +0400167 .parts = yl9200_nand_partition,
168 .num_parts = ARRAY_SIZE(yl9200_nand_partition),
Steve Birtles3ad09202008-02-09 04:49:55 +0100169};
170
Steve Birtles3ad09202008-02-09 04:49:55 +0100171/*
Andrew Victore3ba22d2008-05-24 17:06:45 +0100172 * NOR Flash
173 */
174#define YL9200_FLASH_BASE AT91_CHIPSELECT_0
Andrew Victore5052402008-09-21 21:30:02 +0100175#define YL9200_FLASH_SIZE SZ_16M
Steve Birtles3ad09202008-02-09 04:49:55 +0100176
Andrew Victore3ba22d2008-05-24 17:06:45 +0100177static struct mtd_partition yl9200_flash_partitions[] = {
Steve Birtles3ad09202008-02-09 04:49:55 +0100178 {
Andrew Victore3ba22d2008-05-24 17:06:45 +0100179 .name = "Bootloader",
Andrew Victore3ba22d2008-05-24 17:06:45 +0100180 .offset = 0,
Andrew Victore5052402008-09-21 21:30:02 +0100181 .size = SZ_256K,
Andrew Victore3ba22d2008-05-24 17:06:45 +0100182 .mask_flags = MTD_WRITEABLE, /* force read-only */
183 },
184 {
185 .name = "Kernel",
Andrew Victore5052402008-09-21 21:30:02 +0100186 .offset = MTDPART_OFS_NXTBLK,
187 .size = (2 * SZ_1M) - SZ_256K
Andrew Victore3ba22d2008-05-24 17:06:45 +0100188 },
189 {
190 .name = "Filesystem",
Andrew Victore5052402008-09-21 21:30:02 +0100191 .offset = MTDPART_OFS_NXTBLK,
192 .size = MTDPART_SIZ_FULL
Steve Birtles3ad09202008-02-09 04:49:55 +0100193 }
194};
195
Andrew Victore3ba22d2008-05-24 17:06:45 +0100196static struct physmap_flash_data yl9200_flash_data = {
197 .width = 2,
198 .parts = yl9200_flash_partitions,
199 .nr_parts = ARRAY_SIZE(yl9200_flash_partitions),
200};
201
202static struct resource yl9200_flash_resources[] = {
203 {
204 .start = YL9200_FLASH_BASE,
205 .end = YL9200_FLASH_BASE + YL9200_FLASH_SIZE - 1,
206 .flags = IORESOURCE_MEM,
207 }
208};
209
210static struct platform_device yl9200_flash = {
Steve Birtles3ad09202008-02-09 04:49:55 +0100211 .name = "physmap-flash",
212 .id = 0,
213 .dev = {
Andrew Victore3ba22d2008-05-24 17:06:45 +0100214 .platform_data = &yl9200_flash_data,
Steve Birtles3ad09202008-02-09 04:49:55 +0100215 },
Andrew Victore3ba22d2008-05-24 17:06:45 +0100216 .resource = yl9200_flash_resources,
217 .num_resources = ARRAY_SIZE(yl9200_flash_resources),
Steve Birtles3ad09202008-02-09 04:49:55 +0100218};
219
Andrew Victore3ba22d2008-05-24 17:06:45 +0100220/*
221 * I2C (TWI)
Steve Birtles3ad09202008-02-09 04:49:55 +0100222 */
Andrew Victore3ba22d2008-05-24 17:06:45 +0100223static struct i2c_board_info __initdata yl9200_i2c_devices[] = {
224 { /* EEPROM */
225 I2C_BOARD_INFO("24c128", 0x50),
226 }
227};
228
229/*
230 * GPIO Buttons
231*/
Steve Birtles3ad09202008-02-09 04:49:55 +0100232#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
Andrew Victore3ba22d2008-05-24 17:06:45 +0100233static struct gpio_keys_button yl9200_buttons[] = {
Steve Birtles3ad09202008-02-09 04:49:55 +0100234 {
235 .gpio = AT91_PIN_PA24,
Andrew Victore3ba22d2008-05-24 17:06:45 +0100236 .code = BTN_2,
Steve Birtles3ad09202008-02-09 04:49:55 +0100237 .desc = "SW2",
238 .active_low = 1,
239 .wakeup = 1,
240 },
241 {
242 .gpio = AT91_PIN_PB1,
Andrew Victore3ba22d2008-05-24 17:06:45 +0100243 .code = BTN_3,
Steve Birtles3ad09202008-02-09 04:49:55 +0100244 .desc = "SW3",
245 .active_low = 1,
246 .wakeup = 1,
247 },
248 {
249 .gpio = AT91_PIN_PB2,
Andrew Victore3ba22d2008-05-24 17:06:45 +0100250 .code = BTN_4,
Steve Birtles3ad09202008-02-09 04:49:55 +0100251 .desc = "SW4",
252 .active_low = 1,
253 .wakeup = 1,
254 },
255 {
256 .gpio = AT91_PIN_PB6,
Andrew Victore3ba22d2008-05-24 17:06:45 +0100257 .code = BTN_5,
Steve Birtles3ad09202008-02-09 04:49:55 +0100258 .desc = "SW5",
259 .active_low = 1,
260 .wakeup = 1,
Andrew Victore3ba22d2008-05-24 17:06:45 +0100261 }
Steve Birtles3ad09202008-02-09 04:49:55 +0100262};
263
Andrew Victore3ba22d2008-05-24 17:06:45 +0100264static struct gpio_keys_platform_data yl9200_button_data = {
265 .buttons = yl9200_buttons,
266 .nbuttons = ARRAY_SIZE(yl9200_buttons),
Steve Birtles3ad09202008-02-09 04:49:55 +0100267};
268
Andrew Victore3ba22d2008-05-24 17:06:45 +0100269static struct platform_device yl9200_button_device = {
Steve Birtles3ad09202008-02-09 04:49:55 +0100270 .name = "gpio-keys",
271 .id = -1,
272 .num_resources = 0,
273 .dev = {
Andrew Victore3ba22d2008-05-24 17:06:45 +0100274 .platform_data = &yl9200_button_data,
Steve Birtles3ad09202008-02-09 04:49:55 +0100275 }
276};
277
Andrew Victore3ba22d2008-05-24 17:06:45 +0100278static void __init yl9200_add_device_buttons(void)
Steve Birtles3ad09202008-02-09 04:49:55 +0100279{
Andrew Victore3ba22d2008-05-24 17:06:45 +0100280 at91_set_gpio_input(AT91_PIN_PA24, 1); /* SW2 */
Steve Birtles3ad09202008-02-09 04:49:55 +0100281 at91_set_deglitch(AT91_PIN_PA24, 1);
Andrew Victore3ba22d2008-05-24 17:06:45 +0100282 at91_set_gpio_input(AT91_PIN_PB1, 1); /* SW3 */
Steve Birtles3ad09202008-02-09 04:49:55 +0100283 at91_set_deglitch(AT91_PIN_PB1, 1);
Andrew Victore3ba22d2008-05-24 17:06:45 +0100284 at91_set_gpio_input(AT91_PIN_PB2, 1); /* SW4 */
Steve Birtles3ad09202008-02-09 04:49:55 +0100285 at91_set_deglitch(AT91_PIN_PB2, 1);
Andrew Victore3ba22d2008-05-24 17:06:45 +0100286 at91_set_gpio_input(AT91_PIN_PB6, 1); /* SW5 */
Steve Birtles3ad09202008-02-09 04:49:55 +0100287 at91_set_deglitch(AT91_PIN_PB6, 1);
288
Andrew Victore3ba22d2008-05-24 17:06:45 +0100289 /* Enable buttons (Sheet 5) */
290 at91_set_gpio_output(AT91_PIN_PB7, 1);
Steve Birtles3ad09202008-02-09 04:49:55 +0100291
Andrew Victore3ba22d2008-05-24 17:06:45 +0100292 platform_device_register(&yl9200_button_device);
Steve Birtles3ad09202008-02-09 04:49:55 +0100293}
294#else
Andrew Victore3ba22d2008-05-24 17:06:45 +0100295static void __init yl9200_add_device_buttons(void) {}
Steve Birtles3ad09202008-02-09 04:49:55 +0100296#endif
297
Andrew Victore3ba22d2008-05-24 17:06:45 +0100298/*
299 * Touchscreen
300 */
301#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
302static int ads7843_pendown_state(void)
303{
304 return !at91_get_gpio_value(AT91_PIN_PB11); /* Touchscreen PENIRQ */
305}
306
307static struct ads7846_platform_data ads_info = {
308 .model = 7843,
309 .x_min = 150,
310 .x_max = 3830,
311 .y_min = 190,
312 .y_max = 3830,
313 .vref_delay_usecs = 100,
314
315 /* For a 8" touch-screen */
316 // .x_plate_ohms = 603,
317 // .y_plate_ohms = 332,
318
319 /* For a 10.4" touch-screen */
320 // .x_plate_ohms = 611,
321 // .y_plate_ohms = 325,
322
323 .x_plate_ohms = 576,
324 .y_plate_ohms = 366,
325
326 .pressure_max = 15000, /* generally nonsense on the 7843 */
327 .debounce_max = 1,
328 .debounce_rep = 0,
329 .debounce_tol = (~0),
330 .get_pendown_state = ads7843_pendown_state,
331};
332
333static void __init yl9200_add_device_ts(void)
334{
335 at91_set_gpio_input(AT91_PIN_PB11, 1); /* Touchscreen interrupt pin */
336 at91_set_gpio_input(AT91_PIN_PB10, 1); /* Touchscreen BUSY signal - not used! */
337}
338#else
339static void __init yl9200_add_device_ts(void) {}
340#endif
341
342/*
343 * SPI devices
344 */
345static struct spi_board_info yl9200_spi_devices[] = {
346#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
347 { /* Touchscreen */
348 .modalias = "ads7846",
349 .chip_select = 0,
350 .max_speed_hz = 5000 * 26,
351 .platform_data = &ads_info,
352 .irq = AT91_PIN_PB11,
353 },
354#endif
355 { /* CAN */
356 .modalias = "mcp2510",
357 .chip_select = 1,
358 .max_speed_hz = 25000 * 26,
359 .irq = AT91_PIN_PC0,
360 }
361};
362
363/*
364 * LCD / VGA
365 *
366 * EPSON S1D13806 FB (discontinued chip)
367 * EPSON S1D13506 FB
368 */
Jean-Christophe PLAGNIOL-VILLARD3b24f092010-11-21 11:24:07 +0800369#if defined(CONFIG_FB_S1D13XXX) || defined(CONFIG_FB_S1D13XXX_MODULE)
Steve Birtles3ad09202008-02-09 04:49:55 +0100370#include <video/s1d13xxxfb.h>
371
Steve Birtles3ad09202008-02-09 04:49:55 +0100372
Jean-Christophe PLAGNIOL-VILLARDb2eb5302011-09-19 19:26:52 +0800373static void yl9200_init_video(void)
Steve Birtles3ad09202008-02-09 04:49:55 +0100374{
Andrew Victore3ba22d2008-05-24 17:06:45 +0100375 /* NWAIT Signal */
376 at91_set_A_periph(AT91_PIN_PC6, 0);
Steve Birtles3ad09202008-02-09 04:49:55 +0100377
Andrew Victore3ba22d2008-05-24 17:06:45 +0100378 /* Initialization of the Static Memory Controller for Chip Select 2 */
Jean-Christophe PLAGNIOL-VILLARDf363c402012-02-13 12:58:53 +0800379 at91_ramc_write(0, AT91_SMC_CSR(2), AT91_SMC_DBW_16 /* 16 bit */
Andrew Victore3ba22d2008-05-24 17:06:45 +0100380 | AT91_SMC_WSEN | AT91_SMC_NWS_(0x4) /* wait states */
381 | AT91_SMC_TDF_(0x100) /* float time */
Steve Birtles3ad09202008-02-09 04:49:55 +0100382 );
Steve Birtles3ad09202008-02-09 04:49:55 +0100383}
384
Andrew Victore3ba22d2008-05-24 17:06:45 +0100385static struct s1d13xxxfb_regval yl9200_s1dfb_initregs[] =
Steve Birtles3ad09202008-02-09 04:49:55 +0100386{
Andrew Victore3ba22d2008-05-24 17:06:45 +0100387 {S1DREG_MISC, 0x00}, /* Miscellaneous Register*/
388 {S1DREG_COM_DISP_MODE, 0x01}, /* Display Mode Register, LCD only*/
389 {S1DREG_GPIO_CNF0, 0x00}, /* General IO Pins Configuration Register*/
390 {S1DREG_GPIO_CTL0, 0x00}, /* General IO Pins Control Register*/
391 {S1DREG_CLK_CNF, 0x11}, /* Memory Clock Configuration Register*/
392 {S1DREG_LCD_CLK_CNF, 0x10}, /* LCD Pixel Clock Configuration Register*/
393 {S1DREG_CRT_CLK_CNF, 0x12}, /* CRT/TV Pixel Clock Configuration Register*/
394 {S1DREG_MPLUG_CLK_CNF, 0x01}, /* MediaPlug Clock Configuration Register*/
395 {S1DREG_CPU2MEM_WST_SEL, 0x02}, /* CPU To Memory Wait State Select Register*/
396 {S1DREG_MEM_CNF, 0x00}, /* Memory Configuration Register*/
397 {S1DREG_SDRAM_REF_RATE, 0x04}, /* DRAM Refresh Rate Register, MCLK source*/
398 {S1DREG_SDRAM_TC0, 0x12}, /* DRAM Timings Control Register 0*/
399 {S1DREG_SDRAM_TC1, 0x02}, /* DRAM Timings Control Register 1*/
400 {S1DREG_PANEL_TYPE, 0x25}, /* Panel Type Register*/
401 {S1DREG_MOD_RATE, 0x00}, /* MOD Rate Register*/
402 {S1DREG_LCD_DISP_HWIDTH, 0x4F}, /* LCD Horizontal Display Width Register*/
403 {S1DREG_LCD_NDISP_HPER, 0x13}, /* LCD Horizontal Non-Display Period Register*/
404 {S1DREG_TFT_FPLINE_START, 0x01}, /* TFT FPLINE Start Position Register*/
405 {S1DREG_TFT_FPLINE_PWIDTH, 0x0c}, /* TFT FPLINE Pulse Width Register*/
406 {S1DREG_LCD_DISP_VHEIGHT0, 0xDF}, /* LCD Vertical Display Height Register 0*/
407 {S1DREG_LCD_DISP_VHEIGHT1, 0x01}, /* LCD Vertical Display Height Register 1*/
408 {S1DREG_LCD_NDISP_VPER, 0x2c}, /* LCD Vertical Non-Display Period Register*/
409 {S1DREG_TFT_FPFRAME_START, 0x0a}, /* TFT FPFRAME Start Position Register*/
410 {S1DREG_TFT_FPFRAME_PWIDTH, 0x02}, /* TFT FPFRAME Pulse Width Register*/
411 {S1DREG_LCD_DISP_MODE, 0x05}, /* LCD Display Mode Register*/
412 {S1DREG_LCD_MISC, 0x01}, /* LCD Miscellaneous Register*/
413 {S1DREG_LCD_DISP_START0, 0x00}, /* LCD Display Start Address Register 0*/
414 {S1DREG_LCD_DISP_START1, 0x00}, /* LCD Display Start Address Register 1*/
415 {S1DREG_LCD_DISP_START2, 0x00}, /* LCD Display Start Address Register 2*/
416 {S1DREG_LCD_MEM_OFF0, 0x80}, /* LCD Memory Address Offset Register 0*/
417 {S1DREG_LCD_MEM_OFF1, 0x02}, /* LCD Memory Address Offset Register 1*/
418 {S1DREG_LCD_PIX_PAN, 0x03}, /* LCD Pixel Panning Register*/
419 {S1DREG_LCD_DISP_FIFO_HTC, 0x00}, /* LCD Display FIFO High Threshold Control Register*/
420 {S1DREG_LCD_DISP_FIFO_LTC, 0x00}, /* LCD Display FIFO Low Threshold Control Register*/
421 {S1DREG_CRT_DISP_HWIDTH, 0x4F}, /* CRT/TV Horizontal Display Width Register*/
422 {S1DREG_CRT_NDISP_HPER, 0x13}, /* CRT/TV Horizontal Non-Display Period Register*/
423 {S1DREG_CRT_HRTC_START, 0x01}, /* CRT/TV HRTC Start Position Register*/
424 {S1DREG_CRT_HRTC_PWIDTH, 0x0B}, /* CRT/TV HRTC Pulse Width Register*/
425 {S1DREG_CRT_DISP_VHEIGHT0, 0xDF}, /* CRT/TV Vertical Display Height Register 0*/
426 {S1DREG_CRT_DISP_VHEIGHT1, 0x01}, /* CRT/TV Vertical Display Height Register 1*/
427 {S1DREG_CRT_NDISP_VPER, 0x2B}, /* CRT/TV Vertical Non-Display Period Register*/
428 {S1DREG_CRT_VRTC_START, 0x09}, /* CRT/TV VRTC Start Position Register*/
429 {S1DREG_CRT_VRTC_PWIDTH, 0x01}, /* CRT/TV VRTC Pulse Width Register*/
430 {S1DREG_TV_OUT_CTL, 0x18}, /* TV Output Control Register */
431 {S1DREG_CRT_DISP_MODE, 0x05}, /* CRT/TV Display Mode Register, 16BPP*/
432 {S1DREG_CRT_DISP_START0, 0x00}, /* CRT/TV Display Start Address Register 0*/
433 {S1DREG_CRT_DISP_START1, 0x00}, /* CRT/TV Display Start Address Register 1*/
434 {S1DREG_CRT_DISP_START2, 0x00}, /* CRT/TV Display Start Address Register 2*/
435 {S1DREG_CRT_MEM_OFF0, 0x80}, /* CRT/TV Memory Address Offset Register 0*/
436 {S1DREG_CRT_MEM_OFF1, 0x02}, /* CRT/TV Memory Address Offset Register 1*/
437 {S1DREG_CRT_PIX_PAN, 0x00}, /* CRT/TV Pixel Panning Register*/
438 {S1DREG_CRT_DISP_FIFO_HTC, 0x00}, /* CRT/TV Display FIFO High Threshold Control Register*/
439 {S1DREG_CRT_DISP_FIFO_LTC, 0x00}, /* CRT/TV Display FIFO Low Threshold Control Register*/
440 {S1DREG_LCD_CUR_CTL, 0x00}, /* LCD Ink/Cursor Control Register*/
441 {S1DREG_LCD_CUR_START, 0x01}, /* LCD Ink/Cursor Start Address Register*/
442 {S1DREG_LCD_CUR_XPOS0, 0x00}, /* LCD Cursor X Position Register 0*/
443 {S1DREG_LCD_CUR_XPOS1, 0x00}, /* LCD Cursor X Position Register 1*/
444 {S1DREG_LCD_CUR_YPOS0, 0x00}, /* LCD Cursor Y Position Register 0*/
445 {S1DREG_LCD_CUR_YPOS1, 0x00}, /* LCD Cursor Y Position Register 1*/
446 {S1DREG_LCD_CUR_BCTL0, 0x00}, /* LCD Ink/Cursor Blue Color 0 Register*/
447 {S1DREG_LCD_CUR_GCTL0, 0x00}, /* LCD Ink/Cursor Green Color 0 Register*/
448 {S1DREG_LCD_CUR_RCTL0, 0x00}, /* LCD Ink/Cursor Red Color 0 Register*/
449 {S1DREG_LCD_CUR_BCTL1, 0x1F}, /* LCD Ink/Cursor Blue Color 1 Register*/
450 {S1DREG_LCD_CUR_GCTL1, 0x3F}, /* LCD Ink/Cursor Green Color 1 Register*/
451 {S1DREG_LCD_CUR_RCTL1, 0x1F}, /* LCD Ink/Cursor Red Color 1 Register*/
452 {S1DREG_LCD_CUR_FIFO_HTC, 0x00}, /* LCD Ink/Cursor FIFO Threshold Register*/
453 {S1DREG_CRT_CUR_CTL, 0x00}, /* CRT/TV Ink/Cursor Control Register*/
454 {S1DREG_CRT_CUR_START, 0x01}, /* CRT/TV Ink/Cursor Start Address Register*/
455 {S1DREG_CRT_CUR_XPOS0, 0x00}, /* CRT/TV Cursor X Position Register 0*/
456 {S1DREG_CRT_CUR_XPOS1, 0x00}, /* CRT/TV Cursor X Position Register 1*/
457 {S1DREG_CRT_CUR_YPOS0, 0x00}, /* CRT/TV Cursor Y Position Register 0*/
458 {S1DREG_CRT_CUR_YPOS1, 0x00}, /* CRT/TV Cursor Y Position Register 1*/
459 {S1DREG_CRT_CUR_BCTL0, 0x00}, /* CRT/TV Ink/Cursor Blue Color 0 Register*/
460 {S1DREG_CRT_CUR_GCTL0, 0x00}, /* CRT/TV Ink/Cursor Green Color 0 Register*/
461 {S1DREG_CRT_CUR_RCTL0, 0x00}, /* CRT/TV Ink/Cursor Red Color 0 Register*/
462 {S1DREG_CRT_CUR_BCTL1, 0x1F}, /* CRT/TV Ink/Cursor Blue Color 1 Register*/
463 {S1DREG_CRT_CUR_GCTL1, 0x3F}, /* CRT/TV Ink/Cursor Green Color 1 Register*/
464 {S1DREG_CRT_CUR_RCTL1, 0x1F}, /* CRT/TV Ink/Cursor Red Color 1 Register*/
465 {S1DREG_CRT_CUR_FIFO_HTC, 0x00}, /* CRT/TV Ink/Cursor FIFO Threshold Register*/
466 {S1DREG_BBLT_CTL0, 0x00}, /* BitBlt Control Register 0*/
467 {S1DREG_BBLT_CTL1, 0x01}, /* BitBlt Control Register 1*/
468 {S1DREG_BBLT_CC_EXP, 0x00}, /* BitBlt ROP Code/Color Expansion Register*/
469 {S1DREG_BBLT_OP, 0x00}, /* BitBlt Operation Register*/
470 {S1DREG_BBLT_SRC_START0, 0x00}, /* BitBlt Source Start Address Register 0*/
471 {S1DREG_BBLT_SRC_START1, 0x00}, /* BitBlt Source Start Address Register 1*/
472 {S1DREG_BBLT_SRC_START2, 0x00}, /* BitBlt Source Start Address Register 2*/
473 {S1DREG_BBLT_DST_START0, 0x00}, /* BitBlt Destination Start Address Register 0*/
474 {S1DREG_BBLT_DST_START1, 0x00}, /* BitBlt Destination Start Address Register 1*/
475 {S1DREG_BBLT_DST_START2, 0x00}, /* BitBlt Destination Start Address Register 2*/
476 {S1DREG_BBLT_MEM_OFF0, 0x00}, /* BitBlt Memory Address Offset Register 0*/
477 {S1DREG_BBLT_MEM_OFF1, 0x00}, /* BitBlt Memory Address Offset Register 1*/
478 {S1DREG_BBLT_WIDTH0, 0x00}, /* BitBlt Width Register 0*/
479 {S1DREG_BBLT_WIDTH1, 0x00}, /* BitBlt Width Register 1*/
480 {S1DREG_BBLT_HEIGHT0, 0x00}, /* BitBlt Height Register 0*/
481 {S1DREG_BBLT_HEIGHT1, 0x00}, /* BitBlt Height Register 1*/
482 {S1DREG_BBLT_BGC0, 0x00}, /* BitBlt Background Color Register 0*/
483 {S1DREG_BBLT_BGC1, 0x00}, /* BitBlt Background Color Register 1*/
484 {S1DREG_BBLT_FGC0, 0x00}, /* BitBlt Foreground Color Register 0*/
485 {S1DREG_BBLT_FGC1, 0x00}, /* BitBlt Foreground Color Register 1*/
486 {S1DREG_LKUP_MODE, 0x00}, /* Look-Up Table Mode Register*/
487 {S1DREG_LKUP_ADDR, 0x00}, /* Look-Up Table Address Register*/
488 {S1DREG_PS_CNF, 0x00}, /* Power Save Configuration Register*/
489 {S1DREG_PS_STATUS, 0x00}, /* Power Save Status Register*/
490 {S1DREG_CPU2MEM_WDOGT, 0x00}, /* CPU-to-Memory Access Watchdog Timer Register*/
491 {S1DREG_COM_DISP_MODE, 0x01}, /* Display Mode Register, LCD only*/
Steve Birtles3ad09202008-02-09 04:49:55 +0100492};
493
Andrew Victore3ba22d2008-05-24 17:06:45 +0100494static struct s1d13xxxfb_pdata yl9200_s1dfb_pdata = {
495 .initregs = yl9200_s1dfb_initregs,
496 .initregssize = ARRAY_SIZE(yl9200_s1dfb_initregs),
497 .platform_init_video = yl9200_init_video,
Steve Birtles3ad09202008-02-09 04:49:55 +0100498};
499
Andrew Victore5052402008-09-21 21:30:02 +0100500#define YL9200_FB_REG_BASE AT91_CHIPSELECT_7
501#define YL9200_FB_VMEM_BASE YL9200_FB_REG_BASE + SZ_2M
502#define YL9200_FB_VMEM_SIZE SZ_2M
503
Andrew Victore3ba22d2008-05-24 17:06:45 +0100504static struct resource yl9200_s1dfb_resource[] = {
Steve Birtles3ad09202008-02-09 04:49:55 +0100505 [0] = { /* video mem */
Andrew Victore3ba22d2008-05-24 17:06:45 +0100506 .name = "s1d13xxxfb memory",
Andrew Victore5052402008-09-21 21:30:02 +0100507 .start = YL9200_FB_VMEM_BASE,
508 .end = YL9200_FB_VMEM_BASE + YL9200_FB_VMEM_SIZE -1,
Andrew Victore3ba22d2008-05-24 17:06:45 +0100509 .flags = IORESOURCE_MEM,
Steve Birtles3ad09202008-02-09 04:49:55 +0100510 },
511 [1] = { /* video registers */
Andrew Victore3ba22d2008-05-24 17:06:45 +0100512 .name = "s1d13xxxfb registers",
Andrew Victore5052402008-09-21 21:30:02 +0100513 .start = YL9200_FB_REG_BASE,
514 .end = YL9200_FB_REG_BASE + SZ_512 -1,
Andrew Victore3ba22d2008-05-24 17:06:45 +0100515 .flags = IORESOURCE_MEM,
Steve Birtles3ad09202008-02-09 04:49:55 +0100516 },
517};
518
Andrew Victore5052402008-09-21 21:30:02 +0100519static u64 s1dfb_dmamask = DMA_BIT_MASK(32);
520
Andrew Victore3ba22d2008-05-24 17:06:45 +0100521static struct platform_device yl9200_s1dfb_device = {
522 .name = "s1d13806fb",
523 .id = -1,
524 .dev = {
Steve Birtles3ad09202008-02-09 04:49:55 +0100525 .dma_mask = &s1dfb_dmamask,
Andrew Victore3ba22d2008-05-24 17:06:45 +0100526 .coherent_dma_mask = DMA_BIT_MASK(32),
527 .platform_data = &yl9200_s1dfb_pdata,
Steve Birtles3ad09202008-02-09 04:49:55 +0100528 },
Andrew Victore3ba22d2008-05-24 17:06:45 +0100529 .resource = yl9200_s1dfb_resource,
530 .num_resources = ARRAY_SIZE(yl9200_s1dfb_resource),
Steve Birtles3ad09202008-02-09 04:49:55 +0100531};
532
Andrew Victore3ba22d2008-05-24 17:06:45 +0100533void __init yl9200_add_device_video(void)
Steve Birtles3ad09202008-02-09 04:49:55 +0100534{
Andrew Victore3ba22d2008-05-24 17:06:45 +0100535 platform_device_register(&yl9200_s1dfb_device);
Steve Birtles3ad09202008-02-09 04:49:55 +0100536}
537#else
Andrew Victore3ba22d2008-05-24 17:06:45 +0100538void __init yl9200_add_device_video(void) {}
Steve Birtles3ad09202008-02-09 04:49:55 +0100539#endif
540
Andrew Victore3ba22d2008-05-24 17:06:45 +0100541
542static void __init yl9200_board_init(void)
Steve Birtles3ad09202008-02-09 04:49:55 +0100543{
Jean-Christophe PLAGNIOL-VILLARD7eb1dbb2012-04-05 14:27:57 +0800544 /* Setup the LEDs D2=PB17 (timer), D3=PB16 (cpu) */
545 at91_init_leds(AT91_PIN_PB16, AT91_PIN_PB17);
546
Steve Birtles3ad09202008-02-09 04:49:55 +0100547 /* Serial */
Jean-Christophe PLAGNIOL-VILLARD71b149b2012-04-05 14:14:28 +0800548 /* DBGU on ttyS0. (Rx & Tx only) */
549 at91_register_uart(0, 0, 0);
550
551 /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
552 at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
553 | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
554 | ATMEL_UART_RI);
555
556 /* USART0 on ttyS2. (Rx & Tx only to JP3) */
557 at91_register_uart(AT91RM9200_ID_US0, 2, 0);
558
559 /* USART3 on ttyS3. (Rx, Tx, RTS - RS485 interface) */
560 at91_register_uart(AT91RM9200_ID_US3, 3, ATMEL_UART_RTS);
Steve Birtles3ad09202008-02-09 04:49:55 +0100561 at91_add_device_serial();
562 /* Ethernet */
Andrew Victore3ba22d2008-05-24 17:06:45 +0100563 at91_add_device_eth(&yl9200_eth_data);
Steve Birtles3ad09202008-02-09 04:49:55 +0100564 /* USB Host */
Andrew Victore3ba22d2008-05-24 17:06:45 +0100565 at91_add_device_usbh(&yl9200_usbh_data);
Steve Birtles3ad09202008-02-09 04:49:55 +0100566 /* USB Device */
Andrew Victore3ba22d2008-05-24 17:06:45 +0100567 at91_add_device_udc(&yl9200_udc_data);
Steve Birtles3ad09202008-02-09 04:49:55 +0100568 /* I2C */
Andrew Victore3ba22d2008-05-24 17:06:45 +0100569 at91_add_device_i2c(yl9200_i2c_devices, ARRAY_SIZE(yl9200_i2c_devices));
570 /* MMC */
Ludovic Desroches4cf33262012-05-21 12:23:27 +0200571 at91_add_device_mci(0, &yl9200_mci0_data);
Steve Birtles3ad09202008-02-09 04:49:55 +0100572 /* NAND */
Andrew Victore3ba22d2008-05-24 17:06:45 +0100573 at91_add_device_nand(&yl9200_nand_data);
Steve Birtles3ad09202008-02-09 04:49:55 +0100574 /* NOR Flash */
Andrew Victore3ba22d2008-05-24 17:06:45 +0100575 platform_device_register(&yl9200_flash);
576#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
577 /* SPI */
578 at91_add_device_spi(yl9200_spi_devices, ARRAY_SIZE(yl9200_spi_devices));
579 /* Touchscreen */
580 yl9200_add_device_ts();
581#endif
582 /* LEDs. */
583 at91_gpio_leds(yl9200_leds, ARRAY_SIZE(yl9200_leds));
Steve Birtles3ad09202008-02-09 04:49:55 +0100584 /* Push Buttons */
Andrew Victore3ba22d2008-05-24 17:06:45 +0100585 yl9200_add_device_buttons();
586 /* VGA */
587 yl9200_add_device_video();
Steve Birtles3ad09202008-02-09 04:49:55 +0100588}
589
590MACHINE_START(YL9200, "uCdragon YL-9200")
Andrew Victore3ba22d2008-05-24 17:06:45 +0100591 /* Maintainer: S.Birtles */
Andrew Victore3ba22d2008-05-24 17:06:45 +0100592 .timer = &at91rm9200_timer,
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +0800593 .map_io = at91_map_io,
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +0800594 .init_early = yl9200_init_early,
Jean-Christophe PLAGNIOL-VILLARD92100c12011-04-23 15:28:34 +0800595 .init_irq = at91_init_irq_default,
Andrew Victore3ba22d2008-05-24 17:06:45 +0100596 .init_machine = yl9200_board_init,
Steve Birtles3ad09202008-02-09 04:49:55 +0100597MACHINE_END