blob: f874b773ca134e231df3e21d3c5c5f65caac33a9 [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_machine_init(void)
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090027{
Abhilash Kesavan7000fe82012-11-20 18:20:38 +090028 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 Abrahamee6c71372013-03-09 17:10:23 +090050 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090051}
52
Kukjin Kim2edb36c2012-11-15 15:48:56 +090053static char const *exynos5_dt_compat[] __initdata = {
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090054 "samsung,exynos5250",
Chander Kashyap191d7542013-06-19 00:29:34 +090055 "samsung,exynos5420",
Kukjin Kim2edb36c2012-11-15 15:48:56 +090056 "samsung,exynos5440",
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090057 NULL
58};
59
Arun Kumar K2eae6132012-10-23 22:51:33 +090060static void __init exynos5_reserve(void)
61{
Kukjin Kimade7ffb2012-12-06 17:02:44 +090062#ifdef CONFIG_S5P_DEV_MFC
Arun Kumar K2eae6132012-10-23 22:51:33 +090063 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 Kimade7ffb2012-12-06 17:02:44 +090070#endif
Arun Kumar K2eae6132012-10-23 22:51:33 +090071}
72
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090073DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
74 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
Marc Zyngier06853ae2011-09-08 13:15:22 +010075 .smp = smp_ops(exynos_smp_ops),
Arnd Bergmann0e2238e2013-06-19 01:36:47 +090076 .map_io = exynos_init_io,
Kukjin Kim2edb36c2012-11-15 15:48:56 +090077 .init_machine = exynos5_dt_machine_init,
Shawn Guobb13fab2012-04-26 10:35:40 +080078 .init_late = exynos_init_late,
Thomas Abraham6923ae42013-03-09 17:03:29 +090079 .init_time = exynos_init_time,
Kukjin Kim2edb36c2012-11-15 15:48:56 +090080 .dt_compat = exynos5_dt_compat,
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090081 .restart = exynos5_restart,
Arun Kumar K2eae6132012-10-23 22:51:33 +090082 .reserve = exynos5_reserve,
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090083MACHINE_END