diff options
author | Olof Johansson <olof@lixom.net> | 2013-04-28 15:24:08 -0400 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2013-04-28 15:24:20 -0400 |
commit | 775c4f66fd855e68a98fc5049003810fe98e2e20 (patch) | |
tree | f5d8e44d5a335b60ee6e3d480a3f3a854b85d974 /arch/arm/mach-exynos/common.c | |
parent | a4591dcf743ac841f9a7d81399405b8fe77c87bf (diff) | |
parent | 096ee6adcfb79a13ae04150023725c8a67e00ae8 (diff) |
Merge tag 'late-exynos-v3-for-v3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung into late/dt
From Kukjin Kim:
This allows that device tree enables platform to setup a runtime IO
mapping for the chip id
* tag 'late-exynos-v3-for-v3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung:
ARM: dts: Add chip-id controller node on Exynos4/5 SoC
ARM: EXYNOS: Create virtual I/O mapping for Chip-ID controller using device tree
Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/mach-exynos/common.c')
-rw-r--r-- | arch/arm/mach-exynos/common.c | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c index d3efd6768ff8..3f945cf92c0f 100644 --- a/arch/arm/mach-exynos/common.c +++ b/arch/arm/mach-exynos/common.c | |||
@@ -119,17 +119,6 @@ static struct map_desc exynos_iodesc[] __initdata = { | |||
119 | }, | 119 | }, |
120 | }; | 120 | }; |
121 | 121 | ||
122 | #ifdef CONFIG_ARCH_EXYNOS5 | ||
123 | static struct map_desc exynos5440_iodesc[] __initdata = { | ||
124 | { | ||
125 | .virtual = (unsigned long)S5P_VA_CHIPID, | ||
126 | .pfn = __phys_to_pfn(EXYNOS5440_PA_CHIPID), | ||
127 | .length = SZ_4K, | ||
128 | .type = MT_DEVICE, | ||
129 | }, | ||
130 | }; | ||
131 | #endif | ||
132 | |||
133 | static struct map_desc exynos4_iodesc[] __initdata = { | 122 | static struct map_desc exynos4_iodesc[] __initdata = { |
134 | { | 123 | { |
135 | .virtual = (unsigned long)S3C_VA_SYS, | 124 | .virtual = (unsigned long)S3C_VA_SYS, |
@@ -320,6 +309,31 @@ void __init exynos_init_late(void) | |||
320 | exynos_pm_late_initcall(); | 309 | exynos_pm_late_initcall(); |
321 | } | 310 | } |
322 | 311 | ||
312 | #ifdef CONFIG_OF | ||
313 | int __init exynos_fdt_map_chipid(unsigned long node, const char *uname, | ||
314 | int depth, void *data) | ||
315 | { | ||
316 | struct map_desc iodesc; | ||
317 | __be32 *reg; | ||
318 | unsigned long len; | ||
319 | |||
320 | if (!of_flat_dt_is_compatible(node, "samsung,exynos4210-chipid") && | ||
321 | !of_flat_dt_is_compatible(node, "samsung,exynos5440-clock")) | ||
322 | return 0; | ||
323 | |||
324 | reg = of_get_flat_dt_prop(node, "reg", &len); | ||
325 | if (reg == NULL || len != (sizeof(unsigned long) * 2)) | ||
326 | return 0; | ||
327 | |||
328 | iodesc.pfn = __phys_to_pfn(be32_to_cpu(reg[0])); | ||
329 | iodesc.length = be32_to_cpu(reg[1]) - 1; | ||
330 | iodesc.virtual = (unsigned long)S5P_VA_CHIPID; | ||
331 | iodesc.type = MT_DEVICE; | ||
332 | iotable_init(&iodesc, 1); | ||
333 | return 1; | ||
334 | } | ||
335 | #endif | ||
336 | |||
323 | /* | 337 | /* |
324 | * exynos_map_io | 338 | * exynos_map_io |
325 | * | 339 | * |
@@ -328,19 +342,12 @@ void __init exynos_init_late(void) | |||
328 | 342 | ||
329 | void __init exynos_init_io(struct map_desc *mach_desc, int size) | 343 | void __init exynos_init_io(struct map_desc *mach_desc, int size) |
330 | { | 344 | { |
331 | struct map_desc *iodesc = exynos_iodesc; | 345 | #ifdef CONFIG_OF |
332 | int iodesc_sz = ARRAY_SIZE(exynos_iodesc); | 346 | if (initial_boot_params) |
333 | #if defined(CONFIG_OF) && defined(CONFIG_ARCH_EXYNOS5) | 347 | of_scan_flat_dt(exynos_fdt_map_chipid, NULL); |
334 | unsigned long root = of_get_flat_dt_root(); | 348 | else |
335 | |||
336 | /* initialize the io descriptors we need for initialization */ | ||
337 | if (of_flat_dt_is_compatible(root, "samsung,exynos5440")) { | ||
338 | iodesc = exynos5440_iodesc; | ||
339 | iodesc_sz = ARRAY_SIZE(exynos5440_iodesc); | ||
340 | } | ||
341 | #endif | 349 | #endif |
342 | 350 | iotable_init(exynos_iodesc, ARRAY_SIZE(exynos_iodesc)); | |
343 | iotable_init(iodesc, iodesc_sz); | ||
344 | 351 | ||
345 | if (mach_desc) | 352 | if (mach_desc) |
346 | iotable_init(mach_desc, size); | 353 | iotable_init(mach_desc, size); |