blob: 050a5b1247efb0b98f09a331e373a00a419ed6cd [file] [log] [blame]
Kukjin Kimb3e68fb2012-02-10 13:13:15 +09001/*
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 Anderson5b7897d2012-11-27 11:53:14 -080013#include <linux/of_fdt.h>
Arun Kumar K2eae6132012-10-23 22:51:33 +090014#include <linux/memblock.h>
Abhilash Kesavan7000fe82012-11-20 18:20:38 +090015#include <linux/io.h>
Thomas Abraham9fbf0c82013-03-09 16:10:03 +090016#include <linux/clocksource.h>
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090017
18#include <asm/mach/arch.h>
Abhilash Kesavan7000fe82012-11-20 18:20:38 +090019#include <mach/regs-pmu.h>
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090020
21#include <plat/cpu.h>
Arun Kumar K2eae6132012-10-23 22:51:33 +090022#include <plat/mfc.h>
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090023
24#include "common.h"
25
Kukjin Kim2edb36c2012-11-15 15:48:56 +090026static void __init exynos5_dt_map_io(void)
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090027{
28 exynos_init_io(NULL, 0);
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090029}
30
Kukjin Kim2edb36c2012-11-15 15:48:56 +090031static void __init exynos5_dt_machine_init(void)
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090032{
Abhilash Kesavan7000fe82012-11-20 18:20:38 +090033 struct device_node *i2c_np;
34 const char *i2c_compat = "samsung,s3c2440-i2c";
35 unsigned int tmp;
36
37 /*
38 * Exynos5's legacy i2c controller and new high speed i2c
39 * controller have muxed interrupt sources. By default the
40 * interrupts for 4-channel HS-I2C controller are enabled.
41 * If node for first four channels of legacy i2c controller
42 * are available then re-configure the interrupts via the
43 * system register.
44 */
45 for_each_compatible_node(i2c_np, NULL, i2c_compat) {
46 if (of_device_is_available(i2c_np)) {
47 if (of_alias_get_id(i2c_np, "i2c") < 4) {
48 tmp = readl(EXYNOS5_SYS_I2C_CFG);
49 writel(tmp & ~(0x1 << of_alias_get_id(i2c_np, "i2c")),
50 EXYNOS5_SYS_I2C_CFG);
51 }
52 }
53 }
54
Thomas Abrahamee6c7132013-03-09 17:10:23 +090055 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090056}
57
Kukjin Kim2edb36c2012-11-15 15:48:56 +090058static char const *exynos5_dt_compat[] __initdata = {
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090059 "samsung,exynos5250",
Chander Kashyap191d7542013-06-19 00:29:34 +090060 "samsung,exynos5420",
Kukjin Kim2edb36c2012-11-15 15:48:56 +090061 "samsung,exynos5440",
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090062 NULL
63};
64
Arun Kumar K2eae6132012-10-23 22:51:33 +090065static void __init exynos5_reserve(void)
66{
Kukjin Kimade7ffb2012-12-06 17:02:44 +090067#ifdef CONFIG_S5P_DEV_MFC
Arun Kumar K2eae6132012-10-23 22:51:33 +090068 struct s5p_mfc_dt_meminfo mfc_mem;
69
70 /* Reserve memory for MFC only if it's available */
71 mfc_mem.compatible = "samsung,mfc-v6";
72 if (of_scan_flat_dt(s5p_fdt_find_mfc_mem, &mfc_mem))
73 s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize, mfc_mem.loff,
74 mfc_mem.lsize);
Kukjin Kimade7ffb2012-12-06 17:02:44 +090075#endif
Arun Kumar K2eae6132012-10-23 22:51:33 +090076}
77
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090078DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
79 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
80 .init_irq = exynos5_init_irq,
Marc Zyngier06853ae2011-09-08 13:15:22 +010081 .smp = smp_ops(exynos_smp_ops),
Kukjin Kim2edb36c2012-11-15 15:48:56 +090082 .map_io = exynos5_dt_map_io,
Kukjin Kim2edb36c2012-11-15 15:48:56 +090083 .init_machine = exynos5_dt_machine_init,
Shawn Guobb13fab2012-04-26 10:35:40 +080084 .init_late = exynos_init_late,
Thomas Abraham6923ae42013-03-09 17:03:29 +090085 .init_time = exynos_init_time,
Kukjin Kim2edb36c2012-11-15 15:48:56 +090086 .dt_compat = exynos5_dt_compat,
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090087 .restart = exynos5_restart,
Arun Kumar K2eae6132012-10-23 22:51:33 +090088 .reserve = exynos5_reserve,
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090089MACHINE_END