Skip to content

Commit 93794b7

Browse files
committed
boards: amd: Add support for AMD MicroBlaze V
MicroBlaze V is new AMD/Xilinx soft-core 32bit RISC-V processor IP. It is hardware compatible with classic MicroBlaze processor. The patch contains initial wiring and configuration for initial HW design with OCM(128kB) and DDR(2G) memories, cpu, interrupt controller, timers and uartlite console. Flash is not yet supported. Provided DT is describing one basic configuration which is subset of initial QEMU configuration. CPU is connected to secondary interrupt controller, timer and uartlite for communication over serial line. In soc.c there is no reason to check MULTI_LEVEL_INTERRUPTS or adding dependency on XLNX_INTC because different configuration is not supported today. ARCH_CPU_IDLE_CUSTOM is enabled because default HW design is not enabling C_USE_SLEEP configuration option. Also Wakeup pins are not connected from interrupt controller that's why wake up is not happening. This is limitation for now. Signed-off-by: Michal Simek <[email protected]> Link: zephyrproject-rtos/zephyr#80379 State: waiting
1 parent 7560056 commit 93794b7

File tree

13 files changed

+419
-0
lines changed

13 files changed

+419
-0
lines changed

boards/amd/mbv32/Kconfig.defconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#
2+
# Copyright (c) 2024 Advanced Micro Devices, Inc.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#

boards/amd/mbv32/Kconfig.mbv32

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#
2+
# Copyright (c) 2024 Advanced Micro Devices, Inc.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
config BOARD_MBV32
8+
select SOC_MBV32
9+
10+
if BOARD_MBV32
11+
config MULTI_LEVEL_INTERRUPTS
12+
default y
13+
14+
config 2ND_LEVEL_INTERRUPTS
15+
default y
16+
17+
config 2ND_LVL_INTR_00_OFFSET
18+
default 11
19+
20+
config 2ND_LVL_ISR_TBL_OFFSET
21+
default 12
22+
23+
config MAX_IRQ_PER_AGGREGATOR
24+
default 32
25+
26+
endif

boards/amd/mbv32/board.cmake

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#
2+
# Copyright (c) 2024 Advanced Micro Devices, Inc.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
set(SUPPORTED_EMU_PLATFORMS qemu)
8+
set(QEMU_ARCH riscv32)
9+
set(QEMU_CPU_TYPE_${ARCH} riscv32)
10+
11+
set(QEMU_FLAGS_${ARCH}
12+
-machine amd-microblaze-v-virt
13+
-nographic
14+
-net nic,netdev=eth0 -netdev user,id=eth0 -net nic,netdev=eth1 -netdev user,id=eth1
15+
-m 2g
16+
)
17+
18+
set(QEMU_KERNEL_OPTION
19+
-device loader,cpu-num=0,file=\$<TARGET_FILE:\${logical_target_for_zephyr_elf}>
20+
)

boards/amd/mbv32/board.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
board:
2+
name: mbv32
3+
vendor: amd
4+
socs:
5+
- name: mbv32

boards/amd/mbv32/mbv32.dts

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* dts file for AMD MicroBlaze V
4+
*
5+
* (C) Copyright 2024, Advanced Micro Devices, Inc.
6+
*
7+
* Michal Simek <[email protected]>
8+
*/
9+
10+
/dts-v1/;
11+
12+
/ {
13+
#address-cells = <1>;
14+
#size-cells = <1>;
15+
model = "AMD MicroBlaze V 32bit";
16+
compatible = "qemu,mbv", "amd,mbv";
17+
18+
cpus: cpus {
19+
#address-cells = <1>;
20+
#size-cells = <0>;
21+
timebase-frequency = <100000000>;
22+
cpu_0: cpu@0 {
23+
compatible = "amd,mbv32", "riscv";
24+
device_type = "cpu";
25+
reg = <0>;
26+
riscv,isa = "rv32imafdc";
27+
i-cache-size = <32768>;
28+
d-cache-size = <32768>;
29+
clock-frequency = <100000000>;
30+
cpu0_intc: interrupt-controller {
31+
compatible = "riscv,cpu-intc";
32+
interrupt-controller;
33+
#interrupt-cells = <1>;
34+
};
35+
};
36+
};
37+
38+
aliases {
39+
serial0 = &uart0;
40+
};
41+
42+
chosen {
43+
bootargs = "earlycon=sbi console=ttyUL0,115200";
44+
stdout-path = "serial0:115200n8";
45+
zephyr,console = &uart0;
46+
zephyr,shell-uart = &uart0;
47+
zephyr,sram = &ram0;
48+
};
49+
50+
ram0: memory@80000000 {
51+
device_type = "memory";
52+
reg = <0x80000000 0x80000000>;
53+
};
54+
55+
lmb0: memory@0 {
56+
compatible = "mmio-sram";
57+
reg = <0 0x20000>;
58+
};
59+
60+
clk100: clock {
61+
compatible = "fixed-clock";
62+
#clock-cells = <0>;
63+
clock-frequency = <100000000>;
64+
};
65+
66+
axi: soc {
67+
#address-cells = <1>;
68+
#size-cells = <1>;
69+
compatible = "simple-bus";
70+
ranges;
71+
bootph-all;
72+
73+
axi_intc: interrupt-controller@41200000 {
74+
compatible = "xlnx,xps-intc-1.00.a";
75+
reg = <0x41200000 0x1000>;
76+
interrupt-controller;
77+
interrupt-parent = <&cpu0_intc>;
78+
#interrupt-cells = <2>;
79+
interrupts-extended = <&cpu0_intc 11>;
80+
xlnx,kind-of-intr = <0x1a>;
81+
xlnx,num-intr-inputs = <11>;
82+
};
83+
84+
xlnx_timer0: timer@41c00000 {
85+
compatible = "amd,xps-timer-1.00.a";
86+
reg = <0x41c00000 0x1000>;
87+
interrupt-parent = <&axi_intc>;
88+
interrupts = <0 2>;
89+
xlnx,one-timer-only = <0>;
90+
clocks = <&clk100>;
91+
};
92+
93+
uart0: serial@40600000 {
94+
compatible = "xlnx,xps-uartlite-1.00.a";
95+
reg = <0x40600000 0x1000>;
96+
interrupt-parent = <&axi_intc>;
97+
interrupts = <1 2>;
98+
clocks = <&clk100>;
99+
current-speed = <115200>;
100+
};
101+
};
102+
};

boards/amd/mbv32/mbv32.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#
2+
# Copyright (c) 2024 Advanced Micro Devices, Inc.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
identifier: mbv32
8+
name: MBV32 softcore CPU
9+
type: mcu
10+
simulation: qemu
11+
arch: riscv
12+
toolchain:
13+
- zephyr
14+
ram: 2097152
15+
testing:
16+
ignore_tags:
17+
- bluetooth
18+
- coredump
19+
- crypto
20+
- jwt
21+
- logging
22+
- lwm2m
23+
- mcumgr
24+
- sensor
25+
- shell
26+
- smf
27+
- tinycrypt
28+
- xip
29+
- zdsp
30+
vendor: amd

boards/amd/mbv32/mbv32_defconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# Copyright (c) 2024 Advanced Micro Devices, Inc.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
CONFIG_XIP=n
8+
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=100000000
9+
CONFIG_HEAP_MEM_POOL_SIZE=4096

soc/xlnx/mbv32/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#
2+
# Copyright (c) 2024 Advanced Micro Devices, Inc.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
zephyr_sources(
8+
${ZEPHYR_BASE}/soc/common/riscv-privileged/soc_irq.S
9+
${ZEPHYR_BASE}/soc/common/riscv-privileged/vector.S
10+
soc.c
11+
)
12+
13+
zephyr_include_directories(.)
14+
15+
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "")

soc/xlnx/mbv32/Kconfig

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#
2+
# Copyright (c) 2024 Advanced Micro Devices, Inc.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
config SOC_MBV32
8+
select RISCV
9+
select ATOMIC_OPERATIONS_C
10+
select INCLUDE_RESET_VECTOR
11+
select RISCV_ISA_RV32I
12+
select RISCV_ISA_EXT_M
13+
select RISCV_ISA_EXT_A
14+
select RISCV_ISA_EXT_C
15+
select RISCV_ISA_EXT_ZICSR
16+
select RISCV_ISA_EXT_ZIFENCEI
17+
imply ARCH_CPU_IDLE_CUSTOM
18+
select CLOCK_CONTROL
19+
select CLOCK_CONTROL_FIXED_RATE_CLOCK
20+
select CONSOLE
21+
select SERIAL
22+
select UART_CONSOLE if (UART_NS16550 || UART_XLNX_UARTLITE)
23+
select UART_INTERRUPT_DRIVEN if (UART_NS16550 || UART_XLNX_UARTLITE)
24+
imply UART_NS16550 if DT_HAS_NS16550_ENABLED
25+
imply UART_XLNX_UARTLITE if DT_HAS_UARTLITE_ENABLED
26+
imply GPIO if DT_HAS_XLNX_XPS_GPIO_1_00_A_ENABLED
27+
imply GPIO_XLNX_AXI if DT_HAS_XLNX_XPS_GPIO_1_00_A_ENABLED
28+
imply AMD_TMRCTR if DT_HAS_AMD_XPS_TIMER_1_00_A_ENABLED
29+
imply XLNX_INTC if DT_HAS_XLNX_XPS_INTC_1_00_A_ENABLED
30+
select XLNX_INTC_USE_IPR if XLNX_INTC
31+
select XLNX_INTC_USE_SIE if XLNX_INTC
32+
select XLNX_INTC_USE_CIE if XLNX_INTC
33+
select XLNX_INTC_USE_IVR if XLNX_INTC

soc/xlnx/mbv32/Kconfig.defconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#
2+
# Copyright (c) 2024 Advanced Micro Devices, Inc.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
if SOC_MBV32
8+
9+
config MBV_CSR_DATA_WIDTH
10+
int "Select Control/Status register width"
11+
default 32
12+
13+
config NUM_IRQS
14+
default 44
15+
16+
endif # SOC_MBV32

0 commit comments

Comments
 (0)