From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 8/9] RISC-V: add litex-linux board support
Date: Wed, 5 May 2021 13:08:59 +0300 [thread overview]
Message-ID: <20210505100900.88141-9-antonynpavlov@gmail.com> (raw)
In-Reply-To: <20210505100900.88141-1-antonynpavlov@gmail.com>
Tested on Digilent Arty FPGA board.
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
arch/riscv/boards/Makefile | 1 +
arch/riscv/boards/litex-linux/Makefile | 3 +
arch/riscv/boards/litex-linux/lowlevel.c | 20 +++++
arch/riscv/dts/Makefile | 1 +
arch/riscv/dts/litex-linux.dts | 96 ++++++++++++++++++++++++
arch/riscv/mach-litex/Kconfig | 3 +
images/Makefile.riscv | 4 +
7 files changed, 128 insertions(+)
diff --git a/arch/riscv/boards/Makefile b/arch/riscv/boards/Makefile
index 2ce9af41e0..d477cce362 100644
--- a/arch/riscv/boards/Makefile
+++ b/arch/riscv/boards/Makefile
@@ -1,2 +1,3 @@
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_BOARD_ERIZO_GENERIC) += erizo/
+obj-$(CONFIG_BOARD_LITEX_LINUX) += litex-linux/
diff --git a/arch/riscv/boards/litex-linux/Makefile b/arch/riscv/boards/litex-linux/Makefile
new file mode 100644
index 0000000000..3d217ffe0b
--- /dev/null
+++ b/arch/riscv/boards/litex-linux/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+pbl-y += lowlevel.o
diff --git a/arch/riscv/boards/litex-linux/lowlevel.c b/arch/riscv/boards/litex-linux/lowlevel.c
new file mode 100644
index 0000000000..9ac1a3a42e
--- /dev/null
+++ b/arch/riscv/boards/litex-linux/lowlevel.c
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <common.h>
+#include <asm/barebox-riscv.h>
+#include <debug_ll.h>
+
+ENTRY_FUNCTION(start_litex_linux, a0, a1, a2)
+{
+ extern char __dtb_z_litex_linux_start[];
+ extern void __barebox_nmon_entry(void);
+
+ if (IS_ENABLED(CONFIG_NMON))
+ __barebox_nmon_entry();
+ putc_ll('>');
+
+ /* On POR, we are running from read-only memory here. */
+
+ barebox_riscv_entry(0x40000000, SZ_256M,
+ __dtb_z_litex_linux_start + get_runtime_offset());
+}
diff --git a/arch/riscv/dts/Makefile b/arch/riscv/dts/Makefile
index 4041c34e0c..dc5237b5bb 100644
--- a/arch/riscv/dts/Makefile
+++ b/arch/riscv/dts/Makefile
@@ -5,5 +5,6 @@
obj- += dummy.o
pbl-$(CONFIG_BOARD_ERIZO_GENERIC) += erizo-generic.dtb.o
+pbl-$(CONFIG_BOARD_LITEX_LINUX) += litex-linux.dtb.o
clean-files := *.dtb *.dtb.S .*.dtc .*.pre .*.dts
diff --git a/arch/riscv/dts/litex-linux.dts b/arch/riscv/dts/litex-linux.dts
new file mode 100644
index 0000000000..aa7e072305
--- /dev/null
+++ b/arch/riscv/dts/litex-linux.dts
@@ -0,0 +1,96 @@
+// 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@f0005000 {
+ compatible = "ti,74175";
+ reg = <0xf0005000 0x4>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ ld0 {
+ label = "arty:green:ld0";
+ gpios = <&ledsgpio 0 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+
+ ld1 {
+ label = "arty:green:ld1";
+ gpios = <&ledsgpio 1 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+
+ ld2 {
+ label = "arty:green:ld2";
+ gpios = <&ledsgpio 2 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+
+ ld3 {
+ label = "arty:green:ld3";
+ gpios = <&ledsgpio 3 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+ };
+
+ swgpio: gpio@f0007000 {
+ compatible = "ti,74125";
+ reg = <0xf0007000 0x4>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ };
+};
diff --git a/arch/riscv/mach-litex/Kconfig b/arch/riscv/mach-litex/Kconfig
index 19d5927e44..3ff03b0e02 100644
--- a/arch/riscv/mach-litex/Kconfig
+++ b/arch/riscv/mach-litex/Kconfig
@@ -3,6 +3,9 @@ if MACH_LITEX
choice
prompt "Board type"
+config BOARD_LITEX_LINUX
+ bool "litex linux board"
+
endchoice
endif
diff --git a/images/Makefile.riscv b/images/Makefile.riscv
index 463c6ce440..831858a54d 100644
--- a/images/Makefile.riscv
+++ b/images/Makefile.riscv
@@ -10,3 +10,7 @@ $(obj)/%.nmon: $(obj)/%.img FORCE
pblb-$(CONFIG_BOARD_ERIZO_GENERIC) += start_erizo_generic
FILE_barebox-erizo-generic.img = start_erizo_generic.pblb
image-$(CONFIG_BOARD_ERIZO_GENERIC) += barebox-erizo-generic.img barebox-erizo-generic.nmon
+
+pblb-$(CONFIG_BOARD_LITEX_LINUX) += start_litex_linux
+FILE_barebox-litex-linux.img = start_litex_linux.pblb
+image-$(CONFIG_BOARD_LITEX_LINUX) += barebox-litex-linux.img
--
2.31.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-05-05 10:11 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-05 10:08 [PATCH 0/9] RISC-V: add LiteX SoC support; resurrect nmon Antony Pavlov
2021-05-05 10:08 ` [PATCH 1/9] RISC-V: make it possible to run nmon from PBL C code Antony Pavlov
2021-05-05 10:27 ` Ahmad Fatoum
2021-05-05 10:08 ` [PATCH 2/9] RISC-V: boards: erizo: make it possible to use nmon Antony Pavlov
2021-05-05 10:28 ` Ahmad Fatoum
2021-05-05 10:08 ` [PATCH 3/9] serial: add litex UART driver Antony Pavlov
2021-05-05 10:32 ` Ahmad Fatoum
2021-05-05 10:08 ` [PATCH 4/9] gpio: add driver for 74xx-ICs with MMIO access Antony Pavlov
2021-05-05 10:35 ` Ahmad Fatoum
2021-05-05 10:08 ` [PATCH 5/9] spi: add litex spiflash driver Antony Pavlov
2021-05-05 10:39 ` Ahmad Fatoum
2021-05-05 15:10 ` Antony Pavlov
2021-05-05 10:08 ` [PATCH 6/9] net: add LiteEth driver Antony Pavlov
2021-05-06 10:10 ` Roland Hieber
2021-05-06 11:33 ` Antony Pavlov
2021-05-05 10:08 ` [PATCH 7/9] RISC-V: add initial LiteX SoC support Antony Pavlov
2021-05-05 10:16 ` Ahmad Fatoum
2021-05-05 10:45 ` Jan Lübbe
2021-05-05 15:23 ` Antony Pavlov
2021-05-05 10:08 ` Antony Pavlov [this message]
2021-05-05 10:19 ` [PATCH 8/9] RISC-V: add litex-linux board support Ahmad Fatoum
2021-05-05 10:36 ` Antony Pavlov
2021-05-05 10:09 ` [PATCH 9/9] RISC-V: add litex_linux_defconfig Antony Pavlov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210505100900.88141-9-antonynpavlov@gmail.com \
--to=antonynpavlov@gmail.com \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox