devs.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  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 <linux/slab.h>
  23. #include <linux/string.h>
  24. #include <linux/dma-mapping.h>
  25. #include <asm/mach/arch.h>
  26. #include <asm/mach/map.h>
  27. #include <asm/mach/irq.h>
  28. #include <mach/fb.h>
  29. #include <mach/hardware.h>
  30. #include <mach/dma.h>
  31. #include <mach/irqs.h>
  32. #include <asm/irq.h>
  33. #include <plat/regs-serial.h>
  34. #include <plat/udc.h>
  35. #include <plat/mci.h>
  36. #include <plat/devs.h>
  37. #include <plat/cpu.h>
  38. #include <plat/regs-spi.h>
  39. #include <plat/ts.h>
  40. /* Serial port registrations */
  41. static struct resource s3c2410_uart0_resource[] = {
  42. [0] = {
  43. .start = S3C2410_PA_UART0,
  44. .end = S3C2410_PA_UART0 + 0x3fff,
  45. .flags = IORESOURCE_MEM,
  46. },
  47. [1] = {
  48. .start = IRQ_S3CUART_RX0,
  49. .end = IRQ_S3CUART_ERR0,
  50. .flags = IORESOURCE_IRQ,
  51. }
  52. };
  53. static struct resource s3c2410_uart1_resource[] = {
  54. [0] = {
  55. .start = S3C2410_PA_UART1,
  56. .end = S3C2410_PA_UART1 + 0x3fff,
  57. .flags = IORESOURCE_MEM,
  58. },
  59. [1] = {
  60. .start = IRQ_S3CUART_RX1,
  61. .end = IRQ_S3CUART_ERR1,
  62. .flags = IORESOURCE_IRQ,
  63. }
  64. };
  65. static struct resource s3c2410_uart2_resource[] = {
  66. [0] = {
  67. .start = S3C2410_PA_UART2,
  68. .end = S3C2410_PA_UART2 + 0x3fff,
  69. .flags = IORESOURCE_MEM,
  70. },
  71. [1] = {
  72. .start = IRQ_S3CUART_RX2,
  73. .end = IRQ_S3CUART_ERR2,
  74. .flags = IORESOURCE_IRQ,
  75. }
  76. };
  77. static struct resource s3c2410_uart3_resource[] = {
  78. [0] = {
  79. .start = S3C2443_PA_UART3,
  80. .end = S3C2443_PA_UART3 + 0x3fff,
  81. .flags = IORESOURCE_MEM,
  82. },
  83. [1] = {
  84. .start = IRQ_S3CUART_RX3,
  85. .end = IRQ_S3CUART_ERR3,
  86. .flags = IORESOURCE_IRQ,
  87. },
  88. };
  89. struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
  90. [0] = {
  91. .resources = s3c2410_uart0_resource,
  92. .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
  93. },
  94. [1] = {
  95. .resources = s3c2410_uart1_resource,
  96. .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
  97. },
  98. [2] = {
  99. .resources = s3c2410_uart2_resource,
  100. .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
  101. },
  102. [3] = {
  103. .resources = s3c2410_uart3_resource,
  104. .nr_resources = ARRAY_SIZE(s3c2410_uart3_resource),
  105. },
  106. };
  107. /* LCD Controller */
  108. static struct resource s3c_lcd_resource[] = {
  109. [0] = {
  110. .start = S3C24XX_PA_LCD,
  111. .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,
  112. .flags = IORESOURCE_MEM,
  113. },
  114. [1] = {
  115. .start = IRQ_LCD,
  116. .end = IRQ_LCD,
  117. .flags = IORESOURCE_IRQ,
  118. }
  119. };
  120. static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
  121. struct platform_device s3c_device_lcd = {
  122. .name = "s3c2410-lcd",
  123. .id = -1,
  124. .num_resources = ARRAY_SIZE(s3c_lcd_resource),
  125. .resource = s3c_lcd_resource,
  126. .dev = {
  127. .dma_mask = &s3c_device_lcd_dmamask,
  128. .coherent_dma_mask = 0xffffffffUL
  129. }
  130. };
  131. EXPORT_SYMBOL(s3c_device_lcd);
  132. void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
  133. {
  134. struct s3c2410fb_mach_info *npd;
  135. npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_lcd);
  136. if (npd) {
  137. npd->displays = kmemdup(pd->displays,
  138. sizeof(struct s3c2410fb_display) * npd->num_displays,
  139. GFP_KERNEL);
  140. if (!npd->displays)
  141. printk(KERN_ERR "no memory for LCD display data\n");
  142. } else {
  143. printk(KERN_ERR "no memory for LCD platform data\n");
  144. }
  145. }
  146. /* Touchscreen */
  147. static struct resource s3c_ts_resource[] = {
  148. [0] = {
  149. .start = S3C24XX_PA_ADC,
  150. .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
  151. .flags = IORESOURCE_MEM,
  152. },
  153. [1] = {
  154. .start = IRQ_TC,
  155. .end = IRQ_TC,
  156. .flags = IORESOURCE_IRQ,
  157. },
  158. };
  159. struct platform_device s3c_device_ts = {
  160. .name = "s3c2410-ts",
  161. .id = -1,
  162. .dev.parent = &s3c_device_adc.dev,
  163. .num_resources = ARRAY_SIZE(s3c_ts_resource),
  164. .resource = s3c_ts_resource,
  165. };
  166. EXPORT_SYMBOL(s3c_device_ts);
  167. void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_info)
  168. {
  169. s3c_set_platdata(hard_s3c2410ts_info,
  170. sizeof(struct s3c2410_ts_mach_info), &s3c_device_ts);
  171. }
  172. /* USB Device (Gadget)*/
  173. static struct resource s3c_usbgadget_resource[] = {
  174. [0] = {
  175. .start = S3C24XX_PA_USBDEV,
  176. .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
  177. .flags = IORESOURCE_MEM,
  178. },
  179. [1] = {
  180. .start = IRQ_USBD,
  181. .end = IRQ_USBD,
  182. .flags = IORESOURCE_IRQ,
  183. }
  184. };
  185. struct platform_device s3c_device_usbgadget = {
  186. .name = "s3c2410-usbgadget",
  187. .id = -1,
  188. .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
  189. .resource = s3c_usbgadget_resource,
  190. };
  191. EXPORT_SYMBOL(s3c_device_usbgadget);
  192. void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
  193. {
  194. s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usbgadget);
  195. }
  196. /* USB High Speed 2.0 Device (Gadget) */
  197. static struct resource s3c_hsudc_resource[] = {
  198. [0] = {
  199. .start = S3C2416_PA_HSUDC,
  200. .end = S3C2416_PA_HSUDC + S3C2416_SZ_HSUDC - 1,
  201. .flags = IORESOURCE_MEM,
  202. },
  203. [1] = {
  204. .start = IRQ_USBD,
  205. .end = IRQ_USBD,
  206. .flags = IORESOURCE_IRQ,
  207. }
  208. };
  209. static u64 s3c_hsudc_dmamask = DMA_BIT_MASK(32);
  210. struct platform_device s3c_device_usb_hsudc = {
  211. .name = "s3c-hsudc",
  212. .id = -1,
  213. .num_resources = ARRAY_SIZE(s3c_hsudc_resource),
  214. .resource = s3c_hsudc_resource,
  215. .dev = {
  216. .dma_mask = &s3c_hsudc_dmamask,
  217. .coherent_dma_mask = DMA_BIT_MASK(32),
  218. },
  219. };
  220. void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd)
  221. {
  222. s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usb_hsudc);
  223. }
  224. /* IIS */
  225. static struct resource s3c_iis_resource[] = {
  226. [0] = {
  227. .start = S3C24XX_PA_IIS,
  228. .end = S3C24XX_PA_IIS + S3C24XX_SZ_IIS -1,
  229. .flags = IORESOURCE_MEM,
  230. }
  231. };
  232. static u64 s3c_device_iis_dmamask = 0xffffffffUL;
  233. struct platform_device s3c_device_iis = {
  234. .name = "s3c24xx-iis",
  235. .id = -1,
  236. .num_resources = ARRAY_SIZE(s3c_iis_resource),
  237. .resource = s3c_iis_resource,
  238. .dev = {
  239. .dma_mask = &s3c_device_iis_dmamask,
  240. .coherent_dma_mask = 0xffffffffUL
  241. }
  242. };
  243. EXPORT_SYMBOL(s3c_device_iis);
  244. /* RTC */
  245. static struct resource s3c_rtc_resource[] = {
  246. [0] = {
  247. .start = S3C24XX_PA_RTC,
  248. .end = S3C24XX_PA_RTC + 0xff,
  249. .flags = IORESOURCE_MEM,
  250. },
  251. [1] = {
  252. .start = IRQ_RTC,
  253. .end = IRQ_RTC,
  254. .flags = IORESOURCE_IRQ,
  255. },
  256. [2] = {
  257. .start = IRQ_TICK,
  258. .end = IRQ_TICK,
  259. .flags = IORESOURCE_IRQ
  260. }
  261. };
  262. struct platform_device s3c_device_rtc = {
  263. .name = "s3c2410-rtc",
  264. .id = -1,
  265. .num_resources = ARRAY_SIZE(s3c_rtc_resource),
  266. .resource = s3c_rtc_resource,
  267. };
  268. EXPORT_SYMBOL(s3c_device_rtc);
  269. /* ADC */
  270. static struct resource s3c_adc_resource[] = {
  271. [0] = {
  272. .start = S3C24XX_PA_ADC,
  273. .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
  274. .flags = IORESOURCE_MEM,
  275. },
  276. [1] = {
  277. .start = IRQ_TC,
  278. .end = IRQ_TC,
  279. .flags = IORESOURCE_IRQ,
  280. },
  281. [2] = {
  282. .start = IRQ_ADC,
  283. .end = IRQ_ADC,
  284. .flags = IORESOURCE_IRQ,
  285. }
  286. };
  287. struct platform_device s3c_device_adc = {
  288. .name = "s3c24xx-adc",
  289. .id = -1,
  290. .num_resources = ARRAY_SIZE(s3c_adc_resource),
  291. .resource = s3c_adc_resource,
  292. };
  293. /* SDI */
  294. static struct resource s3c_sdi_resource[] = {
  295. [0] = {
  296. .start = S3C24XX_PA_SDI,
  297. .end = S3C24XX_PA_SDI + S3C24XX_SZ_SDI - 1,
  298. .flags = IORESOURCE_MEM,
  299. },
  300. [1] = {
  301. .start = IRQ_SDI,
  302. .end = IRQ_SDI,
  303. .flags = IORESOURCE_IRQ,
  304. }
  305. };
  306. struct platform_device s3c_device_sdi = {
  307. .name = "s3c2410-sdi",
  308. .id = -1,
  309. .num_resources = ARRAY_SIZE(s3c_sdi_resource),
  310. .resource = s3c_sdi_resource,
  311. };
  312. EXPORT_SYMBOL(s3c_device_sdi);
  313. void __init s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata)
  314. {
  315. s3c_set_platdata(pdata, sizeof(struct s3c24xx_mci_pdata),
  316. &s3c_device_sdi);
  317. }
  318. /* SPI (0) */
  319. static struct resource s3c_spi0_resource[] = {
  320. [0] = {
  321. .start = S3C24XX_PA_SPI,
  322. .end = S3C24XX_PA_SPI + 0x1f,
  323. .flags = IORESOURCE_MEM,
  324. },
  325. [1] = {
  326. .start = IRQ_SPI0,
  327. .end = IRQ_SPI0,
  328. .flags = IORESOURCE_IRQ,
  329. }
  330. };
  331. static u64 s3c_device_spi0_dmamask = 0xffffffffUL;
  332. struct platform_device s3c_device_spi0 = {
  333. .name = "s3c2410-spi",
  334. .id = 0,
  335. .num_resources = ARRAY_SIZE(s3c_spi0_resource),
  336. .resource = s3c_spi0_resource,
  337. .dev = {
  338. .dma_mask = &s3c_device_spi0_dmamask,
  339. .coherent_dma_mask = 0xffffffffUL
  340. }
  341. };
  342. EXPORT_SYMBOL(s3c_device_spi0);
  343. /* SPI (1) */
  344. static struct resource s3c_spi1_resource[] = {
  345. [0] = {
  346. .start = S3C24XX_PA_SPI + S3C2410_SPI1,
  347. .end = S3C24XX_PA_SPI + S3C2410_SPI1 + 0x1f,
  348. .flags = IORESOURCE_MEM,
  349. },
  350. [1] = {
  351. .start = IRQ_SPI1,
  352. .end = IRQ_SPI1,
  353. .flags = IORESOURCE_IRQ,
  354. }
  355. };
  356. static u64 s3c_device_spi1_dmamask = 0xffffffffUL;
  357. struct platform_device s3c_device_spi1 = {
  358. .name = "s3c2410-spi",
  359. .id = 1,
  360. .num_resources = ARRAY_SIZE(s3c_spi1_resource),
  361. .resource = s3c_spi1_resource,
  362. .dev = {
  363. .dma_mask = &s3c_device_spi1_dmamask,
  364. .coherent_dma_mask = 0xffffffffUL
  365. }
  366. };
  367. EXPORT_SYMBOL(s3c_device_spi1);
  368. #ifdef CONFIG_CPU_S3C2440
  369. /* Camif Controller */
  370. static struct resource s3c_camif_resource[] = {
  371. [0] = {
  372. .start = S3C2440_PA_CAMIF,
  373. .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF - 1,
  374. .flags = IORESOURCE_MEM,
  375. },
  376. [1] = {
  377. .start = IRQ_CAM,
  378. .end = IRQ_CAM,
  379. .flags = IORESOURCE_IRQ,
  380. }
  381. };
  382. static u64 s3c_device_camif_dmamask = 0xffffffffUL;
  383. struct platform_device s3c_device_camif = {
  384. .name = "s3c2440-camif",
  385. .id = -1,
  386. .num_resources = ARRAY_SIZE(s3c_camif_resource),
  387. .resource = s3c_camif_resource,
  388. .dev = {
  389. .dma_mask = &s3c_device_camif_dmamask,
  390. .coherent_dma_mask = 0xffffffffUL
  391. }
  392. };
  393. EXPORT_SYMBOL(s3c_device_camif);
  394. /* AC97 */
  395. static struct resource s3c_ac97_resource[] = {
  396. [0] = {
  397. .start = S3C2440_PA_AC97,
  398. .end = S3C2440_PA_AC97 + S3C2440_SZ_AC97 -1,
  399. .flags = IORESOURCE_MEM,
  400. },
  401. [1] = {
  402. .start = IRQ_S3C244x_AC97,
  403. .end = IRQ_S3C244x_AC97,
  404. .flags = IORESOURCE_IRQ,
  405. },
  406. [2] = {
  407. .name = "PCM out",
  408. .start = DMACH_PCM_OUT,
  409. .end = DMACH_PCM_OUT,
  410. .flags = IORESOURCE_DMA,
  411. },
  412. [3] = {
  413. .name = "PCM in",
  414. .start = DMACH_PCM_IN,
  415. .end = DMACH_PCM_IN,
  416. .flags = IORESOURCE_DMA,
  417. },
  418. [4] = {
  419. .name = "Mic in",
  420. .start = DMACH_MIC_IN,
  421. .end = DMACH_MIC_IN,
  422. .flags = IORESOURCE_DMA,
  423. },
  424. };
  425. static u64 s3c_device_audio_dmamask = 0xffffffffUL;
  426. struct platform_device s3c_device_ac97 = {
  427. .name = "samsung-ac97",
  428. .id = -1,
  429. .num_resources = ARRAY_SIZE(s3c_ac97_resource),
  430. .resource = s3c_ac97_resource,
  431. .dev = {
  432. .dma_mask = &s3c_device_audio_dmamask,
  433. .coherent_dma_mask = 0xffffffffUL
  434. }
  435. };
  436. EXPORT_SYMBOL(s3c_device_ac97);
  437. /* ASoC I2S */
  438. struct platform_device s3c2412_device_iis = {
  439. .name = "s3c2412-iis",
  440. .id = -1,
  441. .dev = {
  442. .dma_mask = &s3c_device_audio_dmamask,
  443. .coherent_dma_mask = 0xffffffffUL
  444. }
  445. };
  446. EXPORT_SYMBOL(s3c2412_device_iis);
  447. #endif // CONFIG_CPU_S32440