devs.c 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. /* linux/arch/arm/plat-s3c24xx/devs.c
  2. *
  3. * Copyright (c) 2004 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * Base S3C24XX platform device definitions
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/types.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/list.h>
  17. #include <linux/timer.h>
  18. #include <linux/init.h>
  19. #include <linux/serial_core.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/io.h>
  22. #include <asm/mach/arch.h>
  23. #include <asm/mach/map.h>
  24. #include <asm/mach/irq.h>
  25. #include <mach/fb.h>
  26. #include <mach/hardware.h>
  27. #include <asm/irq.h>
  28. #include <plat/regs-serial.h>
  29. #include <plat/udc.h>
  30. #include <plat/devs.h>
  31. #include <plat/cpu.h>
  32. #include <plat/regs-spi.h>
  33. /* Serial port registrations */
  34. static struct resource s3c2410_uart0_resource[] = {
  35. [0] = {
  36. .start = S3C2410_PA_UART0,
  37. .end = S3C2410_PA_UART0 + 0x3fff,
  38. .flags = IORESOURCE_MEM,
  39. },
  40. [1] = {
  41. .start = IRQ_S3CUART_RX0,
  42. .end = IRQ_S3CUART_ERR0,
  43. .flags = IORESOURCE_IRQ,
  44. }
  45. };
  46. static struct resource s3c2410_uart1_resource[] = {
  47. [0] = {
  48. .start = S3C2410_PA_UART1,
  49. .end = S3C2410_PA_UART1 + 0x3fff,
  50. .flags = IORESOURCE_MEM,
  51. },
  52. [1] = {
  53. .start = IRQ_S3CUART_RX1,
  54. .end = IRQ_S3CUART_ERR1,
  55. .flags = IORESOURCE_IRQ,
  56. }
  57. };
  58. static struct resource s3c2410_uart2_resource[] = {
  59. [0] = {
  60. .start = S3C2410_PA_UART2,
  61. .end = S3C2410_PA_UART2 + 0x3fff,
  62. .flags = IORESOURCE_MEM,
  63. },
  64. [1] = {
  65. .start = IRQ_S3CUART_RX2,
  66. .end = IRQ_S3CUART_ERR2,
  67. .flags = IORESOURCE_IRQ,
  68. }
  69. };
  70. static struct resource s3c2410_uart3_resource[] = {
  71. [0] = {
  72. .start = S3C2443_PA_UART3,
  73. .end = S3C2443_PA_UART3 + 0x3fff,
  74. .flags = IORESOURCE_MEM,
  75. },
  76. [1] = {
  77. .start = IRQ_S3CUART_RX3,
  78. .end = IRQ_S3CUART_ERR3,
  79. .flags = IORESOURCE_IRQ,
  80. },
  81. };
  82. struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
  83. [0] = {
  84. .resources = s3c2410_uart0_resource,
  85. .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
  86. },
  87. [1] = {
  88. .resources = s3c2410_uart1_resource,
  89. .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
  90. },
  91. [2] = {
  92. .resources = s3c2410_uart2_resource,
  93. .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
  94. },
  95. [3] = {
  96. .resources = s3c2410_uart3_resource,
  97. .nr_resources = ARRAY_SIZE(s3c2410_uart3_resource),
  98. },
  99. };
  100. /* yart devices */
  101. static struct platform_device s3c24xx_uart_device0 = {
  102. .id = 0,
  103. };
  104. static struct platform_device s3c24xx_uart_device1 = {
  105. .id = 1,
  106. };
  107. static struct platform_device s3c24xx_uart_device2 = {
  108. .id = 2,
  109. };
  110. static struct platform_device s3c24xx_uart_device3 = {
  111. .id = 3,
  112. };
  113. struct platform_device *s3c24xx_uart_src[4] = {
  114. &s3c24xx_uart_device0,
  115. &s3c24xx_uart_device1,
  116. &s3c24xx_uart_device2,
  117. &s3c24xx_uart_device3,
  118. };
  119. struct platform_device *s3c24xx_uart_devs[4] = {
  120. };
  121. /* USB Host Controller */
  122. static struct resource s3c_usb_resource[] = {
  123. [0] = {
  124. .start = S3C24XX_PA_USBHOST,
  125. .end = S3C24XX_PA_USBHOST + S3C24XX_SZ_USBHOST - 1,
  126. .flags = IORESOURCE_MEM,
  127. },
  128. [1] = {
  129. .start = IRQ_USBH,
  130. .end = IRQ_USBH,
  131. .flags = IORESOURCE_IRQ,
  132. }
  133. };
  134. static u64 s3c_device_usb_dmamask = 0xffffffffUL;
  135. struct platform_device s3c_device_usb = {
  136. .name = "s3c2410-ohci",
  137. .id = -1,
  138. .num_resources = ARRAY_SIZE(s3c_usb_resource),
  139. .resource = s3c_usb_resource,
  140. .dev = {
  141. .dma_mask = &s3c_device_usb_dmamask,
  142. .coherent_dma_mask = 0xffffffffUL
  143. }
  144. };
  145. EXPORT_SYMBOL(s3c_device_usb);
  146. /* LCD Controller */
  147. static struct resource s3c_lcd_resource[] = {
  148. [0] = {
  149. .start = S3C24XX_PA_LCD,
  150. .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,
  151. .flags = IORESOURCE_MEM,
  152. },
  153. [1] = {
  154. .start = IRQ_LCD,
  155. .end = IRQ_LCD,
  156. .flags = IORESOURCE_IRQ,
  157. }
  158. };
  159. static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
  160. struct platform_device s3c_device_lcd = {
  161. .name = "s3c2410-lcd",
  162. .id = -1,
  163. .num_resources = ARRAY_SIZE(s3c_lcd_resource),
  164. .resource = s3c_lcd_resource,
  165. .dev = {
  166. .dma_mask = &s3c_device_lcd_dmamask,
  167. .coherent_dma_mask = 0xffffffffUL
  168. }
  169. };
  170. EXPORT_SYMBOL(s3c_device_lcd);
  171. void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
  172. {
  173. struct s3c2410fb_mach_info *npd;
  174. npd = kmalloc(sizeof(*npd), GFP_KERNEL);
  175. if (npd) {
  176. memcpy(npd, pd, sizeof(*npd));
  177. s3c_device_lcd.dev.platform_data = npd;
  178. } else {
  179. printk(KERN_ERR "no memory for LCD platform data\n");
  180. }
  181. }
  182. /* NAND Controller */
  183. static struct resource s3c_nand_resource[] = {
  184. [0] = {
  185. .start = S3C24XX_PA_NAND,
  186. .end = S3C24XX_PA_NAND + S3C24XX_SZ_NAND - 1,
  187. .flags = IORESOURCE_MEM,
  188. }
  189. };
  190. struct platform_device s3c_device_nand = {
  191. .name = "s3c2410-nand",
  192. .id = -1,
  193. .num_resources = ARRAY_SIZE(s3c_nand_resource),
  194. .resource = s3c_nand_resource,
  195. };
  196. EXPORT_SYMBOL(s3c_device_nand);
  197. /* USB Device (Gadget)*/
  198. static struct resource s3c_usbgadget_resource[] = {
  199. [0] = {
  200. .start = S3C24XX_PA_USBDEV,
  201. .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
  202. .flags = IORESOURCE_MEM,
  203. },
  204. [1] = {
  205. .start = IRQ_USBD,
  206. .end = IRQ_USBD,
  207. .flags = IORESOURCE_IRQ,
  208. }
  209. };
  210. struct platform_device s3c_device_usbgadget = {
  211. .name = "s3c2410-usbgadget",
  212. .id = -1,
  213. .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
  214. .resource = s3c_usbgadget_resource,
  215. };
  216. EXPORT_SYMBOL(s3c_device_usbgadget);
  217. void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
  218. {
  219. struct s3c2410_udc_mach_info *npd;
  220. npd = kmalloc(sizeof(*npd), GFP_KERNEL);
  221. if (npd) {
  222. memcpy(npd, pd, sizeof(*npd));
  223. s3c_device_usbgadget.dev.platform_data = npd;
  224. } else {
  225. printk(KERN_ERR "no memory for udc platform data\n");
  226. }
  227. }
  228. /* Watchdog */
  229. static struct resource s3c_wdt_resource[] = {
  230. [0] = {
  231. .start = S3C24XX_PA_WATCHDOG,
  232. .end = S3C24XX_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG - 1,
  233. .flags = IORESOURCE_MEM,
  234. },
  235. [1] = {
  236. .start = IRQ_WDT,
  237. .end = IRQ_WDT,
  238. .flags = IORESOURCE_IRQ,
  239. }
  240. };
  241. struct platform_device s3c_device_wdt = {
  242. .name = "s3c2410-wdt",
  243. .id = -1,
  244. .num_resources = ARRAY_SIZE(s3c_wdt_resource),
  245. .resource = s3c_wdt_resource,
  246. };
  247. EXPORT_SYMBOL(s3c_device_wdt);
  248. /* IIS */
  249. static struct resource s3c_iis_resource[] = {
  250. [0] = {
  251. .start = S3C24XX_PA_IIS,
  252. .end = S3C24XX_PA_IIS + S3C24XX_SZ_IIS -1,
  253. .flags = IORESOURCE_MEM,
  254. }
  255. };
  256. static u64 s3c_device_iis_dmamask = 0xffffffffUL;
  257. struct platform_device s3c_device_iis = {
  258. .name = "s3c2410-iis",
  259. .id = -1,
  260. .num_resources = ARRAY_SIZE(s3c_iis_resource),
  261. .resource = s3c_iis_resource,
  262. .dev = {
  263. .dma_mask = &s3c_device_iis_dmamask,
  264. .coherent_dma_mask = 0xffffffffUL
  265. }
  266. };
  267. EXPORT_SYMBOL(s3c_device_iis);
  268. /* RTC */
  269. static struct resource s3c_rtc_resource[] = {
  270. [0] = {
  271. .start = S3C24XX_PA_RTC,
  272. .end = S3C24XX_PA_RTC + 0xff,
  273. .flags = IORESOURCE_MEM,
  274. },
  275. [1] = {
  276. .start = IRQ_RTC,
  277. .end = IRQ_RTC,
  278. .flags = IORESOURCE_IRQ,
  279. },
  280. [2] = {
  281. .start = IRQ_TICK,
  282. .end = IRQ_TICK,
  283. .flags = IORESOURCE_IRQ
  284. }
  285. };
  286. struct platform_device s3c_device_rtc = {
  287. .name = "s3c2410-rtc",
  288. .id = -1,
  289. .num_resources = ARRAY_SIZE(s3c_rtc_resource),
  290. .resource = s3c_rtc_resource,
  291. };
  292. EXPORT_SYMBOL(s3c_device_rtc);
  293. /* ADC */
  294. static struct resource s3c_adc_resource[] = {
  295. [0] = {
  296. .start = S3C24XX_PA_ADC,
  297. .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
  298. .flags = IORESOURCE_MEM,
  299. },
  300. [1] = {
  301. .start = IRQ_TC,
  302. .end = IRQ_TC,
  303. .flags = IORESOURCE_IRQ,
  304. },
  305. [2] = {
  306. .start = IRQ_ADC,
  307. .end = IRQ_ADC,
  308. .flags = IORESOURCE_IRQ,
  309. }
  310. };
  311. struct platform_device s3c_device_adc = {
  312. .name = "s3c24xx-adc",
  313. .id = -1,
  314. .num_resources = ARRAY_SIZE(s3c_adc_resource),
  315. .resource = s3c_adc_resource,
  316. };
  317. /* HWMON */
  318. struct platform_device s3c_device_hwmon = {
  319. .name = "s3c24xx-hwmon",
  320. .id = -1,
  321. .dev.parent = &s3c_device_adc.dev,
  322. };
  323. /* SDI */
  324. static struct resource s3c_sdi_resource[] = {
  325. [0] = {
  326. .start = S3C24XX_PA_SDI,
  327. .end = S3C24XX_PA_SDI + S3C24XX_SZ_SDI - 1,
  328. .flags = IORESOURCE_MEM,
  329. },
  330. [1] = {
  331. .start = IRQ_SDI,
  332. .end = IRQ_SDI,
  333. .flags = IORESOURCE_IRQ,
  334. }
  335. };
  336. struct platform_device s3c_device_sdi = {
  337. .name = "s3c2410-sdi",
  338. .id = -1,
  339. .num_resources = ARRAY_SIZE(s3c_sdi_resource),
  340. .resource = s3c_sdi_resource,
  341. };
  342. EXPORT_SYMBOL(s3c_device_sdi);
  343. /* SPI (0) */
  344. static struct resource s3c_spi0_resource[] = {
  345. [0] = {
  346. .start = S3C24XX_PA_SPI,
  347. .end = S3C24XX_PA_SPI + 0x1f,
  348. .flags = IORESOURCE_MEM,
  349. },
  350. [1] = {
  351. .start = IRQ_SPI0,
  352. .end = IRQ_SPI0,
  353. .flags = IORESOURCE_IRQ,
  354. }
  355. };
  356. static u64 s3c_device_spi0_dmamask = 0xffffffffUL;
  357. struct platform_device s3c_device_spi0 = {
  358. .name = "s3c2410-spi",
  359. .id = 0,
  360. .num_resources = ARRAY_SIZE(s3c_spi0_resource),
  361. .resource = s3c_spi0_resource,
  362. .dev = {
  363. .dma_mask = &s3c_device_spi0_dmamask,
  364. .coherent_dma_mask = 0xffffffffUL
  365. }
  366. };
  367. EXPORT_SYMBOL(s3c_device_spi0);
  368. /* SPI (1) */
  369. static struct resource s3c_spi1_resource[] = {
  370. [0] = {
  371. .start = S3C24XX_PA_SPI + S3C2410_SPI1,
  372. .end = S3C24XX_PA_SPI + S3C2410_SPI1 + 0x1f,
  373. .flags = IORESOURCE_MEM,
  374. },
  375. [1] = {
  376. .start = IRQ_SPI1,
  377. .end = IRQ_SPI1,
  378. .flags = IORESOURCE_IRQ,
  379. }
  380. };
  381. static u64 s3c_device_spi1_dmamask = 0xffffffffUL;
  382. struct platform_device s3c_device_spi1 = {
  383. .name = "s3c2410-spi",
  384. .id = 1,
  385. .num_resources = ARRAY_SIZE(s3c_spi1_resource),
  386. .resource = s3c_spi1_resource,
  387. .dev = {
  388. .dma_mask = &s3c_device_spi1_dmamask,
  389. .coherent_dma_mask = 0xffffffffUL
  390. }
  391. };
  392. EXPORT_SYMBOL(s3c_device_spi1);
  393. #ifdef CONFIG_CPU_S3C2440
  394. /* Camif Controller */
  395. static struct resource s3c_camif_resource[] = {
  396. [0] = {
  397. .start = S3C2440_PA_CAMIF,
  398. .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF - 1,
  399. .flags = IORESOURCE_MEM,
  400. },
  401. [1] = {
  402. .start = IRQ_CAM,
  403. .end = IRQ_CAM,
  404. .flags = IORESOURCE_IRQ,
  405. }
  406. };
  407. static u64 s3c_device_camif_dmamask = 0xffffffffUL;
  408. struct platform_device s3c_device_camif = {
  409. .name = "s3c2440-camif",
  410. .id = -1,
  411. .num_resources = ARRAY_SIZE(s3c_camif_resource),
  412. .resource = s3c_camif_resource,
  413. .dev = {
  414. .dma_mask = &s3c_device_camif_dmamask,
  415. .coherent_dma_mask = 0xffffffffUL
  416. }
  417. };
  418. EXPORT_SYMBOL(s3c_device_camif);
  419. #endif // CONFIG_CPU_S32440