Basic StarFive JH7110 RISC-V SoC support
Subsystems (9)
v5 cover Basic StarFive JH7110 RISC-V SoC support
This series of patches base on the latest branch/master, and add support for the StarFive JH7110 RISC-V SoC and VisionFive V2 board. In order for this to be achieved, the respective DT nodes have been added, and the required defconfigs have been added to the boards' defconfig. What is more, the basic required DM drivers have been added, such as reset, clock, pinctrl, uart, ram etc.
Note that the register base address of reset controller is same with the clock controller. Therefore, there is no device tree node alone for reset driver. It binds device node in the clock driver.
The u-boot-spl and u-boot has been tested on the StarFive VisionFive 2 1.2A and 1.3B boards which equip with JH7110 SoC and works normally.
For more information and support, you can visit RVspace wiki[1].
v5:
- Fixed the build errors that came from "make htmldocs".
- Remove the MMU configuration from the S7 device tree node.
- Splitted starfive_visionfive2_defconfig into starfive_visionfive2_12a_defconfig and starfive_visionfive2_13b_defconfig.
- Added the implementation of 'get_function' callback function to pinctrl.
v4:
- Replace compatible string "starfive,jh7110-ccache" with "sifive,ccache0".
- Added 'gmac0_tx_inv','gmac1_tx_inv','gmac1_rx' clock registration.
- Added enable_caches() call to enable L2 cache in board_init() function.
- Moved 'S7_0' device node from board dts to SoC -u-boot.dtsi.
- Added 'i2cx' device node to board dts to consistent with linux.
- Renamed device node 'sdcard1_pins' to 'mmc1_pins'.
v3:
- Added doc/board/starfive/visionfive2.rst file.
- Added support booting from SD.
- Added support pinctrl in SPL.
- Reworded dts to consistent with linux.
- Added CFG_EXTRA_ENV_SETTINGS configuration.
- Reworded starfive_visionfive2_defconfig.
- Reworded the clock driver.
- Renamed 'starfive-jh7110.h' to 'starfive,jh7110-crg.h'.
- Separated 'starfive_visionfive2.dts' to 'jh7110-starfive-visionfive-2-v1.3b.dts' and 'jh7110-starfive-visionfive-2-v1.2a.dts' to consistent with linux.
- Added pinmux_property_set callback function implementation in 'pinctrl-starfive.c'.
v2:
- Renamed file 'jh7110-regs.h' to 'regs.h'.
- Reworded the clear L2 LIM memory code in C.
- Removed flash init call in 'spl_soc_init' function.
- Reworded the clock driver.
- Rename the macro 'SET_DIV' to 'ASSIGNED_CLOCK_PARENTS' in 'spl.c'.
- Moved the device tree node 'dmc@15700000' from 'jh7110-u-boot.dtsi' to 'starfive_visionfive2-u-boot.dtsi'
Previous versions:
v1 - https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
v2 - https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
v3 - https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
v4 - https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
Jianlong Huang (1):
dt-bindings: pinctrl: Add StarFive JH7110 pinctrl definitions
Kuan Lim Lee (1):
pinctrl: starfive: Add StarFive JH7110 driver
Yanhong Wang (15):
riscv: cpu: jh7110: Add support for jh7110 SoC
cache: starfive: Add StarFive JH7110 support
dt-bindings: reset: Add StarFive JH7110 reset definitions
reset: starfive: jh7110: Add reset driver for StarFive JH7110 SoC
dt-bindings: clock: Add StarFive JH7110 clock definitions
clk: starfive: Add StarFive JH7110 clock driver
ram: starfive: add ddr driver
board: starfive: add StarFive VisionFive v2 board support
riscv: cpu: jh7110: Add Kconfig for StarFive JH7110 SoC
board: starfive: Add Kconfig for StarFive VisionFive v2 Board
board: starfive: Add TARGET_STARFIVE_VISIONFIVE2 to Kconfig
riscv: dts: jh7110: Add initial StarFive JH7110 device tree
riscv: dts: jh7110: Add initial u-boot device tree
riscv: dts: jh7110: Add initial StarFive VisionFive v2 board device
tree
configs: starfive: add defconfig for StarFive VisionFvie2 1.2A and
1.3B
arch/riscv/Kconfig | 5 + arch/riscv/cpu/jh7110/Kconfig | 28 + arch/riscv/cpu/jh7110/Makefile | 10 + arch/riscv/cpu/jh7110/cpu.c | 23 + arch/riscv/cpu/jh7110/dram.c | 38 + arch/riscv/cpu/jh7110/spl.c | 64 + arch/riscv/dts/Makefile | 3 +- ...10-starfive-visionfive-2-v1.2a-u-boot.dtsi | 69 + .../jh7110-starfive-visionfive-2-v1.2a.dts | 12 + ...10-starfive-visionfive-2-v1.3b-u-boot.dtsi | 69 + .../jh7110-starfive-visionfive-2-v1.3b.dts | 12 + .../dts/jh7110-starfive-visionfive-2.dtsi | 319 +++ arch/riscv/dts/jh7110-u-boot.dtsi | 99 + arch/riscv/dts/jh7110.dtsi | 573 +++++ arch/riscv/include/asm/arch-jh7110/regs.h | 19 + arch/riscv/include/asm/arch-jh7110/spl.h | 12 + board/starfive/visionfive2/Kconfig | 53 + board/starfive/visionfive2/MAINTAINERS | 7 + board/starfive/visionfive2/Makefile | 7 + board/starfive/visionfive2/spl.c | 87 + .../visionfive2/starfive_visionfive2.c | 40 + configs/starfive_visionfive2_12a_defconfig | 79 + configs/starfive_visionfive2_13b_defconfig | 79 + doc/board/index.rst | 1 + doc/board/starfive/index.rst | 9 + doc/board/starfive/visionfive2.rst | 492 +++++ drivers/cache/cache-sifive-ccache.c | 1 + drivers/clk/Kconfig | 1 + drivers/clk/Makefile | 1 + drivers/clk/starfive/Kconfig | 17 + drivers/clk/starfive/Makefile | 4 + drivers/clk/starfive/clk-jh7110-pll.c | 321 +++ drivers/clk/starfive/clk-jh7110.c | 603 +++++ drivers/clk/starfive/clk.h | 57 + drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/starfive/Kconfig | 28 + drivers/pinctrl/starfive/Makefile | 6 + drivers/pinctrl/starfive/pinctrl-jh7110-aon.c | 113 + drivers/pinctrl/starfive/pinctrl-jh7110-sys.c | 399 ++++ drivers/pinctrl/starfive/pinctrl-starfive.c | 398 ++++ drivers/pinctrl/starfive/pinctrl-starfive.h | 55 + drivers/ram/Kconfig | 1 + drivers/ram/Makefile | 4 +- drivers/ram/starfive/Kconfig | 5 + drivers/ram/starfive/Makefile | 11 + drivers/ram/starfive/ddrcsr_boot.c | 339 +++ drivers/ram/starfive/ddrphy_start.c | 279 +++ drivers/ram/starfive/ddrphy_train.c | 383 ++++ drivers/ram/starfive/ddrphy_utils.c | 1955 +++++++++++++++++ drivers/ram/starfive/starfive_ddr.c | 161 ++ drivers/ram/starfive/starfive_ddr.h | 65 + drivers/reset/Kconfig | 16 + drivers/reset/Makefile | 1 + drivers/reset/reset-jh7110.c | 158 ++ include/configs/starfive-visionfive2.h | 49 + .../dt-bindings/clock/starfive,jh7110-crg.h | 257 +++ .../pinctrl/pinctrl-starfive-jh7110.h | 427 ++++ .../dt-bindings/reset/starfive,jh7110-crg.h | 183 ++ 59 files changed, 8507 insertions(+), 2 deletions(-) create mode 100644 arch/riscv/cpu/jh7110/Kconfig create mode 100644 arch/riscv/cpu/jh7110/Makefile create mode 100644 arch/riscv/cpu/jh7110/cpu.c create mode 100644 arch/riscv/cpu/jh7110/dram.c create mode 100644 arch/riscv/cpu/jh7110/spl.c create mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2-v1.2a-u-boot.dtsi create mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2-v1.2a.dts create mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2-v1.3b-u-boot.dtsi create mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2-v1.3b.dts create mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2.dtsi create mode 100644 arch/riscv/dts/jh7110-u-boot.dtsi create mode 100644 arch/riscv/dts/jh7110.dtsi create mode 100644 arch/riscv/include/asm/arch-jh7110/regs.h create mode 100644 arch/riscv/include/asm/arch-jh7110/spl.h create mode 100644 board/starfive/visionfive2/Kconfig create mode 100644 board/starfive/visionfive2/MAINTAINERS create mode 100644 board/starfive/visionfive2/Makefile create mode 100644 board/starfive/visionfive2/spl.c create mode 100644 board/starfive/visionfive2/starfive_visionfive2.c create mode 100644 configs/starfive_visionfive2_12a_defconfig create mode 100644 configs/starfive_visionfive2_13b_defconfig create mode 100644 doc/board/starfive/index.rst create mode 100644 doc/board/starfive/visionfive2.rst create mode 100644 drivers/clk/starfive/Kconfig create mode 100644 drivers/clk/starfive/Makefile create mode 100644 drivers/clk/starfive/clk-jh7110-pll.c create mode 100644 drivers/clk/starfive/clk-jh7110.c create mode 100644 drivers/clk/starfive/clk.h create mode 100644 drivers/pinctrl/starfive/Kconfig create mode 100644 drivers/pinctrl/starfive/Makefile create mode 100644 drivers/pinctrl/starfive/pinctrl-jh7110-aon.c create mode 100644 drivers/pinctrl/starfive/pinctrl-jh7110-sys.c create mode 100644 drivers/pinctrl/starfive/pinctrl-starfive.c create mode 100644 drivers/pinctrl/starfive/pinctrl-starfive.h create mode 100644 drivers/ram/starfive/Kconfig create mode 100644 drivers/ram/starfive/Makefile create mode 100644 drivers/ram/starfive/ddrcsr_boot.c create mode 100644 drivers/ram/starfive/ddrphy_start.c create mode 100644 drivers/ram/starfive/ddrphy_train.c create mode 100644 drivers/ram/starfive/ddrphy_utils.c create mode 100644 drivers/ram/starfive/starfive_ddr.c create mode 100644 drivers/ram/starfive/starfive_ddr.h create mode 100644 drivers/reset/reset-jh7110.c create mode 100644 include/configs/starfive-visionfive2.h create mode 100644 include/dt-bindings/clock/starfive,jh7110-crg.h create mode 100644 include/dt-bindings/pinctrl/pinctrl-starfive-jh7110.h create mode 100644 include/dt-bindings/reset/starfive,jh7110-crg.h
base-commit: 41a88ad529b3943b1e465846eb24fe2c29203e35
Signature · 1 line
2.17.1
PATCH v5 1/17 riscv: cpu: jh7110: Add support for jh7110 SoC
Add StarFive JH7110 SoC to support RISC-V arch.
--- arch/riscv/cpu/jh7110/Makefile | 10 ++++ arch/riscv/cpu/jh7110/cpu.c | 23 ++++++++ arch/riscv/cpu/jh7110/dram.c | 38 ++++++++++++++ arch/riscv/cpu/jh7110/spl.c | 64 +++++++++++++++++++++++ arch/riscv/include/asm/arch-jh7110/regs.h | 19 +++++++ arch/riscv/include/asm/arch-jh7110/spl.h | 12 +++++ 6 files changed, 166 insertions(+) create mode 100644 arch/riscv/cpu/jh7110/Makefile create mode 100644 arch/riscv/cpu/jh7110/cpu.c create mode 100644 arch/riscv/cpu/jh7110/dram.c create mode 100644 arch/riscv/cpu/jh7110/spl.c create mode 100644 arch/riscv/include/asm/arch-jh7110/regs.h create mode 100644 arch/riscv/include/asm/arch-jh7110/spl.h
arch/riscv/cpu/jh7110/Makefile new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2022 StarFive Technology Co., Ltd. + +ifeq ($(CONFIG_SPL_BUILD),y) +obj-y += spl.o +else +obj-y += cpu.o +obj-y += dram.o +endif
arch/riscv/cpu/jh7110/cpu.c new file +23 -0
@@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2022 StarFive Technology Co., Ltd. +* Author: Yanhong Wang <[email protected]> +*/ + +#include <asm/cache.h> +#include <irq_func.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/jh7110/dram.c new file +38 -0
@@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2022 StarFive Technology Co., Ltd. +* Author: Yanhong Wang <[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 (); +} + +phys_size_t board_get_usable_ram_top (phys_size_t total_size) +{ +/* +* 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 (IS_ENABLED (CONFIG_64BIT ) && gd->ram_top >SZ_4G ) +return SZ_4G ; + +return gd->ram_top; +}
arch/riscv/cpu/jh7110/spl.c new file +64 -0
64 lines not on this page · raw message
arch/riscv/include/asm/arch-jh7110/regs.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2022 StarFive Technology Co., Ltd. +* Author: Yanhong Wang <[email protected]> +*/ + +#ifndef __STARFIVE_JH7110_REGS_H +#define __STARFIVE_JH7110_REGS_H + +#define JH7110_SYS_CRG 0x13020000 +#define JH7110_SYS_SYSCON 0x13030000 +#define JH7110_SYS_IOMUX 0x13040000 +#define JH7110_AON_CRG 0x17000000 +#define JH7110_AON_SYSCON 0x17010000 + +#define JH7110_BOOT_MODE_SELECT_REG 0x1702002c +#define JH7110_BOOT_MODE_SELECT_MASK GENMASK(1, 0) + +#endif /* __STARFIVE_JH7110_REGS_H */
arch/riscv/include/asm/arch-jh7110/spl.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2022 StarFive Technology Co., Ltd. +* Author: Yanhong Wang <[email protected]> +*/ + +#ifndef _SPL_STARFIVE_H +#define _SPL_STARFIVE_H + +int spl_soc_init (void ); + +#endif /* _SPL_STARFIVE_H */
Signature · 1 line
2.17.1
Re: [PATCH v5 01/17] riscv: cpu: jh7110: Add support for jh7110 SoC
Quoted 25 lines · Yanhong Wang
arch/riscv/cpu/jh7110/spl.c new file +25
-0+void harts_early_init (void ) +{ +ulong *ptr; +u8 *tmp; +ulong len, remain; +/* +* 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 ); + +/* clear L2 LIM memory +* set __bss_end to 0x81FFFFF region to zero +* The L2 Cache Controller supports ECC. ECC is applied to SRAM. +* If it is not cleared, the ECC part is invalid, and an ECC error +* will be reported when reading data. +*/ + ptr = (ulong *)&__bss_end; + len =L2_LIM_MEM_END - (ulong)&__bss_end; + remain = len %sizeof (ulong); + len /=sizeof (ulong); +
arch/riscv/cpu/jh7110/spl.c line 64
Quoted 10 lines
arch/riscv/cpu/jh7110/spl.c new file +10
-0+while (len--) + *ptr++ =0 ; + +/* clear the remain bytes */ +if (remain) { + tmp = (u8 *)ptr; +while (remain--) + *tmp++ =0 ; + } +}
Hi Yanhong, I know this is already merged, but it looks wrong to me.harts_early_init will be called by all harts in SPL. The per-hart stack sits between __bss_end and L2_LIM_MEM_END. Zeroing this region could overwrite the hart's stack, and other harts' stacks. The current implementation works likely because harts_early_init doesn't use any stack space, but it's up to the compiler and we can't guarantee that. If it were to save and restore ra register, then we would crash in function epilogue. Also, we are having data-races here, because harts are writing over each other's stack.
My advice is that we should split the zeroing of L2 LIM into different places just before the region is to be used. For stacks, we can let each hart clearing its own stack, and for the malloc space, we can do so during malloc initialization. Doing so also gives us the benefit of catching the read of uninitialized data. In this approach, the L2_LIM_MEM_END macro is not needed anymore.
Re: [PATCH v5 01/17] riscv: cpu: jh7110: Add support for jh7110 SoC
Quoted 44 lines · Bo Gan
Quoted 25 lines · Yanhong Wang
(quoted diff) +25
-0+void harts_early_init(void) +{ + ulong *ptr; + u8 *tmp; + ulong len, remain; + /* + * 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); + + /* clear L2 LIM memory + * set __bss_end to 0x81FFFFF region to zero + * The L2 Cache Controller supports ECC. ECC is applied to SRAM. + * If it is not cleared, the ECC part is invalid, and an ECC error + * will be reported when reading data. + */ + ptr = (ulong *)&__bss_end; + len = L2_LIM_MEM_END - (ulong)&__bss_end; + remain = len % sizeof(ulong); + len /= sizeof(ulong); +Review
Quoted 10 lines
(quoted diff) +10
-0+ while (len--) + *ptr++ = 0; + + /* clear the remain bytes */ + if (remain) { + tmp = (u8 *)ptr; + while (remain--) + *tmp++ = 0; + } +}Hi Yanhong, I know this is already merged, but it looks wrong to me.
harts_early_initwill be called by all harts in SPL. The per-hart stack sits between__bss_endandL2_LIM_MEM_END. Zeroing this region could overwrite the hart's stack, and other harts' stacks. The current implementation works likely becauseharts_early_initdoesn't use any stack space, but it's up to the compiler and we can't guarantee that. If it were to save and restoreraregister, then we would crash in function epilogue. Also, we are having data-races here, because harts are writing over each other's stack.
Quoted 4 lines
My advice is that we should split the zeroing of L2 LIM into different places just before the region is to be used. For stacks, we can let each hart clearing its own stack, and for the malloc space, we can do so during malloc initialization. Doing so also gives us the benefit of catching the read of uninitialized data. In this approach, the
L2_LIM_MEM_ENDmacro is not needed anymore.
Hi,Bo Gan, I agree with you, there is some problem with the initialization of the L2 LIM, so, as you suggested, we should split the zeroing of L2 LIM into different places. Something like:
arch/riscv/cpu/jh7110/spl.c +4 -3
@@ -13,7 +13,6 @@#include <init.h> #define CSR_U74_FEATURE_DISABLE 0x7c1 -#define L2_LIM_MEM_END 0x81FFFFFULDECLARE_GLOBAL_DATA_PTR ;
@@ -61,7 +60,7 @@ void harts_early_init(void) {ulong *ptr;u8 *tmp; -ulong len, remain; +ulong len, remain, init_end;/* * Feature Disable CSR *
@@ -77,8 +76,10 @@ void harts_early_init(void)* If it is not cleared, the ECC part is invalid, and an ECC error * will be reported when reading data. */ + init_end =CONFIG_SPL_STACK -CONFIG_VAL (SYS_MALLOC_F_LEN ) -sizeof (*gd) + -CONFIG_NR_CPUS *BIT (CONFIG_STACK_SIZE_SHIFT ); ptr = (ulong *)&__bss_end; - len =L2_LIM_MEM_END - (ulong)&__bss_end; + len = init_end - (ulong)&__bss_end; remain = len %sizeof (ulong); len /=sizeof (ulong);
arch/riscv/cpu/start.S +14 -0
@@ -118,6 +118,20 @@ call_board_init_f_0: mv sp, a0 #endif +#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK) && \ + defined(CONFIG_STARFIVE_JH7110) + + /* Set the stack region to zero */ + li t0, 1 + slli t1, t0, CONFIG_STACK_SIZE_SHIFT + mv t0, sp + sub t1, t0, t1 +clear_stack: + SREG zero, 0(t1) + addi t1, t1, REGBYTES + blt t1, t0, clear_stack +#endif + /* Configure proprietary settings and customized CSRs of harts */ call_harts_early_init: jal harts_early_init
common/init/board_init.c +1 -0
@@ -162,6 +162,7 @@ void board_init_f_init_reserve(ulong base)#if CONFIG_VAL (SYS_MALLOC_F_LEN )/* go down one 'early malloc arena' */ gd->malloc_base = base; +memset ((void *)base,0 ,CONFIG_VAL (SYS_MALLOC_F_LEN ));#endif if (CONFIG_IS_ENABLED (SYS_REPORT_STACK_F_USAGE ))
PATCH v5 2/17 cache: starfive: Add StarFive JH7110 support
In reply to Yanhong WangThis adds support for the StarFive JH7110 SoC which also feature this SiFive cache controller.
--- drivers/cache/cache-sifive-ccache.c | 1 + 1 file changed, 1 insertion(+)
drivers/cache/cache-sifive-ccache.c +1 -0
@@ -62,6 +62,7 @@ static int sifive_ccache_probe(struct udevice *dev)static const struct udevice_id sifive_ccache_ids[] = { { .compatible ="sifive,fu540-c000-ccache" }, { .compatible ="sifive,fu740-c000-ccache" }, + { .compatible ="sifive,ccache0" }, {} };
Signature · 1 line
2.17.1
PATCH v5 3/17 dt-bindings: reset: Add StarFive JH7110 reset definitions
In reply to Yanhong WangAdd resets for the StarFive JH7110 system(SYS),system-top-group(STG) and always-on(AON) reset controller.
--- .../dt-bindings/reset/starfive,jh7110-crg.h | 183 ++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 include/dt-bindings/reset/starfive,jh7110-crg.h
include/dt-bindings/reset/starfive,jh7110-crg.h new file +183 -0
@@ -0,0 +1,183 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2022 StarFive Technology Co., Ltd. +* +* Author: Yanhong Wang <[email protected]> +*/ + +#ifndef __DT_BINDINGS_RESET_STARFIVE_JH7110_H__ +#define __DT_BINDINGS_RESET_STARFIVE_JH7110_H__ + +/* SYSCRG resets */ +#define JH7110_SYSRST_JTAG2APB 0 +#define JH7110_SYSRST_SYSCON 1 +#define JH7110_SYSRST_IOMUX_APB 2 +#define JH7110_SYSRST_BUS 3 +#define JH7110_SYSRST_DEBUG 4 +#define JH7110_SYSRST_CORE0 5 +#define JH7110_SYSRST_CORE1 6 +#define JH7110_SYSRST_CORE2 7 +#define JH7110_SYSRST_CORE3 8 +#define JH7110_SYSRST_CORE4 9 +#define JH7110_SYSRST_CORE0_ST 10 +#define JH7110_SYSRST_CORE1_ST 11 +#define JH7110_SYSRST_CORE2_ST 12 +#define JH7110_SYSRST_CORE3_ST 13 +#define JH7110_SYSRST_CORE4_ST 14 +#define JH7110_SYSRST_TRACE0 15 +#define JH7110_SYSRST_TRACE1 16 +#define JH7110_SYSRST_TRACE2 17 +#define JH7110_SYSRST_TRACE3 18 +#define JH7110_SYSRST_TRACE4 19 +#define JH7110_SYSRST_TRACE_COM 20 +#define JH7110_SYSRST_GPU_APB 21 +#define JH7110_SYSRST_GPU_DOMA 22 +#define JH7110_SYSRST_NOC_BUS_APB_BUS 23 +#define JH7110_SYSRST_NOC_BUS_AXICFG0_AXI 24 +#define JH7110_SYSRST_NOC_BUS_CPU_AXI 25 +#define JH7110_SYSRST_NOC_BUS_DISP_AXI 26 +#define JH7110_SYSRST_NOC_BUS_GPU_AXI 27 +#define JH7110_SYSRST_NOC_BUS_ISP_AXI 28 +#define JH7110_SYSRST_NOC_BUS_DDRC 29 +#define JH7110_SYSRST_NOC_BUS_STG_AXI 30 +#define JH7110_SYSRST_NOC_BUS_VDEC_AXI 31 + +#define JH7110_SYSRST_NOC_BUS_VENC_AXI 32 +#define JH7110_SYSRST_AXI_CFG1_DEC_AHB 33 +#define JH7110_SYSRST_AXI_CFG1_DEC_MAIN 34 +#define JH7110_SYSRST_AXI_CFG0_DEC_MAIN 35 +#define JH7110_SYSRST_AXI_CFG0_DEC_MAIN_DIV 36 +#define JH7110_SYSRST_AXI_CFG0_DEC_HIFI4 37 +#define JH7110_SYSRST_DDR_AXI 38 +#define JH7110_SYSRST_DDR_OSC 39 +#define JH7110_SYSRST_DDR_APB 40 +#define JH7110_SYSRST_DOM_ISP_TOP_N 41 +#define JH7110_SYSRST_DOM_ISP_TOP_AXI 42 +#define JH7110_SYSRST_DOM_VOUT_TOP_SRC 43 +#define JH7110_SYSRST_CODAJ12_AXI 44 +#define JH7110_SYSRST_CODAJ12_CORE 45 +#define JH7110_SYSRST_CODAJ12_APB 46 +#define JH7110_SYSRST_WAVE511_AXI 47 +#define JH7110_SYSRST_WAVE511_BPU 48 +#define JH7110_SYSRST_WAVE511_VCE 49 +#define JH7110_SYSRST_WAVE511_APB 50 +#define JH7110_SYSRST_VDEC_JPG_ARB_JPG 51 +#define JH7110_SYSRST_VDEC_JPG_ARB_MAIN 52 +#define JH7110_SYSRST_AXIMEM0_AXI 53 +#define JH7110_SYSRST_WAVE420L_AXI 54 +#define JH7110_SYSRST_WAVE420L_BPU 55 +#define JH7110_SYSRST_WAVE420L_VCE 56 +#define JH7110_SYSRST_WAVE420L_APB 57 +#define JH7110_SYSRST_AXIMEM1_AXI 58 +#define JH7110_SYSRST_AXIMEM2_AXI 59 +#define JH7110_SYSRST_INTMEM 60 +#define JH7110_SYSRST_QSPI_AHB 61 +#define JH7110_SYSRST_QSPI_APB 62 +#define JH7110_SYSRST_QSPI_REF 63 + +#define JH7110_SYSRST_SDIO0_AHB 64 +#define JH7110_SYSRST_SDIO1_AHB 65 +#define JH7110_SYSRST_GMAC1_AXI 66 +#define JH7110_SYSRST_GMAC1_AHB 67 +#define JH7110_SYSRST_MAILBOX 68 +#define JH7110_SYSRST_SPI0_APB 69 +#define JH7110_SYSRST_SPI1_APB 70 +#define JH7110_SYSRST_SPI2_APB 71 +#define JH7110_SYSRST_SPI3_APB 72 +#define JH7110_SYSRST_SPI4_APB 73 +#define JH7110_SYSRST_SPI5_APB 74 +#define JH7110_SYSRST_SPI6_APB 75 +#define JH7110_SYSRST_I2C0_APB 76 +#define JH7110_SYSRST_I2C1_APB 77 +#define JH7110_SYSRST_I2C2_APB 78 +#define JH7110_SYSRST_I2C3_APB 79 +#define JH7110_SYSRST_I2C4_APB 80 +#define JH7110_SYSRST_I2C5_APB 81 +#define JH7110_SYSRST_I2C6_APB 82 +#define JH7110_SYSRST_UART0_APB 83 +#define JH7110_SYSRST_UART0_CORE 84 +#define JH7110_SYSRST_UART1_APB 85 +#define JH7110_SYSRST_UART1_CORE 86 +#define JH7110_SYSRST_UART2_APB 87 +#define JH7110_SYSRST_UART2_CORE 88 +#define JH7110_SYSRST_UART3_APB 89 +#define JH7110_SYSRST_UART3_CORE 90 +#define JH7110_SYSRST_UART4_APB 91 +#define JH7110_SYSRST_UART4_CORE 92 +#define JH7110_SYSRST_UART5_APB 93 +#define JH7110_SYSRST_UART5_CORE 94 +#define JH7110_SYSRST_SPDIF_APB 95 + +#define JH7110_SYSRST_PWMDAC_APB 96 +#define JH7110_SYSRST_PDM_DMIC 97 +#define JH7110_SYSRST_PDM_APB 98 +#define JH7110_SYSRST_I2SRX_APB 99 +#define JH7110_SYSRST_I2SRX_BCLK 100 +#define JH7110_SYSRST_I2STX0_APB 101 +#define JH7110_SYSRST_I2STX0_BCLK 102 +#define JH7110_SYSRST_I2STX1_APB 103 +#define JH7110_SYSRST_I2STX1_BCLK 104 +#define JH7110_SYSRST_TDM_AHB 105 +#define JH7110_SYSRST_TDM_CORE 106 +#define JH7110_SYSRST_TDM_APB 107 +#define JH7110_SYSRST_PWM_APB 108 +#define JH7110_SYSRST_WDT_APB 109 +#define JH7110_SYSRST_WDT_CORE 110 +#define JH7110_SYSRST_CAN0_APB 111 +#define JH7110_SYSRST_CAN0_CORE 112 +#define JH7110_SYSRST_CAN0_TIMER 113 +#define JH7110_SYSRST_CAN1_APB 114 +#define JH7110_SYSRST_CAN1_CORE 115 +#define JH7110_SYSRST_CAN1_TIMER 116 +#define JH7110_SYSRST_TIMER_APB 117 +#define JH7110_SYSRST_TIMER0 118 +#define JH7110_SYSRST_TIMER1 119 +#define JH7110_SYSRST_TIMER2 120 +#define JH7110_SYSRST_TIMER3 121 +#define JH7110_SYSRST_INT_CTRL_APB 122 +#define JH7110_SYSRST_TEMP_APB 123 +#define JH7110_SYSRST_TEMP_CORE 124 +#define JH7110_SYSRST_JTAG_CERTIFICATION 125 + +#define JH7110_SYSRST_END 126 + +/* AONCRG resets */ +#define JH7110_AONRST_GMAC0_AXI 0 +#define JH7110_AONRST_GMAC0_AHB 1 +#define JH7110_AONRST_IOMUX 2 +#define JH7110_AONRST_PMU_APB 3 +#define JH7110_AONRST_PMU_WKUP 4 +#define JH7110_AONRST_RTC_APB 5 +#define JH7110_AONRST_RTC_CAL 6 +#define JH7110_AONRST_RTC_32K 7 + +#define JH7110_AONRST_END 8 + +/* STGCRG resets */ +#define JH7110_STGRST_SYSCON_PRESETN 0 +#define JH7110_STGRST_HIFI4_CORE 1 +#define JH7110_STGRST_HIFI4_AXI 2 +#define JH7110_STGRST_SEC_TOP_HRESETN 3 +#define JH7110_STGRST_E24_CORE 4 +#define JH7110_STGRST_DMA1P_AXI 5 +#define JH7110_STGRST_DMA1P_AHB 6 +#define JH7110_STGRST_USB_AXI 7 +#define JH7110_STGRST_USB_APB 8 +#define JH7110_STGRST_USB_UTMI_APB 9 +#define JH7110_STGRST_USB_PWRUP 10 +#define JH7110_STGRST_PCIE0_MST0 11 +#define JH7110_STGRST_PCIE0_SLV0 12 +#define JH7110_STGRST_PCIE0_SLV 13 +#define JH7110_STGRST_PCIE0_BRG 14 +#define JH7110_STGRST_PCIE0_CORE 15 +#define JH7110_STGRST_PCIE0_APB 16 +#define JH7110_STGRST_PCIE1_MST0 17 +#define JH7110_STGRST_PCIE1_SLV0 18 +#define JH7110_STGRST_PCIE1_SLV 19 +#define JH7110_STGRST_PCIE1_BRG 20 +#define JH7110_STGRST_PCIE1_CORE 21 +#define JH7110_STGRST_PCIE1_APB 22 + +#define JH7110_STGRST_END 23 + +#endif /* __DT_BINDINGS_RESET_STARFIVE_JH7110_H__ */
Signature · 1 line
2.17.1
PATCH v5 4/17 reset: starfive: jh7110: Add reset driver for StarFive JH7110 SoC
In reply to Yanhong WangAdd a DM reset driver for StarFive JH7110 SoC.
Note that the register base address of reset controller is the same with the clock controller. Therefore, there is no device tree node alone for reset driver.It binds device node in the clock driver
--- drivers/reset/Kconfig | 16 ++++ drivers/reset/Makefile | 1 + drivers/reset/reset-jh7110.c | 158 +++++++++++++++++++++++++++++++++++ 3 files changed, 175 insertions(+) create mode 100644 drivers/reset/reset-jh7110.c
drivers/reset/Kconfig +16 -0
@@ -172,6 +172,22 @@ config RESET_SIFIVE different hw blocks like DDR, gemgxl. With this driver we leverage U-Boot's reset framework to reset these hardware blocks. +config RESET_JH7110 + bool "Reset driver for StarFive JH7110 SoC" + depends on DM_RESET && STARFIVE_JH7110 + default y + help + Support for reset controller on StarFive + JH7110 SoCs. + +config SPL_RESET_JH7110 + bool "SPL Reset driver for StarFive JH7110 SoC" + depends on SPL && STARFIVE_JH7110 + default y + help + Support for reset controller on StarFive + JH7110 SoCs in SPL. + config RESET_SYSCON bool "Enable generic syscon reset driver support" depends on DM_RESET
drivers/reset/Makefile +1 -0
@@ -32,3 +32,4 @@ obj-$(CONFIG_RESET_SCMI) += reset-scmi.o obj-$(CONFIG_RESET_ZYNQMP) += reset-zynqmp.o obj-$(CONFIG_RESET_DRA7) += reset-dra7.o obj-$(CONFIG_RESET_AT91) += reset-at91.o +obj-$(CONFIG_$(SPL_TPL_)RESET_JH7110) += reset-jh7110.o
drivers/reset/reset-jh7110.c new file +158 -0
158 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v5 5/17 dt-bindings: clock: Add StarFive JH7110 clock definitions
In reply to Yanhong WangAdd all clock outputs for the StarFive JH7110 clock generator.
--- .../dt-bindings/clock/starfive,jh7110-crg.h | 257 ++++++++++++++++++ 1 file changed, 257 insertions(+) create mode 100644 include/dt-bindings/clock/starfive,jh7110-crg.h
include/dt-bindings/clock/starfive,jh7110-crg.h new file +257 -0
@@ -0,0 +1,257 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2022 StarFive Technology Co., Ltd. +* +* Author: Yanhong Wang <[email protected]> +*/ + +#ifndef __DT_BINDINGS_CLOCK_STARFIVE_JH7110_H__ +#define __DT_BINDINGS_CLOCK_STARFIVE_JH7110_H__ + +#define JH7110_SYSCLK_CPU_ROOT 0 +#define JH7110_SYSCLK_CPU_CORE 1 +#define JH7110_SYSCLK_CPU_BUS 2 +#define JH7110_SYSCLK_GPU_ROOT 3 +#define JH7110_SYSCLK_PERH_ROOT 4 +#define JH7110_SYSCLK_BUS_ROOT 5 +#define JH7110_SYSCLK_NOCSTG_BUS 6 +#define JH7110_SYSCLK_AXI_CFG0 7 +#define JH7110_SYSCLK_STG_AXIAHB 8 +#define JH7110_SYSCLK_AHB0 9 +#define JH7110_SYSCLK_AHB1 10 +#define JH7110_SYSCLK_APB_BUS 11 +#define JH7110_SYSCLK_APB0 12 +#define JH7110_SYSCLK_PLL0_DIV2 13 +#define JH7110_SYSCLK_PLL1_DIV2 14 +#define JH7110_SYSCLK_PLL2_DIV2 15 +#define JH7110_SYSCLK_AUDIO_ROOT 16 +#define JH7110_SYSCLK_MCLK_INNER 17 +#define JH7110_SYSCLK_MCLK 18 +#define JH7110_SYSCLK_MCLK_OUT 19 +#define JH7110_SYSCLK_ISP_2X 20 +#define JH7110_SYSCLK_ISP_AXI 21 +#define JH7110_SYSCLK_GCLK0 22 +#define JH7110_SYSCLK_GCLK1 23 +#define JH7110_SYSCLK_GCLK2 24 +#define JH7110_SYSCLK_CORE 25 +#define JH7110_SYSCLK_CORE1 26 +#define JH7110_SYSCLK_CORE2 27 +#define JH7110_SYSCLK_CORE3 28 +#define JH7110_SYSCLK_CORE4 29 +#define JH7110_SYSCLK_DEBUG 30 +#define JH7110_SYSCLK_RTC_TOGGLE 31 +#define JH7110_SYSCLK_TRACE0 32 +#define JH7110_SYSCLK_TRACE1 33 +#define JH7110_SYSCLK_TRACE2 34 +#define JH7110_SYSCLK_TRACE3 35 +#define JH7110_SYSCLK_TRACE4 36 +#define JH7110_SYSCLK_TRACE_COM 37 +#define JH7110_SYSCLK_NOC_BUS_CPU_AXI 38 +#define JH7110_SYSCLK_NOC_BUS_AXICFG0_AXI 39 +#define JH7110_SYSCLK_OSC_DIV2 40 +#define JH7110_SYSCLK_PLL1_DIV4 41 +#define JH7110_SYSCLK_PLL1_DIV8 42 +#define JH7110_SYSCLK_DDR_BUS 43 +#define JH7110_SYSCLK_DDR_AXI 44 +#define JH7110_SYSCLK_GPU_CORE 45 +#define JH7110_SYSCLK_GPU_CORE_CLK 46 +#define JH7110_SYSCLK_GPU_SYS_CLK 47 +#define JH7110_SYSCLK_GPU_APB 48 +#define JH7110_SYSCLK_GPU_RTC_TOGGLE 49 +#define JH7110_SYSCLK_NOC_BUS_GPU_AXI 50 +#define JH7110_SYSCLK_ISP_TOP_CLK_ISPCORE_2X 51 +#define JH7110_SYSCLK_ISP_TOP_CLK_ISP_AXI 52 +#define JH7110_SYSCLK_NOC_BUS_ISP_AXI 53 +#define JH7110_SYSCLK_HIFI4_CORE 54 +#define JH7110_SYSCLK_HIFI4_AXI 55 +#define JH7110_SYSCLK_AXI_CFG1_DEC_MAIN 56 +#define JH7110_SYSCLK_AXI_CFG1_DEC_AHB 57 +#define JH7110_SYSCLK_VOUT_SRC 58 +#define JH7110_SYSCLK_VOUT_AXI 59 +#define JH7110_SYSCLK_NOC_BUS_DISP_AXI 60 +#define JH7110_SYSCLK_VOUT_TOP_CLK_VOUT_AHB 61 +#define JH7110_SYSCLK_VOUT_TOP_CLK_VOUT_AXI 62 +#define JH7110_SYSCLK_VOUT_TOP_CLK_HDMITX0_MCLK 63 +#define JH7110_SYSCLK_VOUT_TOP_CLK_MIPIPHY_REF 64 +#define JH7110_SYSCLK_JPEGC_AXI 65 +#define JH7110_SYSCLK_CODAJ12_AXI 66 +#define JH7110_SYSCLK_CODAJ12_CORE 67 +#define JH7110_SYSCLK_CODAJ12_APB 68 +#define JH7110_SYSCLK_VDEC_AXI 69 +#define JH7110_SYSCLK_WAVE511_AXI 70 +#define JH7110_SYSCLK_WAVE511_BPU 71 +#define JH7110_SYSCLK_WAVE511_VCE 72 +#define JH7110_SYSCLK_WAVE511_APB 73 +#define JH7110_SYSCLK_VDEC_JPG_ARB_JPG 74 +#define JH7110_SYSCLK_VDEC_JPG_ARB_MAIN 75 +#define JH7110_SYSCLK_NOC_BUS_VDEC_AXI 76 +#define JH7110_SYSCLK_VENC_AXI 77 +#define JH7110_SYSCLK_WAVE420L_AXI 78 +#define JH7110_SYSCLK_WAVE420L_BPU 79 +#define JH7110_SYSCLK_WAVE420L_VCE 80 +#define JH7110_SYSCLK_WAVE420L_APB 81 +#define JH7110_SYSCLK_NOC_BUS_VENC_AXI 82 +#define JH7110_SYSCLK_AXI_CFG0_DEC_MAIN_DIV 83 +#define JH7110_SYSCLK_AXI_CFG0_DEC_MAIN 84 +#define JH7110_SYSCLK_AXI_CFG0_DEC_HIFI4 85 +#define JH7110_SYSCLK_AXIMEM2_AXI 86 +#define JH7110_SYSCLK_QSPI_AHB 87 +#define JH7110_SYSCLK_QSPI_APB 88 +#define JH7110_SYSCLK_QSPI_REF_SRC 89 +#define JH7110_SYSCLK_QSPI_REF 90 +#define JH7110_SYSCLK_SDIO0_AHB 91 +#define JH7110_SYSCLK_SDIO1_AHB 92 +#define JH7110_SYSCLK_SDIO0_SDCARD 93 +#define JH7110_SYSCLK_SDIO1_SDCARD 94 +#define JH7110_SYSCLK_USB_125M 95 +#define JH7110_SYSCLK_NOC_BUS_STG_AXI 96 +#define JH7110_SYSCLK_GMAC1_AHB 97 +#define JH7110_SYSCLK_GMAC1_AXI 98 +#define JH7110_SYSCLK_GMAC_SRC 99 +#define JH7110_SYSCLK_GMAC1_GTXCLK 100 +#define JH7110_SYSCLK_GMAC1_RMII_RTX 101 +#define JH7110_SYSCLK_GMAC1_PTP 102 +#define JH7110_SYSCLK_GMAC1_RX 103 +#define JH7110_SYSCLK_GMAC1_RX_INV 104 +#define JH7110_SYSCLK_GMAC1_TX 105 +#define JH7110_SYSCLK_GMAC1_TX_INV 106 +#define JH7110_SYSCLK_GMAC1_GTXC 107 +#define JH7110_SYSCLK_GMAC0_GTXCLK 108 +#define JH7110_SYSCLK_GMAC0_PTP 109 +#define JH7110_SYSCLK_GMAC_PHY 110 +#define JH7110_SYSCLK_GMAC0_GTXC 111 +#define JH7110_SYSCLK_IOMUX_APB 112 +#define JH7110_SYSCLK_MAILBOX 113 +#define JH7110_SYSCLK_INT_CTRL_APB 114 +#define JH7110_SYSCLK_CAN0_APB 115 +#define JH7110_SYSCLK_CAN0_TIMER 116 +#define JH7110_SYSCLK_CAN0_CAN 117 +#define JH7110_SYSCLK_CAN1_APB 118 +#define JH7110_SYSCLK_CAN1_TIMER 119 +#define JH7110_SYSCLK_CAN1_CAN 120 +#define JH7110_SYSCLK_PWM_APB 121 +#define JH7110_SYSCLK_WDT_APB 122 +#define JH7110_SYSCLK_WDT_CORE 123 +#define JH7110_SYSCLK_TIMER_APB 124 +#define JH7110_SYSCLK_TIMER0 125 +#define JH7110_SYSCLK_TIMER1 126 +#define JH7110_SYSCLK_TIMER2 127 +#define JH7110_SYSCLK_TIMER3 128 +#define JH7110_SYSCLK_TEMP_APB 129 +#define JH7110_SYSCLK_TEMP_CORE 130 +#define JH7110_SYSCLK_SPI0_APB 131 +#define JH7110_SYSCLK_SPI1_APB 132 +#define JH7110_SYSCLK_SPI2_APB 133 +#define JH7110_SYSCLK_SPI3_APB 134 +#define JH7110_SYSCLK_SPI4_APB 135 +#define JH7110_SYSCLK_SPI5_APB 136 +#define JH7110_SYSCLK_SPI6_APB 137 +#define JH7110_SYSCLK_I2C0_APB 138 +#define JH7110_SYSCLK_I2C1_APB 139 +#define JH7110_SYSCLK_I2C2_APB 140 +#define JH7110_SYSCLK_I2C3_APB 141 +#define JH7110_SYSCLK_I2C4_APB 142 +#define JH7110_SYSCLK_I2C5_APB 143 +#define JH7110_SYSCLK_I2C6_APB 144 +#define JH7110_SYSCLK_UART0_APB 145 +#define JH7110_SYSCLK_UART0_CORE 146 +#define JH7110_SYSCLK_UART1_APB 147 +#define JH7110_SYSCLK_UART1_CORE 148 +#define JH7110_SYSCLK_UART2_APB 149 +#define JH7110_SYSCLK_UART2_CORE 150 +#define JH7110_SYSCLK_UART3_APB 151 +#define JH7110_SYSCLK_UART3_CORE 152 +#define JH7110_SYSCLK_UART4_APB 153 +#define JH7110_SYSCLK_UART4_CORE 154 +#define JH7110_SYSCLK_UART5_APB 155 +#define JH7110_SYSCLK_UART5_CORE 156 +#define JH7110_SYSCLK_PWMDAC_APB 157 +#define JH7110_SYSCLK_PWMDAC_CORE 158 +#define JH7110_SYSCLK_SPDIF_APB 159 +#define JH7110_SYSCLK_SPDIF_CORE 160 +#define JH7110_SYSCLK_I2STX0_APB 161 +#define JH7110_SYSCLK_I2STX0_BCLK_MST 162 +#define JH7110_SYSCLK_I2STX0_BCLK_MST_INV 163 +#define JH7110_SYSCLK_I2STX0_LRCK_MST 164 +#define JH7110_SYSCLK_I2STX0_BCLK 165 +#define JH7110_SYSCLK_I2STX0_BCLK_INV 166 +#define JH7110_SYSCLK_I2STX0_LRCK 167 +#define JH7110_SYSCLK_I2STX1_APB 168 +#define JH7110_SYSCLK_I2STX1_BCLK_MST 169 +#define JH7110_SYSCLK_I2STX1_BCLK_MST_INV 170 +#define JH7110_SYSCLK_I2STX1_LRCK_MST 171 +#define JH7110_SYSCLK_I2STX1_BCLK 172 +#define JH7110_SYSCLK_I2STX1_BCLK_INV 173 +#define JH7110_SYSCLK_I2STX1_LRCK 174 +#define JH7110_SYSCLK_I2SRX_APB 175 +#define JH7110_SYSCLK_I2SRX_BCLK_MST 176 +#define JH7110_SYSCLK_I2SRX_BCLK_MST_INV 177 +#define JH7110_SYSCLK_I2SRX_LRCK_MST 178 +#define JH7110_SYSCLK_I2SRX_BCLK 179 +#define JH7110_SYSCLK_I2SRX_BCLK_INV 180 +#define JH7110_SYSCLK_I2SRX_LRCK 181 +#define JH7110_SYSCLK_PDM_DMIC 182 +#define JH7110_SYSCLK_PDM_APB 183 +#define JH7110_SYSCLK_TDM_AHB 184 +#define JH7110_SYSCLK_TDM_APB 185 +#define JH7110_SYSCLK_TDM_INTERNAL 186 +#define JH7110_SYSCLK_TDM_CLK_TDM 187 +#define JH7110_SYSCLK_TDM_CLK_TDM_N 188 +#define JH7110_SYSCLK_JTAG_CERTIFICATION_TRNG 189 + +#define JH7110_SYSCLK_PLL0_OUT 190 +#define JH7110_SYSCLK_PLL1_OUT 191 +#define JH7110_SYSCLK_PLL2_OUT 192 + +#define JH7110_SYSCLK_END 193 + +#define JH7110_AONCLK_OSC_DIV4 (JH7110_SYSCLK_END + 0) +#define JH7110_AONCLK_APB_FUNC (JH7110_SYSCLK_END + 1) +#define JH7110_AONCLK_GMAC0_AHB (JH7110_SYSCLK_END + 2) +#define JH7110_AONCLK_GMAC0_AXI (JH7110_SYSCLK_END + 3) +#define JH7110_AONCLK_GMAC0_RMII_RTX (JH7110_SYSCLK_END + 4) +#define JH7110_AONCLK_GMAC0_TX (JH7110_SYSCLK_END + 5) +#define JH7110_AONCLK_GMAC0_TX_INV (JH7110_SYSCLK_END + 6) +#define JH7110_AONCLK_GMAC0_RX (JH7110_SYSCLK_END + 7) +#define JH7110_AONCLK_GMAC0_RX_INV (JH7110_SYSCLK_END + 8) +#define JH7110_AONCLK_OTPC_APB (JH7110_SYSCLK_END + 9) +#define JH7110_AONCLK_RTC_APB (JH7110_SYSCLK_END + 10) +#define JH7110_AONCLK_RTC_INTERNAL (JH7110_SYSCLK_END + 11) +#define JH7110_AONCLK_RTC_32K (JH7110_SYSCLK_END + 12) +#define JH7110_AONCLK_RTC_CAL (JH7110_SYSCLK_END + 13) + +#define JH7110_AONCLK_END (JH7110_SYSCLK_END + 14) + +#define JH7110_STGCLK_HIFI4_CORE (JH7110_AONCLK_END + 0) +#define JH7110_STGCLK_USB_APB (JH7110_AONCLK_END + 1) +#define JH7110_STGCLK_USB_UTMI_APB (JH7110_AONCLK_END + 2) +#define JH7110_STGCLK_USB_AXI (JH7110_AONCLK_END + 3) +#define JH7110_STGCLK_USB_LPM (JH7110_AONCLK_END + 4) +#define JH7110_STGCLK_USB_STB (JH7110_AONCLK_END + 5) +#define JH7110_STGCLK_USB_APP_125 (JH7110_AONCLK_END + 6) +#define JH7110_STGCLK_USB_REFCLK (JH7110_AONCLK_END + 7) +#define JH7110_STGCLK_PCIE0_AXI (JH7110_AONCLK_END + 8) +#define JH7110_STGCLK_PCIE0_APB (JH7110_AONCLK_END + 9) +#define JH7110_STGCLK_PCIE0_TL (JH7110_AONCLK_END + 10) +#define JH7110_STGCLK_PCIE1_AXI (JH7110_AONCLK_END + 11) +#define JH7110_STGCLK_PCIE1_APB (JH7110_AONCLK_END + 12) +#define JH7110_STGCLK_PCIE1_TL (JH7110_AONCLK_END + 13) +#define JH7110_STGCLK_PCIE01_MAIN (JH7110_AONCLK_END + 14) +#define JH7110_STGCLK_SEC_HCLK (JH7110_AONCLK_END + 15) +#define JH7110_STGCLK_SEC_MISCAHB (JH7110_AONCLK_END + 16) +#define JH7110_STGCLK_MTRX_GRP0_MAIN (JH7110_AONCLK_END + 17) +#define JH7110_STGCLK_MTRX_GRP0_BUS (JH7110_AONCLK_END + 18) +#define JH7110_STGCLK_MTRX_GRP0_STG (JH7110_AONCLK_END + 19) +#define JH7110_STGCLK_MTRX_GRP1_MAIN (JH7110_AONCLK_END + 20) +#define JH7110_STGCLK_MTRX_GRP1_BUS (JH7110_AONCLK_END + 21) +#define JH7110_STGCLK_MTRX_GRP1_STG (JH7110_AONCLK_END + 22) +#define JH7110_STGCLK_MTRX_GRP1_HIFI (JH7110_AONCLK_END + 23) +#define JH7110_STGCLK_E2_RTC (JH7110_AONCLK_END + 24) +#define JH7110_STGCLK_E2_CORE (JH7110_AONCLK_END + 25) +#define JH7110_STGCLK_E2_DBG (JH7110_AONCLK_END + 26) +#define JH7110_STGCLK_DMA1P_AXI (JH7110_AONCLK_END + 27) +#define JH7110_STGCLK_DMA1P_AHB (JH7110_AONCLK_END + 28) + +#define JH7110_STGCLK_END (JH7110_AONCLK_END + 29) + +#endif /* __DT_BINDINGS_CLOCK_STARFIVE_JH7110_H__ */
Signature · 1 line
2.17.1
PATCH v5 6/17 clk: starfive: Add StarFive JH7110 clock driver
In reply to Yanhong WangAdd a DM clock driver for StarFive JH7110 SoC.
--- drivers/clk/Kconfig | 1 + drivers/clk/Makefile | 1 + drivers/clk/starfive/Kconfig | 17 + drivers/clk/starfive/Makefile | 4 + drivers/clk/starfive/clk-jh7110-pll.c | 321 ++++++++++++++ drivers/clk/starfive/clk-jh7110.c | 603 ++++++++++++++++++++++++++ drivers/clk/starfive/clk.h | 57 +++ 7 files changed, 1004 insertions(+) create mode 100644 drivers/clk/starfive/Kconfig create mode 100644 drivers/clk/starfive/Makefile create mode 100644 drivers/clk/starfive/clk-jh7110-pll.c create mode 100644 drivers/clk/starfive/clk-jh7110.c create mode 100644 drivers/clk/starfive/clk.h
drivers/clk/Kconfig +1 -0
@@ -235,6 +235,7 @@ source "drivers/clk/owl/Kconfig" source "drivers/clk/renesas/Kconfig" source "drivers/clk/sunxi/Kconfig" source "drivers/clk/sifive/Kconfig" +source "drivers/clk/starfive/Kconfig" source "drivers/clk/stm32/Kconfig" source "drivers/clk/tegra/Kconfig" source "drivers/clk/ti/Kconfig"
drivers/clk/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_$(SPL_TPL_)CLK_COMPOSITE_CCF) += clk-composite.o obj-y += analogbits/ obj-y += imx/ +obj-$(CONFIG_CLK_JH7110) += starfive/ obj-y += tegra/ obj-y += ti/ obj-$(CONFIG_$(SPL_TPL_)CLK_INTEL) += intel/
drivers/clk/starfive/Kconfig new file +17 -0
@@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0+ + +config SPL_CLK_JH7110 + bool "SPL clock support for JH7110" + depends on STARFIVE_JH7110 && SPL + select SPL_CLK + select SPL_CLK_CCF + help + This enables SPL DM support for clock driver in JH7110. + +config CLK_JH7110 + bool "StarFive JH7110 clock support" + depends on STARFIVE_JH7110 + select CLK + select CLK_CCF + help + This enables support clock driver for StarFive JH7110 SoC platform.
drivers/clk/starfive/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-y += clk-jh7110.o +obj-y += clk-jh7110-pll.o
drivers/clk/starfive/clk-jh7110-pll.c new file +321 -0
321 lines not on this page · raw message
drivers/clk/starfive/clk-jh7110.c new file +603 -0
603 lines not on this page · raw message
drivers/clk/starfive/clk.h new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v5 7/17 dt-bindings: pinctrl: Add StarFive JH7110 pinctrl definitions
In reply to Yanhong WangFrom: Jianlong Huang <[email protected]>
Add pinctrl definitions for StarFive JH7110 SoC.
--- .../pinctrl/pinctrl-starfive-jh7110.h | 427 ++++++++++++++++++ 1 file changed, 427 insertions(+) create mode 100644 include/dt-bindings/pinctrl/pinctrl-starfive-jh7110.h
include/dt-bindings/pinctrl/pinctrl-starfive-jh7110.h new file +427 -0
@@ -0,0 +1,427 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ +/* +* Copyright (C) 2022 Emil Renner Berthing <[email protected]> +* Copyright (C) 2022 StarFive Technology Co., Ltd. +*/ + +#ifndef __DT_BINDINGS_PINCTRL_STARFIVE_JH7110_H__ +#define __DT_BINDINGS_PINCTRL_STARFIVE_JH7110_H__ + +/* +* mux bits: +* | 31 - 24 | 23 - 16 | 15 - 10 | 9 - 8 | 7 - 0 | +* | din | dout | doen | function | gpio nr | +* +* dout: output signal +* doen: output enable signal +* din: optional input signal, 0xff = none +* function: +* gpio nr: gpio number, 0 - 63 +*/ +#define GPIOMUX (n, dout, doen, din) ( \ + (((din) & 0xff) << 24) | \ + (((dout) & 0xff) << 16) | \ + (((doen) & 0x3f) << 10) | \ + ((n) & 0x3f)) + +#define PINMUX (n, func) ((1 << 10) | (((func) & 0x3) << 8) | ((n) & 0xff)) + +/* sys_iomux pin */ +#define PAD_GPIO0 0 +#define PAD_GPIO1 1 +#define PAD_GPIO2 2 +#define PAD_GPIO3 3 +#define PAD_GPIO4 4 +#define PAD_GPIO5 5 +#define PAD_GPIO6 6 +#define PAD_GPIO7 7 +#define PAD_GPIO8 8 +#define PAD_GPIO9 9 +#define PAD_GPIO10 10 +#define PAD_GPIO11 11 +#define PAD_GPIO12 12 +#define PAD_GPIO13 13 +#define PAD_GPIO14 14 +#define PAD_GPIO15 15 +#define PAD_GPIO16 16 +#define PAD_GPIO17 17 +#define PAD_GPIO18 18 +#define PAD_GPIO19 19 +#define PAD_GPIO20 20 +#define PAD_GPIO21 21 +#define PAD_GPIO22 22 +#define PAD_GPIO23 23 +#define PAD_GPIO24 24 +#define PAD_GPIO25 25 +#define PAD_GPIO26 26 +#define PAD_GPIO27 27 +#define PAD_GPIO28 28 +#define PAD_GPIO29 29 +#define PAD_GPIO30 30 +#define PAD_GPIO31 31 +#define PAD_GPIO32 32 +#define PAD_GPIO33 33 +#define PAD_GPIO34 34 +#define PAD_GPIO35 35 +#define PAD_GPIO36 36 +#define PAD_GPIO37 37 +#define PAD_GPIO38 38 +#define PAD_GPIO39 39 +#define PAD_GPIO40 40 +#define PAD_GPIO41 41 +#define PAD_GPIO42 42 +#define PAD_GPIO43 43 +#define PAD_GPIO44 44 +#define PAD_GPIO45 45 +#define PAD_GPIO46 46 +#define PAD_GPIO47 47 +#define PAD_GPIO48 48 +#define PAD_GPIO49 49 +#define PAD_GPIO50 50 +#define PAD_GPIO51 51 +#define PAD_GPIO52 52 +#define PAD_GPIO53 53 +#define PAD_GPIO54 54 +#define PAD_GPIO55 55 +#define PAD_GPIO56 56 +#define PAD_GPIO57 57 +#define PAD_GPIO58 58 +#define PAD_GPIO59 59 +#define PAD_GPIO60 60 +#define PAD_GPIO61 61 +#define PAD_GPIO62 62 +#define PAD_GPIO63 63 +#define PAD_SD0_CLK 64 +#define PAD_SD0_CMD 65 +#define PAD_SD0_DATA0 66 +#define PAD_SD0_DATA1 67 +#define PAD_SD0_DATA2 68 +#define PAD_SD0_DATA3 69 +#define PAD_SD0_DATA4 70 +#define PAD_SD0_DATA5 71 +#define PAD_SD0_DATA6 72 +#define PAD_SD0_DATA7 73 +#define PAD_SD0_STRB 74 +#define PAD_GMAC1_MDC 75 +#define PAD_GMAC1_MDIO 76 +#define PAD_GMAC1_RXD0 77 +#define PAD_GMAC1_RXD1 78 +#define PAD_GMAC1_RXD2 79 +#define PAD_GMAC1_RXD3 80 +#define PAD_GMAC1_RXDV 81 +#define PAD_GMAC1_RXC 82 +#define PAD_GMAC1_TXD0 83 +#define PAD_GMAC1_TXD1 84 +#define PAD_GMAC1_TXD2 85 +#define PAD_GMAC1_TXD3 86 +#define PAD_GMAC1_TXEN 87 +#define PAD_GMAC1_TXC 88 +#define PAD_QSPI_SCLK 89 +#define PAD_QSPI_CS0 90 +#define PAD_QSPI_DATA0 91 +#define PAD_QSPI_DATA1 92 +#define PAD_QSPI_DATA2 93 +#define PAD_QSPI_DATA3 94 + +/* aon_iomux pin */ +#define PAD_TESTEN 0 +#define PAD_RGPIO0 1 +#define PAD_RGPIO1 2 +#define PAD_RGPIO2 3 +#define PAD_RGPIO3 4 +#define PAD_RSTN 5 +#define PAD_GMAC0_MDC 6 +#define PAD_GMAC0_MDIO 7 +#define PAD_GMAC0_RXD0 8 +#define PAD_GMAC0_RXD1 9 +#define PAD_GMAC0_RXD2 10 +#define PAD_GMAC0_RXD3 11 +#define PAD_GMAC0_RXDV 12 +#define PAD_GMAC0_RXC 13 +#define PAD_GMAC0_TXD0 14 +#define PAD_GMAC0_TXD1 15 +#define PAD_GMAC0_TXD2 16 +#define PAD_GMAC0_TXD3 17 +#define PAD_GMAC0_TXEN 18 +#define PAD_GMAC0_TXC 19 + +/* sys_iomux dout */ +#define GPOUT_LOW 0 +#define GPOUT_HIGH 1 +#define GPOUT_SYS_WAVE511_UART_TX 2 +#define GPOUT_SYS_CAN0_STBY 3 +#define GPOUT_SYS_CAN0_TST_NEXT_BIT 4 +#define GPOUT_SYS_CAN0_TST_SAMPLE_POINT 5 +#define GPOUT_SYS_CAN0_TXD 6 +#define GPOUT_SYS_USB_DRIVE_VBUS 7 +#define GPOUT_SYS_QSPI_CS1 8 +#define GPOUT_SYS_SPDIF 9 +#define GPOUT_SYS_HDMI_CEC_SDA 10 +#define GPOUT_SYS_HDMI_DDC_SCL 11 +#define GPOUT_SYS_HDMI_DDC_SDA 12 +#define GPOUT_SYS_WATCHDOG 13 +#define GPOUT_SYS_I2C0_CLK 14 +#define GPOUT_SYS_I2C0_DATA 15 +#define GPOUT_SYS_SDIO0_BACK_END_POWER 16 +#define GPOUT_SYS_SDIO0_CARD_POWER_EN 17 +#define GPOUT_SYS_SDIO0_CCMD_OD_PULLUP_EN 18 +#define GPOUT_SYS_SDIO0_RST 19 +#define GPOUT_SYS_UART0_TX 20 +#define GPOUT_SYS_HIFI4_JTAG_TDO 21 +#define GPOUT_SYS_JTAG_TDO 22 +#define GPOUT_SYS_PDM_MCLK 23 +#define GPOUT_SYS_PWM_CHANNEL0 24 +#define GPOUT_SYS_PWM_CHANNEL1 25 +#define GPOUT_SYS_PWM_CHANNEL2 26 +#define GPOUT_SYS_PWM_CHANNEL3 27 +#define GPOUT_SYS_PWMDAC_LEFT 28 +#define GPOUT_SYS_PWMDAC_RIGHT 29 +#define GPOUT_SYS_SPI0_CLK 30 +#define GPOUT_SYS_SPI0_FSS 31 +#define GPOUT_SYS_SPI0_TXD 32 +#define GPOUT_SYS_GMAC_PHYCLK 33 +#define GPOUT_SYS_I2SRX_BCLK 34 +#define GPOUT_SYS_I2SRX_LRCK 35 +#define GPOUT_SYS_I2STX0_BCLK 36 +#define GPOUT_SYS_I2STX0_LRCK 37 +#define GPOUT_SYS_MCLK 38 +#define GPOUT_SYS_TDM_CLK 39 +#define GPOUT_SYS_TDM_SYNC 40 +#define GPOUT_SYS_TDM_TXD 41 +#define GPOUT_SYS_TRACE_DATA0 42 +#define GPOUT_SYS_TRACE_DATA1 43 +#define GPOUT_SYS_TRACE_DATA2 44 +#define GPOUT_SYS_TRACE_DATA3 45 +#define GPOUT_SYS_TRACE_REF 46 +#define GPOUT_SYS_CAN1_STBY 47 +#define GPOUT_SYS_CAN1_TST_NEXT_BIT 48 +#define GPOUT_SYS_CAN1_TST_SAMPLE_POINT 49 +#define GPOUT_SYS_CAN1_TXD 50 +#define GPOUT_SYS_I2C1_CLK 51 +#define GPOUT_SYS_I2C1_DATA 52 +#define GPOUT_SYS_SDIO1_BACK_END_POWER 53 +#define GPOUT_SYS_SDIO1_CARD_POWER_EN 54 +#define GPOUT_SYS_SDIO1_CLK 55 +#define GPOUT_SYS_SDIO1_CMD_OD_PULLUP_EN 56 +#define GPOUT_SYS_SDIO1_CMD 57 +#define GPOUT_SYS_SDIO1_DATA0 58 +#define GPOUT_SYS_SDIO1_DATA1 59 +#define GPOUT_SYS_SDIO1_DATA2 60 +#define GPOUT_SYS_SDIO1_DATA3 61 +#define GPOUT_SYS_SDIO1_DATA4 63 +#define GPOUT_SYS_SDIO1_DATA5 63 +#define GPOUT_SYS_SDIO1_DATA6 64 +#define GPOUT_SYS_SDIO1_DATA7 65 +#define GPOUT_SYS_SDIO1_RST 66 +#define GPOUT_SYS_UART1_RTS 67 +#define GPOUT_SYS_UART1_TX 68 +#define GPOUT_SYS_I2STX1_SDO0 69 +#define GPOUT_SYS_I2STX1_SDO1 70 +#define GPOUT_SYS_I2STX1_SDO2 71 +#define GPOUT_SYS_I2STX1_SDO3 72 +#define GPOUT_SYS_SPI1_CLK 73 +#define GPOUT_SYS_SPI1_FSS 74 +#define GPOUT_SYS_SPI1_TXD 75 +#define GPOUT_SYS_I2C2_CLK 76 +#define GPOUT_SYS_I2C2_DATA 77 +#define GPOUT_SYS_UART2_RTS 78 +#define GPOUT_SYS_UART2_TX 79 +#define GPOUT_SYS_SPI2_CLK 80 +#define GPOUT_SYS_SPI2_FSS 81 +#define GPOUT_SYS_SPI2_TXD 82 +#define GPOUT_SYS_I2C3_CLK 83 +#define GPOUT_SYS_I2C3_DATA 84 +#define GPOUT_SYS_UART3_TX 85 +#define GPOUT_SYS_SPI3_CLK 86 +#define GPOUT_SYS_SPI3_FSS 87 +#define GPOUT_SYS_SPI3_TXD 88 +#define GPOUT_SYS_I2C4_CLK 89 +#define GPOUT_SYS_I2C4_DATA 90 +#define GPOUT_SYS_UART4_RTS 91 +#define GPOUT_SYS_UART4_TX 92 +#define GPOUT_SYS_SPI4_CLK 93 +#define GPOUT_SYS_SPI4_FSS 94 +#define GPOUT_SYS_SPI4_TXD 95 +#define GPOUT_SYS_I2C5_CLK 96 +#define GPOUT_SYS_I2C5_DATA 97 +#define GPOUT_SYS_UART5_RTS 98 +#define GPOUT_SYS_UART5_TX 99 +#define GPOUT_SYS_SPI5_CLK 100 +#define GPOUT_SYS_SPI5_FSS 101 +#define GPOUT_SYS_SPI5_TXD 102 +#define GPOUT_SYS_I2C6_CLK 103 +#define GPOUT_SYS_I2C6_DATA 104 +#define GPOUT_SYS_SPI6_CLK 105 +#define GPOUT_SYS_SPI6_FSS 106 +#define GPOUT_SYS_SPI6_TXD 107 + +/* aon_iomux dout */ +#define GPOUT_AON_CLK_32K_OUT 2 +#define GPOUT_AON_PTC0_PWM4 3 +#define GPOUT_AON_PTC0_PWM5 4 +#define GPOUT_AON_PTC0_PWM6 5 +#define GPOUT_AON_PTC0_PWM7 6 +#define GPOUT_AON_CLK_GCLK0 7 +#define GPOUT_AON_CLK_GCLK1 8 +#define GPOUT_AON_CLK_GCLK2 9 + +/* sys_iomux doen */ +#define GPOEN_ENABLE 0 +#define GPOEN_DISABLE 1 +#define GPOEN_SYS_HDMI_CEC_SDA 2 +#define GPOEN_SYS_HDMI_DDC_SCL 3 +#define GPOEN_SYS_HDMI_DDC_SDA 4 +#define GPOEN_SYS_I2C0_CLK 5 +#define GPOEN_SYS_I2C0_DATA 6 +#define GPOEN_SYS_HIFI4_JTAG_TDO 7 +#define GPOEN_SYS_JTAG_TDO 8 +#define GPOEN_SYS_PWM0_CHANNEL0 9 +#define GPOEN_SYS_PWM0_CHANNEL1 10 +#define GPOEN_SYS_PWM0_CHANNEL2 11 +#define GPOEN_SYS_PWM0_CHANNEL3 12 +#define GPOEN_SYS_SPI0_NSSPCTL 13 +#define GPOEN_SYS_SPI0_NSSP 14 +#define GPOEN_SYS_TDM_SYNC 15 +#define GPOEN_SYS_TDM_TXD 16 +#define GPOEN_SYS_I2C1_CLK 17 +#define GPOEN_SYS_I2C1_DATA 18 +#define GPOEN_SYS_SDIO1_CMD 19 +#define GPOEN_SYS_SDIO1_DATA0 20 +#define GPOEN_SYS_SDIO1_DATA1 21 +#define GPOEN_SYS_SDIO1_DATA2 22 +#define GPOEN_SYS_SDIO1_DATA3 23 +#define GPOEN_SYS_SDIO1_DATA4 24 +#define GPOEN_SYS_SDIO1_DATA5 25 +#define GPOEN_SYS_SDIO1_DATA6 26 +#define GPOEN_SYS_SDIO1_DATA7 27 +#define GPOEN_SYS_SPI1_NSSPCTL 28 +#define GPOEN_SYS_SPI1_NSSP 29 +#define GPOEN_SYS_I2C2_CLK 30 +#define GPOEN_SYS_I2C2_DATA 31 +#define GPOEN_SYS_SPI2_NSSPCTL 32 +#define GPOEN_SYS_SPI2_NSSP 33 +#define GPOEN_SYS_I2C3_CLK 34 +#define GPOEN_SYS_I2C3_DATA 35 +#define GPOEN_SYS_SPI3_NSSPCTL 36 +#define GPOEN_SYS_SPI3_NSSP 37 +#define GPOEN_SYS_I2C4_CLK 38 +#define GPOEN_SYS_I2C4_DATA 39 +#define GPOEN_SYS_SPI4_NSSPCTL 40 +#define GPOEN_SYS_SPI4_NSSP 41 +#define GPOEN_SYS_I2C5_CLK 42 +#define GPOEN_SYS_I2C5_DATA 43 +#define GPOEN_SYS_SPI5_NSSPCTL 44 +#define GPOEN_SYS_SPI5_NSSP 45 +#define GPOEN_SYS_I2C6_CLK 46 +#define GPOEN_SYS_I2C6_DATA 47 +#define GPOEN_SYS_SPI6_NSSPCTL 48 +#define GPOEN_SYS_SPI6_NSSP 49 + +/* aon_iomux doen */ +#define GPOEN_AON_PTC0_OE_N_4 2 +#define GPOEN_AON_PTC0_OE_N_5 3 +#define GPOEN_AON_PTC0_OE_N_6 4 +#define GPOEN_AON_PTC0_OE_N_7 5 + +/* sys_iomux gin */ +#define GPI_NONE 255 + +#define GPI_SYS_WAVE511_UART_RX 0 +#define GPI_SYS_CAN0_RXD 1 +#define GPI_SYS_USB_OVERCURRENT 2 +#define GPI_SYS_SPDIF 3 +#define GPI_SYS_JTAG_RST 4 +#define GPI_SYS_HDMI_CEC_SDA 5 +#define GPI_SYS_HDMI_DDC_SCL 6 +#define GPI_SYS_HDMI_DDC_SDA 7 +#define GPI_SYS_HDMI_HPD 8 +#define GPI_SYS_I2C0_CLK 9 +#define GPI_SYS_I2C0_DATA 10 +#define GPI_SYS_SDIO0_CD 11 +#define GPI_SYS_SDIO0_INT 12 +#define GPI_SYS_SDIO0_WP 13 +#define GPI_SYS_UART0_RX 14 +#define GPI_SYS_HIFI4_JTAG_TCK 15 +#define GPI_SYS_HIFI4_JTAG_TDI 16 +#define GPI_SYS_HIFI4_JTAG_TMS 17 +#define GPI_SYS_HIFI4_JTAG_RST 18 +#define GPI_SYS_JTAG_TDI 19 +#define GPI_SYS_JTAG_TMS 20 +#define GPI_SYS_PDM_DMIC0 21 +#define GPI_SYS_PDM_DMIC1 22 +#define GPI_SYS_I2SRX_SDIN0 23 +#define GPI_SYS_I2SRX_SDIN1 24 +#define GPI_SYS_I2SRX_SDIN2 25 +#define GPI_SYS_SPI0_CLK 26 +#define GPI_SYS_SPI0_FSS 27 +#define GPI_SYS_SPI0_RXD 28 +#define GPI_SYS_JTAG_TCK 29 +#define GPI_SYS_MCLK_EXT 30 +#define GPI_SYS_I2SRX_BCLK 31 +#define GPI_SYS_I2SRX_LRCK 32 +#define GPI_SYS_I2STX0_BCLK 33 +#define GPI_SYS_I2STX0_LRCK 34 +#define GPI_SYS_TDM_CLK 35 +#define GPI_SYS_TDM_RXD 36 +#define GPI_SYS_TDM_SYNC 37 +#define GPI_SYS_CAN1_RXD 38 +#define GPI_SYS_I2C1_CLK 39 +#define GPI_SYS_I2C1_DATA 40 +#define GPI_SYS_SDIO1_CD 41 +#define GPI_SYS_SDIO1_INT 42 +#define GPI_SYS_SDIO1_WP 43 +#define GPI_SYS_SDIO1_CMD 44 +#define GPI_SYS_SDIO1_DATA0 45 +#define GPI_SYS_SDIO1_DATA1 46 +#define GPI_SYS_SDIO1_DATA2 47 +#define GPI_SYS_SDIO1_DATA3 48 +#define GPI_SYS_SDIO1_DATA4 49 +#define GPI_SYS_SDIO1_DATA5 50 +#define GPI_SYS_SDIO1_DATA6 51 +#define GPI_SYS_SDIO1_DATA7 52 +#define GPI_SYS_SDIO1_STRB 53 +#define GPI_SYS_UART1_CTS 54 +#define GPI_SYS_UART1_RX 55 +#define GPI_SYS_SPI1_CLK 56 +#define GPI_SYS_SPI1_FSS 57 +#define GPI_SYS_SPI1_RXD 58 +#define GPI_SYS_I2C2_CLK 59 +#define GPI_SYS_I2C2_DATA 60 +#define GPI_SYS_UART2_CTS 61 +#define GPI_SYS_UART2_RX 62 +#define GPI_SYS_SPI2_CLK 63 +#define GPI_SYS_SPI2_FSS 64 +#define GPI_SYS_SPI2_RXD 65 +#define GPI_SYS_I2C3_CLK 66 +#define GPI_SYS_I2C3_DATA 67 +#define GPI_SYS_UART3_RX 68 +#define GPI_SYS_SPI3_CLK 69 +#define GPI_SYS_SPI3_FSS 70 +#define GPI_SYS_SPI3_RXD 71 +#define GPI_SYS_I2C4_CLK 72 +#define GPI_SYS_I2C4_DATA 73 +#define GPI_SYS_UART4_CTS 74 +#define GPI_SYS_UART4_RX 75 +#define GPI_SYS_SPI4_CLK 76 +#define GPI_SYS_SPI4_FSS 77 +#define GPI_SYS_SPI4_RXD 78 +#define GPI_SYS_I2C5_CLK 79 +#define GPI_SYS_I2C5_DATA 80 +#define GPI_SYS_UART5_CTS 81 +#define GPI_SYS_UART5_RX 82 +#define GPI_SYS_SPI5_CLK 83 +#define GPI_SYS_SPI5_FSS 84 +#define GPI_SYS_SPI5_RXD 85 +#define GPI_SYS_I2C6_CLK 86 +#define GPI_SYS_I2C6_DATA 87 +#define GPI_SYS_SPI6_CLK 88 +#define GPI_SYS_SPI6_FSS 89 +#define GPI_SYS_SPI6_RXD 90 + +/* aon_iomux gin */ +#define GPI_AON_PMU_GPIO_WAKEUP_0 0 +#define GPI_AON_PMU_GPIO_WAKEUP_1 1 +#define GPI_AON_PMU_GPIO_WAKEUP_2 2 +#define GPI_AON_PMU_GPIO_WAKEUP_3 3 + +#endif
Signature · 1 line
2.17.1
PATCH v5 8/17 pinctrl: starfive: Add StarFive JH7110 driver
In reply to Yanhong WangFrom: Kuan Lim Lee <[email protected]>
Add pinctrl driver for StarFive JH7110 SoC.
--- drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/starfive/Kconfig | 28 ++ drivers/pinctrl/starfive/Makefile | 6 + drivers/pinctrl/starfive/pinctrl-jh7110-aon.c | 113 +++++ drivers/pinctrl/starfive/pinctrl-jh7110-sys.c | 399 ++++++++++++++++++ drivers/pinctrl/starfive/pinctrl-starfive.c | 398 +++++++++++++++++ drivers/pinctrl/starfive/pinctrl-starfive.h | 55 +++ 8 files changed, 1001 insertions(+) create mode 100644 drivers/pinctrl/starfive/Kconfig create mode 100644 drivers/pinctrl/starfive/Makefile create mode 100644 drivers/pinctrl/starfive/pinctrl-jh7110-aon.c create mode 100644 drivers/pinctrl/starfive/pinctrl-jh7110-sys.c create mode 100644 drivers/pinctrl/starfive/pinctrl-starfive.c create mode 100644 drivers/pinctrl/starfive/pinctrl-starfive.h
drivers/pinctrl/Kconfig +1 -0
@@ -359,5 +359,6 @@ source "drivers/pinctrl/renesas/Kconfig" source "drivers/pinctrl/rockchip/Kconfig" source "drivers/pinctrl/sunxi/Kconfig" source "drivers/pinctrl/uniphier/Kconfig" +source "drivers/pinctrl/starfive/Kconfig" endmenu
drivers/pinctrl/Makefile +1 -0
@@ -32,3 +32,4 @@ obj-$(CONFIG_PINCTRL_STM32) += pinctrl_stm32.o obj-$(CONFIG_$(SPL_)PINCTRL_STMFX) += pinctrl-stmfx.o obj-y += broadcom/ obj-$(CONFIG_PINCTRL_ZYNQMP) += pinctrl-zynqmp.o +obj-$(CONFIG_PINCTRL_STARFIVE) += starfive/
drivers/pinctrl/starfive/Kconfig new file +28 -0
@@ -0,0 +1,28 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config SPL_PINCTRL_STARFIVE + bool "Support Pinctrl driver for StarFive SoC in SPL" + depends on SPL_PINCTRL_FULL && STARFIVE_JH7110 + help + Enable support pin control driver for StarFive SoC. + +config SPL_PINCTRL_STARFIVE_JH7110 + bool "Support Pinctrl and GPIO driver for StarFive JH7110 SoC in SPL" + depends on SPL_PINCTRL_STARFIVE + help + Enable support pinctrl and gpio driver for StarFive JH7110 in SPL. + +config PINCTRL_STARFIVE + bool "Pinctrl driver for StarFive SoC" + depends on PINCTRL_FULL && STARFIVE_JH7110 + help + Say yes here to support pin control on the StarFive RISC-V SoC. + This also provides an interface to the GPIO pins not used by other + peripherals supporting inputs, outputs, configuring pull-up/pull-down + and interrupts on input changes. + +config PINCTRL_STARFIVE_JH7110 + bool "Pinctrl and GPIO driver for StarFive JH7110 SoC" + depends on PINCTRL_STARFIVE + help + This selects the pinctrl driver for JH7110 starfive.
drivers/pinctrl/starfive/Makefile new file +6 -0
@@ -0,0 +1,6 @@ + +# SPDX-License-Identifier: GPL-2.0 +# Core +obj-$(CONFIG_$(SPL_TPL_)PINCTRL_STARFIVE) += pinctrl-starfive.o +# SoC Drivers +obj-$(CONFIG_$(SPL_TPL_)PINCTRL_STARFIVE_JH7110) += pinctrl-jh7110-sys.o pinctrl-jh7110-aon.o
drivers/pinctrl/starfive/pinctrl-jh7110-aon.c new file +113 -0
113 lines not on this page · raw message
drivers/pinctrl/starfive/pinctrl-jh7110-sys.c new file +399 -0
399 lines not on this page · raw message
drivers/pinctrl/starfive/pinctrl-starfive.c new file +398 -0
398 lines not on this page · raw message
drivers/pinctrl/starfive/pinctrl-starfive.h new file +55 -0
55 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v5 9/17 ram: starfive: add ddr driver
In reply to Yanhong WangAdd driver for StarFive JH7110 to support ddr initialization in SPL.
--- drivers/ram/Kconfig | 1 + drivers/ram/Makefile | 4 +- drivers/ram/starfive/Kconfig | 5 + drivers/ram/starfive/Makefile | 11 + drivers/ram/starfive/ddrcsr_boot.c | 339 +++++ drivers/ram/starfive/ddrphy_start.c | 279 ++++ drivers/ram/starfive/ddrphy_train.c | 383 ++++++ drivers/ram/starfive/ddrphy_utils.c | 1955 +++++++++++++++++++++++++++ drivers/ram/starfive/starfive_ddr.c | 161 +++ drivers/ram/starfive/starfive_ddr.h | 65 + 10 files changed, 3202 insertions(+), 1 deletion(-) create mode 100644 drivers/ram/starfive/Kconfig create mode 100644 drivers/ram/starfive/Makefile create mode 100644 drivers/ram/starfive/ddrcsr_boot.c create mode 100644 drivers/ram/starfive/ddrphy_start.c create mode 100644 drivers/ram/starfive/ddrphy_train.c create mode 100644 drivers/ram/starfive/ddrphy_utils.c create mode 100644 drivers/ram/starfive/starfive_ddr.c create mode 100644 drivers/ram/starfive/starfive_ddr.h
drivers/ram/Kconfig +1 -0
@@ -112,3 +112,4 @@ source "drivers/ram/rockchip/Kconfig" source "drivers/ram/sifive/Kconfig" source "drivers/ram/stm32mp1/Kconfig" source "drivers/ram/octeon/Kconfig" +source "drivers/ram/starfive/Kconfig"
drivers/ram/Makefile +3 -1
@@ -20,5 +20,7 @@ obj-$(CONFIG_K3_DDRSS) += k3-ddrss/ obj-$(CONFIG_IMXRT_SDRAM) += imxrt_sdram.o obj-$(CONFIG_RAM_SIFIVE) += sifive/ - +ifdef CONFIG_SPL_BUILD +obj-$(CONFIG_SPL_STARFIVE_DDR) += starfive/ +endif obj-$(CONFIG_ARCH_OCTEON) += octeon/
drivers/ram/starfive/Kconfig new file +5 -0
@@ -0,0 +1,5 @@ +config SPL_STARFIVE_DDR + bool "StarFive DDR driver in SPL" + depends on SPL_RAM && STARFIVE_JH7110 + help + This enables DDR support for the platforms based on StarFive JH7110 SoC.
drivers/ram/starfive/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (c) 2022 StarFive, Inc +# +ifdef CONFIG_SPL_BUILD +obj-$(CONFIG_SPL_STARFIVE_DDR) += ddrphy_start.o +obj-$(CONFIG_SPL_STARFIVE_DDR) += ddrphy_train.o +obj-$(CONFIG_SPL_STARFIVE_DDR) += starfive_ddr.o +obj-$(CONFIG_SPL_STARFIVE_DDR) += ddrphy_utils.o +obj-$(CONFIG_SPL_STARFIVE_DDR) += ddrcsr_boot.o +endif
drivers/ram/starfive/ddrcsr_boot.c new file +339 -0
339 lines not on this page · raw message
drivers/ram/starfive/ddrphy_start.c new file +279 -0
279 lines not on this page · raw message
drivers/ram/starfive/ddrphy_train.c new file +383 -0
383 lines not on this page · raw message
drivers/ram/starfive/ddrphy_utils.c new file +1955 -0
1,955 lines not on this page · raw message
drivers/ram/starfive/starfive_ddr.c new file +161 -0
15 lines not on this page · raw message
drivers/ram/starfive/starfive_ddr.h new file +65 -0
65 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.17.1
Part of the diff is not shown here. View the raw message.
PATCH v5 10/17 board: starfive: add StarFive VisionFive v2 board support
In reply to Yanhong WangAdd board support for StarFive VisionFive v2.
--- board/starfive/visionfive2/MAINTAINERS | 7 + board/starfive/visionfive2/Makefile | 7 + board/starfive/visionfive2/spl.c | 87 ++++ .../visionfive2/starfive_visionfive2.c | 40 ++ doc/board/index.rst | 1 + doc/board/starfive/index.rst | 9 + doc/board/starfive/visionfive2.rst | 492 ++++++++++++++++++ include/configs/starfive-visionfive2.h | 49 ++ 8 files changed, 692 insertions(+) create mode 100644 board/starfive/visionfive2/MAINTAINERS create mode 100644 board/starfive/visionfive2/Makefile create mode 100644 board/starfive/visionfive2/spl.c create mode 100644 board/starfive/visionfive2/starfive_visionfive2.c create mode 100644 doc/board/starfive/index.rst create mode 100644 doc/board/starfive/visionfive2.rst create mode 100644 include/configs/starfive-visionfive2.h
board/starfive/visionfive2/MAINTAINERS new file +7 -0
@@ -0,0 +1,7 @@ +STARFIVE JH7110 VISIONFIVE2 BOARD +M: startfive +S: Maintained +F: arch/riscv/include/asm/arch-jh7110/ +F: board/starfive/visionfive2/ +F: include/configs/starfive-visionfive2.h +F: configs/starfive_visionfive2_defconfig
board/starfive/visionfive2/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2022 StarFive Technology Co., Ltd. +# + +obj-y := starfive_visionfive2.o +obj-$(CONFIG_SPL_BUILD) += spl.o
board/starfive/visionfive2/spl.c new file +87 -0
87 lines not on this page · raw message
board/starfive/visionfive2/starfive_visionfive2.c new file +40 -0
@@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2022 StarFive Technology Co., Ltd. +* Author: Yanhong Wang<[email protected]> +*/ + +#include <common.h> +#include <asm/io.h> +#include <cpu_func.h> +#include <linux/bitops.h> + +#define JH7110_L2_PREFETCHER_BASE_ADDR 0x2030000 +#define JH7110_L2_PREFETCHER_HART_OFFSET 0x2000 + +/* enable U74-mc hart1~hart4 prefetcher */ +static void enable_prefetcher (void ) +{ +u8 hart; +u32 *reg; + +/* JH7110 use U74MC CORE IP, it include five cores(one S7 and four U7), +* but only U7 cores support prefetcher configuration +*/ +for (hart =1 ; hart <5 ; hart++) { + reg = (void *)(u64)(JH7110_L2_PREFETCHER_BASE_ADDR + + hart *JH7110_L2_PREFETCHER_HART_OFFSET ); + +mb ();/* memory barrier */ +setbits_le32 (reg,0x1 ); +mb ();/* memory barrier */ + } +} + +int board_init (void ) +{ +enable_caches (); +enable_prefetcher (); + +return 0 ; +}
doc/board/index.rst +1 -0
@@ -39,6 +39,7 @@ Board-specific doc sipeed/index socionext/index st/index + starfive/index ste/index tbs/index ti/index
doc/board/starfive/index.rst new file +9 -0
@@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +StarFive +======== + +.. toctree:: + :maxdepth: 1 + + visionfive2
doc/board/starfive/visionfive2.rst new file +492 -0
492 lines not on this page · raw message
include/configs/starfive-visionfive2.h new file +49 -0
49 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [PATCH v5 10/17] board: starfive: add StarFive VisionFive v2 board support
Quoted 28 lines · Yanhong Wang
Add board support for StarFive VisionFive v2.
Signed-off-by Yanhong Wang <[email protected]>Tested-by Conor Dooley <[email protected]>--- board/starfive/visionfive2/MAINTAINERS | 7 + board/starfive/visionfive2/Makefile | 7 + board/starfive/visionfive2/spl.c | 87 ++++ .../visionfive2/starfive_visionfive2.c | 40 ++ doc/board/index.rst | 1 + doc/board/starfive/index.rst | 9 + doc/board/starfive/visionfive2.rst | 492 ++++++++++++++++++ include/configs/starfive-visionfive2.h | 49 ++ 8 files changed, 692 insertions(+)create mode 100644 board/starfive/visionfive2/MAINTAINERS create mode 100644 board/starfive/visionfive2/Makefile create mode 100644
board/starfive/visionfive2/spl.ccreate mode 100644board/starfive/visionfive2/starfive_visionfive2.ccreate mode 100644doc/board/starfive/index.rst
create mode 100644doc/board/starfive/visionfive2.rstcreate mode 100644include/configs/starfive-visionfive2.hboard/starfive/visionfive2/MAINTAINERS new file +0
-0
board/starfive/visionfive2/MAINTAINERS line 2
Quoted 2 lines
board/starfive/visionfive2/MAINTAINERS new file +2
-0@@ -0,0 +1,7 @@ +STARFIVE JH7110 VISIONFIVE2 BOARD +M: startfive
This line is invalid and leads to errors like:
$ scripts/get_maintainer.pl -f configs/starfive_visionfive2_defconfig Invalid MAINTAINERS address: 'startfive'
Please, provide a valid email address, e.g.
M: Yanhong Wang <[email protected]>
Best regards
Heinrich
Quoted 737 lines
board/starfive/visionfive2/MAINTAINERS new file +5
-0+S: Maintained +F: arch/riscv/include/asm/arch-jh7110/ +F: board/starfive/visionfive2/ +F: include/configs/starfive-visionfive2.h +F: configs/starfive_visionfive2_defconfigboard/starfive/visionfive2/Makefile new file +7
-0@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2022 StarFive Technology Co., Ltd. +# + +obj-y := starfive_visionfive2.o +obj-$(CONFIG_SPL_BUILD) += spl.oboard/starfive/visionfive2/spl.c new file +87
-0@@ -0,0 +1,87 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2022 StarFive Technology Co., Ltd. +* Author: Yanhong Wang<[email protected]> +*/ + +#include <common.h> +#include <asm/arch/regs.h> +#include <asm/arch/spl.h> +#include <asm/io.h> +#include <log.h> +#include <spl.h> + +#define JH7110_CLK_CPU_ROOT_OFFSET 0x0U +#define JH7110_CLK_CPU_ROOT_SHIFT 24 +#define JH7110_CLK_CPU_ROOT_MASK GENMASK(29, 24) + +int spl_board_init_f (void ) +{ +int ret; + + ret =spl_soc_init (); +if (ret) { +debug ("JH7110 SPL init failed: %d\n" , ret); +return ret; + } + +return 0 ; +} + +u32 spl_boot_device (void ) +{ +u32 mode; + + mode =in_le32 (JH7110_BOOT_MODE_SELECT_REG ) + &JH7110_BOOT_MODE_SELECT_MASK ; +switch (mode) { +case 0 : +return BOOT_DEVICE_SPI ; + +case 1 : +return BOOT_DEVICE_MMC2 ; + +case 2 : +return BOOT_DEVICE_MMC1 ; + +case 3 : +return BOOT_DEVICE_UART ; + +default : +debug ("Unsupported boot device 0x%x.\n" , mode); +return BOOT_DEVICE_NONE ; + } +} + +void board_init_f (ulong dummy) +{ +int ret; + + ret =spl_early_init (); +if (ret) +panic ("spl_early_init() failed: %d\n" , ret); + +riscv_cpu_setup (NULL ,NULL ); +preloader_console_init (); + +/* Set the parent clock of cpu_root clock to pll0, +* it must be initialized here +*/ +clrsetbits_le32 (JH7110_SYS_CRG +JH7110_CLK_CPU_ROOT_OFFSET , +JH7110_CLK_CPU_ROOT_MASK , +BIT (JH7110_CLK_CPU_ROOT_SHIFT )); + + ret =spl_board_init_f (); +if (ret) { +debug ("spl_board_init_f init failed: %d\n" , ret); +return ; + } +} + +#if CONFIG_IS_ENABLED (SPL_LOAD_FIT ) +int board_fit_config_name_match (const char *name) +{ +/* boot using first FIT config */ +return 0 ; +} +#endif board/starfive/visionfive2/starfive_visionfive2.c new file +40
-0@@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2022 StarFive Technology Co., Ltd. +* Author: Yanhong Wang<[email protected]> +*/ + +#include <common.h> +#include <asm/io.h> +#include <cpu_func.h> +#include <linux/bitops.h> + +#define JH7110_L2_PREFETCHER_BASE_ADDR 0x2030000 +#define JH7110_L2_PREFETCHER_HART_OFFSET 0x2000 + +/* enable U74-mc hart1~hart4 prefetcher */ +static void enable_prefetcher (void ) +{ +u8 hart; +u32 *reg; + +/* JH7110 use U74MC CORE IP, it include five cores(one S7 and four U7), +* but only U7 cores support prefetcher configuration +*/ +for (hart =1 ; hart <5 ; hart++) { + reg = (void *)(u64)(JH7110_L2_PREFETCHER_BASE_ADDR + + hart *JH7110_L2_PREFETCHER_HART_OFFSET ); + +mb ();/* memory barrier */ +setbits_le32 (reg,0x1 ); +mb ();/* memory barrier */ + } +} + +int board_init (void ) +{ +enable_caches (); +enable_prefetcher (); + +return 0 ; +}doc/board/index.rst +1
-0@@ -39,6 +39,7 @@ Board-specific doc sipeed/index socionext/index st/index + starfive/index ste/index tbs/index ti/indexdoc/board/starfive/index.rst new file +9
-0@@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +StarFive +======== + +.. toctree:: + :maxdepth: 1 + + visionfive2doc/board/starfive/visionfive2.rst new file +492
-0@@ -0,0 +1,492 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +StarFive VisionFive2 +==================== + +JH7110 RISC-V SoC +--------------------- +The JH7110 is 4+1 64-bit RISC-V SoC from StarFive. + +The StarFive VisionFive2 development platform is based on JH7110 and capable +of running Linux. + +Mainline support +---------------- + +The support for following drivers are already enabled: + +1. ns16550 UART Driver. +2. StarFive JH7110 clock Driver. +3. StarFive JH7110 reset Driver. +4. Cadence QSPI controller Driver. +5. MMC SPI Driver for MMC/SD support. + +Booting from MMC using U-Boot SPL +--------------------------------- + +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) is required to +boot the u-boot.itb in S-mode and provide M-mode runtime services. + +Currently, the u-boot.itb is used as a dynamic of the OpenSBI FW_DYNAMIC +firmware with the latest. + +Building +~~~~~~~~ + +1. Add the RISC-V toolchain to your PATH. +2. Setup ARCH & cross compilation environment variable: + +.. code-block:: none + + export CROSS_COMPILE=<riscv64 toolchain prefix> + +Before building U-Boot SPL, OpenSBI must be built first. OpenSBI can be +cloned and built for JH7110 as below: + +.. code-block:: console + + git clone https://github.com/riscv/opensbi.git + cd opensbi + make PLATFORM=generic FW_TEXT_START=0x40000000 FW_OPTIONS=0 + +More detailed description of steps required to build FW_DYNAMIC firmware +is beyond the scope of this document. Please refer OpenSBI documenation. +(Note: OpenSBI git repo is at https://github.com/riscv/opensbi.git) + +Now build the U-Boot SPL and U-Boot proper + +.. code-block:: console + + cd <U-Boot-dir> + make starfive_visionfive2_13b_defconfig + make OPENSBI=$(opensbi_dir)/opensbi/build/platform/generic/firmware/fw_dynamic.bin + +This will generate spl/u-boot-spl.bin and FIT image (u-boot.itb) + +u-boot-spl.bin cannot be used directly on StarFive VisionFive2,we need +to convert the u-boot-spl.bin to u-boot-spl.bin.normal.out with +the below command: + + ./spl_tool -c -f $(Uboot_PATH)/spl/u-boot-spl.bin + +More detailed description of spl_tool,please refer spl_tool documenation. +(Note: spl_tool git repo is at https://github.com/starfive-tech/Tools/tree/master/spl_tool) + +This will generate u-boot-spl.bin.normal.out file. + +Flashing +~~~~~~~~ + +SPL loads the U-Boot SPL (u-boot-spl.bin.normal.out) from a partition with GUID type +2E54B353-1271-4842-806F-E436D6AF6985 + +U-Boot SPL expects a U-Boot FIT image (u-boot.itb) from a partition with GUID +type BC13C2FF-59E6-4262-A352-B275FD6F7172 + +FIT image (u-boot.itb) is a combination of fw_dynamic.bin, u-boot-nodtb.bin and +device tree blob (jh7110-starfive-visionfive-2-v1.3b.dtb/jh7110-starfive-visionfive-2-v1.2a.dtb) + +Format the SD card (make sure the disk has GPT, otherwise use gdisk to switch) + +.. code-block:: bash + + sudo sgdisk --clear \ + --set-alignment=2 \ + --new=1:4096:8191 --change-name=1:spl --typecode=1:2E54B353-1271-4842-806F-E436D6AF6985\ + --new=2:8192:16383 --change-name=2:uboot --typecode=2:BC13C2FF-59E6-4262-A352-B275FD6F7172 \ + --new=3:16384:1654784 --change-name=3:system --typecode=3:EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 \ + /dev/sdb + +Program the SD card + +.. code-block:: bash + + sudo dd if=u-boot-spl.bin.normal.out of=/dev/sdb1 + sudo dd if=u-boot.itb of=/dev/sdb2 + + sudo mount /dev/sdb3 /mnt/ + sudo cp u-boot-spl.bin.normal.out /mnt/ + sudo cp u-boot.itb /mnt/ + sudo cp Image.gz /mnt/ + sudo cp initramfs.cpio.gz /mnt/ + sudo cp jh7110-starfive-visionfive-2-v1.3b.dtb /mnt/ + sudo umount /mnt + +Booting +~~~~~~~ + +Change DIP switches MSEL[1:0] are set to 10, select the boot mode to SD. +Once you plugin the sdcard and power up, you should see the U-Boot prompt. + +Sample boot log from StarFive VisionFive2 board +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: none + + + U-Boot SPL 2023.04-rc2-00055-gfc43b9c51a-dirty (Mar 02 2023 - 10:51:39 +0800) + DDR version: dc2e84f0. + Trying to boot from MMC2 + + OpenSBI v1.2-80-g4b28afc + ____ _____ ____ _____ + / __ \ / ____| _ \_ _| + | | | |_ __ ___ _ __ | (___ | |_) || | + | | | | '_ \ / _ \ '_ \ \___ \| _ < | | + | |__| | |_) | __/ | | |____) | |_) || |_ + \____/| .__/ \___|_| |_|_____/|___/_____| + | | + |_| + + Platform Name : StarFive VisionFive 2 v1.3B + Platform Features : medeleg + Platform HART Count : 5 + Platform IPI Device : aclint-mswi + Platform Timer Device : aclint-mtimer @ 4000000Hz + Platform Console Device : uart8250 + Platform HSM Device : --- + Platform PMU Device : --- + Platform Reboot Device : --- + Platform Shutdown Device : --- + Platform Suspend Device : --- + Firmware Base : 0x40000000 + Firmware Size : 264 KB + Firmware RW Offset : 0x20000 + Runtime SBI Version : 1.0 + + Domain0 Name : root + Domain0 Boot HART : 2 + Domain0 HARTs : 0*,1*,2*,3*,4* + Domain0 Region00 : 0x0000000002000000-0x000000000200ffff M: (I,R,W) S/U: () + Domain0 Region01 : 0x0000000040000000-0x000000004001ffff M: (R,X) S/U: () + Domain0 Region02 : 0x0000000040000000-0x000000004007ffff M: (R,W) S/U: () + Domain0 Region03 : 0x0000000000000000-0xffffffffffffffff M: (R,W,X) S/U: (R,W,X) + Domain0 Next Address : 0x0000000040200000 + Domain0 Next Arg1 : 0x0000000040287970 + Domain0 Next Mode : S-mode + Domain0 SysReset : yes + Domain0 SysSuspend : yes + + Boot HART ID : 2 + Boot HART Domain : root + Boot HART Priv Version : v1.11 + Boot HART Base ISA : rv64imafdcbx + Boot HART ISA Extensions : none + Boot HART PMP Count : 8 + Boot HART PMP Granularity : 4096 + Boot HART PMP Address Bits: 34 + Boot HART MHPM Count : 2 + Boot HART MIDELEG : 0x0000000000000222 + Boot HART MEDELEG : 0x000000000000b109 + + + U-Boot 2023.04-rc2-00055-gfc43b9c51a-dirty (Mar 02 2023 - 10:51:39 +0800) + + CPU: rv64imac_zba_zbb + Model: StarFive VisionFive 2 v1.3B + DRAM: 8 GiB + Core: 107 devices, 18 uclasses, devicetree: separate + MMC: mmc@16010000: 0, mmc@16020000: 1 + Loading Environment from nowhere... OK + In: serial@10000000 + Out: serial@10000000 + Err: serial@10000000 + Net: No ethernet found. + Working FDT set to ff74a340 + Hit any key to stop autoboot: 0 + StarFive # + StarFive #version + U-Boot 2023.04-rc2-00055-gfc43b9c51a-dirty (Mar 02 2023 - 10:51:39 +0800) + + riscv64-buildroot-linux-gnu-gcc.br_real (Buildroot VF2_515_v1.0.0_rc4) 10.3.0 + GNU ld (GNU Binutils) 2.36.1 + StarFive # + StarFive #mmc dev 1 + switch to partitions #0, OK + mmc1 is current device + StarFive #mmc info + Device: mmc@16020000 + Manufacturer ID: 9f + OEM: 5449 + Name: SD64G + Bus Speed: 50000000 + Mode: SD High Speed (50MHz) + Rd Block Len: 512 + SD version 3.0 + High Capacity: Yes + Capacity: 58.3 GiB + Bus Width: 4-bit + Erase Group Size: 512 Bytes + StarFive # + StarFive #mmc part + + Partition Map for MMC device 1 -- Partition Type: EFI + + Part Start LBA End LBA Name + Attributes + Type GUID + Partition GUID + 1 0x00001000 0x00001fff "spl" + attrs: 0x0000000000000000 + type: 2e54b353-1271-4842-806f-e436d6af6985 + (2e54b353-1271-4842-806f-e436d6af6985) + guid: d5ee2056-3020-475b-9a33-25b4257c9f12 + 2 0x00002000 0x00003fff "uboot" + attrs: 0x0000000000000000 + type: bc13c2ff-59e6-4262-a352-b275fd6f7172 + (bc13c2ff-59e6-4262-a352-b275fd6f7172) + guid: 379ab7fe-fd0c-4149-b758-960c1cbfc0cc + 3 0x00004000 0x00194000 "system" + attrs: 0x0000000000000000 + type: ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 + (data) + guid: 539a6df9-4655-4953-8541-733ca36eb1db + StarFive # + StarFive #fatls mmc 1:3 + 6429424 Image.gz + 717705 u-boot.itb + 125437 u-boot-spl.bin.normal.out + 152848495 initramfs.cpio.gz + 11285 jh7110-starfive-visionfive-2-v1.3b.dtb + + 5 file(s), 0 dir(s) + + StarFive #fatload mmc 1:3 ${kernel_addr_r} Image.gz + 6429424 bytes read in 394 ms (15.6 MiB/s) + StarFive #fatload mmc 1:3 ${fdt_addr_r} jh7110-starfive-visionfive-2-v1.3b.dtb + 11285 bytes read in 5 ms (2.2 MiB/s) + StarFive #fatload mmc 1:3 ${ramdisk_addr_r} initramfs.cpio.gz + 152848495 bytes read in 9271 ms (15.7 MiB/s) + StarFive #booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r} + Uncompressing Kernel Image + ## Flattened Device Tree blob at 46000000 + Booting using the fdt blob at 0x46000000 + Working FDT set to 46000000 + Loading Ramdisk to f5579000, end fe73d86f ... OK + Loading Device Tree to 00000000f5573000, end 00000000f5578c14 ... OK + Working FDT set to f5573000 + + Starting kernel ... + + + ] Linux version 6.2.0-starfive-00026-g11934a315b67 (wyh@wyh-VirtualBox) (riscv64-linux-gnu-gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, GNU ld (GNU Binutils for Ubuntu) 2.30) #1 SMP Thu Mar 2 14:51:36 CST 2023 + [ 0.000000] OF: fdt: Ignoring memory range 0x40000000 - 0x40200000 + [ 0.000000] Machine model: StarFive VisionFive 2 v1.3B + [ 0.000000] efi: UEFI not found. + [ 0.000000] Zone ranges: + [ 0.000000] DMA32 [mem 0x0000000040200000-0x00000000ffffffff] + [ 0.000000] Normal [mem 0x0000000100000000-0x000000013fffffff] + [ 0.000000] Movable zone start for each node + [ 0.000000] Early memory node ranges + [ 0.000000] node 0: [mem 0x0000000040200000-0x000000013fffffff] + [ 0.000000] Initmem setup node 0 [mem 0x0000000040200000-0x000000013fffffff] + [ 0.000000] On node 0, zone DMA32: 512 pages in unavailable ranges + [ 0.000000] SBI specification v1.0 detected + [ 0.000000] SBI implementation ID=0x1 Version=0x10002 + [ 0.000000] SBI TIME extension detected + [ 0.000000] SBI IPI extension detected + [ 0.000000] SBI RFENCE extension detected + [ 0.000000] SBI HSM extension detected + [ 0.000000] CPU with hartid=0 is not available + [ 0.000000] CPU with hartid=0 is not available + [ 0.000000] CPU with hartid=0 is not available + [ 0.000000] riscv: base ISA extensions acdfim + [ 0.000000] riscv: ELF capabilities acdfim + [ 0.000000] percpu: Embedded 18 pages/cpu s35960 r8192 d29576 u73728 + [ 0.000000] pcpu-alloc: s35960 r8192 d29576 u73728 alloc=18*4096 + [ 0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 + [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 1031688 + [ 0.000000] Kernel command line: console=ttyS0,115200 debug rootwait earlycon=sbi + [ 0.000000] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes, linear) + [ 0.000000] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes, linear) + [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off + [ 0.000000] software IO TLB: area num 4. + [ 0.000000] software IO TLB: mapped [mem 0x00000000f1573000-0x00000000f5573000] (64MB) + [ 0.000000] Virtual kernel memory layout: + [ 0.000000] fixmap : 0xffffffc6fee00000 - 0xffffffc6ff000000 (2048 kB) + [ 0.000000] pci io : 0xffffffc6ff000000 - 0xffffffc700000000 ( 16 MB) + [ 0.000000] vmemmap : 0xffffffc700000000 - 0xffffffc800000000 (4096 MB) + [ 0.000000] vmalloc : 0xffffffc800000000 - 0xffffffd800000000 ( 64 GB) + [ 0.000000] modules : 0xffffffff0136a000 - 0xffffffff80000000 (2028 MB) + [ 0.000000] lowmem : 0xffffffd800000000 - 0xffffffd8ffe00000 (4094 MB) + [ 0.000000] kernel : 0xffffffff80000000 - 0xffffffffffffffff (2047 MB) + [ 0.000000] Memory: 3867604K/4192256K available (8012K kernel code, 4919K rwdata, 4096K rodata, 2190K init, 476K bss, 324652K 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 restricting CPUs from NR_CPUS=64 to nr_cpu_ids=4. + [ 0.000000] rcu: RCU debug extended QS entry/exit. + [ 0.000000] Tracing variant of Tasks RCU enabled. + [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. + [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4 + [ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 + [ 0.000000] CPU with hartid=0 is not available + [ 0.000000] riscv-intc: unable to find hart id for /cpus/cpu@0/interrupt-controller + [ 0.000000] riscv-intc: 64 local interrupts mapped + [ 0.000000] plic: interrupt-controller@c000000: mapped 136 interrupts with 4 handlers for 9 contexts. + [ 0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention. + [ 0.000000] riscv-timer: riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [4] + [ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 881590404240 ns + [ 0.000003] sched_clock: 64 bits at 4MHz, resolution 250ns, wraps every 2199023255500ns + [ 0.000437] Console: colour dummy device 80x25 + [ 0.000568] Calibrating delay loop (skipped), value calculated using timer frequency.. 8.00 BogoMIPS (lpj=16000) + [ 0.000602] pid_max: default: 32768 minimum: 301 + [ 0.000752] LSM: initializing lsm=capability,integrity + [ 0.001071] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes, linear) + [ 0.001189] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes, linear) + [ 0.004201] CPU node for /cpus/cpu@0 exist but the possible cpu range is :0-3 + [ 0.007426] cblist_init_generic: Setting adjustable number of callback queues. + [ 0.007457] cblist_init_generic: Setting shift to 2 and lim to 1. + [ 0.007875] riscv: ELF compat mode unsupported + [ 0.007902] ASID allocator disabled (0 bits) + [ 0.008405] rcu: Hierarchical SRCU implementation. + [ 0.008426] rcu: Max phase no-delay instances is 1000. + [ 0.009247] EFI services will not be available. + [ 0.010738] smp: Bringing up secondary CPUs ... + [ 0.018358] smp: Brought up 1 node, 4 CPUs + [ 0.021776] devtmpfs: initialized + [ 0.027337] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns + [ 0.027389] futex hash table entries: 1024 (order: 4, 65536 bytes, linear) + [ 0.027888] pinctrl core: initialized pinctrl subsystem + [ 0.029881] NET: Registered PF_NETLINK/PF_ROUTE protocol family + [ 0.030401] audit: initializing netlink subsys (disabled) + [ 0.031041] audit: type=2000 audit(0.028:1): state=initialized audit_enabled=0 res=1 + [ 0.031943] cpuidle: using governor menu + [ 0.043011] HugeTLB: registered 2.00 MiB page size, pre-allocated 0 pages + [ 0.043033] HugeTLB: 0 KiB vmemmap can be freed for a 2.00 MiB page + [ 0.044943] iommu: Default domain type: Translated + [ 0.044965] iommu: DMA domain TLB invalidation policy: strict mode + [ 0.046089] SCSI subsystem initialized + [ 0.046733] libata version 3.00 loaded. + [ 0.047231] usbcore: registered new interface driver usbfs + [ 0.047315] usbcore: registered new interface driver hub + [ 0.047420] usbcore: registered new device driver usb + [ 0.049770] vgaarb: loaded + [ 0.050277] clocksource: Switched to clocksource riscv_clocksource + [ 0.084690] NET: Registered PF_INET protocol family + [ 0.085561] IP idents hash table entries: 65536 (order: 7, 524288 bytes, linear) + [ 0.093010] tcp_listen_portaddr_hash hash table entries: 2048 (order: 4, 65536 bytes, linear) + [ 0.093152] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear) + [ 0.093224] TCP established hash table entries: 32768 (order: 6, 262144 bytes, linear) + [ 0.093821] TCP bind hash table entries: 32768 (order: 9, 2097152 bytes, linear) + [ 0.117880] TCP: Hash tables configured (established 32768 bind 32768) + [ 0.118500] UDP hash table entries: 2048 (order: 5, 196608 bytes, linear) + [ 0.118881] UDP-Lite hash table entries: 2048 (order: 5, 196608 bytes, linear) + [ 0.119675] NET: Registered PF_UNIX/PF_LOCAL protocol family + [ 0.121749] RPC: Registered named UNIX socket transport module. + [ 0.121776] RPC: Registered udp transport module. + [ 0.121784] RPC: Registered tcp transport module. + [ 0.121791] RPC: Registered tcp NFSv4.1 backchannel transport module. + [ 0.121816] PCI: CLS 0 bytes, default 64 + [ 0.124101] Unpacking initramfs... + [ 0.125468] workingset: timestamp_bits=46 max_order=20 bucket_order=0 + [ 0.128372] NFS: Registering the id_resolver key type + [ 0.128498] Key type id_resolver registered + [ 0.128525] Key type id_legacy registered + [ 0.128625] nfs4filelayout_init: NFSv4 File Layout Driver Registering... + [ 0.128649] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering... + [ 0.129358] 9p: Installing v9fs 9p2000 file system support + [ 0.130179] NET: Registered PF_ALG protocol family + [ 0.130499] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 247) + [ 0.130544] io scheduler mq-deadline registered + [ 0.130556] io scheduler kyber registered + [ 0.416754] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled + [ 0.420857] SuperH (H)SCI(F) driver initialized + [ 0.443735] loop: module loaded + [ 0.448605] e1000e: Intel(R) PRO/1000 Network Driver + [ 0.448627] e1000e: Copyright(c) 1999 - 2015 Intel Corporation. + [ 0.450716] usbcore: registered new interface driver uas + [ 0.450832] usbcore: registered new interface driver usb-storage + [ 0.451638] mousedev: PS/2 mouse device common for all mice + [ 0.453465] sdhci: Secure Digital Host Controller Interface driver + [ 0.453487] sdhci: Copyright(c) Pierre Ossman + [ 0.453584] sdhci-pltfm: SDHCI platform and OF driver helper + [ 0.454140] usbcore: registered new interface driver usbhid + [ 0.454174] usbhid: USB HID core driver + [ 0.454833] riscv-pmu-sbi: SBI PMU extension is available + [ 0.454920] riscv-pmu-sbi: 16 firmware and 4 hardware counters + [ 0.454942] riscv-pmu-sbi: Perf sampling/filtering is not supported as sscof extension is not available + [ 0.457071] NET: Registered PF_INET6 protocol family + [ 0.460627] Segment Routing with IPv6 + [ 0.460821] In-situ OAM (IOAM) with IPv6 + [ 0.461005] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver + [ 0.462712] NET: Registered PF_PACKET protocol family + [ 0.462933] 9pnet: Installing 9P2000 support + [ 0.463141] Key type dns_resolver registered + [ 0.463168] start plist test + [ 0.469261] end plist test + [ 0.506774] debug_vm_pgtable: [debug_vm_pgtable ]: Validating architecture page table helpers + [ 0.553683] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation. + [ 0.554741] starfive-jh7110-sys-pinctrl 13040000.pinctrl: StarFive GPIO chip registered 64 GPIOs + [ 0.555900] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation. + [ 0.556772] starfive-jh7110-aon-pinctrl 17020000.pinctrl: StarFive GPIO chip registered 4 GPIOs + [ 0.559454] printk: console [ttyS0] disabled + [ 0.579948] 10000000.serial: ttyS0 at MMIO 0x10000000 (irq = 3, base_baud = 1500000) is a 16550A + [ 0.580082] printk: console [ttyS0] enabled + [ 13.642680] Freeing initrd memory: 149264K + [ 13.651051] Freeing unused kernel image (initmem) memory: 2188K + [ 13.666431] Run /init as init process + [ 13.670116] with arguments: + [ 13.673168] /init + [ 13.675488] with environment: + [ 13.678668] HOME=/ + [ 13.681038] TERM=linux + Starting syslogd: OK + Starting klogd: OK + Running sysctl: OK + Populating /dev using udev: [ 14.145944] udevd[93]: starting version 3.2.10 + [ 15.214287] random: crng init done + [ 15.240816] udevd[94]: starting eudev-3.2.10 + done + Saving random seed: OK + Starting system message bus: dbus[122]: Unknown username "pulse" in message bus configuration file + done + Starting rpcbind: OK + Starting iptables: OK + Starting bluetoothd: OK + Starting network: Waiting for interface eth0 to appear............... timeout! + run-parts: /etc/network/if-pre-up.d/wait_iface: exit status 1 + FAIL + Starting dropbear sshd: OK + Starting NFS statd: OK + Starting NFS services: OK + Starting NFS daemon: rpc.nfsd: Unable to access /proc/fs/nfsd errno 2 (No such file or directory). + Please try, as root, 'mount -t nfsd nfsd /proc/fs/nfsd' and then restart rpc.nfsd to correct the problem + FAIL + Starting NFS mountd: OK + Starting DHCP server: FAIL + + Welcome to Buildroot + buildroot login: + +Booting from SPI +---------------- + +Use Building steps from "Booting from MMC using U-Boot SPL" section. + +Partition the SPI in Linux via mtdblock. (Require to boot the board in +SD boot mode by enabling MTD block in Linux) + +Use prebuilt image from here [1], which support to partition the SPI flash. + + +Program the SPI (Require to boot the board in SD boot mode) + +Execute below steps on U-Boot proper, + +.. code-block:: none + + sf probe + fatload mmc 1:3 $kernel_addr_r u-boot.itb + sf update $kernel_addr_r 0x100000 $filesize + + fatload mmc 1:3 $kernel_addr_r u-boot-spl.bin.normal.out + sf update $kernel_addr_r 0x0 $filesize + + +Power off the board + +Change DIP switches MSEL[1:0] are set to 00, select the boot mode to flash + +Power up the board.include/configs/starfive-visionfive2.h new file +49
-0@@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) 2022 StarFive Technology Co., Ltd. +* Author: Yanhong Wang<[email protected]> +* +*/ + +#ifndef _STARFIVE_VISIONFIVE2_H +#define _STARFIVE_VISIONFIVE2_H + +#define RISCV_MMODE_TIMERBASE 0x2000000 +#define RISCV_MMODE_TIMER_FREQ 4000000 +#define RISCV_SMODE_TIMER_FREQ 4000000 + +#define __io + +/* Environment options */ + +#define BOOT_TARGET_DEVICES (func) \ + func(MMC, mmc, 1) \ + func(DHCP, dhcp, na) + +#include <config_distro_bootcmd.h> + +#define TYPE_GUID_SPL "2E54B353-1271-4842-806F-E436D6AF6985" +#define TYPE_GUID_UBOOT "BC13C2FF-59E6-4262-A352-B275FD6F7172" +#define TYPE_GUID_SYSTEM "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7" + +#define PARTS_DEFAULT \ + "name=spl,start=2M,size=2M,type=${type_guid_gpt_loader1};" \ + "name=uboot,size=4MB,type=${type_guid_gpt_loader2};" \ + "name=system,size=-,bootable,type=${type_guid_gpt_system};" + +#define CFG_EXTRA_ENV_SETTINGS \ + "kernel_addr_r=0x40200000\0" \ + "kernel_comp_addr_r=0x88000000\0" \ + "kernel_comp_size=0x4000000\0" \ + "fdt_addr_r=0x46000000\0" \ + "scriptaddr=0x43900000\0" \ + "pxefile_addr_r=0x45900000\0" \ + "ramdisk_addr_r=0x46100000\0" \ + "type_guid_gpt_loader1=" TYPE_GUID_SPL "\0" \ + "type_guid_gpt_loader2=" TYPE_GUID_UBOOT "\0" \ + "type_guid_gpt_system=" TYPE_GUID_SYSTEM "\0" \ + "partitions=" PARTS_DEFAULT "\0" \ + "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ + BOOTENV + +#endif /* _STARFIVE_VISIONFIVE2_H */
PATCH v5 11/17 riscv: cpu: jh7110: Add Kconfig for StarFive JH7110 SoC
In reply to Yanhong WangAdd Kconfig to select the basic functions for StarFive JH7110 SoC.
--- arch/riscv/cpu/jh7110/Kconfig | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 arch/riscv/cpu/jh7110/Kconfig
arch/riscv/cpu/jh7110/Kconfig new file +28 -0
@@ -0,0 +1,28 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2022 StarFive Technology Co., Ltd. + +config STARFIVE_JH7110 + bool + select ARCH_EARLY_INIT_R + select CLK_JH7110 + select CPU + select CPU_RISCV + select RAM + select RESET_JH7110 + select SUPPORT_SPL + select SPL_RAM if SPL + select SPL_STARFIVE_DDR + select PINCTRL_STARFIVE_JH7110 + imply MMC + imply MMC_BROKEN_CD + imply MMC_SPI + imply RISCV_TIMER if (RISCV_SMODE || SPL_RISCV_SMODE) + imply SIFIVE_CACHE + imply SIFIVE_CCACHE + imply SMP + imply SPI + imply SPL_CPU + imply SPL_LOAD_FIT + imply SPL_OPENSBI + imply SPL_SIFIVE_CLINT
Signature · 1 line
2.17.1
PATCH v5 12/17 board: starfive: Add Kconfig for StarFive VisionFive v2 Board
In reply to Yanhong WangAdd Kconfig to select the basic functions for StarFive VisionFive v2 Board.
--- board/starfive/visionfive2/Kconfig | 53 ++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 board/starfive/visionfive2/Kconfig
board/starfive/visionfive2/Kconfig new file +53 -0
@@ -0,0 +1,53 @@ +if TARGET_STARFIVE_VISIONFIVE2 + +config SYS_CPU + default "jh7110" + +config SYS_BOARD + default "visionfive2" + +config SYS_VENDOR + default "starfive" + +config SYS_CONFIG_NAME + default "starfive-visionfive2" + +config TEXT_BASE + default 0x40200000 if SPL + default 0x40000000 if !RISCV_SMODE + default 0x40200000 if RISCV_SMODE + +config SPL_TEXT_BASE + default 0x08000000 + +config SPL_OPENSBI_LOAD_ADDR + default 0x80000000 + +config BOARD_SPECIFIC_OPTIONS # dummy + def_bool y + select STARFIVE_JH7110 + select SUPPORT_SPL + select BINMAN + imply CMD_CPU + imply CMD_DHCP + imply CMD_EXT2 + imply CMD_EXT4 + imply CMD_FAT + imply CMD_FS_GENERIC + imply CMD_GPIO + imply CMD_GPT + imply CMD_MMC + imply CMD_NET + imply CMD_PING + imply CMD_SF + imply DM_GPIO + imply DOS_PARTITION + imply EFI_PARTITION + imply MII + imply IP_DYN + imply ISO_PARTITION + imply PARTITION_TYPE_GUID + imply PHY_LIB + imply PHY_MSCC + +endif
Signature · 1 line
2.17.1
PATCH v5 13/17 board: starfive: Add TARGET_STARFIVE_VISIONFIVE2 to Kconfig
In reply to Yanhong WangAdd board support for StarFive VisionFive v2.
--- arch/riscv/Kconfig | 5 +++++ 1 file changed, 5 insertions(+)
arch/riscv/Kconfig +5 -0
@@ -24,6 +24,9 @@ config TARGET_SIFIVE_UNMATCHED bool "Support SiFive Unmatched Board" select SYS_CACHE_SHIFT_6 +config TARGET_STARFIVE_VISIONFIVE2 + bool "Support StarFive VisionFive2 Board" + config TARGET_SIPEED_MAIX bool "Support Sipeed Maix Board" select SYS_CACHE_SHIFT_6
@@ -65,12 +68,14 @@ source "board/sifive/unleashed/Kconfig" source "board/sifive/unmatched/Kconfig" source "board/openpiton/riscv64/Kconfig" source "board/sipeed/maix/Kconfig" +source "board/starfive/visionfive2/Kconfig" # platform-specific options below source "arch/riscv/cpu/andesv5/Kconfig" source "arch/riscv/cpu/fu540/Kconfig" source "arch/riscv/cpu/fu740/Kconfig" source "arch/riscv/cpu/generic/Kconfig" +source "arch/riscv/cpu/jh7110/Kconfig" # architecture-specific options below
Signature · 1 line
2.17.1
PATCH v5 14/17 riscv: dts: jh7110: Add initial StarFive JH7110 device tree
In reply to Yanhong WangAdd initial device tree for the JH7110 RISC-V SoC.
--- arch/riscv/dts/jh7110.dtsi | 573 +++++++++++++++++++++++++++++++++++++ 1 file changed, 573 insertions(+) create mode 100644 arch/riscv/dts/jh7110.dtsi
arch/riscv/dts/jh7110.dtsi new file +573 -0
@@ -0,0 +1,573 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Copyright (C) 2022 StarFive Technology Co., Ltd. + */ + +/dts-v1/; +#include <dt-bindings/clock/starfive,jh7110-crg.h> +#include <dt-bindings/reset/starfive,jh7110-crg.h> + +/ { + compatible = "starfive,jh7110"; + #address-cells = <2>; + #size-cells = <2>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + S7_0: cpu@0 { + compatible = "sifive,s7", "riscv"; + reg = <0>; + device_type = "cpu"; + i-cache-block-size = <64>; + i-cache-sets = <64>; + i-cache-size = <16384>; + next-level-cache = <&ccache>; + riscv,isa = "rv64imac_zba_zbb"; + status = "disabled"; + + cpu0_intc: interrupt-controller { + compatible = "riscv,cpu-intc"; + interrupt-controller; + #interrupt-cells = <1>; + }; + }; + + U74_1: cpu@1 { + compatible = "sifive,u74-mc", "riscv"; + reg = <1>; + d-cache-block-size = <64>; + d-cache-sets = <64>; + d-cache-size = <32768>; + d-tlb-sets = <1>; + d-tlb-size = <40>; + device_type = "cpu"; + i-cache-block-size = <64>; + i-cache-sets = <64>; + i-cache-size = <32768>; + i-tlb-sets = <1>; + i-tlb-size = <40>; + mmu-type = "riscv,sv39"; + next-level-cache = <&ccache>; + riscv,isa = "rv64imafdc_zba_zbb"; + tlb-split; + + cpu1_intc: interrupt-controller { + compatible = "riscv,cpu-intc"; + interrupt-controller; + #interrupt-cells = <1>; + }; + }; + + U74_2: cpu@2 { + compatible = "sifive,u74-mc", "riscv"; + reg = <2>; + d-cache-block-size = <64>; + d-cache-sets = <64>; + d-cache-size = <32768>; + d-tlb-sets = <1>; + d-tlb-size = <40>; + device_type = "cpu"; + i-cache-block-size = <64>; + i-cache-sets = <64>; + i-cache-size = <32768>; + i-tlb-sets = <1>; + i-tlb-size = <40>; + mmu-type = "riscv,sv39"; + next-level-cache = <&ccache>; + riscv,isa = "rv64imafdc_zba_zbb"; + tlb-split; + + cpu2_intc: interrupt-controller { + compatible = "riscv,cpu-intc"; + interrupt-controller; + #interrupt-cells = <1>; + }; + }; + + U74_3: cpu@3 { + compatible = "sifive,u74-mc", "riscv"; + reg = <3>; + d-cache-block-size = <64>; + d-cache-sets = <64>; + d-cache-size = <32768>; + d-tlb-sets = <1>; + d-tlb-size = <40>; + device_type = "cpu"; + i-cache-block-size = <64>; + i-cache-sets = <64>; + i-cache-size = <32768>; + i-tlb-sets = <1>; + i-tlb-size = <40>; + mmu-type = "riscv,sv39"; + next-level-cache = <&ccache>; + riscv,isa = "rv64imafdc_zba_zbb"; + tlb-split; + + cpu3_intc: interrupt-controller { + compatible = "riscv,cpu-intc"; + interrupt-controller; + #interrupt-cells = <1>; + }; + }; + + U74_4: cpu@4 { + compatible = "sifive,u74-mc", "riscv"; + reg = <4>; + d-cache-block-size = <64>; + d-cache-sets = <64>; + d-cache-size = <32768>; + d-tlb-sets = <1>; + d-tlb-size = <40>; + device_type = "cpu"; + i-cache-block-size = <64>; + i-cache-sets = <64>; + i-cache-size = <32768>; + i-tlb-sets = <1>; + i-tlb-size = <40>; + mmu-type = "riscv,sv39"; + next-level-cache = <&ccache>; + riscv,isa = "rv64imafdc_zba_zbb"; + tlb-split; + + cpu4_intc: interrupt-controller { + compatible = "riscv,cpu-intc"; + interrupt-controller; + #interrupt-cells = <1>; + }; + }; + + cpu-map { + cluster0 { + core0 { + cpu = <&S7_0>; + }; + + core1 { + cpu = <&U74_1>; + }; + + core2 { + cpu = <&U74_2>; + }; + + core3 { + cpu = <&U74_3>; + }; + + core4 { + cpu = <&U74_4>; + }; + }; + }; + }; + + osc: oscillator { + compatible = "fixed-clock"; + clock-output-names = "osc"; + #clock-cells = <0>; + }; + + rtc_osc: rtc-oscillator { + compatible = "fixed-clock"; + clock-output-names = "rtc_osc"; + #clock-cells = <0>; + }; + + gmac0_rmii_refin: gmac0-rmii-refin-clock { + compatible = "fixed-clock"; + clock-output-names = "gmac0_rmii_refin"; + #clock-cells = <0>; + }; + + gmac0_rgmii_rxin: gmac0-rgmii-rxin-clock { + compatible = "fixed-clock"; + clock-output-names = "gmac0_rgmii_rxin"; + #clock-cells = <0>; + }; + + gmac1_rmii_refin: gmac1-rmii-refin-clock { + compatible = "fixed-clock"; + clock-output-names = "gmac1_rmii_refin"; + #clock-cells = <0>; + }; + + gmac1_rgmii_rxin: gmac1-rgmii-rxin-clock { + compatible = "fixed-clock"; + clock-output-names = "gmac1_rgmii_rxin"; + #clock-cells = <0>; + }; + + i2stx_bclk_ext: i2stx-bclk-ext-clock { + compatible = "fixed-clock"; + clock-output-names = "i2stx_bclk_ext"; + #clock-cells = <0>; + }; + + i2stx_lrck_ext: i2stx-lrck-ext-clock { + compatible = "fixed-clock"; + clock-output-names = "i2stx_lrck_ext"; + #clock-cells = <0>; + }; + + i2srx_bclk_ext: i2srx-bclk-ext-clock { + compatible = "fixed-clock"; + clock-output-names = "i2srx_bclk_ext"; + #clock-cells = <0>; + }; + + i2srx_lrck_ext: i2srx-lrck-ext-clock { + compatible = "fixed-clock"; + clock-output-names = "i2srx_lrck_ext"; + #clock-cells = <0>; + }; + + tdm_ext: tdm-ext-clock { + compatible = "fixed-clock"; + clock-output-names = "tdm_ext"; + #clock-cells = <0>; + }; + + mclk_ext: mclk-ext-clock { + compatible = "fixed-clock"; + clock-output-names = "mclk_ext"; + #clock-cells = <0>; + }; + + soc { + compatible = "simple-bus"; + interrupt-parent = <&plic>; + #address-cells = <2>; + #size-cells = <2>; + ranges; + + clint: timer@2000000 { + compatible = "starfive,jh7110-clint", "sifive,clint0"; + reg = <0x0 0x2000000 0x0 0x10000>; + 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>; + }; + + plic: interrupt-controller@c000000 { + compatible = "starfive,jh7110-plic", "sifive,plic-1.0.0"; + reg = <0x0 0xc000000 0x0 0x4000000>; + interrupts-extended = <&cpu0_intc 11>, + <&cpu1_intc 11>, <&cpu1_intc 9>, + <&cpu2_intc 11>, <&cpu2_intc 9>, + <&cpu3_intc 11>, <&cpu3_intc 9>, + <&cpu4_intc 11>, <&cpu4_intc 9>; + interrupt-controller; + #interrupt-cells = <1>; + #address-cells = <0>; + riscv,ndev = <136>; + }; + + ccache: cache-controller@2010000 { + compatible = "starfive,jh7110-ccache", "sifive,ccache0", "cache"; + reg = <0x0 0x2010000 0x0 0x4000>; + interrupts = <1>, <3>, <4>, <2>; + cache-block-size = <64>; + cache-level = <2>; + cache-sets = <2048>; + cache-size = <2097152>; + cache-unified; + }; + + uart0: serial@10000000 { + compatible = "snps,dw-apb-uart"; + reg = <0x0 0x10000000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_UART0_CORE>, + <&syscrg JH7110_SYSCLK_UART0_APB>; + clock-names = "baudclk", "apb_pclk"; + resets = <&syscrg JH7110_SYSRST_UART0_APB>, + <&syscrg JH7110_SYSRST_UART0_CORE>; + interrupts = <32>; + reg-io-width = <4>; + reg-shift = <2>; + status = "disabled"; + }; + + uart1: serial@10010000 { + compatible = "snps,dw-apb-uart"; + reg = <0x0 0x10010000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_UART1_CORE>, + <&syscrg JH7110_SYSCLK_UART1_APB>; + clock-names = "baudclk", "apb_pclk"; + resets = <&syscrg JH7110_SYSRST_UART1_APB>, + <&syscrg JH7110_SYSRST_UART1_CORE>; + interrupts = <33>; + reg-io-width = <4>; + reg-shift = <2>; + status = "disabled"; + }; + + uart2: serial@10020000 { + compatible = "snps,dw-apb-uart"; + reg = <0x0 0x10020000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_UART2_CORE>, + <&syscrg JH7110_SYSCLK_UART2_APB>; + clock-names = "baudclk", "apb_pclk"; + resets = <&syscrg JH7110_SYSRST_UART2_APB>, + <&syscrg JH7110_SYSRST_UART2_CORE>; + interrupts = <34>; + reg-io-width = <4>; + reg-shift = <2>; + status = "disabled"; + }; + + i2c0: i2c@10030000 { + compatible = "snps,designware-i2c"; + reg = <0x0 0x10030000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_I2C0_APB>; + clock-names = "ref"; + resets = <&syscrg JH7110_SYSRST_I2C0_APB>; + interrupts = <35>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c1: i2c@10040000 { + compatible = "snps,designware-i2c"; + reg = <0x0 0x10040000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_I2C1_APB>; + clock-names = "ref"; + resets = <&syscrg JH7110_SYSRST_I2C1_APB>; + interrupts = <36>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c2: i2c@10050000 { + compatible = "snps,designware-i2c"; + reg = <0x0 0x10050000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_I2C2_APB>; + clock-names = "ref"; + resets = <&syscrg JH7110_SYSRST_I2C2_APB>; + interrupts = <37>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + stgcrg: clock-controller@10230000 { + compatible = "starfive,jh7110-stgcrg"; + reg = <0x0 0x10230000 0x0 0x10000>; + #clock-cells = <1>; + #reset-cells = <1>; + }; + + stg_syscon: stg_syscon@10240000 { + compatible = "starfive,jh7110-stg-syscon","syscon"; + reg = <0x0 0x10240000 0x0 0x1000>; + }; + + uart3: serial@12000000 { + compatible = "snps,dw-apb-uart"; + reg = <0x0 0x12000000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_UART3_CORE>, + <&syscrg JH7110_SYSCLK_UART3_APB>; + clock-names = "baudclk", "apb_pclk"; + resets = <&syscrg JH7110_SYSRST_UART3_APB>, + <&syscrg JH7110_SYSRST_UART3_CORE>; + interrupts = <45>; + reg-io-width = <4>; + reg-shift = <2>; + status = "disabled"; + }; + + uart4: serial@12010000 { + compatible = "snps,dw-apb-uart"; + reg = <0x0 0x12010000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_UART4_CORE>, + <&syscrg JH7110_SYSCLK_UART4_APB>; + clock-names = "baudclk", "apb_pclk"; + resets = <&syscrg JH7110_SYSRST_UART4_APB>, + <&syscrg JH7110_SYSRST_UART4_CORE>; + interrupts = <46>; + reg-io-width = <4>; + reg-shift = <2>; + status = "disabled"; + }; + + uart5: serial@12020000 { + compatible = "snps,dw-apb-uart"; + reg = <0x0 0x12020000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_UART5_CORE>, + <&syscrg JH7110_SYSCLK_UART5_APB>; + clock-names = "baudclk", "apb_pclk"; + resets = <&syscrg JH7110_SYSRST_UART5_APB>, + <&syscrg JH7110_SYSRST_UART5_CORE>; + interrupts = <47>; + reg-io-width = <4>; + reg-shift = <2>; + status = "disabled"; + }; + + i2c3: i2c@12030000 { + compatible = "snps,designware-i2c"; + reg = <0x0 0x12030000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_I2C3_APB>; + clock-names = "ref"; + resets = <&syscrg JH7110_SYSRST_I2C3_APB>; + interrupts = <48>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c4: i2c@12040000 { + compatible = "snps,designware-i2c"; + reg = <0x0 0x12040000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_I2C4_APB>; + clock-names = "ref"; + resets = <&syscrg JH7110_SYSRST_I2C4_APB>; + interrupts = <49>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c5: i2c@12050000 { + compatible = "snps,designware-i2c"; + reg = <0x0 0x12050000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_I2C5_APB>; + clock-names = "ref"; + resets = <&syscrg JH7110_SYSRST_I2C5_APB>; + interrupts = <50>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c6: i2c@12060000 { + compatible = "snps,designware-i2c"; + reg = <0x0 0x12060000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_I2C6_APB>; + clock-names = "ref"; + resets = <&syscrg JH7110_SYSRST_I2C6_APB>; + interrupts = <51>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + qspi: spi@13010000 { + compatible = "cdns,qspi-nor"; + reg = <0x0 0x13010000 0x0 0x10000 + 0x0 0x21000000 0x0 0x400000>; + clocks = <&syscrg JH7110_SYSCLK_QSPI_REF>; + clock-names = "clk_ref"; + resets = <&syscrg JH7110_SYSRST_QSPI_APB>, + <&syscrg JH7110_SYSRST_QSPI_AHB>, + <&syscrg JH7110_SYSRST_QSPI_REF>; + reset-names = "rst_apb", "rst_ahb", "rst_ref"; + cdns,fifo-depth = <256>; + cdns,fifo-width = <4>; + #address-cells = <1>; + #size-cells = <0>; + }; + + syscrg: clock-controller@13020000 { + compatible = "starfive,jh7110-syscrg"; + reg = <0x0 0x13020000 0x0 0x10000>; + clocks = <&osc>, <&gmac1_rmii_refin>, + <&gmac1_rgmii_rxin>, + <&i2stx_bclk_ext>, <&i2stx_lrck_ext>, + <&i2srx_bclk_ext>, <&i2srx_lrck_ext>, + <&tdm_ext>, <&mclk_ext>; + clock-names = "osc", "gmac1_rmii_refin", + "gmac1_rgmii_rxin", + "i2stx_bclk_ext", "i2stx_lrck_ext", + "i2srx_bclk_ext", "i2srx_lrck_ext", + "tdm_ext", "mclk_ext"; + #clock-cells = <1>; + #reset-cells = <1>; + }; + + sys_syscon: sys_syscon@13030000 { + compatible = "starfive,jh7110-sys-syscon","syscon"; + reg = <0x0 0x13030000 0x0 0x1000>; + }; + + sysgpio: pinctrl@13040000 { + compatible = "starfive,jh7110-sys-pinctrl"; + reg = <0x0 0x13040000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_IOMUX_APB>; + resets = <&syscrg JH7110_SYSRST_IOMUX_APB>; + interrupts = <86>; + interrupt-controller; + #interrupt-cells = <2>; + gpio-controller; + #gpio-cells = <2>; + }; + + mmc0: mmc@16010000 { + compatible = "starfive,jh7110-mmc"; + reg = <0x0 0x16010000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_SDIO0_AHB>, + <&syscrg JH7110_SYSCLK_SDIO0_SDCARD>; + clock-names = "biu", "ciu"; + resets = <&syscrg JH7110_SYSRST_SDIO0_AHB>; + reset-names = "reset"; + interrupts = <74>; + fifo-depth = <32>; + fifo-watermark-aligned; + data-addr = <0>; + starfive,sysreg = <&sys_syscon 0x14 0x1a 0x7c000000>; + status = "disabled"; + }; + + mmc1: mmc@16020000 { + compatible = "starfive,jh7110-mmc"; + reg = <0x0 0x16020000 0x0 0x10000>; + clocks = <&syscrg JH7110_SYSCLK_SDIO1_AHB>, + <&syscrg JH7110_SYSCLK_SDIO1_SDCARD>; + clock-names = "biu", "ciu"; + resets = <&syscrg JH7110_SYSRST_SDIO1_AHB>; + reset-names = "reset"; + interrupts = <75>; + fifo-depth = <32>; + fifo-watermark-aligned; + data-addr = <0>; + starfive,sysreg = <&sys_syscon 0x9c 0x1 0x3e>; + status = "disabled"; + }; + + aoncrg: clock-controller@17000000 { + compatible = "starfive,jh7110-aoncrg"; + reg = <0x0 0x17000000 0x0 0x10000>; + clocks = <&osc>, <&rtc_osc>, + <&gmac0_rmii_refin>, <&gmac0_rgmii_rxin>, + <&syscrg JH7110_SYSCLK_STG_AXIAHB>, + <&syscrg JH7110_SYSCLK_APB_BUS>, + <&syscrg JH7110_SYSCLK_GMAC0_GTXCLK>; + clock-names = "osc", "rtc_osc", "gmac0_rmii_refin", + "gmac0_rgmii_rxin", "stg_axiahb", + "apb_bus", "gmac0_gtxclk"; + #clock-cells = <1>; + #reset-cells = <1>; + }; + + aon_syscon: aon_syscon@17010000 { + compatible = "starfive,jh7110-aon-syscon","syscon"; + reg = <0x0 0x17010000 0x0 0x1000>; + }; + + aongpio: pinctrl@17020000 { + compatible = "starfive,jh7110-aon-pinctrl"; + reg = <0x0 0x17020000 0x0 0x10000>; + resets = <&aoncrg JH7110_AONRST_IOMUX>; + interrupts = <85>; + interrupt-controller; + #interrupt-cells = <2>; + gpio-controller; + #gpio-cells = <2>; + }; + }; +};
Signature · 1 line
2.17.1
PATCH v5 15/17 riscv: dts: jh7110: Add initial u-boot device tree
In reply to Yanhong WangAdd initial u-boot device tree for the JH7110 RISC-V SoC.
--- arch/riscv/dts/jh7110-u-boot.dtsi | 99 +++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 arch/riscv/dts/jh7110-u-boot.dtsi
arch/riscv/dts/jh7110-u-boot.dtsi new file +99 -0
@@ -0,0 +1,99 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Copyright (C) 2022 StarFive Technology Co., Ltd. + */ + +#include <dt-bindings/reset/starfive,jh7110-crg.h> + +/ { + cpus: cpus { + u-boot,dm-spl; + + S7_0: cpu@0 { + u-boot,dm-spl; + status = "okay"; + cpu0_intc: interrupt-controller { + u-boot,dm-spl; + }; + }; + + U74_1: cpu@1 { + u-boot,dm-spl; + cpu1_intc: interrupt-controller { + u-boot,dm-spl; + }; + }; + + U74_2: cpu@2 { + u-boot,dm-spl; + cpu2_intc: interrupt-controller { + u-boot,dm-spl; + }; + }; + + U74_3: cpu@3 { + u-boot,dm-spl; + cpu3_intc: interrupt-controller { + u-boot,dm-spl; + }; + }; + + U74_4: cpu@4 { + u-boot,dm-spl; + cpu4_intc: interrupt-controller { + u-boot,dm-spl; + }; + }; + }; + + soc { + u-boot,dm-spl; + + clint: timer@2000000 { + u-boot,dm-spl; + }; + + dmc: dmc@15700000 { + u-boot,dm-spl; + compatible = "starfive,jh7110-dmc"; + reg = <0x0 0x15700000 0x0 0x10000>, + <0x0 0x13000000 0x0 0x10000>; + resets = <&syscrg JH7110_SYSRST_DDR_AXI>, + <&syscrg JH7110_SYSRST_DDR_OSC>, + <&syscrg JH7110_SYSRST_DDR_APB>; + reset-names = "axi", "osc", "apb"; + clocks = <&syscrg JH7110_SYSCLK_PLL1_OUT>; + clock-names = "pll1_out"; + clock-frequency = <2133>; + }; + }; +}; + +&osc { + u-boot,dm-spl; +}; + +&gmac0_rmii_refin { + u-boot,dm-spl; +}; + +&aoncrg { + u-boot,dm-spl; +}; + +&syscrg { + u-boot,dm-spl; + starfive,sys-syscon = <&sys_syscon>; +}; + +&stgcrg { + u-boot,dm-spl; +}; + +&sys_syscon { + u-boot,dm-spl; +}; + +&S7_0 { + status = "okay"; +};
Signature · 1 line
2.17.1
Re: [PATCH v5 15/17] riscv: dts: jh7110: Add initial u-boot device tree
Hi YanHong,
Quoted 15 lines · Yanhong Wang
Add initial u-boot device tree for the JH7110 RISC-V SoC.
Signed-off-by Yanhong Wang <[email protected]>Tested-by Conor Dooley <[email protected]>--- arch/riscv/dts/jh7110-u-boot.dtsi | 99 +++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 arch/riscv/dts/jh7110-u-boot.dtsiarch/riscv/dts/jh7110-u-boot.dtsi new file +0
-0
arch/riscv/dts/jh7110-u-boot.dtsi line 10
Quoted 10 lines
arch/riscv/dts/jh7110-u-boot.dtsi new file +10
-0@@ -0,0 +1,99 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Copyright (C) 2022 StarFive Technology Co., Ltd. + */ + +#include <dt-bindings/reset/starfive,jh7110-crg.h> + +/ { + cpus: cpus { + u-boot,dm-spl;
u-boot,dm-spl tag is replaced by bootph-pre-ram in this patch set. 7703efbc99 ("dm: Move to new driver model schema for device tree tags")
(https://patchwork.ozlabs.org/project/uboot/list/?series=341679&archive=both&state=*)
I have modified all the u-boot,dm-spl tag to bootph-pre-ram in all the dts you introduced when merging the patch set, so you don't have to respin the patch set again. Just sending this mail to keep you informed.
Best regards,
Leo
PATCH v5 16/17 riscv: dts: jh7110: Add initial StarFive VisionFive v2 board device tree
In reply to Yanhong WangAdd initial device tree for StarFive VisionFive v2 board.
--- arch/riscv/dts/Makefile | 3 +- ...10-starfive-visionfive-2-v1.2a-u-boot.dtsi | 69 ++++ .../jh7110-starfive-visionfive-2-v1.2a.dts | 12 + ...10-starfive-visionfive-2-v1.3b-u-boot.dtsi | 69 ++++ .../jh7110-starfive-visionfive-2-v1.3b.dts | 12 + .../dts/jh7110-starfive-visionfive-2.dtsi | 319 ++++++++++++++++++ 6 files changed, 483 insertions(+), 1 deletion(-) create mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2-v1.2a-u-boot.dtsi create mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2-v1.2a.dts create mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2-v1.3b-u-boot.dtsi create mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2-v1.3b.dts create mode 100644 arch/riscv/dts/jh7110-starfive-visionfive-2.dtsi
arch/riscv/dts/Makefile +2 -1
@@ -7,7 +7,8 @@ dtb-$(CONFIG_TARGET_OPENPITON_RISCV64) += openpiton-riscv64.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 - +dtb-$(CONFIG_TARGET_STARFIVE_VISIONFIVE2) += jh7110-starfive-visionfive-2-v1.3b.dtb +dtb-$(CONFIG_TARGET_STARFIVE_VISIONFIVE2) += jh7110-starfive-visionfive-2-v1.2a.dtb include $(srctree)/scripts/Makefile.dts targets += $(dtb-y)
arch/riscv/dts/jh7110-starfive-visionfive-2-v1.2a-u-boot.dtsi new file +69 -0
69 lines not on this page · raw message
arch/riscv/dts/jh7110-starfive-visionfive-2-v1.2a.dts new file +12 -0
@@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Copyright (C) 2022 StarFive Technology Co., Ltd. + */ + +/dts-v1/; +#include "jh7110-starfive-visionfive-2.dtsi" + +/ { + model = "StarFive VisionFive 2 v1.2A"; + compatible = "starfive,visionfive-2-v1.2a", "starfive,jh7110"; +};
arch/riscv/dts/jh7110-starfive-visionfive-2-v1.3b-u-boot.dtsi new file +69 -0
69 lines not on this page · raw message
arch/riscv/dts/jh7110-starfive-visionfive-2-v1.3b.dts new file +12 -0
@@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Copyright (C) 2022 StarFive Technology Co., Ltd. + */ + +/dts-v1/; +#include "jh7110-starfive-visionfive-2.dtsi" + +/ { + model = "StarFive VisionFive 2 v1.3B"; + compatible = "starfive,visionfive-2-v1.3b", "starfive,jh7110"; +};
arch/riscv/dts/jh7110-starfive-visionfive-2.dtsi new file +319 -0
319 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v5 17/17 configs: starfive: add defconfig for StarFive VisionFvie2 1.2A and 1.3B
In reply to Yanhong WangThis is the initial basic config for StarFive VisionFive v2 board. It includes consol, Norflash, sdio, ddr etc.
Include starfive_visionfive2_12a_defconfig and starfive_visionfive2_13b_defconfig, matching the 1.2A and 1.3B boards.
--- configs/starfive_visionfive2_12a_defconfig | 79 ++++++++++++++++++++++ configs/starfive_visionfive2_13b_defconfig | 79 ++++++++++++++++++++++ 2 files changed, 158 insertions(+) create mode 100644 configs/starfive_visionfive2_12a_defconfig create mode 100644 configs/starfive_visionfive2_13b_defconfig
configs/starfive_visionfive2_12a_defconfig new file +79 -0
@@ -0,0 +1,79 @@ +CONFIG_RISCV=y +CONFIG_SYS_MALLOC_LEN=0x800000 +CONFIG_SYS_MALLOC_F_LEN=0x10000 +CONFIG_SPL_GPIO=y +CONFIG_NR_DRAM_BANKS=1 +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80000000 +CONFIG_SPL_DM_SPI=y +CONFIG_DEFAULT_DEVICE_TREE="jh7110-starfive-visionfive-2-v1.2a" +CONFIG_SPL_TEXT_BASE=0x8000000 +CONFIG_SYS_PROMPT="StarFive #" +CONFIG_DM_RESET=y +CONFIG_SPL_MMC=y +CONFIG_SPL_STACK=0x8180000 +CONFIG_SPL=y +CONFIG_SPL_SPI_FLASH_SUPPORT=y +CONFIG_SPL_SPI=y +CONFIG_SYS_LOAD_ADDR=0x82000000 +CONFIG_TARGET_STARFIVE_VISIONFIVE2=y +CONFIG_SPL_OPENSBI_LOAD_ADDR=0x40000000 +CONFIG_ARCH_RV64I=y +CONFIG_CMODEL_MEDANY=y +CONFIG_RISCV_SMODE=y +CONFIG_DISTRO_DEFAULTS=y +CONFIG_FIT=y +CONFIG_QSPI_BOOT=y +CONFIG_SD_BOOT=y +CONFIG_USE_BOOTARGS=y +CONFIG_BOOTARGS="console=ttyS0,115200 debug rootwait earlycon=sbi" +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="setenv fdt_addr ${fdtcontroladdr};fdt addr ${fdtcontroladdr};" +CONFIG_DEFAULT_FDT_FILE="starfive/jh7110-starfive-visionfive-2-v1.2a.dtb" +CONFIG_DISPLAY_CPUINFO=y +CONFIG_DISPLAY_BOARDINFO=y +CONFIG_SPL_MAX_SIZE=0x40000 +CONFIG_SPL_PAD_TO=0x0 +CONFIG_SPL_BSS_START_ADDR=0x8040000 +CONFIG_SPL_BSS_MAX_SIZE=0x10000 +# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set +CONFIG_SYS_SPL_MALLOC=y +CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y +CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0x80000000 +CONFIG_SYS_SPL_MALLOC_SIZE=0x400000 +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=0x2 +CONFIG_SPL_DM_SPI_FLASH=y +CONFIG_SPL_DM_RESET=y +CONFIG_SPL_SPI_LOAD=y +CONFIG_SYS_CBSIZE=256 +CONFIG_SYS_PBSIZE=276 +CONFIG_SYS_BOOTM_LEN=0x4000000 +CONFIG_CMD_MEMINFO=y +CONFIG_CMD_TFTPPUT=y +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_SPL_CLK_COMPOSITE_CCF=y +CONFIG_CLK_COMPOSITE_CCF=y +CONFIG_SPL_CLK_JH7110=y +# CONFIG_I2C is not set +CONFIG_MMC_HS400_SUPPORT=y +CONFIG_SPL_MMC_HS400_SUPPORT=y +CONFIG_MMC_DW=y +CONFIG_MMC_DW_SNPS=y +CONFIG_SF_DEFAULT_SPEED=100000000 +CONFIG_SPI_FLASH_EON=y +CONFIG_SPI_FLASH_GIGADEVICE=y +CONFIG_SPI_FLASH_ISSI=y +CONFIG_SPI_FLASH_MACRONIX=y +CONFIG_PINCTRL=y +CONFIG_PINCONF=y +CONFIG_SPL_PINCTRL=y +CONFIG_SPL_PINCONF=y +CONFIG_SPL_PINCTRL_STARFIVE=y +CONFIG_SPL_PINCTRL_STARFIVE_JH7110=y +CONFIG_PINCTRL_STARFIVE=y +# CONFIG_RAM_SIFIVE is not set +CONFIG_SYS_NS16550=y +CONFIG_CADENCE_QSPI=y +CONFIG_TIMER_EARLY=y +CONFIG_OF_LIBFDT_OVERLAY=y
configs/starfive_visionfive2_13b_defconfig new file +79 -0
79 lines not on this page · raw message
Signature · 1 line
2.17.1
Quoted 1 line · On Wed, 29 Mar 2023 11:42:07 +0800 Yanhong Wang…
v5:
[...]
Quoted 2 lines
- Splitted
starfive_visionfive2_defconfigintostarfive_visionfive2_12a_defconfigandstarfive_visionfive2_13b_defconfig.
Is this really necessary? It puts another burden on people building U-Boot, distribution networks, and last but not least users, who will need to pick the correct binary blob, after trying to find out which board they actually have.
Even past versions can detect the installed RAM correctly and will modify the DT accordingly, I assume? Why not make an inquiry on GMAC1_MDIO to tell whether it's a YT8512C (->v1.2A) or another YT8531C (->v1.3B), in the ethernet patch set, and likewise update the device tree dynamically then?
Torsten
Quoted 8 lines · Torsten Duwe
Quoted 1 line · On Wed, 29 Mar 2023 11:42:07 +0800 Yanhong Wang…
v5:
[...]
Quoted 2 lines
- Splitted
starfive_visionfive2_defconfigintostarfive_visionfive2_12a_defconfigandstarfive_visionfive2_13b_defconfig.
Quoted 9 lines
Is this really necessary? It puts another burden on people building U-Boot, distribution networks, and last but not least users, who will need to pick the correct binary blob, after trying to find out which board they actually have.
Even past versions can detect the installed RAM correctly and will modify the DT accordingly, I assume? Why not make an inquiry on
GMAC1_MDIOto tell whether it's a YT8512C (->v1.2A) or another YT8531C (->v1.3B), in the ethernet patch set, and likewise update the device tree dynamically then?
There is only one defconfig in V4, and dts is separate for versions 1.2a and 1.3b. Andreas Schwab suggested that defconfig is also defined separately, so the definition of defconfig in V5 is also separated.
The discussion process as follows:
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Do you have any better suggestion on whether defconfig is defined separately?
Quoted 1 line
Torsten
Quoted 21 lines · On Wed, 29 Mar 2023 18:16:20 +0800 yanhong wang…
Quoted 8 lines · Torsten Duwe
Quoted 1 line · On Wed, 29 Mar 2023 11:42:07 +0800 Yanhong Wang…
v5:
[...]
Quoted 2 lines
- Splitted
starfive_visionfive2_defconfigintostarfive_visionfive2_12a_defconfigandstarfive_visionfive2_13b_defconfig.Quoted 9 lines
Is this really necessary? It puts another burden on people building U-Boot, distribution networks, and last but not least users, who will need to pick the correct binary blob, after trying to find out which board they actually have.
Even past versions can detect the installed RAM correctly and will modify the DT accordingly, I assume? Why not make an inquiry on
GMAC1_MDIOto tell whether it's a YT8512C (->v1.2A) or another YT8531C (->v1.3B), in the ethernet patch set, and likewise update the device tree dynamically then?
Quoted 7 lines
There is only one defconfig in V4, and dts is separate for versions 1.2a and 1.3b. Andreas Schwab suggested that defconfig is also defined separately, so the definition of defconfig in V5 is also separated.
The discussion process as follows:
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Very well. I'll talk to Andreas. Sorry for the confusion.
Quoted 1 line
Do you have any better suggestion on whether defconfig is defined separately?
See above. Roughly, define a superset, like a node YT8512C attached to GMAC1, and another node with a YT8531C attached to GMAC1, both "disabled", and at runtime mark the detected one "okay", maybe patching the board name or not. But I'll discuss this with Andreas first.
Torsten
Quoted 11 lines · On Wed, 29 Mar 2023 18:16:20 +0800 yanhong wang…
Quoted 8 lines · Torsten Duwe
Quoted 1 line · On Wed, 29 Mar 2023 11:42:07 +0800 Yanhong Wang…
v5:
[...]
Quoted 2 lines
- Splitted
starfive_visionfive2_defconfigintostarfive_visionfive2_12a_defconfigandstarfive_visionfive2_13b_defconfig.
Quoted 8 lines
Quoted 8 lines
Is this really necessary? It puts another burden on people building U-Boot, distribution networks, and last but not least users, who will need to pick the correct binary blob, after trying to find out which board they actually have.
Even past versions can detect the installed RAM correctly and will modify the DT accordingly, I assume? Why not make an inquiry on
GMAC1_MDIOto tell whether it's a YT8512C (->v1.2A) or another YT8531C (->v1.3B), in the ethernet patch set, and likewise update the device tree dynamically then?
At a second look, this is a bit tricky: a device tree is already needed for the network initialisation. That one would need to be good enough to get at the PHYs, and flexible enough to be patched into shape later. But see below...
Quoted 9 lines
There is only one defconfig in V4, and dts is separate for versions 1.2a and 1.3b. Andreas Schwab suggested that defconfig is also defined separately, so the definition of defconfig in V5 is also separated.
The discussion process as follows:
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Do you have any better suggestion on whether defconfig is defined separately?
Andreas' concern is the match between the device tree and the actual hardware, as far as it matters for (driver) software. So, different hardware => different DT.
However, AFAICT there is no difference until network comes into play, right? And even then, it is only the types of PHYs and their wiring, correct?
From the other thread: can we enable the EEPROM reading code first, to get the proper MAC addresses for the hardware, and also read the board revision, similar to get_pcb_revision_from_eeprom() from the HiFive unmatched? And then use fixup functions from common/fdt_support.c to adapt the device tree details to the detected board?
Torsten
Quoted 35 lines · Torsten Duwe
Quoted 11 lines · On Wed, 29 Mar 2023 18:16:20 +0800 yanhong wang…
Quoted 8 lines · Torsten Duwe
Quoted 1 line · On Wed, 29 Mar 2023 11:42:07 +0800 Yanhong Wang…
v5:
[...]
Quoted 2 lines
- Splitted
starfive_visionfive2_defconfigintostarfive_visionfive2_12a_defconfigandstarfive_visionfive2_13b_defconfig.Quoted 8 lines
Quoted 8 lines
Is this really necessary? It puts another burden on people building U-Boot, distribution networks, and last but not least users, who will need to pick the correct binary blob, after trying to find out which board they actually have.
Even past versions can detect the installed RAM correctly and will modify the DT accordingly, I assume? Why not make an inquiry on
GMAC1_MDIOto tell whether it's a YT8512C (->v1.2A) or another YT8531C (->v1.3B), in the ethernet patch set, and likewise update the device tree dynamically then?At a second look, this is a bit tricky: a device tree is already needed for the network initialisation. That one would need to be good enough to get at the PHYs, and flexible enough to be patched into shape later. But see below...
Quoted 8 lines
There is only one defconfig in V4, and dts is separate for versions 1.2a and 1.3b. Andreas Schwab suggested that defconfig is also defined separately, so the definition of defconfig in V5 is also separated.
The discussion process as follows:
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Quoted 8 lines
Quoted 1 line
Do you have any better suggestion on whether defconfig is defined separately?
Andreas' concern is the match between the device tree and the actual hardware, as far as it matters for (driver) software. So, different hardware => different DT.
However, AFAICT there is no difference until network comes into play, right? And even then, it is only the types of PHYs and their wiring, correct?
Yes, before gmac and phy were added, everything was the same except for 'model', but the definition of DT refers to Linux and is consistent with the definition framework of Linux.
The difference between 1.2A and 1.3B is the PHY type and phy clock delay configuration, which are reflected in DT, and the difference in defconfig is the configuration of the DT file.
Is defconfig defined separately or merged?
Quoted 5 lines
From the other thread: can we enable the EEPROM reading code first, to get the proper MAC addresses for the hardware, and also read the board revision, similar to
get_pcb_revision_from_eeprom()from the HiFive unmatched? And then use fixup functions fromcommon/fdt_support.cto adapt the device tree details to the detected board?
The EEPROM is being prepared and will be submitted as soon as possible. Is it necessary to incorporate EEPROM into this submission?
When eeprom is supported, the MAC address will be read from eeprom. The board reversion can be read from eeprom, but phy clock delay configuration cannot be read from eeprom, only in DT.
Quoted 1 line
Torsten
Quoted 1 line · On Thu, 13 Apr 2023 10:05:28 +0800 yanhong wang…
the definition of DT refers to Linux and is consistent with the definition framework of Linux.
This is one of the desired goals, to avoid confusion, usually. But note there are already the -u-boot.dtsi files; in this case it would be vice-versa: U-Boot could be simple, the kernel required a different treatment. As long as the resulting tree matches the hardware!
Quoted 4 lines
The difference between 1.2A and 1.3B is the PHY type and phy clock delay configuration, which are reflected in DT, and the difference in defconfig is the configuration of the DT file.
Is defconfig defined separately or merged?
You are the implementer, this is your decision. You make a proposal, and it will get accepted or not. We only make suggestions, with the intention to improve the code.
Quoted 5 lines
The EEPROM is being prepared and will be submitted as soon as possible. Is it necessary to incorporate EEPROM into this submission?
When eeprom is supported, the MAC address will be read from eeprom. The board reversion can be read from eeprom, but phy clock delay configuration cannot be read from eeprom, only in DT.
But the board revision number in EEPROM can be used to differentiate between 1.2 and 1.3, right?
When I look at the code and my test results, this is my proposal to pull this in, in order to simplify things and avoid duplication. Whether you do so is up to you, see above. Let me recap:
* the device tree *must* match the hardware at hand.
* the differences are minor and could be patched, Copy&Waste is error prone and causes extra work.
It is my firm conviction that this patch set does not introduce hardware variants, and it would be the task of the ethernet driver patch set to split the code (DT+defconfig) OR to provide a patching method. Maybe I find a few cycles to look at the EEPROM.
Torsten
Quoted 9 lines · Torsten Duwe
Quoted 1 line · On Thu, 13 Apr 2023 10:05:28 +0800 yanhong wang…
the definition of DT refers to Linux and is consistent with the definition framework of Linux.
This is one of the desired goals, to avoid confusion, usually. But note there are already the
-u-boot.dtsifiles; in this case it would be vice-versa: U-Boot could be simple, the kernel required a different treatment. As long as the resulting tree matches the hardware!
Quoted 8 lines
Quoted 4 lines
The difference between 1.2A and 1.3B is the PHY type and phy clock delay configuration, which are reflected in DT, and the difference in defconfig is the configuration of the DT file.
Is defconfig defined separately or merged?
You are the implementer, this is your decision. You make a proposal, and it will get accepted or not. We only make suggestions, with the intention to improve the code.
Thanks. A defconfig matches a piece of hardware, which is more developer-friendly and less confusing, so defconfig is better defined separately.
Quoted 8 lines
Quoted 5 lines
The EEPROM is being prepared and will be submitted as soon as possible. Is it necessary to incorporate EEPROM into this submission?
When eeprom is supported, the MAC address will be read from eeprom. The board reversion can be read from eeprom, but phy clock delay configuration cannot be read from eeprom, only in DT.
But the board revision number in EEPROM can be used to differentiate between 1.2 and 1.3, right?
Yes, board reversion read from eeprom can distinguish between 1.2A and 1.3B.
1.2A and 1.3B are two sets of hardware, and the differences between the hardware are defined by DT, which is more concise and clear.
Quoted 12 lines
When I look at the code and my test results, this is my proposal to pull this in, in order to simplify things and avoid duplication. Whether you do so is up to you, see above. Let me recap:
* the device tree *must* match the hardware at hand.
* the differences are minor and could be patched, Copy&Waste is error prone and causes extra work.
It is my firm conviction that this patch set does not introduce hardware variants, and it would be the task of the ethernet driver patch set to split the code (DT+defconfig) OR to provide a patching method. Maybe I find a few cycles to look at the EEPROM.
Torsten
Quoted 15 lines · yanhong wang
Quoted 12 lines · Torsten Duwe
Quoted 1 line · On Thu, 13 Apr 2023 10:05:28 +0800 yanhong wang…
the definition of DT refers to Linux and is consistent with the definition framework of Linux.
This is one of the desired goals, to avoid confusion, usually. But note there are already the
-u-boot.dtsifiles; in this case it would be vice-versa: U-Boot could be simple, the kernel required a different treatment. As long as the resulting tree matches the hardware!Quoted 3 lines
The difference between 1.2A and 1.3B is the PHY type and phy clock delay configuration, which are reflected in DT, and the difference in defconfig is the configuration of the DT file.
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
Is defconfig defined separately or merged?
You are the implementer, this is your decision. You make a proposal, and it will get accepted or not. We only make suggestions, with the intention to improve the code.
Thanks. A defconfig matches a piece of hardware, which is more developer-friendly and less confusing, so defconfig is better defined separately.
My opinion isIn my opinion user-friendlyness is more important then developer friendly that from an end-user point of view it's much easier to have one binary that works on all different board versions. If not users will have to know which board version they have to flash the correct U-Boot.
For the RaspberryPi we even went further and put effort into U-Boot development to have one U-Boot binary which can boot RPi3 and RPi4 boards.
In that sense I would advise you to revisit your decision to put a developer-friendly approach over an end-user-friendly one.
As Torsten said, it shouldn't be too difficult to update the device-tree at boot time to fit the actual board you are running U-Boot on.
Just my thoughts about the issue :)
Best regards,
Matthias
Quoted 26 lines
Quoted 8 lines
Quoted 5 lines
The EEPROM is being prepared and will be submitted as soon as possible. Is it necessary to incorporate EEPROM into this submission?
When eeprom is supported, the MAC address will be read from eeprom. The board reversion can be read from eeprom, but phy clock delay configuration cannot be read from eeprom, only in DT.
But the board revision number in EEPROM can be used to differentiate between 1.2 and 1.3, right?
Yes, board reversion read from eeprom can distinguish between 1.2A and 1.3B.
1.2A and 1.3B are two sets of hardware, and the differences between the hardware are defined by DT, which is more concise and clear.
Quoted 12 lines
When I look at the code and my test results, this is my proposal to pull this in, in order to simplify things and avoid duplication. Whether you do so is up to you, see above. Let me recap:
* the device tree *must* match the hardware at hand.
* the differences are minor and could be patched, Copy&Waste is error prone and causes extra work.
It is my firm conviction that this patch set does not introduce hardware variants, and it would be the task of the ethernet driver patch set to split the code (DT+defconfig) OR to provide a patching method. Maybe I find a few cycles to look at the EEPROM.
Torsten
Quoted 5 lines · Matthias Brugger
My opinion isIn my opinion user-friendlyness is more important then developer friendly that from an end-user point of view it's much easier to have one binary that works on all different board versions. If not users will have to know which board version they have to flash the correct U-Boot.
As long as the kernel uses separate device trees, U-Boot needs to know which one to load. As it currently stands, U-Boot uses the wrong name that does not match either of the names used by the kernel, which means it will not be able find any of them.
Signature · 3 lines
Andreas Schwab, SUSE Labs, [email protected] GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
Quoted 8 lines · Andreas Schwab
Quoted 5 lines · Matthias Brugger
My opinion isIn my opinion user-friendlyness is more important then developer friendly that from an end-user point of view it's much easier to have one binary that works on all different board versions. If not users will have to know which board version they have to flash the correct U-Boot.
Quoted 5 lines
As long as the kernel uses separate device trees, U-Boot needs to know which one to load. As it currently stands, U-Boot uses the wrong name that does not match either of the names used by the kernel, which means it will not be able find any of them.
I'm not sure I get your point. The devicetree will be passed to the kernel via a pointer in a register, the kernel does not need to load the devicetree into memory, it will use the one passed by U-Boot.
Regards,
Matthias
Quoted 3 lines · Matthias Brugger
I'm not sure I get your point. The devicetree will be passed to the kernel via a pointer in a register, the kernel does not need to load the devicetree into memory, it will use the one passed by U-Boot.
But U-Boot needs to load it, and the kernel is the authority in providing it.
Signature · 3 lines
Andreas Schwab, SUSE Labs, [email protected] GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
Quoted 9 lines · Andreas Schwab
Quoted 3 lines · Matthias Brugger
I'm not sure I get your point. The devicetree will be passed to the kernel via a pointer in a register, the kernel does not need to load the devicetree into memory, it will use the one passed by U-Boot.
But U-Boot needs to load it, and the kernel is the authority in providing it.
To make it a bit clearer:
Several U-Boot boot methods use the value of environment variable $fdtfile to load a device-tree from file. The same holds true for the boot.scr file created by Debian's flash-kernel package.
A good solution would be to read the EEPROM to determine the exact board version, to set $fdtfile accordingly and update U-Boots control dtb as needed.
Best regards
Heinrich
Quoted 11 lines · Heinrich Schuchardt
Quoted 9 lines · Andreas Schwab
Quoted 3 lines · Matthias Brugger
I'm not sure I get your point. The devicetree will be passed to the kernel via a pointer in a register, the kernel does not need to load the devicetree into memory, it will use the one passed by U-Boot.
But U-Boot needs to load it, and the kernel is the authority in providing it.
Quoted 6 lines
To make it a bit clearer:
Several U-Boot boot methods use the value of environment variable $fdtfile to load a device-tree from file. The same holds true for the boot.scr file created by Debian's flash-kernel package.
A good solution would be to read the EEPROM to determine the exact board version, to set $fdtfile accordingly and update U-Boots control dtb as needed.
The patcheset have implemented the reading of PCB versions from EEPROM and the configuration of gmac device tree nodes according to different PCB versions, which can achieve a bin file compatible with both versions 1.2A and 1.3B.
The patcheset link:
https://patchwork.ozlabs.org/project/uboot/cover/[email protected]/
Quoted 3 lines
Best regards
Heinrich
Hi YanHong, Torsten, Matthias,
Quoted 30 lines · yanhong wang
Quoted 9 lines · Torsten Duwe
Quoted 1 line · On Thu, 13 Apr 2023 10:05:28 +0800 yanhong wang…
the definition of DT refers to Linux and is consistent with the definition framework of Linux.
This is one of the desired goals, to avoid confusion, usually. But note there are already the
-u-boot.dtsifiles; in this case it would be vice-versa: U-Boot could be simple, the kernel required a different treatment. As long as the resulting tree matches the hardware!Quoted 8 lines
Quoted 4 lines
The difference between 1.2A and 1.3B is the PHY type and phy clock delay configuration, which are reflected in DT, and the difference in defconfig is the configuration of the DT file.
Is defconfig defined separately or merged?
You are the implementer, this is your decision. You make a proposal, and it will get accepted or not. We only make suggestions, with the intention to improve the code.
Thanks. A defconfig matches a piece of hardware, which is more developer-friendly and less confusing, so defconfig is better defined separately.
Quoted 6 lines
Quoted 5 lines
The EEPROM is being prepared and will be submitted as soon as possible. Is it necessary to incorporate EEPROM into this submission?
When eeprom is supported, the MAC address will be read from eeprom. The board reversion can be read from eeprom, but phy clock delay configuration cannot be read from eeprom, only in DT.
Quoted 20 lines
Quoted 2 lines
But the board revision number in EEPROM can be used to differentiate between 1.2 and 1.3, right?
Yes, board reversion read from eeprom can distinguish between 1.2A and 1.3B.
1.2A and 1.3B are two sets of hardware, and the differences between the hardware are defined by DT, which is more concise and clear.
Quoted 12 lines
When I look at the code and my test results, this is my proposal to pull this in, in order to simplify things and avoid duplication. Whether you do so is up to you, see above. Let me recap:
* the device tree *must* match the hardware at hand.
* the differences are minor and could be patched, Copy&Waste is error prone and causes extra work.
It is my firm conviction that this patch set does not introduce hardware variants, and it would be the task of the ethernet driver patch set to split the code (DT+defconfig) OR to provide a patching method. Maybe I find a few cycles to look at the EEPROM.
Torsten
Agree with Torsten.
I too IMHO think it makes much sense that whether "to split the (DT + defconfig)" or "patching DT" should be the task of ethernet driver patch.
However, this patch set is rather complete and stay on the ML for quite a time. And also Torsten has sent out the RFC patch that is going for the patching method.
In that sense, I think I could probably merge this v5 patch set with [v4 17/17] patch that only introduces a single defconfig, and wait for Torsten's DT patches if you guys agree.
Any thoughts?
Best regards,
Leo