at91sam9rl_devices.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. /*
  2. * Copyright (C) 2007 Atmel Corporation
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file COPYING in the main directory of this archive for
  6. * more details.
  7. */
  8. #include <asm/mach/arch.h>
  9. #include <asm/mach/map.h>
  10. #include <linux/platform_device.h>
  11. #include <linux/fb.h>
  12. #include <video/atmel_lcdc.h>
  13. #include <asm/arch/board.h>
  14. #include <asm/arch/gpio.h>
  15. #include <asm/arch/at91sam9rl.h>
  16. #include <asm/arch/at91sam9rl_matrix.h>
  17. #include <asm/arch/at91sam926x_mc.h>
  18. #include "generic.h"
  19. /* --------------------------------------------------------------------
  20. * MMC / SD
  21. * -------------------------------------------------------------------- */
  22. #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE)
  23. static u64 mmc_dmamask = 0xffffffffUL;
  24. static struct at91_mmc_data mmc_data;
  25. static struct resource mmc_resources[] = {
  26. [0] = {
  27. .start = AT91SAM9RL_BASE_MCI,
  28. .end = AT91SAM9RL_BASE_MCI + SZ_16K - 1,
  29. .flags = IORESOURCE_MEM,
  30. },
  31. [1] = {
  32. .start = AT91SAM9RL_ID_MCI,
  33. .end = AT91SAM9RL_ID_MCI,
  34. .flags = IORESOURCE_IRQ,
  35. },
  36. };
  37. static struct platform_device at91sam9rl_mmc_device = {
  38. .name = "at91_mci",
  39. .id = -1,
  40. .dev = {
  41. .dma_mask = &mmc_dmamask,
  42. .coherent_dma_mask = 0xffffffff,
  43. .platform_data = &mmc_data,
  44. },
  45. .resource = mmc_resources,
  46. .num_resources = ARRAY_SIZE(mmc_resources),
  47. };
  48. void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
  49. {
  50. if (!data)
  51. return;
  52. /* input/irq */
  53. if (data->det_pin) {
  54. at91_set_gpio_input(data->det_pin, 1);
  55. at91_set_deglitch(data->det_pin, 1);
  56. }
  57. if (data->wp_pin)
  58. at91_set_gpio_input(data->wp_pin, 1);
  59. if (data->vcc_pin)
  60. at91_set_gpio_output(data->vcc_pin, 0);
  61. /* CLK */
  62. at91_set_A_periph(AT91_PIN_PA2, 0);
  63. /* CMD */
  64. at91_set_A_periph(AT91_PIN_PA1, 1);
  65. /* DAT0, maybe DAT1..DAT3 */
  66. at91_set_A_periph(AT91_PIN_PA0, 1);
  67. if (data->wire4) {
  68. at91_set_A_periph(AT91_PIN_PA3, 1);
  69. at91_set_A_periph(AT91_PIN_PA4, 1);
  70. at91_set_A_periph(AT91_PIN_PA5, 1);
  71. }
  72. mmc_data = *data;
  73. platform_device_register(&at91sam9rl_mmc_device);
  74. }
  75. #else
  76. void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
  77. #endif
  78. /* --------------------------------------------------------------------
  79. * NAND / SmartMedia
  80. * -------------------------------------------------------------------- */
  81. #if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE)
  82. static struct at91_nand_data nand_data;
  83. #define NAND_BASE AT91_CHIPSELECT_3
  84. static struct resource nand_resources[] = {
  85. {
  86. .start = NAND_BASE,
  87. .end = NAND_BASE + SZ_256M - 1,
  88. .flags = IORESOURCE_MEM,
  89. }
  90. };
  91. static struct platform_device at91_nand_device = {
  92. .name = "at91_nand",
  93. .id = -1,
  94. .dev = {
  95. .platform_data = &nand_data,
  96. },
  97. .resource = nand_resources,
  98. .num_resources = ARRAY_SIZE(nand_resources),
  99. };
  100. void __init at91_add_device_nand(struct at91_nand_data *data)
  101. {
  102. unsigned long csa;
  103. if (!data)
  104. return;
  105. csa = at91_sys_read(AT91_MATRIX_EBICSA);
  106. at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
  107. /* set the bus interface characteristics */
  108. at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0)
  109. | AT91_SMC_NRDSETUP_(0) | AT91_SMC_NCS_RDSETUP_(0));
  110. at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(2) | AT91_SMC_NCS_WRPULSE_(5)
  111. | AT91_SMC_NRDPULSE_(2) | AT91_SMC_NCS_RDPULSE_(5));
  112. at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(7) | AT91_SMC_NRDCYCLE_(7));
  113. at91_sys_write(AT91_SMC_MODE(3), AT91_SMC_DBW_8 | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(1));
  114. /* enable pin */
  115. if (data->enable_pin)
  116. at91_set_gpio_output(data->enable_pin, 1);
  117. /* ready/busy pin */
  118. if (data->rdy_pin)
  119. at91_set_gpio_input(data->rdy_pin, 1);
  120. /* card detect pin */
  121. if (data->det_pin)
  122. at91_set_gpio_input(data->det_pin, 1);
  123. at91_set_A_periph(AT91_PIN_PB4, 0); /* NANDOE */
  124. at91_set_A_periph(AT91_PIN_PB5, 0); /* NANDWE */
  125. nand_data = *data;
  126. platform_device_register(&at91_nand_device);
  127. }
  128. #else
  129. void __init at91_add_device_nand(struct at91_nand_data *data) {}
  130. #endif
  131. /* --------------------------------------------------------------------
  132. * TWI (i2c)
  133. * -------------------------------------------------------------------- */
  134. #if defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
  135. static struct resource twi_resources[] = {
  136. [0] = {
  137. .start = AT91SAM9RL_BASE_TWI0,
  138. .end = AT91SAM9RL_BASE_TWI0 + SZ_16K - 1,
  139. .flags = IORESOURCE_MEM,
  140. },
  141. [1] = {
  142. .start = AT91SAM9RL_ID_TWI0,
  143. .end = AT91SAM9RL_ID_TWI0,
  144. .flags = IORESOURCE_IRQ,
  145. },
  146. };
  147. static struct platform_device at91sam9rl_twi_device = {
  148. .name = "at91_i2c",
  149. .id = -1,
  150. .resource = twi_resources,
  151. .num_resources = ARRAY_SIZE(twi_resources),
  152. };
  153. void __init at91_add_device_i2c(void)
  154. {
  155. /* pins used for TWI interface */
  156. at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */
  157. at91_set_multi_drive(AT91_PIN_PA23, 1);
  158. at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */
  159. at91_set_multi_drive(AT91_PIN_PA24, 1);
  160. platform_device_register(&at91sam9rl_twi_device);
  161. }
  162. #else
  163. void __init at91_add_device_i2c(void) {}
  164. #endif
  165. /* --------------------------------------------------------------------
  166. * SPI
  167. * -------------------------------------------------------------------- */
  168. #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
  169. static u64 spi_dmamask = 0xffffffffUL;
  170. static struct resource spi_resources[] = {
  171. [0] = {
  172. .start = AT91SAM9RL_BASE_SPI,
  173. .end = AT91SAM9RL_BASE_SPI + SZ_16K - 1,
  174. .flags = IORESOURCE_MEM,
  175. },
  176. [1] = {
  177. .start = AT91SAM9RL_ID_SPI,
  178. .end = AT91SAM9RL_ID_SPI,
  179. .flags = IORESOURCE_IRQ,
  180. },
  181. };
  182. static struct platform_device at91sam9rl_spi_device = {
  183. .name = "atmel_spi",
  184. .id = 0,
  185. .dev = {
  186. .dma_mask = &spi_dmamask,
  187. .coherent_dma_mask = 0xffffffff,
  188. },
  189. .resource = spi_resources,
  190. .num_resources = ARRAY_SIZE(spi_resources),
  191. };
  192. static const unsigned spi_standard_cs[4] = { AT91_PIN_PA28, AT91_PIN_PB7, AT91_PIN_PD8, AT91_PIN_PD9 };
  193. void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
  194. {
  195. int i;
  196. unsigned long cs_pin;
  197. at91_set_A_periph(AT91_PIN_PA25, 0); /* MISO */
  198. at91_set_A_periph(AT91_PIN_PA26, 0); /* MOSI */
  199. at91_set_A_periph(AT91_PIN_PA27, 0); /* SPCK */
  200. /* Enable SPI chip-selects */
  201. for (i = 0; i < nr_devices; i++) {
  202. if (devices[i].controller_data)
  203. cs_pin = (unsigned long) devices[i].controller_data;
  204. else
  205. cs_pin = spi_standard_cs[devices[i].chip_select];
  206. /* enable chip-select pin */
  207. at91_set_gpio_output(cs_pin, 1);
  208. /* pass chip-select pin to driver */
  209. devices[i].controller_data = (void *) cs_pin;
  210. }
  211. spi_register_board_info(devices, nr_devices);
  212. platform_device_register(&at91sam9rl_spi_device);
  213. }
  214. #else
  215. void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) {}
  216. #endif
  217. /* --------------------------------------------------------------------
  218. * LCD Controller
  219. * -------------------------------------------------------------------- */
  220. #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
  221. static u64 lcdc_dmamask = 0xffffffffUL;
  222. static struct atmel_lcdfb_info lcdc_data;
  223. static struct resource lcdc_resources[] = {
  224. [0] = {
  225. .start = AT91SAM9RL_LCDC_BASE,
  226. .end = AT91SAM9RL_LCDC_BASE + SZ_4K - 1,
  227. .flags = IORESOURCE_MEM,
  228. },
  229. [1] = {
  230. .start = AT91SAM9RL_ID_LCDC,
  231. .end = AT91SAM9RL_ID_LCDC,
  232. .flags = IORESOURCE_IRQ,
  233. },
  234. #if defined(CONFIG_FB_INTSRAM)
  235. [2] = {
  236. .start = AT91SAM9RL_SRAM_BASE,
  237. .end = AT91SAM9RL_SRAM_BASE + AT91SAM9RL_SRAM_SIZE - 1,
  238. .flags = IORESOURCE_MEM,
  239. },
  240. #endif
  241. };
  242. static struct platform_device at91_lcdc_device = {
  243. .name = "atmel_lcdfb",
  244. .id = 0,
  245. .dev = {
  246. .dma_mask = &lcdc_dmamask,
  247. .coherent_dma_mask = 0xffffffff,
  248. .platform_data = &lcdc_data,
  249. },
  250. .resource = lcdc_resources,
  251. .num_resources = ARRAY_SIZE(lcdc_resources),
  252. };
  253. void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
  254. {
  255. if (!data) {
  256. return;
  257. }
  258. at91_set_B_periph(AT91_PIN_PC1, 0); /* LCDPWR */
  259. at91_set_A_periph(AT91_PIN_PC5, 0); /* LCDHSYNC */
  260. at91_set_A_periph(AT91_PIN_PC6, 0); /* LCDDOTCK */
  261. at91_set_A_periph(AT91_PIN_PC7, 0); /* LCDDEN */
  262. at91_set_A_periph(AT91_PIN_PC3, 0); /* LCDCC */
  263. at91_set_B_periph(AT91_PIN_PC9, 0); /* LCDD3 */
  264. at91_set_B_periph(AT91_PIN_PC10, 0); /* LCDD4 */
  265. at91_set_B_periph(AT91_PIN_PC11, 0); /* LCDD5 */
  266. at91_set_B_periph(AT91_PIN_PC12, 0); /* LCDD6 */
  267. at91_set_B_periph(AT91_PIN_PC13, 0); /* LCDD7 */
  268. at91_set_B_periph(AT91_PIN_PC15, 0); /* LCDD11 */
  269. at91_set_B_periph(AT91_PIN_PC16, 0); /* LCDD12 */
  270. at91_set_B_periph(AT91_PIN_PC17, 0); /* LCDD13 */
  271. at91_set_B_periph(AT91_PIN_PC18, 0); /* LCDD14 */
  272. at91_set_B_periph(AT91_PIN_PC19, 0); /* LCDD15 */
  273. at91_set_B_periph(AT91_PIN_PC20, 0); /* LCDD18 */
  274. at91_set_B_periph(AT91_PIN_PC21, 0); /* LCDD19 */
  275. at91_set_B_periph(AT91_PIN_PC22, 0); /* LCDD20 */
  276. at91_set_B_periph(AT91_PIN_PC23, 0); /* LCDD21 */
  277. at91_set_B_periph(AT91_PIN_PC24, 0); /* LCDD22 */
  278. at91_set_B_periph(AT91_PIN_PC25, 0); /* LCDD23 */
  279. lcdc_data = *data;
  280. platform_device_register(&at91_lcdc_device);
  281. }
  282. #else
  283. void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
  284. #endif
  285. /* --------------------------------------------------------------------
  286. * LEDs
  287. * -------------------------------------------------------------------- */
  288. #if defined(CONFIG_LEDS)
  289. u8 at91_leds_cpu;
  290. u8 at91_leds_timer;
  291. void __init at91_init_leds(u8 cpu_led, u8 timer_led)
  292. {
  293. /* Enable GPIO to access the LEDs */
  294. at91_set_gpio_output(cpu_led, 1);
  295. at91_set_gpio_output(timer_led, 1);
  296. at91_leds_cpu = cpu_led;
  297. at91_leds_timer = timer_led;
  298. }
  299. #else
  300. void __init at91_init_leds(u8 cpu_led, u8 timer_led) {}
  301. #endif
  302. /* --------------------------------------------------------------------
  303. * UART
  304. * -------------------------------------------------------------------- */
  305. #if defined(CONFIG_SERIAL_ATMEL)
  306. static struct resource dbgu_resources[] = {
  307. [0] = {
  308. .start = AT91_VA_BASE_SYS + AT91_DBGU,
  309. .end = AT91_VA_BASE_SYS + AT91_DBGU + SZ_512 - 1,
  310. .flags = IORESOURCE_MEM,
  311. },
  312. [1] = {
  313. .start = AT91_ID_SYS,
  314. .end = AT91_ID_SYS,
  315. .flags = IORESOURCE_IRQ,
  316. },
  317. };
  318. static struct atmel_uart_data dbgu_data = {
  319. .use_dma_tx = 0,
  320. .use_dma_rx = 0, /* DBGU not capable of receive DMA */
  321. .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU),
  322. };
  323. static struct platform_device at91sam9rl_dbgu_device = {
  324. .name = "atmel_usart",
  325. .id = 0,
  326. .dev = {
  327. .platform_data = &dbgu_data,
  328. .coherent_dma_mask = 0xffffffff,
  329. },
  330. .resource = dbgu_resources,
  331. .num_resources = ARRAY_SIZE(dbgu_resources),
  332. };
  333. static inline void configure_dbgu_pins(void)
  334. {
  335. at91_set_A_periph(AT91_PIN_PA21, 0); /* DRXD */
  336. at91_set_A_periph(AT91_PIN_PA22, 1); /* DTXD */
  337. }
  338. static struct resource uart0_resources[] = {
  339. [0] = {
  340. .start = AT91SAM9RL_BASE_US0,
  341. .end = AT91SAM9RL_BASE_US0 + SZ_16K - 1,
  342. .flags = IORESOURCE_MEM,
  343. },
  344. [1] = {
  345. .start = AT91SAM9RL_ID_US0,
  346. .end = AT91SAM9RL_ID_US0,
  347. .flags = IORESOURCE_IRQ,
  348. },
  349. };
  350. static struct atmel_uart_data uart0_data = {
  351. .use_dma_tx = 1,
  352. .use_dma_rx = 1,
  353. };
  354. static struct platform_device at91sam9rl_uart0_device = {
  355. .name = "atmel_usart",
  356. .id = 1,
  357. .dev = {
  358. .platform_data = &uart0_data,
  359. .coherent_dma_mask = 0xffffffff,
  360. },
  361. .resource = uart0_resources,
  362. .num_resources = ARRAY_SIZE(uart0_resources),
  363. };
  364. static inline void configure_usart0_pins(void)
  365. {
  366. at91_set_A_periph(AT91_PIN_PA6, 1); /* TXD0 */
  367. at91_set_A_periph(AT91_PIN_PA7, 0); /* RXD0 */
  368. at91_set_A_periph(AT91_PIN_PA9, 0); /* RTS0 */
  369. at91_set_A_periph(AT91_PIN_PA10, 0); /* CTS0 */
  370. }
  371. static struct resource uart1_resources[] = {
  372. [0] = {
  373. .start = AT91SAM9RL_BASE_US1,
  374. .end = AT91SAM9RL_BASE_US1 + SZ_16K - 1,
  375. .flags = IORESOURCE_MEM,
  376. },
  377. [1] = {
  378. .start = AT91SAM9RL_ID_US1,
  379. .end = AT91SAM9RL_ID_US1,
  380. .flags = IORESOURCE_IRQ,
  381. },
  382. };
  383. static struct atmel_uart_data uart1_data = {
  384. .use_dma_tx = 1,
  385. .use_dma_rx = 1,
  386. };
  387. static struct platform_device at91sam9rl_uart1_device = {
  388. .name = "atmel_usart",
  389. .id = 2,
  390. .dev = {
  391. .platform_data = &uart1_data,
  392. .coherent_dma_mask = 0xffffffff,
  393. },
  394. .resource = uart1_resources,
  395. .num_resources = ARRAY_SIZE(uart1_resources),
  396. };
  397. static inline void configure_usart1_pins(void)
  398. {
  399. at91_set_A_periph(AT91_PIN_PA11, 1); /* TXD1 */
  400. at91_set_A_periph(AT91_PIN_PA12, 0); /* RXD1 */
  401. }
  402. static struct resource uart2_resources[] = {
  403. [0] = {
  404. .start = AT91SAM9RL_BASE_US2,
  405. .end = AT91SAM9RL_BASE_US2 + SZ_16K - 1,
  406. .flags = IORESOURCE_MEM,
  407. },
  408. [1] = {
  409. .start = AT91SAM9RL_ID_US2,
  410. .end = AT91SAM9RL_ID_US2,
  411. .flags = IORESOURCE_IRQ,
  412. },
  413. };
  414. static struct atmel_uart_data uart2_data = {
  415. .use_dma_tx = 1,
  416. .use_dma_rx = 1,
  417. };
  418. static struct platform_device at91sam9rl_uart2_device = {
  419. .name = "atmel_usart",
  420. .id = 3,
  421. .dev = {
  422. .platform_data = &uart2_data,
  423. .coherent_dma_mask = 0xffffffff,
  424. },
  425. .resource = uart2_resources,
  426. .num_resources = ARRAY_SIZE(uart2_resources),
  427. };
  428. static inline void configure_usart2_pins(void)
  429. {
  430. at91_set_A_periph(AT91_PIN_PA13, 1); /* TXD2 */
  431. at91_set_A_periph(AT91_PIN_PA14, 0); /* RXD2 */
  432. }
  433. static struct resource uart3_resources[] = {
  434. [0] = {
  435. .start = AT91SAM9RL_BASE_US3,
  436. .end = AT91SAM9RL_BASE_US3 + SZ_16K - 1,
  437. .flags = IORESOURCE_MEM,
  438. },
  439. [1] = {
  440. .start = AT91SAM9RL_ID_US3,
  441. .end = AT91SAM9RL_ID_US3,
  442. .flags = IORESOURCE_IRQ,
  443. },
  444. };
  445. static struct atmel_uart_data uart3_data = {
  446. .use_dma_tx = 1,
  447. .use_dma_rx = 1,
  448. };
  449. static struct platform_device at91sam9rl_uart3_device = {
  450. .name = "atmel_usart",
  451. .id = 4,
  452. .dev = {
  453. .platform_data = &uart3_data,
  454. .coherent_dma_mask = 0xffffffff,
  455. },
  456. .resource = uart3_resources,
  457. .num_resources = ARRAY_SIZE(uart3_resources),
  458. };
  459. static inline void configure_usart3_pins(void)
  460. {
  461. at91_set_A_periph(AT91_PIN_PB0, 1); /* TXD3 */
  462. at91_set_A_periph(AT91_PIN_PB1, 0); /* RXD3 */
  463. }
  464. struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
  465. struct platform_device *atmel_default_console_device; /* the serial console device */
  466. void __init at91_init_serial(struct at91_uart_config *config)
  467. {
  468. int i;
  469. /* Fill in list of supported UARTs */
  470. for (i = 0; i < config->nr_tty; i++) {
  471. switch (config->tty_map[i]) {
  472. case 0:
  473. configure_usart0_pins();
  474. at91_uarts[i] = &at91sam9rl_uart0_device;
  475. at91_clock_associate("usart0_clk", &at91sam9rl_uart0_device.dev, "usart");
  476. break;
  477. case 1:
  478. configure_usart1_pins();
  479. at91_uarts[i] = &at91sam9rl_uart1_device;
  480. at91_clock_associate("usart1_clk", &at91sam9rl_uart1_device.dev, "usart");
  481. break;
  482. case 2:
  483. configure_usart2_pins();
  484. at91_uarts[i] = &at91sam9rl_uart2_device;
  485. at91_clock_associate("usart2_clk", &at91sam9rl_uart2_device.dev, "usart");
  486. break;
  487. case 3:
  488. configure_usart3_pins();
  489. at91_uarts[i] = &at91sam9rl_uart3_device;
  490. at91_clock_associate("usart3_clk", &at91sam9rl_uart3_device.dev, "usart");
  491. break;
  492. case 4:
  493. configure_dbgu_pins();
  494. at91_uarts[i] = &at91sam9rl_dbgu_device;
  495. at91_clock_associate("mck", &at91sam9rl_dbgu_device.dev, "usart");
  496. break;
  497. default:
  498. continue;
  499. }
  500. at91_uarts[i]->id = i; /* update ID number to mapped ID */
  501. }
  502. /* Set serial console device */
  503. if (config->console_tty < ATMEL_MAX_UART)
  504. atmel_default_console_device = at91_uarts[config->console_tty];
  505. if (!atmel_default_console_device)
  506. printk(KERN_INFO "AT91: No default serial console defined.\n");
  507. }
  508. void __init at91_add_device_serial(void)
  509. {
  510. int i;
  511. for (i = 0; i < ATMEL_MAX_UART; i++) {
  512. if (at91_uarts[i])
  513. platform_device_register(at91_uarts[i]);
  514. }
  515. }
  516. #else
  517. void __init at91_init_serial(struct at91_uart_config *config) {}
  518. void __init at91_add_device_serial(void) {}
  519. #endif
  520. /* -------------------------------------------------------------------- */
  521. /*
  522. * These devices are always present and don't need any board-specific
  523. * setup.
  524. */
  525. static int __init at91_add_standard_devices(void)
  526. {
  527. return 0;
  528. }
  529. arch_initcall(at91_add_standard_devices);