board-yl-9200.c 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. /*
  2. * linux/arch/arm/mach-at91/board-yl-9200.c
  3. *
  4. * Adapted from:
  5. *various board files in
  6. * /arch/arm/mach-at91
  7. * modifications to convert to YL-9200 platform
  8. * Copyright (C) 2007 S.Birtles
  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 as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. */
  24. #include <linux/types.h>
  25. #include <linux/init.h>
  26. #include <linux/mm.h>
  27. #include <linux/module.h>
  28. #include <linux/platform_device.h>
  29. #include <linux/spi/spi.h>
  30. /*#include <linux/can_bus/candata.h>*/
  31. #include <linux/spi/ads7846.h>
  32. #include <linux/mtd/physmap.h>
  33. /*#include <sound/gpio_sounder.h>*/
  34. #include <asm/hardware.h>
  35. #include <asm/setup.h>
  36. #include <asm/mach-types.h>
  37. #include <asm/irq.h>
  38. #include <asm/mach/arch.h>
  39. #include <asm/mach/map.h>
  40. #include <asm/mach/irq.h>
  41. #include <asm/arch/board.h>
  42. #include <asm/arch/gpio.h>
  43. #include <asm/arch/at91rm9200_mc.h>
  44. #include <linux/gpio_keys.h>
  45. #include <linux/input.h>
  46. #include "generic.h"
  47. #include <asm/arch/at91_pio.h>
  48. #define YL_9200_FLASH_BASE AT91_CHIPSELECT_0
  49. #define YL_9200_FLASH_SIZE 0x800000
  50. /*
  51. * Serial port configuration.
  52. * 0 .. 3 = USART0 .. USART3
  53. * 4 = DBGU
  54. *atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL
  55. *atmel_usart.1: ttyS1 at MMIO 0xfffc0000 (irq = 6) is a ATMEL_SERIAL
  56. *atmel_usart.2: ttyS2 at MMIO 0xfffc4000 (irq = 7) is a ATMEL_SERIAL
  57. *atmel_usart.3: ttyS3 at MMIO 0xfffc8000 (irq = 8) is a ATMEL_SERIAL
  58. *atmel_usart.4: ttyS4 at MMIO 0xfffcc000 (irq = 9) is a ATMEL_SERIAL
  59. * on the YL-9200 we are sitting at the following
  60. *ttyS0 at MMIO 0xfefff200 (irq = 1) is a AT91_SERIAL
  61. *ttyS1 at MMIO 0xfefc4000 (irq = 7) is a AT91_SERIAL
  62. */
  63. /* extern void __init yl_9200_add_device_sounder(struct gpio_sounder *sounders, int nr);*/
  64. static struct at91_uart_config __initdata yl_9200_uart_config = {
  65. .console_tty = 0, /* ttyS0 */
  66. .nr_tty = 3,
  67. .tty_map = { 4, 1, 0, -1, -1 } /* ttyS0, ..., ttyS4 */
  68. };
  69. static void __init yl_9200_map_io(void)
  70. {
  71. /* Initialize processor: 18.432 MHz crystal */
  72. /*Also initialises register clocks & gpio*/
  73. at91rm9200_initialize(18432000, AT91RM9200_PQFP); /*we have a 3 bank system*/
  74. /* Setup the serial ports and console */
  75. at91_init_serial(&yl_9200_uart_config);
  76. /* Setup the LEDs D2=PB17,D3=PB16 */
  77. at91_init_leds(AT91_PIN_PB16,AT91_PIN_PB17); /*cpu-led,timer-led*/
  78. }
  79. static void __init yl_9200_init_irq(void)
  80. {
  81. at91rm9200_init_interrupts(NULL);
  82. }
  83. static struct at91_eth_data __initdata yl_9200_eth_data = {
  84. .phy_irq_pin = AT91_PIN_PB28,
  85. .is_rmii = 1,
  86. };
  87. static struct at91_usbh_data __initdata yl_9200_usbh_data = {
  88. .ports = 1, /* this should be 1 not 2 for the Yl9200*/
  89. };
  90. static struct at91_udc_data __initdata yl_9200_udc_data = {
  91. /*on sheet 7 Schemitic rev 1.0*/
  92. .pullup_pin = AT91_PIN_PC4,
  93. .vbus_pin= AT91_PIN_PC5,
  94. .pullup_active_low = 1, /*ACTIVE LOW!! due to PNP transistor on page 7*/
  95. };
  96. /*
  97. static struct at91_cf_data __initdata yl_9200_cf_data = {
  98. TODO S.BIRTLES
  99. .det_pin = AT91_PIN_xxx,
  100. .rst_pin = AT91_PIN_xxx,
  101. .irq_pin = ... not connected
  102. .vcc_pin = ... always powered
  103. };
  104. */
  105. static struct at91_mmc_data __initdata yl_9200_mmc_data = {
  106. .det_pin = AT91_PIN_PB9, /*THIS LOOKS CORRECT SHEET7*/
  107. /* .wp_pin = ... not connected SHEET7*/
  108. .slot_b = 0,
  109. .wire4 = 1,
  110. };
  111. /* --------------------------------------------------------------------
  112. * Touch screen
  113. * -------------------------------------------------------------------- */
  114. #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
  115. static int ads7843_pendown_state(void)
  116. {
  117. return !at91_get_gpio_value(AT91_PIN_PB11); /* Touchscreen PENIRQ */
  118. }
  119. static void __init at91_init_device_ts(void)
  120. {
  121. /*IMPORTANT NOTE THE SPI INTERFACE IS ALREADY CONFIGURED BY XXX_DEVICES.C
  122. THAT IS TO SAY THAT MISO,MOSI,SPCK AND CS are already configured
  123. we only need to enable the other datapins which are:
  124. PB10/RK1 BUSY
  125. */
  126. /* Touchscreen BUSY signal , pin,use pullup ( TODO not currently used in the ADS7843/6.c driver)*/
  127. at91_set_gpio_input(AT91_PIN_PB10, 1);
  128. }
  129. #else
  130. static void __init at91_init_device_ts(void) {}
  131. #endif
  132. static struct ads7846_platform_data ads_info = {
  133. .model = 7843,
  134. .x_min = 150,
  135. .x_max = 3830,
  136. .y_min = 190,
  137. .y_max = 3830,
  138. .vref_delay_usecs = 100,
  139. /* for a 8" touch screen*/
  140. //.x_plate_ohms = 603, //= 450, S.Birtles TODO
  141. //.y_plate_ohms = 332, //= 250, S.Birtles TODO
  142. /*for a 10.4" touch screen*/
  143. //.x_plate_ohms =611,
  144. //.y_plate_ohms =325,
  145. .x_plate_ohms = 576,
  146. .y_plate_ohms = 366,
  147. //
  148. .pressure_max = 15000, /*generally nonsense on the 7843*/
  149. /*number of times to send query to chip in a given run 0 equals one time (do not set to 0!! ,there is a bug in ADS 7846 code)*/
  150. .debounce_max = 1,
  151. .debounce_rep = 0,
  152. .debounce_tol = (~0),
  153. .get_pendown_state = ads7843_pendown_state,
  154. };
  155. /*static struct canbus_platform_data can_info = {
  156. .model = 2510,
  157. };
  158. */
  159. static struct spi_board_info yl_9200_spi_devices[] = {
  160. /*this sticks it at:
  161. /sys/devices/platform/atmel_spi.0/spi0.0
  162. /sys/bus/platform/devices/
  163. Documentation/spi IIRC*/
  164. #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
  165. /*(this IS correct 04-NOV-2007)*/
  166. {
  167. .modalias = "ads7846", /* because the driver is called ads7846*/
  168. .chip_select = 0, /*THIS MUST BE AN INDEX INTO AN ARRAY OF pins */
  169. /*this is ONLY TO BE USED if chipselect above is not used, it passes a pin directly for the chip select*/
  170. /*.controller_data =AT91_PIN_PA3 ,*/
  171. .max_speed_hz = 5000*26, /*(4700 * 26)-125000 * 26, (max sample rate @ 3V) * (cmd + data + overhead) */
  172. .bus_num = 0,
  173. .platform_data = &ads_info,
  174. .irq = AT91_PIN_PB11,
  175. },
  176. #endif
  177. /*we need to put our CAN driver data here!!*/
  178. /*THIS IS ALL DUMMY DATA*/
  179. /* {
  180. .modalias = "mcp2510", //DUMMY for MCP2510 chip
  181. .chip_select = 1,*/ /*THIS MUST BE AN INDEX INTO AN ARRAY OF pins */
  182. /*this is ONLY TO BE USED if chipselect above is not used, it passes a pin directly for the chip select */
  183. /* .controller_data =AT91_PIN_PA4 ,
  184. .max_speed_hz = 25000 * 26,
  185. .bus_num = 0,
  186. .platform_data = &can_info,
  187. .irq = AT91_PIN_PC0,
  188. },
  189. */
  190. //max SPI chip needs to go here
  191. };
  192. static struct mtd_partition __initdata yl_9200_nand_partition[] = {
  193. {
  194. .name = "AT91 NAND partition 1, boot",
  195. .offset = 0,
  196. .size = 1 * SZ_256K
  197. },
  198. {
  199. .name = "AT91 NAND partition 2, kernel",
  200. .offset = 1 * SZ_256K,
  201. .size = 2 * SZ_1M - 1 * SZ_256K
  202. },
  203. {
  204. .name = "AT91 NAND partition 3, filesystem",
  205. .offset = 2 * SZ_1M,
  206. .size = 14 * SZ_1M
  207. },
  208. {
  209. .name = "AT91 NAND partition 4, storage",
  210. .offset = 16 * SZ_1M,
  211. .size = 16 * SZ_1M
  212. },
  213. {
  214. .name = "AT91 NAND partition 5, ext-fs",
  215. .offset = 32 * SZ_1M,
  216. .size = 32 * SZ_1M
  217. },
  218. };
  219. static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
  220. {
  221. *num_partitions = ARRAY_SIZE(yl_9200_nand_partition);
  222. return yl_9200_nand_partition;
  223. }
  224. static struct at91_nand_data __initdata yl_9200_nand_data = {
  225. .ale= 6,
  226. .cle= 7,
  227. /*.det_pin = AT91_PIN_PCxx,*/ /*we don't have a det pin because NandFlash is fixed to board*/
  228. .rdy_pin = AT91_PIN_PC14, /*R/!B Sheet10*/
  229. .enable_pin = AT91_PIN_PC15, /*!CE Sheet10 */
  230. .partition_info = nand_partitions,
  231. };
  232. /*
  233. TODO S.Birtles
  234. potentially a problem with the size above
  235. physmap platform flash device: 00800000 at 10000000
  236. physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
  237. NOR chip too large to fit in mapping. Attempting to cope...
  238. Intel/Sharp Extended Query Table at 0x0031
  239. Using buffer write method
  240. cfi_cmdset_0001: Erase suspend on write enabled
  241. Reducing visibility of 16384KiB chip to 8192KiB
  242. */
  243. static struct mtd_partition yl_9200_flash_partitions[] = {
  244. {
  245. .name = "Bootloader",
  246. .size = 0x00040000,
  247. .offset = 0,
  248. .mask_flags = MTD_WRITEABLE /* force read-only */
  249. },{
  250. .name = "Kernel",
  251. .size = 0x001C0000,
  252. .offset = 0x00040000,
  253. },{
  254. .name = "Filesystem",
  255. .size = MTDPART_SIZ_FULL,
  256. .offset = 0x00200000
  257. }
  258. };
  259. static struct physmap_flash_data yl_9200_flash_data = {
  260. .width = 2,
  261. .parts = yl_9200_flash_partitions,
  262. .nr_parts = ARRAY_SIZE(yl_9200_flash_partitions),
  263. };
  264. static struct resource yl_9200_flash_resources[] = {
  265. {
  266. .start = YL_9200_FLASH_BASE,
  267. .end = YL_9200_FLASH_BASE + YL_9200_FLASH_SIZE - 1,
  268. .flags = IORESOURCE_MEM,
  269. }
  270. };
  271. static struct platform_device yl_9200_flash = {
  272. .name = "physmap-flash",
  273. .id = 0,
  274. .dev = {
  275. .platform_data = &yl_9200_flash_data,
  276. },
  277. .resource = yl_9200_flash_resources,
  278. .num_resources = ARRAY_SIZE(yl_9200_flash_resources),
  279. };
  280. static struct gpio_led yl_9200_leds[] = {
  281. /*D2 &D3 are passed directly in via at91_init_leds*/
  282. {
  283. .name = "led4", /*D4*/
  284. .gpio = AT91_PIN_PB15,
  285. .active_low = 1,
  286. .default_trigger = "heartbeat",
  287. /*.default_trigger = "timer",*/
  288. },
  289. {
  290. .name = "led5", /*D5*/
  291. .gpio = AT91_PIN_PB8,
  292. .active_low = 1,
  293. .default_trigger = "heartbeat",
  294. }
  295. };
  296. //static struct gpio_sounder yl_9200_sounder[] = {*/
  297. /*This is a simple speaker attached to a gpo line*/
  298. // {
  299. // .name = "Speaker", /*LS1*/
  300. // .gpio = AT91_PIN_PA22,
  301. // .active_low = 0,
  302. // .default_trigger = "heartbeat",
  303. /*.default_trigger = "timer",*/
  304. // },
  305. //};
  306. static struct i2c_board_info __initdata yl_9200_i2c_devices[] = {
  307. {
  308. /*TODO*/
  309. I2C_BOARD_INFO("CS4334", 0x00),
  310. }
  311. };
  312. /*
  313. * GPIO Buttons
  314. */
  315. #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  316. static struct gpio_keys_button yl_9200_buttons[] = {
  317. {
  318. .gpio = AT91_PIN_PA24,
  319. .code = BTN_2,
  320. .desc = "SW2",
  321. .active_low = 1,
  322. .wakeup = 1,
  323. },
  324. {
  325. .gpio = AT91_PIN_PB1,
  326. .code = BTN_3,
  327. .desc = "SW3",
  328. .active_low = 1,
  329. .wakeup = 1,
  330. },
  331. {
  332. .gpio = AT91_PIN_PB2,
  333. .code = BTN_4,
  334. .desc = "SW4",
  335. .active_low = 1,
  336. .wakeup = 1,
  337. },
  338. {
  339. .gpio = AT91_PIN_PB6,
  340. .code = BTN_5,
  341. .desc = "SW5",
  342. .active_low = 1,
  343. .wakeup = 1,
  344. },
  345. };
  346. static struct gpio_keys_platform_data yl_9200_button_data = {
  347. .buttons = yl_9200_buttons,
  348. .nbuttons = ARRAY_SIZE(yl_9200_buttons),
  349. };
  350. static struct platform_device yl_9200_button_device = {
  351. .name = "gpio-keys",
  352. .id = -1,
  353. .num_resources = 0,
  354. .dev = {
  355. .platform_data = &yl_9200_button_data,
  356. }
  357. };
  358. static void __init yl_9200_add_device_buttons(void)
  359. {
  360. //SW2
  361. at91_set_gpio_input(AT91_PIN_PA24, 0);
  362. at91_set_deglitch(AT91_PIN_PA24, 1);
  363. //SW3
  364. at91_set_gpio_input(AT91_PIN_PB1, 0);
  365. at91_set_deglitch(AT91_PIN_PB1, 1);
  366. //SW4
  367. at91_set_gpio_input(AT91_PIN_PB2, 0);
  368. at91_set_deglitch(AT91_PIN_PB2, 1);
  369. //SW5
  370. at91_set_gpio_input(AT91_PIN_PB6, 0);
  371. at91_set_deglitch(AT91_PIN_PB6, 1);
  372. at91_set_gpio_output(AT91_PIN_PB7, 1); /* #TURN BUTTONS ON, SHEET 5 of schematics */
  373. platform_device_register(&yl_9200_button_device);
  374. }
  375. #else
  376. static void __init yl_9200_add_device_buttons(void) {}
  377. #endif
  378. #if defined(CONFIG_FB_S1D135XX) || defined(CONFIG_FB_S1D13XXX_MODULE)
  379. #include <video/s1d13xxxfb.h>
  380. /* EPSON S1D13806 FB (discontinued chip)*/
  381. /* EPSON S1D13506 FB */
  382. #define AT91_FB_REG_BASE 0x80000000L
  383. #define AT91_FB_REG_SIZE 0x200
  384. #define AT91_FB_VMEM_BASE 0x80200000L
  385. #define AT91_FB_VMEM_SIZE 0x200000L
  386. /*#define S1D_DISPLAY_WIDTH 640*/
  387. /*#define S1D_DISPLAY_HEIGHT 480*/
  388. static void __init yl_9200_init_video(void)
  389. {
  390. at91_sys_write(AT91_PIOC + PIO_ASR,AT91_PIN_PC6);
  391. at91_sys_write(AT91_PIOC + PIO_BSR,0);
  392. at91_sys_write(AT91_PIOC + PIO_ASR,AT91_PIN_PC6);
  393. at91_sys_write( AT91_SMC_CSR(2),
  394. AT91_SMC_NWS_(0x4) |
  395. AT91_SMC_WSEN |
  396. AT91_SMC_TDF_(0x100) |
  397. AT91_SMC_DBW
  398. );
  399. }
  400. static struct s1d13xxxfb_regval yl_9200_s1dfb_initregs[] =
  401. {
  402. {S1DREG_MISC, 0x00}, /* Miscellaneous Register*/
  403. {S1DREG_COM_DISP_MODE, 0x01}, /* Display Mode Register, LCD only*/
  404. {S1DREG_GPIO_CNF0, 0x00}, /* General IO Pins Configuration Register*/
  405. {S1DREG_GPIO_CTL0, 0x00}, /* General IO Pins Control Register*/
  406. {S1DREG_CLK_CNF, 0x11}, /* Memory Clock Configuration Register*/
  407. {S1DREG_LCD_CLK_CNF, 0x10}, /* LCD Pixel Clock Configuration Register*/
  408. {S1DREG_CRT_CLK_CNF, 0x12}, /* CRT/TV Pixel Clock Configuration Register*/
  409. {S1DREG_MPLUG_CLK_CNF, 0x01}, /* MediaPlug Clock Configuration Register*/
  410. {S1DREG_CPU2MEM_WST_SEL, 0x02}, /* CPU To Memory Wait State Select Register*/
  411. {S1DREG_MEM_CNF, 0x00}, /* Memory Configuration Register*/
  412. {S1DREG_SDRAM_REF_RATE, 0x04}, /* DRAM Refresh Rate Register, MCLK source*/
  413. {S1DREG_SDRAM_TC0, 0x12}, /* DRAM Timings Control Register 0*/
  414. {S1DREG_SDRAM_TC1, 0x02}, /* DRAM Timings Control Register 1*/
  415. {S1DREG_PANEL_TYPE, 0x25}, /* Panel Type Register*/
  416. {S1DREG_MOD_RATE, 0x00}, /* MOD Rate Register*/
  417. {S1DREG_LCD_DISP_HWIDTH, 0x4F}, /* LCD Horizontal Display Width Register*/
  418. {S1DREG_LCD_NDISP_HPER, 0x13}, /* LCD Horizontal Non-Display Period Register*/
  419. {S1DREG_TFT_FPLINE_START, 0x01}, /* TFT FPLINE Start Position Register*/
  420. {S1DREG_TFT_FPLINE_PWIDTH, 0x0c}, /* TFT FPLINE Pulse Width Register*/
  421. {S1DREG_LCD_DISP_VHEIGHT0, 0xDF}, /* LCD Vertical Display Height Register 0*/
  422. {S1DREG_LCD_DISP_VHEIGHT1, 0x01}, /* LCD Vertical Display Height Register 1*/
  423. {S1DREG_LCD_NDISP_VPER, 0x2c}, /* LCD Vertical Non-Display Period Register*/
  424. {S1DREG_TFT_FPFRAME_START, 0x0a}, /* TFT FPFRAME Start Position Register*/
  425. {S1DREG_TFT_FPFRAME_PWIDTH, 0x02}, /* TFT FPFRAME Pulse Width Register*/
  426. {S1DREG_LCD_DISP_MODE, 0x05}, /* LCD Display Mode Register*/
  427. {S1DREG_LCD_MISC, 0x01}, /* LCD Miscellaneous Register*/
  428. {S1DREG_LCD_DISP_START0, 0x00}, /* LCD Display Start Address Register 0*/
  429. {S1DREG_LCD_DISP_START1, 0x00}, /* LCD Display Start Address Register 1*/
  430. {S1DREG_LCD_DISP_START2, 0x00}, /* LCD Display Start Address Register 2*/
  431. {S1DREG_LCD_MEM_OFF0, 0x80}, /* LCD Memory Address Offset Register 0*/
  432. {S1DREG_LCD_MEM_OFF1, 0x02}, /* LCD Memory Address Offset Register 1*/
  433. {S1DREG_LCD_PIX_PAN, 0x03}, /* LCD Pixel Panning Register*/
  434. {S1DREG_LCD_DISP_FIFO_HTC, 0x00}, /* LCD Display FIFO High Threshold Control Register*/
  435. {S1DREG_LCD_DISP_FIFO_LTC, 0x00}, /* LCD Display FIFO Low Threshold Control Register*/
  436. {S1DREG_CRT_DISP_HWIDTH, 0x4F}, /* CRT/TV Horizontal Display Width Register*/
  437. {S1DREG_CRT_NDISP_HPER, 0x13}, /* CRT/TV Horizontal Non-Display Period Register*/
  438. {S1DREG_CRT_HRTC_START, 0x01}, /* CRT/TV HRTC Start Position Register*/
  439. {S1DREG_CRT_HRTC_PWIDTH, 0x0B}, /* CRT/TV HRTC Pulse Width Register*/
  440. {S1DREG_CRT_DISP_VHEIGHT0, 0xDF}, /* CRT/TV Vertical Display Height Register 0*/
  441. {S1DREG_CRT_DISP_VHEIGHT1, 0x01}, /* CRT/TV Vertical Display Height Register 1*/
  442. {S1DREG_CRT_NDISP_VPER, 0x2B}, /* CRT/TV Vertical Non-Display Period Register*/
  443. {S1DREG_CRT_VRTC_START, 0x09}, /* CRT/TV VRTC Start Position Register*/
  444. {S1DREG_CRT_VRTC_PWIDTH, 0x01}, /* CRT/TV VRTC Pulse Width Register*/
  445. {S1DREG_TV_OUT_CTL, 0x18}, /* TV Output Control Register */
  446. {S1DREG_CRT_DISP_MODE, 0x05}, /* CRT/TV Display Mode Register, 16BPP*/
  447. {S1DREG_CRT_DISP_START0, 0x00}, /* CRT/TV Display Start Address Register 0*/
  448. {S1DREG_CRT_DISP_START1, 0x00}, /* CRT/TV Display Start Address Register 1*/
  449. {S1DREG_CRT_DISP_START2, 0x00}, /* CRT/TV Display Start Address Register 2*/
  450. {S1DREG_CRT_MEM_OFF0, 0x80}, /* CRT/TV Memory Address Offset Register 0*/
  451. {S1DREG_CRT_MEM_OFF1, 0x02}, /* CRT/TV Memory Address Offset Register 1*/
  452. {S1DREG_CRT_PIX_PAN, 0x00}, /* CRT/TV Pixel Panning Register*/
  453. {S1DREG_CRT_DISP_FIFO_HTC, 0x00}, /* CRT/TV Display FIFO High Threshold Control Register*/
  454. {S1DREG_CRT_DISP_FIFO_LTC, 0x00}, /* CRT/TV Display FIFO Low Threshold Control Register*/
  455. {S1DREG_LCD_CUR_CTL, 0x00}, /* LCD Ink/Cursor Control Register*/
  456. {S1DREG_LCD_CUR_START, 0x01}, /* LCD Ink/Cursor Start Address Register*/
  457. {S1DREG_LCD_CUR_XPOS0, 0x00}, /* LCD Cursor X Position Register 0*/
  458. {S1DREG_LCD_CUR_XPOS1, 0x00}, /* LCD Cursor X Position Register 1*/
  459. {S1DREG_LCD_CUR_YPOS0, 0x00}, /* LCD Cursor Y Position Register 0*/
  460. {S1DREG_LCD_CUR_YPOS1, 0x00}, /* LCD Cursor Y Position Register 1*/
  461. {S1DREG_LCD_CUR_BCTL0, 0x00}, /* LCD Ink/Cursor Blue Color 0 Register*/
  462. {S1DREG_LCD_CUR_GCTL0, 0x00}, /* LCD Ink/Cursor Green Color 0 Register*/
  463. {S1DREG_LCD_CUR_RCTL0, 0x00}, /* LCD Ink/Cursor Red Color 0 Register*/
  464. {S1DREG_LCD_CUR_BCTL1, 0x1F}, /* LCD Ink/Cursor Blue Color 1 Register*/
  465. {S1DREG_LCD_CUR_GCTL1, 0x3F}, /* LCD Ink/Cursor Green Color 1 Register*/
  466. {S1DREG_LCD_CUR_RCTL1, 0x1F}, /* LCD Ink/Cursor Red Color 1 Register*/
  467. {S1DREG_LCD_CUR_FIFO_HTC, 0x00}, /* LCD Ink/Cursor FIFO Threshold Register*/
  468. {S1DREG_CRT_CUR_CTL, 0x00}, /* CRT/TV Ink/Cursor Control Register*/
  469. {S1DREG_CRT_CUR_START, 0x01}, /* CRT/TV Ink/Cursor Start Address Register*/
  470. {S1DREG_CRT_CUR_XPOS0, 0x00}, /* CRT/TV Cursor X Position Register 0*/
  471. {S1DREG_CRT_CUR_XPOS1, 0x00}, /* CRT/TV Cursor X Position Register 1*/
  472. {S1DREG_CRT_CUR_YPOS0, 0x00}, /* CRT/TV Cursor Y Position Register 0*/
  473. {S1DREG_CRT_CUR_YPOS1, 0x00}, /* CRT/TV Cursor Y Position Register 1*/
  474. {S1DREG_CRT_CUR_BCTL0, 0x00}, /* CRT/TV Ink/Cursor Blue Color 0 Register*/
  475. {S1DREG_CRT_CUR_GCTL0, 0x00}, /* CRT/TV Ink/Cursor Green Color 0 Register*/
  476. {S1DREG_CRT_CUR_RCTL0, 0x00}, /* CRT/TV Ink/Cursor Red Color 0 Register*/
  477. {S1DREG_CRT_CUR_BCTL1, 0x1F}, /* CRT/TV Ink/Cursor Blue Color 1 Register*/
  478. {S1DREG_CRT_CUR_GCTL1, 0x3F}, /* CRT/TV Ink/Cursor Green Color 1 Register*/
  479. {S1DREG_CRT_CUR_RCTL1, 0x1F}, /* CRT/TV Ink/Cursor Red Color 1 Register*/
  480. {S1DREG_CRT_CUR_FIFO_HTC, 0x00}, /* CRT/TV Ink/Cursor FIFO Threshold Register*/
  481. {S1DREG_BBLT_CTL0, 0x00}, /* BitBlt Control Register 0*/
  482. {S1DREG_BBLT_CTL1, 0x01}, /* BitBlt Control Register 1*/
  483. {S1DREG_BBLT_CC_EXP, 0x00}, /* BitBlt ROP Code/Color Expansion Register*/
  484. {S1DREG_BBLT_OP, 0x00}, /* BitBlt Operation Register*/
  485. {S1DREG_BBLT_SRC_START0, 0x00}, /* BitBlt Source Start Address Register 0*/
  486. {S1DREG_BBLT_SRC_START1, 0x00}, /* BitBlt Source Start Address Register 1*/
  487. {S1DREG_BBLT_SRC_START2, 0x00}, /* BitBlt Source Start Address Register 2*/
  488. {S1DREG_BBLT_DST_START0, 0x00}, /* BitBlt Destination Start Address Register 0*/
  489. {S1DREG_BBLT_DST_START1, 0x00}, /* BitBlt Destination Start Address Register 1*/
  490. {S1DREG_BBLT_DST_START2, 0x00}, /* BitBlt Destination Start Address Register 2*/
  491. {S1DREG_BBLT_MEM_OFF0, 0x00}, /* BitBlt Memory Address Offset Register 0*/
  492. {S1DREG_BBLT_MEM_OFF1, 0x00}, /* BitBlt Memory Address Offset Register 1*/
  493. {S1DREG_BBLT_WIDTH0, 0x00}, /* BitBlt Width Register 0*/
  494. {S1DREG_BBLT_WIDTH1, 0x00}, /* BitBlt Width Register 1*/
  495. {S1DREG_BBLT_HEIGHT0, 0x00}, /* BitBlt Height Register 0*/
  496. {S1DREG_BBLT_HEIGHT1, 0x00}, /* BitBlt Height Register 1*/
  497. {S1DREG_BBLT_BGC0, 0x00}, /* BitBlt Background Color Register 0*/
  498. {S1DREG_BBLT_BGC1, 0x00}, /* BitBlt Background Color Register 1*/
  499. {S1DREG_BBLT_FGC0, 0x00}, /* BitBlt Foreground Color Register 0*/
  500. {S1DREG_BBLT_FGC1, 0x00}, /* BitBlt Foreground Color Register 1*/
  501. {S1DREG_LKUP_MODE, 0x00}, /* Look-Up Table Mode Register*/
  502. {S1DREG_LKUP_ADDR, 0x00}, /* Look-Up Table Address Register*/
  503. {S1DREG_PS_CNF, 0x00}, /* Power Save Configuration Register*/
  504. {S1DREG_PS_STATUS, 0x00}, /* Power Save Status Register*/
  505. {S1DREG_CPU2MEM_WDOGT, 0x00}, /* CPU-to-Memory Access Watchdog Timer Register*/
  506. {S1DREG_COM_DISP_MODE, 0x01}, /* Display Mode Register, LCD only*/
  507. };
  508. static u64 s1dfb_dmamask = 0xffffffffUL;
  509. static struct s1d13xxxfb_pdata yl_9200_s1dfb_pdata = {
  510. .initregs = yl_9200_s1dfb_initregs,
  511. .initregssize = ARRAY_SIZE(yl_9200_s1dfb_initregs),
  512. .platform_init_video = yl_9200_init_video,
  513. };
  514. static struct resource yl_9200_s1dfb_resource[] = {
  515. [0] = { /* video mem */
  516. .name = "s1d13xxxfb memory",
  517. /* .name = "s1d13806 memory",*/
  518. .start = AT91_FB_VMEM_BASE,
  519. .end = AT91_FB_VMEM_BASE + AT91_FB_VMEM_SIZE -1,
  520. .flags = IORESOURCE_MEM,
  521. },
  522. [1] = { /* video registers */
  523. .name = "s1d13xxxfb registers",
  524. /* .name = "s1d13806 registers",*/
  525. .start = AT91_FB_REG_BASE,
  526. .end = AT91_FB_REG_BASE + AT91_FB_REG_SIZE -1,
  527. .flags = IORESOURCE_MEM,
  528. },
  529. };
  530. static struct platform_device yl_9200_s1dfb_device = {
  531. /*TODO S.Birtles , really we need the chip revision in here as well*/
  532. .name = "s1d13806fb",
  533. /* .name = "s1d13506fb",*/
  534. .id = -1,
  535. .dev = {
  536. /*TODO theres a waring here!!*/
  537. /*WARNING: vmlinux.o(.data+0x2dbc): Section mismatch: reference to .init.text: (between 'yl_9200_s1dfb_pdata' and 's1dfb_dmamask')*/
  538. .dma_mask = &s1dfb_dmamask,
  539. .coherent_dma_mask = 0xffffffff,
  540. .platform_data = &yl_9200_s1dfb_pdata,
  541. },
  542. .resource = yl_9200_s1dfb_resource,
  543. .num_resources = ARRAY_SIZE(yl_9200_s1dfb_resource),
  544. };
  545. void __init yl_9200_add_device_video(void)
  546. {
  547. platform_device_register(&yl_9200_s1dfb_device);
  548. }
  549. #else
  550. void __init yl_9200_add_device_video(void) {}
  551. #endif
  552. /*this is not called first , yl_9200_map_io is called first*/
  553. static void __init yl_9200_board_init(void)
  554. {
  555. /* Serial */
  556. at91_add_device_serial();
  557. /* Ethernet */
  558. at91_add_device_eth(&yl_9200_eth_data);
  559. /* USB Host */
  560. at91_add_device_usbh(&yl_9200_usbh_data);
  561. /* USB Device */
  562. at91_add_device_udc(&yl_9200_udc_data);
  563. /* pullup_pin it is actually active low, but this is not needed, driver sets it up */
  564. /*at91_set_multi_drive(yl_9200_udc_data.pullup_pin, 0);*/
  565. /* Compact Flash */
  566. /*at91_add_device_cf(&yl_9200_cf_data);*/
  567. /* I2C */
  568. at91_add_device_i2c(yl_9200_i2c_devices, ARRAY_SIZE(yl_9200_i2c_devices));
  569. /* SPI */
  570. /*TODO YL9200 we have 2 spi interfaces touch screen & CAN*/
  571. /* AT91_PIN_PA5, AT91_PIN_PA6 , are used on the max 485 NOT SPI*/
  572. /*touch screen and CAN*/
  573. at91_add_device_spi(yl_9200_spi_devices, ARRAY_SIZE(yl_9200_spi_devices));
  574. /*Basically the TS uses PB11 & PB10 , PB11 is configured by the SPI system BP10 IS NOT USED!!*/
  575. /* we need this incase the board is running without a touch screen*/
  576. #if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
  577. at91_init_device_ts(); /*init the touch screen device*/
  578. #endif
  579. /* DataFlash card */
  580. at91_add_device_mmc(0, &yl_9200_mmc_data);
  581. /* NAND */
  582. at91_add_device_nand(&yl_9200_nand_data);
  583. /* NOR Flash */
  584. platform_device_register(&yl_9200_flash);
  585. /* LEDs. Note!! this does not include the led's we passed for the processor status */
  586. at91_gpio_leds(yl_9200_leds, ARRAY_SIZE(yl_9200_leds));
  587. /* VGA */
  588. /*this is self registered by including the s1d13xxx chip in the kernel build*/
  589. yl_9200_add_device_video();
  590. /* Push Buttons */
  591. yl_9200_add_device_buttons();
  592. /*TODO fixup the Sounder */
  593. // yl_9200_add_device_sounder(yl_9200_sounder,ARRAY_SIZE(yl_9200_sounder));
  594. }
  595. MACHINE_START(YL9200, "uCdragon YL-9200")
  596. /* Maintainer: S.Birtles*/
  597. .phys_io = AT91_BASE_SYS,
  598. .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
  599. .boot_params = AT91_SDRAM_BASE + 0x100,
  600. .timer = &at91rm9200_timer,
  601. .map_io = yl_9200_map_io,
  602. .init_irq = yl_9200_init_irq,
  603. .init_machine = yl_9200_board_init,
  604. MACHINE_END