Skip to content

Commit f668474

Browse files
ibirnbaumcarlescufi
authored andcommitted
soc: arm: dts: arm: xilinx: Zynq-7000 SoC init code, device tree data
Add SoC-specific code, the basic device tree and Kconfig data as well as the corresponding linker command file for the Xilinx Zynq-7000 family of SoCs. This SoC - either as a QEMU simulation or on actual hardware such as the Avnet/Digilent ZedBoard - is suitable as an ini- tial target for the ARMv7 Cortex-A support. Signed-off-by: Immo Birnbaum <[email protected]>
1 parent 315ad1d commit f668474

File tree

9 files changed

+327
-0
lines changed

9 files changed

+327
-0
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@
433433
/dts/riscv/starfive/ @rajnesh-kanwal
434434
/dts/riscv/andes_v5* @cwshu @Teng-Shih-Wei
435435
/dts/arm/armv*m.dtsi @galak @ioannisg
436+
/dts/arm/armv7-a.dtsi @ibirnbaum
436437
/dts/arm/armv7-r.dtsi @bbolen @stephanosio
437438
/dts/arm/xilinx/ @bbolen @stephanosio
438439
/dts/arm/renesas/ @julien-massot

dts/arm/armv7-a.dtsi

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (c) 2018 Lexmark International, Inc.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include "skeleton.dtsi"
8+
9+
/ {
10+
soc {
11+
#address-cells = <1>;
12+
#size-cells = <1>;
13+
compatible = "simple-bus";
14+
ranges;
15+
};
16+
};

dts/arm/xilinx/zynq7000.dtsi

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
/*
2+
* Copyright (c) 2021 Weidmueller Interface GmbH & Co. KG
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include <mem.h>
7+
#include <arm/armv7-a.dtsi>
8+
#include <dt-bindings/interrupt-controller/arm-gic.h>
9+
#include <dt-bindings/ethernet/xlnx_gem.h>
10+
11+
/ {
12+
cpus {
13+
#address-cells = <1>;
14+
#size-cells = <0>;
15+
16+
cpu@0 {
17+
device_type = "cpu";
18+
compatible = "arm,cortex-a9";
19+
reg = <0>;
20+
};
21+
};
22+
23+
soc {
24+
interrupt-parent = <&gic>;
25+
26+
ocm_low: memory@1000 {
27+
compatible = "xlnx,zynq-ocm";
28+
reg = <0x00001000 DT_SIZE_K(188)>;
29+
};
30+
31+
ocm_high: memory@fffc0000 {
32+
compatible = "xlnx,zynq-ocm";
33+
reg = <0xFFFC0000 DT_SIZE_K(256)>;
34+
};
35+
36+
arch_timer: timer@f8f00200 {
37+
compatible = "arm,armv8-timer";
38+
status = "okay";
39+
interrupt-names = "irq_0", "irq_1", "irq_2", "irq_3";
40+
interrupts = <GIC_PPI 13 IRQ_TYPE_EDGE
41+
IRQ_DEFAULT_PRIORITY>,
42+
<GIC_PPI 14 IRQ_TYPE_EDGE
43+
IRQ_DEFAULT_PRIORITY>,
44+
<GIC_PPI 11 IRQ_TYPE_EDGE
45+
IRQ_DEFAULT_PRIORITY>,
46+
<GIC_PPI 10 IRQ_TYPE_EDGE
47+
IRQ_DEFAULT_PRIORITY>;
48+
reg = <0xf8f00200 0x1C>;
49+
label = "arch_timer";
50+
};
51+
52+
gic: interrupt-controller@f8f01000 {
53+
compatible = "arm,gic";
54+
status = "okay";
55+
reg = <0xf8f01000 0x1000>,
56+
<0xf8f00100 0x100>;
57+
interrupt-controller;
58+
#interrupt-cells = <4>;
59+
label = "gic";
60+
};
61+
62+
gem0: ethernet@e000b000 {
63+
compatible = "xlnx,gem";
64+
status = "disabled";
65+
reg = <0xe000b000 0x1000>,
66+
<0xf8000140 0x4>;
67+
interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL
68+
IRQ_DEFAULT_PRIORITY>,
69+
<GIC_SPI 23 IRQ_TYPE_LEVEL
70+
IRQ_DEFAULT_PRIORITY>;
71+
interrupt-names = "irq_0", "irq_1";
72+
label = "gem0";
73+
mdio-phy-address = <XLNX_GEM_PHY_AUTO_DETECT>;
74+
phy-poll-interval = <1000>;
75+
link-speed = <XLNX_GEM_LINK_SPEED_100MBIT>;
76+
amba-ahb-dbus-width = <XLNX_GEM_AMBA_AHB_DBUS_WIDTH_32BIT>;
77+
amba-ahb-burst-length = <XLNX_GEM_AMBA_AHB_BURST_SINGLE>;
78+
hw-rx-buffer-size = <XLNX_GEM_HW_RX_BUFFER_SIZE_8KB>;
79+
hw-rx-buffer-offset = <0>;
80+
hw-tx-buffer-size-full;
81+
rx-buffer-descriptors = <32>;
82+
tx-buffer-descriptors = <32>;
83+
rx-buffer-size = <512>;
84+
tx-buffer-size = <512>;
85+
discard-rx-fcs;
86+
unicast-hash;
87+
full-duplex;
88+
};
89+
90+
gem1: ethernet@e000c000 {
91+
compatible = "xlnx,gem";
92+
status = "disabled";
93+
reg = <0xe000c000 0x1000>,
94+
<0xf8000144 0x4>;
95+
interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL
96+
IRQ_DEFAULT_PRIORITY>,
97+
<GIC_SPI 46 IRQ_TYPE_LEVEL
98+
IRQ_DEFAULT_PRIORITY>;
99+
interrupt-names = "irq_0", "irq_1";
100+
label = "gem1";
101+
mdio-phy-address = <XLNX_GEM_PHY_AUTO_DETECT>;
102+
phy-poll-interval = <1000>;
103+
link-speed = <XLNX_GEM_LINK_SPEED_100MBIT>;
104+
amba-ahb-dbus-width = <XLNX_GEM_AMBA_AHB_DBUS_WIDTH_32BIT>;
105+
amba-ahb-burst-length = <XLNX_GEM_AMBA_AHB_BURST_SINGLE>;
106+
hw-rx-buffer-size = <XLNX_GEM_HW_RX_BUFFER_SIZE_8KB>;
107+
hw-rx-buffer-offset = <0>;
108+
hw-tx-buffer-size-full;
109+
rx-buffer-descriptors = <32>;
110+
tx-buffer-descriptors = <32>;
111+
rx-buffer-size = <512>;
112+
tx-buffer-size = <512>;
113+
discard-rx-fcs;
114+
unicast-hash;
115+
full-duplex;
116+
};
117+
118+
uart0: uart@e0000000 {
119+
compatible = "xlnx,xuartps";
120+
status = "disabled";
121+
reg = <0xe0000000 0x4c>;
122+
interrupts = <GIC_SPI 27 IRQ_TYPE_LEVEL
123+
IRQ_DEFAULT_PRIORITY>;
124+
interrupt-names = "irq_0";
125+
label = "uart0";
126+
};
127+
128+
uart1: uart@e0001000 {
129+
compatible = "xlnx,xuartps";
130+
status = "disabled";
131+
reg = <0xe0001000 0x4c>;
132+
interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL
133+
IRQ_DEFAULT_PRIORITY>;
134+
interrupt-names = "irq_0";
135+
label = "uart1";
136+
};
137+
138+
};
139+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# Copyright (c) 2021 Weidmueller Interface GmbH & Co. KG
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
zephyr_sources(
8+
soc.c
9+
)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#
2+
# Copyright (c) 2021 Weidmueller Interface GmbH & Co. KG
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
6+
if SOC_XILINX_ZYNQ7000 || SOC_XILINX_ZYNQ7000S
7+
8+
config SOC
9+
default "xilinx_zynq7000"
10+
11+
config NUM_IRQS
12+
int
13+
# must be >= the highest interrupt number used
14+
default 96
15+
16+
# Workaround for not being able to have commas in macro arguments
17+
DT_CHOSEN_Z_FLASH := zephyr,flash
18+
19+
config FLASH_SIZE
20+
default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_FLASH),0,K)
21+
22+
config FLASH_BASE_ADDRESS
23+
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH))
24+
25+
endif

soc/arm/xilinx_zynq7000/Kconfig.soc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#
2+
# Copyright (c) 2021 Weidmueller Interface GmbH & Co. KG
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
6+
config SOC_SERIES_XILINX_ZYNQ7000
7+
bool "Xilinx Zynq-7000 Core Series"
8+
select ARM
9+
select CPU_CORTEX_A9
10+
select GIC_V1
11+
select ARM_ARCH_TIMER_ERRATUM_740657 if ARM_ARCH_TIMER
12+
help
13+
Enable support for the Xilinx Zynq-7000 SoC series.
14+
15+
choice
16+
prompt "Xilinx Zynq-7000 Selection"
17+
depends on SOC_SERIES_XILINX_ZYNQ7000
18+
19+
config SOC_XILINX_ZYNQ7000
20+
bool "Xilinx Zynq-7000 dual-core (XC7Zxxx)"
21+
22+
config SOC_XILINX_ZYNQ7000S
23+
bool "Xilinx Zynq-7000 single-core (XC7ZxxxS)"
24+
25+
endchoice

soc/arm/xilinx_zynq7000/linker.ld

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
* Copyright (c) 2021 Weidmueller Interface GmbH & Co. KG
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <arch/arm/aarch32/cortex_a_r/scripts/linker.ld>

soc/arm/xilinx_zynq7000/soc.c

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* Copyright (c) 2021 Weidmueller Interface GmbH & Co. KG
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include <device.h>
7+
#include <devicetree.h>
8+
#include <init.h>
9+
#include <sys/util.h>
10+
11+
#include <arch/arm/aarch32/mmu/arm_mmu.h>
12+
#include "soc.h"
13+
14+
static const struct arm_mmu_region mmu_regions[] = {
15+
16+
MMU_REGION_FLAT_ENTRY("vectors",
17+
0x00000000,
18+
0x1000,
19+
MT_STRONGLY_ORDERED | MPERM_R | MPERM_X),
20+
MMU_REGION_FLAT_ENTRY("slcr",
21+
0xF8000000,
22+
0x1000,
23+
MT_STRONGLY_ORDERED | MPERM_R | MPERM_W),
24+
MMU_REGION_FLAT_ENTRY("mpcore",
25+
0xF8F00000,
26+
0x2000,
27+
MT_STRONGLY_ORDERED | MPERM_R | MPERM_W),
28+
MMU_REGION_FLAT_ENTRY("ocm",
29+
DT_REG_ADDR(DT_CHOSEN(zephyr_ocm)),
30+
DT_REG_SIZE(DT_CHOSEN(zephyr_ocm)),
31+
MT_STRONGLY_ORDERED | MPERM_R | MPERM_W),
32+
/* ARM Arch timer, GIC are covered by the MPCore mapping */
33+
/* UARTs */
34+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart0), okay)
35+
MMU_REGION_FLAT_ENTRY("uart0",
36+
DT_REG_ADDR(DT_NODELABEL(uart0)),
37+
DT_REG_SIZE(DT_NODELABEL(uart0)),
38+
MT_DEVICE | MATTR_SHARED | MPERM_R | MPERM_W),
39+
#endif
40+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart1), okay)
41+
MMU_REGION_FLAT_ENTRY("uart1",
42+
DT_REG_ADDR(DT_NODELABEL(uart1)),
43+
DT_REG_SIZE(DT_NODELABEL(uart1)),
44+
MT_DEVICE | MATTR_SHARED | MPERM_R | MPERM_W),
45+
#endif
46+
47+
/* GEMs */
48+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(gem0), okay)
49+
MMU_REGION_FLAT_ENTRY("gem0",
50+
DT_REG_ADDR(DT_NODELABEL(gem0)),
51+
DT_REG_SIZE(DT_NODELABEL(gem0)),
52+
MT_DEVICE | MATTR_SHARED | MPERM_R | MPERM_W),
53+
#endif
54+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(gem1), okay)
55+
MMU_REGION_FLAT_ENTRY("gem1",
56+
DT_REG_ADDR(DT_NODELABEL(gem1)),
57+
DT_REG_SIZE(DT_NODELABEL(gem1)),
58+
MT_DEVICE | MATTR_SHARED | MPERM_R | MPERM_W),
59+
#endif
60+
};
61+
62+
const struct arm_mmu_config mmu_config = {
63+
.num_regions = ARRAY_SIZE(mmu_regions),
64+
.mmu_regions = mmu_regions,
65+
};
66+
67+
/**
68+
* @brief Basic hardware initialization of the Zynq-7000 SoC
69+
*
70+
* Performs the basic initialization of the Zynq-7000 SoC.
71+
*
72+
* @return 0
73+
*/
74+
static int soc_xlnx_zynq7000_init(const struct device *arg)
75+
{
76+
ARG_UNUSED(arg);
77+
NMI_INIT();
78+
79+
return 0;
80+
}
81+
82+
SYS_INIT(soc_xlnx_zynq7000_init, PRE_KERNEL_1,
83+
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
84+
85+
/* EOF */

soc/arm/xilinx_zynq7000/soc.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (c) 2021 Weidmueller Interface GmbH & Co. KG
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#ifndef _SOC__H_
7+
#define _SOC__H_
8+
9+
#ifndef _ASMLANGUAGE
10+
11+
/*
12+
* The following definitions are required for the inclusion of the CMSIS
13+
* Common Peripheral Access Layer for aarch32 Cortex-A CPUs:
14+
*/
15+
16+
#define __CORTEX_A 9U
17+
18+
#endif /* !_ASMLANGUAGE */
19+
20+
#endif /* _SOC__H_ */

0 commit comments

Comments
 (0)