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