devs.c 9.9 KB

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