Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 1 | /* |
| 2 | * SAMSUNG EXYNOS5250 Flattened Device Tree enabled machine |
| 3 | * |
| 4 | * Copyright (c) 2012 Samsung Electronics Co., Ltd. |
| 5 | * http://www.samsung.com |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/of_platform.h> |
Doug Anderson | 5b7897d | 2012-11-27 11:53:14 -0800 | [diff] [blame] | 13 | #include <linux/of_fdt.h> |
Arun Kumar K | 2eae613 | 2012-10-23 22:51:33 +0900 | [diff] [blame] | 14 | #include <linux/memblock.h> |
Abhilash Kesavan | 7000fe8 | 2012-11-20 18:20:38 +0900 | [diff] [blame] | 15 | #include <linux/io.h> |
Thomas Abraham | 9fbf0c8 | 2013-03-09 16:10:03 +0900 | [diff] [blame] | 16 | #include <linux/clocksource.h> |
Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 17 | |
| 18 | #include <asm/mach/arch.h> |
Abhilash Kesavan | 7000fe8 | 2012-11-20 18:20:38 +0900 | [diff] [blame] | 19 | #include <mach/regs-pmu.h> |
Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 20 | |
| 21 | #include <plat/cpu.h> |
Arun Kumar K | 2eae613 | 2012-10-23 22:51:33 +0900 | [diff] [blame] | 22 | #include <plat/mfc.h> |
Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 23 | |
| 24 | #include "common.h" |
| 25 | |
Kukjin Kim | 2edb36c | 2012-11-15 15:48:56 +0900 | [diff] [blame] | 26 | static void __init exynos5_dt_machine_init(void) |
Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 27 | { |
Abhilash Kesavan | 7000fe8 | 2012-11-20 18:20:38 +0900 | [diff] [blame] | 28 | struct device_node *i2c_np; |
| 29 | const char *i2c_compat = "samsung,s3c2440-i2c"; |
| 30 | unsigned int tmp; |
| 31 | |
| 32 | /* |
| 33 | * Exynos5's legacy i2c controller and new high speed i2c |
| 34 | * controller have muxed interrupt sources. By default the |
| 35 | * interrupts for 4-channel HS-I2C controller are enabled. |
| 36 | * If node for first four channels of legacy i2c controller |
| 37 | * are available then re-configure the interrupts via the |
| 38 | * system register. |
| 39 | */ |
| 40 | for_each_compatible_node(i2c_np, NULL, i2c_compat) { |
| 41 | if (of_device_is_available(i2c_np)) { |
| 42 | if (of_alias_get_id(i2c_np, "i2c") < 4) { |
| 43 | tmp = readl(EXYNOS5_SYS_I2C_CFG); |
| 44 | writel(tmp & ~(0x1 << of_alias_get_id(i2c_np, "i2c")), |
| 45 | EXYNOS5_SYS_I2C_CFG); |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | |
Thomas Abraham | ee6c713 | 2013-03-09 17:10:23 +0900 | [diff] [blame] | 50 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 51 | } |
| 52 | |
Kukjin Kim | 2edb36c | 2012-11-15 15:48:56 +0900 | [diff] [blame] | 53 | static char const *exynos5_dt_compat[] __initdata = { |
Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 54 | "samsung,exynos5250", |
Chander Kashyap | 191d754 | 2013-06-19 00:29:34 +0900 | [diff] [blame] | 55 | "samsung,exynos5420", |
Kukjin Kim | 2edb36c | 2012-11-15 15:48:56 +0900 | [diff] [blame] | 56 | "samsung,exynos5440", |
Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 57 | NULL |
| 58 | }; |
| 59 | |
Arun Kumar K | 2eae613 | 2012-10-23 22:51:33 +0900 | [diff] [blame] | 60 | static void __init exynos5_reserve(void) |
| 61 | { |
Kukjin Kim | ade7ffb | 2012-12-06 17:02:44 +0900 | [diff] [blame] | 62 | #ifdef CONFIG_S5P_DEV_MFC |
Arun Kumar K | 2eae613 | 2012-10-23 22:51:33 +0900 | [diff] [blame] | 63 | struct s5p_mfc_dt_meminfo mfc_mem; |
| 64 | |
| 65 | /* Reserve memory for MFC only if it's available */ |
| 66 | mfc_mem.compatible = "samsung,mfc-v6"; |
| 67 | if (of_scan_flat_dt(s5p_fdt_find_mfc_mem, &mfc_mem)) |
| 68 | s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize, mfc_mem.loff, |
| 69 | mfc_mem.lsize); |
Kukjin Kim | ade7ffb | 2012-12-06 17:02:44 +0900 | [diff] [blame] | 70 | #endif |
Arun Kumar K | 2eae613 | 2012-10-23 22:51:33 +0900 | [diff] [blame] | 71 | } |
| 72 | |
Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 73 | DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)") |
| 74 | /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ |
Marc Zyngier | 06853ae | 2011-09-08 13:15:22 +0100 | [diff] [blame] | 75 | .smp = smp_ops(exynos_smp_ops), |
Arnd Bergmann | 0e2238e | 2013-06-19 01:36:47 +0900 | [diff] [blame] | 76 | .map_io = exynos_init_io, |
Kukjin Kim | 2edb36c | 2012-11-15 15:48:56 +0900 | [diff] [blame] | 77 | .init_machine = exynos5_dt_machine_init, |
Shawn Guo | bb13fab | 2012-04-26 10:35:40 +0800 | [diff] [blame] | 78 | .init_late = exynos_init_late, |
Thomas Abraham | 6923ae4 | 2013-03-09 17:03:29 +0900 | [diff] [blame] | 79 | .init_time = exynos_init_time, |
Kukjin Kim | 2edb36c | 2012-11-15 15:48:56 +0900 | [diff] [blame] | 80 | .dt_compat = exynos5_dt_compat, |
Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 81 | .restart = exynos5_restart, |
Arun Kumar K | 2eae613 | 2012-10-23 22:51:33 +0900 | [diff] [blame] | 82 | .reserve = exynos5_reserve, |
Kukjin Kim | b3e68fb | 2012-02-10 13:13:15 +0900 | [diff] [blame] | 83 | MACHINE_END |