at91rm9200_devices.c 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200
  1. /*
  2. * arch/arm/mach-at91/at91rm9200_devices.c
  3. *
  4. * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org>
  5. * Copyright (C) 2005 David Brownell
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. */
  13. #include <asm/mach/arch.h>
  14. #include <asm/mach/map.h>
  15. #include <linux/dma-mapping.h>
  16. #include <linux/gpio.h>
  17. #include <linux/platform_device.h>
  18. #include <linux/i2c-gpio.h>
  19. #include <mach/at91rm9200.h>
  20. #include <mach/at91rm9200_mc.h>
  21. #include <mach/at91_ramc.h>
  22. #include "board.h"
  23. #include "generic.h"
  24. /* --------------------------------------------------------------------
  25. * USB Host
  26. * -------------------------------------------------------------------- */
  27. #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
  28. static u64 ohci_dmamask = DMA_BIT_MASK(32);
  29. static struct at91_usbh_data usbh_data;
  30. static struct resource usbh_resources[] = {
  31. [0] = {
  32. .start = AT91RM9200_UHP_BASE,
  33. .end = AT91RM9200_UHP_BASE + SZ_1M - 1,
  34. .flags = IORESOURCE_MEM,
  35. },
  36. [1] = {
  37. .start = NR_IRQS_LEGACY + AT91RM9200_ID_UHP,
  38. .end = NR_IRQS_LEGACY + AT91RM9200_ID_UHP,
  39. .flags = IORESOURCE_IRQ,
  40. },
  41. };
  42. static struct platform_device at91rm9200_usbh_device = {
  43. .name = "at91_ohci",
  44. .id = -1,
  45. .dev = {
  46. .dma_mask = &ohci_dmamask,
  47. .coherent_dma_mask = DMA_BIT_MASK(32),
  48. .platform_data = &usbh_data,
  49. },
  50. .resource = usbh_resources,
  51. .num_resources = ARRAY_SIZE(usbh_resources),
  52. };
  53. void __init at91_add_device_usbh(struct at91_usbh_data *data)
  54. {
  55. int i;
  56. if (!data)
  57. return;
  58. /* Enable overcurrent notification */
  59. for (i = 0; i < data->ports; i++) {
  60. if (gpio_is_valid(data->overcurrent_pin[i]))
  61. at91_set_gpio_input(data->overcurrent_pin[i], 1);
  62. }
  63. usbh_data = *data;
  64. platform_device_register(&at91rm9200_usbh_device);
  65. }
  66. #else
  67. void __init at91_add_device_usbh(struct at91_usbh_data *data) {}
  68. #endif
  69. /* --------------------------------------------------------------------
  70. * USB Device (Gadget)
  71. * -------------------------------------------------------------------- */
  72. #if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE)
  73. static struct at91_udc_data udc_data;
  74. static struct resource udc_resources[] = {
  75. [0] = {
  76. .start = AT91RM9200_BASE_UDP,
  77. .end = AT91RM9200_BASE_UDP + SZ_16K - 1,
  78. .flags = IORESOURCE_MEM,
  79. },
  80. [1] = {
  81. .start = NR_IRQS_LEGACY + AT91RM9200_ID_UDP,
  82. .end = NR_IRQS_LEGACY + AT91RM9200_ID_UDP,
  83. .flags = IORESOURCE_IRQ,
  84. },
  85. };
  86. static struct platform_device at91rm9200_udc_device = {
  87. .name = "at91_udc",
  88. .id = -1,
  89. .dev = {
  90. .platform_data = &udc_data,
  91. },
  92. .resource = udc_resources,
  93. .num_resources = ARRAY_SIZE(udc_resources),
  94. };
  95. void __init at91_add_device_udc(struct at91_udc_data *data)
  96. {
  97. if (!data)
  98. return;
  99. if (gpio_is_valid(data->vbus_pin)) {
  100. at91_set_gpio_input(data->vbus_pin, 0);
  101. at91_set_deglitch(data->vbus_pin, 1);
  102. }
  103. if (gpio_is_valid(data->pullup_pin))
  104. at91_set_gpio_output(data->pullup_pin, 0);
  105. udc_data = *data;
  106. platform_device_register(&at91rm9200_udc_device);
  107. }
  108. #else
  109. void __init at91_add_device_udc(struct at91_udc_data *data) {}
  110. #endif
  111. /* --------------------------------------------------------------------
  112. * Ethernet
  113. * -------------------------------------------------------------------- */
  114. #if defined(CONFIG_ARM_AT91_ETHER) || defined(CONFIG_ARM_AT91_ETHER_MODULE)
  115. static u64 eth_dmamask = DMA_BIT_MASK(32);
  116. static struct macb_platform_data eth_data;
  117. static struct resource eth_resources[] = {
  118. [0] = {
  119. .start = AT91RM9200_BASE_EMAC,
  120. .end = AT91RM9200_BASE_EMAC + SZ_16K - 1,
  121. .flags = IORESOURCE_MEM,
  122. },
  123. [1] = {
  124. .start = NR_IRQS_LEGACY + AT91RM9200_ID_EMAC,
  125. .end = NR_IRQS_LEGACY + AT91RM9200_ID_EMAC,
  126. .flags = IORESOURCE_IRQ,
  127. },
  128. };
  129. static struct platform_device at91rm9200_eth_device = {
  130. .name = "at91_ether",
  131. .id = -1,
  132. .dev = {
  133. .dma_mask = &eth_dmamask,
  134. .coherent_dma_mask = DMA_BIT_MASK(32),
  135. .platform_data = &eth_data,
  136. },
  137. .resource = eth_resources,
  138. .num_resources = ARRAY_SIZE(eth_resources),
  139. };
  140. void __init at91_add_device_eth(struct macb_platform_data *data)
  141. {
  142. if (!data)
  143. return;
  144. if (gpio_is_valid(data->phy_irq_pin)) {
  145. at91_set_gpio_input(data->phy_irq_pin, 0);
  146. at91_set_deglitch(data->phy_irq_pin, 1);
  147. }
  148. /* Pins used for MII and RMII */
  149. at91_set_A_periph(AT91_PIN_PA16, 0); /* EMDIO */
  150. at91_set_A_periph(AT91_PIN_PA15, 0); /* EMDC */
  151. at91_set_A_periph(AT91_PIN_PA14, 0); /* ERXER */
  152. at91_set_A_periph(AT91_PIN_PA13, 0); /* ERX1 */
  153. at91_set_A_periph(AT91_PIN_PA12, 0); /* ERX0 */
  154. at91_set_A_periph(AT91_PIN_PA11, 0); /* ECRS_ECRSDV */
  155. at91_set_A_periph(AT91_PIN_PA10, 0); /* ETX1 */
  156. at91_set_A_periph(AT91_PIN_PA9, 0); /* ETX0 */
  157. at91_set_A_periph(AT91_PIN_PA8, 0); /* ETXEN */
  158. at91_set_A_periph(AT91_PIN_PA7, 0); /* ETXCK_EREFCK */
  159. if (!data->is_rmii) {
  160. at91_set_B_periph(AT91_PIN_PB19, 0); /* ERXCK */
  161. at91_set_B_periph(AT91_PIN_PB18, 0); /* ECOL */
  162. at91_set_B_periph(AT91_PIN_PB17, 0); /* ERXDV */
  163. at91_set_B_periph(AT91_PIN_PB16, 0); /* ERX3 */
  164. at91_set_B_periph(AT91_PIN_PB15, 0); /* ERX2 */
  165. at91_set_B_periph(AT91_PIN_PB14, 0); /* ETXER */
  166. at91_set_B_periph(AT91_PIN_PB13, 0); /* ETX3 */
  167. at91_set_B_periph(AT91_PIN_PB12, 0); /* ETX2 */
  168. }
  169. eth_data = *data;
  170. platform_device_register(&at91rm9200_eth_device);
  171. }
  172. #else
  173. void __init at91_add_device_eth(struct macb_platform_data *data) {}
  174. #endif
  175. /* --------------------------------------------------------------------
  176. * Compact Flash / PCMCIA
  177. * -------------------------------------------------------------------- */
  178. #if defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE)
  179. static struct at91_cf_data cf_data;
  180. #define CF_BASE AT91_CHIPSELECT_4
  181. static struct resource cf_resources[] = {
  182. [0] = {
  183. .start = CF_BASE,
  184. /* ties up CS4, CS5 and CS6 */
  185. .end = CF_BASE + (0x30000000 - 1),
  186. .flags = IORESOURCE_MEM | IORESOURCE_MEM_8AND16BIT,
  187. },
  188. };
  189. static struct platform_device at91rm9200_cf_device = {
  190. .name = "at91_cf",
  191. .id = -1,
  192. .dev = {
  193. .platform_data = &cf_data,
  194. },
  195. .resource = cf_resources,
  196. .num_resources = ARRAY_SIZE(cf_resources),
  197. };
  198. void __init at91_add_device_cf(struct at91_cf_data *data)
  199. {
  200. unsigned int csa;
  201. if (!data)
  202. return;
  203. data->chipselect = 4; /* can only use EBI ChipSelect 4 */
  204. /* CF takes over CS4, CS5, CS6 */
  205. csa = at91_ramc_read(0, AT91_EBI_CSA);
  206. at91_ramc_write(0, AT91_EBI_CSA, csa | AT91_EBI_CS4A_SMC_COMPACTFLASH);
  207. /*
  208. * Static memory controller timing adjustments.
  209. * REVISIT: these timings are in terms of MCK cycles, so
  210. * when MCK changes (cpufreq etc) so must these values...
  211. */
  212. at91_ramc_write(0, AT91_SMC_CSR(4),
  213. AT91_SMC_ACSS_STD
  214. | AT91_SMC_DBW_16
  215. | AT91_SMC_BAT
  216. | AT91_SMC_WSEN
  217. | AT91_SMC_NWS_(32) /* wait states */
  218. | AT91_SMC_RWSETUP_(6) /* setup time */
  219. | AT91_SMC_RWHOLD_(4) /* hold time */
  220. );
  221. /* input/irq */
  222. if (gpio_is_valid(data->irq_pin)) {
  223. at91_set_gpio_input(data->irq_pin, 1);
  224. at91_set_deglitch(data->irq_pin, 1);
  225. }
  226. at91_set_gpio_input(data->det_pin, 1);
  227. at91_set_deglitch(data->det_pin, 1);
  228. /* outputs, initially off */
  229. if (gpio_is_valid(data->vcc_pin))
  230. at91_set_gpio_output(data->vcc_pin, 0);
  231. at91_set_gpio_output(data->rst_pin, 0);
  232. /* force poweron defaults for these pins ... */
  233. at91_set_A_periph(AT91_PIN_PC9, 0); /* A25/CFRNW */
  234. at91_set_A_periph(AT91_PIN_PC10, 0); /* NCS4/CFCS */
  235. at91_set_A_periph(AT91_PIN_PC11, 0); /* NCS5/CFCE1 */
  236. at91_set_A_periph(AT91_PIN_PC12, 0); /* NCS6/CFCE2 */
  237. /* nWAIT is _not_ a default setting */
  238. at91_set_A_periph(AT91_PIN_PC6, 1); /* nWAIT */
  239. cf_data = *data;
  240. platform_device_register(&at91rm9200_cf_device);
  241. }
  242. #else
  243. void __init at91_add_device_cf(struct at91_cf_data *data) {}
  244. #endif
  245. /* --------------------------------------------------------------------
  246. * MMC / SD
  247. * -------------------------------------------------------------------- */
  248. #if IS_ENABLED(CONFIG_MMC_ATMELMCI)
  249. static u64 mmc_dmamask = DMA_BIT_MASK(32);
  250. static struct mci_platform_data mmc_data;
  251. static struct resource mmc_resources[] = {
  252. [0] = {
  253. .start = AT91RM9200_BASE_MCI,
  254. .end = AT91RM9200_BASE_MCI + SZ_16K - 1,
  255. .flags = IORESOURCE_MEM,
  256. },
  257. [1] = {
  258. .start = NR_IRQS_LEGACY + AT91RM9200_ID_MCI,
  259. .end = NR_IRQS_LEGACY + AT91RM9200_ID_MCI,
  260. .flags = IORESOURCE_IRQ,
  261. },
  262. };
  263. static struct platform_device at91rm9200_mmc_device = {
  264. .name = "atmel_mci",
  265. .id = -1,
  266. .dev = {
  267. .dma_mask = &mmc_dmamask,
  268. .coherent_dma_mask = DMA_BIT_MASK(32),
  269. .platform_data = &mmc_data,
  270. },
  271. .resource = mmc_resources,
  272. .num_resources = ARRAY_SIZE(mmc_resources),
  273. };
  274. void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
  275. {
  276. unsigned int i;
  277. unsigned int slot_count = 0;
  278. if (!data)
  279. return;
  280. for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) {
  281. if (!data->slot[i].bus_width)
  282. continue;
  283. /* input/irq */
  284. if (gpio_is_valid(data->slot[i].detect_pin)) {
  285. at91_set_gpio_input(data->slot[i].detect_pin, 1);
  286. at91_set_deglitch(data->slot[i].detect_pin, 1);
  287. }
  288. if (gpio_is_valid(data->slot[i].wp_pin))
  289. at91_set_gpio_input(data->slot[i].wp_pin, 1);
  290. switch (i) {
  291. case 0: /* slot A */
  292. /* CMD */
  293. at91_set_A_periph(AT91_PIN_PA28, 1);
  294. /* DAT0, maybe DAT1..DAT3 */
  295. at91_set_A_periph(AT91_PIN_PA29, 1);
  296. if (data->slot[i].bus_width == 4) {
  297. at91_set_B_periph(AT91_PIN_PB3, 1);
  298. at91_set_B_periph(AT91_PIN_PB4, 1);
  299. at91_set_B_periph(AT91_PIN_PB5, 1);
  300. }
  301. slot_count++;
  302. break;
  303. case 1: /* slot B */
  304. /* CMD */
  305. at91_set_B_periph(AT91_PIN_PA8, 1);
  306. /* DAT0, maybe DAT1..DAT3 */
  307. at91_set_B_periph(AT91_PIN_PA9, 1);
  308. if (data->slot[i].bus_width == 4) {
  309. at91_set_B_periph(AT91_PIN_PA10, 1);
  310. at91_set_B_periph(AT91_PIN_PA11, 1);
  311. at91_set_B_periph(AT91_PIN_PA12, 1);
  312. }
  313. slot_count++;
  314. break;
  315. default:
  316. printk(KERN_ERR
  317. "AT91: SD/MMC slot %d not available\n", i);
  318. break;
  319. }
  320. if (slot_count) {
  321. /* CLK */
  322. at91_set_A_periph(AT91_PIN_PA27, 0);
  323. mmc_data = *data;
  324. platform_device_register(&at91rm9200_mmc_device);
  325. }
  326. }
  327. }
  328. #else
  329. void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {}
  330. #endif
  331. /* --------------------------------------------------------------------
  332. * NAND / SmartMedia
  333. * -------------------------------------------------------------------- */
  334. #if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
  335. static struct atmel_nand_data nand_data;
  336. #define NAND_BASE AT91_CHIPSELECT_3
  337. static struct resource nand_resources[] = {
  338. {
  339. .start = NAND_BASE,
  340. .end = NAND_BASE + SZ_256M - 1,
  341. .flags = IORESOURCE_MEM,
  342. }
  343. };
  344. static struct platform_device at91rm9200_nand_device = {
  345. .name = "atmel_nand",
  346. .id = -1,
  347. .dev = {
  348. .platform_data = &nand_data,
  349. },
  350. .resource = nand_resources,
  351. .num_resources = ARRAY_SIZE(nand_resources),
  352. };
  353. void __init at91_add_device_nand(struct atmel_nand_data *data)
  354. {
  355. unsigned int csa;
  356. if (!data)
  357. return;
  358. /* enable the address range of CS3 */
  359. csa = at91_ramc_read(0, AT91_EBI_CSA);
  360. at91_ramc_write(0, AT91_EBI_CSA, csa | AT91_EBI_CS3A_SMC_SMARTMEDIA);
  361. /* set the bus interface characteristics */
  362. at91_ramc_write(0, AT91_SMC_CSR(3), AT91_SMC_ACSS_STD | AT91_SMC_DBW_8 | AT91_SMC_WSEN
  363. | AT91_SMC_NWS_(5)
  364. | AT91_SMC_TDF_(1)
  365. | AT91_SMC_RWSETUP_(0) /* tDS Data Set up Time 30 - ns */
  366. | AT91_SMC_RWHOLD_(1) /* tDH Data Hold Time 20 - ns */
  367. );
  368. /* enable pin */
  369. if (gpio_is_valid(data->enable_pin))
  370. at91_set_gpio_output(data->enable_pin, 1);
  371. /* ready/busy pin */
  372. if (gpio_is_valid(data->rdy_pin))
  373. at91_set_gpio_input(data->rdy_pin, 1);
  374. /* card detect pin */
  375. if (gpio_is_valid(data->det_pin))
  376. at91_set_gpio_input(data->det_pin, 1);
  377. at91_set_A_periph(AT91_PIN_PC1, 0); /* SMOE */
  378. at91_set_A_periph(AT91_PIN_PC3, 0); /* SMWE */
  379. nand_data = *data;
  380. platform_device_register(&at91rm9200_nand_device);
  381. }
  382. #else
  383. void __init at91_add_device_nand(struct atmel_nand_data *data) {}
  384. #endif
  385. /* --------------------------------------------------------------------
  386. * TWI (i2c)
  387. * -------------------------------------------------------------------- */
  388. /*
  389. * Prefer the GPIO code since the TWI controller isn't robust
  390. * (gets overruns and underruns under load) and can only issue
  391. * repeated STARTs in one scenario (the driver doesn't yet handle them).
  392. */
  393. #if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
  394. static struct i2c_gpio_platform_data pdata = {
  395. .sda_pin = AT91_PIN_PA25,
  396. .sda_is_open_drain = 1,
  397. .scl_pin = AT91_PIN_PA26,
  398. .scl_is_open_drain = 1,
  399. .udelay = 2, /* ~100 kHz */
  400. };
  401. static struct platform_device at91rm9200_twi_device = {
  402. .name = "i2c-gpio",
  403. .id = 0,
  404. .dev.platform_data = &pdata,
  405. };
  406. void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
  407. {
  408. at91_set_GPIO_periph(AT91_PIN_PA25, 1); /* TWD (SDA) */
  409. at91_set_multi_drive(AT91_PIN_PA25, 1);
  410. at91_set_GPIO_periph(AT91_PIN_PA26, 1); /* TWCK (SCL) */
  411. at91_set_multi_drive(AT91_PIN_PA26, 1);
  412. i2c_register_board_info(0, devices, nr_devices);
  413. platform_device_register(&at91rm9200_twi_device);
  414. }
  415. #elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
  416. static struct resource twi_resources[] = {
  417. [0] = {
  418. .start = AT91RM9200_BASE_TWI,
  419. .end = AT91RM9200_BASE_TWI + SZ_16K - 1,
  420. .flags = IORESOURCE_MEM,
  421. },
  422. [1] = {
  423. .start = NR_IRQS_LEGACY + AT91RM9200_ID_TWI,
  424. .end = NR_IRQS_LEGACY + AT91RM9200_ID_TWI,
  425. .flags = IORESOURCE_IRQ,
  426. },
  427. };
  428. static struct platform_device at91rm9200_twi_device = {
  429. .name = "i2c-at91rm9200",
  430. .id = 0,
  431. .resource = twi_resources,
  432. .num_resources = ARRAY_SIZE(twi_resources),
  433. };
  434. void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
  435. {
  436. /* pins used for TWI interface */
  437. at91_set_A_periph(AT91_PIN_PA25, 0); /* TWD */
  438. at91_set_multi_drive(AT91_PIN_PA25, 1);
  439. at91_set_A_periph(AT91_PIN_PA26, 0); /* TWCK */
  440. at91_set_multi_drive(AT91_PIN_PA26, 1);
  441. i2c_register_board_info(0, devices, nr_devices);
  442. platform_device_register(&at91rm9200_twi_device);
  443. }
  444. #else
  445. void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
  446. #endif
  447. /* --------------------------------------------------------------------
  448. * SPI
  449. * -------------------------------------------------------------------- */
  450. #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
  451. static u64 spi_dmamask = DMA_BIT_MASK(32);
  452. static struct resource spi_resources[] = {
  453. [0] = {
  454. .start = AT91RM9200_BASE_SPI,
  455. .end = AT91RM9200_BASE_SPI + SZ_16K - 1,
  456. .flags = IORESOURCE_MEM,
  457. },
  458. [1] = {
  459. .start = NR_IRQS_LEGACY + AT91RM9200_ID_SPI,
  460. .end = NR_IRQS_LEGACY + AT91RM9200_ID_SPI,
  461. .flags = IORESOURCE_IRQ,
  462. },
  463. };
  464. static struct platform_device at91rm9200_spi_device = {
  465. .name = "atmel_spi",
  466. .id = 0,
  467. .dev = {
  468. .dma_mask = &spi_dmamask,
  469. .coherent_dma_mask = DMA_BIT_MASK(32),
  470. },
  471. .resource = spi_resources,
  472. .num_resources = ARRAY_SIZE(spi_resources),
  473. };
  474. static const unsigned spi_standard_cs[4] = { AT91_PIN_PA3, AT91_PIN_PA4, AT91_PIN_PA5, AT91_PIN_PA6 };
  475. void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
  476. {
  477. int i;
  478. unsigned long cs_pin;
  479. at91_set_A_periph(AT91_PIN_PA0, 0); /* MISO */
  480. at91_set_A_periph(AT91_PIN_PA1, 0); /* MOSI */
  481. at91_set_A_periph(AT91_PIN_PA2, 0); /* SPCK */
  482. /* Enable SPI chip-selects */
  483. for (i = 0; i < nr_devices; i++) {
  484. if (devices[i].controller_data)
  485. cs_pin = (unsigned long) devices[i].controller_data;
  486. else
  487. cs_pin = spi_standard_cs[devices[i].chip_select];
  488. if (devices[i].chip_select == 0) /* for CS0 errata */
  489. at91_set_A_periph(cs_pin, 0);
  490. else
  491. at91_set_gpio_output(cs_pin, 1);
  492. /* pass chip-select pin to driver */
  493. devices[i].controller_data = (void *) cs_pin;
  494. }
  495. spi_register_board_info(devices, nr_devices);
  496. platform_device_register(&at91rm9200_spi_device);
  497. }
  498. #else
  499. void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) {}
  500. #endif
  501. /* --------------------------------------------------------------------
  502. * Timer/Counter blocks
  503. * -------------------------------------------------------------------- */
  504. #ifdef CONFIG_ATMEL_TCLIB
  505. static struct resource tcb0_resources[] = {
  506. [0] = {
  507. .start = AT91RM9200_BASE_TCB0,
  508. .end = AT91RM9200_BASE_TCB0 + SZ_16K - 1,
  509. .flags = IORESOURCE_MEM,
  510. },
  511. [1] = {
  512. .start = NR_IRQS_LEGACY + AT91RM9200_ID_TC0,
  513. .end = NR_IRQS_LEGACY + AT91RM9200_ID_TC0,
  514. .flags = IORESOURCE_IRQ,
  515. },
  516. [2] = {
  517. .start = NR_IRQS_LEGACY + AT91RM9200_ID_TC1,
  518. .end = NR_IRQS_LEGACY + AT91RM9200_ID_TC1,
  519. .flags = IORESOURCE_IRQ,
  520. },
  521. [3] = {
  522. .start = NR_IRQS_LEGACY + AT91RM9200_ID_TC2,
  523. .end = NR_IRQS_LEGACY + AT91RM9200_ID_TC2,
  524. .flags = IORESOURCE_IRQ,
  525. },
  526. };
  527. static struct platform_device at91rm9200_tcb0_device = {
  528. .name = "atmel_tcb",
  529. .id = 0,
  530. .resource = tcb0_resources,
  531. .num_resources = ARRAY_SIZE(tcb0_resources),
  532. };
  533. static struct resource tcb1_resources[] = {
  534. [0] = {
  535. .start = AT91RM9200_BASE_TCB1,
  536. .end = AT91RM9200_BASE_TCB1 + SZ_16K - 1,
  537. .flags = IORESOURCE_MEM,
  538. },
  539. [1] = {
  540. .start = NR_IRQS_LEGACY + AT91RM9200_ID_TC3,
  541. .end = NR_IRQS_LEGACY + AT91RM9200_ID_TC3,
  542. .flags = IORESOURCE_IRQ,
  543. },
  544. [2] = {
  545. .start = NR_IRQS_LEGACY + AT91RM9200_ID_TC4,
  546. .end = NR_IRQS_LEGACY + AT91RM9200_ID_TC4,
  547. .flags = IORESOURCE_IRQ,
  548. },
  549. [3] = {
  550. .start = NR_IRQS_LEGACY + AT91RM9200_ID_TC5,
  551. .end = NR_IRQS_LEGACY + AT91RM9200_ID_TC5,
  552. .flags = IORESOURCE_IRQ,
  553. },
  554. };
  555. static struct platform_device at91rm9200_tcb1_device = {
  556. .name = "atmel_tcb",
  557. .id = 1,
  558. .resource = tcb1_resources,
  559. .num_resources = ARRAY_SIZE(tcb1_resources),
  560. };
  561. static void __init at91_add_device_tc(void)
  562. {
  563. platform_device_register(&at91rm9200_tcb0_device);
  564. platform_device_register(&at91rm9200_tcb1_device);
  565. }
  566. #else
  567. static void __init at91_add_device_tc(void) { }
  568. #endif
  569. /* --------------------------------------------------------------------
  570. * RTC
  571. * -------------------------------------------------------------------- */
  572. #if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE)
  573. static struct resource rtc_resources[] = {
  574. [0] = {
  575. .start = AT91RM9200_BASE_RTC,
  576. .end = AT91RM9200_BASE_RTC + SZ_256 - 1,
  577. .flags = IORESOURCE_MEM,
  578. },
  579. [1] = {
  580. .start = NR_IRQS_LEGACY + AT91_ID_SYS,
  581. .end = NR_IRQS_LEGACY + AT91_ID_SYS,
  582. .flags = IORESOURCE_IRQ,
  583. },
  584. };
  585. static struct platform_device at91rm9200_rtc_device = {
  586. .name = "at91_rtc",
  587. .id = -1,
  588. .resource = rtc_resources,
  589. .num_resources = ARRAY_SIZE(rtc_resources),
  590. };
  591. static void __init at91_add_device_rtc(void)
  592. {
  593. platform_device_register(&at91rm9200_rtc_device);
  594. }
  595. #else
  596. static void __init at91_add_device_rtc(void) {}
  597. #endif
  598. /* --------------------------------------------------------------------
  599. * Watchdog
  600. * -------------------------------------------------------------------- */
  601. #if defined(CONFIG_AT91RM9200_WATCHDOG) || defined(CONFIG_AT91RM9200_WATCHDOG_MODULE)
  602. static struct platform_device at91rm9200_wdt_device = {
  603. .name = "at91_wdt",
  604. .id = -1,
  605. .num_resources = 0,
  606. };
  607. static void __init at91_add_device_watchdog(void)
  608. {
  609. platform_device_register(&at91rm9200_wdt_device);
  610. }
  611. #else
  612. static void __init at91_add_device_watchdog(void) {}
  613. #endif
  614. /* --------------------------------------------------------------------
  615. * SSC -- Synchronous Serial Controller
  616. * -------------------------------------------------------------------- */
  617. #if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
  618. static u64 ssc0_dmamask = DMA_BIT_MASK(32);
  619. static struct resource ssc0_resources[] = {
  620. [0] = {
  621. .start = AT91RM9200_BASE_SSC0,
  622. .end = AT91RM9200_BASE_SSC0 + SZ_16K - 1,
  623. .flags = IORESOURCE_MEM,
  624. },
  625. [1] = {
  626. .start = NR_IRQS_LEGACY + AT91RM9200_ID_SSC0,
  627. .end = NR_IRQS_LEGACY + AT91RM9200_ID_SSC0,
  628. .flags = IORESOURCE_IRQ,
  629. },
  630. };
  631. static struct platform_device at91rm9200_ssc0_device = {
  632. .name = "at91rm9200_ssc",
  633. .id = 0,
  634. .dev = {
  635. .dma_mask = &ssc0_dmamask,
  636. .coherent_dma_mask = DMA_BIT_MASK(32),
  637. },
  638. .resource = ssc0_resources,
  639. .num_resources = ARRAY_SIZE(ssc0_resources),
  640. };
  641. static inline void configure_ssc0_pins(unsigned pins)
  642. {
  643. if (pins & ATMEL_SSC_TF)
  644. at91_set_A_periph(AT91_PIN_PB0, 1);
  645. if (pins & ATMEL_SSC_TK)
  646. at91_set_A_periph(AT91_PIN_PB1, 1);
  647. if (pins & ATMEL_SSC_TD)
  648. at91_set_A_periph(AT91_PIN_PB2, 1);
  649. if (pins & ATMEL_SSC_RD)
  650. at91_set_A_periph(AT91_PIN_PB3, 1);
  651. if (pins & ATMEL_SSC_RK)
  652. at91_set_A_periph(AT91_PIN_PB4, 1);
  653. if (pins & ATMEL_SSC_RF)
  654. at91_set_A_periph(AT91_PIN_PB5, 1);
  655. }
  656. static u64 ssc1_dmamask = DMA_BIT_MASK(32);
  657. static struct resource ssc1_resources[] = {
  658. [0] = {
  659. .start = AT91RM9200_BASE_SSC1,
  660. .end = AT91RM9200_BASE_SSC1 + SZ_16K - 1,
  661. .flags = IORESOURCE_MEM,
  662. },
  663. [1] = {
  664. .start = NR_IRQS_LEGACY + AT91RM9200_ID_SSC1,
  665. .end = NR_IRQS_LEGACY + AT91RM9200_ID_SSC1,
  666. .flags = IORESOURCE_IRQ,
  667. },
  668. };
  669. static struct platform_device at91rm9200_ssc1_device = {
  670. .name = "at91rm9200_ssc",
  671. .id = 1,
  672. .dev = {
  673. .dma_mask = &ssc1_dmamask,
  674. .coherent_dma_mask = DMA_BIT_MASK(32),
  675. },
  676. .resource = ssc1_resources,
  677. .num_resources = ARRAY_SIZE(ssc1_resources),
  678. };
  679. static inline void configure_ssc1_pins(unsigned pins)
  680. {
  681. if (pins & ATMEL_SSC_TF)
  682. at91_set_A_periph(AT91_PIN_PB6, 1);
  683. if (pins & ATMEL_SSC_TK)
  684. at91_set_A_periph(AT91_PIN_PB7, 1);
  685. if (pins & ATMEL_SSC_TD)
  686. at91_set_A_periph(AT91_PIN_PB8, 1);
  687. if (pins & ATMEL_SSC_RD)
  688. at91_set_A_periph(AT91_PIN_PB9, 1);
  689. if (pins & ATMEL_SSC_RK)
  690. at91_set_A_periph(AT91_PIN_PB10, 1);
  691. if (pins & ATMEL_SSC_RF)
  692. at91_set_A_periph(AT91_PIN_PB11, 1);
  693. }
  694. static u64 ssc2_dmamask = DMA_BIT_MASK(32);
  695. static struct resource ssc2_resources[] = {
  696. [0] = {
  697. .start = AT91RM9200_BASE_SSC2,
  698. .end = AT91RM9200_BASE_SSC2 + SZ_16K - 1,
  699. .flags = IORESOURCE_MEM,
  700. },
  701. [1] = {
  702. .start = NR_IRQS_LEGACY + AT91RM9200_ID_SSC2,
  703. .end = NR_IRQS_LEGACY + AT91RM9200_ID_SSC2,
  704. .flags = IORESOURCE_IRQ,
  705. },
  706. };
  707. static struct platform_device at91rm9200_ssc2_device = {
  708. .name = "at91rm9200_ssc",
  709. .id = 2,
  710. .dev = {
  711. .dma_mask = &ssc2_dmamask,
  712. .coherent_dma_mask = DMA_BIT_MASK(32),
  713. },
  714. .resource = ssc2_resources,
  715. .num_resources = ARRAY_SIZE(ssc2_resources),
  716. };
  717. static inline void configure_ssc2_pins(unsigned pins)
  718. {
  719. if (pins & ATMEL_SSC_TF)
  720. at91_set_A_periph(AT91_PIN_PB12, 1);
  721. if (pins & ATMEL_SSC_TK)
  722. at91_set_A_periph(AT91_PIN_PB13, 1);
  723. if (pins & ATMEL_SSC_TD)
  724. at91_set_A_periph(AT91_PIN_PB14, 1);
  725. if (pins & ATMEL_SSC_RD)
  726. at91_set_A_periph(AT91_PIN_PB15, 1);
  727. if (pins & ATMEL_SSC_RK)
  728. at91_set_A_periph(AT91_PIN_PB16, 1);
  729. if (pins & ATMEL_SSC_RF)
  730. at91_set_A_periph(AT91_PIN_PB17, 1);
  731. }
  732. /*
  733. * SSC controllers are accessed through library code, instead of any
  734. * kind of all-singing/all-dancing driver. For example one could be
  735. * used by a particular I2S audio codec's driver, while another one
  736. * on the same system might be used by a custom data capture driver.
  737. */
  738. void __init at91_add_device_ssc(unsigned id, unsigned pins)
  739. {
  740. struct platform_device *pdev;
  741. /*
  742. * NOTE: caller is responsible for passing information matching
  743. * "pins" to whatever will be using each particular controller.
  744. */
  745. switch (id) {
  746. case AT91RM9200_ID_SSC0:
  747. pdev = &at91rm9200_ssc0_device;
  748. configure_ssc0_pins(pins);
  749. break;
  750. case AT91RM9200_ID_SSC1:
  751. pdev = &at91rm9200_ssc1_device;
  752. configure_ssc1_pins(pins);
  753. break;
  754. case AT91RM9200_ID_SSC2:
  755. pdev = &at91rm9200_ssc2_device;
  756. configure_ssc2_pins(pins);
  757. break;
  758. default:
  759. return;
  760. }
  761. platform_device_register(pdev);
  762. }
  763. #else
  764. void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
  765. #endif
  766. /* --------------------------------------------------------------------
  767. * UART
  768. * -------------------------------------------------------------------- */
  769. #if defined(CONFIG_SERIAL_ATMEL)
  770. static struct resource dbgu_resources[] = {
  771. [0] = {
  772. .start = AT91RM9200_BASE_DBGU,
  773. .end = AT91RM9200_BASE_DBGU + SZ_512 - 1,
  774. .flags = IORESOURCE_MEM,
  775. },
  776. [1] = {
  777. .start = NR_IRQS_LEGACY + AT91_ID_SYS,
  778. .end = NR_IRQS_LEGACY + AT91_ID_SYS,
  779. .flags = IORESOURCE_IRQ,
  780. },
  781. };
  782. static struct atmel_uart_data dbgu_data = {
  783. .use_dma_tx = 0,
  784. .use_dma_rx = 0, /* DBGU not capable of receive DMA */
  785. };
  786. static u64 dbgu_dmamask = DMA_BIT_MASK(32);
  787. static struct platform_device at91rm9200_dbgu_device = {
  788. .name = "atmel_usart",
  789. .id = 0,
  790. .dev = {
  791. .dma_mask = &dbgu_dmamask,
  792. .coherent_dma_mask = DMA_BIT_MASK(32),
  793. .platform_data = &dbgu_data,
  794. },
  795. .resource = dbgu_resources,
  796. .num_resources = ARRAY_SIZE(dbgu_resources),
  797. };
  798. static inline void configure_dbgu_pins(void)
  799. {
  800. at91_set_A_periph(AT91_PIN_PA30, 0); /* DRXD */
  801. at91_set_A_periph(AT91_PIN_PA31, 1); /* DTXD */
  802. }
  803. static struct resource uart0_resources[] = {
  804. [0] = {
  805. .start = AT91RM9200_BASE_US0,
  806. .end = AT91RM9200_BASE_US0 + SZ_16K - 1,
  807. .flags = IORESOURCE_MEM,
  808. },
  809. [1] = {
  810. .start = NR_IRQS_LEGACY + AT91RM9200_ID_US0,
  811. .end = NR_IRQS_LEGACY + AT91RM9200_ID_US0,
  812. .flags = IORESOURCE_IRQ,
  813. },
  814. };
  815. static struct atmel_uart_data uart0_data = {
  816. .use_dma_tx = 1,
  817. .use_dma_rx = 1,
  818. };
  819. static u64 uart0_dmamask = DMA_BIT_MASK(32);
  820. static struct platform_device at91rm9200_uart0_device = {
  821. .name = "atmel_usart",
  822. .id = 1,
  823. .dev = {
  824. .dma_mask = &uart0_dmamask,
  825. .coherent_dma_mask = DMA_BIT_MASK(32),
  826. .platform_data = &uart0_data,
  827. },
  828. .resource = uart0_resources,
  829. .num_resources = ARRAY_SIZE(uart0_resources),
  830. };
  831. static inline void configure_usart0_pins(unsigned pins)
  832. {
  833. at91_set_A_periph(AT91_PIN_PA17, 1); /* TXD0 */
  834. at91_set_A_periph(AT91_PIN_PA18, 0); /* RXD0 */
  835. if (pins & ATMEL_UART_CTS)
  836. at91_set_A_periph(AT91_PIN_PA20, 0); /* CTS0 */
  837. if (pins & ATMEL_UART_RTS) {
  838. /*
  839. * AT91RM9200 Errata #39 - RTS0 is not internally connected to PA21.
  840. * We need to drive the pin manually. Default is off (RTS is active low).
  841. */
  842. at91_set_gpio_output(AT91_PIN_PA21, 1);
  843. }
  844. }
  845. static struct resource uart1_resources[] = {
  846. [0] = {
  847. .start = AT91RM9200_BASE_US1,
  848. .end = AT91RM9200_BASE_US1 + SZ_16K - 1,
  849. .flags = IORESOURCE_MEM,
  850. },
  851. [1] = {
  852. .start = NR_IRQS_LEGACY + AT91RM9200_ID_US1,
  853. .end = NR_IRQS_LEGACY + AT91RM9200_ID_US1,
  854. .flags = IORESOURCE_IRQ,
  855. },
  856. };
  857. static struct atmel_uart_data uart1_data = {
  858. .use_dma_tx = 1,
  859. .use_dma_rx = 1,
  860. };
  861. static u64 uart1_dmamask = DMA_BIT_MASK(32);
  862. static struct platform_device at91rm9200_uart1_device = {
  863. .name = "atmel_usart",
  864. .id = 2,
  865. .dev = {
  866. .dma_mask = &uart1_dmamask,
  867. .coherent_dma_mask = DMA_BIT_MASK(32),
  868. .platform_data = &uart1_data,
  869. },
  870. .resource = uart1_resources,
  871. .num_resources = ARRAY_SIZE(uart1_resources),
  872. };
  873. static inline void configure_usart1_pins(unsigned pins)
  874. {
  875. at91_set_A_periph(AT91_PIN_PB20, 1); /* TXD1 */
  876. at91_set_A_periph(AT91_PIN_PB21, 0); /* RXD1 */
  877. if (pins & ATMEL_UART_RI)
  878. at91_set_A_periph(AT91_PIN_PB18, 0); /* RI1 */
  879. if (pins & ATMEL_UART_DTR)
  880. at91_set_A_periph(AT91_PIN_PB19, 0); /* DTR1 */
  881. if (pins & ATMEL_UART_DCD)
  882. at91_set_A_periph(AT91_PIN_PB23, 0); /* DCD1 */
  883. if (pins & ATMEL_UART_CTS)
  884. at91_set_A_periph(AT91_PIN_PB24, 0); /* CTS1 */
  885. if (pins & ATMEL_UART_DSR)
  886. at91_set_A_periph(AT91_PIN_PB25, 0); /* DSR1 */
  887. if (pins & ATMEL_UART_RTS)
  888. at91_set_A_periph(AT91_PIN_PB26, 0); /* RTS1 */
  889. }
  890. static struct resource uart2_resources[] = {
  891. [0] = {
  892. .start = AT91RM9200_BASE_US2,
  893. .end = AT91RM9200_BASE_US2 + SZ_16K - 1,
  894. .flags = IORESOURCE_MEM,
  895. },
  896. [1] = {
  897. .start = NR_IRQS_LEGACY + AT91RM9200_ID_US2,
  898. .end = NR_IRQS_LEGACY + AT91RM9200_ID_US2,
  899. .flags = IORESOURCE_IRQ,
  900. },
  901. };
  902. static struct atmel_uart_data uart2_data = {
  903. .use_dma_tx = 1,
  904. .use_dma_rx = 1,
  905. };
  906. static u64 uart2_dmamask = DMA_BIT_MASK(32);
  907. static struct platform_device at91rm9200_uart2_device = {
  908. .name = "atmel_usart",
  909. .id = 3,
  910. .dev = {
  911. .dma_mask = &uart2_dmamask,
  912. .coherent_dma_mask = DMA_BIT_MASK(32),
  913. .platform_data = &uart2_data,
  914. },
  915. .resource = uart2_resources,
  916. .num_resources = ARRAY_SIZE(uart2_resources),
  917. };
  918. static inline void configure_usart2_pins(unsigned pins)
  919. {
  920. at91_set_A_periph(AT91_PIN_PA22, 0); /* RXD2 */
  921. at91_set_A_periph(AT91_PIN_PA23, 1); /* TXD2 */
  922. if (pins & ATMEL_UART_CTS)
  923. at91_set_B_periph(AT91_PIN_PA30, 0); /* CTS2 */
  924. if (pins & ATMEL_UART_RTS)
  925. at91_set_B_periph(AT91_PIN_PA31, 0); /* RTS2 */
  926. }
  927. static struct resource uart3_resources[] = {
  928. [0] = {
  929. .start = AT91RM9200_BASE_US3,
  930. .end = AT91RM9200_BASE_US3 + SZ_16K - 1,
  931. .flags = IORESOURCE_MEM,
  932. },
  933. [1] = {
  934. .start = NR_IRQS_LEGACY + AT91RM9200_ID_US3,
  935. .end = NR_IRQS_LEGACY + AT91RM9200_ID_US3,
  936. .flags = IORESOURCE_IRQ,
  937. },
  938. };
  939. static struct atmel_uart_data uart3_data = {
  940. .use_dma_tx = 1,
  941. .use_dma_rx = 1,
  942. };
  943. static u64 uart3_dmamask = DMA_BIT_MASK(32);
  944. static struct platform_device at91rm9200_uart3_device = {
  945. .name = "atmel_usart",
  946. .id = 4,
  947. .dev = {
  948. .dma_mask = &uart3_dmamask,
  949. .coherent_dma_mask = DMA_BIT_MASK(32),
  950. .platform_data = &uart3_data,
  951. },
  952. .resource = uart3_resources,
  953. .num_resources = ARRAY_SIZE(uart3_resources),
  954. };
  955. static inline void configure_usart3_pins(unsigned pins)
  956. {
  957. at91_set_B_periph(AT91_PIN_PA5, 1); /* TXD3 */
  958. at91_set_B_periph(AT91_PIN_PA6, 0); /* RXD3 */
  959. if (pins & ATMEL_UART_CTS)
  960. at91_set_B_periph(AT91_PIN_PB1, 0); /* CTS3 */
  961. if (pins & ATMEL_UART_RTS)
  962. at91_set_B_periph(AT91_PIN_PB0, 0); /* RTS3 */
  963. }
  964. static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
  965. void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
  966. {
  967. struct platform_device *pdev;
  968. struct atmel_uart_data *pdata;
  969. switch (id) {
  970. case 0: /* DBGU */
  971. pdev = &at91rm9200_dbgu_device;
  972. configure_dbgu_pins();
  973. break;
  974. case AT91RM9200_ID_US0:
  975. pdev = &at91rm9200_uart0_device;
  976. configure_usart0_pins(pins);
  977. break;
  978. case AT91RM9200_ID_US1:
  979. pdev = &at91rm9200_uart1_device;
  980. configure_usart1_pins(pins);
  981. break;
  982. case AT91RM9200_ID_US2:
  983. pdev = &at91rm9200_uart2_device;
  984. configure_usart2_pins(pins);
  985. break;
  986. case AT91RM9200_ID_US3:
  987. pdev = &at91rm9200_uart3_device;
  988. configure_usart3_pins(pins);
  989. break;
  990. default:
  991. return;
  992. }
  993. pdata = pdev->dev.platform_data;
  994. pdata->num = portnr; /* update to mapped ID */
  995. if (portnr < ATMEL_MAX_UART)
  996. at91_uarts[portnr] = pdev;
  997. }
  998. void __init at91_add_device_serial(void)
  999. {
  1000. int i;
  1001. for (i = 0; i < ATMEL_MAX_UART; i++) {
  1002. if (at91_uarts[i])
  1003. platform_device_register(at91_uarts[i]);
  1004. }
  1005. }
  1006. #else
  1007. void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
  1008. void __init at91_add_device_serial(void) {}
  1009. #endif
  1010. /* -------------------------------------------------------------------- */
  1011. /*
  1012. * These devices are always present and don't need any board-specific
  1013. * setup.
  1014. */
  1015. static int __init at91_add_standard_devices(void)
  1016. {
  1017. at91_add_device_rtc();
  1018. at91_add_device_watchdog();
  1019. at91_add_device_tc();
  1020. return 0;
  1021. }
  1022. arch_initcall(at91_add_standard_devices);