RISCV: Add Hifive unleashed platform

This change adds support for Hifive unleashed board. It also removes the
outdated hifive suport from the spike platform.
This commit is contained in:
Siwei Zhuang
2019-06-24 15:48:18 +10:00
parent efda335b8c
commit 8b4ed9941a
15 changed files with 612 additions and 108 deletions

View File

@@ -71,7 +71,8 @@ function(declare_default_headers)
)
# calculate the irq cnode size based on MAX_IRQ
if("${KernelArch}" STREQUAL "riscv")
set(MAX_IRQ "${CONFIGURE_PLIC_MAX_NUM_INT} + 2")
set(MAX_IRQ "${CONFIGURE_PLIC_MAX_NUM_INT}")
math(EXPR MAX_IRQ "${MAX_IRQ} + 2")
else()
set(MAX_IRQ "${CONFIGURE_MAX_IRQ}")
endif()
@@ -89,8 +90,8 @@ function(declare_default_headers)
# variables parsed by the above will be prepended with CONFIGURE_, so pipe them
# straight to configure_file
configure_file(
src/arch/${KernelArch}/platform_gen.h.in ${CMAKE_CURRENT_BINARY_DIR}/gen_headers/plat/platform_gen.h
@ONLY
src/arch/${KernelArch}/platform_gen.h.in
${CMAKE_CURRENT_BINARY_DIR}/gen_headers/plat/platform_gen.h @ONLY
)
include_directories(include/plat/default)
endfunction()

View File

@@ -22,17 +22,17 @@
#define STORE sw
/* Contain the typical location of memory */
#define PADDR_BASE 0x80000000lu
#define PADDR_BASE physBase
/* This represents the physical address that the kernel image will be linked to. This needs to
* be on a 1gb boundary as we currently require being able to creating a mapping to this address
* as the largest frame size */
#define PADDR_LOAD 0x84000000
#define PADDR_LOAD UL_CONST(0x84000000)
/* This is the base of the kernel window, which is directly mapped to PADDR_BASE */
#define PPTR_BASE seL4_UserTop
/* This is the mapping of the kernel (mapped above the kernel window currently) */
#define KERNEL_BASE 0xFF800000
#define KERNEL_BASE UL_CONST(0xFF800000)
#define KERNEL_ELF_BASE KERNEL_BASE
/* Start of kernel device mapping region in highest 4MiB of memory. */
#define KDEV_PPTR 0xFFC00000
#define KDEV_PPTR UL_CONST(0xFFC00000)
#endif /* __ARCH_MODE_HARDWARE_H */

View File

@@ -91,12 +91,12 @@
/* This represents the physical address that the kernel image will be linked to. This needs to
* be on a 1gb boundary as we currently require being able to creating a mapping to this address
* as the largest frame size */
#define PADDR_LOAD 0x84000000
#define PADDR_LOAD UL_CONST(physBase + 0x4000000)
/* This is the base of the kernel window, which is directly mapped to PADDR_BASE */
#define PPTR_BASE 0xFFFFFFC000000000lu
/* This is the mapping of the kernel (mapped above the kernel window currently) */
#define KERNEL_BASE 0xFFFFFFFF80000000lu
#define KERNEL_ELF_BASE 0xFFFFFFFF84000000
#define KERNEL_ELF_BASE UL_CONST(0xFFFFFFFF84000000)
/* Start of kernel device mapping region in highest 1GiB of memory. */
#define KDEV_PPTR 0xFFFFFFFFC0000000lu
#else

View File

@@ -10,6 +10,9 @@
* @TAG(DATA61_GPL)
*/
#ifndef __ARCH_MACHINE_PLIC_H
#define __ARCH_MACHINE_PLIC_H
/*
* RISC-V defines a Platform-level interrupt controller (PLIC) (priv-1.10).
* It is responsible for managing global interrupts in a RISC-V system.
@@ -63,3 +66,4 @@ static inline void plic_init_controller(void)
{
}
#endif /* __ARCH_MACHINE_PLIC_H */

View File

@@ -10,16 +10,14 @@
* @TAG(DATA61_GPL)
*/
#ifndef __PLAT_INSTANCE_HARDWARE_H
#define __PLAT_INSTANCE_HARDWARE_H
#ifndef __DRIVER_IRQ_HIFIVE_H
#define __DRIVER_IRQ_HIFIVE_H
#define PLIC_MAX_NUM_INT 53
#define IRQ_CNODE_SLOT_BITS 6
#include <plat/machine/devices_gen.h>
#define PLIC_BASE 0x0C000000
#define PLIC_PPTR_BASE 0xFFFFFFFFCC000000
#define PLIC_PPTR_BASE PLIC_PPTR + 0x0C000000
#define PLIC_HARTID 2
#define PLIC_HARTID (CONFIG_FIRST_HART_ID * 2)
#define PLIC_PRIO 0x0
#define PLIC_PRIO_PER_ID 0x4
@@ -31,6 +29,7 @@
#define PLIC_THRES_PER_HART 0x1000
#define PLIC_THRES_CLAIM 0x4
typedef uint32_t interrupt_t;
static inline uint32_t readl(const volatile uint64_t addr)
{
uint32_t val;
@@ -116,36 +115,10 @@ static inline void plic_init_controller(void)
writel(1, (PLIC_PPTR_BASE + PLIC_THRES + PLIC_THRES_PER_HART * PLIC_HARTID));
/* Set the priorities of all interrupts to 1 */
for (int i = 1; i <= PLIC_MAX_NUM_INT + 1; i++) {
for (int i = 1; i <= PLIC_MAX_IRQ + 1; i++) {
writel(2, PLIC_PPTR_BASE + PLIC_PRIO + PLIC_PRIO_PER_ID * i);
}
}
/* Available physical memory regions on platform (RAM minus kernel image). */
/* NOTE: Regions are not allowed to be adjacent! */
static p_region_t BOOT_DATA avail_p_regs[] = {
/* The first 2MB are reserved for the SBI in the BBL */
#if defined(CONFIG_ARCH_RISCV64)
{ /*.start = */ 0x80200000, /* .end = */ 0x17FF00000}
#elif defined(CONFIG_ARCH_RISCV32)
{ /*.start = */ 0x80200000, /* .end = */ 0xFD000000}
#endif
};
static const paddr_t BOOT_RODATA kernel_devices[] = {
/* Plic0 */
0x00000000,
};
static const p_region_t BOOT_RODATA dev_p_regs[] = {
{ 0x10010000, 0x10011000 }, /* UART0 */
{ 0x10011000, 0x10012000 }, /* UART1 */
{ 0x10020000, 0x10021000 }, /* PWM0 */
{ 0x10021000, 0x10022000 }, /* PWM1 */
{ 0x10060000, 0x10061000 }, /* GPIO */
{ 0x10090000, 0x10091000 }, /* ETH */
};
#endif
#endif /* __DRIVER_IRQ_HIFIVE_H */

View File

@@ -0,0 +1,20 @@
/*
* Copyright 2018, Data61
* Commonwealth Scientific and Industrial Research Organisation (CSIRO)
* ABN 41 687 119 230.
*
* This software may be distributed and modified according to the terms of
* the BSD 2-Clause license. Note that NO WARRANTY is provided.
* See "LICENSE_BSD2.txt" for details.
*
* @TAG(DATA61_BSD)
*/
#ifndef __LIBSEL4_SEL4_PLAT_API_CONSTANTS_H_
#define __LIBSEL4_SEL4_PLAT_API_CONSTANTS_H_
#ifdef HAVE_AUTOCONF
#include <autoconf.h>
#endif
#endif /* __LIBSEL4_SEL4_PLAT_API_CONSTANTS_H_ */

View File

@@ -25,8 +25,13 @@ config_choice(
RISCV_PLAT
"Select the platform for the architecture"
"spike;KernelPlatformSpike;PLAT_SPIKE;KernelArchRiscV"
"hifive;KernelPlatformHifive;PLAT_HIFIVE;KernelSel4ArchRiscV64"
)
# Include all the platforms.
include(src/plat/spike/config.cmake)
include(src/plat/hifive/config.cmake)
if(KernelArchRiscV)
config_set(KernelSel4Arch SEL4_ARCH "${KernelRiscVSel4Arch}")
endif()
@@ -37,9 +42,6 @@ elseif(KernelSel4ArchRiscV64)
set_kernel_64()
endif()
# Include all the platforms.
include(src/plat/spike/config.cmake)
config_string(
KernelPTLevels PT_LEVELS "Number of page \
table levels for RISC-V depends on the mode. For example there are: \

View File

@@ -99,6 +99,7 @@ static pte_t pte_next(word_t phys_addr, bool_t is_leaf)
BOOT_CODE void map_kernel_frame(paddr_t paddr, pptr_t vaddr, vm_rights_t vm_rights)
{
paddr = ROUND_DOWN(paddr, RISCV_GET_LVL_PGSIZE_BITS(1));
assert((paddr % RISCV_GET_LVL_PGSIZE(1)) == 0);
kernel_root_pageTable[RISCV_GET_PT_INDEX(vaddr, 1)] = pte_next(paddr, true);
}

View File

@@ -27,7 +27,7 @@
#define SEXTERNAL_IE 9
#define SEXTERNAL_CAUSE 9
#define RESET_CYCLES ((CONFIG_SPIKE_CLOCK_FREQ / MS_IN_S) * CONFIG_TIMER_TICK_MS)
#define RESET_CYCLES ((TIMER_CLOCK_HZ / MS_IN_S) * CONFIG_TIMER_TICK_MS)
#define IS_IRQ_VALID(X) (((X)) <= maxIRQ && (X)!= irqInvalid)
@@ -80,7 +80,7 @@ BOOT_CODE void map_kernel_devices(void)
return;
}
for (int i = 0; i < (sizeof(kernel_devices) / sizeof(paddr_t)); i++) {
for (int i = 0; i < (sizeof(kernel_devices) / sizeof(kernel_frame_t)); i++) {
map_kernel_frame(kernel_devices[i].paddr, KDEV_PPTR,
VMKernelOnly);
}

View File

@@ -0,0 +1,25 @@
#
# Copyright 2019, Data61
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# ABN 41 687 119 230.
#
# Copyright 2019, DornerWorks
#
# This software may be distributed and modified according to the terms of
# the GNU General Public License version 2. Note that NO WARRANTY is provided.
# See "LICENSE_GPLv2.txt" for details.
#
# @TAG(DATA61_DORNERWORKS_GPL)
#
cmake_minimum_required(VERSION 3.7.2)
if(KernelPlatformHifive)
config_set(KernelPlatform PLAT "hifive")
config_set(KernelPlatformFirstHartID FIRST_HART_ID 1)
list(APPEND KernelDTSList "tools/dts/hifive.dts")
declare_default_headers(
TIMER_FREQUENCY 10000000llu PLIC_MAX_NUM_INT 53
INTERRUPT_CONTROLLER drivers/irq/hifive.h
)
endif()

View File

@@ -16,38 +16,14 @@ cmake_minimum_required(VERSION 3.7.2)
if(KernelPlatformSpike)
config_set(KernelPlatform PLAT "spike")
config_set(KernelPlatformFirstHartID FIRST_HART_ID 0)
if(Kernel32)
list(APPEND KernelDTSList "tools/dts/spike32.dts")
else()
list(APPEND KernelDTSList "tools/dts/spike.dts")
endif()
declare_default_headers(TIMER_FREQUENCY 10000000llu PLIC_MAX_NUM_INT 2
INTERRUPT_CONTROLLER arch/machine/plic.h)
declare_default_headers(
TIMER_FREQUENCY 10000000llu PLIC_MAX_NUM_INT 0
INTERRUPT_CONTROLLER arch/machine/plic.h
)
endif()
config_choice(
KernelSpikeInstance
RISCV_SPIKE_INSTANCE
"Select the instance for Spike to run on"
"qemu;KernelPlatformSpikeQemu;BUILD_SPIKE_QEMU;KernelArchRiscV"
"rocket-chip-zedboard;KernelPlatformSpikeRocketChip;BUILD_ROCKET_CHIP_ZEDBOARD;KernelSel4ArchRiscV64"
"hi-five-unleashed;KernelPlatformSpikeSiFiveFreedom;BUILD_HI_FIVE_UNLEASHED;KernelSel4ArchRiscV64"
)
config_string(
KernelPlatformSpikeClockFrequency SPIKE_CLOCK_FREQ "Frequency of Clock used for Scheduler"
DEFAULT 10000000
UNQUOTE
)
set(DefaultFirstHartID 0)
# Include all of the different instances of the Spike platform
include(src/plat/spike/instance/rocket-chip/config.cmake)
include(src/plat/spike/instance/freedom/config.cmake)
config_string(
KernelPlatformSpikeFirstHartID FIRST_HART_ID "HART ID of the first kernel HART "
DEFAULT ${DefaultFirstHartID}
UNQUOTE
)

View File

@@ -1,14 +0,0 @@
#
# Copyright 2018, DornerWorks
#
# This software may be distributed and modified according to the terms of
# the GNU General Public License version 2. Note that NO WARRANTY is provided.
# See "LICENSE_GPLv2.txt" for details.
#
# @TAG(DORNERWORKS_GPL)
#
if(KernelPlatformSpikeSiFiveFreedom)
set(KernelPlatformSpikeClockFrequency 1000000)
set(DefaultFirstHartID 1)
endif()

View File

@@ -1,13 +0,0 @@
#
# Copyright 2018, DornerWorks
#
# This software may be distributed and modified according to the terms of
# the GNU General Public License version 2. Note that NO WARRANTY is provided.
# See "LICENSE_GPLv2.txt" for details.
#
# @TAG(DORNERWORKS_GPL)
#
if(KernelPlatformSpikeQemu)
set(KernelPlatformSpikeClockFrequency 10000000)
endif()

527
tools/dts/hifive.dts Normal file
View File

@@ -0,0 +1,527 @@
/* Copyright (c) 2018 SiFive, Inc */
/* SPDX-License-Identifier: Apache-2.0 */
/* SPDX-License-Identifier: GPL-2.0-or-later */
/* See the file LICENSE for further information */
/* @TAG(OTHER_GPL) */
/dts-v1/;
/ {
#address-cells = <0x00000002>;
#size-cells = <0x00000002>;
compatible = "sifive,fu540g", "sifive,fu500";
model = "sifive,hifive-unleashed-a00";
aliases {
serial0 = <0x2f736f63 0x2f736572 0x69616c40 0x31303031 0x30303030>;
serial1 = <0x2f736f63 0x2f736572 0x69616c40 0x31303031 0x31303030>;
};
chosen {
};
firmware {
sifive,fsbl = "2018-03-20";
};
cpus {
#address-cells = <0x00000001>;
#size-cells = <0x00000000>;
timebase-frequency = <0x000f4240>;
cpu@0 {
clock-frequency = <0x00000000>;
compatible = "sifive,rocket0", "riscv";
device_type = "cpu";
i-cache-block-size = <0x00000040>;
i-cache-sets = <0x00000080>;
i-cache-size = <0x00004000>;
next-level-cache = <0x00000001 0x00000002>;
reg = <0x00000000>;
riscv,isa = "rv64imac";
sifive,dtim = <0x00000003>;
sifive,itim = <0x00000004>;
status = "masked";
interrupt-controller {
#interrupt-cells = <0x00000001>;
compatible = "riscv,cpu-intc";
interrupt-controller;
linux,phandle = <0x0000000f>;
phandle = <0x0000000f>;
};
};
cpu@1 {
clock-frequency = <0x00000000>;
compatible = "sifive,rocket0", "riscv";
d-cache-block-size = <0x00000040>;
d-cache-sets = <0x00000040>;
d-cache-size = <0x00008000>;
d-tlb-sets = <0x00000001>;
d-tlb-size = <0x00000020>;
device_type = "cpu";
i-cache-block-size = <0x00000040>;
i-cache-sets = <0x00000040>;
i-cache-size = <0x00008000>;
i-tlb-sets = <0x00000001>;
i-tlb-size = <0x00000020>;
mmu-type = "riscv,sv39";
next-level-cache = <0x00000001 0x00000002>;
reg = <0x00000001>;
riscv,isa = "rv64imafdc";
sifive,itim = <0x00000005>;
status = "okay";
tlb-split;
interrupt-controller {
#interrupt-cells = <0x00000001>;
compatible = "riscv,cpu-intc";
interrupt-controller;
linux,phandle = <0x00000010>;
phandle = <0x00000010>;
};
};
cpu@2 {
clock-frequency = <0x00000000>;
compatible = "sifive,rocket0", "riscv";
d-cache-block-size = <0x00000040>;
d-cache-sets = <0x00000040>;
d-cache-size = <0x00008000>;
d-tlb-sets = <0x00000001>;
d-tlb-size = <0x00000020>;
device_type = "cpu";
i-cache-block-size = <0x00000040>;
i-cache-sets = <0x00000040>;
i-cache-size = <0x00008000>;
i-tlb-sets = <0x00000001>;
i-tlb-size = <0x00000020>;
mmu-type = "riscv,sv39";
next-level-cache = <0x00000001 0x00000002>;
reg = <0x00000002>;
riscv,isa = "rv64imafdc";
sifive,itim = <0x00000006>;
status = "okay";
tlb-split;
interrupt-controller {
#interrupt-cells = <0x00000001>;
compatible = "riscv,cpu-intc";
interrupt-controller;
linux,phandle = <0x00000011>;
phandle = <0x00000011>;
};
};
cpu@3 {
clock-frequency = <0x00000000>;
compatible = "sifive,rocket0", "riscv";
d-cache-block-size = <0x00000040>;
d-cache-sets = <0x00000040>;
d-cache-size = <0x00008000>;
d-tlb-sets = <0x00000001>;
d-tlb-size = <0x00000020>;
device_type = "cpu";
i-cache-block-size = <0x00000040>;
i-cache-sets = <0x00000040>;
i-cache-size = <0x00008000>;
i-tlb-sets = <0x00000001>;
i-tlb-size = <0x00000020>;
mmu-type = "riscv,sv39";
next-level-cache = <0x00000001 0x00000002>;
reg = <0x00000003>;
riscv,isa = "rv64imafdc";
sifive,itim = <0x00000007>;
status = "okay";
tlb-split;
interrupt-controller {
#interrupt-cells = <0x00000001>;
compatible = "riscv,cpu-intc";
interrupt-controller;
linux,phandle = <0x00000012>;
phandle = <0x00000012>;
};
};
cpu@4 {
clock-frequency = <0x00000000>;
compatible = "sifive,rocket0", "riscv";
d-cache-block-size = <0x00000040>;
d-cache-sets = <0x00000040>;
d-cache-size = <0x00008000>;
d-tlb-sets = <0x00000001>;
d-tlb-size = <0x00000020>;
device_type = "cpu";
i-cache-block-size = <0x00000040>;
i-cache-sets = <0x00000040>;
i-cache-size = <0x00008000>;
i-tlb-sets = <0x00000001>;
i-tlb-size = <0x00000020>;
mmu-type = "riscv,sv39";
next-level-cache = <0x00000001 0x00000002>;
reg = <0x00000004>;
riscv,isa = "rv64imafdc";
sifive,itim = <0x00000008>;
status = "okay";
tlb-split;
interrupt-controller {
#interrupt-cells = <0x00000001>;
compatible = "riscv,cpu-intc";
interrupt-controller;
linux,phandle = <0x00000013>;
phandle = <0x00000013>;
};
};
};
memory@80000000 {
device_type = "memory";
reg = <0x00000000 0x80000000 0x00000002 0x00000000>;
linux,phandle = <0x0000000e>;
phandle = <0x0000000e>;
};
soc {
#address-cells = <0x00000002>;
#size-cells = <0x00000002>;
compatible = "SiFive,FU540G-soc", "fu500-soc", "sifive-soc", "simple-bus";
ranges;
refclk {
#clock-cells = <0x00000000>;
compatible = "fixed-clock";
clock-frequency = <0x01fca055>;
clock-output-names = "xtal";
linux,phandle = <0x00000009>;
phandle = <0x00000009>;
};
prci@10000000 {
compatible = "sifive,aloeprci0";
reg = <0x00000000 0x10000000 0x00000000 0x00001000>;
reg-names = "control";
clocks = <0x00000009>;
#clock-cells = <0x00000001>;
linux,phandle = <0x0000000a>;
phandle = <0x0000000a>;
};
tlclk {
compatible = "fixed-factor-clock";
clocks = <0x0000000a 0x00000000>;
#clock-cells = <0x00000000>;
clock-div = <0x00000002>;
clock-mult = <0x00000001>;
linux,phandle = <0x00000016>;
phandle = <0x00000016>;
};
cadence-gemgxl-mgmt@100a0000 {
compatible = "sifive,cadencegemgxlmgmt0";
reg = <0x00000000 0x100a0000 0x00000000 0x00001000>;
reg-names = "control";
#clock-cells = <0x00000000>;
linux,phandle = <0x00000014>;
phandle = <0x00000014>;
};
bus-blocker@100b8000 {
compatible = "sifive,bus-blocker0";
reg = <0x00000000 0x100b8000 0x00000000 0x00001000>;
reg-names = "control";
};
cache-controller@2010000 {
cache-block-size = <0x00000040>;
cache-level = <0x00000002>;
cache-sets = <0x00000800>;
cache-size = <0x00200000>;
cache-unified;
compatible = "sifive,ccache0", "cache";
interrupt-parent = <0x0000000b>;
interrupts = <0x00000001 0x00000002 0x00000003>;
next-level-cache = <0x0000000c 0x0000000d 0x0000000e>;
reg = <0x00000000 0x02010000 0x00000000 0x00001000 0x00000000 0x08000000 0x00000000 0x02000000>;
reg-names = "control", "sideband";
linux,phandle = <0x00000002>;
phandle = <0x00000002>;
};
cadence-ddr-mgmt@100c0000 {
compatible = "sifive,cadenceddrmgmt0";
reg = <0x00000000 0x100c0000 0x00000000 0x00001000>;
reg-names = "control";
};
chiplink@40000000 {
#address-cells = <0x00000002>;
#size-cells = <0x00000002>;
compatible = "sifive,chiplink", "simple-bus";
ranges = <0x00000000 0x60000000 0x00000000 0x60000000 0x00000000 0x20000000 0x00000030 0x00000000 0x00000030 0x00000000 0x00000010 0x00000000 0x00000000 0x40000000 0x00000000 0x40000000 0x00000000 0x20000000 0x00000020 0x00000000 0x00000020 0x00000000 0x00000010 0x00000000>;
linux,phandle = <0x0000000d>;
phandle = <0x0000000d>;
};
dma@3000000 {
#dma-cells = <0x00000001>;
compatible = "riscv,dma0";
dma-channels = <0x00000004>;
dma-requests = <0x00000000>;
interrupt-parent = <0x0000000b>;
interrupts = <0x00000017 0x00000018 0x00000019 0x0000001a 0x0000001b 0x0000001c 0x0000001d 0x0000001e>;
reg = <0x00000000 0x03000000 0x00000000 0x00100000>;
reg-names = "control";
riscv,dma-pools = <0x00000001>;
};
dtim@1000000 {
compatible = "sifive,dtim0";
reg = <0x00000000 0x01000000 0x00000000 0x00002000>;
reg-names = "mem";
linux,phandle = <0x00000003>;
phandle = <0x00000003>;
};
ememoryotp@10070000 {
compatible = "sifive,ememoryotp0";
reg = <0x00000000 0x10070000 0x00000000 0x00001000>;
reg-names = "control";
};
error-device@18000000 {
compatible = "sifive,error0";
reg = <0x00000000 0x18000000 0x00000000 0x08000000>;
reg-names = "mem";
linux,phandle = <0x00000001>;
phandle = <0x00000001>;
};
ethernet@10090000 {
compatible = "cdns,macb";
interrupt-parent = <0x0000000b>;
interrupts = <0x00000035>;
reg = <0x00000000 0x10090000 0x00000000 0x00002000>;
reg-names = "control";
local-mac-address = <0x70b3d592>;
phy-mode = "gmii";
clock-names = <0x70636c6b 0x0068636c 0x6b007478 0x5f636c6b>;
clocks = <0x0000000a 0x00000001 0x0000000a 0x00000001 0x00000014>;
#address-cells = <0x00000001>;
#size-cells = <0x00000000>;
ethernet-phy@0 {
reg = <0x00000000>;
reset-gpios = <0x00000015 0x0000000c 0x00000001>;
};
};
gpio@10060000 {
compatible = "sifive,gpio0";
interrupt-parent = <0x0000000b>;
interrupts = <0x00000007 0x00000008 0x00000009 0x0000000a 0x0000000b 0x0000000c 0x0000000d 0x0000000e 0x0000000f 0x00000010 0x00000011 0x00000012 0x00000013 0x00000014 0x00000015 0x00000016>;
reg = <0x00000000 0x10060000 0x00000000 0x00001000>;
reg-names = "control";
gpio-controller;
#gpio-cells = <0x00000002>;
interrupt-controller;
#interrupt-cells = <0x00000002>;
linux,phandle = <0x00000015>;
phandle = <0x00000015>;
};
gpio-restart {
compatible = "gpio-restart";
gpios = <0x00000015 0x0000000a 0x00000001>;
};
i2c@10030000 {
compatible = "sifive,i2c0", "opencores,i2c-ocores";
reg = <0x00000000 0x10030000 0x00000000 0x00001000>;
reg-names = "control";
clocks = <0x00000016>;
reg-shift = <0x00000002>;
reg-io-width = <0x00000001>;
#address-cells = <0x00000001>;
#size-cells = <0x00000000>;
};
interrupt-controller@c000000 {
#interrupt-cells = <0x00000001>;
compatible = "riscv,plic0";
interrupt-controller;
interrupts-extended = <0x0000000f 0xffffffff 0x00000010 0xffffffff 0x00000010 0x00000009 0x00000011 0xffffffff 0x00000011 0x00000009 0x00000012 0xffffffff 0x00000012 0x00000009 0x00000013 0xffffffff 0x00000013 0x00000009>;
reg = <0x00000000 0x0c000000 0x00000000 0x04000000>;
reg-names = "control";
riscv,max-priority = <0x00000007>;
riscv,ndev = <0x00000035>;
linux,phandle = <0x0000000b>;
phandle = <0x0000000b>;
};
itim@1800000 {
compatible = "sifive,itim0";
reg = <0x00000000 0x01800000 0x00000000 0x00004000>;
reg-names = "mem";
linux,phandle = <0x00000004>;
phandle = <0x00000004>;
};
itim@1808000 {
compatible = "sifive,itim0";
reg = <0x00000000 0x01808000 0x00000000 0x00008000>;
reg-names = "mem";
linux,phandle = <0x00000005>;
phandle = <0x00000005>;
};
itim@1810000 {
compatible = "sifive,itim0";
reg = <0x00000000 0x01810000 0x00000000 0x00008000>;
reg-names = "mem";
linux,phandle = <0x00000006>;
phandle = <0x00000006>;
};
itim@1818000 {
compatible = "sifive,itim0";
reg = <0x00000000 0x01818000 0x00000000 0x00008000>;
reg-names = "mem";
linux,phandle = <0x00000007>;
phandle = <0x00000007>;
};
itim@1820000 {
compatible = "sifive,itim0";
reg = <0x00000000 0x01820000 0x00000000 0x00008000>;
reg-names = "mem";
linux,phandle = <0x00000008>;
phandle = <0x00000008>;
};
memory-controller@100b0000 {
compatible = "sifive,aloeddr0";
interrupt-parent = <0x0000000b>;
interrupts = <0x0000001f>;
reg = <0x00000000 0x100b0000 0x00000000 0x00004000>;
reg-names = "control";
};
pci@2000000000 {
#address-cells = <0x00000003>;
#interrupt-cells = <0x00000001>;
#size-cells = <0x00000002>;
compatible = "ms-pf,axi-pcie-host";
device_type = "pci";
interrupt-map = <0x00000000 0x00000000 0x00000000 0x00000001 0x00000017 0x00000001 0x00000000 0x00000000 0x00000000 0x00000002 0x00000017 0x00000002 0x00000000 0x00000000 0x00000000 0x00000003 0x00000017 0x00000003 0x00000000 0x00000000 0x00000000 0x00000004 0x00000017 0x00000004>;
interrupt-map-mask = <0x00000000 0x00000000 0x00000000 0x00000007>;
interrupt-parent = <0x0000000b>;
interrupts = <0x00000020>;
ranges = <0x02000000 0x00000000 0x40000000 0x00000000 0x40000000 0x00000000 0x20000000>;
reg = <0x00000020 0x00000000 0x00000000 0x04000000>;
reg-names = "control";
interrupt-controller {
#address-cells = <0x00000000>;
#interrupt-cells = <0x00000001>;
interrupt-controller;
linux,phandle = <0x00000017>;
phandle = <0x00000017>;
};
};
pinctrl@10080000 {
compatible = "sifive,pinctrl0";
reg = <0x00000000 0x10080000 0x00000000 0x00001000>;
reg-names = "control";
};
pwm@10020000 {
compatible = "sifive,pwm0";
interrupt-parent = <0x0000000b>;
interrupts = <0x0000002a 0x0000002b 0x0000002c 0x0000002d>;
reg = <0x00000000 0x10020000 0x00000000 0x00001000>;
reg-names = "control";
clocks = <0x00000016>;
sifive,approx-period = <0x000f4240>;
#pwm-cells = <0x00000002>;
linux,phandle = <0x00000018>;
phandle = <0x00000018>;
};
pwm@10021000 {
compatible = "sifive,pwm0";
interrupt-parent = <0x0000000b>;
interrupts = <0x0000002e 0x0000002f 0x00000030 0x00000031>;
reg = <0x00000000 0x10021000 0x00000000 0x00001000>;
reg-names = "control";
clocks = <0x00000016>;
sifive,approx-period = <0x000f4240>;
#pwm-cells = <0x00000002>;
};
pwmleds {
compatible = "pwm-leds";
heartbeat {
pwms = <0x00000018 0x00000000 0x00000000>;
max-brightness = <0x000000ff>;
linux,default-trigger = "heartbeat";
};
mtd {
pwms = <0x00000018 0x00000001 0x00000000>;
max-brightness = <0x000000ff>;
linux,default-trigger = "mtd";
};
netdev {
pwms = <0x00000018 0x00000002 0x00000000>;
max-brightness = <0x000000ff>;
linux,default-trigger = "netdev";
};
panic {
pwms = <0x00000018 0x00000003 0x00000000>;
max-brightness = <0x000000ff>;
linux,default-trigger = "panic";
};
};
rom@1000 {
compatible = "sifive,modeselect0";
reg = <0x00000000 0x00001000 0x00000000 0x00001000>;
reg-names = "mem";
};
rom@10000 {
compatible = "sifive,maskrom0";
reg = <0x00000000 0x00010000 0x00000000 0x00008000>;
reg-names = "mem";
};
rom@a000000 {
compatible = "ucbbar,cacheable-zero0";
reg = <0x00000000 0x0a000000 0x00000000 0x02000000>;
reg-names = "mem";
linux,phandle = <0x0000000c>;
phandle = <0x0000000c>;
};
serial@10010000 {
compatible = "sifive,uart0";
interrupt-parent = <0x0000000b>;
interrupts = <0x00000004>;
reg = <0x00000000 0x10010000 0x00000000 0x00001000>;
reg-names = "control";
clocks = <0x00000016>;
};
serial@10011000 {
compatible = "sifive,uart0";
interrupt-parent = <0x0000000b>;
interrupts = <0x00000005>;
reg = <0x00000000 0x10011000 0x00000000 0x00001000>;
reg-names = "control";
clocks = <0x00000016>;
};
spi@10040000 {
compatible = "sifive,spi0";
interrupt-parent = <0x0000000b>;
interrupts = <0x00000033>;
reg = <0x00000000 0x10040000 0x00000000 0x00001000 0x00000000 0x20000000 0x00000000 0x10000000>;
reg-names = "control", "mem";
clocks = <0x00000016>;
#address-cells = <0x00000001>;
#size-cells = <0x00000000>;
flash@0 {
compatible = "issi,is25wp256d", "jedec,spi-nor";
reg = <0x00000000>;
spi-max-frequency = <0x02faf080>;
m25p,fast-read;
spi-tx-bus-width = <0x00000004>;
spi-rx-bus-width = <0x00000004>;
};
};
spi@10041000 {
compatible = "sifive,spi0";
interrupt-parent = <0x0000000b>;
interrupts = <0x00000034>;
reg = <0x00000000 0x10041000 0x00000000 0x00001000 0x00000000 0x30000000 0x00000000 0x10000000>;
reg-names = "control", "mem";
clocks = <0x00000016>;
#address-cells = <0x00000001>;
#size-cells = <0x00000000>;
};
spi@10050000 {
compatible = "sifive,spi0";
interrupt-parent = <0x0000000b>;
interrupts = <0x00000006>;
reg = <0x00000000 0x10050000 0x00000000 0x00001000>;
reg-names = "control";
clocks = <0x00000016>;
#address-cells = <0x00000001>;
#size-cells = <0x00000000>;
mmc@0 {
compatible = "mmc-spi-slot";
reg = <0x00000000>;
spi-max-frequency = <0x01312d00>;
voltage-ranges = <0x00000ce4 0x00000ce4>;
disable-wp;
gpios = <0x00000015 0x0000000b 0x00000001>;
};
};
teststatus@4000 {
compatible = "sifive,test0";
reg = <0x00000000 0x00004000 0x00000000 0x00001000>;
reg-names = "control";
};
};
};

View File

@@ -906,8 +906,10 @@ def add_build_rules(devices, output):
# print result to cmake variable
print(';'.join(devices), file=output)
MEGA_PAGE_SIZE = 0x200000
def output_regions(args, devices, memory, kernel, irqs, fp):
""" generate the device list for the C header file """
memory = sorted(memory, key=lambda a: a.start)