blob: 57bd24f6a4bd94ff95c7518b5217bb67a393ba38 [file] [log] [blame]
Vineet Guptac121c502013-01-18 15:12:20 +05301/*
2 * ARC FPGA Platform support code
3 *
4 * Copyright (C) 2012 Synopsys, Inc. (www.synopsys.com)
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/types.h>
12#include <linux/init.h>
Vineet Guptaee36d172013-01-18 15:12:20 +053013#include <linux/device.h>
Vineet Guptac121c502013-01-18 15:12:20 +053014#include <linux/platform_device.h>
Vineet Gupta7fadc1e2013-01-18 15:12:24 +053015#include <linux/io.h>
Vineet Guptaee36d172013-01-18 15:12:20 +053016#include <linux/console.h>
Vineet Guptaabe11dd2013-01-18 15:12:21 +053017#include <linux/of_platform.h>
Vineet Guptaee36d172013-01-18 15:12:20 +053018#include <asm/setup.h>
Vineet Guptaee36d172013-01-18 15:12:20 +053019#include <asm/clk.h>
Vineet Gupta877768c2013-01-23 16:32:48 +053020#include <asm/mach_desc.h>
Vineet Guptaee36d172013-01-18 15:12:20 +053021#include <plat/memmap.h>
Vineet Gupta877768c2013-01-23 16:32:48 +053022#include <plat/smp.h>
Vineet Guptae97ff122013-01-18 15:12:26 +053023#include <plat/irq.h>
Vineet Guptaee36d172013-01-18 15:12:20 +053024
Vineet Gupta877768c2013-01-23 16:32:48 +053025static void __init plat_fpga_early_init(void)
Vineet Guptac121c502013-01-18 15:12:20 +053026{
27 pr_info("[plat-arcfpga]: registering early dev resources\n");
Vineet Guptaee36d172013-01-18 15:12:20 +053028
Vineet Gupta9a091d92014-02-28 16:13:44 +080029#ifdef CONFIG_ISS_SMP_EXTN
Vineet Guptab830cde2013-01-18 15:12:26 +053030 iss_model_init_early_smp();
31#endif
Vineet Guptac121c502013-01-18 15:12:20 +053032}
33
Vineet Gupta877768c2013-01-23 16:32:48 +053034static void __init plat_fpga_populate_dev(void)
Vineet Guptac121c502013-01-18 15:12:20 +053035{
Vineet Guptaabe11dd2013-01-18 15:12:21 +053036 /*
37 * Traverses flattened DeviceTree - registering platform devices
Vineet Gupta1b9bff72014-06-24 13:55:13 +053038 * (if any) complete with their resources
Vineet Guptaabe11dd2013-01-18 15:12:21 +053039 */
Vineet Gupta1b9bff72014-06-24 13:55:13 +053040 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
Vineet Guptac121c502013-01-18 15:12:20 +053041}
Vineet Gupta877768c2013-01-23 16:32:48 +053042
43/*----------------------- Machine Descriptions ------------------------------
44 *
45 * Machine description is simply a set of platform/board specific callbacks
46 * This is not directly related to DeviceTree based dynamic device creation,
47 * however as part of early device tree scan, we also select the right
48 * callback set, by matching the DT compatible name.
49 */
50
Vineet Gupta70e95642014-09-10 11:08:39 +053051static const char *legacy_fpga_compat[] __initconst = {
Vineet Gupta877768c2013-01-23 16:32:48 +053052 "snps,arc-angel4",
Vineet Gupta877768c2013-01-23 16:32:48 +053053 "snps,arc-ml509",
54 NULL,
55};
56
Vineet Gupta70e95642014-09-10 11:08:39 +053057MACHINE_START(LEGACY_FPGA, "legacy_fpga")
58 .dt_compat = legacy_fpga_compat,
Vineet Gupta877768c2013-01-23 16:32:48 +053059 .init_early = plat_fpga_early_init,
60 .init_machine = plat_fpga_populate_dev,
Vineet Gupta619f3012014-09-04 10:57:33 +053061#ifdef CONFIG_ISS_SMP_EXTN
Vineet Gupta877768c2013-01-23 16:32:48 +053062 .init_smp = iss_model_init_smp,
63#endif
64MACHINE_END
Mischa Jonkera92a5d02013-04-18 11:40:39 +020065
Vineet Gupta70e95642014-09-10 11:08:39 +053066static const char *simulation_compat[] __initconst = {
67 "snps,nsim",
Mischa Jonkera92a5d02013-04-18 11:40:39 +020068 "snps,nsimosci",
69 NULL,
70};
71
Vineet Gupta70e95642014-09-10 11:08:39 +053072MACHINE_START(SIMULATION, "simulation")
73 .dt_compat = simulation_compat,
Mischa Jonkera92a5d02013-04-18 11:40:39 +020074 .init_machine = plat_fpga_populate_dev,
Mischa Jonkera92a5d02013-04-18 11:40:39 +020075MACHINE_END