at91sam9rl_devices.c 16 KB

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