forked from barebox/barebox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
1,404 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
|
||
pbl-y += lowlevel.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
|
||
#include <common.h> | ||
#include <asm/barebox-riscv.h> | ||
#include <debug_ll.h> | ||
#include <asm/riscv_nmon.h> | ||
|
||
ENTRY_FUNCTION(start_litex_linux, a0, a1, a2) | ||
{ | ||
extern char __dtb_z_litex_linux_start[]; | ||
void *fdt; | ||
|
||
barebox_nmon_entry(); | ||
|
||
putc_ll('>'); | ||
|
||
/* On POR, we are running from read-only memory here. */ | ||
|
||
fdt = __dtb_z_litex_linux_start + get_runtime_offset(); | ||
|
||
barebox_riscv_machine_entry(0x40000000, SZ_256M, fdt); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
obj-y += board.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// SPDX-License-Identifier: GPL-2.0+ | ||
/* | ||
* Copyright (C) 2021 Ahmad Fatoum, Pengutronix | ||
*/ | ||
|
||
#include <common.h> | ||
#include <driver.h> | ||
#include <poweroff.h> | ||
#include <restart.h> | ||
#include <asm/system.h> | ||
#include <asm/barebox-riscv.h> | ||
|
||
struct riscvemu_priv { | ||
struct restart_handler rst; | ||
void __noreturn (*restart)(unsigned long, void *); | ||
|
||
}; | ||
|
||
#define HTIF_BASE_ADDR IOMEM(0x40008000) | ||
#define HTIF_TOHOST_LOW (HTIF_BASE_ADDR + 0) | ||
#define HTIF_TOHOST_HIGH (HTIF_BASE_ADDR + 4) | ||
|
||
static void __noreturn riscvemu_poweroff(struct poweroff_handler *pwr) | ||
{ | ||
writel(1, HTIF_TOHOST_LOW); | ||
writel(0, HTIF_TOHOST_HIGH); | ||
|
||
__builtin_unreachable(); | ||
} | ||
|
||
static void __noreturn riscvemu_restart(struct restart_handler *rst) | ||
{ | ||
struct riscvemu_priv *priv = container_of(rst, struct riscvemu_priv, rst); | ||
|
||
/* | ||
* barebox PBL relocates itself to end of RAM early on, so unless | ||
* something explicitly scrubbed the initial PBL, we can jump back to | ||
* the reset vector to "reset". | ||
*/ | ||
priv->restart(riscv_hartid(), barebox_riscv_boot_dtb()); | ||
} | ||
|
||
static int riscvemu_probe(struct device_d *dev) | ||
{ | ||
struct device_node *of_chosen; | ||
struct riscvemu_priv *priv; | ||
u64 start; | ||
|
||
if (of_find_compatible_node(NULL, NULL, "ucb,htif0")) | ||
poweroff_handler_register_fn(riscvemu_poweroff); | ||
|
||
of_chosen = of_find_node_by_path("/chosen"); | ||
|
||
if (of_property_read_u64(of_chosen, "riscv,kernel-start", &start)) | ||
return 0; | ||
|
||
priv = xzalloc(sizeof(*priv)); | ||
|
||
priv->restart = (void *)(uintptr_t)start; | ||
priv->rst.restart = riscvemu_restart; | ||
priv->rst.name = "vector"; | ||
|
||
return restart_handler_register(&priv->rst); | ||
} | ||
|
||
static const struct of_device_id riscvemu_of_match[] = { | ||
{ .compatible = "ucbbar,riscvemu-bar_dev" }, | ||
{ /* sentinel */ }, | ||
}; | ||
|
||
static struct driver_d riscvemu_board_driver = { | ||
.name = "board-riscvemu", | ||
.probe = riscvemu_probe, | ||
.of_compatible = riscvemu_of_match, | ||
}; | ||
device_platform_driver(riscvemu_board_driver); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
CONFIG_SOC_LITEX=y | ||
CONFIG_STACK_SIZE=0x20000 | ||
CONFIG_MALLOC_SIZE=0xf00000 | ||
CONFIG_MALLOC_TLSF=y | ||
CONFIG_PANIC_HANG=y | ||
CONFIG_BAUDRATE=1000000 | ||
CONFIG_HUSH_FANCY_PROMPT=y | ||
CONFIG_CMDLINE_EDITING=y | ||
CONFIG_AUTO_COMPLETE=y | ||
# CONFIG_TIMESTAMP is not set | ||
CONFIG_BOOTM_SHOW_TYPE=y | ||
CONFIG_BOOTM_VERBOSE=y | ||
CONFIG_BOOTM_INITRD=y | ||
CONFIG_BOOTM_OFTREE=y | ||
CONFIG_BOOTM_OFTREE_UIMAGE=y | ||
CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y | ||
CONFIG_DEBUG_LL=y | ||
CONFIG_LONGHELP=y | ||
CONFIG_CMD_IOMEM=y | ||
CONFIG_CMD_IMD=y | ||
CONFIG_CMD_MEMINFO=y | ||
CONFIG_CMD_GO=y | ||
CONFIG_CMD_LOADY=y | ||
CONFIG_CMD_EXPORT=y | ||
CONFIG_CMD_CMP=y | ||
CONFIG_CMD_MD5SUM=y | ||
CONFIG_CMD_SHA1SUM=y | ||
CONFIG_CMD_MSLEEP=y | ||
CONFIG_CMD_SLEEP=y | ||
CONFIG_CMD_DHCP=y | ||
CONFIG_CMD_MIITOOL=y | ||
CONFIG_CMD_PING=y | ||
CONFIG_CMD_TFTP=y | ||
CONFIG_CMD_ECHO_E=y | ||
CONFIG_CMD_EDIT=y | ||
CONFIG_CMD_MEMTEST=y | ||
CONFIG_CMD_MM=y | ||
CONFIG_CMD_CLK=y | ||
CONFIG_CMD_GPIO=y | ||
CONFIG_CMD_LED=y | ||
CONFIG_CMD_SPI=y | ||
CONFIG_CMD_LED_TRIGGER=y | ||
CONFIG_CMD_OF_DUMP=y | ||
CONFIG_CMD_TIME=y | ||
CONFIG_CMD_DHRYSTONE=y | ||
CONFIG_NET=y | ||
CONFIG_NET_NFS=y | ||
CONFIG_NET_NETCONSOLE=y | ||
CONFIG_DRIVER_NET_LITEETH=y | ||
CONFIG_AR8327N_PHY=y | ||
CONFIG_AT803X_PHY=y | ||
CONFIG_DAVICOM_PHY=y | ||
CONFIG_DP83867_PHY=y | ||
CONFIG_LXT_PHY=y | ||
CONFIG_MARVELL_PHY=y | ||
CONFIG_MICREL_PHY=y | ||
CONFIG_NATIONAL_PHY=y | ||
CONFIG_REALTEK_PHY=y | ||
CONFIG_SMSC_PHY=y | ||
CONFIG_DRIVER_SPI_LITEX_SPIFLASH=y | ||
CONFIG_MTD=y | ||
# CONFIG_MTD_OOB_DEVICE is not set | ||
CONFIG_MTD_M25P80=y | ||
CONFIG_CLOCKSOURCE_DUMMY_RATE=20000 | ||
CONFIG_SRAM=y | ||
CONFIG_LED=y | ||
CONFIG_LED_GPIO=y | ||
CONFIG_LED_GPIO_OF=y | ||
CONFIG_LED_TRIGGERS=y | ||
CONFIG_GPIO_74XX_MMIO=y | ||
CONFIG_GPIO_GENERIC_PLATFORM=y | ||
# CONFIG_PINCTRL is not set | ||
CONFIG_FS_TFTP=y | ||
CONFIG_FS_NFS=y | ||
CONFIG_DIGEST_CRC32_GENERIC=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
|
||
#include "litex_soc_linux.dtsi" | ||
|
||
#include <dt-bindings/gpio/gpio.h> | ||
|
||
/ { | ||
model = "LiteX VexRiscV-SoC-Linux"; | ||
compatible = "litex,vexriscv-soc-linux"; | ||
|
||
aliases { | ||
rom = &rom; | ||
sram = &sram; | ||
}; | ||
|
||
/* ARTY board */ | ||
rom: rom@00000000 { | ||
compatible = "mmio-sram"; | ||
reg = <0x00000000 0x00008000>; | ||
read-only; | ||
}; | ||
|
||
sram: sram@20000000 { | ||
compatible = "mmio-sram"; | ||
reg = <0x20000000 0x00004000>; | ||
}; | ||
|
||
main_ram: memory@40000000 { | ||
device_type = "memory"; | ||
reg = <0x40000000 0x10000000>; | ||
}; | ||
}; | ||
|
||
&uart0 { | ||
status = "okay"; | ||
}; | ||
|
||
&mac0 { | ||
status = "okay"; | ||
}; | ||
|
||
&spi0 { | ||
status = "okay"; | ||
|
||
spiflash: w25q128@0 { | ||
#address-cells = <1>; | ||
#size-cells = <1>; | ||
compatible = "winbond,w25q128", "jedec,spi-nor"; | ||
spi-max-frequency = <104000000>; | ||
reg = <0>; | ||
}; | ||
}; | ||
|
||
/ { | ||
ledsgpio: gpio@f000a800 { | ||
compatible = "ti,74175"; | ||
reg = <0xf000a800 0x4>; | ||
gpio-controller; | ||
#gpio-cells = <2>; | ||
}; | ||
|
||
leds { | ||
compatible = "gpio-leds"; | ||
|
||
ld0 { | ||
label = "arty:green:ld0"; | ||
gpios = <&ledsgpio 0 GPIO_ACTIVE_HIGH>; | ||
}; | ||
|
||
ld1 { | ||
label = "arty:green:ld1"; | ||
gpios = <&ledsgpio 1 GPIO_ACTIVE_HIGH>; | ||
}; | ||
|
||
ld2 { | ||
label = "arty:green:ld2"; | ||
gpios = <&ledsgpio 2 GPIO_ACTIVE_HIGH>; | ||
}; | ||
|
||
ld3 { | ||
label = "arty:green:ld3"; | ||
gpios = <&ledsgpio 3 GPIO_ACTIVE_HIGH>; | ||
}; | ||
}; | ||
|
||
swgpio: gpio@f0006000 { | ||
compatible = "ti,74125"; | ||
reg = <0xf0006000 0x4>; | ||
gpio-controller; | ||
#gpio-cells = <2>; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// SPDX-License-Identifier: GPL-2.0-only | ||
|
||
/dts-v1/; | ||
|
||
/ { | ||
compatible = "litex,vexriscv-soc-linux"; | ||
|
||
#address-cells = <1>; | ||
#size-cells = <1>; | ||
|
||
cpus { | ||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
|
||
timebase-frequency = <100000000>; // 100 MHz | ||
|
||
cpu@0 { | ||
device_type = "cpu"; | ||
compatible = "spinalhdl,vexriscv", "riscv"; | ||
reg = <0>; | ||
}; | ||
}; | ||
|
||
uart0: serial@f0001000 { | ||
compatible = "litex,uart"; | ||
reg = <0xf0001000 0x18>; | ||
status = "disabled"; | ||
}; | ||
|
||
mac0: mac@f0006800 { | ||
compatible = "litex,liteeth"; | ||
reg = <0xf0006800 0x7c /* base */ | ||
0xf0007000 0x0a /* mdio_base */ | ||
0xb0000000 0x2000>; /* buf_base */ | ||
tx-fifo-depth = <2>; | ||
rx-fifo-depth = <2>; | ||
status = "disabled"; | ||
}; | ||
|
||
spi0: spi@f000b800 { | ||
compatible = "litex,spiflash"; | ||
|
||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
|
||
reg = <0xf000b800 0x100>; | ||
status = "disabled"; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.