devs.c 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. /* linux/arch/arm/mach-s3c2410/devs.c
  2. *
  3. * Copyright (c) 2004 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * Base S3C2410 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. * Modifications:
  13. * 10-Mar-2005 LCVR Changed S3C2410_{VA,SZ} to S3C24XX_{VA,SZ}
  14. * 10-Feb-2005 BJD Added camera from guillaume.gourat@nexvision.tv
  15. * 29-Aug-2004 BJD Added timers 0 through 3
  16. * 29-Aug-2004 BJD Changed index of devices we only have one of to -1
  17. * 21-Aug-2004 BJD Added IRQ_TICK to RTC resources
  18. * 18-Aug-2004 BJD Created initial version
  19. */
  20. #include <linux/kernel.h>
  21. #include <linux/types.h>
  22. #include <linux/interrupt.h>
  23. #include <linux/list.h>
  24. #include <linux/timer.h>
  25. #include <linux/init.h>
  26. #include <linux/device.h>
  27. #include <asm/mach/arch.h>
  28. #include <asm/mach/map.h>
  29. #include <asm/mach/irq.h>
  30. #include <asm/hardware.h>
  31. #include <asm/io.h>
  32. #include <asm/irq.h>
  33. #include <asm/arch/regs-serial.h>
  34. #include "devs.h"
  35. /* Serial port registrations */
  36. struct platform_device *s3c24xx_uart_devs[3];
  37. /* USB Host Controller */
  38. static struct resource s3c_usb_resource[] = {
  39. [0] = {
  40. .start = S3C2410_PA_USBHOST,
  41. .end = S3C2410_PA_USBHOST + S3C24XX_SZ_USBHOST,
  42. .flags = IORESOURCE_MEM,
  43. },
  44. [1] = {
  45. .start = IRQ_USBH,
  46. .end = IRQ_USBH,
  47. .flags = IORESOURCE_IRQ,
  48. }
  49. };
  50. static u64 s3c_device_usb_dmamask = 0xffffffffUL;
  51. struct platform_device s3c_device_usb = {
  52. .name = "s3c2410-ohci",
  53. .id = -1,
  54. .num_resources = ARRAY_SIZE(s3c_usb_resource),
  55. .resource = s3c_usb_resource,
  56. .dev = {
  57. .dma_mask = &s3c_device_usb_dmamask,
  58. .coherent_dma_mask = 0xffffffffUL
  59. }
  60. };
  61. EXPORT_SYMBOL(s3c_device_usb);
  62. /* LCD Controller */
  63. static struct resource s3c_lcd_resource[] = {
  64. [0] = {
  65. .start = S3C2410_PA_LCD,
  66. .end = S3C2410_PA_LCD + S3C24XX_SZ_LCD,
  67. .flags = IORESOURCE_MEM,
  68. },
  69. [1] = {
  70. .start = IRQ_LCD,
  71. .end = IRQ_LCD,
  72. .flags = IORESOURCE_IRQ,
  73. }
  74. };
  75. static u64 s3c_device_lcd_dmamask = 0xffffffffUL;
  76. struct platform_device s3c_device_lcd = {
  77. .name = "s3c2410-lcd",
  78. .id = -1,
  79. .num_resources = ARRAY_SIZE(s3c_lcd_resource),
  80. .resource = s3c_lcd_resource,
  81. .dev = {
  82. .dma_mask = &s3c_device_lcd_dmamask,
  83. .coherent_dma_mask = 0xffffffffUL
  84. }
  85. };
  86. EXPORT_SYMBOL(s3c_device_lcd);
  87. /* NAND Controller */
  88. static struct resource s3c_nand_resource[] = {
  89. [0] = {
  90. .start = S3C2410_PA_NAND,
  91. .end = S3C2410_PA_NAND + S3C24XX_SZ_NAND,
  92. .flags = IORESOURCE_MEM,
  93. }
  94. };
  95. struct platform_device s3c_device_nand = {
  96. .name = "s3c2410-nand",
  97. .id = -1,
  98. .num_resources = ARRAY_SIZE(s3c_nand_resource),
  99. .resource = s3c_nand_resource,
  100. };
  101. EXPORT_SYMBOL(s3c_device_nand);
  102. /* USB Device (Gadget)*/
  103. static struct resource s3c_usbgadget_resource[] = {
  104. [0] = {
  105. .start = S3C2410_PA_USBDEV,
  106. .end = S3C2410_PA_USBDEV + S3C24XX_SZ_USBDEV,
  107. .flags = IORESOURCE_MEM,
  108. },
  109. [1] = {
  110. .start = IRQ_USBD,
  111. .end = IRQ_USBD,
  112. .flags = IORESOURCE_IRQ,
  113. }
  114. };
  115. struct platform_device s3c_device_usbgadget = {
  116. .name = "s3c2410-usbgadget",
  117. .id = -1,
  118. .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
  119. .resource = s3c_usbgadget_resource,
  120. };
  121. EXPORT_SYMBOL(s3c_device_usbgadget);
  122. /* Watchdog */
  123. static struct resource s3c_wdt_resource[] = {
  124. [0] = {
  125. .start = S3C2410_PA_WATCHDOG,
  126. .end = S3C2410_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG,
  127. .flags = IORESOURCE_MEM,
  128. },
  129. [1] = {
  130. .start = IRQ_WDT,
  131. .end = IRQ_WDT,
  132. .flags = IORESOURCE_IRQ,
  133. }
  134. };
  135. struct platform_device s3c_device_wdt = {
  136. .name = "s3c2410-wdt",
  137. .id = -1,
  138. .num_resources = ARRAY_SIZE(s3c_wdt_resource),
  139. .resource = s3c_wdt_resource,
  140. };
  141. EXPORT_SYMBOL(s3c_device_wdt);
  142. /* I2C */
  143. static struct resource s3c_i2c_resource[] = {
  144. [0] = {
  145. .start = S3C2410_PA_IIC,
  146. .end = S3C2410_PA_IIC + S3C24XX_SZ_IIC,
  147. .flags = IORESOURCE_MEM,
  148. },
  149. [1] = {
  150. .start = IRQ_IIC,
  151. .end = IRQ_IIC,
  152. .flags = IORESOURCE_IRQ,
  153. }
  154. };
  155. struct platform_device s3c_device_i2c = {
  156. .name = "s3c2410-i2c",
  157. .id = -1,
  158. .num_resources = ARRAY_SIZE(s3c_i2c_resource),
  159. .resource = s3c_i2c_resource,
  160. };
  161. EXPORT_SYMBOL(s3c_device_i2c);
  162. /* IIS */
  163. static struct resource s3c_iis_resource[] = {
  164. [0] = {
  165. .start = S3C2410_PA_IIS,
  166. .end = S3C2410_PA_IIS + S3C24XX_SZ_IIS,
  167. .flags = IORESOURCE_MEM,
  168. }
  169. };
  170. static u64 s3c_device_iis_dmamask = 0xffffffffUL;
  171. struct platform_device s3c_device_iis = {
  172. .name = "s3c2410-iis",
  173. .id = -1,
  174. .num_resources = ARRAY_SIZE(s3c_iis_resource),
  175. .resource = s3c_iis_resource,
  176. .dev = {
  177. .dma_mask = &s3c_device_iis_dmamask,
  178. .coherent_dma_mask = 0xffffffffUL
  179. }
  180. };
  181. EXPORT_SYMBOL(s3c_device_iis);
  182. /* RTC */
  183. static struct resource s3c_rtc_resource[] = {
  184. [0] = {
  185. .start = S3C2410_PA_RTC,
  186. .end = S3C2410_PA_RTC + 0xff,
  187. .flags = IORESOURCE_MEM,
  188. },
  189. [1] = {
  190. .start = IRQ_RTC,
  191. .end = IRQ_RTC,
  192. .flags = IORESOURCE_IRQ,
  193. },
  194. [2] = {
  195. .start = IRQ_TICK,
  196. .end = IRQ_TICK,
  197. .flags = IORESOURCE_IRQ
  198. }
  199. };
  200. struct platform_device s3c_device_rtc = {
  201. .name = "s3c2410-rtc",
  202. .id = -1,
  203. .num_resources = ARRAY_SIZE(s3c_rtc_resource),
  204. .resource = s3c_rtc_resource,
  205. };
  206. EXPORT_SYMBOL(s3c_device_rtc);
  207. /* ADC */
  208. static struct resource s3c_adc_resource[] = {
  209. [0] = {
  210. .start = S3C2410_PA_ADC,
  211. .end = S3C2410_PA_ADC + S3C24XX_SZ_ADC,
  212. .flags = IORESOURCE_MEM,
  213. },
  214. [1] = {
  215. .start = IRQ_TC,
  216. .end = IRQ_ADC,
  217. .flags = IORESOURCE_IRQ,
  218. }
  219. };
  220. struct platform_device s3c_device_adc = {
  221. .name = "s3c2410-adc",
  222. .id = -1,
  223. .num_resources = ARRAY_SIZE(s3c_adc_resource),
  224. .resource = s3c_adc_resource,
  225. };
  226. /* SDI */
  227. static struct resource s3c_sdi_resource[] = {
  228. [0] = {
  229. .start = S3C2410_PA_SDI,
  230. .end = S3C2410_PA_SDI + S3C24XX_SZ_SDI,
  231. .flags = IORESOURCE_MEM,
  232. },
  233. [1] = {
  234. .start = IRQ_SDI,
  235. .end = IRQ_SDI,
  236. .flags = IORESOURCE_IRQ,
  237. }
  238. };
  239. struct platform_device s3c_device_sdi = {
  240. .name = "s3c2410-sdi",
  241. .id = -1,
  242. .num_resources = ARRAY_SIZE(s3c_sdi_resource),
  243. .resource = s3c_sdi_resource,
  244. };
  245. EXPORT_SYMBOL(s3c_device_sdi);
  246. /* SPI (0) */
  247. static struct resource s3c_spi0_resource[] = {
  248. [0] = {
  249. .start = S3C2410_PA_SPI,
  250. .end = S3C2410_PA_SPI + 0x1f,
  251. .flags = IORESOURCE_MEM,
  252. },
  253. [1] = {
  254. .start = IRQ_SPI0,
  255. .end = IRQ_SPI0,
  256. .flags = IORESOURCE_IRQ,
  257. }
  258. };
  259. struct platform_device s3c_device_spi0 = {
  260. .name = "s3c2410-spi",
  261. .id = 0,
  262. .num_resources = ARRAY_SIZE(s3c_spi0_resource),
  263. .resource = s3c_spi0_resource,
  264. };
  265. EXPORT_SYMBOL(s3c_device_spi0);
  266. /* SPI (1) */
  267. static struct resource s3c_spi1_resource[] = {
  268. [0] = {
  269. .start = S3C2410_PA_SPI + 0x20,
  270. .end = S3C2410_PA_SPI + 0x20 + 0x1f,
  271. .flags = IORESOURCE_MEM,
  272. },
  273. [1] = {
  274. .start = IRQ_SPI1,
  275. .end = IRQ_SPI1,
  276. .flags = IORESOURCE_IRQ,
  277. }
  278. };
  279. struct platform_device s3c_device_spi1 = {
  280. .name = "s3c2410-spi",
  281. .id = 1,
  282. .num_resources = ARRAY_SIZE(s3c_spi1_resource),
  283. .resource = s3c_spi1_resource,
  284. };
  285. EXPORT_SYMBOL(s3c_device_spi1);
  286. /* pwm timer blocks */
  287. static struct resource s3c_timer0_resource[] = {
  288. [0] = {
  289. .start = S3C2410_PA_TIMER + 0x0C,
  290. .end = S3C2410_PA_TIMER + 0x0C + 0xB,
  291. .flags = IORESOURCE_MEM,
  292. },
  293. [1] = {
  294. .start = IRQ_TIMER0,
  295. .end = IRQ_TIMER0,
  296. .flags = IORESOURCE_IRQ,
  297. }
  298. };
  299. struct platform_device s3c_device_timer0 = {
  300. .name = "s3c2410-timer",
  301. .id = 0,
  302. .num_resources = ARRAY_SIZE(s3c_timer0_resource),
  303. .resource = s3c_timer0_resource,
  304. };
  305. EXPORT_SYMBOL(s3c_device_timer0);
  306. /* timer 1 */
  307. static struct resource s3c_timer1_resource[] = {
  308. [0] = {
  309. .start = S3C2410_PA_TIMER + 0x18,
  310. .end = S3C2410_PA_TIMER + 0x23,
  311. .flags = IORESOURCE_MEM,
  312. },
  313. [1] = {
  314. .start = IRQ_TIMER1,
  315. .end = IRQ_TIMER1,
  316. .flags = IORESOURCE_IRQ,
  317. }
  318. };
  319. struct platform_device s3c_device_timer1 = {
  320. .name = "s3c2410-timer",
  321. .id = 1,
  322. .num_resources = ARRAY_SIZE(s3c_timer1_resource),
  323. .resource = s3c_timer1_resource,
  324. };
  325. EXPORT_SYMBOL(s3c_device_timer1);
  326. /* timer 2 */
  327. static struct resource s3c_timer2_resource[] = {
  328. [0] = {
  329. .start = S3C2410_PA_TIMER + 0x24,
  330. .end = S3C2410_PA_TIMER + 0x2F,
  331. .flags = IORESOURCE_MEM,
  332. },
  333. [1] = {
  334. .start = IRQ_TIMER2,
  335. .end = IRQ_TIMER2,
  336. .flags = IORESOURCE_IRQ,
  337. }
  338. };
  339. struct platform_device s3c_device_timer2 = {
  340. .name = "s3c2410-timer",
  341. .id = 2,
  342. .num_resources = ARRAY_SIZE(s3c_timer2_resource),
  343. .resource = s3c_timer2_resource,
  344. };
  345. EXPORT_SYMBOL(s3c_device_timer2);
  346. /* timer 3 */
  347. static struct resource s3c_timer3_resource[] = {
  348. [0] = {
  349. .start = S3C2410_PA_TIMER + 0x30,
  350. .end = S3C2410_PA_TIMER + 0x3B,
  351. .flags = IORESOURCE_MEM,
  352. },
  353. [1] = {
  354. .start = IRQ_TIMER3,
  355. .end = IRQ_TIMER3,
  356. .flags = IORESOURCE_IRQ,
  357. }
  358. };
  359. struct platform_device s3c_device_timer3 = {
  360. .name = "s3c2410-timer",
  361. .id = 3,
  362. .num_resources = ARRAY_SIZE(s3c_timer3_resource),
  363. .resource = s3c_timer3_resource,
  364. };
  365. EXPORT_SYMBOL(s3c_device_timer3);
  366. #ifdef CONFIG_CPU_S3C2440
  367. /* Camif Controller */
  368. static struct resource s3c_camif_resource[] = {
  369. [0] = {
  370. .start = S3C2440_PA_CAMIF,
  371. .end = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF,
  372. .flags = IORESOURCE_MEM,
  373. },
  374. [1] = {
  375. .start = IRQ_CAM,
  376. .end = IRQ_CAM,
  377. .flags = IORESOURCE_IRQ,
  378. }
  379. };
  380. static u64 s3c_device_camif_dmamask = 0xffffffffUL;
  381. struct platform_device s3c_device_camif = {
  382. .name = "s3c2440-camif",
  383. .id = -1,
  384. .num_resources = ARRAY_SIZE(s3c_camif_resource),
  385. .resource = s3c_camif_resource,
  386. .dev = {
  387. .dma_mask = &s3c_device_camif_dmamask,
  388. .coherent_dma_mask = 0xffffffffUL
  389. }
  390. };
  391. EXPORT_SYMBOL(s3c_device_camif);
  392. #endif // CONFIG_CPU_S32440