board-yl-9200.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. /*
  2. * linux/arch/arm/mach-at91/board-yl-9200.c
  3. *
  4. * Adapted from various board files in arch/arm/mach-at91
  5. *
  6. * Modifications for YL-9200 platform:
  7. * Copyright (C) 2007 S. Birtles
  8. *
  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. #include <linux/types.h>
  24. #include <linux/init.h>
  25. #include <linux/mm.h>
  26. #include <linux/module.h>
  27. #include <linux/dma-mapping.h>
  28. #include <linux/platform_device.h>
  29. #include <linux/spi/spi.h>
  30. #include <linux/spi/ads7846.h>
  31. #include <linux/mtd/physmap.h>
  32. #include <linux/gpio_keys.h>
  33. #include <linux/input.h>
  34. #include <asm/setup.h>
  35. #include <asm/mach-types.h>
  36. #include <asm/irq.h>
  37. #include <asm/mach/arch.h>
  38. #include <asm/mach/map.h>
  39. #include <asm/mach/irq.h>
  40. #include <mach/hardware.h>
  41. #include <mach/board.h>
  42. #include <mach/gpio.h>
  43. #include <mach/at91rm9200_mc.h>
  44. #include <mach/cpu.h>
  45. #include "generic.h"
  46. static void __init yl9200_init_early(void)
  47. {
  48. /* Set cpu type: PQFP */
  49. at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
  50. /* Initialize processor: 18.432 MHz crystal */
  51. at91rm9200_initialize(18432000);
  52. /* Setup the LEDs D2=PB17 (timer), D3=PB16 (cpu) */
  53. at91_init_leds(AT91_PIN_PB16, AT91_PIN_PB17);
  54. /* DBGU on ttyS0. (Rx & Tx only) */
  55. at91_register_uart(0, 0, 0);
  56. /* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */
  57. at91_register_uart(AT91RM9200_ID_US1, 1, ATMEL_UART_CTS | ATMEL_UART_RTS
  58. | ATMEL_UART_DTR | ATMEL_UART_DSR | ATMEL_UART_DCD
  59. | ATMEL_UART_RI);
  60. /* USART0 on ttyS2. (Rx & Tx only to JP3) */
  61. at91_register_uart(AT91RM9200_ID_US0, 2, 0);
  62. /* USART3 on ttyS3. (Rx, Tx, RTS - RS485 interface) */
  63. at91_register_uart(AT91RM9200_ID_US3, 3, ATMEL_UART_RTS);
  64. /* set serial console to ttyS0 (ie, DBGU) */
  65. at91_set_serial_console(0);
  66. }
  67. static void __init yl9200_init_irq(void)
  68. {
  69. at91rm9200_init_interrupts(NULL);
  70. }
  71. /*
  72. * LEDs
  73. */
  74. static struct gpio_led yl9200_leds[] = {
  75. { /* D2 */
  76. .name = "led2",
  77. .gpio = AT91_PIN_PB17,
  78. .active_low = 1,
  79. .default_trigger = "timer",
  80. },
  81. { /* D3 */
  82. .name = "led3",
  83. .gpio = AT91_PIN_PB16,
  84. .active_low = 1,
  85. .default_trigger = "heartbeat",
  86. },
  87. { /* D4 */
  88. .name = "led4",
  89. .gpio = AT91_PIN_PB15,
  90. .active_low = 1,
  91. },
  92. { /* D5 */
  93. .name = "led5",
  94. .gpio = AT91_PIN_PB8,
  95. .active_low = 1,
  96. }
  97. };
  98. /*
  99. * Ethernet
  100. */
  101. static struct at91_eth_data __initdata yl9200_eth_data = {
  102. .phy_irq_pin = AT91_PIN_PB28,
  103. .is_rmii = 1,
  104. };
  105. /*
  106. * USB Host
  107. */
  108. static struct at91_usbh_data __initdata yl9200_usbh_data = {
  109. .ports = 1, /* PQFP version of AT91RM9200 */
  110. };
  111. /*
  112. * USB Device
  113. */
  114. static struct at91_udc_data __initdata yl9200_udc_data = {
  115. .pullup_pin = AT91_PIN_PC4,
  116. .vbus_pin = AT91_PIN_PC5,
  117. .pullup_active_low = 1, /* Active Low due to PNP transistor (pg 7) */
  118. };
  119. /*
  120. * MMC
  121. */
  122. static struct at91_mmc_data __initdata yl9200_mmc_data = {
  123. .det_pin = AT91_PIN_PB9,
  124. // .wp_pin = ... not connected
  125. .wire4 = 1,
  126. };
  127. /*
  128. * NAND Flash
  129. */
  130. static struct mtd_partition __initdata yl9200_nand_partition[] = {
  131. {
  132. .name = "AT91 NAND partition 1, boot",
  133. .offset = 0,
  134. .size = SZ_256K
  135. },
  136. {
  137. .name = "AT91 NAND partition 2, kernel",
  138. .offset = MTDPART_OFS_NXTBLK,
  139. .size = (2 * SZ_1M) - SZ_256K
  140. },
  141. {
  142. .name = "AT91 NAND partition 3, filesystem",
  143. .offset = MTDPART_OFS_NXTBLK,
  144. .size = 14 * SZ_1M
  145. },
  146. {
  147. .name = "AT91 NAND partition 4, storage",
  148. .offset = MTDPART_OFS_NXTBLK,
  149. .size = SZ_16M
  150. },
  151. {
  152. .name = "AT91 NAND partition 5, ext-fs",
  153. .offset = MTDPART_OFS_NXTBLK,
  154. .size = SZ_32M
  155. }
  156. };
  157. static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
  158. {
  159. *num_partitions = ARRAY_SIZE(yl9200_nand_partition);
  160. return yl9200_nand_partition;
  161. }
  162. static struct atmel_nand_data __initdata yl9200_nand_data = {
  163. .ale = 6,
  164. .cle = 7,
  165. // .det_pin = ... not connected
  166. .rdy_pin = AT91_PIN_PC14, /* R/!B (Sheet10) */
  167. .enable_pin = AT91_PIN_PC15, /* !CE (Sheet10) */
  168. .partition_info = nand_partitions,
  169. };
  170. /*
  171. * NOR Flash
  172. */
  173. #define YL9200_FLASH_BASE AT91_CHIPSELECT_0
  174. #define YL9200_FLASH_SIZE SZ_16M
  175. static struct mtd_partition yl9200_flash_partitions[] = {
  176. {
  177. .name = "Bootloader",
  178. .offset = 0,
  179. .size = SZ_256K,
  180. .mask_flags = MTD_WRITEABLE, /* force read-only */
  181. },
  182. {
  183. .name = "Kernel",
  184. .offset = MTDPART_OFS_NXTBLK,
  185. .size = (2 * SZ_1M) - SZ_256K
  186. },
  187. {
  188. .name = "Filesystem",
  189. .offset = MTDPART_OFS_NXTBLK,
  190. .size = MTDPART_SIZ_FULL
  191. }
  192. };
  193. static struct physmap_flash_data yl9200_flash_data = {
  194. .width = 2,
  195. .parts = yl9200_flash_partitions,
  196. .nr_parts = ARRAY_SIZE(yl9200_flash_partitions),
  197. };
  198. static struct resource yl9200_flash_resources[] = {
  199. {
  200. .start = YL9200_FLASH_BASE,
  201. .end = YL9200_FLASH_BASE + YL9200_FLASH_SIZE - 1,
  202. .flags = IORESOURCE_MEM,
  203. }
  204. };
  205. static struct platform_device yl9200_flash = {
  206. .name = "physmap-flash",
  207. .id = 0,
  208. .dev = {
  209. .platform_data = &yl9200_flash_data,
  210. },
  211. .resource = yl9200_flash_resources,
  212. .num_resources = ARRAY_SIZE(yl9200_flash_resources),
  213. };
  214. /*
  215. * I2C (TWI)
  216. */
  217. static struct i2c_board_info __initdata yl9200_i2c_devices[] = {
  218. { /* EEPROM */
  219. I2C_BOARD_INFO("24c128", 0x50),
  220. }
  221. };
  222. /*
  223. * GPIO Buttons
  224. */
  225. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  226. static struct gpio_keys_button yl9200_buttons[] = {
  227. {
  228. .gpio = AT91_PIN_PA24,
  229. .code = BTN_2,
  230. .desc = "SW2",
  231. .active_low = 1,
  232. .wakeup = 1,
  233. },
  234. {
  235. .gpio = AT91_PIN_PB1,
  236. .code = BTN_3,
  237. .desc = "SW3",
  238. .active_low = 1,
  239. .wakeup = 1,
  240. },
  241. {
  242. .gpio = AT91_PIN_PB2,
  243. .code = BTN_4,
  244. .desc = "SW4",
  245. .active_low = 1,
  246. .wakeup = 1,
  247. },
  248. {
  249. .gpio = AT91_PIN_PB6,
  250. .code = BTN_5,
  251. .desc = "SW5",
  252. .active_low = 1,
  253. .wakeup = 1,
  254. }
  255. };
  256. static struct gpio_keys_platform_data yl9200_button_data = {
  257. .buttons = yl9200_buttons,
  258. .nbuttons = ARRAY_SIZE(yl9200_buttons),
  259. };
  260. static struct platform_device yl9200_button_device = {
  261. .name = "gpio-keys",
  262. .id = -1,
  263. .num_resources = 0,
  264. .dev = {
  265. .platform_data = &yl9200_button_data,
  266. }
  267. };
  268. static void __init yl9200_add_device_buttons(void)
  269. {
  270. at91_set_gpio_input(AT91_PIN_PA24, 1); /* SW2 */
  271. at91_set_deglitch(AT91_PIN_PA24, 1);
  272. at91_set_gpio_input(AT91_PIN_PB1, 1); /* SW3 */
  273. at91_set_deglitch(AT91_PIN_PB1, 1);
  274. at91_set_gpio_input(AT91_PIN_PB2, 1); /* SW4 */
  275. at91_set_deglitch(AT91_PIN_PB2, 1);
  276. at91_set_gpio_input(AT91_PIN_PB6, 1); /* SW5 */
  277. at91_set_deglitch(AT91_PIN_PB6, 1);
  278. /* Enable buttons (Sheet 5) */
  279. at91_set_gpio_output(AT91_PIN_PB7, 1);
  280. platform_device_register(&yl9200_button_device);
  281. }
  282. #else
  283. static void __init yl9200_add_device_buttons(void) {}
  284. #endif
  285. /*
  286. * Touchscreen
  287. */
  288. #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
  289. static int ads7843_pendown_state(void)
  290. {
  291. return !at91_get_gpio_value(AT91_PIN_PB11); /* Touchscreen PENIRQ */
  292. }
  293. static struct ads7846_platform_data ads_info = {
  294. .model = 7843,
  295. .x_min = 150,
  296. .x_max = 3830,
  297. .y_min = 190,
  298. .y_max = 3830,
  299. .vref_delay_usecs = 100,
  300. /* For a 8" touch-screen */
  301. // .x_plate_ohms = 603,
  302. // .y_plate_ohms = 332,
  303. /* For a 10.4" touch-screen */
  304. // .x_plate_ohms = 611,
  305. // .y_plate_ohms = 325,
  306. .x_plate_ohms = 576,
  307. .y_plate_ohms = 366,
  308. .pressure_max = 15000, /* generally nonsense on the 7843 */
  309. .debounce_max = 1,
  310. .debounce_rep = 0,
  311. .debounce_tol = (~0),
  312. .get_pendown_state = ads7843_pendown_state,
  313. };
  314. static void __init yl9200_add_device_ts(void)
  315. {
  316. at91_set_gpio_input(AT91_PIN_PB11, 1); /* Touchscreen interrupt pin */
  317. at91_set_gpio_input(AT91_PIN_PB10, 1); /* Touchscreen BUSY signal - not used! */
  318. }
  319. #else
  320. static void __init yl9200_add_device_ts(void) {}
  321. #endif
  322. /*
  323. * SPI devices
  324. */
  325. static struct spi_board_info yl9200_spi_devices[] = {
  326. #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
  327. { /* Touchscreen */
  328. .modalias = "ads7846",
  329. .chip_select = 0,
  330. .max_speed_hz = 5000 * 26,
  331. .platform_data = &ads_info,
  332. .irq = AT91_PIN_PB11,
  333. },
  334. #endif
  335. { /* CAN */
  336. .modalias = "mcp2510",
  337. .chip_select = 1,
  338. .max_speed_hz = 25000 * 26,
  339. .irq = AT91_PIN_PC0,
  340. }
  341. };
  342. /*
  343. * LCD / VGA
  344. *
  345. * EPSON S1D13806 FB (discontinued chip)
  346. * EPSON S1D13506 FB
  347. */
  348. #if defined(CONFIG_FB_S1D13XXX) || defined(CONFIG_FB_S1D13XXX_MODULE)
  349. #include <video/s1d13xxxfb.h>
  350. static void __init yl9200_init_video(void)
  351. {
  352. /* NWAIT Signal */
  353. at91_set_A_periph(AT91_PIN_PC6, 0);
  354. /* Initialization of the Static Memory Controller for Chip Select 2 */
  355. at91_sys_write(AT91_SMC_CSR(2), AT91_SMC_DBW_16 /* 16 bit */
  356. | AT91_SMC_WSEN | AT91_SMC_NWS_(0x4) /* wait states */
  357. | AT91_SMC_TDF_(0x100) /* float time */
  358. );
  359. }
  360. static struct s1d13xxxfb_regval yl9200_s1dfb_initregs[] =
  361. {
  362. {S1DREG_MISC, 0x00}, /* Miscellaneous Register*/
  363. {S1DREG_COM_DISP_MODE, 0x01}, /* Display Mode Register, LCD only*/
  364. {S1DREG_GPIO_CNF0, 0x00}, /* General IO Pins Configuration Register*/
  365. {S1DREG_GPIO_CTL0, 0x00}, /* General IO Pins Control Register*/
  366. {S1DREG_CLK_CNF, 0x11}, /* Memory Clock Configuration Register*/
  367. {S1DREG_LCD_CLK_CNF, 0x10}, /* LCD Pixel Clock Configuration Register*/
  368. {S1DREG_CRT_CLK_CNF, 0x12}, /* CRT/TV Pixel Clock Configuration Register*/
  369. {S1DREG_MPLUG_CLK_CNF, 0x01}, /* MediaPlug Clock Configuration Register*/
  370. {S1DREG_CPU2MEM_WST_SEL, 0x02}, /* CPU To Memory Wait State Select Register*/
  371. {S1DREG_MEM_CNF, 0x00}, /* Memory Configuration Register*/
  372. {S1DREG_SDRAM_REF_RATE, 0x04}, /* DRAM Refresh Rate Register, MCLK source*/
  373. {S1DREG_SDRAM_TC0, 0x12}, /* DRAM Timings Control Register 0*/
  374. {S1DREG_SDRAM_TC1, 0x02}, /* DRAM Timings Control Register 1*/
  375. {S1DREG_PANEL_TYPE, 0x25}, /* Panel Type Register*/
  376. {S1DREG_MOD_RATE, 0x00}, /* MOD Rate Register*/
  377. {S1DREG_LCD_DISP_HWIDTH, 0x4F}, /* LCD Horizontal Display Width Register*/
  378. {S1DREG_LCD_NDISP_HPER, 0x13}, /* LCD Horizontal Non-Display Period Register*/
  379. {S1DREG_TFT_FPLINE_START, 0x01}, /* TFT FPLINE Start Position Register*/
  380. {S1DREG_TFT_FPLINE_PWIDTH, 0x0c}, /* TFT FPLINE Pulse Width Register*/
  381. {S1DREG_LCD_DISP_VHEIGHT0, 0xDF}, /* LCD Vertical Display Height Register 0*/
  382. {S1DREG_LCD_DISP_VHEIGHT1, 0x01}, /* LCD Vertical Display Height Register 1*/
  383. {S1DREG_LCD_NDISP_VPER, 0x2c}, /* LCD Vertical Non-Display Period Register*/
  384. {S1DREG_TFT_FPFRAME_START, 0x0a}, /* TFT FPFRAME Start Position Register*/
  385. {S1DREG_TFT_FPFRAME_PWIDTH, 0x02}, /* TFT FPFRAME Pulse Width Register*/
  386. {S1DREG_LCD_DISP_MODE, 0x05}, /* LCD Display Mode Register*/
  387. {S1DREG_LCD_MISC, 0x01}, /* LCD Miscellaneous Register*/
  388. {S1DREG_LCD_DISP_START0, 0x00}, /* LCD Display Start Address Register 0*/
  389. {S1DREG_LCD_DISP_START1, 0x00}, /* LCD Display Start Address Register 1*/
  390. {S1DREG_LCD_DISP_START2, 0x00}, /* LCD Display Start Address Register 2*/
  391. {S1DREG_LCD_MEM_OFF0, 0x80}, /* LCD Memory Address Offset Register 0*/
  392. {S1DREG_LCD_MEM_OFF1, 0x02}, /* LCD Memory Address Offset Register 1*/
  393. {S1DREG_LCD_PIX_PAN, 0x03}, /* LCD Pixel Panning Register*/
  394. {S1DREG_LCD_DISP_FIFO_HTC, 0x00}, /* LCD Display FIFO High Threshold Control Register*/
  395. {S1DREG_LCD_DISP_FIFO_LTC, 0x00}, /* LCD Display FIFO Low Threshold Control Register*/
  396. {S1DREG_CRT_DISP_HWIDTH, 0x4F}, /* CRT/TV Horizontal Display Width Register*/
  397. {S1DREG_CRT_NDISP_HPER, 0x13}, /* CRT/TV Horizontal Non-Display Period Register*/
  398. {S1DREG_CRT_HRTC_START, 0x01}, /* CRT/TV HRTC Start Position Register*/
  399. {S1DREG_CRT_HRTC_PWIDTH, 0x0B}, /* CRT/TV HRTC Pulse Width Register*/
  400. {S1DREG_CRT_DISP_VHEIGHT0, 0xDF}, /* CRT/TV Vertical Display Height Register 0*/
  401. {S1DREG_CRT_DISP_VHEIGHT1, 0x01}, /* CRT/TV Vertical Display Height Register 1*/
  402. {S1DREG_CRT_NDISP_VPER, 0x2B}, /* CRT/TV Vertical Non-Display Period Register*/
  403. {S1DREG_CRT_VRTC_START, 0x09}, /* CRT/TV VRTC Start Position Register*/
  404. {S1DREG_CRT_VRTC_PWIDTH, 0x01}, /* CRT/TV VRTC Pulse Width Register*/
  405. {S1DREG_TV_OUT_CTL, 0x18}, /* TV Output Control Register */
  406. {S1DREG_CRT_DISP_MODE, 0x05}, /* CRT/TV Display Mode Register, 16BPP*/
  407. {S1DREG_CRT_DISP_START0, 0x00}, /* CRT/TV Display Start Address Register 0*/
  408. {S1DREG_CRT_DISP_START1, 0x00}, /* CRT/TV Display Start Address Register 1*/
  409. {S1DREG_CRT_DISP_START2, 0x00}, /* CRT/TV Display Start Address Register 2*/
  410. {S1DREG_CRT_MEM_OFF0, 0x80}, /* CRT/TV Memory Address Offset Register 0*/
  411. {S1DREG_CRT_MEM_OFF1, 0x02}, /* CRT/TV Memory Address Offset Register 1*/
  412. {S1DREG_CRT_PIX_PAN, 0x00}, /* CRT/TV Pixel Panning Register*/
  413. {S1DREG_CRT_DISP_FIFO_HTC, 0x00}, /* CRT/TV Display FIFO High Threshold Control Register*/
  414. {S1DREG_CRT_DISP_FIFO_LTC, 0x00}, /* CRT/TV Display FIFO Low Threshold Control Register*/
  415. {S1DREG_LCD_CUR_CTL, 0x00}, /* LCD Ink/Cursor Control Register*/
  416. {S1DREG_LCD_CUR_START, 0x01}, /* LCD Ink/Cursor Start Address Register*/
  417. {S1DREG_LCD_CUR_XPOS0, 0x00}, /* LCD Cursor X Position Register 0*/
  418. {S1DREG_LCD_CUR_XPOS1, 0x00}, /* LCD Cursor X Position Register 1*/
  419. {S1DREG_LCD_CUR_YPOS0, 0x00}, /* LCD Cursor Y Position Register 0*/
  420. {S1DREG_LCD_CUR_YPOS1, 0x00}, /* LCD Cursor Y Position Register 1*/
  421. {S1DREG_LCD_CUR_BCTL0, 0x00}, /* LCD Ink/Cursor Blue Color 0 Register*/
  422. {S1DREG_LCD_CUR_GCTL0, 0x00}, /* LCD Ink/Cursor Green Color 0 Register*/
  423. {S1DREG_LCD_CUR_RCTL0, 0x00}, /* LCD Ink/Cursor Red Color 0 Register*/
  424. {S1DREG_LCD_CUR_BCTL1, 0x1F}, /* LCD Ink/Cursor Blue Color 1 Register*/
  425. {S1DREG_LCD_CUR_GCTL1, 0x3F}, /* LCD Ink/Cursor Green Color 1 Register*/
  426. {S1DREG_LCD_CUR_RCTL1, 0x1F}, /* LCD Ink/Cursor Red Color 1 Register*/
  427. {S1DREG_LCD_CUR_FIFO_HTC, 0x00}, /* LCD Ink/Cursor FIFO Threshold Register*/
  428. {S1DREG_CRT_CUR_CTL, 0x00}, /* CRT/TV Ink/Cursor Control Register*/
  429. {S1DREG_CRT_CUR_START, 0x01}, /* CRT/TV Ink/Cursor Start Address Register*/
  430. {S1DREG_CRT_CUR_XPOS0, 0x00}, /* CRT/TV Cursor X Position Register 0*/
  431. {S1DREG_CRT_CUR_XPOS1, 0x00}, /* CRT/TV Cursor X Position Register 1*/
  432. {S1DREG_CRT_CUR_YPOS0, 0x00}, /* CRT/TV Cursor Y Position Register 0*/
  433. {S1DREG_CRT_CUR_YPOS1, 0x00}, /* CRT/TV Cursor Y Position Register 1*/
  434. {S1DREG_CRT_CUR_BCTL0, 0x00}, /* CRT/TV Ink/Cursor Blue Color 0 Register*/
  435. {S1DREG_CRT_CUR_GCTL0, 0x00}, /* CRT/TV Ink/Cursor Green Color 0 Register*/
  436. {S1DREG_CRT_CUR_RCTL0, 0x00}, /* CRT/TV Ink/Cursor Red Color 0 Register*/
  437. {S1DREG_CRT_CUR_BCTL1, 0x1F}, /* CRT/TV Ink/Cursor Blue Color 1 Register*/
  438. {S1DREG_CRT_CUR_GCTL1, 0x3F}, /* CRT/TV Ink/Cursor Green Color 1 Register*/
  439. {S1DREG_CRT_CUR_RCTL1, 0x1F}, /* CRT/TV Ink/Cursor Red Color 1 Register*/
  440. {S1DREG_CRT_CUR_FIFO_HTC, 0x00}, /* CRT/TV Ink/Cursor FIFO Threshold Register*/
  441. {S1DREG_BBLT_CTL0, 0x00}, /* BitBlt Control Register 0*/
  442. {S1DREG_BBLT_CTL1, 0x01}, /* BitBlt Control Register 1*/
  443. {S1DREG_BBLT_CC_EXP, 0x00}, /* BitBlt ROP Code/Color Expansion Register*/
  444. {S1DREG_BBLT_OP, 0x00}, /* BitBlt Operation Register*/
  445. {S1DREG_BBLT_SRC_START0, 0x00}, /* BitBlt Source Start Address Register 0*/
  446. {S1DREG_BBLT_SRC_START1, 0x00}, /* BitBlt Source Start Address Register 1*/
  447. {S1DREG_BBLT_SRC_START2, 0x00}, /* BitBlt Source Start Address Register 2*/
  448. {S1DREG_BBLT_DST_START0, 0x00}, /* BitBlt Destination Start Address Register 0*/
  449. {S1DREG_BBLT_DST_START1, 0x00}, /* BitBlt Destination Start Address Register 1*/
  450. {S1DREG_BBLT_DST_START2, 0x00}, /* BitBlt Destination Start Address Register 2*/
  451. {S1DREG_BBLT_MEM_OFF0, 0x00}, /* BitBlt Memory Address Offset Register 0*/
  452. {S1DREG_BBLT_MEM_OFF1, 0x00}, /* BitBlt Memory Address Offset Register 1*/
  453. {S1DREG_BBLT_WIDTH0, 0x00}, /* BitBlt Width Register 0*/
  454. {S1DREG_BBLT_WIDTH1, 0x00}, /* BitBlt Width Register 1*/
  455. {S1DREG_BBLT_HEIGHT0, 0x00}, /* BitBlt Height Register 0*/
  456. {S1DREG_BBLT_HEIGHT1, 0x00}, /* BitBlt Height Register 1*/
  457. {S1DREG_BBLT_BGC0, 0x00}, /* BitBlt Background Color Register 0*/
  458. {S1DREG_BBLT_BGC1, 0x00}, /* BitBlt Background Color Register 1*/
  459. {S1DREG_BBLT_FGC0, 0x00}, /* BitBlt Foreground Color Register 0*/
  460. {S1DREG_BBLT_FGC1, 0x00}, /* BitBlt Foreground Color Register 1*/
  461. {S1DREG_LKUP_MODE, 0x00}, /* Look-Up Table Mode Register*/
  462. {S1DREG_LKUP_ADDR, 0x00}, /* Look-Up Table Address Register*/
  463. {S1DREG_PS_CNF, 0x00}, /* Power Save Configuration Register*/
  464. {S1DREG_PS_STATUS, 0x00}, /* Power Save Status Register*/
  465. {S1DREG_CPU2MEM_WDOGT, 0x00}, /* CPU-to-Memory Access Watchdog Timer Register*/
  466. {S1DREG_COM_DISP_MODE, 0x01}, /* Display Mode Register, LCD only*/
  467. };
  468. static struct s1d13xxxfb_pdata yl9200_s1dfb_pdata = {
  469. .initregs = yl9200_s1dfb_initregs,
  470. .initregssize = ARRAY_SIZE(yl9200_s1dfb_initregs),
  471. .platform_init_video = yl9200_init_video,
  472. };
  473. #define YL9200_FB_REG_BASE AT91_CHIPSELECT_7
  474. #define YL9200_FB_VMEM_BASE YL9200_FB_REG_BASE + SZ_2M
  475. #define YL9200_FB_VMEM_SIZE SZ_2M
  476. static struct resource yl9200_s1dfb_resource[] = {
  477. [0] = { /* video mem */
  478. .name = "s1d13xxxfb memory",
  479. .start = YL9200_FB_VMEM_BASE,
  480. .end = YL9200_FB_VMEM_BASE + YL9200_FB_VMEM_SIZE -1,
  481. .flags = IORESOURCE_MEM,
  482. },
  483. [1] = { /* video registers */
  484. .name = "s1d13xxxfb registers",
  485. .start = YL9200_FB_REG_BASE,
  486. .end = YL9200_FB_REG_BASE + SZ_512 -1,
  487. .flags = IORESOURCE_MEM,
  488. },
  489. };
  490. static u64 s1dfb_dmamask = DMA_BIT_MASK(32);
  491. static struct platform_device yl9200_s1dfb_device = {
  492. .name = "s1d13806fb",
  493. .id = -1,
  494. .dev = {
  495. .dma_mask = &s1dfb_dmamask,
  496. .coherent_dma_mask = DMA_BIT_MASK(32),
  497. .platform_data = &yl9200_s1dfb_pdata,
  498. },
  499. .resource = yl9200_s1dfb_resource,
  500. .num_resources = ARRAY_SIZE(yl9200_s1dfb_resource),
  501. };
  502. void __init yl9200_add_device_video(void)
  503. {
  504. platform_device_register(&yl9200_s1dfb_device);
  505. }
  506. #else
  507. void __init yl9200_add_device_video(void) {}
  508. #endif
  509. static void __init yl9200_board_init(void)
  510. {
  511. /* Serial */
  512. at91_add_device_serial();
  513. /* Ethernet */
  514. at91_add_device_eth(&yl9200_eth_data);
  515. /* USB Host */
  516. at91_add_device_usbh(&yl9200_usbh_data);
  517. /* USB Device */
  518. at91_add_device_udc(&yl9200_udc_data);
  519. /* I2C */
  520. at91_add_device_i2c(yl9200_i2c_devices, ARRAY_SIZE(yl9200_i2c_devices));
  521. /* MMC */
  522. at91_add_device_mmc(0, &yl9200_mmc_data);
  523. /* NAND */
  524. at91_add_device_nand(&yl9200_nand_data);
  525. /* NOR Flash */
  526. platform_device_register(&yl9200_flash);
  527. #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
  528. /* SPI */
  529. at91_add_device_spi(yl9200_spi_devices, ARRAY_SIZE(yl9200_spi_devices));
  530. /* Touchscreen */
  531. yl9200_add_device_ts();
  532. #endif
  533. /* LEDs. */
  534. at91_gpio_leds(yl9200_leds, ARRAY_SIZE(yl9200_leds));
  535. /* Push Buttons */
  536. yl9200_add_device_buttons();
  537. /* VGA */
  538. yl9200_add_device_video();
  539. }
  540. MACHINE_START(YL9200, "uCdragon YL-9200")
  541. /* Maintainer: S.Birtles */
  542. .timer = &at91rm9200_timer,
  543. .map_io = at91rm9200_map_io,
  544. .init_early = yl9200_init_early,
  545. .init_irq = yl9200_init_irq,
  546. .init_machine = yl9200_board_init,
  547. MACHINE_END