xref: /linux/arch/arm/mach-zynq/common.c (revision 3d64b4496f5fd90618106555344205a522178c0c)
1b85a3ef4SJohn Linn /*
2b85a3ef4SJohn Linn  * This file contains common code that is intended to be used across
3b85a3ef4SJohn Linn  * boards so that it's not replicated.
4b85a3ef4SJohn Linn  *
5b85a3ef4SJohn Linn  *  Copyright (C) 2011 Xilinx
6b85a3ef4SJohn Linn  *
7b85a3ef4SJohn Linn  * This software is licensed under the terms of the GNU General Public
8b85a3ef4SJohn Linn  * License version 2, as published by the Free Software Foundation, and
9b85a3ef4SJohn Linn  * may be copied, distributed, and modified under those terms.
10b85a3ef4SJohn Linn  *
11b85a3ef4SJohn Linn  * This program is distributed in the hope that it will be useful,
12b85a3ef4SJohn Linn  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13b85a3ef4SJohn Linn  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14b85a3ef4SJohn Linn  * GNU General Public License for more details.
15b85a3ef4SJohn Linn  */
16b85a3ef4SJohn Linn 
17b85a3ef4SJohn Linn #include <linux/init.h>
18b85a3ef4SJohn Linn #include <linux/kernel.h>
19b85a3ef4SJohn Linn #include <linux/cpumask.h>
20b85a3ef4SJohn Linn #include <linux/platform_device.h>
21b85a3ef4SJohn Linn #include <linux/clk.h>
22b85a3ef4SJohn Linn #include <linux/of_irq.h>
23b85a3ef4SJohn Linn #include <linux/of_platform.h>
24*3d64b449SArnd Bergmann #include <linux/of.h>
25b85a3ef4SJohn Linn 
26*3d64b449SArnd Bergmann #include <asm/mach/arch.h>
27b85a3ef4SJohn Linn #include <asm/mach/map.h>
28*3d64b449SArnd Bergmann #include <asm/mach-types.h>
29b85a3ef4SJohn Linn #include <asm/page.h>
30b85a3ef4SJohn Linn #include <asm/hardware/gic.h>
31b85a3ef4SJohn Linn #include <asm/hardware/cache-l2x0.h>
32b85a3ef4SJohn Linn 
33b85a3ef4SJohn Linn #include <mach/zynq_soc.h>
34b85a3ef4SJohn Linn #include <mach/clkdev.h>
35b85a3ef4SJohn Linn #include "common.h"
36b85a3ef4SJohn Linn 
37b85a3ef4SJohn Linn static struct of_device_id zynq_of_bus_ids[] __initdata = {
38b85a3ef4SJohn Linn 	{ .compatible = "simple-bus", },
39b85a3ef4SJohn Linn 	{}
40b85a3ef4SJohn Linn };
41b85a3ef4SJohn Linn 
42b85a3ef4SJohn Linn /**
43b85a3ef4SJohn Linn  * xilinx_init_machine() - System specific initialization, intended to be
44b85a3ef4SJohn Linn  *			   called from board specific initialization.
45b85a3ef4SJohn Linn  */
46*3d64b449SArnd Bergmann static void __init xilinx_init_machine(void)
47b85a3ef4SJohn Linn {
48b85a3ef4SJohn Linn #ifdef CONFIG_CACHE_L2X0
49b85a3ef4SJohn Linn 	/*
50b85a3ef4SJohn Linn 	 * 64KB way size, 8-way associativity, parity disabled
51b85a3ef4SJohn Linn 	 */
52b85a3ef4SJohn Linn 	l2x0_init(PL310_L2CC_BASE, 0x02060000, 0xF0F0FFFF);
53b85a3ef4SJohn Linn #endif
54b85a3ef4SJohn Linn 
55b85a3ef4SJohn Linn 	of_platform_bus_probe(NULL, zynq_of_bus_ids, NULL);
56b85a3ef4SJohn Linn }
57b85a3ef4SJohn Linn 
58b85a3ef4SJohn Linn /**
59b85a3ef4SJohn Linn  * xilinx_irq_init() - Interrupt controller initialization for the GIC.
60b85a3ef4SJohn Linn  */
61*3d64b449SArnd Bergmann static void __init xilinx_irq_init(void)
62b85a3ef4SJohn Linn {
63b85a3ef4SJohn Linn 	gic_init(0, 29, SCU_GIC_DIST_BASE, SCU_GIC_CPU_BASE);
64b85a3ef4SJohn Linn }
65b85a3ef4SJohn Linn 
66b85a3ef4SJohn Linn /* The minimum devices needed to be mapped before the VM system is up and
67b85a3ef4SJohn Linn  * running include the GIC, UART and Timer Counter.
68b85a3ef4SJohn Linn  */
69b85a3ef4SJohn Linn 
70b85a3ef4SJohn Linn static struct map_desc io_desc[] __initdata = {
71b85a3ef4SJohn Linn 	{
72b85a3ef4SJohn Linn 		.virtual	= TTC0_VIRT,
73b85a3ef4SJohn Linn 		.pfn		= __phys_to_pfn(TTC0_PHYS),
74b85a3ef4SJohn Linn 		.length		= SZ_4K,
75b85a3ef4SJohn Linn 		.type		= MT_DEVICE,
76b85a3ef4SJohn Linn 	}, {
77b85a3ef4SJohn Linn 		.virtual	= SCU_PERIPH_VIRT,
78b85a3ef4SJohn Linn 		.pfn		= __phys_to_pfn(SCU_PERIPH_PHYS),
79b85a3ef4SJohn Linn 		.length		= SZ_8K,
80b85a3ef4SJohn Linn 		.type		= MT_DEVICE,
81b85a3ef4SJohn Linn 	}, {
82b85a3ef4SJohn Linn 		.virtual	= PL310_L2CC_VIRT,
83b85a3ef4SJohn Linn 		.pfn		= __phys_to_pfn(PL310_L2CC_PHYS),
84b85a3ef4SJohn Linn 		.length		= SZ_4K,
85b85a3ef4SJohn Linn 		.type		= MT_DEVICE,
86b85a3ef4SJohn Linn 	},
87b85a3ef4SJohn Linn 
88b85a3ef4SJohn Linn #ifdef CONFIG_DEBUG_LL
89b85a3ef4SJohn Linn 	{
90b85a3ef4SJohn Linn 		.virtual	= UART0_VIRT,
91b85a3ef4SJohn Linn 		.pfn		= __phys_to_pfn(UART0_PHYS),
92b85a3ef4SJohn Linn 		.length		= SZ_4K,
93b85a3ef4SJohn Linn 		.type		= MT_DEVICE,
94b85a3ef4SJohn Linn 	},
95b85a3ef4SJohn Linn #endif
96b85a3ef4SJohn Linn 
97b85a3ef4SJohn Linn };
98b85a3ef4SJohn Linn 
99b85a3ef4SJohn Linn /**
100b85a3ef4SJohn Linn  * xilinx_map_io() - Create memory mappings needed for early I/O.
101b85a3ef4SJohn Linn  */
102*3d64b449SArnd Bergmann static void __init xilinx_map_io(void)
103b85a3ef4SJohn Linn {
104b85a3ef4SJohn Linn 	iotable_init(io_desc, ARRAY_SIZE(io_desc));
105b85a3ef4SJohn Linn }
106*3d64b449SArnd Bergmann 
107*3d64b449SArnd Bergmann static const char *xilinx_dt_match[] = {
108*3d64b449SArnd Bergmann 	"xlnx,zynq-ep107",
109*3d64b449SArnd Bergmann 	NULL
110*3d64b449SArnd Bergmann };
111*3d64b449SArnd Bergmann 
112*3d64b449SArnd Bergmann MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform")
113*3d64b449SArnd Bergmann 	.map_io		= xilinx_map_io,
114*3d64b449SArnd Bergmann 	.init_irq	= xilinx_irq_init,
115*3d64b449SArnd Bergmann 	.init_machine	= xilinx_init_machine,
116*3d64b449SArnd Bergmann 	.timer		= &xttcpss_sys_timer,
117*3d64b449SArnd Bergmann 	.dt_compat	= xilinx_dt_match,
118*3d64b449SArnd Bergmann MACHINE_END
119