Add FU740 chip and HiFive Unmatched board support
Subsystems (6)
v11 cover Add FU740 chip and HiFive Unmatched board support
This patch set is to add SiFive fu740 chip and HiFive Unmatched board support. Patches are split into several parts:
- [PATCH v11 1/8] support for fu740 cpu
- [PATCH v11 2/8] support for fu740 clk driver
- [PATCH v11 3/8] rename and support for fu740 ram driver
- [PATCH v11 4/8] add pcie driver
- [PATCH v11 5/8] dts for SiFive fu740
- [PATCH v11 6/8] dts for SiFive Unmatched board
- [PATCH v11 7/8] add Unmatched board support
- [PATCH v11 8/8] clear feature disable CSR
Description
- For fu740 cpu support, reuse most of fu540 cpu.
- For prci driver, add one abstract layer to separate fu540 and fu740. Move orignal fu540 code to separate files.
- For pcie driver, it depends on gpio, prci, clk and reset drivers to do init&reset works. Also based on pcie_dw_common.c
- Align with Linux DT file.
Tests and patch checks
- Able to boot both unmatched and unleashed boards.
- PCIe tests
. M.2 NVMe SSD
. e1000 compatibale ethernet adapter (ping&tftpboot) . pci-to-usb adapter(usb mass storage)
- checkpatch is performed. To keep code derived from other boards the same.
Changlogs
- v11
. squash 'binman change' patch into [PATH v11 6/8] and
[PATCH v11 7/8]
- v10
. on top of 2 patchset below,
http://patchwork.ozlabs.org/project/uboot/patch/20210511120412.25065-1-bmeng.cn at gmail.com/
http://patchwork.ozlabs.org/project/uboot/list/?series=242992
. appends patch 'clear feature disable CSRs' and 'binman change for
unmatched'
- v9
. applied http://patchwork.ozlabs.org/project/uboot/patch/20210511120412.25065-1-bmeng.cn at gmail.com/ . append clear feature disable CSR patch to the last
- v8
. Add #include <asm/global_data.h> back to sifive_clint.c in
[PATCH v8 1/7]
. Remove unused CLK_SIFIVE_FU540_PRCI from Kconfig [PATCH v8 2/8]
and remove CONFIG_CLK_SIFIVE_PRCI=y from unleashed config in
[PATCH v8 7/7]
. Remove ECAM compatible string to align with Linux pcie driver
and add Reviewed-by to [PATCH v8 4/7]
. Drop last patch [PATCH v7 8/8] for drivers/net/macb.c and use
the same compatible string, 'sifive,fu540-c000-gem', to align with
Linux driver.
- v7
. Rebase to latest master branch
. Moved dts for fu740 patch [v6 1/7] to [v7 5/8] and seperate dts of
Unmatched board from [v6 6/7] into [v7 6/8]
. Applied PCIe refactoring patch to base on the common code in
pcie_dw_common.c
- v6
. Remove redundant DT string for 1.2GHz CPU clock and squash to
[1/7]
- v5
. Fix unleashed build error in patch [6/8]
. Append one more set for 1.2GHz CPU speed
. Add "#include <asm/global_data.h>" back to sifive_ddr.c
. Add Reviewed-by to [4/8] and [7/8]
- v4
. fixed incorrect file name in ./board/sifive/unmatched/Makefile
. fixed link in doc/board/sifive/index.rst, passed 'make htmldocs'
- v3
. Rebase to unleashed rename v2 patch
. Rename
doc/board/sifive/unmatched.rst
board/sifive/unmatched/unmatched.c
. Fix tail whitespace
. Add 'git mv' info to ram driver and merge patch back to one
. Add comment to macb driver for PLL hardware quirk
. Add reviewed-by to patch [6/7]
. Add 'gpio-poweroff' node for upcoming opensbi integration
- v2
. Rebase to unleashed rename patch
. remove unnessaary fu540 changes
. split ram driver patch into 2 to keep 'git mv' info
. use a shorter name for unmatched support
. Remove redundant&incorrect temperature-sensor in DT
. Remove unnecessary USB EHCI & OHCI from defconfig
. Revised fu740 doc
. Fixed year of copyright
. Add reviewed-by received in v1 patch
Green Wan (8):
riscv: cpu: fu740: Add support for cpu fu740
drivers: clk: add fu740 support
drivers: ram: sifive: rename fu540_ddr and add fu740 support
drivers: pci: add pcie support for fu740
riscv: dts: add fu740 support
riscv: dts: add SiFive Unmatched board support
board: sifive: add HiFive Unmatched board support
riscv: cpu: fu740: clear feature disable CSR
arch/riscv/Kconfig | 5 +
arch/riscv/cpu/fu540/Kconfig | 2 +-
arch/riscv/cpu/fu740/Kconfig | 37 +
arch/riscv/cpu/fu740/Makefile | 12 +
arch/riscv/cpu/fu740/cache.c | 55 +
arch/riscv/cpu/fu740/cpu.c | 22 +
arch/riscv/cpu/fu740/dram.c | 38 +
arch/riscv/cpu/fu740/spl.c | 38 +
arch/riscv/dts/Makefile | 1 +
arch/riscv/dts/fu740-c000-u-boot.dtsi | 105 ++
arch/riscv/dts/fu740-c000.dtsi | 329 ++++
.../dts/fu740-hifive-unmatched-a00-ddr.dtsi | 1489 +++++++++++++++++
.../dts/hifive-unmatched-a00-u-boot.dtsi | 41 +
arch/riscv/dts/hifive-unmatched-a00.dts | 259 +++
arch/riscv/include/asm/arch-fu740/cache.h | 14 +
arch/riscv/include/asm/arch-fu740/clk.h | 14 +
arch/riscv/include/asm/arch-fu740/gpio.h | 38 +
arch/riscv/include/asm/arch-fu740/reset.h | 13 +
arch/riscv/include/asm/arch-fu740/spl.h | 14 +
board/sifive/unleashed/Kconfig | 1 +
board/sifive/unmatched/Kconfig | 51 +
board/sifive/unmatched/MAINTAINERS | 9 +
board/sifive/unmatched/Makefile | 9 +
board/sifive/unmatched/spl.c | 85 +
board/sifive/unmatched/unmatched.c | 24 +
common/spl/Kconfig | 4 +-
configs/sifive_unmatched_defconfig | 54 +
doc/board/sifive/index.rst | 1 +
doc/board/sifive/unmatched.rst | 536 ++++++
drivers/clk/sifive/Kconfig | 8 +-
drivers/clk/sifive/Makefile | 4 +-
drivers/clk/sifive/fu540-prci.c | 769 +--------
drivers/clk/sifive/fu540-prci.h | 22 +
drivers/clk/sifive/fu740-prci.c | 158 ++
drivers/clk/sifive/fu740-prci.h | 22 +
drivers/clk/sifive/sifive-prci.c | 733 ++++++++
drivers/clk/sifive/sifive-prci.h | 323 ++++
drivers/pci/Kconfig | 10 +
drivers/pci/Makefile | 1 +
drivers/pci/pcie_dw_sifive.c | 507 ++++++
drivers/ram/sifive/Kconfig | 8 +-
drivers/ram/sifive/Makefile | 2 +-
.../ram/sifive/{fu540_ddr.c => sifive_ddr.c} | 89 +-
drivers/reset/Kconfig | 2 +-
include/configs/sifive-unmatched.h | 85 +
include/dt-bindings/clock/sifive-fu740-prci.h | 25 +
include/dt-bindings/reset/sifive-fu740-prci.h | 19 +
47 files changed, 5281 insertions(+), 806 deletions(-)
create mode 100644 arch/riscv/cpu/fu740/Kconfig
create mode 100644 arch/riscv/cpu/fu740/Makefile
create mode 100644 arch/riscv/cpu/fu740/cache.c
create mode 100644 arch/riscv/cpu/fu740/cpu.c
create mode 100644 arch/riscv/cpu/fu740/dram.c
create mode 100644 arch/riscv/cpu/fu740/spl.c
create mode 100644 arch/riscv/dts/fu740-c000-u-boot.dtsi
create mode 100644 arch/riscv/dts/fu740-c000.dtsi
create mode 100644 arch/riscv/dts/fu740-hifive-unmatched-a00-ddr.dtsi
create mode 100644 arch/riscv/dts/hifive-unmatched-a00-u-boot.dtsi
create mode 100644 arch/riscv/dts/hifive-unmatched-a00.dts
create mode 100644 arch/riscv/include/asm/arch-fu740/cache.h
create mode 100644 arch/riscv/include/asm/arch-fu740/clk.h
create mode 100644 arch/riscv/include/asm/arch-fu740/gpio.h
create mode 100644 arch/riscv/include/asm/arch-fu740/reset.h
create mode 100644 arch/riscv/include/asm/arch-fu740/spl.h
create mode 100644 board/sifive/unmatched/Kconfig
create mode 100644 board/sifive/unmatched/MAINTAINERS
create mode 100644 board/sifive/unmatched/Makefile
create mode 100644 board/sifive/unmatched/spl.c
create mode 100644 board/sifive/unmatched/unmatched.c
create mode 100644 configs/sifive_unmatched_defconfig
create mode 100644 doc/board/sifive/unmatched.rst
create mode 100644 drivers/clk/sifive/fu540-prci.h
create mode 100644 drivers/clk/sifive/fu740-prci.c
create mode 100644 drivers/clk/sifive/fu740-prci.h
create mode 100644 drivers/clk/sifive/sifive-prci.c
create mode 100644 drivers/clk/sifive/sifive-prci.h
create mode 100644 drivers/pci/pcie_dw_sifive.c
rename drivers/ram/sifive/{fu540_ddr.c => sifive_ddr.c} (81%)
create mode 100644 include/configs/sifive-unmatched.h
create mode 100644 include/dt-bindings/clock/sifive-fu740-prci.h
create mode 100644 include/dt-bindings/reset/sifive-fu740-prci.hSignature · 1 line
2.31.0
PATCH v11 1/8 riscv: cpu: fu740: Add support for cpu fu740
Add SiFive fu740 cpu to support RISC-V arch
--- arch/riscv/Kconfig | 1 + arch/riscv/cpu/fu740/Kconfig | 37 +++++++++++++++ arch/riscv/cpu/fu740/Makefile | 12 +++++ arch/riscv/cpu/fu740/cache.c | 55 +++++++++++++++++++++++ arch/riscv/cpu/fu740/cpu.c | 22 +++++++++ arch/riscv/cpu/fu740/dram.c | 38 ++++++++++++++++ arch/riscv/cpu/fu740/spl.c | 23 ++++++++++ arch/riscv/include/asm/arch-fu740/cache.h | 14 ++++++ arch/riscv/include/asm/arch-fu740/clk.h | 14 ++++++ arch/riscv/include/asm/arch-fu740/gpio.h | 38 ++++++++++++++++ arch/riscv/include/asm/arch-fu740/reset.h | 13 ++++++ arch/riscv/include/asm/arch-fu740/spl.h | 14 ++++++ 12 files changed, 281 insertions(+) create mode 100644 arch/riscv/cpu/fu740/Kconfig create mode 100644 arch/riscv/cpu/fu740/Makefile create mode 100644 arch/riscv/cpu/fu740/cache.c create mode 100644 arch/riscv/cpu/fu740/cpu.c create mode 100644 arch/riscv/cpu/fu740/dram.c create mode 100644 arch/riscv/cpu/fu740/spl.c create mode 100644 arch/riscv/include/asm/arch-fu740/cache.h create mode 100644 arch/riscv/include/asm/arch-fu740/clk.h create mode 100644 arch/riscv/include/asm/arch-fu740/gpio.h create mode 100644 arch/riscv/include/asm/arch-fu740/reset.h create mode 100644 arch/riscv/include/asm/arch-fu740/spl.h
arch/riscv/Kconfig +1 -0
@@ -61,6 +61,7 @@ source "board/sipeed/maix/Kconfig" # platform-specific options below source "arch/riscv/cpu/ax25/Kconfig" source "arch/riscv/cpu/fu540/Kconfig" +source "arch/riscv/cpu/fu740/Kconfig" source "arch/riscv/cpu/generic/Kconfig" # architecture-specific options below
arch/riscv/cpu/fu740/Kconfig new file +37 -0
@@ -0,0 +1,37 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2020-2021 SiFive, Inc +# Pragnesh Patel <[email protected]> + +config SIFIVE_FU740 + bool + select ARCH_EARLY_INIT_R + select RAM + select SPL_RAM if SPL + imply CPU + imply CPU_RISCV + imply RISCV_TIMER if (RISCV_SMODE || SPL_RISCV_SMODE) + imply SPL_SIFIVE_CLINT + imply CMD_CPU + imply SPL_CPU + imply SPL_OPENSBI + imply SPL_LOAD_FIT + imply SMP + imply CLK_SIFIVE + imply CLK_SIFIVE_PRCI + imply SIFIVE_SERIAL + imply MACB + imply MII + imply SPI + imply SPI_SIFIVE + imply MMC + imply MMC_SPI + imply MMC_BROKEN_CD + imply CMD_MMC + imply DM_GPIO + imply SIFIVE_GPIO + imply CMD_GPIO + imply MISC + imply SIFIVE_OTP + imply DM_PWM + imply PWM_SIFIVE
arch/riscv/cpu/fu740/Makefile new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2020-2021 SiFive, Inc +# Pragnesh Patel <[email protected]> + +ifeq ($(CONFIG_SPL_BUILD),y) +obj-y += spl.o +else +obj-y += dram.o +obj-y += cpu.o +obj-y += cache.o +endif
arch/riscv/cpu/fu740/cache.c new file +55 -0
55 lines not on this page · raw message
arch/riscv/cpu/fu740/cpu.c new file +22 -0
@@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2018, Bin Meng <[email protected]> +*/ + +#include <irq_func.h> +#include <asm/cache.h> + +/* +* cleanup_before_linux() is called just before we call linux +* it prepares the processor for linux +* +* we disable interrupt and caches. +*/ +int cleanup_before_linux (void ) +{ +disable_interrupts (); + +cache_flush (); + +return 0 ; +}
arch/riscv/cpu/fu740/dram.c new file +38 -0
@@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2018, Bin Meng <[email protected]> +*/ + +#include <common.h> +#include <fdtdec.h> +#include <init.h> +#include <linux/sizes.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int dram_init (void ) +{ +return fdtdec_setup_mem_size_base (); +} + +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; +}
arch/riscv/cpu/fu740/spl.c new file +23 -0
@@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2020-201 SiFive, Inc +* Pragnesh Patel <[email protected]> +*/ + +#include <dm.h> +#include <log.h> + +int spl_soc_init (void ) +{ +int ret; +struct udevice *dev; + +/* DDR init */ + ret =uclass_get_device (UCLASS_RAM ,0 , &dev); +if (ret) { +debug ("DRAM init failed: %d\n" , ret); +return ret; + } + +return 0 ; +}
arch/riscv/include/asm/arch-fu740/cache.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2020-2021 SiFive, Inc. +* +* Authors: +* Pragnesh Patel <[email protected]> +*/ + +#ifndef _CACHE_SIFIVE_H +#define _CACHE_SIFIVE_H + +int cache_enable_ways (void ); + +#endif /* _CACHE_SIFIVE_H */
arch/riscv/include/asm/arch-fu740/clk.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (c) 2020-2021 SiFive Inc +* +* Authors: +* Pragnesh Patel <[email protected]> +*/ + +#ifndef __CLK_SIFIVE_H +#define __CLK_SIFIVE_H + +/* Note: This is a placeholder header for driver compilation. */ + +#endif
arch/riscv/include/asm/arch-fu740/gpio.h new file +38 -0
@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2020-2021 SiFive, Inc. +*/ + +#ifndef _GPIO_SIFIVE_H +#define _GPIO_SIFIVE_H + +#define GPIO_INPUT_VAL 0x00 +#define GPIO_INPUT_EN 0x04 +#define GPIO_OUTPUT_EN 0x08 +#define GPIO_OUTPUT_VAL 0x0C +#define GPIO_RISE_IE 0x18 +#define GPIO_RISE_IP 0x1C +#define GPIO_FALL_IE 0x20 +#define GPIO_FALL_IP 0x24 +#define GPIO_HIGH_IE 0x28 +#define GPIO_HIGH_IP 0x2C +#define GPIO_LOW_IE 0x30 +#define GPIO_LOW_IP 0x34 +#define GPIO_OUTPUT_XOR 0x40 + +#define NR_GPIOS 16 + +enum gpio_state { +LOW , +HIGH +}; + +/* Details about a GPIO bank */ +struct sifive_gpio_plat { +void *base;/* address of registers in physical memory */ +}; + +#define SIFIVE_GENERIC_GPIO_NR (port, index) \ + (((port) * NR_GPIOS) + ((index) & (NR_GPIOS - 1))) + +#endif /* _GPIO_SIFIVE_H */
arch/riscv/include/asm/arch-fu740/reset.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (c) 2020-2021 SiFive, Inc. +* +* Author: Sagar Kadam <[email protected]> +*/ + +#ifndef __RESET_SIFIVE_H +#define __RESET_SIFIVE_H + +int sifive_reset_bind (struct udevice *dev,ulong count); + +#endif
arch/riscv/include/asm/arch-fu740/spl.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2020-2021 SiFive, Inc. +* +* Authors: +* Pragnesh Patel <[email protected]> +*/ + +#ifndef _SPL_SIFIVE_H +#define _SPL_SIFIVE_H + +int spl_soc_init (void ); + +#endif /* _SPL_SIFIVE_H */
Signature · 1 line
2.31.0
PATCH v11 2/8 drivers: clk: add fu740 support
In reply to Green WanAdd fu740 support. One abstract layer is added for supporting multiple chips such as fu540 and fu740.
--- arch/riscv/cpu/fu540/Kconfig | 2 +- drivers/clk/sifive/Kconfig | 8 +- drivers/clk/sifive/Makefile | 4 +- drivers/clk/sifive/fu540-prci.c | 769 +------------------------------ drivers/clk/sifive/fu540-prci.h | 22 + drivers/clk/sifive/fu740-prci.c | 158 +++++++ drivers/clk/sifive/fu740-prci.h | 22 + drivers/clk/sifive/sifive-prci.c | 733 +++++++++++++++++++++++++++++ drivers/clk/sifive/sifive-prci.h | 323 +++++++++++++ drivers/reset/Kconfig | 2 +- 10 files changed, 1288 insertions(+), 755 deletions(-) create mode 100644 drivers/clk/sifive/fu540-prci.h create mode 100644 drivers/clk/sifive/fu740-prci.c create mode 100644 drivers/clk/sifive/fu740-prci.h create mode 100644 drivers/clk/sifive/sifive-prci.c create mode 100644 drivers/clk/sifive/sifive-prci.h
arch/riscv/cpu/fu540/Kconfig +1 -1
@@ -18,7 +18,7 @@ config SIFIVE_FU540 imply SPL_LOAD_FIT imply SMP imply CLK_SIFIVE - imply CLK_SIFIVE_FU540_PRCI + imply CLK_SIFIVE_PRCI imply SIFIVE_SERIAL imply MACB imply MII
drivers/clk/sifive/Kconfig +4 -4
@@ -6,11 +6,11 @@ config CLK_SIFIVE help SoC drivers for SiFive Linux-capable SoCs. -config CLK_SIFIVE_FU540_PRCI - bool "PRCI driver for SiFive FU540 SoCs" +config CLK_SIFIVE_PRCI + bool "PRCI driver for SiFive 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. + FU540/FU740 SoCs. If this kernel is meant to run on a SiFive FU540/ + FU740 SoCs, enable this driver.
drivers/clk/sifive/Makefile +3 -1
@@ -1,3 +1,5 @@ # SPDX-License-Identifier: GPL-2.0+ -obj-$(CONFIG_CLK_SIFIVE_FU540_PRCI) += fu540-prci.o +obj-y += sifive-prci.o + +obj-$(CONFIG_CLK_SIFIVE_PRCI) += fu540-prci.o fu740-prci.o
drivers/clk/sifive/fu540-prci.c +21 -748
807 lines not on this page · raw message
drivers/clk/sifive/fu540-prci.h new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020-2021 SiFive, Inc. +* Zong Li +* Pragnesh Patel +*/ + +#ifndef __SIFIVE_CLK_FU540_PRCI_H +#define __SIFIVE_CLK_FU540_PRCI_H + +#include "sifive-prci.h" + +#define NUM_CLOCK_FU540 4 + +extern struct __prci_clock __prci_init_clocks_fu540[NUM_CLOCK_FU540 ]; + +static const struct prci_clk_desc prci_clk_fu540 = { + .clks = __prci_init_clocks_fu540, + .num_clks =ARRAY_SIZE (__prci_init_clocks_fu540), +}; + +#endif /* __SIFIVE_CLK_FU540_PRCI_H */
drivers/clk/sifive/fu740-prci.c new file +158 -0
158 lines not on this page · raw message
drivers/clk/sifive/fu740-prci.h new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020-2021 SiFive, Inc. +* Zong Li +* Pragnesh Patel +*/ + +#ifndef __SIFIVE_CLK_FU740_PRCI_H +#define __SIFIVE_CLK_FU740_PRCI_H + +#include "sifive-prci.h" + +#define NUM_CLOCK_FU740 9 + +extern struct __prci_clock __prci_init_clocks_fu740[NUM_CLOCK_FU740 ]; + +static const struct prci_clk_desc prci_clk_fu740 = { + .clks = __prci_init_clocks_fu740, + .num_clks =ARRAY_SIZE (__prci_init_clocks_fu740), +}; + +#endif /* __SIFIVE_CLK_FU740_PRCI_H */
drivers/clk/sifive/sifive-prci.c new file +733 -0
733 lines not on this page · raw message
drivers/clk/sifive/sifive-prci.h new file +323 -0
323 lines not on this page · raw message
drivers/reset/Kconfig +1 -1
@@ -166,7 +166,7 @@ config RESET_IPQ419 config RESET_SIFIVE bool "Reset Driver for SiFive SoC's" - depends on DM_RESET && CLK_SIFIVE_FU540_PRCI && TARGET_SIFIVE_UNLEASHED + depends on DM_RESET && CLK_SIFIVE_PRCI && TARGET_SIFIVE_UNLEASHED default y help PRCI module within SiFive SoC's provides mechanism to reset
Signature · 1 line
2.31.0
Re: [PATCH v11 2/8] drivers: clk: add fu740 support
Quoted 13 lines · Green Wan
Add fu740 support. One abstract layer is added for supporting multiple chips such as fu540 and fu740.
Signed-off-by Green Wan <[email protected]>--- arch/riscv/cpu/fu540/Kconfig | 2 +- drivers/clk/sifive/Kconfig | 8 +- drivers/clk/sifive/Makefile | 4 +- drivers/clk/sifive/fu540-prci.c | 769 +------------------------------ drivers/clk/sifive/fu540-prci.h | 22 + drivers/clk/sifive/fu740-prci.c | 158 +++++++ drivers/clk/sifive/fu740-prci.h | 22 + drivers/clk/sifive/sifive-prci.c | 733 +++++++++++++++++++++++++++++
Quoted 9 lines
drivers/clk/sifive/sifive-prci.h | 323 +++++++++++++ drivers/reset/Kconfig | 2 +- 10 files changed, 1288 insertions(+), 755 deletions(-) create mode 100644 drivers/clk/sifive/fu540-prci.h create mode 100644 drivers/clk/sifive/fu740-prci.c create mode 100644 drivers/clk/sifive/fu740-prci.h create mode 100644 drivers/clk/sifive/sifive-prci.c create mode 100644 drivers/clk/sifive/sifive-prci.h
PATCH v11 3/8 drivers: ram: sifive: rename fu540_ddr and add fu740 support
In reply to Green WanRename fu540_ddr.c to sifive_ddr.c and add fu740 support
---
drivers/ram/sifive/Kconfig | 8 +-
drivers/ram/sifive/Makefile | 2 +-
.../ram/sifive/{fu540_ddr.c => sifive_ddr.c} | 89 ++++++++++---------
3 files changed, 50 insertions(+), 49 deletions(-)
rename drivers/ram/sifive/{fu540_ddr.c => sifive_ddr.c} (81%)drivers/ram/sifive/Kconfig +4 -4
@@ -5,9 +5,9 @@ config RAM_SIFIVE help This enables support for ram drivers of SiFive SoCs. -config SIFIVE_FU540_DDR - bool "SiFive FU540 DDR driver" +config SIFIVE_DDR + bool "SiFive DDR driver" depends on RAM_SIFIVE - default y if TARGET_SIFIVE_UNLEASHED + default y if TARGET_SIFIVE_UNLEASHED || TARGET_SIFIVE_UNMATCHED help - This enables DDR support for the platforms based on SiFive FU540 SoC. + This enables DDR support for the platforms based on SiFive SoC.
drivers/ram/sifive/Makefile +1 -1
@@ -3,4 +3,4 @@ # Copyright (c) 2020 SiFive, Inc # -obj-$(CONFIG_SIFIVE_FU540_DDR) += fu540_ddr.o +obj-$(CONFIG_SIFIVE_DDR) += sifive_ddr.o
drivers/ram/sifive/sifive_ddr.c renamed from drivers/ram/sifive/fu540_ddr.c +45 -44
231 lines not on this page · raw message
Signature · 1 line
2.31.0
PATCH v11 4/8 drivers: pci: add pcie support for fu740
In reply to Green WanAdd pcie driver for SiFive fu740, the driver depends on fu740 gpio, clk and reset driver to do init. Force running at Gen1 for better capatible enumeration.
Several devices are tested:
a) M.2 NVMe SSD
b) USB-to-PCI adapter
c) Ethernet adapter (E1000 compatible)
--- drivers/pci/Kconfig | 10 + drivers/pci/Makefile | 1 + drivers/pci/pcie_dw_sifive.c | 507 +++++++++++++++++++++++++++++++++++ 3 files changed, 518 insertions(+) create mode 100644 drivers/pci/pcie_dw_sifive.c
drivers/pci/Kconfig +10 -0
@@ -97,6 +97,16 @@ config PCIE_DW_MVEBU Armada-8K SoCs. The PCIe controller on Armada-8K is based on DesignWare hardware. +config PCIE_DW_SIFIVE + bool "Enable SiFive FU740 PCIe" + depends on CLK_SIFIVE_PRCI + depends on RESET_SIFIVE + depends on SIFIVE_GPIO + select PCIE_DW_COMMON + help + Say Y here if you want to enable PCIe controller support on + FU740. + config PCIE_FSL bool "FSL PowerPC PCIe support" depends on DM_PCI
drivers/pci/Makefile +1 -0
@@ -54,3 +54,4 @@ obj-$(CONFIG_PCIE_DW_MESON) += pcie_dw_meson.o obj-$(CONFIG_PCI_BRCMSTB) += pcie_brcmstb.o obj-$(CONFIG_PCI_OCTEONTX) += pci_octeontx.o obj-$(CONFIG_PCIE_OCTEON) += pcie_octeon.o +obj-$(CONFIG_PCIE_DW_SIFIVE) += pcie_dw_sifive.o
drivers/pci/pcie_dw_sifive.c new file +507 -0
507 lines not on this page · raw message
Signature · 1 line
2.31.0
PATCH v11 5/8 riscv: dts: add fu740 support
In reply to Green WanAdd dts support for fu740. The HiFive Unmatched support is based on fu740 cpu and drivers in following patch set.
--- arch/riscv/dts/fu740-c000-u-boot.dtsi | 105 ++++++ arch/riscv/dts/fu740-c000.dtsi | 329 ++++++++++++++++++ include/dt-bindings/clock/sifive-fu740-prci.h | 25 ++ include/dt-bindings/reset/sifive-fu740-prci.h | 19 + 4 files changed, 478 insertions(+) create mode 100644 arch/riscv/dts/fu740-c000-u-boot.dtsi create mode 100644 arch/riscv/dts/fu740-c000.dtsi create mode 100644 include/dt-bindings/clock/sifive-fu740-prci.h create mode 100644 include/dt-bindings/reset/sifive-fu740-prci.h
arch/riscv/dts/fu740-c000-u-boot.dtsi new file +105 -0
@@ -0,0 +1,105 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * (C) Copyright 2020-2021 SiFive, Inc + */ + +#include <dt-bindings/reset/sifive-fu740-prci.h> + +/ { + cpus { + assigned-clocks = <&prci PRCI_CLK_COREPLL>; + assigned-clock-rates = <1200000000>; + u-boot,dm-spl; + cpu0: cpu at 0 { + clocks = <&prci PRCI_CLK_COREPLL>; + u-boot,dm-spl; + status = "okay"; + cpu0_intc: interrupt-controller { + u-boot,dm-spl; + }; + }; + cpu1: cpu at 1 { + clocks = <&prci PRCI_CLK_COREPLL>; + u-boot,dm-spl; + cpu1_intc: interrupt-controller { + u-boot,dm-spl; + }; + }; + cpu2: cpu at 2 { + clocks = <&prci PRCI_CLK_COREPLL>; + u-boot,dm-spl; + cpu2_intc: interrupt-controller { + u-boot,dm-spl; + }; + }; + cpu3: cpu at 3 { + clocks = <&prci PRCI_CLK_COREPLL>; + u-boot,dm-spl; + cpu3_intc: interrupt-controller { + u-boot,dm-spl; + }; + }; + cpu4: cpu at 4 { + clocks = <&prci PRCI_CLK_COREPLL>; + u-boot,dm-spl; + cpu4_intc: interrupt-controller { + u-boot,dm-spl; + }; + }; + }; + + soc { + u-boot,dm-spl; + clint: clint at 2000000 { + compatible = "riscv,clint0"; + interrupts-extended = <&cpu0_intc 3 &cpu0_intc 7 + &cpu1_intc 3 &cpu1_intc 7 + &cpu2_intc 3 &cpu2_intc 7 + &cpu3_intc 3 &cpu3_intc 7 + &cpu4_intc 3 &cpu4_intc 7>; + reg = <0x0 0x2000000 0x0 0x10000>; + u-boot,dm-spl; + }; + prci: clock-controller at 10000000 { + #reset-cells = <1>; + resets = <&prci PRCI_RST_DDR_CTRL_N>, + <&prci PRCI_RST_DDR_AXI_N>, + <&prci PRCI_RST_DDR_AHB_N>, + <&prci PRCI_RST_DDR_PHY_N>, + <&prci PRCI_RST_GEMGXL_N>, + <&prci PRCI_RST_CLTX_N>; + reset-names = "ddr_ctrl", "ddr_axi", "ddr_ahb", + "ddr_phy", "gemgxl_reset", "cltx_reset"; + }; + dmc: dmc at 100b0000 { + compatible = "sifive,fu740-c000-ddr"; + reg = <0x0 0x100b0000 0x0 0x0800 + 0x0 0x100b2000 0x0 0x2000 + 0x0 0x100b8000 0x0 0x1000>; + clocks = <&prci PRCI_CLK_DDRPLL>; + clock-frequency = <933333324>; + u-boot,dm-spl; + }; + }; +}; + +&prci { + u-boot,dm-spl; +}; + +&uart0 { + u-boot,dm-spl; +}; + +&spi0 { + u-boot,dm-spl; +}; + +ð0 { + assigned-clocks = <&prci PRCI_CLK_GEMGXLPLL>; + assigned-clock-rates = <125125000>; +}; + +&ccache { + status = "okay"; +};
arch/riscv/dts/fu740-c000.dtsi new file +329 -0
329 lines not on this page · raw message
include/dt-bindings/clock/sifive-fu740-prci.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ +/* +* Copyright (C) 2020-2021 SiFive, Inc. +* Wesley Terpstra +* Paul Walmsley +* Zong Li +* Pragnesh Patel +*/ + +#ifndef __DT_BINDINGS_CLOCK_SIFIVE_FU740_PRCI_H +#define __DT_BINDINGS_CLOCK_SIFIVE_FU740_PRCI_H + +/* Clock indexes for use by Device Tree data and the PRCI driver */ + +#define PRCI_CLK_COREPLL 0 +#define PRCI_CLK_DDRPLL 1 +#define PRCI_CLK_GEMGXLPLL 2 +#define PRCI_CLK_DVFSCOREPLL 3 +#define PRCI_CLK_HFPCLKPLL 4 +#define PRCI_CLK_CLTXPLL 5 +#define PRCI_CLK_TLCLK 6 +#define PRCI_CLK_PCLK 7 +#define PRCI_CLK_PCIEAUX 8 + +#endif
include/dt-bindings/reset/sifive-fu740-prci.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ +/* +* Copyright (C) 2020-2021 Sifive, Inc. +* Author: Pragnesh Patel <[email protected]> +*/ + +#ifndef __DT_BINDINGS_RESET_SIFIVE_FU740_PRCI_H +#define __DT_BINDINGS_RESET_SIFIVE_FU740_PRCI_H + +/* Reset indexes for use by device tree data and the PRCI driver */ +#define PRCI_RST_DDR_CTRL_N 0 +#define PRCI_RST_DDR_AXI_N 1 +#define PRCI_RST_DDR_AHB_N 2 +#define PRCI_RST_DDR_PHY_N 3 +#define PRCI_RST_PCIE_POWER_UP_N 4 +#define PRCI_RST_GEMGXL_N 5 +#define PRCI_RST_CLTX_N 6 + +#endif
Signature · 1 line
2.31.0
PATCH v11 6/8 riscv: dts: add SiFive Unmatched board support
In reply to Green WanAdd dts files for SiFive Unmatched board.
--- arch/riscv/dts/Makefile | 1 + .../dts/fu740-hifive-unmatched-a00-ddr.dtsi | 1489 +++++++++++++++++ .../dts/hifive-unmatched-a00-u-boot.dtsi | 41 + arch/riscv/dts/hifive-unmatched-a00.dts | 259 +++ 4 files changed, 1790 insertions(+) create mode 100644 arch/riscv/dts/fu740-hifive-unmatched-a00-ddr.dtsi create mode 100644 arch/riscv/dts/hifive-unmatched-a00-u-boot.dtsi create mode 100644 arch/riscv/dts/hifive-unmatched-a00.dts
arch/riscv/dts/Makefile +1 -0
@@ -4,6 +4,7 @@ dtb-$(CONFIG_TARGET_AX25_AE350) += ae350_32.dtb ae350_64.dtb dtb-$(CONFIG_TARGET_MICROCHIP_ICICLE) += microchip-mpfs-icicle-kit.dtb dtb-$(CONFIG_TARGET_QEMU_VIRT) += qemu-virt.dtb dtb-$(CONFIG_TARGET_SIFIVE_UNLEASHED) += hifive-unleashed-a00.dtb +dtb-$(CONFIG_TARGET_SIFIVE_UNMATCHED) += hifive-unmatched-a00.dtb dtb-$(CONFIG_TARGET_SIPEED_MAIX) += k210-maix-bit.dtb targets += $(dtb-y)
arch/riscv/dts/fu740-hifive-unmatched-a00-ddr.dtsi new file +1489 -0
1,489 lines not on this page · raw message
arch/riscv/dts/hifive-unmatched-a00-u-boot.dtsi new file +41 -0
41 lines not on this page · raw message
arch/riscv/dts/hifive-unmatched-a00.dts new file +259 -0
259 lines not on this page · raw message
Signature · 1 line
2.31.0
PATCH v11 6/8 riscv: dts: add SiFive Unmatched board support
Quoted 5 lines · Green Wan
Add dts files for SiFive Unmatched board.
Signed-off-by Green Wan <[email protected]>Reviewed-by Rick Chen <[email protected]>
Quoted 10 lines
--- arch/riscv/dts/Makefile | 1 + .../dts/fu740-hifive-unmatched-a00-ddr.dtsi | 1489 +++++++++++++++++ .../dts/hifive-unmatched-a00-u-boot.dtsi | 41 + arch/riscv/dts/hifive-unmatched-a00.dts | 259 +++ 4 files changed, 1790 insertions(+) create mode 100644 arch/riscv/dts/fu740-hifive-unmatched-a00-ddr.dtsi create mode 100644 arch/riscv/dts/hifive-unmatched-a00-u-boot.dtsi create mode 100644 arch/riscv/dts/hifive-unmatched-a00.dts
PATCH v11 7/8 board: sifive: add HiFive Unmatched board support
In reply to Green WanAdd defconfig and board support for HiFive Unmatched.
--- arch/riscv/Kconfig | 4 + board/sifive/unleashed/Kconfig | 1 + board/sifive/unmatched/Kconfig | 51 +++ board/sifive/unmatched/MAINTAINERS | 9 + board/sifive/unmatched/Makefile | 9 + board/sifive/unmatched/spl.c | 85 +++++ board/sifive/unmatched/unmatched.c | 24 ++ common/spl/Kconfig | 4 +- configs/sifive_unmatched_defconfig | 54 +++ doc/board/sifive/index.rst | 1 + doc/board/sifive/unmatched.rst | 536 +++++++++++++++++++++++++++++ drivers/reset/Kconfig | 2 +- include/configs/sifive-unmatched.h | 85 +++++ 13 files changed, 862 insertions(+), 3 deletions(-) create mode 100644 board/sifive/unmatched/Kconfig create mode 100644 board/sifive/unmatched/MAINTAINERS create mode 100644 board/sifive/unmatched/Makefile create mode 100644 board/sifive/unmatched/spl.c create mode 100644 board/sifive/unmatched/unmatched.c create mode 100644 configs/sifive_unmatched_defconfig create mode 100644 doc/board/sifive/unmatched.rst create mode 100644 include/configs/sifive-unmatched.h
arch/riscv/Kconfig +4 -0
@@ -20,6 +20,9 @@ config TARGET_QEMU_VIRT config TARGET_SIFIVE_UNLEASHED bool "Support SiFive Unleashed Board" +config TARGET_SIFIVE_UNMATCHED + bool "Support SiFive Unmatched Board" + config TARGET_SIPEED_MAIX bool "Support Sipeed Maix Board"
@@ -56,6 +59,7 @@ source "board/AndesTech/ax25-ae350/Kconfig" source "board/emulation/qemu-riscv/Kconfig" source "board/microchip/mpfs_icicle/Kconfig" source "board/sifive/unleashed/Kconfig" +source "board/sifive/unmatched/Kconfig" source "board/sipeed/maix/Kconfig" # platform-specific options below
board/sifive/unleashed/Kconfig +1 -0
@@ -28,6 +28,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy select SIFIVE_FU540 select ENV_IS_IN_SPI_FLASH select BINMAN + select RESET_SIFIVE imply CMD_DHCP imply CMD_EXT2 imply CMD_EXT4
board/sifive/unmatched/Kconfig new file +51 -0
51 lines not on this page · raw message
board/sifive/unmatched/MAINTAINERS new file +9 -0
@@ -0,0 +1,9 @@ +SiFive HiFive Unmatched FU740 BOARD +M: Paul Walmsley <[email protected]> +M: Pragnesh Patel <[email protected]> +M: Green Wan <[email protected]> +S: Maintained +F: board/sifive/unmatched/ +F: doc/board/sifive/hifive-unmatched-fu740.rst +F: include/configs/sifive-unmatched.h +F: configs/sifive_unmatched_defconfig
board/sifive/unmatched/Makefile new file +9 -0
@@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (c) 2020-2021 SiFive, Inc + +obj-y += unmatched.o + +ifdef CONFIG_SPL_BUILD +obj-y += spl.o +endif
board/sifive/unmatched/spl.c new file +85 -0
85 lines not on this page · raw message
board/sifive/unmatched/unmatched.c new file +24 -0
@@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (c) 2020-2021, SiFive Inc +* +* Authors: +* Pragnesh Patel <[email protected]> +*/ + +#include <common.h> +#include <dm.h> +#include <asm/arch/cache.h> + +int board_init (void ) +{ +int ret; + +/* enable all cache ways */ + ret =cache_enable_ways (); +if (ret) { +debug ("%s: could not enable cache ways\n" , __func__); +return ret; + } +return 0 ; +}
common/spl/Kconfig +2 -2
@@ -322,7 +322,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR ARCH_ROCKCHIP || ARCH_MVEBU || ARCH_SOCFPGA || \ ARCH_AT91 || ARCH_ZYNQ || ARCH_KEYSTONE || OMAP34XX || \ OMAP44XX || OMAP54XX || AM33XX || AM43XX || \ - TARGET_SIFIVE_UNLEASHED + TARGET_SIFIVE_UNLEASHED || TARGET_SIFIVE_UNMATCHED help Use sector number for specifying U-Boot location on MMC/SD in raw mode.
@@ -339,7 +339,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR default 0x300 if ARCH_ZYNQ || ARCH_KEYSTONE || OMAP34XX || OMAP44XX || \ OMAP54XX || AM33XX || AM43XX || ARCH_K3 default 0x4000 if ARCH_ROCKCHIP - default 0x822 if TARGET_SIFIVE_UNLEASHED + default 0x822 if TARGET_SIFIVE_UNLEASHED || TARGET_SIFIVE_UNMATCHED help Address on the MMC to load U-Boot from, when the MMC is being used in raw mode. Units: MMC sectors (1 sector = 512 bytes).
configs/sifive_unmatched_defconfig new file +54 -0
54 lines not on this page · raw message
doc/board/sifive/index.rst +1 -0
@@ -7,3 +7,4 @@ SiFive :maxdepth: 2 unleashed + unmatched
doc/board/sifive/unmatched.rst new file +536 -0
536 lines not on this page · raw message
drivers/reset/Kconfig +1 -1
@@ -166,7 +166,7 @@ config RESET_IPQ419 config RESET_SIFIVE bool "Reset Driver for SiFive SoC's" - depends on DM_RESET && CLK_SIFIVE_PRCI && TARGET_SIFIVE_UNLEASHED + depends on DM_RESET && CLK_SIFIVE_PRCI && (TARGET_SIFIVE_UNLEASHED || TARGET_SIFIVE_UNMATCHED) default y help PRCI module within SiFive SoC's provides mechanism to reset
include/configs/sifive-unmatched.h new file +85 -0
85 lines not on this page · raw message
Signature · 1 line
2.31.0
PATCH v11 8/8 riscv: cpu: fu740: clear feature disable CSR
In reply to Green WanClear feature disable CSR to turn on all features of hart. The detail is specified at section, 'SiFive Feature Disable CSR', in user manual
--- arch/riscv/cpu/fu740/spl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/riscv/cpu/fu740/spl.c +15 -0
@@ -6,6 +6,9 @@#include <dm.h> #include <log.h> +#include <asm/csr.h> + +#define CSR_U74_FEATURE_DISABLE 0x7c1int spl_soc_init (void ) {
@@ -21,3 +24,15 @@ int spl_soc_init(void)return 0 ; } + +void harts_early_init (void ) +{ +/* +* Feature Disable CSR +* +* Clear feature disable CSR to '0' to turn on all features for +* each core. This operation must be in M-mode. +*/ +if (CONFIG_IS_ENABLED (RISCV_MMODE )) +csr_write (CSR_U74_FEATURE_DISABLE ,0 ); +}
Signature · 1 line
2.31.0