riscv: Add AST2700 platform support
Subsystems (2)
v2 cover riscv: Add AST2700 platform support
AST2700 is the 7th generation of Aspeed BMC SoCs.
A 32-bits Ibex RISC-V core is integrated as the boot MCU to run the first stage bootloader, SPL, for the platform initialization.
This patch series starts by revising RISC-V common code to relax certain restrictions for finer platform resource tuning. As this MCU adopts the "small" configuration provided by Ibex and has limited SRAM space.
In addition to the RV common code revision, the other patches provides the basic AST2700 platform code and DRAM/Timer drivers to succuessfully boot SPL and U-Boot on this Ibex-based MCU.
v2:
- collect Reviewed-by and Acked-by tags
- add the build document for ibex-ast2700 board as suggested
Chia-Wei Wang (8):
riscv: Make A ISA extension selectable
riscv: Make stack size shift configurable
riscv: u-boot-spl.lds: Remove _image_binary_end alignment
riscv: Add AST2700 SoC initial platform support
timer: Add AST2700 IBEX timer support
board: ibex_ast2700: Add FMC header support
ram: ast2700: Add DRAM controller initialization
configs: ibex-ast2700: Enable DRAM and timer driver
arch/riscv/Kconfig | 12 +- arch/riscv/cpu/ast2700/Kconfig | 6 + arch/riscv/cpu/ast2700/Makefile | 1 + arch/riscv/cpu/ast2700/cpu.c | 23 + arch/riscv/cpu/u-boot-spl.lds | 2 - arch/riscv/dts/Makefile | 1 + arch/riscv/dts/ast2700-ibex.dts | 22 + arch/riscv/dts/ast2700-u-boot.dtsi | 40 + arch/riscv/dts/ast2700.dtsi | 76 + arch/riscv/include/asm/arch-ast2700/fmc_hdr.h | 52 + arch/riscv/include/asm/arch-ast2700/scu.h | 145 + arch/riscv/include/asm/arch-ast2700/sdram.h | 137 + arch/riscv/include/asm/arch-ast2700/sli.h | 82 + board/aspeed/ibex_ast2700/Kconfig | 21 + board/aspeed/ibex_ast2700/MAINTAINERS | 7 + board/aspeed/ibex_ast2700/Makefile | 3 + board/aspeed/ibex_ast2700/fmc_hdr.c | 64 + board/aspeed/ibex_ast2700/ibex_ast2700.c | 85 + board/aspeed/ibex_ast2700/sli.c | 72 + configs/ibex-ast2700_defconfig | 94 + doc/board/aspeed/ibex-ast2700.rst | 26 + doc/board/aspeed/index.rst | 9 + doc/board/index.rst | 1 + drivers/ram/Makefile | 2 +- drivers/ram/aspeed/Kconfig | 27 +- drivers/ram/aspeed/Makefile | 1 + ..._ddrphy_phyinit_ddr4-3200-nodimm-train2D.c | 2700 +++++++ ..._ddrphy_phyinit_ddr5-3200-nodimm-train2D.c | 6930 +++++++++++++++++ drivers/ram/aspeed/sdram_ast2700.c | 1036 +++ drivers/timer/Kconfig | 6 + drivers/timer/Makefile | 1 + drivers/timer/ast_ibex_timer.c | 45 + include/configs/ibex_ast2700.h | 12 + 33 files changed, 11732 insertions(+), 9 deletions(-) create mode 100644 arch/riscv/cpu/ast2700/Kconfig create mode 100644 arch/riscv/cpu/ast2700/Makefile create mode 100644 arch/riscv/cpu/ast2700/cpu.c create mode 100644 arch/riscv/dts/ast2700-ibex.dts create mode 100644 arch/riscv/dts/ast2700-u-boot.dtsi create mode 100644 arch/riscv/dts/ast2700.dtsi create mode 100644 arch/riscv/include/asm/arch-ast2700/fmc_hdr.h create mode 100644 arch/riscv/include/asm/arch-ast2700/scu.h create mode 100644 arch/riscv/include/asm/arch-ast2700/sdram.h create mode 100644 arch/riscv/include/asm/arch-ast2700/sli.h create mode 100644 board/aspeed/ibex_ast2700/Kconfig create mode 100644 board/aspeed/ibex_ast2700/MAINTAINERS create mode 100644 board/aspeed/ibex_ast2700/Makefile create mode 100644 board/aspeed/ibex_ast2700/fmc_hdr.c create mode 100644 board/aspeed/ibex_ast2700/ibex_ast2700.c create mode 100644 board/aspeed/ibex_ast2700/sli.c create mode 100644 configs/ibex-ast2700_defconfig create mode 100644 doc/board/aspeed/ibex-ast2700.rst create mode 100644 doc/board/aspeed/index.rst create mode 100644 drivers/ram/aspeed/dwc_ddrphy_phyinit_ddr4-3200-nodimm-train2D.c create mode 100644 drivers/ram/aspeed/dwc_ddrphy_phyinit_ddr5-3200-nodimm-train2D.c create mode 100644 drivers/ram/aspeed/sdram_ast2700.c create mode 100644 drivers/timer/ast_ibex_timer.c create mode 100644 include/configs/ibex_ast2700.h
Signature · 1 line
2.25.1
PATCH v2 1/8 riscv: Make A ISA extension selectable
Make the Atomic (A) ISA extension selectable. Thus CPUs such as Ibex without the A extension can be supported.
--- arch/riscv/Kconfig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/riscv/Kconfig +4 -1
@@ -308,7 +308,10 @@ config TPL_USE_ARCH_STRNCMP endmenu config RISCV_ISA_A - def_bool y + bool "Standard extension for Atomic Instructions" + default y + help + Adds "A" to the ISA string passed to the compiler. config DMA_ADDR_T_64BIT bool
Signature · 1 line
2.25.1
PATCH v2 2/8 riscv: Make stack size shift configurable
In reply to Chia-Wei WangAdd prompt for STACK_SIZE_SHIFT to make it configurable. The default value remains 14 as usual.
--- arch/riscv/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/Kconfig +1 -1
@@ -453,7 +453,7 @@ config RISCV_PRIV_1_9 memory is configured was also changed. config STACK_SIZE_SHIFT - int + int "Stack size shift" default 14 config OF_BOARD_FIXUP
Signature · 1 line
2.25.1
PATCH v2 3/8 riscv: u-boot-spl.lds: Remove _image_binary_end alignment
In reply to Chia-Wei WangThe _image_binary_end symbol was aligned to the 8-bytes boundary. However, the SPL device tree (u-boot-spl.dtb) is concatenated right after the binary (u-boot-spl-nodtb.bin) wihtout the consideration of the 8-bytes alignment restriction.
After then, for the SPL_SEPARATE_BSS case, fdtdec_setup() searching for the DTB by _image_binary_end will return the "Missing DTB" error. As the real DTB starting point does not align to a 8-bytes address like _image_binary_end does.
--- arch/riscv/cpu/u-boot-spl.lds | 2 -- 1 file changed, 2 deletions(-)
arch/riscv/cpu/u-boot-spl.lds +0 -2
@@ -44,8 +44,6 @@ SECTIONS __binman_sym_end = .; } > .spl_mem - . = ALIGN(8); - _end = .; _image_binary_end = .;
Signature · 1 line
2.25.1
PATCH v2 4/8 riscv: Add AST2700 SoC initial platform support
In reply to Chia-Wei WangAST2700 SoCs integrates a Ibex 32-bits RISC-V core as the boot MCU for the first stage bootloader execution, namely SPL.
This patch implements the preliminary base to successfully run SPL on this RV32-based MCU to the console banner message.
--- arch/riscv/Kconfig | 5 + arch/riscv/cpu/ast2700/Kconfig | 6 + arch/riscv/cpu/ast2700/Makefile | 1 + arch/riscv/cpu/ast2700/cpu.c | 23 ++++ arch/riscv/dts/Makefile | 1 + arch/riscv/dts/ast2700-ibex.dts | 22 ++++ arch/riscv/dts/ast2700-u-boot.dtsi | 40 ++++++ arch/riscv/dts/ast2700.dtsi | 76 ++++++++++++ arch/riscv/include/asm/arch-ast2700/scu.h | 145 ++++++++++++++++++++++ arch/riscv/include/asm/arch-ast2700/sli.h | 82 ++++++++++++ board/aspeed/ibex_ast2700/Kconfig | 21 ++++ board/aspeed/ibex_ast2700/MAINTAINERS | 7 ++ board/aspeed/ibex_ast2700/Makefile | 2 + board/aspeed/ibex_ast2700/ibex_ast2700.c | 85 +++++++++++++ board/aspeed/ibex_ast2700/sli.c | 72 +++++++++++ configs/ibex-ast2700_defconfig | 92 ++++++++++++++ doc/board/aspeed/ibex-ast2700.rst | 26 ++++ doc/board/aspeed/index.rst | 9 ++ doc/board/index.rst | 1 + include/configs/ibex_ast2700.h | 12 ++ 20 files changed, 728 insertions(+) create mode 100644 arch/riscv/cpu/ast2700/Kconfig create mode 100644 arch/riscv/cpu/ast2700/Makefile create mode 100644 arch/riscv/cpu/ast2700/cpu.c create mode 100644 arch/riscv/dts/ast2700-ibex.dts create mode 100644 arch/riscv/dts/ast2700-u-boot.dtsi create mode 100644 arch/riscv/dts/ast2700.dtsi create mode 100644 arch/riscv/include/asm/arch-ast2700/scu.h create mode 100644 arch/riscv/include/asm/arch-ast2700/sli.h create mode 100644 board/aspeed/ibex_ast2700/Kconfig create mode 100644 board/aspeed/ibex_ast2700/MAINTAINERS create mode 100644 board/aspeed/ibex_ast2700/Makefile create mode 100644 board/aspeed/ibex_ast2700/ibex_ast2700.c create mode 100644 board/aspeed/ibex_ast2700/sli.c create mode 100644 configs/ibex-ast2700_defconfig create mode 100644 doc/board/aspeed/ibex-ast2700.rst create mode 100644 doc/board/aspeed/index.rst create mode 100644 include/configs/ibex_ast2700.h
arch/riscv/Kconfig +5 -0
@@ -46,6 +46,9 @@ config TARGET_TH1520_LPI4A config TARGET_XILINX_MBV bool "Support AMD/Xilinx MicroBlaze V" +config TARGET_ASPEED_AST2700_IBEX + bool "Support Ibex RISC-V cores on Aspeed AST2700 SoC" + endchoice config SYS_ICACHE_OFF
@@ -81,6 +84,7 @@ config SPL_ZERO_MEM_BEFORE_USE # board-specific options below source "board/andestech/ae350/Kconfig" +source "board/aspeed/ibex_ast2700/Kconfig" source "board/emulation/qemu-riscv/Kconfig" source "board/microchip/mpfs_icicle/Kconfig" source "board/openpiton/riscv64/Kconfig"
@@ -97,6 +101,7 @@ source "arch/riscv/cpu/andes/Kconfig" source "arch/riscv/cpu/cv1800b/Kconfig" source "arch/riscv/cpu/fu540/Kconfig" source "arch/riscv/cpu/fu740/Kconfig" +source "arch/riscv/cpu/ast2700/Kconfig" source "arch/riscv/cpu/generic/Kconfig" source "arch/riscv/cpu/jh7110/Kconfig"
arch/riscv/cpu/ast2700/Kconfig new file +6 -0
@@ -0,0 +1,6 @@ +config RISCV_AST2700 + bool + imply CPU + imply CPU_RISCV + help + Run U-Boot on AST2700 with IBex RISC-V CPU integrated.
arch/riscv/cpu/ast2700/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-y += cpu.o
arch/riscv/cpu/ast2700/cpu.c new file +23 -0
@@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Copyright (C) 2018, Bin Meng <[email protected]> +* Copyright (C) 2024, Aspeed Technology Inc. +*/ + +#include <irq_func.h> +#include <asm/cache.h> + +/* +* cleanup_before_linux() is called just before we call linux +* it prepares the processor for linux +* +* we disable interrupt and caches. +*/ +int cleanup_before_linux (void ) +{ +disable_interrupts (); + +cache_flush (); + +return 0 ; +}
arch/riscv/dts/Makefile +1 -0
@@ -11,6 +11,7 @@ dtb-$(CONFIG_TARGET_SIPEED_MAIX) += k210-maix-bit.dtb dtb-$(CONFIG_TARGET_STARFIVE_VISIONFIVE2) += jh7110-starfive-visionfive-2.dtb dtb-$(CONFIG_TARGET_TH1520_LPI4A) += th1520-lichee-pi-4a.dtb dtb-$(CONFIG_TARGET_XILINX_MBV) += xilinx-mbv32.dtb +dtb-$(CONFIG_TARGET_ASPEED_AST2700_IBEX) += ast2700-ibex.dtb include $(srctree)/scripts/Makefile.dts
arch/riscv/dts/ast2700-ibex.dts new file +22 -0
@@ -0,0 +1,22 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; + +#include "ast2700.dtsi" + +/ { + chosen { + stdout-path = &uart12; + tick-timer = &ast_ibex_timer; + }; + + memory@0 { + device_type = "memory"; + reg = <0x80000000 0x40000000>; + }; +}; + +&uart12 { + status = "okay"; + clock-frequency = <1846153>; +};
arch/riscv/dts/ast2700-u-boot.dtsi new file +40 -0
@@ -0,0 +1,40 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/ { + cpus { + bootph-all; + }; + + memory@80000000 { + bootph-all; + }; + + soc0: soc@12000000 { + bootph-all; + + sdrammc: sdrammc@12c00000 { + bootph-all; + }; + + syscon0: syscon@12c02000 { + bootph-all; + }; + }; + + soc1: soc@14000000 { + bootph-all; + + syscon1: syscon@14c02000 { + bootph-all; + }; + + uart12: serial@14c33b00 { + bootph-all; + }; + + ast_ibex_timer: timer { + bootph-all; + }; + }; + +};
arch/riscv/dts/ast2700.dtsi new file +76 -0
76 lines not on this page · raw message
arch/riscv/include/asm/arch-ast2700/scu.h new file +145 -0
145 lines not on this page · raw message
arch/riscv/include/asm/arch-ast2700/sli.h new file +82 -0
82 lines not on this page · raw message
board/aspeed/ibex_ast2700/Kconfig new file +21 -0
@@ -0,0 +1,21 @@ +if TARGET_ASPEED_AST2700_IBEX + +config SYS_BOARD + default "ibex_ast2700" + +config SYS_VENDOR + default "aspeed" + +config SYS_CPU + default "ast2700" + +config SYS_CONFIG_NAME + default "ibex_ast2700" + +config BOARD_SPECIFIC_OPTIONS + def_bool y + select RISCV_AST2700 + select SUPPORT_SPL + imply SPL_DRIVERS_MISC + +endif
board/aspeed/ibex_ast2700/MAINTAINERS new file +7 -0
@@ -0,0 +1,7 @@ +AST2700 using Ibex RISC-V Core as the boot MCU +M: Chia-Wei, Wang <[email protected]> +S: Maintained +F: arch/riscv/include/asm/arch-ast2700/ +F: board/aspeed/ibex_ast2700/ +F: configs/ibex-ast2700_defconfig +F: include/configs/ibex_ast2700.h
board/aspeed/ibex_ast2700/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +obj-y += ibex_ast2700.o +obj-y += sli.o
board/aspeed/ibex_ast2700/ibex_ast2700.c new file +85 -0
85 lines not on this page · raw message
board/aspeed/ibex_ast2700/sli.c new file +72 -0
72 lines not on this page · raw message
configs/ibex-ast2700_defconfig new file +92 -0
92 lines not on this page · raw message
doc/board/aspeed/ibex-ast2700.rst new file +26 -0
@@ -0,0 +1,26 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +IBex AST2700 +============ + +AST2700 integrates an IBex RISC-V 32-bits CPU as the boot MCU to execute the +first stage bootlaoder, namely SPL. + +Build +----- + +1. Prepare the toolchains and make sure the $PATH to toolchains is correct. +2. Use `make ibex-ast2700_defconfig` in u-boot root to build the image + +Running U-Boot SPL +------------------ + +The U-Boot SPL will boot in M mode and load the FIT image which includes +the 2nd stage bootloaders executed by the main processor Cortex-A35. + + +Burn U-Boot to SPI Flash +------------------------ + +Use SPI flash programmer (e.g. SF100) to program the u-book-spl.bin with the +offset 0x80 bytes to the SPI flash beginning.
doc/board/aspeed/index.rst new file +9 -0
@@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Aspeed +====== + +.. toctree:: + :maxdepth: 2 + + ibex-ast2700
doc/board/index.rst +1 -0
@@ -14,6 +14,7 @@ Board-specific doc anbernic/index apple/index armltd/index + aspeed/index asus/index atmel/index beacon/index
include/configs/ibex_ast2700.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (c) Aspeed Technology Inc. +*/ + +#ifndef __CONFIG_H +#define __CONFIG_H + +#define CFG_SYS_UBOOT_BASE CONFIG_TEXT_BASE +#define CFG_SYS_SDRAM_BASE 0x80000000 + +#endif /* __CONFIG_H */
Signature · 1 line
2.25.1
PATCH v2 5/8 timer: Add AST2700 IBEX timer support
In reply to Chia-Wei WangAdd the driver for the AST2700 Ibex timer, which uses CPU cycles as the timer count running at 200MHz.
--- drivers/timer/Kconfig | 6 +++++ drivers/timer/Makefile | 1 + drivers/timer/ast_ibex_timer.c | 45 ++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 drivers/timer/ast_ibex_timer.c
drivers/timer/Kconfig +6 -0
@@ -106,6 +106,12 @@ config AST_TIMER This is mostly because they all share several registers which makes it difficult to completely separate them. +config AST_IBEX_TIMER + bool "Aspeed ast2700 Ibex timer" + depends on TIMER + help + Select this to enable a timer support for the Ibex RV32-based MCUs in AST2700. + config ATCPIT100_TIMER bool "ATCPIT100 timer support" depends on TIMER
drivers/timer/Makefile +1 -0
@@ -9,6 +9,7 @@ obj-$(CONFIG_$(SPL_)ANDES_PLMT_TIMER) += andes_plmt_timer.o obj-$(CONFIG_ARC_TIMER) += arc_timer.o obj-$(CONFIG_ARM_TWD_TIMER) += arm_twd_timer.o obj-$(CONFIG_AST_TIMER) += ast_timer.o +obj-$(CONFIG_AST_IBEX_TIMER) += ast_ibex_timer.o obj-$(CONFIG_ATCPIT100_TIMER) += atcpit100_timer.o obj-$(CONFIG_$(SPL_)ATMEL_PIT_TIMER) += atmel_pit_timer.o obj-$(CONFIG_$(SPL_)ATMEL_TCB_TIMER) += atmel_tcb_timer.o
drivers/timer/ast_ibex_timer.c new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 6/8 board: ibex_ast2700: Add FMC header support
In reply to Chia-Wei WangDefine and parse the header of the First Mutable Code (FMC) of AST2700 SoCs at runtime phase.
The FMC header contains the information to load prebuilt binaries required for device initialization such as DRAM and VGA.
--- arch/riscv/include/asm/arch-ast2700/fmc_hdr.h | 52 +++++++++++++++ board/aspeed/ibex_ast2700/Makefile | 1 + board/aspeed/ibex_ast2700/fmc_hdr.c | 64 +++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 arch/riscv/include/asm/arch-ast2700/fmc_hdr.h create mode 100644 board/aspeed/ibex_ast2700/fmc_hdr.c
arch/riscv/include/asm/arch-ast2700/fmc_hdr.h new file +52 -0
@@ -0,0 +1,52 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (C) ASPEED Technology Inc. +*/ + +#ifndef __ASM_AST2700_FMC_HDR_H__ +#define __ASM_AST2700_FMC_HDR_H__ + +#include <linux/types.h> + +#define HDR_MAGIC 0x48545341/* ASTH */ +#define HDR_PB_MAX 30 + +enum prebuilt_type { +PBT_END_MARK =0x0 , + +PBT_DDR4_PMU_TRAIN_IMEM , +PBT_DDR4_PMU_TRAIN_DMEM , +PBT_DDR4_2D_PMU_TRAIN_IMEM , +PBT_DDR4_2D_PMU_TRAIN_DMEM , +PBT_DDR5_PMU_TRAIN_IMEM , +PBT_DDR5_PMU_TRAIN_DMEM , +PBT_DP_FW , +PBT_UEFI_X64_AST2700 , + +PBT_NUM +}; + +struct fmc_hdr_preamble { +uint32_t magic; +uint32_t version; +}; + +struct fmc_hdr_body { +uint32_t fmc_size; +union { +struct { +uint32_t type; +uint32_t size; + } pbs[0 ]; +uint32_t raz[29 ]; + }; +}; + +struct fmc_hdr { +struct fmc_hdr_preamble preamble; +struct fmc_hdr_body body; +} __packed; + +int fmc_hdr_get_prebuilt (uint32_t type,uint32_t *ofst,uint32_t *size); + +#endif
board/aspeed/ibex_ast2700/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-y += ibex_ast2700.o +obj-y += fmc_hdr.o obj-y += sli.o
board/aspeed/ibex_ast2700/fmc_hdr.c new file +64 -0
64 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 7/8 ram: ast2700: Add DRAM controller initialization
In reply to Chia-Wei WangAdd driver for AST2700 to initialize DRAM in SPL.
This patch also refactors the Kconfig dependency of Aspeed DRAM drivers as some of them are shared among the file structures of RV and ARM ISAs.
--- arch/riscv/include/asm/arch-ast2700/sdram.h | 137 + drivers/ram/Makefile | 2 +- drivers/ram/aspeed/Kconfig | 27 +- drivers/ram/aspeed/Makefile | 1 + ..._ddrphy_phyinit_ddr4-3200-nodimm-train2D.c | 2700 +++++++ ..._ddrphy_phyinit_ddr5-3200-nodimm-train2D.c | 6930 +++++++++++++++++ drivers/ram/aspeed/sdram_ast2700.c | 1036 +++ 7 files changed, 10828 insertions(+), 5 deletions(-) create mode 100644 arch/riscv/include/asm/arch-ast2700/sdram.h create mode 100644 drivers/ram/aspeed/dwc_ddrphy_phyinit_ddr4-3200-nodimm-train2D.c create mode 100644 drivers/ram/aspeed/dwc_ddrphy_phyinit_ddr5-3200-nodimm-train2D.c create mode 100644 drivers/ram/aspeed/sdram_ast2700.c
arch/riscv/include/asm/arch-ast2700/sdram.h new file +137 -0
@@ -0,0 +1,137 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (c) Aspeed Technology Inc. +*/ +#ifndef __ASM_AST2700_SDRAM_H__ +#define __ASM_AST2700_SDRAM_H__ + +struct sdrammc_regs { +u32 prot_key; +u32 intr_status; +u32 intr_clear; +u32 intr_mask; +u32 mcfg; +u32 mctl; +u32 msts; +u32 error_status; +u32 actime1; +u32 actime2; +u32 actime3; +u32 actime4; +u32 actime5; +u32 actime6; +u32 actime7; +u32 dfi_timing; +u32 dcfg; +u32 dctl; +u32 mrctl; +u32 mrwr; +u32 mrrd; +u32 mr01; +u32 mr23; +u32 mr45; +u32 mr67; +u32 refctl; +u32 refmng_ctl; +u32 refsts; +u32 zqctl; +u32 ecc_addr_range; +u32 ecc_failure_status; +u32 ecc_failure_addr; +u32 ecc_test_control; +u32 ecc_test_status; +u32 arbctl; +u32 enccfg; +u32 protect_lock_set; +u32 protect_lock_status; +u32 protect_lock_reset; +u32 enc_min_addr; +u32 enc_max_addr; +u32 enc_key[4 ]; +u32 enc_iv[3 ]; +u32 bistcfg; +u32 bist_addr; +u32 bist_size; +u32 bist_patt; +u32 bist_res; +u32 bist_fail_addr; +u32 bist_fail_data[4 ]; +u32 reserved2[2 ]; +u32 debug_control; +u32 debug_status; +u32 phy_intf_status; +u32 testcfg; +u32 gfmcfg; +u32 gfm0ctl; +u32 gfm1ctl; +u32 reserved3[0xf8 ]; +}; + +#define DRAMC_UNLK_KEY 0x1688a8a8 + +/* offset 0x04 */ +#define DRAMC_IRQSTA_PWRCTL_ERR BIT(16) +#define DRAMC_IRQSTA_PHY_ERR BIT(15) +#define DRAMC_IRQSTA_LOWPOWER_DONE BIT(12) +#define DRAMC_IRQSTA_FREQ_CHG_DONE BIT(11) +#define DRAMC_IRQSTA_REF_DONE BIT(10) +#define DRAMC_IRQSTA_ZQ_DONE BIT(9) +#define DRAMC_IRQSTA_BIST_DONE BIT(8) +#define DRAMC_IRQSTA_ECC_RCVY_ERR BIT(5) +#define DRAMC_IRQSTA_ECC_ERR BIT(4) +#define DRAMC_IRQSTA_PROT_ERR BIT(3) +#define DRAMC_IRQSTA_OVERSZ_ERR BIT(2) +#define DRAMC_IRQSTA_MR_DONE BIT(1) +#define DRAMC_IRQSTA_PHY_INIT_DONE BIT(0) + +/* offset 0x14 */ +#define DRAMC_MCTL_WB_SOFT_RESET BIT(24) +#define DRAMC_MCTL_PHY_CLK_DIS BIT(18) +#define DRAMC_MCTL_PHY_RESET BIT(17) +#define DRAMC_MCTL_PHY_POWER_ON BIT(16) +#define DRAMC_MCTL_FREQ_CHG_START BIT(3) +#define DRAMC_MCTL_PHY_LOWPOWER_START BIT(2) +#define DRAMC_MCTL_SELF_REF_START BIT(1) +#define DRAMC_MCTL_PHY_INIT_START BIT(0) + +/* offset 0x40 */ +#define DRAMC_DFICFG_WD_POL BIT(18) +#define DRAMC_DFICFG_CKE_OUT BIT(17) +#define DRAMC_DFICFG_RESET BIT(16) + +/* offset 0x48 */ +#define DRAMC_MRCTL_ERR_STATUS BIT(31) +#define DRAMC_MRCTL_READY_STATUS BIT(30) +#define DRAMC_MRCTL_MR_ADDR BIT(8) +#define DRAMC_MRCTL_CMD_DLL_RST BIT(7) +#define DRAMC_MRCTL_CMD_DQ_SEL BIT(6) +#define DRAMC_MRCTL_CMD_TYPE BIT(2) +#define DRAMC_MRCTL_CMD_WR_CTL BIT(1) +#define DRAMC_MRCTL_CMD_START BIT(0) + +/* offset 0xC0 */ +#define DRAMC_BISTRES_RUNNING BIT(10) +#define DRAMC_BISTRES_FAIL BIT(9) +#define DRAMC_BISTRES_DONE BIT(8) +#define DRAMC_BISTCFG_INIT_MODE BIT(7) +#define DRAMC_BISTCFG_PMODE GENMASK(6, 4) +#define DRAMC_BISTCFG_BMODE GENMASK(3, 2) +#define DRAMC_BISTCFG_ENABLE BIT(1) +#define DRAMC_BISTCFG_START BIT(0) +#define BIST_PMODE_CRC (3) +#define BIST_BMODE_RW_SWITCH (3) + +/* DRAMC048 MR Control Register */ +#define MR_TYPE_SHIFT 2 +#define MR_RW (0 << MR_TYPE_SHIFT) +#define MR_MPC BIT(2) +#define MR_VREFCS (2 << MR_TYPE_SHIFT) +#define MR_VREFCA (3 << MR_TYPE_SHIFT) +#define MR_ADDRESS_SHIFT 8 +#define MR_ADDR (n) (((n) << MR_ADDRESS_SHIFT) | DRAMC_MRCTL_CMD_WR_CTL) +#define MR_NUM_SHIFT 4 +#define MR_NUM (n) ((n) << MR_NUM_SHIFT) +#define MR_DLL_RESET BIT(7) +#define MR_1T_MODE BIT(16) + +#endif
drivers/ram/Makefile +1 -1
@@ -14,7 +14,7 @@ obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ obj-$(CONFIG_K3_AM654_DDRSS) += k3-am654-ddrss.o obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/ -obj-$(CONFIG_ARCH_ASPEED) += aspeed/ +obj-$(CONFIG_ASPEED_RAM) += aspeed/ obj-$(CONFIG_K3_DDRSS) += k3-ddrss/ obj-$(CONFIG_IMXRT_SDRAM) += imxrt_sdram.o
drivers/ram/aspeed/Kconfig +23 -4
@@ -1,6 +1,7 @@ menuconfig ASPEED_RAM bool "ASPEED SDRAM configuration" - depends on RAM && ARCH_ASPEED + depends on RAM + depends on ARCH_ASPEED || TARGET_ASPEED_AST2700_IBEX default ARCH_ASPEED help Configuration options for DDR SDRAM on ASPEED systems.
@@ -8,8 +9,6 @@ menuconfig ASPEED_RAM RAM initialisation is always built in for the platform. This menu allows customisation of the configuration used. -if ASPEED_RAM - config ASPEED_DDR4_DUALX8 bool "Enable Dual X8 DDR4 die" depends on ASPEED_RAM
@@ -74,4 +73,24 @@ config ASPEED_DDR4_1600 select DDR4 target data rate at 1600M endchoice -endif # End of ASPEED_RAM +choice + prompt "AST2700 DDR target date rate" + default ASPEED_DDR_3200 + depends on ASPEED_RAM + depends on TARGET_ASPEED_AST2700_IBEX + +config ASPEED_DDR_1600 + bool "1600 Mbps" + help + select DDR target data rate at 1600M + +config ASPEED_DDR_2400 + bool "2400 Mbps" + help + select DDR target data rate at 2400M + +config ASPEED_DDR_3200 + bool "3200 Mbps" + help + select DDR target data rate at 3200M +endchoice
drivers/ram/aspeed/Makefile +1 -0
@@ -2,3 +2,4 @@ # obj-$(CONFIG_ASPEED_AST2500) += sdram_ast2500.o obj-$(CONFIG_ASPEED_AST2600) += sdram_ast2600.o +obj-$(CONFIG_TARGET_ASPEED_AST2700_IBEX) += sdram_ast2700.o
drivers/ram/aspeed/dwc_ddrphy_phyinit_ddr4-3200-nodimm-train2D.c new file +2700 -0
2,700 lines not on this page · raw message
drivers/ram/aspeed/dwc_ddrphy_phyinit_ddr5-3200-nodimm-train2D.c new file +6930 -0
110 lines not on this page · raw message
drivers/ram/aspeed/sdram_ast2700.c new file +1036 -0
1,036 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.25.1
Part of the diff is not shown here. View the raw message.
PATCH v2 8/8 configs: ibex-ast2700: Enable DRAM and timer driver
In reply to Chia-Wei WangEnable the driver support for the DRAM and timer devices.
--- configs/ibex-ast2700_defconfig | 2 ++ 1 file changed, 2 insertions(+)
configs/ibex-ast2700_defconfig +2 -0
@@ -83,9 +83,11 @@ CONFIG_MMC_SDHCI=y # CONFIG_POWER is not set CONFIG_RAM=y CONFIG_SPL_RAM=y +CONFIG_ASPEED_RAM=y # CONFIG_RAM_SIFIVE is not set CONFIG_SYS_NS16550=y CONFIG_SYS_NS16550_MEM32=y +CONFIG_AST_IBEX_TIMER=y CONFIG_VIDEO=y # CONFIG_VIDEO_LOGO is not set # CONFIG_RSA is not set
Signature · 1 line
2.25.1