devs.c 38 KB

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