SiFive FU540 Support
Subsystems (5)
v7 cover SiFive FU540 Support
This patchset adds SiFive Freedom Unleashed (FU540) support to RISC-V U-Boot.
The patches are based upon latest U-Boot source tree
(git://git.denx.de/u-boot.git) at commit id dbe70c7d4e3d5c705a98d82952e05a591efd0683
All drivers namely: SiFive PRCI, SiFive Serial, and Cadance MACB Ethernet work fine on actual SiFive Unleashed board and QEMU sifive_u machine.
Changes since v6:
- Rebased patches to latest U-Boot source tree
- Droped PATCH1 and PATCH2. Instead added a PATCH to select CREATE_ARCH_SYMLINK for RISC-V
- Few typo fixes in SiFive FU540 readme
Changes since v5:
- Added PATCH16 to fix INITRD passing to Linux using bootm for U-Boot RISC-V
Changes since v4:
- Removed #ifndef from macb_enable_clk() in PATCH7
- Updated test/dm/clk.c in PATCH10 to test fixed factor clock using sandbox
Changes since v3:
- Added patch to un-ignore arch/riscv/include/asm/arch
- Added patch to fix mrproper make target to only remove arch/*/include/asm/arch paths which are symlinks
- Added patch to have place-holder asm/arch/clk.h for RISC-V
- Removed "#ifndef CONFIG_RISCV" from macb clk API patch
Changes since v2:
- Fixed typo in PATCH3 comments
- Removed "#if" from clk_fixed_factor_ofdata_to_platdata() in PATCH7
- Added PATCH12 for SiFive FU540 README guide
Changes since v1:
- Re-ordered SoB in patches with multiple SoB
- Simplified board_get_usable_ram_top() added by PATCH3
Anup Patel (10):
riscv: Enable create symlink using kconfig
riscv: Rename cpu/qemu to cpu/generic
riscv: Add asm/dma-mapping.h for DMA mappings
riscv: Add place-holder asm/arch/clk.h for driver compilation
riscv: generic: Ensure that U-Boot runs within 4GB for 64bit systems
net: macb: Fix clk API usage for RISC-V systems
clk: Add SiFive FU540 PRCI clock driver
clk: Add fixed-factor clock driver
riscv: Add SiFive FU540 board support
riscv: Enable CONFIG_SYS_BOOT_RAMDISK_HIGH for using initrd
Atish Patra (5):
net: macb: Fix GEM hardware detection
drivers: serial_sifive: Fix baud rate calculation
drivers: serial_sifive: Skip baudrate config if no input clock
cpu: Bind timer driver for boot hart
doc: Add a readme guide for SiFive FU540
arch/Kconfig | 1 +
arch/riscv/Kconfig | 6 +-
arch/riscv/cpu/{qemu => generic}/Kconfig | 2 +-
arch/riscv/cpu/{qemu => generic}/Makefile | 0
arch/riscv/cpu/{qemu => generic}/cpu.c | 0
arch/riscv/cpu/generic/dram.c | 37 ++
arch/riscv/cpu/qemu/dram.c | 17 -
arch/riscv/include/asm/arch-generic/clk.h | 14 +
arch/riscv/include/asm/config.h | 1 +
arch/riscv/include/asm/dma-mapping.h | 38 ++
arch/sandbox/dts/test.dts | 8 +
board/emulation/qemu-riscv/Kconfig | 4 +-
.../qemu-riscv => sifive/fu540}/Kconfig | 36 +-
board/sifive/fu540/MAINTAINERS | 9 +
board/sifive/fu540/Makefile | 5 +
board/sifive/fu540/fu540.c | 17 +
configs/sifive_fu540_defconfig | 11 +
doc/README.sifive-fu540 | 303 +++++++++
drivers/clk/Kconfig | 1 +
drivers/clk/Makefile | 5 +-
drivers/clk/clk_fixed_factor.c | 72 +++
drivers/clk/sifive/Kconfig | 19 +
drivers/clk/sifive/Makefile | 5 +
.../clk/sifive/analogbits-wrpll-cln28hpc.h | 101 +++
drivers/clk/sifive/fu540-prci.c | 604 ++++++++++++++++++
drivers/clk/sifive/wrpll-cln28hpc.c | 390 +++++++++++
drivers/cpu/riscv_cpu.c | 7 +-
drivers/net/macb.c | 11 +-
drivers/serial/serial_sifive.c | 60 +-
include/configs/sifive-fu540.h | 43 ++
include/dt-bindings/clk/sifive-fu540-prci.h | 29 +
test/dm/clk.c | 5 +-
32 files changed, 1795 insertions(+), 66 deletions(-)
rename arch/riscv/cpu/{qemu => generic}/Kconfig (91%)
rename arch/riscv/cpu/{qemu => generic}/Makefile (100%)
rename arch/riscv/cpu/{qemu => generic}/cpu.c (100%)
create mode 100644 arch/riscv/cpu/generic/dram.c
delete mode 100644 arch/riscv/cpu/qemu/dram.c
create mode 100644 arch/riscv/include/asm/arch-generic/clk.h
create mode 100644 arch/riscv/include/asm/dma-mapping.h
copy board/{emulation/qemu-riscv => sifive/fu540}/Kconfig (57%)
create mode 100644 board/sifive/fu540/MAINTAINERS
create mode 100644 board/sifive/fu540/Makefile
create mode 100644 board/sifive/fu540/fu540.c
create mode 100644 configs/sifive_fu540_defconfig
create mode 100644 doc/README.sifive-fu540
create mode 100644 drivers/clk/clk_fixed_factor.c
create mode 100644 drivers/clk/sifive/Kconfig
create mode 100644 drivers/clk/sifive/Makefile
create mode 100644 drivers/clk/sifive/analogbits-wrpll-cln28hpc.h
create mode 100644 drivers/clk/sifive/fu540-prci.c
create mode 100644 drivers/clk/sifive/wrpll-cln28hpc.c
create mode 100644 include/configs/sifive-fu540.h
create mode 100644 include/dt-bindings/clk/sifive-fu540-prci.hSignature · 1 line
2.17.1
PATCH v7 1/15 riscv: Enable create symlink using kconfig
We select CREATE_ARCH_SYMLINK for RISC-V so that we can have include/asm/arch linked to include/asm/arch-xyz.
--- arch/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/Kconfig +1 -0
@@ -61,6 +61,7 @@ config PPC config RISCV bool "RISC-V architecture" + select CREATE_ARCH_SYMLINK select SUPPORT_OF_CONTROL select OF_CONTROL select DM
Signature · 1 line
2.17.1
PATCH v7 1/15 riscv: Enable create symlink using kconfig
Quoted 9 lines · Anup Patel
We select
CREATE_ARCH_SYMLINKfor RISC-V so that we can haveinclude/asm/archlinked toinclude/asm/arch-xyz.Signed-off-by Anup Patel <[email protected]>--- arch/Kconfig | 1 + 1 file changed, 1 insertion(+)
PATCH v7 2/15 riscv: Rename cpu/qemu to cpu/generic
In reply to Anup PatelThe QEMU CPU support under arch/riscv is pretty much generic and works fine for SiFive Unleashed as well. In fact, there will be quite a few RISC-V SOCs for which QEMU CPU support will work fine.
This patch renames cpu/qemu to cpu/generic to indicate the above fact. If there are SOC specific errata workarounds required in cpu/generic then those can be done at runtime in cpu/generic based on CPU vendor specific DT compatible string.
---
arch/riscv/Kconfig | 2 +-
arch/riscv/cpu/{qemu => generic}/Kconfig | 2 +-
arch/riscv/cpu/{qemu => generic}/Makefile | 0
arch/riscv/cpu/{qemu => generic}/cpu.c | 0
arch/riscv/cpu/{qemu => generic}/dram.c | 0
board/emulation/qemu-riscv/Kconfig | 4 ++--
6 files changed, 4 insertions(+), 4 deletions(-)
rename arch/riscv/cpu/{qemu => generic}/Kconfig (91%)
rename arch/riscv/cpu/{qemu => generic}/Makefile (100%)
rename arch/riscv/cpu/{qemu => generic}/cpu.c (100%)
rename arch/riscv/cpu/{qemu => generic}/dram.c (100%)arch/riscv/Kconfig +1 -1
@@ -22,7 +22,7 @@ source "board/emulation/qemu-riscv/Kconfig" # platform-specific options below source "arch/riscv/cpu/ax25/Kconfig" -source "arch/riscv/cpu/qemu/Kconfig" +source "arch/riscv/cpu/generic/Kconfig" # architecture-specific options below
arch/riscv/cpu/generic/Kconfig renamed from arch/riscv/cpu/qemu/Kconfig +1 -1
@@ -2,7 +2,7 @@ # # Copyright (C) 2018, Bin Meng <[email protected]> -config QEMU_RISCV +config GENERIC_RISCV bool select ARCH_EARLY_INIT_R imply CPU
arch/riscv/cpu/generic/Makefile renamed from arch/riscv/cpu/qemu/Makefile +0 -0
arch/riscv/cpu/generic/cpu.c renamed from arch/riscv/cpu/qemu/cpu.c +0 -0
arch/riscv/cpu/generic/dram.c renamed from arch/riscv/cpu/qemu/dram.c +0 -0
board/emulation/qemu-riscv/Kconfig +2 -2
@@ -7,7 +7,7 @@ config SYS_VENDOR default "emulation" config SYS_CPU - default "qemu" + default "generic" config SYS_CONFIG_NAME default "qemu-riscv"
@@ -18,7 +18,7 @@ config SYS_TEXT_BASE config BOARD_SPECIFIC_OPTIONS # dummy def_bool y - select QEMU_RISCV + select GENERIC_RISCV imply SYS_NS16550 imply VIRTIO_MMIO imply VIRTIO_NET
Signature · 1 line
2.17.1
PATCH v7 3/15 riscv: Add asm/dma-mapping.h for DMA mappings
In reply to Anup PatelThis patch adds asm/dma-mapping.h for Linux-like DMA mappings APIs required by some of the drivers (such as, Cadance MACB Ethernet driver).
--- arch/riscv/include/asm/dma-mapping.h | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 arch/riscv/include/asm/dma-mapping.h
arch/riscv/include/asm/dma-mapping.h new file +38 -0
@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (c) 2018 Western Digital Corporation or its affiliates. +* +* Authors: +* Anup Patel <[email protected]> +*/ + +#ifndef __ASM_RISCV_DMA_MAPPING_H +#define __ASM_RISCV_DMA_MAPPING_H + +#include <linux/dma-direction.h> + +#define dma_mapping_error (x, y) 0 + +static inline void *dma_alloc_coherent (size_t len,unsigned long *handle) +{ + *handle = (unsigned long )memalign (ARCH_DMA_MINALIGN , len); +return (void *)*handle; +} + +static inline void dma_free_coherent (void *addr) +{ +free (addr); +} + +static inline unsigned long dma_map_single (volatile void *vaddr,size_t len, +enum dma_data_direction dir) +{ +return (unsigned long )vaddr; +} + +static inline void dma_unmap_single (volatile void *vaddr,size_t len, +unsigned long paddr) +{ +} + +#endif /* __ASM_RISCV_DMA_MAPPING_H */
Signature · 1 line
2.17.1
PATCH v7 4/15 riscv: Add place-holder asm/arch/clk.h for driver compilation
In reply to Anup PatelSome of the drivers (such as Cadence MACB ethernet driver) expect asm/arch/clk.h to be provided by arch support so we add place-holder asm/arch-generic/clk.h for RISC-V generic CPU.
--- arch/riscv/include/asm/arch-generic/clk.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 arch/riscv/include/asm/arch-generic/clk.h
arch/riscv/include/asm/arch-generic/clk.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (c) 2019 Western Digital Corporation or its affiliates. +* +* Authors: +* Anup Patel <[email protected]> +*/ + +#ifndef __ASM_RISCV_ARCH_CLK_H +#define __ASM_RISCV_ARCH_CLK_H + +/* Note: This is a placeholder header for driver compilation. */ + +#endif
Signature · 1 line
2.17.1
PATCH v7 4/15 riscv: Add place-holder asm/arch/clk.h for driver compilation
Quoted 5 lines · Anup Patel
Some of the drivers (such as Cadence MACB ethernet driver) expect
asm/arch/clk.hto be provided by arch support so we add place-holderasm/arch-generic/clk.hfor RISC-V generic CPU.
Quoted 7 lines
Signed-off-by Anup Patel <[email protected]>Reviewed-by Lukas Auer <[email protected]>--- arch/riscv/include/asm/arch-generic/clk.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 arch/riscv/include/asm/arch-generic/clk.h
PATCH v7 5/15 riscv: generic: Ensure that U-Boot runs within 4GB for 64bit systems
In reply to Anup PatelOn 64bit systems, the DRAM top can be easily beyond 4GB and U-Boot DMA mapping APIs will generate DMA addresses beyond 4GB. This breaks DMA programming in 32bit DMA capable devices (such as Cadence MACB ethernet). For example, If DRAM is more then 2GB on QEMU sifive_u machine then Cadence MACB ethernet stops working for U-Boot because it is a 32bit DMA capable device.
To handle 32bit DMA capable devices on 64bit systems, we provide custom implementation of board_get_usable_ram_top() which ensures that usable ram top is not more then 4GB. This in-turn ensures that U-Boot always runs within 4GB hence DMA addresses generated by DMA mapping APIs will be within 4GB too.
--- arch/riscv/cpu/generic/dram.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
arch/riscv/cpu/generic/dram.c +20 -0
@@ -5,6 +5,9 @@#include <common.h> #include <fdtdec.h> +#include <linux/sizes.h> + +DECLARE_GLOBAL_DATA_PTR ;int dram_init (void ) {
@@ -15,3 +18,20 @@ int dram_init_banksize(void) {return fdtdec_setup_memory_banksize (); } + +ulong board_get_usable_ram_top (ulong total_size) +{ +#ifdef CONFIG_64BIT +/* +* Ensure that we run from first 4GB so that all +* addresses used by U-Boot are 32bit addresses. +* +* This in-turn ensures that 32bit DMA capable +* devices work fine because DMA mapping APIs will +* provide 32bit DMA addresses only. +*/ +if (gd->ram_top >SZ_4G ) +return SZ_4G ; +#endif +return gd->ram_top; +}
Signature · 1 line
2.17.1
PATCH v7 6/15 net: macb: Fix clk API usage for RISC-V systems
In reply to Anup PatelDon't fail in macb_enable_clk() if clk_enable() returns -ENOSYS because we get -ENOSYS for fixed-rate clocks.
--- drivers/net/macb.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/macb.c +4 -5
@@ -1061,14 +1061,13 @@ static int macb_enable_clk(struct udevice *dev)return -EINVAL ;/* -* Zynq clock driver didn't support for enable or disable -* clock. Hence, clk_enable() didn't apply for Zynq +* If clock driver didn't support enable or disable then +* we get -ENOSYS from clk_enable(). To handle this, we +* don't fail for ret == -ENOSYS. */ -#ifndef CONFIG_MACB_ZYNQ ret =clk_enable (&clk); -if (ret) +if (ret && ret != -ENOSYS )return ret; -#endif clk_rate =clk_get_rate (&clk);if (!clk_rate)
Signature · 1 line
2.17.1
PATCH v7 7/15 net: macb: Fix GEM hardware detection
In reply to Anup PatelFrom: Atish Patra <[email protected]>
Fix MID bit field check to correctly identify all GEM hardwares.
The check is updated as per macb driver in Linux location:
<linux_sources>/drivers/net/ethernet/cadence/macb_main.c:259
--- drivers/net/macb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/macb.c +1 -1
@@ -143,7 +143,7 @@ struct macb_device {static int macb_is_gem (struct macb_device *macb) { -return MACB_BFEXT (IDNUM ,macb_readl (macb,MID )) ==0x2 ; +return MACB_BFEXT (IDNUM ,macb_readl (macb,MID )) >=0x2 ; }#ifndef cpu_is_sama5d2
Signature · 1 line
2.17.1
PATCH v7 8/15 clk: Add SiFive FU540 PRCI clock driver
In reply to Anup PatelAdd driver code for the SiFive FU540 PRCI IP block. This IP block handles reset and clock control for the SiFive FU540 device and implements SoC-level clock tree controls and dividers.
Based on code written by Wesley Terpstra <[email protected]> found in commit 999529edf517ed75b56659d456d221b2ee56bb60 of:
https://github.com/riscv/riscv-linux
Boot and PLL rate change were tested on a SiFive HiFive Unleashed board.
--- drivers/clk/Kconfig | 1 + drivers/clk/Makefile | 1 + drivers/clk/sifive/Kconfig | 19 + drivers/clk/sifive/Makefile | 5 + .../clk/sifive/analogbits-wrpll-cln28hpc.h | 101 +++ drivers/clk/sifive/fu540-prci.c | 604 ++++++++++++++++++ drivers/clk/sifive/wrpll-cln28hpc.c | 390 +++++++++++ include/dt-bindings/clk/sifive-fu540-prci.h | 29 + 8 files changed, 1150 insertions(+) create mode 100644 drivers/clk/sifive/Kconfig create mode 100644 drivers/clk/sifive/Makefile create mode 100644 drivers/clk/sifive/analogbits-wrpll-cln28hpc.h create mode 100644 drivers/clk/sifive/fu540-prci.c create mode 100644 drivers/clk/sifive/wrpll-cln28hpc.c create mode 100644 include/dt-bindings/clk/sifive-fu540-prci.h
drivers/clk/Kconfig +1 -0
@@ -105,6 +105,7 @@ source "drivers/clk/mvebu/Kconfig" source "drivers/clk/owl/Kconfig" source "drivers/clk/renesas/Kconfig" source "drivers/clk/sunxi/Kconfig" +source "drivers/clk/sifive/Kconfig" source "drivers/clk/tegra/Kconfig" source "drivers/clk/uniphier/Kconfig"
drivers/clk/Makefile +1 -0
@@ -22,6 +22,7 @@ obj-$(CONFIG_CLK_HSDK) += clk-hsdk-cgu.o obj-$(CONFIG_CLK_MPC83XX) += mpc83xx_clk.o obj-$(CONFIG_CLK_OWL) += owl/ obj-$(CONFIG_CLK_RENESAS) += renesas/ +obj-$(CONFIG_CLK_SIFIVE) += sifive/ obj-$(CONFIG_ARCH_SUNXI) += sunxi/ obj-$(CONFIG_CLK_STM32F) += clk_stm32f.o obj-$(CONFIG_CLK_STM32MP1) += clk_stm32mp1.o
drivers/clk/sifive/Kconfig new file +19 -0
@@ -0,0 +1,19 @@ +# SPDX-License-Identifier: GPL-2.0 + +config CLK_ANALOGBITS_WRPLL_CLN28HPC + bool + +config CLK_SIFIVE + bool "SiFive SoC driver support" + depends on CLK + help + SoC drivers for SiFive Linux-capable SoCs. + +config CLK_SIFIVE_FU540_PRCI + bool "PRCI driver for SiFive FU540 SoCs" + depends on CLK_SIFIVE + select CLK_ANALOGBITS_WRPLL_CLN28HPC + help + Supports the Power Reset Clock interface (PRCI) IP block found in + FU540 SoCs. If this kernel is meant to run on a SiFive FU540 SoC, + enable this driver.
drivers/clk/sifive/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-$(CONFIG_CLK_ANALOGBITS_WRPLL_CLN28HPC) += wrpll-cln28hpc.o + +obj-$(CONFIG_CLK_SIFIVE_FU540_PRCI) += fu540-prci.o
drivers/clk/sifive/analogbits-wrpll-cln28hpc.h new file +101 -0
101 lines not on this page · raw message
drivers/clk/sifive/fu540-prci.c new file +604 -0
604 lines not on this page · raw message
drivers/clk/sifive/wrpll-cln28hpc.c new file +390 -0
390 lines not on this page · raw message
include/dt-bindings/clk/sifive-fu540-prci.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) 2019 Western Digital Corporation or its affiliates. +* +* Copyright (C) 2018 SiFive, Inc. +* Wesley Terpstra +* Paul Walmsley +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef __LINUX_CLK_SIFIVE_FU540_PRCI_H +#define __LINUX_CLK_SIFIVE_FU540_PRCI_H + +/* Clock indexes for use by Device Tree data */ + +#define PRCI_CLK_COREPLL 0 +#define PRCI_CLK_DDRPLL 1 +#define PRCI_CLK_GEMGXLPLL 2 +#define PRCI_CLK_TLCLK 3 + +#endif
Signature · 1 line
2.17.1
PATCH v7 9/15 clk: Add fixed-factor clock driver
In reply to Anup PatelThis patch adds fixed-factor clock driver which derives clock rate by dividing (div) and multiplying (mult) fixed factors to a parent clock.
--- arch/sandbox/dts/test.dts | 8 ++++ drivers/clk/Makefile | 4 +- drivers/clk/clk_fixed_factor.c | 72 ++++++++++++++++++++++++++++++++++ test/dm/clk.c | 5 ++- 4 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 drivers/clk/clk_fixed_factor.c
arch/sandbox/dts/test.dts +8 -0
@@ -203,6 +203,14 @@ #clock-cells = <0>; clock-frequency = <1234>; }; + + clk_fixed_factor: clk-fixed-factor { + compatible = "fixed-factor-clock"; + #clock-cells = <0>; + clock-div = <3>; + clock-mult = <2>; + clocks = <&clk_fixed>; + }; }; clk_sandbox: clk-sbox {
drivers/clk/Makefile +3 -1
@@ -4,7 +4,9 @@ # Wolfgang Denk, DENX Software Engineering, wd at denx.de. # -obj-$(CONFIG_$(SPL_TPL_)CLK) += clk-uclass.o clk_fixed_rate.o +obj-$(CONFIG_$(SPL_TPL_)CLK) += clk-uclass.o +obj-$(CONFIG_$(SPL_TPL_)CLK) += clk_fixed_rate.o +obj-$(CONFIG_$(SPL_TPL_)CLK) += clk_fixed_factor.o obj-y += imx/ obj-y += tegra/
drivers/clk/clk_fixed_factor.c new file +72 -0
72 lines not on this page · raw message
test/dm/clk.c +4 -1
@@ -12,12 +12,15 @@static int dm_test_clk (struct unit_test_state *uts) { -struct udevice *dev_fixed, *dev_clk, *dev_test; +struct udevice *dev_fixed, *dev_fixed_factor, *dev_clk, *dev_test;ulong rate;ut_assertok (uclass_get_device_by_name (UCLASS_CLK ,"clk-fixed" , &dev_fixed)); +ut_assertok (uclass_get_device_by_name (UCLASS_CLK ,"clk-fixed-factor" , + &dev_fixed_factor)); +ut_assertok (uclass_get_device_by_name (UCLASS_CLK ,"clk-sbox" , &dev_clk));ut_asserteq (0 ,sandbox_clk_query_enable (dev_clk,SANDBOX_CLK_ID_SPI ));
Signature · 1 line
2.17.1
PATCH v7 10/15 drivers: serial_sifive: Fix baud rate calculation
In reply to Anup PatelFrom: Atish Patra <[email protected]>
Compute the baud rate multipler with more precision.
--- drivers/serial/serial_sifive.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)
drivers/serial/serial_sifive.c +26 -2
@@ -33,16 +33,40 @@ struct uart_sifive { };struct sifive_uart_platdata { -unsigned int clock; +unsigned long clock;int saved_input_char;struct uart_sifive *regs; }; +/** +* Find minimum divisor divides in_freq to max_target_hz; +* Based on uart driver n SiFive FSBL. +* +* f_baud = f_in / (div + 1) => div = (f_in / f_baud) - 1 +* The nearest integer solution requires rounding up as to not exceed +* max_target_hz. +* div = ceil(f_in / f_baud) - 1 +* = floor((f_in - 1 + f_baud) / f_baud) - 1 +* This should not overflow as long as (f_in - 1 + f_baud) does not exceed +* 2^32 - 1, which is unlikely since we represent frequencies in kHz. +*/ +static inline unsigned int uart_min_clk_divisor (unsigned long in_freq, +unsigned long max_target_hz) +{ +unsigned long quotient = + (in_freq + max_target_hz -1 ) / (max_target_hz); +/* Avoid underflow */ +if (quotient ==0 ) +return 0 ; +else +return quotient -1 ; +} +/* Set up the baud rate in gd struct */ static void _sifive_serial_setbrg (struct uart_sifive *regs,unsigned long clock,unsigned long baud) { -writel ((u32)((clock / baud) -1 ), ®s->div); +writel ((uart_min_clk_divisor (clock, baud)), ®s->div); }static void _sifive_serial_init (struct uart_sifive *regs)
Signature · 1 line
2.17.1
PATCH v7 11/15 drivers: serial_sifive: Skip baudrate config if no input clock
In reply to Anup PatelFrom: Atish Patra <[email protected]>
It is possible that input clock is not available because clk device was not available and 'clock-frequency' DT property is also not available.
In this case, instead of failing we should just skip baudrate config by returning zero.
--- drivers/serial/serial_sifive.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/serial/serial_sifive.c +16 -16
@@ -99,27 +99,27 @@ static int _sifive_serial_getc(struct uart_sifive *regs)static int sifive_serial_setbrg (struct udevice *dev,int baudrate) { -int err; +int ret;struct clk clk;struct sifive_uart_platdata *platdata =dev_get_platdata (dev); +u32 clock =0 ; - err =clk_get_by_index (dev,0 , &clk); -if (!err) { - err =clk_get_rate (&clk); -if (!IS_ERR_VALUE (err)) - platdata->clock = err; - }else if (err != -ENOENT && err != -ENODEV && err != -ENOSYS ) { + ret =clk_get_by_index (dev,0 , &clk); +if (IS_ERR_VALUE (ret)) {debug ("SiFive UART failed to get clock\n" ); -return err; - } - -if (!platdata->clock) - platdata->clock =dev_read_u32_default (dev,"clock-frequency" ,0 ); -if (!platdata->clock) { -debug ("SiFive UART clock not defined\n" ); -return -EINVAL ; + ret =dev_read_u32 (dev,"clock-frequency" , &clock); +if (IS_ERR_VALUE (ret)) { +debug ("SiFive UART clock not defined\n" ); +return 0 ; + } + }else { + clock =clk_get_rate (&clk); +if (IS_ERR_VALUE (clock)) { +debug ("SiFive UART clock get rate failed\n" ); +return 0 ; + } } - + platdata->clock = clock;_sifive_serial_setbrg (platdata->regs, platdata->clock, baudrate);return 0 ;
Signature · 1 line
2.17.1
PATCH v7 12/15 cpu: Bind timer driver for boot hart
In reply to Anup PatelFrom: Atish Patra <[email protected]>
Currently, timer driver is bound only for hart0.
There is no mandatory requirement that hart0 should always come up. In fact, HiFive Unleashed SoC hart0 doesn't boot in S-mode because it only has M-mode.
The timer driver should be bound for boot hart.
--- drivers/cpu/riscv_cpu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/cpu/riscv_cpu.c +4 -3
@@ -10,6 +10,8 @@#include <dm/device-internal.h> #include <dm/lists.h> +DECLARE_GLOBAL_DATA_PTR ; +static int riscv_cpu_get_desc (struct udevice *dev,char *buf,int size) {const char *isa;
@@ -62,7 +64,6 @@ static int riscv_cpu_bind(struct udevice *dev)/* save the hart id */ plat->cpu_id =dev_read_addr (dev); -/* first examine the property in current cpu node */ ret =dev_read_u32 (dev,"timebase-frequency" , &plat->timebase_freq);/* if not found, then look at the parent /cpus node */
@@ -71,7 +72,7 @@ static int riscv_cpu_bind(struct udevice *dev) &plat->timebase_freq);/* -* Bind riscv-timer driver on hart 0 +* Bind riscv-timer driver on boot hart. * * We only instantiate one timer device which is enough for U-Boot. * Pass the "timebase-frequency" value as the driver data for the
@@ -80,7 +81,7 @@ static int riscv_cpu_bind(struct udevice *dev)* Return value is not checked since it's possible that the timer * driver is not included. */ -if (!plat->cpu_id && plat->timebase_freq) { +if (plat->cpu_id == gd->arch.boot_hart && plat->timebase_freq) { drv =lists_driver_lookup_name ("riscv_timer" );if (!drv) {debug ("Cannot find the timer driver, not included?\n" );
Signature · 1 line
2.17.1
PATCH v7 13/15 riscv: Add SiFive FU540 board support
In reply to Anup PatelThis patch adds SiFive FU540 board support. For now, only SiFive serial, SiFive PRCI, and Cadance MACB drivers are only enabled. The SiFive FU540 defconfig by default builds U-Boot for S-Mode because U-Boot on SiFive FU540 will run in S-Mode as payload of BBL or OpenSBI.
--- arch/riscv/Kconfig | 4 ++++ board/sifive/fu540/Kconfig | 42 +++++++++++++++++++++++++++++++++ board/sifive/fu540/MAINTAINERS | 9 +++++++ board/sifive/fu540/Makefile | 5 ++++ board/sifive/fu540/fu540.c | 17 ++++++++++++++ configs/sifive_fu540_defconfig | 11 +++++++++ include/configs/sifive-fu540.h | 43 ++++++++++++++++++++++++++++++++++ 7 files changed, 131 insertions(+) create mode 100644 board/sifive/fu540/Kconfig create mode 100644 board/sifive/fu540/MAINTAINERS create mode 100644 board/sifive/fu540/Makefile create mode 100644 board/sifive/fu540/fu540.c create mode 100644 configs/sifive_fu540_defconfig create mode 100644 include/configs/sifive-fu540.h
arch/riscv/Kconfig +4 -0
@@ -14,11 +14,15 @@ config TARGET_AX25_AE350 config TARGET_QEMU_VIRT bool "Support QEMU Virt Board" +config TARGET_SIFIVE_FU540 + bool "Support SiFive FU540 Board" + endchoice # board-specific options below source "board/AndesTech/ax25-ae350/Kconfig" source "board/emulation/qemu-riscv/Kconfig" +source "board/sifive/fu540/Kconfig" # platform-specific options below source "arch/riscv/cpu/ax25/Kconfig"
board/sifive/fu540/Kconfig new file +42 -0
42 lines not on this page · raw message
board/sifive/fu540/MAINTAINERS new file +9 -0
@@ -0,0 +1,9 @@ +SiFive FU540 BOARD +M: Paul Walmsley <[email protected]> +M: Palmer Dabbelt <[email protected]> +M: Anup Patel <[email protected]> +M: Atish Patra <[email protected]> +S: Maintained +F: board/sifive/fu540/ +F: include/configs/sifive-fu540.h +F: configs/sifive_fu540_defconfig
board/sifive/fu540/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (c) 2019 Western Digital Corporation or its affiliates. + +obj-y += fu540.o
board/sifive/fu540/fu540.c new file +17 -0
@@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (c) 2019 Western Digital Corporation or its affiliates. +* +* Authors: +* Anup Patel <[email protected]> +*/ + +#include <common.h> +#include <dm.h> + +int board_init (void ) +{ +/* For now nothing to do here. */ + +return 0 ; +}
configs/sifive_fu540_defconfig new file +11 -0
@@ -0,0 +1,11 @@ +CONFIG_RISCV=y +CONFIG_TARGET_SIFIVE_FU540=y +CONFIG_RISCV_SMODE=y +CONFIG_ARCH_RV64I=y +CONFIG_DISTRO_DEFAULTS=y +CONFIG_NR_DRAM_BANKS=1 +CONFIG_FIT=y +CONFIG_DISPLAY_CPUINFO=y +CONFIG_DISPLAY_BOARDINFO=y +CONFIG_CMD_MII=y +CONFIG_OF_PRIOR_STAGE=y
include/configs/sifive-fu540.h new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v7 14/15 doc: Add a readme guide for SiFive FU540
In reply to Anup PatelFrom: Atish Patra <[email protected]>
The readme guide describes the procedure to build, flash and boot Linux using U-Boot on HiFive Unleashed. It also explains the current state of U-boot support and future action items.
--- doc/README.sifive-fu540 | 303 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 303 insertions(+) create mode 100644 doc/README.sifive-fu540
doc/README.sifive-fu540 new file +303 -0
@@ -0,0 +1,303 @@ +FU540-C000 RISC-V SoC +===================== +The FU540-C000 is the world’s first 4+1 64-bit RISC‑V SoC from SiFive. + +The HiFive Unleashed development platform is based on FU540-C000 and capable +of running Linux. + +Mainline support +================ +The support for following drivers are already enabled: +1. SiFive UART Driver. +2. SiFive PRCI Driver for clock. +3. Cadence MACB ethernet driver for networking support. + +TODO: +1. SPI driver is still missing. So MMC card can't be used in U-Boot as of now. +2. U-Boot expects the serial console device entry to be present under /chosen + DT node. Example: + chosen { + stdout-path = "/soc/serial at 10010000:115200"; + }; + + Without a serial console U-Boot will panic. + +Building +======== +1. Add the RISC-V toolchain to your PATH. +2. Setup ARCH & cross compilation enviornment variable. + a. export ARCH=riscv + b. export CROSS_COMPILE=<riscv64 toolchain prefix> +3. make sifive_fu540_defconfig +4. make + +Flashing +======== +The current U-Boot port is supported in S-mode only and loaded from DRAM. + +A prior stage (M-mode) firmware/bootloader (e.g OpenSBI or BBL) is required to +load the u-boot.bin into memory and provide runtime services. The u-boot.bin +can be given as a payload to the prior stage (M-mode) firmware/bootloader. + +The description of steps required to build the firmware is beyond the scope of +this document. Please refer OpenSBI or BBL documenation. +(Note: OpenSBI git repo is at https://github.com/riscv/opensbi.git) +(Note: BBL git repo is at https://github.com/riscv/riscv-pk.git) + +Once the prior stage firmware/bootloader binary is generated, it should be +copied to the first partition of the sdcard. + +sudo dd if=<prior_stage_firmware_binary> of=/dev/disk2s1 bs=1024 + +Booting +======= +Once you plugin the sdcard and power up, you should see the U-Boot prompt. + +Sample boot log from HiFive Unleashed board +=========================================== +U-Boot 2019.01-00019-gc7953536-dirty (Jan 22 2019 - 11:05:40 -0800) + +CPU: rv64imafdc +Model: sifive,hifive-unleashed-a00 +DRAM: 8 GiB +In: serial at 10010000 +Out: serial at 10010000 +Err: serial at 10010000 +Net: +Warning: ethernet at 10090000 (eth0) using random MAC address - b6:75:4d:48:50:94 +eth0: ethernet at 10090000 +Hit any key to stop autoboot: 0 +=> version +U-Boot 2019.01-00019-gc7953536-dirty (Jan 22 2019 - 11:05:40 -0800) + +riscv64-linux-gcc.br_real (Buildroot 2018.11-rc2-00003-ga0787e9) 8.2.0 +GNU ld (GNU Binutils) 2.31.1 +=> +=============================================================================== + +Now you can configure your networking, tftp server and use tftp boot method to +load uImage. + +========================================================================== +=> setenv ethaddr 70:B3:D5:92:F0:C2 +=> setenv ipaddr 10.196.157.189 +=> setenv serverip 10.11.143.218 +=> setenv gatewayip 10.196.156.1 +=> setenv netmask 255.255.252.0 +=> bdinfo +boot_params = 0x0000000000000000 +DRAM bank = 0x0000000000000000 +-> start = 0x0000000080000000 +-> size = 0x0000000200000000 +relocaddr = 0x00000000fff90000 +reloc off = 0x000000007fd90000 +ethaddr = 70:B3:D5:92:F0:C2 +IP addr = 10.196.157.189 +baudrate = 115200 bps +=> tftpboot uImage +ethernet at 10090000: PHY present at 0 +ethernet at 10090000: Starting autonegotiation... +ethernet at 10090000: Autonegotiation complete +ethernet at 10090000: link up, 1000Mbps full-duplex (lpa: 0x3800) +Using ethernet at 10090000 device +TFTP from server 10.11.143.218; our IP address is 10.196.157.189; sending through gateway 10.196.156.1 +Filename 'uImage'. +Load address: 0x80200000 +Loading: ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ########################################################## + 2.5 MiB/s +done +Bytes transferred = 14939132 (e3f3fc hex) +=> bootm 0x80200000 - 0x82200000 +## Booting kernel from Legacy Image at 80200000 ... + Image Name: Linux + Image Type: RISC-V Linux Kernel Image (uncompressed) + Data Size: 14939068 Bytes = 14.2 MiB + Load Address: 80200000 + Entry Point: 80200000 + Verifying Checksum ... OK +## Flattened Device Tree blob at 82200000 + Booting using the fdt blob at 0x82200000 + Loading Kernel Image ... OK + Using Device Tree in place at 0000000082200000, end 0000000082205c69 + +Starting kernel ... + +[ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000 +[ 0.000000] Linux version 5.0.0-rc1-00020-g4b51f736 (atish at jedi-01) (gcc version 7.2.0 (GCC)) #262 SMP Mon Jan 21 17:39:27 PST 2019 +[ 0.000000] initrd not found or empty - disabling initrd +[ 0.000000] Zone ranges: +[ 0.000000] DMA32 [mem 0x0000000080200000-0x00000000ffffffff] +[ 0.000000] Normal [mem 0x0000000100000000-0x000027ffffffffff] +[ 0.000000] Movable zone start for each node +[ 0.000000] Early memory node ranges +[ 0.000000] node 0: [mem 0x0000000080200000-0x000000027fffffff] +[ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x000000027fffffff] +[ 0.000000] software IO TLB: mapped [mem 0xfbfff000-0xfffff000] (64MB) +[ 0.000000] CPU with hartid=0 has a non-okay status of "masked" +[ 0.000000] CPU with hartid=0 has a non-okay status of "masked" +[ 0.000000] elf_hwcap is 0x112d +[ 0.000000] percpu: Embedded 15 pages/cpu @(____ptrval____) s29720 r0 d31720 u61440 +[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 2067975 +[ 0.000000] Kernel command line: earlyprintk +[ 0.000000] Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes) +[ 0.000000] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes) +[ 0.000000] Sorting __ex_table... +[ 0.000000] Memory: 8178760K/8386560K available (3309K kernel code, 248K rwdata, 872K rodata, 9381K init, 763K bss, 207800K reserved, 0K cma-reserved) +[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1 +[ 0.000000] rcu: Hierarchical RCU implementation. +[ 0.000000] rcu: RCU event tracing is enabled. +[ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4. +[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies. +[ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4 +[ 0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0 +[ 0.000000] plic: mapped 53 interrupts to 4 (out of 9) handlers. +[ 0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [1] +[ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 3526361616960 ns +[ 0.000008] sched_clock: 64 bits at 1000kHz, resolution 1000ns, wraps every 2199023255500ns +[ 0.000221] Console: colour dummy device 80x25 +[ 0.000902] printk: console [tty0] enabled +[ 0.000963] Calibrating delay loop (skipped), value calculated using timer frequency.. 2.00 BogoMIPS (lpj=10000) +[ 0.001034] pid_max: default: 32768 minimum: 301 +[ 0.001541] Mount-cache hash table entries: 16384 (order: 5, 131072 bytes) +[ 0.001912] Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes) +[ 0.003542] rcu: Hierarchical SRCU implementation. +[ 0.004347] smp: Bringing up secondary CPUs ... +[ 1.040259] CPU1: failed to come online +[ 2.080483] CPU2: failed to come online +[ 3.120699] CPU3: failed to come online +[ 3.120765] smp: Brought up 1 node, 1 CPU +[ 3.121923] devtmpfs: initialized +[ 3.124649] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns +[ 3.124727] futex hash table entries: 1024 (order: 4, 65536 bytes) +[ 3.125346] random: get_random_u32 called from bucket_table_alloc+0x72/0x172 with crng_init=0 +[ 3.125578] NET: Registered protocol family 16 +[ 3.126400] sifive-u54-prci 10000000.prci: Registered U54 core clocks +[ 3.126649] sifive-gemgxl-mgmt 100a0000.cadence-gemgxl-mgmt: Registered clock switch 'cadence-gemgxl-mgmt' +[ 3.135572] vgaarb: loaded +[ 3.135858] SCSI subsystem initialized +[ 3.136193] usbcore: registered new interface driver usbfs +[ 3.136266] usbcore: registered new interface driver hub +[ 3.136348] usbcore: registered new device driver usb +[ 3.136446] pps_core: LinuxPPS API ver. 1 registered +[ 3.136484] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <[email protected]> +[ 3.136575] PTP clock support registered +[ 3.137256] clocksource: Switched to clocksource riscv_clocksource +[ 3.142711] NET: Registered protocol family 2 +[ 3.143322] tcp_listen_portaddr_hash hash table entries: 4096 (order: 4, 65536 bytes) +[ 3.143634] TCP established hash table entries: 65536 (order: 7, 524288 bytes) +[ 3.145799] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes) +[ 3.149121] TCP: Hash tables configured (established 65536 bind 65536) +[ 3.149591] UDP hash table entries: 4096 (order: 5, 131072 bytes) +[ 3.150094] UDP-Lite hash table entries: 4096 (order: 5, 131072 bytes) +[ 3.150781] NET: Registered protocol family 1 +[ 3.230693] workingset: timestamp_bits=62 max_order=21 bucket_order=0 +[ 3.241224] io scheduler mq-deadline registered +[ 3.241269] io scheduler kyber registered +[ 3.242143] sifive_gpio 10060000.gpio: SiFive GPIO chip registered 16 GPIOs +[ 3.242357] pwm-sifivem 10020000.pwm: Unable to find controller clock +[ 3.242439] pwm-sifivem 10021000.pwm: Unable to find controller clock +[ 3.243228] xilinx-pcie 2000000000.pci: PCIe Link is DOWN +[ 3.243289] xilinx-pcie 2000000000.pci: host bridge /soc/pci at 2000000000 ranges: +[ 3.243360] xilinx-pcie 2000000000.pci: No bus range found for /soc/pci at 2000000000, using [bus 00-ff] +[ 3.243447] xilinx-pcie 2000000000.pci: MEM 0x40000000..0x5fffffff -> 0x40000000 +[ 3.243591] xilinx-pcie 2000000000.pci: PCI host bridge to bus 0000:00 +[ 3.243636] pci_bus 0000:00: root bus resource [bus 00-ff] +[ 3.243676] pci_bus 0000:00: root bus resource [mem 0x40000000-0x5fffffff] +[ 3.276547] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled +[ 3.277689] 10010000.serial: ttySIF0 at MMIO 0x10010000 (irq = 39, base_baud = 0) is a SiFive UART v0 +[ 3.786963] printk: console [ttySIF0] enabled +[ 3.791504] 10011000.serial: ttySIF1 at MMIO 0x10011000 (irq = 40, base_baud = 0) is a SiFive UART v0 +[ 3.801251] sifive_spi 10040000.spi: mapped; irq=41, cs=1 +[ 3.806362] m25p80 spi0.0: unrecognized JEDEC id bytes: 9d, 70, 19 +[ 3.812084] m25p80: probe of spi0.0 failed with error -2 +[ 3.817453] sifive_spi 10041000.spi: mapped; irq=42, cs=4 +[ 3.823027] sifive_spi 10050000.spi: mapped; irq=43, cs=1 +[ 3.828604] libphy: Fixed MDIO Bus: probed +[ 3.832623] macb: GEM doesn't support hardware ptp. +[ 3.837196] libphy: MACB_mii_bus: probed +[ 4.041156] Microsemi VSC8541 SyncE 10090000.ethernet-ffffffff:00: attached PHY driver [Microsemi VSC8541 SyncE] (mii_bus:phy_addr=10090000.ethernet-ffffffff:00, irq=POLL) +[ 4.055779] macb 10090000.ethernet eth0: Cadence GEM rev 0x10070109 at 0x10090000 irq 12 (70:b3:d5:92:f0:c2) +[ 4.065780] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver +[ 4.072033] ehci-pci: EHCI PCI platform driver +[ 4.076521] usbcore: registered new interface driver usb-storage +[ 4.082843] softdog: initialized. soft_noboot=0 soft_margin=60 sec soft_panic=0 (nowayout=0) +[ 4.127465] mmc_spi spi2.0: SD/MMC host mmc0, no DMA, no WP, no poweroff +[ 4.133645] usbcore: registered new interface driver usbhid +[ 4.138980] usbhid: USB HID core driver +[ 4.143017] NET: Registered protocol family 17 +[ 4.147885] pwm-sifivem 10020000.pwm: SiFive PWM chip registered 4 PWMs +[ 4.153945] pwm-sifivem 10021000.pwm: SiFive PWM chip registered 4 PWMs +[ 4.186407] Freeing unused kernel memory: 9380K +[ 4.190224] This architecture does not have kernel memory protection. +[ 4.196609] Run /init as init process +Starting logging: OK +Starting mdev... +[ 4.303785] mmc0: host does not support reading read-only switch, assuming write-enable +[ 4.311109] mmc0: new SDHC card on SPI +[ 4.317103] mmcblk0: mmc0:0000 SS08G 7.40 GiB +[ 4.386471] mmcblk0: p1 p2 +sort: /sys/devices/platform/Fixed: No such file or directory +modprobe: can't change directory to '/lib/modules': No such file or directory +Initializing random[ 4.759075] random: dd: uninitialized urandom read (512 bytes read) + number generator... done. +Starting network... +udhcpc (v1.24.2) started +Sending discover... +Sending discover... +[ 7.927510] macb 10090000.ethernet eth0: link up (1000/Full) +Sending discover... +Sending select for 10.196.157.190... +Lease of 10.196.157.190 obtained, lease time 499743 +deleting routers +adding dns 10.86.1.1 +adding dns 10.86.2.1 +/etc/init.d/S50dropbear +Starting dropbear sshd: [ 12.772393] random: dropbear: uninitialized urandom read (32 bytes read) +OK + +Welcome to Buildroot +buildroot login:
Signature · 1 line
2.17.1
PATCH v7 14/15 doc: Add a readme guide for SiFive FU540
Quoted 9 lines · Anup Patel
From: Atish Patra <[email protected]>
The readme guide describes the procedure to build, flash and boot Linux using U-Boot on HiFive Unleashed. It also explains the current state of U-boot support and future action items.
Signed-off-by Atish Patra <[email protected]>Signed-off-by Anup Patel <[email protected]>Reviewed-by Lukas Auer <[email protected]>
I'm testing this with the mainline kernel (v5.0-rc6) and running into some problems getting kernel output on the serial console.
[...]
Quoted 63 lines
+=> setenv ethaddr 70:B3:D5:92:F0:C2 +=> setenv ipaddr 10.196.157.189 +=> setenv serverip 10.11.143.218 +=> setenv gatewayip 10.196.156.1 +=> setenv netmask 255.255.252.0 +=> bdinfodoc/README.sifive-fu540 new file +57
-0+boot_params = 0x0000000000000000 +DRAM bank = 0x0000000000000000 +-> start = 0x0000000080000000 +-> size = 0x0000000200000000 +relocaddr = 0x00000000fff90000 +reloc off = 0x000000007fd90000 +ethaddr = 70:B3:D5:92:F0:C2 +IP addr = 10.196.157.189 +baudrate = 115200 bps +=> tftpboot uImage +ethernet at 10090000: PHY present at 0 +ethernet at 10090000: Starting autonegotiation... +ethernet at 10090000: Autonegotiation complete +ethernet at 10090000: link up, 1000Mbps full-duplex (lpa: 0x3800) +Using ethernet at 10090000 device +TFTP from server 10.11.143.218; our IP address is 10.196.157.189; sending through gateway 10.196.156.1 +Filename 'uImage'. +Load address: 0x80200000 +Loading: ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + #################################################################
doc/README.sifive-fu540 line 154
Quoted 10 lines
doc/README.sifive-fu540 new file +10
-0+ ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ########################################################## + 2.5 MiB/s +done +Bytes transferred = 14939132 (e3f3fc hex) +=> bootm 0x80200000 - 0x82200000
First question: this doc doesn't explain how there is a DT at 0x82200000, and what it contains.
Trying this with a freshly build u-boot payload with OpenSBI, bootm seems to detect a DT there, but I don't understand how it got there, or what it is in it.
Looking a little closer, it appears that this DT (and the address) is hard-coded in the OpenSBI code. This should proably be documented here for clarity sake.
doc/README.sifive-fu540 line 167
Quoted 13 lines
doc/README.sifive-fu540 new file +13
-0+## Booting kernel from Legacy Image at 80200000 ... + Image Name: Linux + Image Type: RISC-V Linux Kernel Image (uncompressed) + Data Size: 14939068 Bytes = 14.2 MiB + Load Address: 80200000 + Entry Point: 80200000 + Verifying Checksum ... OK +## Flattened Device Tree blob at 82200000 + Booting using the fdt blob at 0x82200000 + Loading Kernel Image ... OK + Using Device Tree in place at 0000000082200000, end 0000000082205c69 + +Starting kernel ...
Next, I'm able to DHCP and TFTP my uImage just like above, but I don't see any output on the console after the "Starting kernel".
That suggests that whatever DT is present there doesn't have the right settings for the serial console.
I tried setting the u-boot bootargs to "console=ttySIF0 earlyprintk", but I'm still seeing nothing on the console.
Dumping the hard-coded OpenSBI DT from u-boot[1], it seem that the chosen node has the right value (as documented in this patch):
Hmm, maybe I'm missing the obvious... is there even an upstream serial driver for this UART in v5.0-rc6... (/me goes searching for the compatible)... hmm, doesn't look like it.
Quoted 2 lines
+[ 0.000000] OF: fdt: Ignoring memory range
0x80000000-0x80200000
+[ 0.000000] Linux version 5.0.0-rc1-00020-g4b51f736 (atish at jedi-01) (gcc version 7.2.0 (GCC)) #262 SMP Mon Jan 21 17:39:27 PST 2019
Looks like you're testing with a handful of out-of-tree kernel patches. Can you give a pointer to where you're building your kernel from?
I'm guessing at a minimum I at least need the serial driver.
Thanks,
Kevin
[1]
=> fdt addr 0x82200000
=> fdt list
/ {
#address-cells = <0x00000002>;
#size-cells = <0x00000002>;
compatible = "sifive,fu540g", "sifive,fu500";
model = "sifive,hifive-unleashed-a00";
aliases {
};
chosen {
};
firmware {
};
cpus {
};
memory at 80000000 {
};
soc {
};
};
=> fdt list /chosen
chosen {
stdout-path = "/soc/serial at 10010000:115200";
};PATCH v7 14/15 doc: Add a readme guide for SiFive FU540
Quoted 12 lines · Kevin Hilman
Quoted 6 lines · Anup Patel
From: Atish Patra <[email protected]>
The readme guide describes the procedure to build, flash and boot Linux using U-Boot on HiFive Unleashed. It also explains the current state of U-boot support and future action items.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Atish Patra <[email protected]>Signed-off-by Anup Patel <[email protected]>Reviewed-by Lukas Auer <[email protected]>I'm testing this with the mainline kernel (v5.0-rc6) and running into some problems getting kernel output on the serial console.
Unfortunately.
Quoted 70 lines
[...]
Quoted 68 lines
+=> setenv ethaddr 70:B3:D5:92:F0:C2 +=> setenv ipaddr 10.196.157.189 +=> setenv serverip 10.11.143.218 +=> setenv gatewayip 10.196.156.1 +=> setenv netmask 255.255.252.0 +=> bdinfodoc/README.sifive-fu540 new file +62
-0+boot_params = 0x0000000000000000 +DRAM bank = 0x0000000000000000 +-> start = 0x0000000080000000 +-> size = 0x0000000200000000 +relocaddr = 0x00000000fff90000 +reloc off = 0x000000007fd90000 +ethaddr = 70:B3:D5:92:F0:C2 +IP addr = 10.196.157.189 +baudrate = 115200 bps +=> tftpboot uImage +ethernet at 10090000: PHY present at 0 +ethernet at 10090000: Starting autonegotiation... +ethernet at 10090000: Autonegotiation complete +ethernet at 10090000: link up, 1000Mbps full-duplex (lpa: 0x3800) +Using ethernet at 10090000 device +TFTP from server 10.11.143.218; our IP address is 10.196.157.189; sending through gateway 10.196.156.1 +Filename 'uImage'. +Load address: 0x80200000 +Loading: ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + ################################################################# + #################################################################
Quoted 9 lines
doc/README.sifive-fu540 line 154
Quoted 5 lines
doc/README.sifive-fu540 new file +5
-0+ ########################################################## + 2.5 MiB/s +done +Bytes transferred = 14939132 (e3f3fc hex) +=> bootm 0x80200000 - 0x82200000First question: this doc doesn't explain how there is a DT at
0x82200000, and what it contains.
DT is being passed from the previous stage boot loader to OpenSBI and OpenSBI passed it to U-Boot after modifying few entries (hart masks and plic entries).
There is a way to provide custom DT in OpenSBI as well.
Quoted 8 lines
Trying this with a freshly build u-boot payload with OpenSBI, bootm seems to detect a DT there, but I don't understand how it got there, or what it is in it.
Looking a little closer, it appears that this DT (and the address) is hard-coded in the OpenSBI code. This should proably be documented here for clarity sake.
I will update the document to add more clarity.
Quoted 23 lines
doc/README.sifive-fu540 line 167
Quoted 13 lines
doc/README.sifive-fu540 new file +13
-0+## Booting kernel from Legacy Image at 80200000 ... + Image Name: Linux + Image Type: RISC-V Linux Kernel Image (uncompressed) + Data Size: 14939068 Bytes = 14.2 MiB + Load Address: 80200000 + Entry Point: 80200000 + Verifying Checksum ... OK +## Flattened Device Tree blob at 82200000 + Booting using the fdt blob at 0x82200000 + Loading Kernel Image ... OK + Using Device Tree in place at 0000000082200000, end 0000000082205c69 + +Starting kernel ...Next, I'm able to DHCP and TFTP my uImage just like above, but I don't see any output on the console after the "Starting kernel".
That suggests that whatever DT is present there doesn't have the right settings for the serial console.
I tried setting the u-boot bootargs to "console=ttySIF0 earlyprintk", but I'm still seeing nothing on the console.
Quoted 7 lines
Dumping the hard-coded OpenSBI DT from u-boot[1], it seem that the chosen node has the right value (as documented in this patch):
Hmm, maybe I'm missing the obvious... is there even an upstream serial driver for this UART in v5.0-rc6... (/me goes searching for the compatible)... hmm, doesn't look like it.
Unfortunately, all the drivers for unleashed are not upstreamed yet. It is a mess and hopefully it will be resolved soon.
Quoted 6 lines
Quoted 2 lines
+[ 0.000000] OF: fdt: Ignoring memory range
0x80000000-0x80200000
+[ 0.000000] Linux version 5.0.0-rc1-00020-g4b51f736 (atish at jedi-01) (gcc version 7.2.0 (GCC)) #262 SMP Mon Jan 21 17:39:27 PST 2019Looks like you're testing with a handful of out-of-tree kernel patches. Can you give a pointer to where you're building your kernel from?
Here is my branch based on 5.0-rc5 that should work.
https://github.com/atishp04/linux/ v5.0-rc5_unleashed_uboot
1-8 patches are mostly SMP fixes and currently under review. They should be part of next merge window.
------------------------------------------------------------------------------------------
1. 4a0edc9b RISC-V: Assign hwcap as per comman capabilities.
2. c29e4afa irqchip/irq-sifive-plic: Check and continue in case of an invalid cpuid.
3. 6c191098 clocksource/drivers/riscv: Add required checks during clock source init
4. d89bfcf6 RISC-V: Compare cpuid with NR_CPUS before mapping.
5. 474cb3e3 RISC-V: Allow hartid-to-cpuid function to fail.
6. 5e07a2f4 RISC-V: Remove NR_CPUs check during hartid search from DT
7. cf5f2ec6 RISC-V: Move cpuid to hartid mapping to SMP.
8. 7838fe36 RISC-V: Do not wait indefinitely in __cpu_up
------------------------------------------------------------------------------------------
The real mess is the following driver patches for unleashed board.
9. d46dc16f spi: sifive: no dma hack
10. e8ea1346 spi: add driver for the SiFive SPI controller
11. 120d5658 pcie-microsemi: added support for the Vera-board root complex
12. afb97b09 RISC-V: Networking fix Hack
13. 4ca6e585 pwm-sifive: add a driver for SiFive SoC PWM
14. ddb4b49e gpio-sifive: support GPIO on SiFive SoCs
15. f8859c7d u54-prci: driver for core U54 clocks
16. 27b6fd77 u54-prci: driver for core U54 clocks
17. dcd33855 gemgxl-mgmt: implement clock switch for GEM tx_clk
18. b25bb020 tty: serial: add driver for the SiFive UART
19. fd6f363f dt-bindings: serial: add documentation for the SiFive UART driver
Please make sure following configs are enabled in your config.
CONFIG_SERIAL_SIFIVE=yCONFIG_SERIAL_SIFIVE_CONSOLE=yCONFIG_SIFIVE_PLIC=yCONFIG_SPI=yCONFIG_SPI_SIFIVE=yCONFIG_GPIOLIB=yCONFIG_GPIO_SIFIVE=yCONFIG_PWM_SIFIVE=yCONFIG_CLK_U54_PRCI=yCONFIG_CLK_GEMGXL_MGMT=y
I will update the document to mention about the driver patches as well. Sorry for the inconvenience caused.
Regards,
Atish
Quoted 35 lines
I'm guessing at a minimum I at least need the serial driver.
Thanks,
Kevin
[1]
=> fdt addr0x82200000
=> fdt list/ { #address-cells = <0x00000002>; #size-cells = <0x00000002>; compatible = "sifive,fu540g", "sifive,fu500"; model = "sifive,hifive-unleashed-a00"; aliases { }; chosen { }; firmware { }; cpus { }; memory at 80000000 { }; soc { }; }; => fdt list /chosen chosen { stdout-path = "/soc/serial at 10010000:115200"; };_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Auer
PATCH v7 14/15 doc: Add a readme guide for SiFive FU540
Quoted 150 lines · Atish Patra
Quoted 13 lines
On Feb 12, 2019, at 4:18 PM, Kevin Hilman <[email protected]> wrote:
Quoted 8 lines · Anup Patel
From: Atish Patra <[email protected]>
The readme guide describes the procedure to build, flash and boot Linux
using U-Boot on HiFive Unleashed. It also explains the current state of
U-boot support and future action items.Quoted 8 lines
Quoted 3 lines
Signed-off-by Atish Patra <[email protected]>Signed-off-by Anup Patel <[email protected]>Reviewed-by Lukas Auer <[email protected]>I'm testing this with the mainline kernel (v5.0-rc6) and running into
some problems getting kernel output on the serial console.Unfortunately.
Quoted 116 lines
[...]
Quoted 114 lines
+=> setenv ethaddr 70:B3:D5:92:F0:C2 +=> setenv ipaddr 10.196.157.189 +=> setenv serverip 10.11.143.218 +=> setenv gatewayip 10.196.156.1 +=> setenv netmask 255.255.252.0 +=> bdinfodoc/README.sifive-fu540 new file +16
-0+boot_params = 0x0000000000000000 +DRAM bank = 0x0000000000000000 +-> start = 0x0000000080000000 +-> size = 0x0000000200000000 +relocaddr = 0x00000000fff90000 +reloc off = 0x000000007fd90000 +ethaddr = 70:B3:D5:92:F0:C2 +IP addr = 10.196.157.189 +baudrate = 115200 bps +=> tftpboot uImage +ethernet at 10090000: PHY present at 0 +ethernet at 10090000: Starting autonegotiation... +ethernet at 10090000: Autonegotiation complete +ethernet at 10090000: link up, 1000Mbps full-duplex (lpa: 0x3800) +Using ethernet at 10090000 device +TFTP from server 10.11.143.218; our IP address is10.196.157.189; sending through gateway 10.196.156.1
doc/README.sifive-fu540 new file +3
-0+Filename 'uImage'. +Load address: 0x80200000 +Loading:#################################################################
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################Quoted 9 lines
doc/README.sifive-fu540 line 154
Quoted 5 lines
###
doc/README.sifive-fu540 new file +4
-0+ 2.5 MiB/s +done +Bytes transferred = 14939132 (e3f3fc hex) +=> bootm 0x80200000 - 0x82200000First question: this doc doesn't explain how there is a DT at
0x82200000, and what it contains.
Quoted 5 lines
DT is being passed from the previous stage boot loader to OpenSBI and OpenSBI passed it to U-Boot
after modifying few entries (hart masks and plic entries).There is a way to provide custom DT in OpenSBI as well.
FYI, you can also use the fdtcontroladdr environment variable to pass U-Boot's device tree, so the one passed by OpenSBI, to Linux.
Thanks,
Lukas
Quoted 155 lines
Quoted 6 lines
Trying this with a freshly build u-boot payload with OpenSBI, bootm seems to detect a DT there, but I don't understand how it got there, or
what it is in it.Quoted 6 lines
Looking a little closer, it appears that this DT (and the address) is
hard-coded in the OpenSBI code. This should proably be documented here
for clarity sake.I will update the document to add more clarity.
Quoted 27 lines
Quoted 12 lines
doc/README.sifive-fu540 new file +11
-0+## Booting kernel from Legacy Image at 80200000 ... + Image Name: Linux + Image Type: RISC-V Linux Kernel Image (uncompressed) + Data Size: 14939068 Bytes = 14.2 MiB + Load Address: 80200000 + Entry Point: 80200000 + Verifying Checksum ... OK +## Flattened Device Tree blob at 82200000 + Booting using the fdt blob at 0x82200000 + Loading Kernel Image ... OK + Using Device Tree in place at 0000000082200000, end
0000000082205c69doc/README.sifive-fu540 line 167
Quoted 2 lines
doc/README.sifive-fu540 new file +2
-0+ +Starting kernel ...Next, I'm able to DHCP and TFTP my uImage just like above, but I don't
see any output on the console after the "Starting kernel".That suggests that whatever DT is present there doesn't have the right
settings for the serial console.I tried setting the u-boot bootargs to "console=ttySIF0 earlyprintk",
but I'm still seeing nothing on the console.Quoted 8 lines
Dumping the hard-coded OpenSBI DT from u-boot[1], it seem that the chosen node has the right value (as documented in this patch):
Hmm, maybe I'm missing the obvious... is there even an upstream serial
driver for this UART in v5.0-rc6... (/me goes searching for the compatible)... hmm, doesn't look like it.Unfortunately, all the drivers for unleashed are not upstreamed yet. It is a mess and hopefully it will be resolved soon.
Quoted 10 lines
Quoted 5 lines
+[ 0.000000] OF: fdt: Ignoring memory range
0x80000000-0x80200000
+[ 0.000000] Linux version 5.0.0-rc1-00020-g4b51f736 (
atish at jedi-01) (gcc version 7.2.0 (GCC)) #262 SMP Mon Jan 21 17:39:27 PST 2019Looks like you're testing with a handful of out-of-tree kernel patches.
Can you give a pointer to where you're building your kernel from?Here is my branch based on 5.0-rc5 that should work.
https://github.com/atishp04/linux/ v5.0-rc5_unleashed_uboot
1-8 patches are mostly SMP fixes and currently under review. They should be part of next merge window.
-------------------------------------------------------------------
-----------------------
1.4a0edc9bRISC-V: Assign hwcap as per comman capabilities.
2.c29e4afairqchip/irq-sifive-plic: Check and continue in case of an invalid cpuid.
3.6c191098clocksource/drivers/riscv: Add required checks during clock source init
4.d89bfcf6RISC-V: Compare cpuid withNR_CPUSbefore mapping.
5.474cb3e3RISC-V: Allow hartid-to-cpuid function to fail.
6.5e07a2f4RISC-V: RemoveNR_CPUscheck during hartid search from DT
7.cf5f2ec6RISC-V: Move cpuid to hartid mapping to SMP.
8.7838fe36RISC-V: Do not wait indefinitely in__cpu_up
-------------------------------------------------------------------
-----------------------The real mess is the following driver patches for unleashed board.
9.
d46dc16fspi: sifive: no dma hack
10.e8ea1346spi: add driver for the SiFive SPI controller
11.120d5658pcie-microsemi: added support for the Vera-board root complex
12.afb97b09RISC-V: Networking fix Hack
13.4ca6e585pwm-sifive: add a driver for SiFive SoC PWM
14.ddb4b49egpio-sifive: support GPIO on SiFive SoCs
15.f8859c7du54-prci: driver for core U54 clocks
16.27b6fd77u54-prci: driver for core U54 clocks
17.dcd33855gemgxl-mgmt: implement clock switch for GEMtx_clk
18.b25bb020tty: serial: add driver for the SiFive UART
19.fd6f363fdt-bindings: serial: add documentation for the SiFive UART driverPlease make sure following configs are enabled in your config.
CONFIG_SERIAL_SIFIVE=yCONFIG_SERIAL_SIFIVE_CONSOLE=yCONFIG_SIFIVE_PLIC=yCONFIG_SPI=yCONFIG_SPI_SIFIVE=yCONFIG_GPIOLIB=yCONFIG_GPIO_SIFIVE=yCONFIG_PWM_SIFIVE=yCONFIG_CLK_U54_PRCI=yCONFIG_CLK_GEMGXL_MGMT=yI will update the document to mention about the driver patches as well. Sorry for the inconvenience caused.
Regards,
AtishQuoted 35 lines
I'm guessing at a minimum I at least need the serial driver.
Thanks,
Kevin
[1]
=> fdt addr0x82200000
=> fdt list/ { #address-cells = <0x00000002>; #size-cells = <0x00000002>; compatible = "sifive,fu540g", "sifive,fu500"; model = "sifive,hifive-unleashed-a00"; aliases { }; chosen { }; firmware { }; cpus { }; memory at 80000000 { }; soc { }; }; => fdt list /chosen chosen { stdout-path = "/soc/serial at 10010000:115200"; };_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH v7 14/15 doc: Add a readme guide for SiFive FU540
Quoted 155 lines · Lukas
Quoted 154 lines · Atish Patra
Quoted 13 lines
On Feb 12, 2019, at 4:18 PM, Kevin Hilman <[email protected]> wrote:
Quoted 8 lines · Anup Patel
From: Atish Patra <[email protected]>
The readme guide describes the procedure to build, flash and boot Linux
using U-Boot on HiFive Unleashed. It also explains the current state of
U-boot support and future action items.Quoted 8 lines
Quoted 3 lines
Signed-off-by Atish Patra <[email protected]>Signed-off-by Anup Patel <[email protected]>Reviewed-by Lukas Auer <[email protected]>I'm testing this with the mainline kernel (v5.0-rc6) and running into
some problems getting kernel output on the serial console.Unfortunately.
Quoted 116 lines
[...]
Quoted 114 lines
+=> setenv ethaddr 70:B3:D5:92:F0:C2 +=> setenv ipaddr 10.196.157.189 +=> setenv serverip 10.11.143.218 +=> setenv gatewayip 10.196.156.1 +=> setenv netmask 255.255.252.0 +=> bdinfodoc/README.sifive-fu540 new file +16
-0+boot_params = 0x0000000000000000 +DRAM bank = 0x0000000000000000 +-> start = 0x0000000080000000 +-> size = 0x0000000200000000 +relocaddr = 0x00000000fff90000 +reloc off = 0x000000007fd90000 +ethaddr = 70:B3:D5:92:F0:C2 +IP addr = 10.196.157.189 +baudrate = 115200 bps +=> tftpboot uImage +ethernet at 10090000: PHY present at 0 +ethernet at 10090000: Starting autonegotiation... +ethernet at 10090000: Autonegotiation complete +ethernet at 10090000: link up, 1000Mbps full-duplex (lpa: 0x3800) +Using ethernet at 10090000 device +TFTP from server 10.11.143.218; our IP address is10.196.157.189; sending through gateway 10.196.156.1
doc/README.sifive-fu540 new file +3
-0+Filename 'uImage'. +Load address: 0x80200000 +Loading:#################################################################
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################
##########
+ #######################################################Quoted 9 lines
doc/README.sifive-fu540 line 154
Quoted 5 lines
###
doc/README.sifive-fu540 new file +4
-0+ 2.5 MiB/s +done +Bytes transferred = 14939132 (e3f3fc hex) +=> bootm 0x80200000 - 0x82200000First question: this doc doesn't explain how there is a DT at
0x82200000, and what it contains.DT is being passed from the previous stage boot loader to OpenSBI and OpenSBI passed it to U-Boot
after modifying few entries (hart masks and plic entries).
Quoted 50 lines
Quoted 1 line
There is a way to provide custom DT in OpenSBI as well.
FYI, you can also use the fdtcontroladdr environment variable to pass U-Boot's device tree, so the one passed by OpenSBI, to Linux.
Thanks,
LukasQuoted 42 lines
Quoted 6 lines
Trying this with a freshly build u-boot payload with OpenSBI, bootm seems to detect a DT there, but I don't understand how it got there, or
what it is in it.Quoted 6 lines
Looking a little closer, it appears that this DT (and the address) is
hard-coded in the OpenSBI code. This should proably be documented here
for clarity sake.I will update the document to add more clarity.
Quoted 27 lines
Quoted 12 lines
doc/README.sifive-fu540 new file +11
-0+## Booting kernel from Legacy Image at 80200000 ... + Image Name: Linux + Image Type: RISC-V Linux Kernel Image (uncompressed) + Data Size: 14939068 Bytes = 14.2 MiB + Load Address: 80200000 + Entry Point: 80200000 + Verifying Checksum ... OK +## Flattened Device Tree blob at 82200000 + Booting using the fdt blob at 0x82200000 + Loading Kernel Image ... OK + Using Device Tree in place at 0000000082200000, end
0000000082205c69doc/README.sifive-fu540 line 167
Quoted 2 lines
doc/README.sifive-fu540 new file +2
-0+ +Starting kernel ...Next, I'm able to DHCP and TFTP my uImage just like above, but I don't
see any output on the console after the "Starting kernel".That suggests that whatever DT is present there doesn't have the right
settings for the serial console.I tried setting the u-boot bootargs to "console=ttySIF0 earlyprintk",
but I'm still seeing nothing on the console.
FYI: earlyprintk is disabled in v5.0rc5 in favor of earlycon.
so you need to use
CONFIG_CMDLINE="earlycon=sbi console=ttySIF0"
Regards,
Atish
Quoted 114 lines
Quoted 113 lines
Quoted 8 lines
Dumping the hard-coded OpenSBI DT from u-boot[1], it seem that the chosen node has the right value (as documented in this patch):
Hmm, maybe I'm missing the obvious... is there even an upstream serial
driver for this UART in v5.0-rc6... (/me goes searching for the compatible)... hmm, doesn't look like it.Unfortunately, all the drivers for unleashed are not upstreamed yet. It is a mess and hopefully it will be resolved soon.
Quoted 10 lines
Quoted 5 lines
+[ 0.000000] OF: fdt: Ignoring memory range
0x80000000-0x80200000
+[ 0.000000] Linux version 5.0.0-rc1-00020-g4b51f736 (
atish at jedi-01) (gcc version 7.2.0 (GCC)) #262 SMP Mon Jan 21 17:39:27 PST 2019Looks like you're testing with a handful of out-of-tree kernel patches.
Can you give a pointer to where you're building your kernel from?Here is my branch based on 5.0-rc5 that should work.
https://github.com/atishp04/linux/ v5.0-rc5_unleashed_uboot
1-8 patches are mostly SMP fixes and currently under review. They should be part of next merge window.
-------------------------------------------------------------------
-----------------------
1.4a0edc9bRISC-V: Assign hwcap as per comman capabilities.
2.c29e4afairqchip/irq-sifive-plic: Check and continue in case of an invalid cpuid.
3.6c191098clocksource/drivers/riscv: Add required checks during clock source init
4.d89bfcf6RISC-V: Compare cpuid withNR_CPUSbefore mapping.
5.474cb3e3RISC-V: Allow hartid-to-cpuid function to fail.
6.5e07a2f4RISC-V: RemoveNR_CPUscheck during hartid search from DT
7.cf5f2ec6RISC-V: Move cpuid to hartid mapping to SMP.
8.7838fe36RISC-V: Do not wait indefinitely in__cpu_up
-------------------------------------------------------------------
-----------------------The real mess is the following driver patches for unleashed board.
9.
d46dc16fspi: sifive: no dma hack
10.e8ea1346spi: add driver for the SiFive SPI controller
11.120d5658pcie-microsemi: added support for the Vera-board root complex
12.afb97b09RISC-V: Networking fix Hack
13.4ca6e585pwm-sifive: add a driver for SiFive SoC PWM
14.ddb4b49egpio-sifive: support GPIO on SiFive SoCs
15.f8859c7du54-prci: driver for core U54 clocks
16.27b6fd77u54-prci: driver for core U54 clocks
17.dcd33855gemgxl-mgmt: implement clock switch for GEMtx_clk
18.b25bb020tty: serial: add driver for the SiFive UART
19.fd6f363fdt-bindings: serial: add documentation for the SiFive UART driverPlease make sure following configs are enabled in your config.
CONFIG_SERIAL_SIFIVE=yCONFIG_SERIAL_SIFIVE_CONSOLE=yCONFIG_SIFIVE_PLIC=yCONFIG_SPI=yCONFIG_SPI_SIFIVE=yCONFIG_GPIOLIB=yCONFIG_GPIO_SIFIVE=yCONFIG_PWM_SIFIVE=yCONFIG_CLK_U54_PRCI=yCONFIG_CLK_GEMGXL_MGMT=yI will update the document to mention about the driver patches as well. Sorry for the inconvenience caused.
Regards,
AtishQuoted 35 lines
I'm guessing at a minimum I at least need the serial driver.
Thanks,
Kevin
[1]
=> fdt addr0x82200000
=> fdt list/ { #address-cells = <0x00000002>; #size-cells = <0x00000002>; compatible = "sifive,fu540g", "sifive,fu500"; model = "sifive,hifive-unleashed-a00"; aliases { }; chosen { }; firmware { }; cpus { }; memory at 80000000 { }; soc { }; }; => fdt list /chosen chosen { stdout-path = "/soc/serial at 10010000:115200"; };_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
PATCH v7 14/15 doc: Add a readme guide for SiFive FU540
In reply to Atish PatraQuoted 20 lines · Atish Patra
Quoted 10 lines · Kevin Hilman
Quoted 6 lines · Anup Patel
From: Atish Patra <[email protected]>
The readme guide describes the procedure to build, flash and boot Linux using U-Boot on HiFive Unleashed. It also explains the current state of U-boot support and future action items.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Atish Patra <[email protected]>Signed-off-by Anup Patel <[email protected]>Reviewed-by Lukas Auer <[email protected]>I'm testing this with the mainline kernel (v5.0-rc6) and running into some problems getting kernel output on the serial console.
Unfortunately.
[...]
Quoted 8 lines
Quoted 3 lines
First question: this doc doesn't explain how there is a DT at
0x82200000, and what it contains.DT is being passed from the previous stage boot loader to OpenSBI and OpenSBI passed it to U-Boot after modifying few entries (hart masks and plic entries).
There is a way to provide custom DT in OpenSBI as well.
And if u-boot were load (or TFTP) a custom DT, this should work too, right?
Quoted 10 lines
Quoted 8 lines
Trying this with a freshly build u-boot payload with OpenSBI, bootm seems to detect a DT there, but I don't understand how it got there, or what it is in it.
Looking a little closer, it appears that this DT (and the address) is hard-coded in the OpenSBI code. This should proably be documented here for clarity sake.
I will update the document to add more clarity.
Thanks.
Quoted 33 lines
Quoted 23 lines
doc/README.sifive-fu540 line 167
Quoted 13 lines
doc/README.sifive-fu540 new file +13
-0+## Booting kernel from Legacy Image at 80200000 ... + Image Name: Linux + Image Type: RISC-V Linux Kernel Image (uncompressed) + Data Size: 14939068 Bytes = 14.2 MiB + Load Address: 80200000 + Entry Point: 80200000 + Verifying Checksum ... OK +## Flattened Device Tree blob at 82200000 + Booting using the fdt blob at 0x82200000 + Loading Kernel Image ... OK + Using Device Tree in place at 0000000082200000, end 0000000082205c69 + +Starting kernel ...Next, I'm able to DHCP and TFTP my uImage just like above, but I don't see any output on the console after the "Starting kernel".
That suggests that whatever DT is present there doesn't have the right settings for the serial console.
I tried setting the u-boot bootargs to "console=ttySIF0 earlyprintk", but I'm still seeing nothing on the console.
Quoted 7 lines
Dumping the hard-coded OpenSBI DT from u-boot[1], it seem that the chosen node has the right value (as documented in this patch):
Hmm, maybe I'm missing the obvious... is there even an upstream serial driver for this UART in v5.0-rc6... (/me goes searching for the compatible)... hmm, doesn't look like it.
Unfortunately, all the drivers for unleashed are not upstreamed yet. It is a mess and hopefully it will be resolved soon.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
+[ 0.000000] OF: fdt: Ignoring memory range
0x80000000-0x80200000
+[ 0.000000] Linux version 5.0.0-rc1-00020-g4b51f736 (atish at jedi-01) (gcc version 7.2.0 (GCC)) #262 SMP Mon Jan 21 17:39:27 PST 2019Looks like you're testing with a handful of out-of-tree kernel patches. Can you give a pointer to where you're building your kernel from?
Here is my branch based on 5.0-rc5 that should work.
Yes, building a kernel from there, using the config options you mentioned works. Thanks.
Quoted 41 lines
https://github.com/atishp04/linux/ v5.0-rc5_unleashed_uboot
1-8 patches are mostly SMP fixes and currently under review. They should be part of next merge window.
------------------------------------------------------------------------------------------
1.4a0edc9bRISC-V: Assign hwcap as per comman capabilities.
2.c29e4afairqchip/irq-sifive-plic: Check and continue in case of an invalid cpuid.
3.6c191098clocksource/drivers/riscv: Add required checks during clock source init
4.d89bfcf6RISC-V: Compare cpuid withNR_CPUSbefore mapping.
5.474cb3e3RISC-V: Allow hartid-to-cpuid function to fail.
6.5e07a2f4RISC-V: RemoveNR_CPUscheck during hartid search from DT
7.cf5f2ec6RISC-V: Move cpuid to hartid mapping to SMP.
8.7838fe36RISC-V: Do not wait indefinitely in__cpu_up
------------------------------------------------------------------------------------------The real mess is the following driver patches for unleashed board.
9.
d46dc16fspi: sifive: no dma hack
10.e8ea1346spi: add driver for the SiFive SPI controller
11.120d5658pcie-microsemi: added support for the Vera-board root complex
12.afb97b09RISC-V: Networking fix Hack
13.4ca6e585pwm-sifive: add a driver for SiFive SoC PWM
14.ddb4b49egpio-sifive: support GPIO on SiFive SoCs
15.f8859c7du54-prci: driver for core U54 clocks
16.27b6fd77u54-prci: driver for core U54 clocks
17.dcd33855gemgxl-mgmt: implement clock switch for GEMtx_clk
18.b25bb020tty: serial: add driver for the SiFive UART
19.fd6f363fdt-bindings: serial: add documentation for the SiFive UART driverPlease make sure following configs are enabled in your config.
CONFIG_SERIAL_SIFIVE=yCONFIG_SERIAL_SIFIVE_CONSOLE=yCONFIG_SIFIVE_PLIC=yCONFIG_SPI=yCONFIG_SPI_SIFIVE=yCONFIG_GPIOLIB=yCONFIG_GPIO_SIFIVE=yCONFIG_PWM_SIFIVE=yCONFIG_CLK_U54_PRCI=yCONFIG_CLK_GEMGXL_MGMT=y
Quoted 1 line
I will update the document to mention about the driver patches as well. Sorry for the inconvenience caused.
Probably should mention the kernel config requirements too, if they are not the defaults in upstream.
Kevin
PATCH v7 15/15 riscv: Enable CONFIG_SYS_BOOT_RAMDISK_HIGH for using initrd
In reply to Anup PatelThis patch enables CONFIG_SYS_BOOT_RAMDISK_HIGH for RISC-V because bootm will update initrd location in DTB only if CONFIG_SYS_BOOT_RAMDISK_HIGH is enabled. If we don't enable this option then bootm assumes DTB already has initrd details which is not the case most of the time.
--- arch/riscv/include/asm/config.h | 1 + 1 file changed, 1 insertion(+)
arch/riscv/include/asm/config.h +1 -0
@@ -8,5 +8,6 @@#define _ASM_CONFIG_H_#define CONFIG_LMB +#define CONFIG_SYS_BOOT_RAMDISK_HIGH #endif
Signature · 1 line
2.17.1
v7 cover SiFive FU540 Support
In reply to Anup PatelQuoted 10 lines · Anup Patel
This patchset adds SiFive Freedom Unleashed (FU540) support to RISC-V U-Boot.
The patches are based upon latest U-Boot source tree
(git://git.denx.de/u-boot.git) at commit iddbe70c7d4e3d5c705a98d82952e05a591efd0683All drivers namely: SiFive PRCI, SiFive Serial, and Cadance MACB Ethernet work fine on actual SiFive Unleashed board and QEMU
sifive_umachine.
Looks like the MACB driver cannot find the correct MAC address. That makes it rather awkward for network boot.
Warning: ethernet at 10090000 (eth0) using random MAC address - 0e:14:15:06:ae:e4
Andreas.
Signature · 3 lines
Andreas Schwab, SUSE Labs, schwab at suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
v7 cover SiFive FU540 Support
Quoted 10 lines · Andreas Schwab
Quoted 7 lines · Anup Patel
This patchset adds SiFive Freedom Unleashed (FU540) support to RISC-V U-Boot.
The patches are based upon latest U-Boot source tree
(git://git.denx.de/u-boot.git) at commit iddbe70c7d4e3d5c705a98d82952e05a591efd0683
Quoted 8 lines
Quoted 3 lines
All drivers namely: SiFive PRCI, SiFive Serial, and Cadance MACB Ethernet work fine on actual SiFive Unleashed board and QEMU
sifive_umachine.Looks like the MACB driver cannot find the correct MAC address. That makes it rather awkward for network boot.
Warning: ethernet at 10090000 (eth0) using random MAC address - 0e:14:15:06:ae:e4
This is because we don't have place to put U-Boot environment variables as of now on Unleashed board. This will be solved once we have SPI driver and SPI_MMC driver for Unleased board.
In future, we will be saving "ethaddr" environment variable on SPI_MMC so U-Boot will pick MAC address at boot-time from SPI_MMC. Once this is achieved, the above warning will go away.
Regards,
Anup
v7 cover SiFive FU540 Support
Quoted 24 lines
Am 12.02.2019 um 03:57 schrieb Anup Patel <[email protected]>:
Quoted 11 lines · Andreas Schwab
Quoted 10 lines · Anup Patel
This patchset adds SiFive Freedom Unleashed (FU540) support to RISC-V U-Boot.
The patches are based upon latest U-Boot source tree
(git://git.denx.de/u-boot.git) at commit iddbe70c7d4e3d5c705a98d82952e05a591efd0683Quoted 8 lines
Quoted 3 lines
All drivers namely: SiFive PRCI, SiFive Serial, and Cadance MACB Ethernet work fine on actual SiFive Unleashed board and QEMU
sifive_umachine.Looks like the MACB driver cannot find the correct MAC address. That makes it rather awkward for network boot.
Warning: ethernet at 10090000 (eth0) using random MAC address - 0e:14:15:06:ae:e4
Quoted 7 lines
This is because we don't have place to put U-Boot environment variables as of now on Unleashed board. This will be solved once we have SPI driver and
SPI_MMCdriver for Unleased board.In future, we will be saving "ethaddr" environment variable on
SPI_MMCso U-Boot will pick MAC address at boot-time fromSPI_MMC. Once this is achieved, the above warning will go away.
How is the MAC determined in Linux?
Alex
Quoted 3 lines
Regards,
Anup
v7 cover SiFive FU540 Support
Quoted 29 lines · Alexander Graf
Quoted 29 lines
Am 12.02.2019 um 03:57 schrieb Anup Patel <[email protected]>:
Quoted 11 lines · Andreas Schwab
Quoted 10 lines · Anup Patel
This patchset adds SiFive Freedom Unleashed (FU540) support to RISC-V U-Boot.
The patches are based upon latest U-Boot source tree
(git://git.denx.de/u-boot.git) at commit iddbe70c7d4e3d5c705a98d82952e05a591efd0683Quoted 8 lines
Quoted 3 lines
All drivers namely: SiFive PRCI, SiFive Serial, and Cadance MACB Ethernet work fine on actual SiFive Unleashed board and QEMU
sifive_umachine.Looks like the MACB driver cannot find the correct MAC address. That makes it rather awkward for network boot.
Warning: ethernet at 10090000 (eth0) using random MAC address - 0e:14:15:06:ae:e4
This is because we don't have place to put U-Boot environment variables as of now on Unleashed board. This will be solved once we have SPI driver and
SPI_MMCdriver for Unleased board.
Quoted 5 lines
Quoted 3 lines
In future, we will be saving "ethaddr" environment variable on
SPI_MMCso U-Boot will pick MAC address at boot-time fromSPI_MMC. Once this is achieved, the above warning will go away.How is the MAC determined in Linux?
In Linux, we have an "local-mac-address" DT property used by quite a few drivers (including Cadence Ethernet driver) but it's not uniform across Linux drivers.
In U-Boot, another option is to change the Candence MACB driver and set "ethaddr" environment variable based on "local-mac-address" DT property from driver probe. Suggestions ??
Regards,
Anup
v7 cover SiFive FU540 Support
Quoted 40 lines
Am 12.02.2019 um 07:35 schrieb Anup Patel <[email protected]>:
Quoted 30 lines · Alexander Graf
Quoted 29 lines
Quoted 16 lines
Am 12.02.2019 um 03:57 schrieb Anup Patel <[email protected]>:
Quoted 11 lines · Andreas Schwab
On Feb 11 2019, Anup Patel <[email protected]> wrote:
This patchset adds SiFive Freedom Unleashed (FU540) support to RISC-V U-Boot.
The patches are based upon latest U-Boot source tree
(git://git.denx.de/u-boot.git) at commit iddbe70c7d4e3d5c705a98d82952e05a591efd0683Quoted 8 lines
Quoted 3 lines
All drivers namely: SiFive PRCI, SiFive Serial, and Cadance MACB Ethernet work fine on actual SiFive Unleashed board and QEMU
sifive_umachine.Looks like the MACB driver cannot find the correct MAC address. That makes it rather awkward for network boot.
Warning: ethernet at 10090000 (eth0) using random MAC address - 0e:14:15:06:ae:e4
This is because we don't have place to put U-Boot environment variables as of now on Unleashed board. This will be solved once we have SPI driver and
SPI_MMCdriver for Unleased board.Quoted 5 lines
Quoted 3 lines
In future, we will be saving "ethaddr" environment variable on
SPI_MMCso U-Boot will pick MAC address at boot-time fromSPI_MMC. Once this is achieved, the above warning will go away.How is the MAC determined in Linux?
Quoted 7 lines
In Linux, we have an "local-mac-address" DT property used by quite a few drivers (including Cadence Ethernet driver) but it's not uniform across Linux drivers.
In U-Boot, another option is to change the Candence MACB driver and set "ethaddr" environment variable based on "local-mac-address" DT property from driver probe. Suggestions ??
That would be my quick fix suggestion, yes :). Or do it in the board file.
Alex
Quoted 3 lines
Regards,
Anup
v7 cover SiFive FU540 Support
In reply to Anup PatelQuoted 3 lines · Anup Patel
This is because we don't have place to put U-Boot environment variables as of now on Unleashed board. This will be solved once we have SPI driver and
SPI_MMCdriver for Unleased board.
Isn't the MAC part of the initial DT?
Andreas.
Signature · 3 lines
Andreas Schwab, SUSE Labs, schwab at suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
v7 cover SiFive FU540 Support
Quoted 9 lines · Andreas Schwab
Quoted 3 lines · Anup Patel
This is because we don't have place to put U-Boot environment variables as of now on Unleashed board. This will be solved once we have SPI driver and
SPI_MMCdriver for Unleased board.Isn't the MAC part of the initial DT?
My understanding is that U-Boot should fixup the DT using the <ethaddr> environment value, before jumping to Linux.
Regards,
Bin
v7 cover SiFive FU540 Support
Quoted 8 lines · Bin Meng
Quoted 7 lines · Andreas Schwab
Quoted 3 lines · Anup Patel
This is because we don't have place to put U-Boot environment variables as of now on Unleashed board. This will be solved once we have SPI driver and
SPI_MMCdriver for Unleased board.
Quoted 5 lines
Quoted 2 lines
Isn't the MAC part of the initial DT?
My understanding is that U-Boot should fixup the DT using the <ethaddr> environment value, before jumping to Linux.
But where does it get the env var from? Why would it need to modify the MAC?
Andreas.
Signature · 3 lines
Andreas Schwab, SUSE Labs, schwab at suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
v7 cover SiFive FU540 Support
Quoted 11 lines · Andreas Schwab
Quoted 8 lines · Bin Meng
Quoted 7 lines · Andreas Schwab
Quoted 3 lines · Anup Patel
This is because we don't have place to put U-Boot environment variables as of now on Unleashed board. This will be solved once we have SPI driver and
SPI_MMCdriver for Unleased board.
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
Isn't the MAC part of the initial DT?
My understanding is that U-Boot should fixup the DT using the <ethaddr> environment value, before jumping to Linux.
But where does it get the env var from? Why would it need to modify the MAC?
The env var is stored in whatever supported media in U-Boot. Not like PCI NICs which normally have EEPROM to store pre-flashed MAC address by their vendors, for most embedded network controllers in the SoC, normally there is no hardware provided mechanism to ensure a unique MAC address, instead it relies on software to program one to the hardware before bringing it up. In the U-Boot case, it's the <ethaddr> env.
Regards,
Bin
v7 cover SiFive FU540 Support
Quoted 16 lines · Bin Meng
Quoted 8 lines · Andreas Schwab
Quoted 6 lines · Bin Meng
Quoted 5 lines · Andreas Schwab
Quoted 3 lines · Anup Patel
This is because we don't have place to put U-Boot environment variables as of now on Unleashed board. This will be solved once we have SPI driver and
SPI_MMCdriver for Unleased board.Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Isn't the MAC part of the initial DT?
My understanding is that U-Boot should fixup the DT using the <ethaddr> environment value, before jumping to Linux.
But where does it get the env var from? Why would it need to modify the MAC?
Quoted 7 lines
The env var is stored in whatever supported media in U-Boot. Not like PCI NICs which normally have EEPROM to store pre-flashed MAC address by their vendors, for most embedded network controllers in the SoC, normally there is no hardware provided mechanism to ensure a unique MAC address, instead it relies on software to program one to the hardware before bringing it up. In the U-Boot case, it's the <ethaddr> env.
Yes, and U-Boot can read it from the DT to populate ethaddr if its upper layer does provide a stable MAC address through DT.
Alex
v7 cover SiFive FU540 Support
In reply to Bin MengQuoted 6 lines · Bin Meng
The env var is stored in whatever supported media in U-Boot. Not like PCI NICs which normally have EEPROM to store pre-flashed MAC address by their vendors, for most embedded network controllers in the SoC, normally there is no hardware provided mechanism to ensure a unique MAC address, instead it relies on software to program one to the hardware before bringing it up.
On the Hifive the MAC is part of the initial DT, so there is no need to use a secondary store.
Andreas.
Signature · 3 lines
Andreas Schwab, SUSE Labs, schwab at suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
v7 cover SiFive FU540 Support
Quoted 10 lines · Andreas Schwab
Quoted 6 lines · Bin Meng
The env var is stored in whatever supported media in U-Boot. Not like PCI NICs which normally have EEPROM to store pre-flashed MAC address by their vendors, for most embedded network controllers in the SoC, normally there is no hardware provided mechanism to ensure a unique MAC address, instead it relies on software to program one to the hardware before bringing it up.
Quoted 3 lines
On the Hifive the MAC is part of the initial DT, so there is no need to use a secondary store.
So for the HiFive board, who is supposed to guarantee the uniqueness of the MAC address? Does SiFive program DT with different MAC to every board they shipped? If so, we can just read "local-mac-address" from DT in U-Boot.
Regards,
Bin
v7 cover SiFive FU540 Support
Quoted 12 lines · Bin Meng
Quoted 10 lines · Andreas Schwab
Quoted 6 lines · Bin Meng
The env var is stored in whatever supported media in U-Boot. Not like PCI NICs which normally have EEPROM to store pre-flashed MAC address by their vendors, for most embedded network controllers in the SoC, normally there is no hardware provided mechanism to ensure a unique MAC address, instead it relies on software to program one to the hardware before bringing it up.
Quoted 8 lines
Quoted 3 lines
On the Hifive the MAC is part of the initial DT, so there is no need to use a secondary store.
So for the HiFive board, who is supposed to guarantee the uniqueness of the MAC address? Does SiFive program DT with different MAC to every board they shipped? If so, we can just read "local-mac-address" from DT in U-Boot.
General practice (atlease what I have seen on few boards), is that board will have unique MAC address printed/labelled for each Ethernet port. We can just set-and-save "ethaddr" U-Boot env variable based on MAC address printed on board.
Unfortunately, I was not able to find printed MAC address on Unleashed board.
Regards,
Anup
v7 cover SiFive FU540 Support
Quoted 6 lines · Anup Patel
General practice (atlease what I have seen on few boards), is that board will have unique MAC address printed/labelled for each Ethernet port. We can just set-and-save "ethaddr" U-Boot env variable based on MAC address printed on board.
Unfortunately, I was not able to find printed MAC address on Unleashed board.
It is derived from the serial number.
Andreas.
Signature · 3 lines
Andreas Schwab, SUSE Labs, schwab at suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
Auer
v7 cover SiFive FU540 Support
Quoted 10 lines · Andreas Schwab
Quoted 8 lines · Anup Patel
General practice (atlease what I have seen on few boards), is that board
will have unique MAC address printed/labelled for each Ethernet port. We
can just set-and-save "ethaddr" U-Boot env variable based on MAC address
printed on board.
Quoted 5 lines
Quoted 2 lines
Unfortunately, I was not able to find printed MAC address on Unleashed board.
It is derived from the serial number.
Here is the relevant code from the FSBL [1]. The serial number is stored in OTP memory.
There's also a U-Boot driver available [2], but I haven't tested or looked at it in detail.
[1]:
https://github.com/sifive/freedom-u540-c000-bootloader/blob/master/fsbl/main.c#L377
[2]:
https://github.com/tmagik/HiFive_U-Boot/commit/6d842765de142b61f847852da7a9ce0d081d770c
Thanks,
Lukas
v7 cover SiFive FU540 Support
In reply to Bin MengQuoted 11 lines · Bin Meng
Quoted 10 lines · Andreas Schwab
Quoted 6 lines · Bin Meng
The env var is stored in whatever supported media in U-Boot. Not like PCI NICs which normally have EEPROM to store pre-flashed MAC address by their vendors, for most embedded network controllers in the SoC, normally there is no hardware provided mechanism to ensure a unique MAC address, instead it relies on software to program one to the hardware before bringing it up.
Quoted 8 lines
Quoted 3 lines
On the Hifive the MAC is part of the initial DT, so there is no need to use a secondary store.
So for the HiFive board, who is supposed to guarantee the uniqueness of the MAC address? Does SiFive program DT with different MAC to every board they shipped? If so, we can just read "local-mac-address" from DT in U-Boot.
The DT is supplied via SD card, just like U-Boot is. So it's up to the user to modify the DT and ensure that it contains a unique MAC address.
Alex
v7 cover SiFive FU540 Support
Quoted 1 line · Alexander Graf
The DT is supplied via SD card
That's not true by default. It is part of the FSBL, I think.
Andreas.
Signature · 3 lines
Andreas Schwab, SUSE Labs, schwab at suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
v7 cover SiFive FU540 Support
In reply to Anup PatelHi Anup,
Quoted 10 lines · Anup Patel
This patchset adds SiFive Freedom Unleashed (FU540) support to RISC-V U-Boot.
The patches are based upon latest U-Boot source tree
(git://git.denx.de/u-boot.git) at commit iddbe70c7d4e3d5c705a98d82952e05a591efd0683All drivers namely: SiFive PRCI, SiFive Serial, and Cadance MACB Ethernet work fine on actual SiFive Unleashed board and QEMU
sifive_umachine.
I tested u-boot networking (DHCP, TFTP) on my desk with a gigE switch and it worked fine. Then, I moved it to a lab with a 100Mb switch, and DHCP doesn't work anymore.
Can you do some sanity testing with a 100Mb switch?
Kevin
v7 cover SiFive FU540 Support
Quoted 11 lines · Kevin Hilman
Hi Anup,
Quoted 7 lines · Anup Patel
This patchset adds SiFive Freedom Unleashed (FU540) support to RISC-V U-Boot.
The patches are based upon latest U-Boot source tree
(git://git.denx.de/u-boot.git) at commit iddbe70c7d4e3d5c705a98d82952e05a591efd0683
Quoted 7 lines
Quoted 3 lines
All drivers namely: SiFive PRCI, SiFive Serial, and Cadance MACB Ethernet work fine on actual SiFive Unleashed board and QEMU
sifive_umachine.I tested u-boot networking (DHCP, TFTP) on my desk with a gigE switch and it worked fine. Then, I moved it to a lab with a 100Mb switch, and DHCP doesn't work anymore.
And to be clear, neither does TFTP if setting static ipaddr/netmask/gatewayip etc.
Kevin
v7 cover SiFive FU540 Support
Quoted 18 lines · Kevin Hilman
Quoted 15 lines · Kevin Hilman
Hi Anup,
Quoted 10 lines · Anup Patel
This patchset adds SiFive Freedom Unleashed (FU540) support to RISC-V U-Boot.
The patches are based upon latest U-Boot source tree
(git://git.denx.de/u-boot.git) at commit iddbe70c7d4e3d5c705a98d82952e05a591efd0683All drivers namely: SiFive PRCI, SiFive Serial, and Cadance MACB Ethernet work fine on actual SiFive Unleashed board and QEMU
sifive_umachine.
Quoted 6 lines
Quoted 3 lines
I tested u-boot networking (DHCP, TFTP) on my desk with a gigE switch and it worked fine. Then, I moved it to a lab with a 100Mb switch, and DHCP doesn't work anymore.
And to be clear, neither does TFTP if setting static ipaddr/netmask/gatewayip etc.
Sound to me a bug of the GEM driver on SiFive FU540 board.
Regards,
Bin
v7 cover SiFive FU540 Support
Quoted 19 lines · bmeng.cn at gmail.com
Quoted 18 lines · Kevin Hilman
Quoted 15 lines · Kevin Hilman
Hi Anup,
Quoted 10 lines · Anup Patel
This patchset adds SiFive Freedom Unleashed (FU540) support to RISC-V U-Boot.
The patches are based upon latest U-Boot source tree
(git://git.denx.de/u-boot.git) at commit iddbe70c7d4e3d5c705a98d82952e05a591efd0683All drivers namely: SiFive PRCI, SiFive Serial, and Cadance MACB Ethernet work fine on actual SiFive Unleashed board and QEMU
sifive_umachine.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I tested u-boot networking (DHCP, TFTP) on my desk with a gigE switch and it worked fine. Then, I moved it to a lab with a 100Mb switch, and DHCP doesn't work anymore.
And to be clear, neither does TFTP if setting static ipaddr/netmask/gatewayip etc.
Sound to me a bug of the GEM driver on SiFive FU540 board.
It looks to me like u-boot is missing a driver for the GEM clockmux in the FU540. This is necessary to switch between the clock for 1G operation and 100M operation. Without this you'll just get whatever clock was set up by the previous boot stage (or even worse, reset).
v7 cover SiFive FU540 Support
Palmer, Anup,
Quoted 28 lines · Palmer Dabbelt
Quoted 26 lines · bmeng.cn at gmail.com
Quoted 24 lines · Kevin Hilman
Quoted 11 lines · Kevin Hilman
Hi Anup,
Quoted 7 lines · Anup Patel
This patchset adds SiFive Freedom Unleashed (FU540) support to RISC-V U-Boot.
The patches are based upon latest U-Boot source tree
(git://git.denx.de/u-boot.git) at commit iddbe70c7d4e3d5c705a98d82952e05a591efd0683Quoted 7 lines
Quoted 3 lines
All drivers namely: SiFive PRCI, SiFive Serial, and Cadance MACB Ethernet work fine on actual SiFive Unleashed board and QEMU
sifive_umachine.I tested u-boot networking (DHCP, TFTP) on my desk with a gigE switch and it worked fine. Then, I moved it to a lab with a 100Mb switch, and DHCP doesn't work anymore.
And to be clear, neither does TFTP if setting static ipaddr/netmask/gatewayip etc.
Quoted 6 lines
Quoted 1 line
Sound to me a bug of the GEM driver on SiFive FU540 board.
It looks to me like u-boot is missing a driver for the GEM clockmux in the FU540. This is necessary to switch between the clock for 1G operation and 100M operation. Without this you'll just get whatever clock was set up by the previous boot stage (or even worse, reset).
Anyone know if this is fixed in u-boot yet? I've yet to try the latest mainline u-boot, but will if if it's expected to work.
Kevin
v7 cover SiFive FU540 Support
Quoted 33 lines · Kevin Hilman
Palmer, Anup,
Quoted 30 lines · Palmer Dabbelt
Quoted 27 lines · bmeng.cn at gmail.com
Quoted 18 lines · Kevin Hilman
Quoted 15 lines · Kevin Hilman
Hi Anup,
Quoted 10 lines · Anup Patel
This patchset adds SiFive Freedom Unleashed (FU540) support to RISC-V U-Boot.
The patches are based upon latest U-Boot source tree
(git://git.denx.de/u-boot.git) at commit iddbe70c7d4e3d5c705a98d82952e05a591efd0683All drivers namely: SiFive PRCI, SiFive Serial, and Cadance MACB Ethernet work fine on actual SiFive Unleashed board and QEMU
sifive_umachine.Quoted 6 lines
Quoted 3 lines
I tested u-boot networking (DHCP, TFTP) on my desk with a gigE switch and it worked fine. Then, I moved it to a lab with a 100Mb switch, and DHCP doesn't work anymore.
And to be clear, neither does TFTP if setting static ipaddr/netmask/gatewayip etc.
Sound to me a bug of the GEM driver on SiFive FU540 board.
Quoted 8 lines
Quoted 4 lines
It looks to me like u-boot is missing a driver for the GEM clockmux in the FU540. This is necessary to switch between the clock for 1G operation and 100M operation. Without this you'll just get whatever clock was set up by the previous boot stage (or even worse, reset).
Anyone know if this is fixed in u-boot yet? I've yet to try the latest mainline u-boot, but will if if it's expected to work.
I have not seen a GEM driver for FU540 board. So I guess it is not fixed it. Is it a blocker for setting up kernelCI for RISC-V ?
Regards,
Atish
Quoted 6 lines
Kevin
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
v7 cover SiFive FU540 Support
Quoted 39 lines · Atish Patra
Quoted 38 lines · Kevin Hilman
Palmer, Anup,
Quoted 34 lines · Palmer Dabbelt
Quoted 19 lines · bmeng.cn at gmail.com
Quoted 18 lines · Kevin Hilman
Quoted 15 lines · Kevin Hilman
Hi Anup,
Quoted 10 lines · Anup Patel
This patchset adds SiFive Freedom Unleashed (FU540) support to RISC-V U-Boot.
The patches are based upon latest U-Boot source tree
(git://git.denx.de/u-boot.git) at commit iddbe70c7d4e3d5c705a98d82952e05a591efd0683All drivers namely: SiFive PRCI, SiFive Serial, and Cadance MACB Ethernet work fine on actual SiFive Unleashed board and QEMU
sifive_umachine.Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I tested u-boot networking (DHCP, TFTP) on my desk with a gigE switch and it worked fine. Then, I moved it to a lab with a 100Mb switch, and DHCP doesn't work anymore.
And to be clear, neither does TFTP if setting static ipaddr/netmask/gatewayip etc.
Sound to me a bug of the GEM driver on SiFive FU540 board.
It looks to me like u-boot is missing a driver for the GEM clockmux in the FU540. This is necessary to switch between the clock for 1G operation and 100M operation. Without this you'll just get whatever clock was set up by the previous boot stage (or even worse, reset).
Quoted 6 lines
Quoted 3 lines
Anyone know if this is fixed in u-boot yet? I've yet to try the latest mainline u-boot, but will if if it's expected to work.
I have not seen a GEM driver for FU540 board. So I guess it is not fixed it. Is it a blocker for setting up kernelCI for RISC-V ?
Not really, that's only one of the remaining issue. For now, I have connected it to a gigE switch, so u-boot networking is working.
But, the bigger blocker for kernelCI right now is not having out-of-the-box mainline support. Mainline is still missing a serial driver, and a handful of Kconfig options in the default defconfig to make things boot[1].
If I use the 'v5.1-rc4_unleashed' from your github, along with my kconfig fragment[1], things are working well.
But in order to automate this for kernelCI, we need all of that upstream.
Kevin
[1] This is the config fragment I'm adding to the default defconfig in mainline. I'm not exactly sure which ones are absolutely need for basic boot.
CONFIG_SERIAL_SIFIVE=yCONFIG_SERIAL_SIFIVE_CONSOLE=yCONFIG_SIFIVE_PLIC=yCONFIG_SPI=yCONFIG_SPI_SIFIVE=yCONFIG_GPIOLIB=yCONFIG_GPIO_SIFIVE=yCONFIG_PWM_SIFIVE=yCONFIG_CLK_U54_PRCI=yCONFIG_CLK_GEMGXL_MGMT=y
v7 cover SiFive FU540 Support
Quoted 56 lines · Kevin Hilman
Quoted 39 lines · Atish Patra
Quoted 38 lines · Kevin Hilman
Palmer, Anup,
Quoted 34 lines · Palmer Dabbelt
Quoted 19 lines · bmeng.cn at gmail.com
Quoted 18 lines · Kevin Hilman
Quoted 15 lines · Kevin Hilman
Hi Anup,
Quoted 10 lines · Anup Patel
This patchset adds SiFive Freedom Unleashed (FU540) support to RISC-V U-Boot.
The patches are based upon latest U-Boot source tree
(git://git.denx.de/u-boot.git) at commit iddbe70c7d4e3d5c705a98d82952e05a591efd0683All drivers namely: SiFive PRCI, SiFive Serial, and Cadance MACB Ethernet work fine on actual SiFive Unleashed board and QEMU
sifive_umachine.Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I tested u-boot networking (DHCP, TFTP) on my desk with a gigE switch and it worked fine. Then, I moved it to a lab with a 100Mb switch, and DHCP doesn't work anymore.
And to be clear, neither does TFTP if setting static ipaddr/netmask/gatewayip etc.
Sound to me a bug of the GEM driver on SiFive FU540 board.
It looks to me like u-boot is missing a driver for the GEM clockmux in the FU540. This is necessary to switch between the clock for 1G operation and 100M operation. Without this you'll just get whatever clock was set up by the previous boot stage (or even worse, reset).
Quoted 6 lines
Quoted 3 lines
Anyone know if this is fixed in u-boot yet? I've yet to try the latest mainline u-boot, but will if if it's expected to work.
I have not seen a GEM driver for FU540 board. So I guess it is not fixed it. Is it a blocker for setting up kernelCI for RISC-V ?
Not really, that's only one of the remaining issue. For now, I have connected it to a gigE switch, so u-boot networking is working.
But, the bigger blocker for kernelCI right now is not having out-of-the-box mainline support. Mainline is still missing a serial driver, and a handful of
Kconfigoptions in the default defconfig to make things boot[1].
Quoted 6 lines
If I use the 'v5.1-rc4_unleashed' from your github, along with my kconfig fragment[1], things are working well.
But in order to automate this for kernelCI, we need all of that upstream.
Yeah. I agree. We need upstream drivers sooner than later. I believe SiFive Team (Paul & co) are working on this.
He recently sent updated version of driver patches to the linux-riscv mailing list.
Quoted 6 lines
Kevin
[1] This is the config fragment I'm adding to the default defconfig in mainline. I'm not exactly sure which ones are absolutely need for basic boot.
Quoted 11 lines
CONFIG_SERIAL_SIFIVE=yCONFIG_SERIAL_SIFIVE_CONSOLE=yCONFIG_SIFIVE_PLIC=yCONFIG_SPI=yCONFIG_SPI_SIFIVE=yCONFIG_GPIOLIB=yCONFIG_GPIO_SIFIVE=yCONFIG_PWM_SIFIVE=yCONFIG_CLK_U54_PRCI=yCONFIG_CLK_GEMGXL_MGMT=y
My working config has enabled all of the above except CONFIG_PWM_SIFIVE. I have not played around the config that much to find out absolute minimum config. So this may not be the answer you are looking for :).
Regards,
Atish
v7 cover SiFive FU540 Support
Quoted 60 lines · Atish Patra
Quoted 59 lines · Kevin Hilman
Quoted 39 lines · Atish Patra
Quoted 38 lines · Kevin Hilman
Palmer, Anup,
Quoted 34 lines · Palmer Dabbelt
Quoted 19 lines · bmeng.cn at gmail.com
Quoted 18 lines · Kevin Hilman
Quoted 15 lines · Kevin Hilman
Hi Anup,
Quoted 10 lines · Anup Patel
This patchset adds SiFive Freedom Unleashed (FU540) support to RISC-V U-Boot.
The patches are based upon latest U-Boot source tree
(git://git.denx.de/u-boot.git) at commit iddbe70c7d4e3d5c705a98d82952e05a591efd0683All drivers namely: SiFive PRCI, SiFive Serial, and Cadance MACB Ethernet work fine on actual SiFive Unleashed board and QEMU
sifive_umachine.Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I tested u-boot networking (DHCP, TFTP) on my desk with a gigE switch and it worked fine. Then, I moved it to a lab with a 100Mb switch, and DHCP doesn't work anymore.
And to be clear, neither does TFTP if setting static ipaddr/netmask/gatewayip etc.
Sound to me a bug of the GEM driver on SiFive FU540 board.
It looks to me like u-boot is missing a driver for the GEM clockmux in the FU540. This is necessary to switch between the clock for 1G operation and 100M operation. Without this you'll just get whatever clock was set up by the previous boot stage (or even worse, reset).
Quoted 6 lines
Quoted 3 lines
Anyone know if this is fixed in u-boot yet? I've yet to try the latest mainline u-boot, but will if if it's expected to work.
I have not seen a GEM driver for FU540 board. So I guess it is not fixed it. Is it a blocker for setting up kernelCI for RISC-V ?
Not really, that's only one of the remaining issue. For now, I have connected it to a gigE switch, so u-boot networking is working.
But, the bigger blocker for kernelCI right now is not having out-of-the-box mainline support. Mainline is still missing a serial driver, and a handful of
Kconfigoptions in the default defconfig to make things boot[1].If I use the 'v5.1-rc4_unleashed' from your github, along with my kconfig fragment[1], things are working well.
Quoted 8 lines
Quoted 3 lines
But in order to automate this for kernelCI, we need all of that upstream.
Yeah. I agree. We need upstream drivers sooner than later. I believe SiFive Team (Paul & co) are working on this.
He recently sent updated version of driver patches to the linux-riscv mailing list.
Yes, I'm trying to test all of those (hence our other discussion on the DT thread)
Quoted 16 lines
Quoted 4 lines
[1] This is the config fragment I'm adding to the default defconfig in mainline. I'm not exactly sure which ones are absolutely need for basic boot.
Quoted 11 lines
CONFIG_SERIAL_SIFIVE=yCONFIG_SERIAL_SIFIVE_CONSOLE=yCONFIG_SIFIVE_PLIC=yCONFIG_SPI=yCONFIG_SPI_SIFIVE=yCONFIG_GPIOLIB=yCONFIG_GPIO_SIFIVE=yCONFIG_PWM_SIFIVE=yCONFIG_CLK_U54_PRCI=yCONFIG_CLK_GEMGXL_MGMT=y
Quoted 3 lines
My working config has enabled all of the above except
CONFIG_PWM_SIFIVE. I have not played around the config that much to find out absolute minimum config. So this may not be the answer you are looking for :).
At least for kernelCI, we'll need to figure that out and get it upstream if we want to boot test these.
Kevin
v7 cover SiFive FU540 Support
Quoted 91 lines · Kevin Hilman
Quoted 60 lines · Atish Patra
Quoted 59 lines · Kevin Hilman
Quoted 39 lines · Atish Patra
Quoted 38 lines · Kevin Hilman
Palmer, Anup,
Quoted 34 lines · Palmer Dabbelt
Quoted 19 lines · bmeng.cn at gmail.com
Quoted 18 lines · Kevin Hilman
Quoted 15 lines · Kevin Hilman
Hi Anup,
Quoted 10 lines · Anup Patel
This patchset adds SiFive Freedom Unleashed (FU540) support to RISC-V U-Boot.
The patches are based upon latest U-Boot source tree
(git://git.denx.de/u-boot.git) at commit iddbe70c7d4e3d5c705a98d82952e05a591efd0683All drivers namely: SiFive PRCI, SiFive Serial, and Cadance MACB Ethernet work fine on actual SiFive Unleashed board and QEMU
sifive_umachine.Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I tested u-boot networking (DHCP, TFTP) on my desk with a gigE switch and it worked fine. Then, I moved it to a lab with a 100Mb switch, and DHCP doesn't work anymore.
And to be clear, neither does TFTP if setting static ipaddr/netmask/gatewayip etc.
Sound to me a bug of the GEM driver on SiFive FU540 board.
It looks to me like u-boot is missing a driver for the GEM clockmux in the FU540. This is necessary to switch between the clock for 1G operation and 100M operation. Without this you'll just get whatever clock was set up by the previous boot stage (or even worse, reset).
Quoted 6 lines
Quoted 3 lines
Anyone know if this is fixed in u-boot yet? I've yet to try the latest mainline u-boot, but will if if it's expected to work.
I have not seen a GEM driver for FU540 board. So I guess it is not fixed it. Is it a blocker for setting up kernelCI for RISC-V ?
Not really, that's only one of the remaining issue. For now, I have connected it to a gigE switch, so u-boot networking is working.
But, the bigger blocker for kernelCI right now is not having out-of-the-box mainline support. Mainline is still missing a serial driver, and a handful of
Kconfigoptions in the default defconfig to make things boot[1].If I use the 'v5.1-rc4_unleashed' from your github, along with my kconfig fragment[1], things are working well.
Quoted 8 lines
Quoted 3 lines
But in order to automate this for kernelCI, we need all of that upstream.
Yeah. I agree. We need upstream drivers sooner than later. I believe SiFive Team (Paul & co) are working on this.
He recently sent updated version of driver patches to the linux-riscv mailing list.
Yes, I'm trying to test all of those (hence our other discussion on the DT thread)
Quoted 16 lines
Quoted 15 lines
[1] This is the config fragment I'm adding to the default defconfig in mainline. I'm not exactly sure which ones are absolutely need for basic boot.
CONFIG_SERIAL_SIFIVE=yCONFIG_SERIAL_SIFIVE_CONSOLE=yCONFIG_SIFIVE_PLIC=yCONFIG_SPI=yCONFIG_SPI_SIFIVE=yCONFIG_GPIOLIB=yCONFIG_GPIO_SIFIVE=yCONFIG_PWM_SIFIVE=yCONFIG_CLK_U54_PRCI=yCONFIG_CLK_GEMGXL_MGMT=y
Quoted 6 lines
Quoted 3 lines
My working config has enabled all of the above except
CONFIG_PWM_SIFIVE. I have not played around the config that much to find out absolute minimum config. So this may not be the answer you are looking for :).At least for kernelCI, we'll need to figure that out and get it upstream if we want to boot test these.
Oh, and one other u-boot question.
Any reason you didn't enable booti support in riscv u-boot? That would allow you to boot the Image (or Image.gz) directly, instead of the need to create a special image with u-boot header (uImage)
Kevin
v7 cover SiFive FU540 Support
Quoted 96 lines · Kevin Hilman
Quoted 95 lines · Kevin Hilman
Quoted 60 lines · Atish Patra
Quoted 59 lines · Kevin Hilman
Quoted 39 lines · Atish Patra
Quoted 38 lines · Kevin Hilman
Palmer, Anup,
Quoted 34 lines · Palmer Dabbelt
Quoted 19 lines · bmeng.cn at gmail.com
Quoted 18 lines · Kevin Hilman
Quoted 15 lines · Kevin Hilman
Hi Anup,
Quoted 10 lines · Anup Patel
This patchset adds SiFive Freedom Unleashed (FU540) support to RISC-V U-Boot.
The patches are based upon latest U-Boot source tree
(git://git.denx.de/u-boot.git) at commit iddbe70c7d4e3d5c705a98d82952e05a591efd0683All drivers namely: SiFive PRCI, SiFive Serial, and Cadance MACB Ethernet work fine on actual SiFive Unleashed board and QEMU
sifive_umachine.Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I tested u-boot networking (DHCP, TFTP) on my desk with a gigE switch and it worked fine. Then, I moved it to a lab with a 100Mb switch, and DHCP doesn't work anymore.
And to be clear, neither does TFTP if setting static ipaddr/netmask/gatewayip etc.
Sound to me a bug of the GEM driver on SiFive FU540 board.
It looks to me like u-boot is missing a driver for the GEM clockmux in the FU540. This is necessary to switch between the clock for 1G operation and 100M operation. Without this you'll just get whatever clock was set up by the previous boot stage (or even worse, reset).
Quoted 6 lines
Quoted 3 lines
Anyone know if this is fixed in u-boot yet? I've yet to try the latest mainline u-boot, but will if if it's expected to work.
I have not seen a GEM driver for FU540 board. So I guess it is not fixed it. Is it a blocker for setting up kernelCI for RISC-V ?
Not really, that's only one of the remaining issue. For now, I have connected it to a gigE switch, so u-boot networking is working.
But, the bigger blocker for kernelCI right now is not having out-of-the-box mainline support. Mainline is still missing a serial driver, and a handful of
Kconfigoptions in the default defconfig to make things boot[1].If I use the 'v5.1-rc4_unleashed' from your github, along with my kconfig fragment[1], things are working well.
Quoted 8 lines
Quoted 3 lines
But in order to automate this for kernelCI, we need all of that upstream.
Yeah. I agree. We need upstream drivers sooner than later. I believe SiFive Team (Paul & co) are working on this.
He recently sent updated version of driver patches to the linux-riscv mailing list.
Yes, I'm trying to test all of those (hence our other discussion on the DT thread)
Quoted 19 lines
Quoted 4 lines
[1] This is the config fragment I'm adding to the default defconfig in mainline. I'm not exactly sure which ones are absolutely need for basic boot.
Quoted 11 lines
CONFIG_SERIAL_SIFIVE=yCONFIG_SERIAL_SIFIVE_CONSOLE=yCONFIG_SIFIVE_PLIC=yCONFIG_SPI=yCONFIG_SPI_SIFIVE=yCONFIG_GPIOLIB=yCONFIG_GPIO_SIFIVE=yCONFIG_PWM_SIFIVE=yCONFIG_CLK_U54_PRCI=yCONFIG_CLK_GEMGXL_MGMT=yMy working config has enabled all of the above except
CONFIG_PWM_SIFIVE. I have not played around the config that much to find out absolute minimum config. So this may not be the answer you are looking for :).
Quoted 9 lines
Quoted 2 lines
At least for kernelCI, we'll need to figure that out and get it upstream if we want to boot test these.
Oh, and one other u-boot question.
Any reason you didn't enable
bootisupport in riscv u-boot? That would allow you to boot the Image (or Image.gz) directly, instead of the need to create a special image with u-boot header (uImage)
Yes. I am currently working on booti support. I should have a working patch by next week.
Regards,
Atish
Quoted 2 lines
Kevin