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