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