Skip to content

Commit b85a3ef

Browse files
author
John Linn
committed
ARM: Xilinx: Adding Xilinx board support
The 1st board support is minimal to get a system up and running on the Xilinx platform. This platform reuses the clock implementation from plat-versatile, and it depends entirely on CONFIG_OF support. There is only one board support file which obtains all device information from a device tree dtb file which is passed to the kernel at boot time. Signed-off-by: John Linn <john.linn@xilinx.com>
1 parent 2c53b43 commit b85a3ef

24 files changed

Lines changed: 938 additions & 1 deletion

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Xilinx Zynq EP107 Emulation Platform board
2+
3+
This board is an emulation platform for the Zynq product which is
4+
based on an ARM Cortex A9 processor.
5+
6+
Required root node properties:
7+
- compatible = "xlnx,zynq-ep107";

‎arch/arm/Kconfig‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,20 @@ config ARCH_VT8500
879879
select HAVE_PWM
880880
help
881881
Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip.
882+
883+
config ARCH_ZYNQ
884+
bool "Xilinx Zynq ARM Cortex A9 Platform"
885+
select CPU_V7
886+
select GENERIC_TIME
887+
select GENERIC_CLOCKEVENTS
888+
select CLKDEV_LOOKUP
889+
select ARM_GIC
890+
select ARM_AMBA
891+
select ICST
892+
select USE_OF
893+
help
894+
Support for Xilinx Zynq ARM Cortex A9 Platform
895+
882896
endchoice
883897

884898
#

‎arch/arm/Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,15 @@ machine-$(CONFIG_MACH_SPEAR300) := spear3xx
196196
machine-$(CONFIG_MACH_SPEAR310) := spear3xx
197197
machine-$(CONFIG_MACH_SPEAR320) := spear3xx
198198
machine-$(CONFIG_MACH_SPEAR600) := spear6xx
199+
machine-$(CONFIG_ARCH_ZYNQ) := zynq
199200

200201
# Platform directory name. This list is sorted alphanumerically
201202
# by CONFIG_* macro name.
202203
plat-$(CONFIG_ARCH_MXC) := mxc
203204
plat-$(CONFIG_ARCH_OMAP) := omap
204205
plat-$(CONFIG_ARCH_S3C64XX) := samsung
205206
plat-$(CONFIG_ARCH_TCC_926) := tcc
207+
plat-$(CONFIG_ARCH_ZYNQ) := versatile
206208
plat-$(CONFIG_PLAT_IOP) := iop
207209
plat-$(CONFIG_PLAT_NOMADIK) := nomadik
208210
plat-$(CONFIG_PLAT_ORION) := orion

‎arch/arm/boot/dts/zynq-ep107.dts‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (C) 2011 Xilinx
3+
*
4+
* This software is licensed under the terms of the GNU General Public
5+
* License version 2, as published by the Free Software Foundation, and
6+
* may be copied, distributed, and modified under those terms.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*/
13+
14+
/dts-v1/;
15+
/ {
16+
model = "Xilinx Zynq EP107";
17+
compatible = "xlnx,zynq-ep107";
18+
#address-cells = <1>;
19+
#size-cells = <1>;
20+
interrupt-parent = <&intc>;
21+
22+
memory {
23+
device_type = "memory";
24+
reg = <0x0 0x10000000>;
25+
};
26+
27+
chosen {
28+
bootargs = "console=ttyPS0,9600 root=/dev/ram rw initrd=0x800000,8M earlyprintk";
29+
linux,stdout-path = &uart0;
30+
};
31+
32+
amba {
33+
compatible = "simple-bus";
34+
#address-cells = <1>;
35+
#size-cells = <1>;
36+
ranges;
37+
38+
intc: interrupt-controller@f8f01000 {
39+
interrupt-controller;
40+
compatible = "arm,gic";
41+
reg = <0xF8F01000 0x1000>;
42+
#interrupt-cells = <2>;
43+
};
44+
45+
uart0: uart@e0000000 {
46+
compatible = "xlnx,xuartps";
47+
reg = <0xE0000000 0x1000>;
48+
interrupts = <59 0>;
49+
clock = <50000000>;
50+
};
51+
};
52+
};

‎arch/arm/mach-zynq/Makefile‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#
2+
# Makefile for the linux kernel.
3+
#
4+
5+
# Common support
6+
obj-y := common.o timer.o board_dt.o

‎arch/arm/mach-zynq/Makefile.boot‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
zreladdr-y := 0x00008000
2+
params_phys-y := 0x00000100
3+
initrd_phys-y := 0x00800000

‎arch/arm/mach-zynq/board_dt.c‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* This file contains code for boards with device tree support.
3+
*
4+
* Copyright (C) 2011 Xilinx
5+
*
6+
* based on arch/arm/mach-realview/core.c
7+
*
8+
* Copyright (C) 1999 - 2003 ARM Limited
9+
* Copyright (C) 2000 Deep Blue Solutions Ltd
10+
*
11+
* This software is licensed under the terms of the GNU General Public
12+
* License version 2, as published by the Free Software Foundation, and
13+
* may be copied, distributed, and modified under those terms.
14+
*
15+
* This program is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU General Public License for more details.
19+
*/
20+
21+
#include <linux/of.h>
22+
#include <asm/mach/arch.h>
23+
#include <asm/mach-types.h>
24+
#include "common.h"
25+
26+
static const char *xilinx_dt_match[] = {
27+
"xlnx,zynq-ep107",
28+
NULL
29+
};
30+
31+
MACHINE_START(XILINX_EP107, "Xilinx Zynq Platform")
32+
.map_io = xilinx_map_io,
33+
.init_irq = xilinx_irq_init,
34+
.init_machine = xilinx_init_machine,
35+
.timer = &xttcpss_sys_timer,
36+
.dt_compat = xilinx_dt_match,
37+
MACHINE_END

‎arch/arm/mach-zynq/common.c‎

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

‎arch/arm/mach-zynq/common.h‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* This file contains common function prototypes to avoid externs
3+
* in the c files.
4+
*
5+
* Copyright (C) 2011 Xilinx
6+
*
7+
* This software is licensed under the terms of the GNU General Public
8+
* License version 2, as published by the Free Software Foundation, and
9+
* may be copied, distributed, and modified under those terms.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*/
16+
17+
#ifndef __MACH_ZYNQ_COMMON_H__
18+
#define __MACH_ZYNQ_COMMON_H__
19+
20+
#include <linux/init.h>
21+
#include <asm/mach/time.h>
22+
23+
extern void xilinx_init_machine(void);
24+
extern void xilinx_irq_init(void);
25+
extern void xilinx_map_io(void);
26+
27+
extern struct sys_timer xttcpss_sys_timer;
28+
29+
#endif
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* arch/arm/mach-zynq/include/mach/clkdev.h
3+
*
4+
* Copyright (C) 2011 Xilinx, Inc.
5+
*
6+
* This software is licensed under the terms of the GNU General Public
7+
* License version 2, as published by the Free Software Foundation, and
8+
* may be copied, distributed, and modified under those terms.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
*/
16+
17+
#ifndef __MACH_CLKDEV_H__
18+
#define __MACH_CLKDEV_H__
19+
20+
#include <plat/clock.h>
21+
22+
struct clk {
23+
unsigned long rate;
24+
const struct clk_ops *ops;
25+
const struct icst_params *params;
26+
void __iomem *vcoreg;
27+
};
28+
29+
#define __clk_get(clk) ({ 1; })
30+
#define __clk_put(clk) do { } while (0)
31+
32+
#endif

0 commit comments

Comments
 (0)