devs.c 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642
  1. /* linux/arch/arm/plat-samsung/devs.c
  2. *
  3. * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  4. * http://www.samsung.com
  5. *
  6. * Base SAMSUNG 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. #include <linux/kernel.h>
  13. #include <linux/types.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/list.h>
  16. #include <linux/timer.h>
  17. #include <linux/init.h>
  18. #include <linux/serial_core.h>
  19. #include <linux/platform_device.h>
  20. #include <linux/io.h>
  21. #include <linux/slab.h>
  22. #include <linux/string.h>
  23. #include <linux/dma-mapping.h>
  24. #include <linux/fb.h>
  25. #include <linux/gfp.h>
  26. #include <linux/mtd/mtd.h>
  27. #include <linux/mtd/onenand.h>
  28. #include <linux/mtd/partitions.h>
  29. #include <linux/mmc/host.h>
  30. #include <linux/ioport.h>
  31. #include <linux/platform_data/s3c-hsudc.h>
  32. #include <asm/irq.h>
  33. #include <asm/pmu.h>
  34. #include <asm/mach/arch.h>
  35. #include <asm/mach/map.h>
  36. #include <asm/mach/irq.h>
  37. #include <mach/hardware.h>
  38. #include <mach/dma.h>
  39. #include <mach/irqs.h>
  40. #include <mach/map.h>
  41. #include <plat/cpu.h>
  42. #include <plat/devs.h>
  43. #include <plat/adc.h>
  44. #include <plat/ata.h>
  45. #include <plat/ehci.h>
  46. #include <plat/fb.h>
  47. #include <plat/fb-s3c2410.h>
  48. #include <plat/hwmon.h>
  49. #include <plat/iic.h>
  50. #include <plat/keypad.h>
  51. #include <plat/mci.h>
  52. #include <plat/nand.h>
  53. #include <plat/sdhci.h>
  54. #include <plat/ts.h>
  55. #include <plat/udc.h>
  56. #include <plat/udc-hs.h>
  57. #include <plat/usb-control.h>
  58. #include <plat/usb-phy.h>
  59. #include <plat/regs-iic.h>
  60. #include <plat/regs-serial.h>
  61. #include <plat/regs-spi.h>
  62. #include <plat/s3c64xx-spi.h>
  63. static u64 samsung_device_dma_mask = DMA_BIT_MASK(32);
  64. /* AC97 */
  65. #ifdef CONFIG_CPU_S3C2440
  66. static struct resource s3c_ac97_resource[] = {
  67. [0] = DEFINE_RES_MEM(S3C2440_PA_AC97, S3C2440_SZ_AC97),
  68. [1] = DEFINE_RES_IRQ(IRQ_S3C244X_AC97),
  69. [2] = DEFINE_RES_DMA_NAMED(DMACH_PCM_OUT, "PCM out"),
  70. [3] = DEFINE_RES_DMA_NAMED(DMACH_PCM_IN, "PCM in"),
  71. [4] = DEFINE_RES_DMA_NAMED(DMACH_MIC_IN, "Mic in"),
  72. };
  73. struct platform_device s3c_device_ac97 = {
  74. .name = "samsung-ac97",
  75. .id = -1,
  76. .num_resources = ARRAY_SIZE(s3c_ac97_resource),
  77. .resource = s3c_ac97_resource,
  78. .dev = {
  79. .dma_mask = &samsung_device_dma_mask,
  80. .coherent_dma_mask = DMA_BIT_MASK(32),
  81. }
  82. };
  83. #endif /* CONFIG_CPU_S3C2440 */
  84. /* ADC */
  85. #ifdef CONFIG_PLAT_S3C24XX
  86. static struct resource s3c_adc_resource[] = {
  87. [0] = DEFINE_RES_MEM(S3C24XX_PA_ADC, S3C24XX_SZ_ADC),
  88. [1] = DEFINE_RES_IRQ(IRQ_TC),
  89. [2] = DEFINE_RES_IRQ(IRQ_ADC),
  90. };
  91. struct platform_device s3c_device_adc = {
  92. .name = "s3c24xx-adc",
  93. .id = -1,
  94. .num_resources = ARRAY_SIZE(s3c_adc_resource),
  95. .resource = s3c_adc_resource,
  96. };
  97. #endif /* CONFIG_PLAT_S3C24XX */
  98. #if defined(CONFIG_SAMSUNG_DEV_ADC)
  99. static struct resource s3c_adc_resource[] = {
  100. [0] = DEFINE_RES_MEM(SAMSUNG_PA_ADC, SZ_256),
  101. [1] = DEFINE_RES_IRQ(IRQ_TC),
  102. [2] = DEFINE_RES_IRQ(IRQ_ADC),
  103. };
  104. struct platform_device s3c_device_adc = {
  105. .name = "samsung-adc",
  106. .id = -1,
  107. .num_resources = ARRAY_SIZE(s3c_adc_resource),
  108. .resource = s3c_adc_resource,
  109. };
  110. #endif /* CONFIG_SAMSUNG_DEV_ADC */
  111. /* Camif Controller */
  112. #ifdef CONFIG_CPU_S3C2440
  113. static struct resource s3c_camif_resource[] = {
  114. [0] = DEFINE_RES_MEM(S3C2440_PA_CAMIF, S3C2440_SZ_CAMIF),
  115. [1] = DEFINE_RES_IRQ(IRQ_CAM),
  116. };
  117. struct platform_device s3c_device_camif = {
  118. .name = "s3c2440-camif",
  119. .id = -1,
  120. .num_resources = ARRAY_SIZE(s3c_camif_resource),
  121. .resource = s3c_camif_resource,
  122. .dev = {
  123. .dma_mask = &samsung_device_dma_mask,
  124. .coherent_dma_mask = DMA_BIT_MASK(32),
  125. }
  126. };
  127. #endif /* CONFIG_CPU_S3C2440 */
  128. /* ASOC DMA */
  129. struct platform_device samsung_asoc_dma = {
  130. .name = "samsung-audio",
  131. .id = -1,
  132. .dev = {
  133. .dma_mask = &samsung_device_dma_mask,
  134. .coherent_dma_mask = DMA_BIT_MASK(32),
  135. }
  136. };
  137. struct platform_device samsung_asoc_idma = {
  138. .name = "samsung-idma",
  139. .id = -1,
  140. .dev = {
  141. .dma_mask = &samsung_device_dma_mask,
  142. .coherent_dma_mask = DMA_BIT_MASK(32),
  143. }
  144. };
  145. /* FB */
  146. #ifdef CONFIG_S3C_DEV_FB
  147. static struct resource s3c_fb_resource[] = {
  148. [0] = DEFINE_RES_MEM(S3C_PA_FB, SZ_16K),
  149. [1] = DEFINE_RES_IRQ(IRQ_LCD_VSYNC),
  150. [2] = DEFINE_RES_IRQ(IRQ_LCD_FIFO),
  151. [3] = DEFINE_RES_IRQ(IRQ_LCD_SYSTEM),
  152. };
  153. struct platform_device s3c_device_fb = {
  154. .name = "s3c-fb",
  155. .id = -1,
  156. .num_resources = ARRAY_SIZE(s3c_fb_resource),
  157. .resource = s3c_fb_resource,
  158. .dev = {
  159. .dma_mask = &samsung_device_dma_mask,
  160. .coherent_dma_mask = DMA_BIT_MASK(32),
  161. },
  162. };
  163. void __init s3c_fb_set_platdata(struct s3c_fb_platdata *pd)
  164. {
  165. s3c_set_platdata(pd, sizeof(struct s3c_fb_platdata),
  166. &s3c_device_fb);
  167. }
  168. #endif /* CONFIG_S3C_DEV_FB */
  169. /* FIMC */
  170. #ifdef CONFIG_S5P_DEV_FIMC0
  171. static struct resource s5p_fimc0_resource[] = {
  172. [0] = DEFINE_RES_MEM(S5P_PA_FIMC0, SZ_4K),
  173. [1] = DEFINE_RES_IRQ(IRQ_FIMC0),
  174. };
  175. struct platform_device s5p_device_fimc0 = {
  176. .name = "s5p-fimc",
  177. .id = 0,
  178. .num_resources = ARRAY_SIZE(s5p_fimc0_resource),
  179. .resource = s5p_fimc0_resource,
  180. .dev = {
  181. .dma_mask = &samsung_device_dma_mask,
  182. .coherent_dma_mask = DMA_BIT_MASK(32),
  183. },
  184. };
  185. struct platform_device s5p_device_fimc_md = {
  186. .name = "s5p-fimc-md",
  187. .id = -1,
  188. };
  189. #endif /* CONFIG_S5P_DEV_FIMC0 */
  190. #ifdef CONFIG_S5P_DEV_FIMC1
  191. static struct resource s5p_fimc1_resource[] = {
  192. [0] = DEFINE_RES_MEM(S5P_PA_FIMC1, SZ_4K),
  193. [1] = DEFINE_RES_IRQ(IRQ_FIMC1),
  194. };
  195. struct platform_device s5p_device_fimc1 = {
  196. .name = "s5p-fimc",
  197. .id = 1,
  198. .num_resources = ARRAY_SIZE(s5p_fimc1_resource),
  199. .resource = s5p_fimc1_resource,
  200. .dev = {
  201. .dma_mask = &samsung_device_dma_mask,
  202. .coherent_dma_mask = DMA_BIT_MASK(32),
  203. },
  204. };
  205. #endif /* CONFIG_S5P_DEV_FIMC1 */
  206. #ifdef CONFIG_S5P_DEV_FIMC2
  207. static struct resource s5p_fimc2_resource[] = {
  208. [0] = DEFINE_RES_MEM(S5P_PA_FIMC2, SZ_4K),
  209. [1] = DEFINE_RES_IRQ(IRQ_FIMC2),
  210. };
  211. struct platform_device s5p_device_fimc2 = {
  212. .name = "s5p-fimc",
  213. .id = 2,
  214. .num_resources = ARRAY_SIZE(s5p_fimc2_resource),
  215. .resource = s5p_fimc2_resource,
  216. .dev = {
  217. .dma_mask = &samsung_device_dma_mask,
  218. .coherent_dma_mask = DMA_BIT_MASK(32),
  219. },
  220. };
  221. #endif /* CONFIG_S5P_DEV_FIMC2 */
  222. #ifdef CONFIG_S5P_DEV_FIMC3
  223. static struct resource s5p_fimc3_resource[] = {
  224. [0] = DEFINE_RES_MEM(S5P_PA_FIMC3, SZ_4K),
  225. [1] = DEFINE_RES_IRQ(IRQ_FIMC3),
  226. };
  227. struct platform_device s5p_device_fimc3 = {
  228. .name = "s5p-fimc",
  229. .id = 3,
  230. .num_resources = ARRAY_SIZE(s5p_fimc3_resource),
  231. .resource = s5p_fimc3_resource,
  232. .dev = {
  233. .dma_mask = &samsung_device_dma_mask,
  234. .coherent_dma_mask = DMA_BIT_MASK(32),
  235. },
  236. };
  237. #endif /* CONFIG_S5P_DEV_FIMC3 */
  238. /* G2D */
  239. #ifdef CONFIG_S5P_DEV_G2D
  240. static struct resource s5p_g2d_resource[] = {
  241. [0] = {
  242. .start = S5P_PA_G2D,
  243. .end = S5P_PA_G2D + SZ_4K - 1,
  244. .flags = IORESOURCE_MEM,
  245. },
  246. [1] = {
  247. .start = IRQ_2D,
  248. .end = IRQ_2D,
  249. .flags = IORESOURCE_IRQ,
  250. },
  251. };
  252. struct platform_device s5p_device_g2d = {
  253. .name = "s5p-g2d",
  254. .id = 0,
  255. .num_resources = ARRAY_SIZE(s5p_g2d_resource),
  256. .resource = s5p_g2d_resource,
  257. .dev = {
  258. .dma_mask = &samsung_device_dma_mask,
  259. .coherent_dma_mask = DMA_BIT_MASK(32),
  260. },
  261. };
  262. #endif /* CONFIG_S5P_DEV_G2D */
  263. #ifdef CONFIG_S5P_DEV_JPEG
  264. static struct resource s5p_jpeg_resource[] = {
  265. [0] = DEFINE_RES_MEM(S5P_PA_JPEG, SZ_4K),
  266. [1] = DEFINE_RES_IRQ(IRQ_JPEG),
  267. };
  268. struct platform_device s5p_device_jpeg = {
  269. .name = "s5p-jpeg",
  270. .id = 0,
  271. .num_resources = ARRAY_SIZE(s5p_jpeg_resource),
  272. .resource = s5p_jpeg_resource,
  273. .dev = {
  274. .dma_mask = &samsung_device_dma_mask,
  275. .coherent_dma_mask = DMA_BIT_MASK(32),
  276. },
  277. };
  278. #endif /* CONFIG_S5P_DEV_JPEG */
  279. /* FIMD0 */
  280. #ifdef CONFIG_S5P_DEV_FIMD0
  281. static struct resource s5p_fimd0_resource[] = {
  282. [0] = DEFINE_RES_MEM(S5P_PA_FIMD0, SZ_32K),
  283. [1] = DEFINE_RES_IRQ(IRQ_FIMD0_VSYNC),
  284. [2] = DEFINE_RES_IRQ(IRQ_FIMD0_FIFO),
  285. [3] = DEFINE_RES_IRQ(IRQ_FIMD0_SYSTEM),
  286. };
  287. struct platform_device s5p_device_fimd0 = {
  288. .name = "s5p-fb",
  289. .id = 0,
  290. .num_resources = ARRAY_SIZE(s5p_fimd0_resource),
  291. .resource = s5p_fimd0_resource,
  292. .dev = {
  293. .dma_mask = &samsung_device_dma_mask,
  294. .coherent_dma_mask = DMA_BIT_MASK(32),
  295. },
  296. };
  297. void __init s5p_fimd0_set_platdata(struct s3c_fb_platdata *pd)
  298. {
  299. s3c_set_platdata(pd, sizeof(struct s3c_fb_platdata),
  300. &s5p_device_fimd0);
  301. }
  302. #endif /* CONFIG_S5P_DEV_FIMD0 */
  303. /* HWMON */
  304. #ifdef CONFIG_S3C_DEV_HWMON
  305. struct platform_device s3c_device_hwmon = {
  306. .name = "s3c-hwmon",
  307. .id = -1,
  308. .dev.parent = &s3c_device_adc.dev,
  309. };
  310. void __init s3c_hwmon_set_platdata(struct s3c_hwmon_pdata *pd)
  311. {
  312. s3c_set_platdata(pd, sizeof(struct s3c_hwmon_pdata),
  313. &s3c_device_hwmon);
  314. }
  315. #endif /* CONFIG_S3C_DEV_HWMON */
  316. /* HSMMC */
  317. #ifdef CONFIG_S3C_DEV_HSMMC
  318. static struct resource s3c_hsmmc_resource[] = {
  319. [0] = DEFINE_RES_MEM(S3C_PA_HSMMC0, SZ_4K),
  320. [1] = DEFINE_RES_IRQ(IRQ_HSMMC0),
  321. };
  322. struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata = {
  323. .max_width = 4,
  324. .host_caps = (MMC_CAP_4_BIT_DATA |
  325. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
  326. .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
  327. };
  328. struct platform_device s3c_device_hsmmc0 = {
  329. .name = "s3c-sdhci",
  330. .id = 0,
  331. .num_resources = ARRAY_SIZE(s3c_hsmmc_resource),
  332. .resource = s3c_hsmmc_resource,
  333. .dev = {
  334. .dma_mask = &samsung_device_dma_mask,
  335. .coherent_dma_mask = DMA_BIT_MASK(32),
  336. .platform_data = &s3c_hsmmc0_def_platdata,
  337. },
  338. };
  339. void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd)
  340. {
  341. s3c_sdhci_set_platdata(pd, &s3c_hsmmc0_def_platdata);
  342. }
  343. #endif /* CONFIG_S3C_DEV_HSMMC */
  344. #ifdef CONFIG_S3C_DEV_HSMMC1
  345. static struct resource s3c_hsmmc1_resource[] = {
  346. [0] = DEFINE_RES_MEM(S3C_PA_HSMMC1, SZ_4K),
  347. [1] = DEFINE_RES_IRQ(IRQ_HSMMC1),
  348. };
  349. struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata = {
  350. .max_width = 4,
  351. .host_caps = (MMC_CAP_4_BIT_DATA |
  352. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
  353. .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
  354. };
  355. struct platform_device s3c_device_hsmmc1 = {
  356. .name = "s3c-sdhci",
  357. .id = 1,
  358. .num_resources = ARRAY_SIZE(s3c_hsmmc1_resource),
  359. .resource = s3c_hsmmc1_resource,
  360. .dev = {
  361. .dma_mask = &samsung_device_dma_mask,
  362. .coherent_dma_mask = DMA_BIT_MASK(32),
  363. .platform_data = &s3c_hsmmc1_def_platdata,
  364. },
  365. };
  366. void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd)
  367. {
  368. s3c_sdhci_set_platdata(pd, &s3c_hsmmc1_def_platdata);
  369. }
  370. #endif /* CONFIG_S3C_DEV_HSMMC1 */
  371. /* HSMMC2 */
  372. #ifdef CONFIG_S3C_DEV_HSMMC2
  373. static struct resource s3c_hsmmc2_resource[] = {
  374. [0] = DEFINE_RES_MEM(S3C_PA_HSMMC2, SZ_4K),
  375. [1] = DEFINE_RES_IRQ(IRQ_HSMMC2),
  376. };
  377. struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata = {
  378. .max_width = 4,
  379. .host_caps = (MMC_CAP_4_BIT_DATA |
  380. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
  381. .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
  382. };
  383. struct platform_device s3c_device_hsmmc2 = {
  384. .name = "s3c-sdhci",
  385. .id = 2,
  386. .num_resources = ARRAY_SIZE(s3c_hsmmc2_resource),
  387. .resource = s3c_hsmmc2_resource,
  388. .dev = {
  389. .dma_mask = &samsung_device_dma_mask,
  390. .coherent_dma_mask = DMA_BIT_MASK(32),
  391. .platform_data = &s3c_hsmmc2_def_platdata,
  392. },
  393. };
  394. void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd)
  395. {
  396. s3c_sdhci_set_platdata(pd, &s3c_hsmmc2_def_platdata);
  397. }
  398. #endif /* CONFIG_S3C_DEV_HSMMC2 */
  399. #ifdef CONFIG_S3C_DEV_HSMMC3
  400. static struct resource s3c_hsmmc3_resource[] = {
  401. [0] = DEFINE_RES_MEM(S3C_PA_HSMMC3, SZ_4K),
  402. [1] = DEFINE_RES_IRQ(IRQ_HSMMC3),
  403. };
  404. struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata = {
  405. .max_width = 4,
  406. .host_caps = (MMC_CAP_4_BIT_DATA |
  407. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
  408. .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
  409. };
  410. struct platform_device s3c_device_hsmmc3 = {
  411. .name = "s3c-sdhci",
  412. .id = 3,
  413. .num_resources = ARRAY_SIZE(s3c_hsmmc3_resource),
  414. .resource = s3c_hsmmc3_resource,
  415. .dev = {
  416. .dma_mask = &samsung_device_dma_mask,
  417. .coherent_dma_mask = DMA_BIT_MASK(32),
  418. .platform_data = &s3c_hsmmc3_def_platdata,
  419. },
  420. };
  421. void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd)
  422. {
  423. s3c_sdhci_set_platdata(pd, &s3c_hsmmc3_def_platdata);
  424. }
  425. #endif /* CONFIG_S3C_DEV_HSMMC3 */
  426. /* I2C */
  427. static struct resource s3c_i2c0_resource[] = {
  428. [0] = DEFINE_RES_MEM(S3C_PA_IIC, SZ_4K),
  429. [1] = DEFINE_RES_IRQ(IRQ_IIC),
  430. };
  431. struct platform_device s3c_device_i2c0 = {
  432. .name = "s3c2410-i2c",
  433. #ifdef CONFIG_S3C_DEV_I2C1
  434. .id = 0,
  435. #else
  436. .id = -1,
  437. #endif
  438. .num_resources = ARRAY_SIZE(s3c_i2c0_resource),
  439. .resource = s3c_i2c0_resource,
  440. };
  441. struct s3c2410_platform_i2c default_i2c_data __initdata = {
  442. .flags = 0,
  443. .slave_addr = 0x10,
  444. .frequency = 100*1000,
  445. .sda_delay = 100,
  446. };
  447. void __init s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *pd)
  448. {
  449. struct s3c2410_platform_i2c *npd;
  450. if (!pd) {
  451. pd = &default_i2c_data;
  452. pd->bus_num = 0;
  453. }
  454. npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
  455. &s3c_device_i2c0);
  456. if (!npd->cfg_gpio)
  457. npd->cfg_gpio = s3c_i2c0_cfg_gpio;
  458. }
  459. #ifdef CONFIG_S3C_DEV_I2C1
  460. static struct resource s3c_i2c1_resource[] = {
  461. [0] = DEFINE_RES_MEM(S3C_PA_IIC1, SZ_4K),
  462. [1] = DEFINE_RES_IRQ(IRQ_IIC1),
  463. };
  464. struct platform_device s3c_device_i2c1 = {
  465. .name = "s3c2410-i2c",
  466. .id = 1,
  467. .num_resources = ARRAY_SIZE(s3c_i2c1_resource),
  468. .resource = s3c_i2c1_resource,
  469. };
  470. void __init s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *pd)
  471. {
  472. struct s3c2410_platform_i2c *npd;
  473. if (!pd) {
  474. pd = &default_i2c_data;
  475. pd->bus_num = 1;
  476. }
  477. npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
  478. &s3c_device_i2c1);
  479. if (!npd->cfg_gpio)
  480. npd->cfg_gpio = s3c_i2c1_cfg_gpio;
  481. }
  482. #endif /* CONFIG_S3C_DEV_I2C1 */
  483. #ifdef CONFIG_S3C_DEV_I2C2
  484. static struct resource s3c_i2c2_resource[] = {
  485. [0] = DEFINE_RES_MEM(S3C_PA_IIC2, SZ_4K),
  486. [1] = DEFINE_RES_IRQ(IRQ_IIC2),
  487. };
  488. struct platform_device s3c_device_i2c2 = {
  489. .name = "s3c2410-i2c",
  490. .id = 2,
  491. .num_resources = ARRAY_SIZE(s3c_i2c2_resource),
  492. .resource = s3c_i2c2_resource,
  493. };
  494. void __init s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *pd)
  495. {
  496. struct s3c2410_platform_i2c *npd;
  497. if (!pd) {
  498. pd = &default_i2c_data;
  499. pd->bus_num = 2;
  500. }
  501. npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
  502. &s3c_device_i2c2);
  503. if (!npd->cfg_gpio)
  504. npd->cfg_gpio = s3c_i2c2_cfg_gpio;
  505. }
  506. #endif /* CONFIG_S3C_DEV_I2C2 */
  507. #ifdef CONFIG_S3C_DEV_I2C3
  508. static struct resource s3c_i2c3_resource[] = {
  509. [0] = DEFINE_RES_MEM(S3C_PA_IIC3, SZ_4K),
  510. [1] = DEFINE_RES_IRQ(IRQ_IIC3),
  511. };
  512. struct platform_device s3c_device_i2c3 = {
  513. .name = "s3c2440-i2c",
  514. .id = 3,
  515. .num_resources = ARRAY_SIZE(s3c_i2c3_resource),
  516. .resource = s3c_i2c3_resource,
  517. };
  518. void __init s3c_i2c3_set_platdata(struct s3c2410_platform_i2c *pd)
  519. {
  520. struct s3c2410_platform_i2c *npd;
  521. if (!pd) {
  522. pd = &default_i2c_data;
  523. pd->bus_num = 3;
  524. }
  525. npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
  526. &s3c_device_i2c3);
  527. if (!npd->cfg_gpio)
  528. npd->cfg_gpio = s3c_i2c3_cfg_gpio;
  529. }
  530. #endif /*CONFIG_S3C_DEV_I2C3 */
  531. #ifdef CONFIG_S3C_DEV_I2C4
  532. static struct resource s3c_i2c4_resource[] = {
  533. [0] = DEFINE_RES_MEM(S3C_PA_IIC4, SZ_4K),
  534. [1] = DEFINE_RES_IRQ(IRQ_IIC4),
  535. };
  536. struct platform_device s3c_device_i2c4 = {
  537. .name = "s3c2440-i2c",
  538. .id = 4,
  539. .num_resources = ARRAY_SIZE(s3c_i2c4_resource),
  540. .resource = s3c_i2c4_resource,
  541. };
  542. void __init s3c_i2c4_set_platdata(struct s3c2410_platform_i2c *pd)
  543. {
  544. struct s3c2410_platform_i2c *npd;
  545. if (!pd) {
  546. pd = &default_i2c_data;
  547. pd->bus_num = 4;
  548. }
  549. npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
  550. &s3c_device_i2c4);
  551. if (!npd->cfg_gpio)
  552. npd->cfg_gpio = s3c_i2c4_cfg_gpio;
  553. }
  554. #endif /*CONFIG_S3C_DEV_I2C4 */
  555. #ifdef CONFIG_S3C_DEV_I2C5
  556. static struct resource s3c_i2c5_resource[] = {
  557. [0] = DEFINE_RES_MEM(S3C_PA_IIC5, SZ_4K),
  558. [1] = DEFINE_RES_IRQ(IRQ_IIC5),
  559. };
  560. struct platform_device s3c_device_i2c5 = {
  561. .name = "s3c2440-i2c",
  562. .id = 5,
  563. .num_resources = ARRAY_SIZE(s3c_i2c5_resource),
  564. .resource = s3c_i2c5_resource,
  565. };
  566. void __init s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *pd)
  567. {
  568. struct s3c2410_platform_i2c *npd;
  569. if (!pd) {
  570. pd = &default_i2c_data;
  571. pd->bus_num = 5;
  572. }
  573. npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
  574. &s3c_device_i2c5);
  575. if (!npd->cfg_gpio)
  576. npd->cfg_gpio = s3c_i2c5_cfg_gpio;
  577. }
  578. #endif /*CONFIG_S3C_DEV_I2C5 */
  579. #ifdef CONFIG_S3C_DEV_I2C6
  580. static struct resource s3c_i2c6_resource[] = {
  581. [0] = DEFINE_RES_MEM(S3C_PA_IIC6, SZ_4K),
  582. [1] = DEFINE_RES_IRQ(IRQ_IIC6),
  583. };
  584. struct platform_device s3c_device_i2c6 = {
  585. .name = "s3c2440-i2c",
  586. .id = 6,
  587. .num_resources = ARRAY_SIZE(s3c_i2c6_resource),
  588. .resource = s3c_i2c6_resource,
  589. };
  590. void __init s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *pd)
  591. {
  592. struct s3c2410_platform_i2c *npd;
  593. if (!pd) {
  594. pd = &default_i2c_data;
  595. pd->bus_num = 6;
  596. }
  597. npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
  598. &s3c_device_i2c6);
  599. if (!npd->cfg_gpio)
  600. npd->cfg_gpio = s3c_i2c6_cfg_gpio;
  601. }
  602. #endif /* CONFIG_S3C_DEV_I2C6 */
  603. #ifdef CONFIG_S3C_DEV_I2C7
  604. static struct resource s3c_i2c7_resource[] = {
  605. [0] = DEFINE_RES_MEM(S3C_PA_IIC7, SZ_4K),
  606. [1] = DEFINE_RES_IRQ(IRQ_IIC7),
  607. };
  608. struct platform_device s3c_device_i2c7 = {
  609. .name = "s3c2440-i2c",
  610. .id = 7,
  611. .num_resources = ARRAY_SIZE(s3c_i2c7_resource),
  612. .resource = s3c_i2c7_resource,
  613. };
  614. void __init s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *pd)
  615. {
  616. struct s3c2410_platform_i2c *npd;
  617. if (!pd) {
  618. pd = &default_i2c_data;
  619. pd->bus_num = 7;
  620. }
  621. npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
  622. &s3c_device_i2c7);
  623. if (!npd->cfg_gpio)
  624. npd->cfg_gpio = s3c_i2c7_cfg_gpio;
  625. }
  626. #endif /* CONFIG_S3C_DEV_I2C7 */
  627. /* I2C HDMIPHY */
  628. #ifdef CONFIG_S5P_DEV_I2C_HDMIPHY
  629. static struct resource s5p_i2c_resource[] = {
  630. [0] = DEFINE_RES_MEM(S5P_PA_IIC_HDMIPHY, SZ_4K),
  631. [1] = DEFINE_RES_IRQ(IRQ_IIC_HDMIPHY),
  632. };
  633. struct platform_device s5p_device_i2c_hdmiphy = {
  634. .name = "s3c2440-hdmiphy-i2c",
  635. .id = -1,
  636. .num_resources = ARRAY_SIZE(s5p_i2c_resource),
  637. .resource = s5p_i2c_resource,
  638. };
  639. void __init s5p_i2c_hdmiphy_set_platdata(struct s3c2410_platform_i2c *pd)
  640. {
  641. struct s3c2410_platform_i2c *npd;
  642. if (!pd) {
  643. pd = &default_i2c_data;
  644. if (soc_is_exynos4210())
  645. pd->bus_num = 8;
  646. else if (soc_is_s5pv210())
  647. pd->bus_num = 3;
  648. else
  649. pd->bus_num = 0;
  650. }
  651. npd = s3c_set_platdata(pd, sizeof(struct s3c2410_platform_i2c),
  652. &s5p_device_i2c_hdmiphy);
  653. }
  654. #endif /* CONFIG_S5P_DEV_I2C_HDMIPHY */
  655. /* I2S */
  656. #ifdef CONFIG_PLAT_S3C24XX
  657. static struct resource s3c_iis_resource[] = {
  658. [0] = DEFINE_RES_MEM(S3C24XX_PA_IIS, S3C24XX_SZ_IIS),
  659. };
  660. struct platform_device s3c_device_iis = {
  661. .name = "s3c24xx-iis",
  662. .id = -1,
  663. .num_resources = ARRAY_SIZE(s3c_iis_resource),
  664. .resource = s3c_iis_resource,
  665. .dev = {
  666. .dma_mask = &samsung_device_dma_mask,
  667. .coherent_dma_mask = DMA_BIT_MASK(32),
  668. }
  669. };
  670. #endif /* CONFIG_PLAT_S3C24XX */
  671. /* IDE CFCON */
  672. #ifdef CONFIG_SAMSUNG_DEV_IDE
  673. static struct resource s3c_cfcon_resource[] = {
  674. [0] = DEFINE_RES_MEM(SAMSUNG_PA_CFCON, SZ_16K),
  675. [1] = DEFINE_RES_IRQ(IRQ_CFCON),
  676. };
  677. struct platform_device s3c_device_cfcon = {
  678. .id = 0,
  679. .num_resources = ARRAY_SIZE(s3c_cfcon_resource),
  680. .resource = s3c_cfcon_resource,
  681. };
  682. void __init s3c_ide_set_platdata(struct s3c_ide_platdata *pdata)
  683. {
  684. s3c_set_platdata(pdata, sizeof(struct s3c_ide_platdata),
  685. &s3c_device_cfcon);
  686. }
  687. #endif /* CONFIG_SAMSUNG_DEV_IDE */
  688. /* KEYPAD */
  689. #ifdef CONFIG_SAMSUNG_DEV_KEYPAD
  690. static struct resource samsung_keypad_resources[] = {
  691. [0] = DEFINE_RES_MEM(SAMSUNG_PA_KEYPAD, SZ_32),
  692. [1] = DEFINE_RES_IRQ(IRQ_KEYPAD),
  693. };
  694. struct platform_device samsung_device_keypad = {
  695. .name = "samsung-keypad",
  696. .id = -1,
  697. .num_resources = ARRAY_SIZE(samsung_keypad_resources),
  698. .resource = samsung_keypad_resources,
  699. };
  700. void __init samsung_keypad_set_platdata(struct samsung_keypad_platdata *pd)
  701. {
  702. struct samsung_keypad_platdata *npd;
  703. npd = s3c_set_platdata(pd, sizeof(struct samsung_keypad_platdata),
  704. &samsung_device_keypad);
  705. if (!npd->cfg_gpio)
  706. npd->cfg_gpio = samsung_keypad_cfg_gpio;
  707. }
  708. #endif /* CONFIG_SAMSUNG_DEV_KEYPAD */
  709. /* LCD Controller */
  710. #ifdef CONFIG_PLAT_S3C24XX
  711. static struct resource s3c_lcd_resource[] = {
  712. [0] = DEFINE_RES_MEM(S3C24XX_PA_LCD, S3C24XX_SZ_LCD),
  713. [1] = DEFINE_RES_IRQ(IRQ_LCD),
  714. };
  715. struct platform_device s3c_device_lcd = {
  716. .name = "s3c2410-lcd",
  717. .id = -1,
  718. .num_resources = ARRAY_SIZE(s3c_lcd_resource),
  719. .resource = s3c_lcd_resource,
  720. .dev = {
  721. .dma_mask = &samsung_device_dma_mask,
  722. .coherent_dma_mask = DMA_BIT_MASK(32),
  723. }
  724. };
  725. void __init s3c24xx_fb_set_platdata(struct s3c2410fb_mach_info *pd)
  726. {
  727. struct s3c2410fb_mach_info *npd;
  728. npd = s3c_set_platdata(pd, sizeof(*npd), &s3c_device_lcd);
  729. if (npd) {
  730. npd->displays = kmemdup(pd->displays,
  731. sizeof(struct s3c2410fb_display) * npd->num_displays,
  732. GFP_KERNEL);
  733. if (!npd->displays)
  734. printk(KERN_ERR "no memory for LCD display data\n");
  735. } else {
  736. printk(KERN_ERR "no memory for LCD platform data\n");
  737. }
  738. }
  739. #endif /* CONFIG_PLAT_S3C24XX */
  740. /* MFC */
  741. #ifdef CONFIG_S5P_DEV_MFC
  742. static struct resource s5p_mfc_resource[] = {
  743. [0] = DEFINE_RES_MEM(S5P_PA_MFC, SZ_64K),
  744. [1] = DEFINE_RES_IRQ(IRQ_MFC),
  745. };
  746. struct platform_device s5p_device_mfc = {
  747. .name = "s5p-mfc",
  748. .id = -1,
  749. .num_resources = ARRAY_SIZE(s5p_mfc_resource),
  750. .resource = s5p_mfc_resource,
  751. };
  752. /*
  753. * MFC hardware has 2 memory interfaces which are modelled as two separate
  754. * platform devices to let dma-mapping distinguish between them.
  755. *
  756. * MFC parent device (s5p_device_mfc) must be registered before memory
  757. * interface specific devices (s5p_device_mfc_l and s5p_device_mfc_r).
  758. */
  759. struct platform_device s5p_device_mfc_l = {
  760. .name = "s5p-mfc-l",
  761. .id = -1,
  762. .dev = {
  763. .parent = &s5p_device_mfc.dev,
  764. .dma_mask = &samsung_device_dma_mask,
  765. .coherent_dma_mask = DMA_BIT_MASK(32),
  766. },
  767. };
  768. struct platform_device s5p_device_mfc_r = {
  769. .name = "s5p-mfc-r",
  770. .id = -1,
  771. .dev = {
  772. .parent = &s5p_device_mfc.dev,
  773. .dma_mask = &samsung_device_dma_mask,
  774. .coherent_dma_mask = DMA_BIT_MASK(32),
  775. },
  776. };
  777. #endif /* CONFIG_S5P_DEV_MFC */
  778. /* MIPI CSIS */
  779. #ifdef CONFIG_S5P_DEV_CSIS0
  780. static struct resource s5p_mipi_csis0_resource[] = {
  781. [0] = DEFINE_RES_MEM(S5P_PA_MIPI_CSIS0, SZ_16K),
  782. [1] = DEFINE_RES_IRQ(IRQ_MIPI_CSIS0),
  783. };
  784. struct platform_device s5p_device_mipi_csis0 = {
  785. .name = "s5p-mipi-csis",
  786. .id = 0,
  787. .num_resources = ARRAY_SIZE(s5p_mipi_csis0_resource),
  788. .resource = s5p_mipi_csis0_resource,
  789. };
  790. #endif /* CONFIG_S5P_DEV_CSIS0 */
  791. #ifdef CONFIG_S5P_DEV_CSIS1
  792. static struct resource s5p_mipi_csis1_resource[] = {
  793. [0] = DEFINE_RES_MEM(S5P_PA_MIPI_CSIS1, SZ_16K),
  794. [1] = DEFINE_RES_IRQ(IRQ_MIPI_CSIS1),
  795. };
  796. struct platform_device s5p_device_mipi_csis1 = {
  797. .name = "s5p-mipi-csis",
  798. .id = 1,
  799. .num_resources = ARRAY_SIZE(s5p_mipi_csis1_resource),
  800. .resource = s5p_mipi_csis1_resource,
  801. };
  802. #endif
  803. /* NAND */
  804. #ifdef CONFIG_S3C_DEV_NAND
  805. static struct resource s3c_nand_resource[] = {
  806. [0] = DEFINE_RES_MEM(S3C_PA_NAND, SZ_1M),
  807. };
  808. struct platform_device s3c_device_nand = {
  809. .name = "s3c2410-nand",
  810. .id = -1,
  811. .num_resources = ARRAY_SIZE(s3c_nand_resource),
  812. .resource = s3c_nand_resource,
  813. };
  814. /*
  815. * s3c_nand_copy_set() - copy nand set data
  816. * @set: The new structure, directly copied from the old.
  817. *
  818. * Copy all the fields from the NAND set field from what is probably __initdata
  819. * to new kernel memory. The code returns 0 if the copy happened correctly or
  820. * an error code for the calling function to display.
  821. *
  822. * Note, we currently do not try and look to see if we've already copied the
  823. * data in a previous set.
  824. */
  825. static int __init s3c_nand_copy_set(struct s3c2410_nand_set *set)
  826. {
  827. void *ptr;
  828. int size;
  829. size = sizeof(struct mtd_partition) * set->nr_partitions;
  830. if (size) {
  831. ptr = kmemdup(set->partitions, size, GFP_KERNEL);
  832. set->partitions = ptr;
  833. if (!ptr)
  834. return -ENOMEM;
  835. }
  836. if (set->nr_map && set->nr_chips) {
  837. size = sizeof(int) * set->nr_chips;
  838. ptr = kmemdup(set->nr_map, size, GFP_KERNEL);
  839. set->nr_map = ptr;
  840. if (!ptr)
  841. return -ENOMEM;
  842. }
  843. if (set->ecc_layout) {
  844. ptr = kmemdup(set->ecc_layout,
  845. sizeof(struct nand_ecclayout), GFP_KERNEL);
  846. set->ecc_layout = ptr;
  847. if (!ptr)
  848. return -ENOMEM;
  849. }
  850. return 0;
  851. }
  852. void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand)
  853. {
  854. struct s3c2410_platform_nand *npd;
  855. int size;
  856. int ret;
  857. /* note, if we get a failure in allocation, we simply drop out of the
  858. * function. If there is so little memory available at initialisation
  859. * time then there is little chance the system is going to run.
  860. */
  861. npd = s3c_set_platdata(nand, sizeof(struct s3c2410_platform_nand),
  862. &s3c_device_nand);
  863. if (!npd)
  864. return;
  865. /* now see if we need to copy any of the nand set data */
  866. size = sizeof(struct s3c2410_nand_set) * npd->nr_sets;
  867. if (size) {
  868. struct s3c2410_nand_set *from = npd->sets;
  869. struct s3c2410_nand_set *to;
  870. int i;
  871. to = kmemdup(from, size, GFP_KERNEL);
  872. npd->sets = to; /* set, even if we failed */
  873. if (!to) {
  874. printk(KERN_ERR "%s: no memory for sets\n", __func__);
  875. return;
  876. }
  877. for (i = 0; i < npd->nr_sets; i++) {
  878. ret = s3c_nand_copy_set(to);
  879. if (ret) {
  880. printk(KERN_ERR "%s: failed to copy set %d\n",
  881. __func__, i);
  882. return;
  883. }
  884. to++;
  885. }
  886. }
  887. }
  888. #endif /* CONFIG_S3C_DEV_NAND */
  889. /* ONENAND */
  890. #ifdef CONFIG_S3C_DEV_ONENAND
  891. static struct resource s3c_onenand_resources[] = {
  892. [0] = DEFINE_RES_MEM(S3C_PA_ONENAND, SZ_1K),
  893. [1] = DEFINE_RES_MEM(S3C_PA_ONENAND_BUF, S3C_SZ_ONENAND_BUF),
  894. [2] = DEFINE_RES_IRQ(IRQ_ONENAND),
  895. };
  896. struct platform_device s3c_device_onenand = {
  897. .name = "samsung-onenand",
  898. .id = 0,
  899. .num_resources = ARRAY_SIZE(s3c_onenand_resources),
  900. .resource = s3c_onenand_resources,
  901. };
  902. #endif /* CONFIG_S3C_DEV_ONENAND */
  903. #ifdef CONFIG_S3C64XX_DEV_ONENAND1
  904. static struct resource s3c64xx_onenand1_resources[] = {
  905. [0] = DEFINE_RES_MEM(S3C64XX_PA_ONENAND1, SZ_1K),
  906. [1] = DEFINE_RES_MEM(S3C64XX_PA_ONENAND1_BUF, S3C64XX_SZ_ONENAND1_BUF),
  907. [2] = DEFINE_RES_IRQ(IRQ_ONENAND1),
  908. };
  909. struct platform_device s3c64xx_device_onenand1 = {
  910. .name = "samsung-onenand",
  911. .id = 1,
  912. .num_resources = ARRAY_SIZE(s3c64xx_onenand1_resources),
  913. .resource = s3c64xx_onenand1_resources,
  914. };
  915. void __init s3c64xx_onenand1_set_platdata(struct onenand_platform_data *pdata)
  916. {
  917. s3c_set_platdata(pdata, sizeof(struct onenand_platform_data),
  918. &s3c64xx_device_onenand1);
  919. }
  920. #endif /* CONFIG_S3C64XX_DEV_ONENAND1 */
  921. #ifdef CONFIG_S5P_DEV_ONENAND
  922. static struct resource s5p_onenand_resources[] = {
  923. [0] = DEFINE_RES_MEM(S5P_PA_ONENAND, SZ_128K),
  924. [1] = DEFINE_RES_MEM(S5P_PA_ONENAND_DMA, SZ_8K),
  925. [2] = DEFINE_RES_IRQ(IRQ_ONENAND_AUDI),
  926. };
  927. struct platform_device s5p_device_onenand = {
  928. .name = "s5pc110-onenand",
  929. .id = -1,
  930. .num_resources = ARRAY_SIZE(s5p_onenand_resources),
  931. .resource = s5p_onenand_resources,
  932. };
  933. #endif /* CONFIG_S5P_DEV_ONENAND */
  934. /* PMU */
  935. #ifdef CONFIG_PLAT_S5P
  936. static struct resource s5p_pmu_resource[] = {
  937. DEFINE_RES_IRQ(IRQ_PMU)
  938. };
  939. static struct platform_device s5p_device_pmu = {
  940. .name = "arm-pmu",
  941. .id = ARM_PMU_DEVICE_CPU,
  942. .num_resources = ARRAY_SIZE(s5p_pmu_resource),
  943. .resource = s5p_pmu_resource,
  944. };
  945. static int __init s5p_pmu_init(void)
  946. {
  947. platform_device_register(&s5p_device_pmu);
  948. return 0;
  949. }
  950. arch_initcall(s5p_pmu_init);
  951. #endif /* CONFIG_PLAT_S5P */
  952. /* PWM Timer */
  953. #ifdef CONFIG_SAMSUNG_DEV_PWM
  954. #define TIMER_RESOURCE_SIZE (1)
  955. #define TIMER_RESOURCE(_tmr, _irq) \
  956. (struct resource [TIMER_RESOURCE_SIZE]) { \
  957. [0] = { \
  958. .start = _irq, \
  959. .end = _irq, \
  960. .flags = IORESOURCE_IRQ \
  961. } \
  962. }
  963. #define DEFINE_S3C_TIMER(_tmr_no, _irq) \
  964. .name = "s3c24xx-pwm", \
  965. .id = _tmr_no, \
  966. .num_resources = TIMER_RESOURCE_SIZE, \
  967. .resource = TIMER_RESOURCE(_tmr_no, _irq), \
  968. /*
  969. * since we already have an static mapping for the timer,
  970. * we do not bother setting any IO resource for the base.
  971. */
  972. struct platform_device s3c_device_timer[] = {
  973. [0] = { DEFINE_S3C_TIMER(0, IRQ_TIMER0) },
  974. [1] = { DEFINE_S3C_TIMER(1, IRQ_TIMER1) },
  975. [2] = { DEFINE_S3C_TIMER(2, IRQ_TIMER2) },
  976. [3] = { DEFINE_S3C_TIMER(3, IRQ_TIMER3) },
  977. [4] = { DEFINE_S3C_TIMER(4, IRQ_TIMER4) },
  978. };
  979. #endif /* CONFIG_SAMSUNG_DEV_PWM */
  980. /* RTC */
  981. #ifdef CONFIG_PLAT_S3C24XX
  982. static struct resource s3c_rtc_resource[] = {
  983. [0] = DEFINE_RES_MEM(S3C24XX_PA_RTC, SZ_256),
  984. [1] = DEFINE_RES_IRQ(IRQ_RTC),
  985. [2] = DEFINE_RES_IRQ(IRQ_TICK),
  986. };
  987. struct platform_device s3c_device_rtc = {
  988. .name = "s3c2410-rtc",
  989. .id = -1,
  990. .num_resources = ARRAY_SIZE(s3c_rtc_resource),
  991. .resource = s3c_rtc_resource,
  992. };
  993. #endif /* CONFIG_PLAT_S3C24XX */
  994. #ifdef CONFIG_S3C_DEV_RTC
  995. static struct resource s3c_rtc_resource[] = {
  996. [0] = DEFINE_RES_MEM(S3C_PA_RTC, SZ_256),
  997. [1] = DEFINE_RES_IRQ(IRQ_RTC_ALARM),
  998. [2] = DEFINE_RES_IRQ(IRQ_RTC_TIC),
  999. };
  1000. struct platform_device s3c_device_rtc = {
  1001. .name = "s3c64xx-rtc",
  1002. .id = -1,
  1003. .num_resources = ARRAY_SIZE(s3c_rtc_resource),
  1004. .resource = s3c_rtc_resource,
  1005. };
  1006. #endif /* CONFIG_S3C_DEV_RTC */
  1007. /* SDI */
  1008. #ifdef CONFIG_PLAT_S3C24XX
  1009. static struct resource s3c_sdi_resource[] = {
  1010. [0] = DEFINE_RES_MEM(S3C24XX_PA_SDI, S3C24XX_SZ_SDI),
  1011. [1] = DEFINE_RES_IRQ(IRQ_SDI),
  1012. };
  1013. struct platform_device s3c_device_sdi = {
  1014. .name = "s3c2410-sdi",
  1015. .id = -1,
  1016. .num_resources = ARRAY_SIZE(s3c_sdi_resource),
  1017. .resource = s3c_sdi_resource,
  1018. };
  1019. void __init s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata)
  1020. {
  1021. s3c_set_platdata(pdata, sizeof(struct s3c24xx_mci_pdata),
  1022. &s3c_device_sdi);
  1023. }
  1024. #endif /* CONFIG_PLAT_S3C24XX */
  1025. /* SPI */
  1026. #ifdef CONFIG_PLAT_S3C24XX
  1027. static struct resource s3c_spi0_resource[] = {
  1028. [0] = DEFINE_RES_MEM(S3C24XX_PA_SPI, SZ_32),
  1029. [1] = DEFINE_RES_IRQ(IRQ_SPI0),
  1030. };
  1031. struct platform_device s3c_device_spi0 = {
  1032. .name = "s3c2410-spi",
  1033. .id = 0,
  1034. .num_resources = ARRAY_SIZE(s3c_spi0_resource),
  1035. .resource = s3c_spi0_resource,
  1036. .dev = {
  1037. .dma_mask = &samsung_device_dma_mask,
  1038. .coherent_dma_mask = DMA_BIT_MASK(32),
  1039. }
  1040. };
  1041. static struct resource s3c_spi1_resource[] = {
  1042. [0] = DEFINE_RES_MEM(S3C24XX_PA_SPI1, SZ_32),
  1043. [1] = DEFINE_RES_IRQ(IRQ_SPI1),
  1044. };
  1045. struct platform_device s3c_device_spi1 = {
  1046. .name = "s3c2410-spi",
  1047. .id = 1,
  1048. .num_resources = ARRAY_SIZE(s3c_spi1_resource),
  1049. .resource = s3c_spi1_resource,
  1050. .dev = {
  1051. .dma_mask = &samsung_device_dma_mask,
  1052. .coherent_dma_mask = DMA_BIT_MASK(32),
  1053. }
  1054. };
  1055. #endif /* CONFIG_PLAT_S3C24XX */
  1056. /* Touchscreen */
  1057. #ifdef CONFIG_PLAT_S3C24XX
  1058. static struct resource s3c_ts_resource[] = {
  1059. [0] = DEFINE_RES_MEM(S3C24XX_PA_ADC, S3C24XX_SZ_ADC),
  1060. [1] = DEFINE_RES_IRQ(IRQ_TC),
  1061. };
  1062. struct platform_device s3c_device_ts = {
  1063. .name = "s3c2410-ts",
  1064. .id = -1,
  1065. .dev.parent = &s3c_device_adc.dev,
  1066. .num_resources = ARRAY_SIZE(s3c_ts_resource),
  1067. .resource = s3c_ts_resource,
  1068. };
  1069. void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *hard_s3c2410ts_info)
  1070. {
  1071. s3c_set_platdata(hard_s3c2410ts_info,
  1072. sizeof(struct s3c2410_ts_mach_info), &s3c_device_ts);
  1073. }
  1074. #endif /* CONFIG_PLAT_S3C24XX */
  1075. #ifdef CONFIG_SAMSUNG_DEV_TS
  1076. static struct resource s3c_ts_resource[] = {
  1077. [0] = DEFINE_RES_MEM(SAMSUNG_PA_ADC, SZ_256),
  1078. [1] = DEFINE_RES_IRQ(IRQ_TC),
  1079. };
  1080. static struct s3c2410_ts_mach_info default_ts_data __initdata = {
  1081. .delay = 10000,
  1082. .presc = 49,
  1083. .oversampling_shift = 2,
  1084. };
  1085. struct platform_device s3c_device_ts = {
  1086. .name = "s3c64xx-ts",
  1087. .id = -1,
  1088. .num_resources = ARRAY_SIZE(s3c_ts_resource),
  1089. .resource = s3c_ts_resource,
  1090. };
  1091. void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *pd)
  1092. {
  1093. if (!pd)
  1094. pd = &default_ts_data;
  1095. s3c_set_platdata(pd, sizeof(struct s3c2410_ts_mach_info),
  1096. &s3c_device_ts);
  1097. }
  1098. #endif /* CONFIG_SAMSUNG_DEV_TS */
  1099. /* TV */
  1100. #ifdef CONFIG_S5P_DEV_TV
  1101. static struct resource s5p_hdmi_resources[] = {
  1102. [0] = DEFINE_RES_MEM(S5P_PA_HDMI, SZ_1M),
  1103. [1] = DEFINE_RES_IRQ(IRQ_HDMI),
  1104. };
  1105. struct platform_device s5p_device_hdmi = {
  1106. .name = "s5p-hdmi",
  1107. .id = -1,
  1108. .num_resources = ARRAY_SIZE(s5p_hdmi_resources),
  1109. .resource = s5p_hdmi_resources,
  1110. };
  1111. static struct resource s5p_sdo_resources[] = {
  1112. [0] = DEFINE_RES_MEM(S5P_PA_SDO, SZ_64K),
  1113. [1] = DEFINE_RES_IRQ(IRQ_SDO),
  1114. };
  1115. struct platform_device s5p_device_sdo = {
  1116. .name = "s5p-sdo",
  1117. .id = -1,
  1118. .num_resources = ARRAY_SIZE(s5p_sdo_resources),
  1119. .resource = s5p_sdo_resources,
  1120. };
  1121. static struct resource s5p_mixer_resources[] = {
  1122. [0] = DEFINE_RES_MEM_NAMED(S5P_PA_MIXER, SZ_64K, "mxr"),
  1123. [1] = DEFINE_RES_MEM_NAMED(S5P_PA_VP, SZ_64K, "vp"),
  1124. [2] = DEFINE_RES_IRQ_NAMED(IRQ_MIXER, "irq"),
  1125. };
  1126. struct platform_device s5p_device_mixer = {
  1127. .name = "s5p-mixer",
  1128. .id = -1,
  1129. .num_resources = ARRAY_SIZE(s5p_mixer_resources),
  1130. .resource = s5p_mixer_resources,
  1131. .dev = {
  1132. .dma_mask = &samsung_device_dma_mask,
  1133. .coherent_dma_mask = DMA_BIT_MASK(32),
  1134. }
  1135. };
  1136. #endif /* CONFIG_S5P_DEV_TV */
  1137. /* USB */
  1138. #ifdef CONFIG_S3C_DEV_USB_HOST
  1139. static struct resource s3c_usb_resource[] = {
  1140. [0] = DEFINE_RES_MEM(S3C_PA_USBHOST, SZ_256),
  1141. [1] = DEFINE_RES_IRQ(IRQ_USBH),
  1142. };
  1143. struct platform_device s3c_device_ohci = {
  1144. .name = "s3c2410-ohci",
  1145. .id = -1,
  1146. .num_resources = ARRAY_SIZE(s3c_usb_resource),
  1147. .resource = s3c_usb_resource,
  1148. .dev = {
  1149. .dma_mask = &samsung_device_dma_mask,
  1150. .coherent_dma_mask = DMA_BIT_MASK(32),
  1151. }
  1152. };
  1153. /*
  1154. * s3c_ohci_set_platdata - initialise OHCI device platform data
  1155. * @info: The platform data.
  1156. *
  1157. * This call copies the @info passed in and sets the device .platform_data
  1158. * field to that copy. The @info is copied so that the original can be marked
  1159. * __initdata.
  1160. */
  1161. void __init s3c_ohci_set_platdata(struct s3c2410_hcd_info *info)
  1162. {
  1163. s3c_set_platdata(info, sizeof(struct s3c2410_hcd_info),
  1164. &s3c_device_ohci);
  1165. }
  1166. #endif /* CONFIG_S3C_DEV_USB_HOST */
  1167. /* USB Device (Gadget) */
  1168. #ifdef CONFIG_PLAT_S3C24XX
  1169. static struct resource s3c_usbgadget_resource[] = {
  1170. [0] = DEFINE_RES_MEM(S3C24XX_PA_USBDEV, S3C24XX_SZ_USBDEV),
  1171. [1] = DEFINE_RES_IRQ(IRQ_USBD),
  1172. };
  1173. struct platform_device s3c_device_usbgadget = {
  1174. .name = "s3c2410-usbgadget",
  1175. .id = -1,
  1176. .num_resources = ARRAY_SIZE(s3c_usbgadget_resource),
  1177. .resource = s3c_usbgadget_resource,
  1178. };
  1179. void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
  1180. {
  1181. s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usbgadget);
  1182. }
  1183. #endif /* CONFIG_PLAT_S3C24XX */
  1184. /* USB EHCI Host Controller */
  1185. #ifdef CONFIG_S5P_DEV_USB_EHCI
  1186. static struct resource s5p_ehci_resource[] = {
  1187. [0] = DEFINE_RES_MEM(S5P_PA_EHCI, SZ_256),
  1188. [1] = DEFINE_RES_IRQ(IRQ_USB_HOST),
  1189. };
  1190. struct platform_device s5p_device_ehci = {
  1191. .name = "s5p-ehci",
  1192. .id = -1,
  1193. .num_resources = ARRAY_SIZE(s5p_ehci_resource),
  1194. .resource = s5p_ehci_resource,
  1195. .dev = {
  1196. .dma_mask = &samsung_device_dma_mask,
  1197. .coherent_dma_mask = DMA_BIT_MASK(32),
  1198. }
  1199. };
  1200. void __init s5p_ehci_set_platdata(struct s5p_ehci_platdata *pd)
  1201. {
  1202. struct s5p_ehci_platdata *npd;
  1203. npd = s3c_set_platdata(pd, sizeof(struct s5p_ehci_platdata),
  1204. &s5p_device_ehci);
  1205. if (!npd->phy_init)
  1206. npd->phy_init = s5p_usb_phy_init;
  1207. if (!npd->phy_exit)
  1208. npd->phy_exit = s5p_usb_phy_exit;
  1209. }
  1210. #endif /* CONFIG_S5P_DEV_USB_EHCI */
  1211. /* USB HSOTG */
  1212. #ifdef CONFIG_S3C_DEV_USB_HSOTG
  1213. static struct resource s3c_usb_hsotg_resources[] = {
  1214. [0] = DEFINE_RES_MEM(S3C_PA_USB_HSOTG, SZ_128K),
  1215. [1] = DEFINE_RES_IRQ(IRQ_OTG),
  1216. };
  1217. struct platform_device s3c_device_usb_hsotg = {
  1218. .name = "s3c-hsotg",
  1219. .id = -1,
  1220. .num_resources = ARRAY_SIZE(s3c_usb_hsotg_resources),
  1221. .resource = s3c_usb_hsotg_resources,
  1222. .dev = {
  1223. .dma_mask = &samsung_device_dma_mask,
  1224. .coherent_dma_mask = DMA_BIT_MASK(32),
  1225. },
  1226. };
  1227. void __init s3c_hsotg_set_platdata(struct s3c_hsotg_plat *pd)
  1228. {
  1229. struct s3c_hsotg_plat *npd;
  1230. npd = s3c_set_platdata(pd, sizeof(struct s3c_hsotg_plat),
  1231. &s3c_device_usb_hsotg);
  1232. if (!npd->phy_init)
  1233. npd->phy_init = s5p_usb_phy_init;
  1234. if (!npd->phy_exit)
  1235. npd->phy_exit = s5p_usb_phy_exit;
  1236. }
  1237. #endif /* CONFIG_S3C_DEV_USB_HSOTG */
  1238. /* USB High Spped 2.0 Device (Gadget) */
  1239. #ifdef CONFIG_PLAT_S3C24XX
  1240. static struct resource s3c_hsudc_resource[] = {
  1241. [0] = DEFINE_RES_MEM(S3C2416_PA_HSUDC, S3C2416_SZ_HSUDC),
  1242. [1] = DEFINE_RES_IRQ(IRQ_USBD),
  1243. };
  1244. struct platform_device s3c_device_usb_hsudc = {
  1245. .name = "s3c-hsudc",
  1246. .id = -1,
  1247. .num_resources = ARRAY_SIZE(s3c_hsudc_resource),
  1248. .resource = s3c_hsudc_resource,
  1249. .dev = {
  1250. .dma_mask = &samsung_device_dma_mask,
  1251. .coherent_dma_mask = DMA_BIT_MASK(32),
  1252. },
  1253. };
  1254. void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd)
  1255. {
  1256. s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usb_hsudc);
  1257. }
  1258. #endif /* CONFIG_PLAT_S3C24XX */
  1259. /* WDT */
  1260. #ifdef CONFIG_S3C_DEV_WDT
  1261. static struct resource s3c_wdt_resource[] = {
  1262. [0] = DEFINE_RES_MEM(S3C_PA_WDT, SZ_1K),
  1263. [1] = DEFINE_RES_IRQ(IRQ_WDT),
  1264. };
  1265. struct platform_device s3c_device_wdt = {
  1266. .name = "s3c2410-wdt",
  1267. .id = -1,
  1268. .num_resources = ARRAY_SIZE(s3c_wdt_resource),
  1269. .resource = s3c_wdt_resource,
  1270. };
  1271. #endif /* CONFIG_S3C_DEV_WDT */
  1272. #ifdef CONFIG_S3C64XX_DEV_SPI0
  1273. static struct resource s3c64xx_spi0_resource[] = {
  1274. [0] = DEFINE_RES_MEM(S3C_PA_SPI0, SZ_256),
  1275. [1] = DEFINE_RES_DMA(DMACH_SPI0_TX),
  1276. [2] = DEFINE_RES_DMA(DMACH_SPI0_RX),
  1277. [3] = DEFINE_RES_IRQ(IRQ_SPI0),
  1278. };
  1279. struct platform_device s3c64xx_device_spi0 = {
  1280. .name = "s3c64xx-spi",
  1281. .id = 0,
  1282. .num_resources = ARRAY_SIZE(s3c64xx_spi0_resource),
  1283. .resource = s3c64xx_spi0_resource,
  1284. .dev = {
  1285. .dma_mask = &samsung_device_dma_mask,
  1286. .coherent_dma_mask = DMA_BIT_MASK(32),
  1287. },
  1288. };
  1289. void __init s3c64xx_spi0_set_platdata(struct s3c64xx_spi_info *pd,
  1290. int src_clk_nr, int num_cs)
  1291. {
  1292. if (!pd) {
  1293. pr_err("%s:Need to pass platform data\n", __func__);
  1294. return;
  1295. }
  1296. /* Reject invalid configuration */
  1297. if (!num_cs || src_clk_nr < 0) {
  1298. pr_err("%s: Invalid SPI configuration\n", __func__);
  1299. return;
  1300. }
  1301. pd->num_cs = num_cs;
  1302. pd->src_clk_nr = src_clk_nr;
  1303. if (!pd->cfg_gpio)
  1304. pd->cfg_gpio = s3c64xx_spi0_cfg_gpio;
  1305. s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi0);
  1306. }
  1307. #endif /* CONFIG_S3C64XX_DEV_SPI0 */
  1308. #ifdef CONFIG_S3C64XX_DEV_SPI1
  1309. static struct resource s3c64xx_spi1_resource[] = {
  1310. [0] = DEFINE_RES_MEM(S3C_PA_SPI1, SZ_256),
  1311. [1] = DEFINE_RES_DMA(DMACH_SPI1_TX),
  1312. [2] = DEFINE_RES_DMA(DMACH_SPI1_RX),
  1313. [3] = DEFINE_RES_IRQ(IRQ_SPI1),
  1314. };
  1315. struct platform_device s3c64xx_device_spi1 = {
  1316. .name = "s3c64xx-spi",
  1317. .id = 1,
  1318. .num_resources = ARRAY_SIZE(s3c64xx_spi1_resource),
  1319. .resource = s3c64xx_spi1_resource,
  1320. .dev = {
  1321. .dma_mask = &samsung_device_dma_mask,
  1322. .coherent_dma_mask = DMA_BIT_MASK(32),
  1323. },
  1324. };
  1325. void __init s3c64xx_spi1_set_platdata(struct s3c64xx_spi_info *pd,
  1326. int src_clk_nr, int num_cs)
  1327. {
  1328. if (!pd) {
  1329. pr_err("%s:Need to pass platform data\n", __func__);
  1330. return;
  1331. }
  1332. /* Reject invalid configuration */
  1333. if (!num_cs || src_clk_nr < 0) {
  1334. pr_err("%s: Invalid SPI configuration\n", __func__);
  1335. return;
  1336. }
  1337. pd->num_cs = num_cs;
  1338. pd->src_clk_nr = src_clk_nr;
  1339. if (!pd->cfg_gpio)
  1340. pd->cfg_gpio = s3c64xx_spi1_cfg_gpio;
  1341. s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi1);
  1342. }
  1343. #endif /* CONFIG_S3C64XX_DEV_SPI1 */
  1344. #ifdef CONFIG_S3C64XX_DEV_SPI2
  1345. static struct resource s3c64xx_spi2_resource[] = {
  1346. [0] = DEFINE_RES_MEM(S3C_PA_SPI2, SZ_256),
  1347. [1] = DEFINE_RES_DMA(DMACH_SPI2_TX),
  1348. [2] = DEFINE_RES_DMA(DMACH_SPI2_RX),
  1349. [3] = DEFINE_RES_IRQ(IRQ_SPI2),
  1350. };
  1351. struct platform_device s3c64xx_device_spi2 = {
  1352. .name = "s3c64xx-spi",
  1353. .id = 2,
  1354. .num_resources = ARRAY_SIZE(s3c64xx_spi2_resource),
  1355. .resource = s3c64xx_spi2_resource,
  1356. .dev = {
  1357. .dma_mask = &samsung_device_dma_mask,
  1358. .coherent_dma_mask = DMA_BIT_MASK(32),
  1359. },
  1360. };
  1361. void __init s3c64xx_spi2_set_platdata(struct s3c64xx_spi_info *pd,
  1362. int src_clk_nr, int num_cs)
  1363. {
  1364. if (!pd) {
  1365. pr_err("%s:Need to pass platform data\n", __func__);
  1366. return;
  1367. }
  1368. /* Reject invalid configuration */
  1369. if (!num_cs || src_clk_nr < 0) {
  1370. pr_err("%s: Invalid SPI configuration\n", __func__);
  1371. return;
  1372. }
  1373. pd->num_cs = num_cs;
  1374. pd->src_clk_nr = src_clk_nr;
  1375. if (!pd->cfg_gpio)
  1376. pd->cfg_gpio = s3c64xx_spi2_cfg_gpio;
  1377. s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi2);
  1378. }
  1379. #endif /* CONFIG_S3C64XX_DEV_SPI2 */