devs.c 9.9 KB

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