devs.c 38 KB

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