From 6dd4d5de15d9fc2b3ea54e3e91cdad6a0ba969ee Mon Sep 17 00:00:00 2001 From: Jani Paalijarvi Date: Thu, 14 Oct 2021 07:29:11 +0300 Subject: [PATCH] risc-v/mpfs: Add support for Aries M100PFSMVP board - Add defconfig and board specific files - Create mpfs/common for code which is shared between MPFS boards. - Add support for GPIO driven EMMCSD mux. - Move DDR Libero definitions from arch to boards. Signed-off-by: Jani Paalijarvi --- arch/risc-v/src/mpfs/Kconfig | 6 + arch/risc-v/src/mpfs/mpfs_emmcsd.c | 17 +- boards/Kconfig | 12 + boards/risc-v/mpfs/common/Makefile | 34 + .../mpfs/{icicle => common}/kernel/Makefile | 2 +- .../kernel/mpfs_userspace.c | 2 +- .../src/Makefile => common/src/Make.defs} | 18 +- .../{icicle => common}/src/mpfs_board_spi.c | 2 +- .../mpfs/{icicle => common}/src/mpfs_boot.c | 2 +- .../mpfs/{icicle => common}/src/mpfs_emmcsd.c | 23 +- .../mpfs/{icicle => common}/src/mpfs_i2c.c | 2 +- .../mpfs/{icicle => common}/src/mpfs_ostest.c | 2 +- .../mpfs/{icicle => common}/src/mpfs_pwm.c | 2 +- boards/risc-v/mpfs/icicle/src/Make.defs | 33 + .../src/{mpfsicicle.h => board_config.h} | 8 +- boards/risc-v/mpfs/icicle/src/mpfs_appinit.c | 2 +- boards/risc-v/mpfs/icicle/src/mpfs_autoleds.c | 2 +- boards/risc-v/mpfs/icicle/src/mpfs_bringup.c | 2 +- boards/risc-v/mpfs/m100pfsevp/Kconfig | 8 + .../mpfs/m100pfsevp/configs/nsh/defconfig | 75 +++ boards/risc-v/mpfs/m100pfsevp/include/board.h | 87 +++ .../m100pfsevp/include/board_liberodefs.h | 613 ++++++++++++++++++ .../risc-v/mpfs/m100pfsevp/scripts/Make.defs | 102 +++ .../risc-v/mpfs/m100pfsevp/scripts/gnu-elf.ld | 115 ++++ .../mpfs/m100pfsevp/scripts/hss-nuttx.yml | 12 + .../mpfs/m100pfsevp/scripts/ld-envm.script | 98 +++ .../risc-v/mpfs/m100pfsevp/scripts/ld.script | 97 +++ .../risc-v/mpfs/m100pfsevp/scripts/memory.ld | 35 + .../mpfs/m100pfsevp/scripts/user-space.ld | 104 +++ boards/risc-v/mpfs/m100pfsevp/src/Make.defs | 33 + .../risc-v/mpfs/m100pfsevp/src/board_config.h | 39 ++ .../risc-v/mpfs/m100pfsevp/src/mpfs_appinit.c | 75 +++ .../mpfs/m100pfsevp/src/mpfs_autoleds.c | 92 +++ .../risc-v/mpfs/m100pfsevp/src/mpfs_bringup.c | 105 +++ 34 files changed, 1823 insertions(+), 38 deletions(-) create mode 100644 boards/risc-v/mpfs/common/Makefile rename boards/risc-v/mpfs/{icicle => common}/kernel/Makefile (98%) rename boards/risc-v/mpfs/{icicle => common}/kernel/mpfs_userspace.c (98%) rename boards/risc-v/mpfs/{icicle/src/Makefile => common/src/Make.defs} (82%) rename boards/risc-v/mpfs/{icicle => common}/src/mpfs_board_spi.c (98%) rename boards/risc-v/mpfs/{icicle => common}/src/mpfs_boot.c (98%) rename boards/risc-v/mpfs/{icicle => common}/src/mpfs_emmcsd.c (82%) rename boards/risc-v/mpfs/{icicle => common}/src/mpfs_i2c.c (98%) rename boards/risc-v/mpfs/{icicle => common}/src/mpfs_ostest.c (98%) rename boards/risc-v/mpfs/{icicle => common}/src/mpfs_pwm.c (98%) create mode 100755 boards/risc-v/mpfs/icicle/src/Make.defs rename boards/risc-v/mpfs/icicle/src/{mpfsicicle.h => board_config.h} (90%) create mode 100755 boards/risc-v/mpfs/m100pfsevp/Kconfig create mode 100644 boards/risc-v/mpfs/m100pfsevp/configs/nsh/defconfig create mode 100755 boards/risc-v/mpfs/m100pfsevp/include/board.h create mode 100644 boards/risc-v/mpfs/m100pfsevp/include/board_liberodefs.h create mode 100755 boards/risc-v/mpfs/m100pfsevp/scripts/Make.defs create mode 100755 boards/risc-v/mpfs/m100pfsevp/scripts/gnu-elf.ld create mode 100644 boards/risc-v/mpfs/m100pfsevp/scripts/hss-nuttx.yml create mode 100755 boards/risc-v/mpfs/m100pfsevp/scripts/ld-envm.script create mode 100755 boards/risc-v/mpfs/m100pfsevp/scripts/ld.script create mode 100755 boards/risc-v/mpfs/m100pfsevp/scripts/memory.ld create mode 100755 boards/risc-v/mpfs/m100pfsevp/scripts/user-space.ld create mode 100755 boards/risc-v/mpfs/m100pfsevp/src/Make.defs create mode 100755 boards/risc-v/mpfs/m100pfsevp/src/board_config.h create mode 100755 boards/risc-v/mpfs/m100pfsevp/src/mpfs_appinit.c create mode 100755 boards/risc-v/mpfs/m100pfsevp/src/mpfs_autoleds.c create mode 100755 boards/risc-v/mpfs/m100pfsevp/src/mpfs_bringup.c diff --git a/arch/risc-v/src/mpfs/Kconfig b/arch/risc-v/src/mpfs/Kconfig index 934186d65c..c3ec38e343 100755 --- a/arch/risc-v/src/mpfs/Kconfig +++ b/arch/risc-v/src/mpfs/Kconfig @@ -32,6 +32,12 @@ config MPFS_DDR_INIT ---help--- Initializes and performs DDR training on the associated DDR memory. +config MPFS_EMMCSD_MUX_GPIO + bool "GPIO driven EMMCSD mux" + default n + ---help--- + External mux GPIO between e.MMC and SD-card + menu "MPFS Peripheral Support" # These "hidden" settings determine whether a peripheral option is available diff --git a/arch/risc-v/src/mpfs/mpfs_emmcsd.c b/arch/risc-v/src/mpfs/mpfs_emmcsd.c index 3772bac219..f0d7c31439 100755 --- a/arch/risc-v/src/mpfs/mpfs_emmcsd.c +++ b/arch/risc-v/src/mpfs/mpfs_emmcsd.c @@ -217,10 +217,13 @@ MPFS_EMMCSD_SRS14_TC_IE) /* SD-Card IOMUX */ - #define LIBERO_SETTING_IOMUX1_CR_SD 0x00000000UL -#define LIBERO_SETTING_IOMUX2_CR_SD 0x00000000UL -#define LIBERO_SETTING_IOMUX6_CR_SD 0x0000001DUL +#ifdef CONFIG_MPFS_EMMCSD_MUX_GPIO +#define LIBERO_SETTING_IOMUX2_CR_SD 0X00BB0000UL +#else +#define LIBERO_SETTING_IOMUX2_CR_SD 0x00000000UL +#endif +#define LIBERO_SETTING_IOMUX6_CR_SD 0X0000001DUL #define LIBERO_SETTING_MSSIO_BANK4_CFG_CR_SD 0x00080907UL #define LIBERO_SETTING_MSSIO_BANK4_IO_CFG_0_1_CR_SD 0x08290829UL #define LIBERO_SETTING_MSSIO_BANK4_IO_CFG_2_3_CR_SD 0x08290829UL @@ -1350,6 +1353,13 @@ static void mpfs_sdcard_init(struct mpfs_dev_s *priv) putreg32(LIBERO_SETTING_IOMUX2_CR_SD, MPFS_SYSREG_IOMUX2); putreg32(LIBERO_SETTING_IOMUX6_CR_SD, MPFS_SYSREG_IOMUX6); +#ifdef CONFIG_MPFS_EMMCSD_MUX_GPIO + /* Select SD-card */ + + mcinfo("Selecting SD card\n"); + mpfs_gpiowrite(MPFS_EMMCSD_GPIO, true); + +#else /* CONFIG_ARCH_BOARD_ICICLE_MPFS */ /* With 3.3v we exit from here */ if (priv->jumpers_3v3) @@ -1370,6 +1380,7 @@ static void mpfs_sdcard_init(struct mpfs_dev_s *priv) MPFS_SYSREG_4_12_13); putreg32(1, SDIO_REGISTER_ADDRESS); +#endif } /**************************************************************************** diff --git a/boards/Kconfig b/boards/Kconfig index d4499294b8..cb5fa4fd5a 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -681,6 +681,14 @@ config ARCH_BOARD_ICICLE_MPFS This is the board configuration for the port of NuttX to the MicroChip icicle-mpfs board. This board features the RISC-V MPFS. +config ARCH_BOARD_M100PFSEVP_MPFS + bool "Aries M100PFSEVP evaluation platform for MPFS" + depends on ARCH_CHIP_MPFS + select CONFIG_MPFS_EMMCSD_MUX_GPIO if !MPFS_WITH_QEMU + ---help--- + This is the board configuration for the port of NuttX to the + MicroChip m100pfsevp-mpfs board. This board features the RISC-V MPFS. + config ARCH_BOARD_MAX32660_EVSYS bool "Maxim Integrated MAX32660-EVSYS" depends on ARCH_CHIP_MAX32660 @@ -2389,6 +2397,7 @@ config ARCH_BOARD default "maix-bit" if ARCH_BOARD_MAIX_BIT default "smartl-c906" if ARCH_BOARD_SMARTL_C906 default "icicle" if ARCH_BOARD_ICICLE_MPFS + default "m100pfsevp" if ARCH_BOARD_M100PFSEVP_MPFS default "maple" if ARCH_BOARD_MAPLE default "makerlisp" if ARCH_BOARD_MAKERLISP default "max32660-evsys" if ARCH_BOARD_MAX32660_EVSYS @@ -3199,6 +3208,9 @@ endif if ARCH_BOARD_ICICLE_MPFS source "boards/risc-v/mpfs/icicle/Kconfig" endif +if ARCH_BOARD_M100PFSEVP_MPFS +source "boards/risc-v/mpfs/m100pfsevp/Kconfig" +endif if ARCH_BOARD_RV32M1_VEGA source "boards/risc-v/rv32m1/rv32m1-vega/Kconfig" endif diff --git a/boards/risc-v/mpfs/common/Makefile b/boards/risc-v/mpfs/common/Makefile new file mode 100644 index 0000000000..113f4a106b --- /dev/null +++ b/boards/risc-v/mpfs/common/Makefile @@ -0,0 +1,34 @@ +############################################################################# +# boards/risc-v/mpfs/common/Makefile +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################# + +include $(TOPDIR)/Make.defs + +include board/Make.defs +include src/Make.defs + +DEPPATH += --dep-path board +DEPPATH += --dep-path src + +include $(TOPDIR)/boards/Board.mk + +ARCHSRCDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src +BOARDDIR = $(ARCHSRCDIR)$(DELIM)board +CFLAGS += $(shell $(INCDIR) "$(CC)" $(BOARDDIR)$(DELIM)include) + diff --git a/boards/risc-v/mpfs/icicle/kernel/Makefile b/boards/risc-v/mpfs/common/kernel/Makefile similarity index 98% rename from boards/risc-v/mpfs/icicle/kernel/Makefile rename to boards/risc-v/mpfs/common/kernel/Makefile index 919e2d9965..26204b29aa 100755 --- a/boards/risc-v/mpfs/icicle/kernel/Makefile +++ b/boards/risc-v/mpfs/common/kernel/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/risc-v/mpfs/icicle//kernel/Makefile +# boards/risc-v/mpfs/common/kernel/Makefile # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with diff --git a/boards/risc-v/mpfs/icicle/kernel/mpfs_userspace.c b/boards/risc-v/mpfs/common/kernel/mpfs_userspace.c similarity index 98% rename from boards/risc-v/mpfs/icicle/kernel/mpfs_userspace.c rename to boards/risc-v/mpfs/common/kernel/mpfs_userspace.c index e90b08d815..d1c2e90d65 100755 --- a/boards/risc-v/mpfs/icicle/kernel/mpfs_userspace.c +++ b/boards/risc-v/mpfs/common/kernel/mpfs_userspace.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/mpfs/icicle/kernel/mpfs_userspace.c + * boards/risc-v/mpfs/common/kernel/mpfs_userspace.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/boards/risc-v/mpfs/icicle/src/Makefile b/boards/risc-v/mpfs/common/src/Make.defs similarity index 82% rename from boards/risc-v/mpfs/icicle/src/Makefile rename to boards/risc-v/mpfs/common/src/Make.defs index 1f49e0a2dd..9a3455b887 100755 --- a/boards/risc-v/mpfs/icicle/src/Makefile +++ b/boards/risc-v/mpfs/common/src/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/risc-v/mpfs/icicle/src/Makefile +# boards/risc-v/mpfs/common/src/Make.defs # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -18,22 +18,12 @@ # ############################################################################ -include $(TOPDIR)/Make.defs - -CSRCS = mpfs_bringup.c mpfs_boot.c - -ifeq ($(CONFIG_BOARDCTL),y) -CSRCS += mpfs_appinit.c -endif +CSRCS += mpfs_boot.c ifeq ($(CONFIG_I2C),y) CSRCS += mpfs_i2c.c endif -ifeq ($(CONFIG_ARCH_LEDS),y) -CSRCS += mpfs_autoleds.c -endif - ifeq ($(CONFIG_ARCH_FPU),y) CSRCS += mpfs_ostest.c endif @@ -50,4 +40,6 @@ ifeq ($(CONFIG_MPFS_EMMCSD),y) CSRCS += mpfs_emmcsd.c endif -include $(TOPDIR)/boards/Board.mk +DEPPATH += --dep-path src +VPATH += :src +CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src) diff --git a/boards/risc-v/mpfs/icicle/src/mpfs_board_spi.c b/boards/risc-v/mpfs/common/src/mpfs_board_spi.c similarity index 98% rename from boards/risc-v/mpfs/icicle/src/mpfs_board_spi.c rename to boards/risc-v/mpfs/common/src/mpfs_board_spi.c index 85f955214e..5f8c6252b4 100644 --- a/boards/risc-v/mpfs/icicle/src/mpfs_board_spi.c +++ b/boards/risc-v/mpfs/common/src/mpfs_board_spi.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/mpfs/icicle/src/mpfs_board_spi.c + * boards/risc-v/mpfs/common/src/mpfs_board_spi.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/boards/risc-v/mpfs/icicle/src/mpfs_boot.c b/boards/risc-v/mpfs/common/src/mpfs_boot.c similarity index 98% rename from boards/risc-v/mpfs/icicle/src/mpfs_boot.c rename to boards/risc-v/mpfs/common/src/mpfs_boot.c index 183ee9591a..19ccaa4b91 100755 --- a/boards/risc-v/mpfs/icicle/src/mpfs_boot.c +++ b/boards/risc-v/mpfs/common/src/mpfs_boot.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/mpfs/icicle/src/mpfs_boot.c + * boards/risc-v/mpfs/common/src/mpfs_boot.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/boards/risc-v/mpfs/icicle/src/mpfs_emmcsd.c b/boards/risc-v/mpfs/common/src/mpfs_emmcsd.c similarity index 82% rename from boards/risc-v/mpfs/icicle/src/mpfs_emmcsd.c rename to boards/risc-v/mpfs/common/src/mpfs_emmcsd.c index 8b9d693a7d..b6fea4e772 100644 --- a/boards/risc-v/mpfs/icicle/src/mpfs_emmcsd.c +++ b/boards/risc-v/mpfs/common/src/mpfs_emmcsd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/mpfs/icicle/src/mpfs_emmcsd.c + * boards/risc-v/mpfs/common/src/mpfs_emmcsd.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -29,7 +29,7 @@ #include #include "mpfs_emmcsd.h" -#include "mpfsicicle.h" +#include "board_config.h" /**************************************************************************** * Private Data @@ -57,25 +57,32 @@ int mpfs_board_emmcsd_init(void) { int ret; +#ifdef CONFIG_MPFS_EMMCSD_MUX_GPIO + /* Configure eMMC / SD-card signal GPIO */ + + finfo("Configuring EMMCSD MUX GPIO\n"); + mpfs_configgpio(MPFS_EMMCSD_GPIO); + mpfs_gpiowrite(MPFS_EMMCSD_GPIO, false); +#endif + /* Mount the SDIO-based MMC/SD block driver */ /* First, get an instance of the SDIO interface */ - finfo("Initializing SDIO slot %d\n", CONFIG_NSH_MMCSDSLOTNO); + finfo("Initializing SDIO slot %d\n", SDIO_SLOTNO); - g_sdio_dev = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); + g_sdio_dev = sdio_initialize(SDIO_SLOTNO); if (!g_sdio_dev) { - ferr("ERROR: Failed to initialize SDIO slot %d\n", - CONFIG_NSH_MMCSDSLOTNO); + ferr("ERROR: Failed to initialize SDIO slot %d\n", SDIO_SLOTNO); return -ENODEV; } /* Now bind the SDIO interface to the MMC/SD driver */ - finfo("Bind SDIO to the MMC/SD driver, minor=%d\n", CONFIG_NSH_MMCSDMINOR); + finfo("Bind SDIO to the MMC/SD driver, minor=%d\n", SDIO_MINOR); - ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, g_sdio_dev); + ret = mmcsd_slotinitialize(SDIO_MINOR, g_sdio_dev); if (ret != OK) { ferr("ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); diff --git a/boards/risc-v/mpfs/icicle/src/mpfs_i2c.c b/boards/risc-v/mpfs/common/src/mpfs_i2c.c similarity index 98% rename from boards/risc-v/mpfs/icicle/src/mpfs_i2c.c rename to boards/risc-v/mpfs/common/src/mpfs_i2c.c index f08b50fa42..4fa701a1a7 100644 --- a/boards/risc-v/mpfs/icicle/src/mpfs_i2c.c +++ b/boards/risc-v/mpfs/common/src/mpfs_i2c.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/mpfs/icicle/src/mpfs_i2c.c + * boards/risc-v/mpfs/common/src/mpfs_i2c.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/boards/risc-v/mpfs/icicle/src/mpfs_ostest.c b/boards/risc-v/mpfs/common/src/mpfs_ostest.c similarity index 98% rename from boards/risc-v/mpfs/icicle/src/mpfs_ostest.c rename to boards/risc-v/mpfs/common/src/mpfs_ostest.c index 715ccc6504..587b441513 100755 --- a/boards/risc-v/mpfs/icicle/src/mpfs_ostest.c +++ b/boards/risc-v/mpfs/common/src/mpfs_ostest.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/mpfs/icicle/src/mpfs_ostest.c + * boards/risc-v/mpfs/common/src/mpfs_ostest.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/boards/risc-v/mpfs/icicle/src/mpfs_pwm.c b/boards/risc-v/mpfs/common/src/mpfs_pwm.c similarity index 98% rename from boards/risc-v/mpfs/icicle/src/mpfs_pwm.c rename to boards/risc-v/mpfs/common/src/mpfs_pwm.c index 823a58a7ac..36dab10308 100644 --- a/boards/risc-v/mpfs/icicle/src/mpfs_pwm.c +++ b/boards/risc-v/mpfs/common/src/mpfs_pwm.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/mpfs/icicle/src/mpfs_pwm.c + * boards/risc-v/mpfs/common/src/mpfs_pwm.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/boards/risc-v/mpfs/icicle/src/Make.defs b/boards/risc-v/mpfs/icicle/src/Make.defs new file mode 100755 index 0000000000..276ab6d0a8 --- /dev/null +++ b/boards/risc-v/mpfs/icicle/src/Make.defs @@ -0,0 +1,33 @@ +############################################################################ +# boards/risc-v/mpfs/icicle/src/Make.defs +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +CSRCS = mpfs_bringup.c + +ifeq ($(CONFIG_BOARDCTL),y) +CSRCS += mpfs_appinit.c +endif + +ifeq ($(CONFIG_ARCH_LEDS),y) +CSRCS += mpfs_autoleds.c +endif + +DEPPATH += --dep-path board +VPATH += :board +CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board) diff --git a/boards/risc-v/mpfs/icicle/src/mpfsicicle.h b/boards/risc-v/mpfs/icicle/src/board_config.h similarity index 90% rename from boards/risc-v/mpfs/icicle/src/mpfsicicle.h rename to boards/risc-v/mpfs/icicle/src/board_config.h index d5f851f4d3..346d0f4ca5 100755 --- a/boards/risc-v/mpfs/icicle/src/mpfsicicle.h +++ b/boards/risc-v/mpfs/icicle/src/board_config.h @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/mpfs/icicle/src/mpfsicicle.h + * boards/risc-v/mpfs/icicle/src/board_config.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -18,8 +18,8 @@ * ****************************************************************************/ -#ifndef __BOARDS_RISCV_ICICLE_MPFS_SRC_MPFSICICLE_H -#define __BOARDS_RISCV_ICICLE_MPFS_SRC_MPFSICICLE_H +#ifndef __BOARDS_RISCV_ICICLE_MPFS_SRC_BOARD_CONFIG_H +#define __BOARDS_RISCV_ICICLE_MPFS_SRC_BOARD_CONFIG_H /**************************************************************************** * Included Files @@ -47,4 +47,4 @@ int mpfs_board_i2c_init(void); int mpfs_board_emmcsd_init(void); int mpfs_pwm_setup(void); -#endif /* __BOARDS_RISCV_ICICLE_MPFS_SRC_MPFSICICLE_H */ +#endif /* __BOARDS_RISCV_ICICLE_MPFS_SRC_BOARD_CONFIG_H */ diff --git a/boards/risc-v/mpfs/icicle/src/mpfs_appinit.c b/boards/risc-v/mpfs/icicle/src/mpfs_appinit.c index c4a28c00be..1fc6a1d722 100755 --- a/boards/risc-v/mpfs/icicle/src/mpfs_appinit.c +++ b/boards/risc-v/mpfs/icicle/src/mpfs_appinit.c @@ -32,7 +32,7 @@ #include #include "mpfs.h" -#include "mpfsicicle.h" +#include "board_config.h" /**************************************************************************** * Public Functions diff --git a/boards/risc-v/mpfs/icicle/src/mpfs_autoleds.c b/boards/risc-v/mpfs/icicle/src/mpfs_autoleds.c index 5bc8b3b544..1d8afb93e4 100755 --- a/boards/risc-v/mpfs/icicle/src/mpfs_autoleds.c +++ b/boards/risc-v/mpfs/icicle/src/mpfs_autoleds.c @@ -28,7 +28,7 @@ #include #include -#include "mpfsicicle.h" +#include "board_config.h" /**************************************************************************** * Public Functions diff --git a/boards/risc-v/mpfs/icicle/src/mpfs_bringup.c b/boards/risc-v/mpfs/icicle/src/mpfs_bringup.c index 9018dd2383..292e584848 100755 --- a/boards/risc-v/mpfs/icicle/src/mpfs_bringup.c +++ b/boards/risc-v/mpfs/icicle/src/mpfs_bringup.c @@ -33,7 +33,7 @@ #include #include -#include "mpfsicicle.h" +#include "board_config.h" #include "mpfs_corepwm.h" #include "mpfs.h" diff --git a/boards/risc-v/mpfs/m100pfsevp/Kconfig b/boards/risc-v/mpfs/m100pfsevp/Kconfig new file mode 100755 index 0000000000..311a590d88 --- /dev/null +++ b/boards/risc-v/mpfs/m100pfsevp/Kconfig @@ -0,0 +1,8 @@ +# +# For a description of the syntax of this configuration file, +# see misc/tools/kconfig-language.txt. +# + +if ARCH_BOARD_M100PFSEVP_MPFS + +endif diff --git a/boards/risc-v/mpfs/m100pfsevp/configs/nsh/defconfig b/boards/risc-v/mpfs/m100pfsevp/configs/nsh/defconfig new file mode 100644 index 0000000000..afab79171e --- /dev/null +++ b/boards/risc-v/mpfs/m100pfsevp/configs/nsh/defconfig @@ -0,0 +1,75 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_DISABLE_OS_API is not set +# CONFIG_NSH_DISABLE_LOSMART is not set +CONFIG_ARCH="risc-v" +CONFIG_ARCH_BOARD="m100pfsevp" +CONFIG_ARCH_BOARD_M100PFSEVP_MPFS=y +CONFIG_ARCH_CHIP="mpfs" +CONFIG_ARCH_CHIP_MPFS=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_RISCV=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_BOARD_LOOPSPERMSEC=54000 +CONFIG_BUILTIN=y +CONFIG_DEBUG_ASSERTIONS=y +CONFIG_DEBUG_ERROR=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEBUG_WARN=y +CONFIG_DEV_ZERO=y +CONFIG_EXPERIMENTAL=y +CONFIG_FS_PROCFS=y +CONFIG_FS_ROMFS=y +CONFIG_IDLETHREAD_STACKSIZE=2048 +CONFIG_INTELHEX_BINARY=y +CONFIG_LIBC_FLOATINGPOINT=y +CONFIG_LIBC_HOSTNAME="m100pfsevp" +CONFIG_LIBC_PERROR_STDOUT=y +CONFIG_LIBC_STRERROR=y +CONFIG_MEMSET_64BIT=y +CONFIG_MEMSET_OPTSPEED=y +CONFIG_MPFS_ENABLE_DPFPU=y +CONFIG_MPFS_UART1=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_DISABLE_IFUPDOWN=y +CONFIG_NSH_DISABLE_MKDIR=y +CONFIG_NSH_DISABLE_RM=y +CONFIG_NSH_DISABLE_RMDIR=y +CONFIG_NSH_DISABLE_UMOUNT=y +CONFIG_NSH_LINELEN=160 +CONFIG_NSH_STRERROR=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_RAM_SIZE=1048576 +CONFIG_RAM_START=0x80200000 +CONFIG_RAW_BINARY=y +CONFIG_READLINE_CMD_HISTORY=y +CONFIG_READLINE_TABCOMPLETION=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_LPWORK=y +CONFIG_SCHED_WAITPID=y +CONFIG_SERIAL_NPOLLWAITERS=2 +CONFIG_STACK_COLORATION=y +CONFIG_START_MONTH=4 +CONFIG_START_YEAR=2021 +CONFIG_SYSLOG_COLOR_OUTPUT=y +CONFIG_SYSTEM_CLE_CMD_HISTORY=y +CONFIG_SYSTEM_COLOR_CLE=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_TIME64=y +CONFIG_TASK_NAME_SIZE=20 +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_TESTING_OSTEST_FPUSIZE=264 +CONFIG_UART1_SERIAL_CONSOLE=y +CONFIG_USERMAIN_STACKSIZE=3072 +CONFIG_USER_ENTRYPOINT="nsh_main" diff --git a/boards/risc-v/mpfs/m100pfsevp/include/board.h b/boards/risc-v/mpfs/m100pfsevp/include/board.h new file mode 100755 index 0000000000..14447acbef --- /dev/null +++ b/boards/risc-v/mpfs/m100pfsevp/include/board.h @@ -0,0 +1,87 @@ +/**************************************************************************** + * boards/risc-v/mpfs/m100pfsevp/include/board.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __BOARDS_RISCV_M100PFSEVP_MPFS_INCLUDE_BOARD_H +#define __BOARDS_RISCV_M100PFSEVP_MPFS_INCLUDE_BOARD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#ifndef __ASSEMBLY__ +# include +#endif + +#include "mpfs_gpio.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifdef CONFIG_MPFS_EMMCSD_MUX_GPIO +/* eMMC / SD-card GPIO selection signal */ +#define MPFS_EMMCSD_GPIO (GPIO_BANK0 | GPIO_PIN12 | GPIO_OUTPUT | GPIO_BUFFER_ENABLE) +#endif + +/* TODO: check Clocking */ + +#define MPFS_MSS_EXT_SGMII_REF_CLK (125000000UL) +#define MPFS_MSS_COREPLEX_CPU_CLK (600000000UL) +#define MPFS_MSS_SYSTEM_CLK (600000000UL) +#define MPFS_MSS_RTC_TOGGLE_CLK (1000000UL) +#define MPFS_MSS_AXI_CLK (300000000UL) +#define MPFS_MSS_APB_AHB_CLK (150000000UL) +#define MPFS_FPGA_BCLK (3000000UL) + +/* LED definitions **********************************************************/ + +/* LED index values for use with board_userled() */ + +/* Button definitions *******************************************************/ + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: mpfs_boardinitialize + ****************************************************************************/ + +void mpfs_boardinitialize(void); + +#undef EXTERN +#if defined(__cplusplus) +} +#endif +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_RISCV_M100PFSEVP_MPFS_INCLUDE_BOARD_H */ diff --git a/boards/risc-v/mpfs/m100pfsevp/include/board_liberodefs.h b/boards/risc-v/mpfs/m100pfsevp/include/board_liberodefs.h new file mode 100644 index 0000000000..9759501d77 --- /dev/null +++ b/boards/risc-v/mpfs/m100pfsevp/include/board_liberodefs.h @@ -0,0 +1,613 @@ +/**************************************************************************** + * boards/risc-v/mpfs/m100pfsevp/include/board_liberodefs.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __BOARDS_RISCV_MPFS_M100PFSEVP_INCLUDE_BOARD_LIBERODEFS_H +#define __BOARDS_RISCV_MPFS_M100PFSEVP_INCLUDE_BOARD_LIBERODEFS_H + +/* These are constants provided by the vendor. Values have been synced from + * hart-software-services (HSS) with the tag: 2021.08 + */ + +#define LIBERO_SETTING_MSS_EXT_SGMII_REF_CLK 125000000 +#define LIBERO_SETTING_MSS_RTC_TOGGLE_CLK 1000000 +#define LIBERO_SETTING_MSS_ENVM_CR 0x40050006 +#define LIBERO_SETTING_MSS_CLOCK_CONFIG_CR 0x00000024 +#define LIBERO_SETTING_MSS_MSSCLKMUX 0x00000003 +#define LIBERO_SETTING_MSS_PLL_CKMUX 0x00000155 +#define LIBERO_SETTING_MSS_BCLKMUX 0x00000208 +#define LIBERO_SETTING_MSS_FMETER_ADDR 0x00000000 +#define LIBERO_SETTING_MSS_FMETER_DATAW 0x00000000 +#define LIBERO_SETTING_MSS_FMETER_DATAR 0x00000000 +#define LIBERO_SETTING_MSS_PLL_REF_FB 0x00000500 +#define LIBERO_SETTING_MSS_PLL_CTRL 0x01000037 +#define LIBERO_SETTING_MSS_PLL_DIV_0_1 0x01000200 +#define LIBERO_SETTING_MSS_PLL_DIV_2_3 0x0f000600 +#define LIBERO_SETTING_MSS_SSCG_REG_0 0x00000000 +#define LIBERO_SETTING_MSS_SSCG_REG_1 0x00000000 +#define LIBERO_SETTING_MSS_SSCG_REG_2 0x000000c0 +#define LIBERO_SETTING_MSS_SSCG_REG_3 0x00000001 +#define LIBERO_SETTING_MSS_PLL_FRACN 0x00000000 +#define LIBERO_SETTING_MSS_PLL_CTRL2 0x00001020 +#define LIBERO_SETTING_MSS_PLL_PHADJ 0x00004003 + +#define LIBERO_SETTING_CH0_CNTL 0x00fe0002 +#define LIBERO_SETTING_CH1_CNTL 0x00fe0002 +#define LIBERO_SETTING_SPARE_CNTL 0xff000000 + +#define LIBERO_SETTING_SGMII_SGMII_CLKMUX 0x00000005 +#define LIBERO_SETTING_SGMII_CLK_XCVR 0x00002c30 +#define LIBERO_SETTING_SGMII_REFCLKMUX 0x00000005 +#define LIBERO_SETTING_SGMII_PLL_CTRL 0x0100003e +#define LIBERO_SETTING_SGMII_PLL_REF_FB 0x00000100 +#define LIBERO_SETTING_SGMII_PLL_DIV_0_1 0x01000100 +#define LIBERO_SETTING_SGMII_PLL_DIV_2_3 0x01000100 +#define LIBERO_SETTING_SGMII_PLL_CTRL2 0x00001020 +#define LIBERO_SETTING_SGMII_PLL_FRACN 0x00000000 +#define LIBERO_SETTING_SGMII_SSCG_REG_0 0x00000000 +#define LIBERO_SETTING_SGMII_SSCG_REG_1 0x00000000 +#define LIBERO_SETTING_SGMII_SSCG_REG_2 0x00000019 +#define LIBERO_SETTING_SGMII_SSCG_REG_3 0x00000001 +#define LIBERO_SETTING_SGMII_PLL_PHADJ 0x00007443 +#define LIBERO_SETTING_SGMII_MODE 0x08c0e6ff +#define LIBERO_SETTING_RECAL_CNTL 0x000020c8 +#define LIBERO_SETTING_CLK_CNTL 0xf00050cc +#define LIBERO_SETTING_PLL_CNTL 0x80140101 + +#define LIBERO_SETTING_TRAINING_SKIP_SETTING 0x00000000 + +#define LIBERO_SETTING_DDRPHY_MODE_OFF 0x00000000 +#define LIBERO_SETTING_DPC_BITS_OFF_MODE 0x00000000 +#define LIBERO_SETTING_DDRPHY_MODE 0x00002122 + +#define LIBERO_SETTING_RPC_ODT_DQ 0x00000002 +#define LIBERO_SETTING_RPC_ODT_DQS 0x00000002 +#define LIBERO_SETTING_RPC_ODT_ADDCMD 0x00000002 +#define LIBERO_SETTING_RPC_ODT_CLK 0x00000002 +#define LIBERO_SETTING_RPC_EN_ADDCMD0_OVRT9 0x00000000 +#define LIBERO_SETTING_RPC_EN_ADDCMD1_OVRT10 0x00000003 +#define LIBERO_SETTING_RPC_EN_ADDCMD2_OVRT11 0x00000dc4 +#define LIBERO_SETTING_RPC_EN_DATA0_OVRT12 0x00000000 +#define LIBERO_SETTING_RPC_EN_DATA1_OVRT13 0x00000000 +#define LIBERO_SETTING_RPC_EN_DATA2_OVRT14 0x00000000 +#define LIBERO_SETTING_RPC_EN_DATA3_OVRT15 0x00000000 +#define LIBERO_SETTING_RPC_EN_ECC_OVRT16 0x0000007f +#define LIBERO_SETTING_RPC235_WPD_ADD_CMD0 0x00000000 +#define LIBERO_SETTING_RPC236_WPD_ADD_CMD1 0x00000000 +#define LIBERO_SETTING_RPC237_WPD_ADD_CMD2 0x00000000 +#define LIBERO_SETTING_RPC238_WPD_DATA0 0x00000000 +#define LIBERO_SETTING_RPC239_WPD_DATA1 0x00000000 +#define LIBERO_SETTING_RPC240_WPD_DATA2 0x00000000 +#define LIBERO_SETTING_RPC241_WPD_DATA3 0x00000000 +#define LIBERO_SETTING_RPC242_WPD_ECC 0x00000000 +#define LIBERO_SETTING_RPC243_WPU_ADD_CMD0 0x00000fff +#define LIBERO_SETTING_RPC244_WPU_ADD_CMD1 0x00000fff +#define LIBERO_SETTING_RPC245_WPU_ADD_CMD2 0x00000fff +#define LIBERO_SETTING_RPC246_WPU_DATA0 0x000007ff +#define LIBERO_SETTING_RPC247_WPU_DATA1 0x000007ff +#define LIBERO_SETTING_RPC248_WPU_DATA2 0x000007ff +#define LIBERO_SETTING_RPC249_WPU_DATA3 0x000007ff +#define LIBERO_SETTING_RPC250_WPU_ECC 0x0000007f + +#define LIBERO_SETTING_DDR_SOFT_RESET 0x00000000 +#define LIBERO_SETTING_DDR_PLL_CTRL 0x0100003f +#define LIBERO_SETTING_DDR_PLL_REF_FB 0x00000500 +#define LIBERO_SETTING_DDR_PLL_FRACN 0x00000000 +#define LIBERO_SETTING_DDR_PLL_DIV_0_1 0x02000100 +#define LIBERO_SETTING_DDR_PLL_DIV_2_3 0x01000100 +#define LIBERO_SETTING_DDR_PLL_CTRL2 0x00001020 +#define LIBERO_SETTING_DDR_PLL_CAL 0x00000d06 +#define LIBERO_SETTING_DDR_PLL_PHADJ 0x00005003 +#define LIBERO_SETTING_DDR_SSCG_REG_0 0x00000000 +#define LIBERO_SETTING_DDR_SSCG_REG_1 0x00000000 +#define LIBERO_SETTING_DDR_SSCG_REG_2 0x00000080 +#define LIBERO_SETTING_DDR_SSCG_REG_3 0x00000001 + +#define LIBERO_SETTING_CFG_MANUAL_ADDRESS_MAP 0x00000000 +#define LIBERO_SETTING_CFG_CHIPADDR_MAP 0x00000000 +#define LIBERO_SETTING_CFG_CIDADDR_MAP 0x00000000 +#define LIBERO_SETTING_CFG_BANKADDR_MAP_0 0x00000000 +#define LIBERO_SETTING_CFG_BANKADDR_MAP_1 0x00000000 +#define LIBERO_SETTING_CFG_ROWADDR_MAP_0 0x00000000 +#define LIBERO_SETTING_CFG_ROWADDR_MAP_1 0x00000000 +#define LIBERO_SETTING_CFG_ROWADDR_MAP_2 0x00000000 +#define LIBERO_SETTING_CFG_ROWADDR_MAP_3 0x00000000 +#define LIBERO_SETTING_CFG_COLADDR_MAP_0 0x00000000 +#define LIBERO_SETTING_CFG_COLADDR_MAP_1 0x00000000 +#define LIBERO_SETTING_CFG_COLADDR_MAP_2 0x00000000 +#define LIBERO_SETTING_CFG_VRCG_ENABLE 0x00000140 +#define LIBERO_SETTING_CFG_VRCG_DISABLE 0x000000a0 +#define LIBERO_SETTING_CFG_WRITE_LATENCY_SET 0x00000000 + +#define LIBERO_SETTING_CFG_THERMAL_OFFSET 0x00000000 +#define LIBERO_SETTING_CFG_SOC_ODT 0x00000000 +#define LIBERO_SETTING_CFG_ODTE_CK 0x00000000 +#define LIBERO_SETTING_CFG_ODTE_CS 0x00000000 +#define LIBERO_SETTING_CFG_ODTD_CA 0x00000000 +#define LIBERO_SETTING_CFG_LPDDR4_FSP_OP 0x00000000 +#define LIBERO_SETTING_CFG_DBI_CL 0x0000000b +#define LIBERO_SETTING_CFG_NON_DBI_CL 0x0000000b +#define LIBERO_SETTING_CFG_WRITE_CRC 0x00000000 +#define LIBERO_SETTING_CFG_MPR_READ_FORMAT 0x00000000 +#define LIBERO_SETTING_CFG_WR_CMD_LAT_CRC_DM 0x00000000 +#define LIBERO_SETTING_CFG_FINE_GRAN_REF_MODE 0x00000000 +#define LIBERO_SETTING_CFG_TEMP_SENSOR_READOUT 0x00000000 +#define LIBERO_SETTING_CFG_PER_DRAM_ADDR_EN 0x00000000 +#define LIBERO_SETTING_CFG_GEARDOWN_MODE 0x00000000 +#define LIBERO_SETTING_CFG_WR_PREAMBLE 0x00000000 +#define LIBERO_SETTING_CFG_RD_PREAMBLE 0x00000000 +#define LIBERO_SETTING_CFG_RD_PREAMB_TRN_MODE 0x00000000 +#define LIBERO_SETTING_CFG_SR_ABORT 0x00000000 + +#define LIBERO_SETTING_CFG_INT_VREF_MON 0x00000000 +#define LIBERO_SETTING_CFG_MAX_PWR_DOWN_MODE 0x00000000 +#define LIBERO_SETTING_CFG_READ_DBI 0x00000000 +#define LIBERO_SETTING_CFG_WRITE_DBI 0x00000000 +#define LIBERO_SETTING_CFG_DATA_MASK 0x00000001 +#define LIBERO_SETTING_CFG_RTT_PARK 0x00000000 +#define LIBERO_SETTING_CFG_ODT_INBUF_4_PD 0x00000001 +#define LIBERO_SETTING_CFG_CCD_S 0x00000004 +#define LIBERO_SETTING_CFG_CCD_L 0x00000005 +#define LIBERO_SETTING_CFG_VREFDQ_TRN_ENABLE 0x00000001 +#define LIBERO_SETTING_CFG_VREFDQ_TRN_RANGE 0x00000001 +#define LIBERO_SETTING_CFG_VREFDQ_TRN_VALUE 0x0000001e +#define LIBERO_SETTING_CFG_RRD_S 0x00000005 +#define LIBERO_SETTING_CFG_RRD_L 0x00000006 +#define LIBERO_SETTING_CFG_WTR_S 0x00000002 +#define LIBERO_SETTING_CFG_WTR_L 0x00000006 +#define LIBERO_SETTING_CFG_WTR_S_CRC_DM 0x00000007 +#define LIBERO_SETTING_CFG_WTR_L_CRC_DM 0x0000000b +#define LIBERO_SETTING_CFG_WR_CRC_DM 0x00000011 +#define LIBERO_SETTING_CFG_RFC1 0x00000118 +#define LIBERO_SETTING_CFG_RFC2 0x00000000 +#define LIBERO_SETTING_CFG_RFC4 0x00000000 +#define LIBERO_SETTING_CFG_NIBBLE_DEVICES 0x00000000 + +#define LIBERO_SETTING_CFG_MB_AUTOPCH_COL_BIT_POS_LOW 0x00000004 +#define LIBERO_SETTING_CFG_MB_AUTOPCH_COL_BIT_POS_HIGH 0x0000000a +#define LIBERO_SETTING_CFG_CA_PARITY_ERR_STATUS 0x00000000 +#define LIBERO_SETTING_CFG_CRC_ERROR_CLEAR 0x00000000 +#define LIBERO_SETTING_CFG_CA_PARITY_LATENCY 0x00000000 +#define LIBERO_SETTING_CFG_CA_PARITY_PERSIST_ERR 0x00000000 +#define LIBERO_SETTING_CFG_GENERATE_REFRESH_ON_SRX 0x00000001 +#define LIBERO_SETTING_CFG_CS_TO_CMDADDR_LATENCY 0x00000000 + +#define LIBERO_SETTING_CFG_TEMP_CTRL_REF_MODE 0x00000000 +#define LIBERO_SETTING_CFG_TEMP_CTRL_REF_RANGE 0x00000000 + +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS0_0 0x81881881 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS0_1 0x00008818 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS1_0 0xa92a92a9 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS1_1 0x00002a92 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS2_0 0xc28c28c2 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS2_1 0x00008c28 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS3_0 0xea2ea2ea +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS3_1 0x00002ea2 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS4_0 0x03903903 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS4_1 0x00009039 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS5_0 0x2b32b32b +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS5_1 0x000032b3 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS6_0 0x44944944 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS6_1 0x00009449 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS7_0 0x6c36c36c +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS7_1 0x000036c3 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS8_0 0x85985985 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS8_1 0x00009859 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS9_0 0xad3ad3ad +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS9_1 0x00003ad3 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS10_0 0xc69c69c6 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS10_1 0x00009c69 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS11_0 0xee3ee3ee +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS11_1 0x00003ee3 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS12_0 0x07a07a07 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS12_1 0x0000a07a +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS13_0 0x2f42f42f +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS13_1 0x000042f4 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS14_0 0x48a48a48 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS14_1 0x0000a48a +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS15_0 0x70470470 +#define LIBERO_SETTING_CFG_BIT_MAP_INDEX_CS15_1 0x00004704 + +#define LIBERO_SETTING_CFG_NUM_LOGICAL_RANKS_PER_3DS 0x00000000 +#define LIBERO_SETTING_CFG_ADVANCE_ACTIVATE_READY 0x00000000 + +#define LIBERO_SETTING_CFG_RFC_DLR1 0x00000000 +#define LIBERO_SETTING_CFG_RFC_DLR2 0x00000000 +#define LIBERO_SETTING_CFG_RFC_DLR4 0x00000000 +#define LIBERO_SETTING_CFG_RRD_DLR 0x00000000 +#define LIBERO_SETTING_CFG_FAW_DLR 0x00000000 +#define LIBERO_SETTING_CTRLR_SOFT_RESET_N 0x00000001 +#define LIBERO_SETTING_CFG_LOOKAHEAD_PCH 0x00000000 +#define LIBERO_SETTING_CFG_LOOKAHEAD_ACT 0x00000000 +#define LIBERO_SETTING_CFG_BL 0x00000000 +#define LIBERO_SETTING_CTRLR_INIT 0x00000000 +#define LIBERO_SETTING_CFG_AUTO_REF_EN 0x00000001 +#define LIBERO_SETTING_CFG_RAS 0x0000001c +#define LIBERO_SETTING_CFG_RCD 0x0000000b +#define LIBERO_SETTING_CFG_RRD 0x00000007 +#define LIBERO_SETTING_CFG_RP 0x0000000b +#define LIBERO_SETTING_CFG_RC 0x00000027 +#define LIBERO_SETTING_CFG_FAW 0x0000001c +#define LIBERO_SETTING_CFG_RFC 0x00000076 +#define LIBERO_SETTING_CFG_RTP 0x00000006 +#define LIBERO_SETTING_CFG_WR 0x0000000c +#define LIBERO_SETTING_CFG_WTR 0x00000008 +#define LIBERO_SETTING_CFG_PASR 0x00000000 +#define LIBERO_SETTING_CFG_XP 0x00000003 +#define LIBERO_SETTING_CFG_XSR 0x00000024 +#define LIBERO_SETTING_CFG_CL 0x0000000b +#define LIBERO_SETTING_CFG_READ_TO_WRITE 0x00000002 +#define LIBERO_SETTING_CFG_WRITE_TO_WRITE 0x00000002 +#define LIBERO_SETTING_CFG_READ_TO_READ 0x00000002 +#define LIBERO_SETTING_CFG_WRITE_TO_READ 0x00000001 +#define LIBERO_SETTING_CFG_READ_TO_WRITE_ODT 0x00000004 +#define LIBERO_SETTING_CFG_WRITE_TO_WRITE_ODT 0x00000002 +#define LIBERO_SETTING_CFG_READ_TO_READ_ODT 0x00000002 +#define LIBERO_SETTING_CFG_WRITE_TO_READ_ODT 0x00000001 +#define LIBERO_SETTING_CFG_MIN_READ_IDLE 0x00000007 +#define LIBERO_SETTING_CFG_MRD 0x00000010 +#define LIBERO_SETTING_CFG_BT 0x00000000 +#define LIBERO_SETTING_CFG_DS 0x00000000 +#define LIBERO_SETTING_CFG_QOFF 0x00000000 +#define LIBERO_SETTING_CFG_RTT 0x00000001 +#define LIBERO_SETTING_CFG_DLL_DISABLE 0x00000000 +#define LIBERO_SETTING_CFG_REF_PER 0x00001860 +#define LIBERO_SETTING_CFG_STARTUP_DELAY 0x00027100 +#define LIBERO_SETTING_CFG_MEM_COLBITS 0x0000000a +#define LIBERO_SETTING_CFG_MEM_ROWBITS 0x00000010 +#define LIBERO_SETTING_CFG_MEM_BANKBITS 0x00000003 + +#define LIBERO_SETTING_CFG_ODT_RD_MAP_CS0 0x00000000 +#define LIBERO_SETTING_CFG_ODT_RD_MAP_CS1 0x00000000 +#define LIBERO_SETTING_CFG_ODT_RD_MAP_CS2 0x00000000 +#define LIBERO_SETTING_CFG_ODT_RD_MAP_CS3 0x00000000 +#define LIBERO_SETTING_CFG_ODT_RD_MAP_CS4 0x00000000 +#define LIBERO_SETTING_CFG_ODT_RD_MAP_CS5 0x00000000 +#define LIBERO_SETTING_CFG_ODT_RD_MAP_CS6 0x00000000 +#define LIBERO_SETTING_CFG_ODT_RD_MAP_CS7 0x00000000 +#define LIBERO_SETTING_CFG_ODT_WR_MAP_CS0 0x00000000 +#define LIBERO_SETTING_CFG_ODT_WR_MAP_CS1 0x00000000 +#define LIBERO_SETTING_CFG_ODT_WR_MAP_CS2 0x00000000 +#define LIBERO_SETTING_CFG_ODT_WR_MAP_CS3 0x00000000 +#define LIBERO_SETTING_CFG_ODT_WR_MAP_CS4 0x00000000 +#define LIBERO_SETTING_CFG_ODT_WR_MAP_CS5 0x00000000 +#define LIBERO_SETTING_CFG_ODT_WR_MAP_CS6 0x00000000 +#define LIBERO_SETTING_CFG_ODT_WR_MAP_CS7 0x00000000 +#define LIBERO_SETTING_CFG_ODT_RD_TURN_ON 0x00000000 +#define LIBERO_SETTING_CFG_ODT_WR_TURN_ON 0x00000000 +#define LIBERO_SETTING_CFG_ODT_RD_TURN_OFF 0x00000000 +#define LIBERO_SETTING_CFG_ODT_WR_TURN_OFF 0x00000000 + +#define LIBERO_SETTING_CFG_EMR3 0x00000000 +#define LIBERO_SETTING_CFG_TWO_T 0x00000000 +#define LIBERO_SETTING_CFG_TWO_T_SEL_CYCLE 0x00000001 +#define LIBERO_SETTING_CFG_REGDIMM 0x00000000 +#define LIBERO_SETTING_CFG_MOD 0x00000018 +#define LIBERO_SETTING_CFG_XS 0x00000120 +#define LIBERO_SETTING_CFG_XSDLL 0x00000200 +#define LIBERO_SETTING_CFG_XPR 0x00000120 +#define LIBERO_SETTING_CFG_AL_MODE 0x00000000 +#define LIBERO_SETTING_CFG_CWL 0x0000000b +#define LIBERO_SETTING_CFG_BL_MODE 0x00000000 +#define LIBERO_SETTING_CFG_TDQS 0x00000000 +#define LIBERO_SETTING_CFG_RTT_WR 0x00000000 +#define LIBERO_SETTING_CFG_LP_ASR 0x00000003 +#define LIBERO_SETTING_CFG_AUTO_SR 0x00000000 +#define LIBERO_SETTING_CFG_SRT 0x00000000 +#define LIBERO_SETTING_CFG_ADDR_MIRROR 0x00000000 +#define LIBERO_SETTING_CFG_ZQ_CAL_TYPE 0x00000000 +#define LIBERO_SETTING_CFG_ZQ_CAL_PER 0x00027100 +#define LIBERO_SETTING_CFG_AUTO_ZQ_CAL_EN 0x00000000 +#define LIBERO_SETTING_CFG_MEMORY_TYPE 0x00000080 +#define LIBERO_SETTING_CFG_ONLY_SRANK_CMDS 0x00000000 +#define LIBERO_SETTING_CFG_NUM_RANKS 0x00000001 +#define LIBERO_SETTING_CFG_QUAD_RANK 0x00000000 +#define LIBERO_SETTING_CFG_EARLY_RANK_TO_WR_START 0x00000000 +#define LIBERO_SETTING_CFG_EARLY_RANK_TO_RD_START 0x00000000 +#define LIBERO_SETTING_CFG_PASR_BANK 0x00000000 +#define LIBERO_SETTING_CFG_PASR_SEG 0x00000000 +#define LIBERO_SETTING_CFG_INIT_DURATION 0x000029b0 +#define LIBERO_SETTING_CFG_ZQINIT_CAL_DURATION 0x00000400 +#define LIBERO_SETTING_CFG_ZQ_CAL_L_DURATION 0x00000200 +#define LIBERO_SETTING_CFG_ZQ_CAL_S_DURATION 0x00000080 +#define LIBERO_SETTING_CFG_ZQ_CAL_R_DURATION 0x0000000b +#define LIBERO_SETTING_CFG_MRR 0x00000002 +#define LIBERO_SETTING_CFG_MRW 0x00000010 +#define LIBERO_SETTING_CFG_ODT_POWERDOWN 0x00000000 +#define LIBERO_SETTING_CFG_WL 0x00000009 +#define LIBERO_SETTING_CFG_RL 0x0000000e +#define LIBERO_SETTING_CFG_CAL_READ_PERIOD 0x00000000 +#define LIBERO_SETTING_CFG_NUM_CAL_READS 0x00000001 + +#define LIBERO_SETTING_INIT_FORCE_WRITE_DATA_0 0x00000000 +#define LIBERO_SETTING_INIT_AUTOINIT_DISABLE 0x00000000 +#define LIBERO_SETTING_INIT_FORCE_RESET 0x00000000 +#define LIBERO_SETTING_INIT_GEARDOWN_EN 0x00000000 +#define LIBERO_SETTING_INIT_DISABLE_CKE 0x00000000 +#define LIBERO_SETTING_INIT_CS 0x00000000 +#define LIBERO_SETTING_INIT_PRECHARGE_ALL 0x00000000 +#define LIBERO_SETTING_INIT_REFRESH 0x00000000 +#define LIBERO_SETTING_INIT_ZQ_CAL_REQ 0x00000000 +#define LIBERO_SETTING_INIT_MRR_MODE 0x00000000 +#define LIBERO_SETTING_INIT_MR_W_REQ 0x00000000 +#define LIBERO_SETTING_INIT_MR_ADDR 0x00000000 +#define LIBERO_SETTING_INIT_MR_WR_DATA 0x00000000 +#define LIBERO_SETTING_INIT_MR_WR_MASK 0x00000000 +#define LIBERO_SETTING_INIT_NOP 0x00000000 +#define LIBERO_SETTING_INIT_SELF_REFRESH 0x00000000 +#define LIBERO_SETTING_INIT_POWER_DOWN 0x00000000 +#define LIBERO_SETTING_INIT_FORCE_WRITE 0x00000000 +#define LIBERO_SETTING_INIT_FORCE_WRITE_CS 0x00000000 +#define LIBERO_SETTING_INIT_RDIMM_COMPLETE 0x00000000 +#define LIBERO_SETTING_INIT_MEMORY_RESET_MASK 0x00000000 +#define LIBERO_SETTING_INIT_CAL_SELECT 0x00000000 +#define LIBERO_SETTING_INIT_CAL_L_R_REQ 0x00000000 +#define LIBERO_SETTING_INIT_CAL_L_B_SIZE 0x00000000 +#define LIBERO_SETTING_INIT_RWFIFO 0x00000000 +#define LIBERO_SETTING_INIT_RD_DQCAL 0x00000000 +#define LIBERO_SETTING_INIT_START_DQSOSC 0x00000000 +#define LIBERO_SETTING_INIT_STOP_DQSOSC 0x00000000 +#define LIBERO_SETTING_INIT_ZQ_CAL_START 0x00000000 +#define LIBERO_SETTING_INIT_CAL_L_ADDR_0 0x00000000 +#define LIBERO_SETTING_INIT_CAL_L_ADDR_1 0x00000000 +#define LIBERO_SETTING_INIT_ODT_FORCE_EN 0x00000000 +#define LIBERO_SETTING_INIT_ODT_FORCE_RANK 0x00000000 +#define LIBERO_SETTING_INIT_PDA_MR_W_REQ 0x00000000 +#define LIBERO_SETTING_INIT_PDA_NIBBLE_SELECT 0x00000000 +#define LIBERO_SETTING_INIT_WRITE_DATA_1B_ECC_ERROR_GEN 0x00000000 +#define LIBERO_SETTING_INIT_WRITE_DATA_2B_ECC_ERROR_GEN 0x00000000 +#define LIBERO_SETTING_INIT_READ_CAPTURE_ADDR 0x00000000 +#define LIBERO_SETTING_INIT_CA_PARITY_ERROR_GEN_REQ 0x00000000 +#define LIBERO_SETTING_INIT_CA_PARITY_ERROR_GEN_CMD 0x00000000 +#define LIBERO_SETTING_INIT_DFI_LP_DATA_REQ 0x00000000 +#define LIBERO_SETTING_INIT_DFI_LP_CTRL_REQ 0x00000000 +#define LIBERO_SETTING_INIT_DFI_LP_WAKEUP 0x00000000 +#define LIBERO_SETTING_INIT_DFI_DRAM_CLK_DISABLE 0x00000000 + +#define LIBERO_SETTING_CFG_CTRLR_INIT_DISABLE 0x00000000 +#define LIBERO_SETTING_CFG_RDIMM_LAT 0x00000000 +#define LIBERO_SETTING_CFG_RDIMM_BSIDE_INVERT 0x00000001 +#define LIBERO_SETTING_CFG_LRDIMM 0x00000000 +#define LIBERO_SETTING_CFG_RD_PREAMB_TOGGLE 0x00000000 +#define LIBERO_SETTING_CFG_RD_POSTAMBLE 0x00000000 +#define LIBERO_SETTING_CFG_PU_CAL 0x00000000 +#define LIBERO_SETTING_CFG_DQ_ODT 0x00000000 +#define LIBERO_SETTING_CFG_CA_ODT 0x00000000 +#define LIBERO_SETTING_CFG_ZQLATCH_DURATION 0x00000030 + +#define LIBERO_SETTING_CFG_WR_POSTAMBLE 0x00000000 +#define LIBERO_SETTING_CFG_CTRLUPD_TRIG 0x00000000 +#define LIBERO_SETTING_CFG_CTRLUPD_START_DELAY 0x00000000 +#define LIBERO_SETTING_CFG_DFI_T_CTRLUPD_MAX 0x00000000 +#define LIBERO_SETTING_CFG_CTRLR_BUSY_SEL 0x00000000 +#define LIBERO_SETTING_CFG_CTRLR_BUSY_VALUE 0x00000000 +#define LIBERO_SETTING_CFG_CTRLR_BUSY_TURN_OFF_DELAY 0x00000000 +#define LIBERO_SETTING_CFG_CTRLR_BUSY_SLOW_RESTART_WIN 0x00000000 +#define LIBERO_SETTING_CFG_CTRLR_BUSY_RESTART_HOLDOFF 0x00000000 +#define LIBERO_SETTING_CFG_PARITY_RDIMM_DELAY 0x00000000 +#define LIBERO_SETTING_CFG_CTRLR_BUSY_ENABLE 0x00000000 +#define LIBERO_SETTING_CFG_ASYNC_ODT 0x00000000 +#define LIBERO_SETTING_CFG_ZQ_CAL_DURATION 0x00000640 +#define LIBERO_SETTING_CFG_MRRI 0x00000000 +#define LIBERO_SETTING_CFG_PHYUPD_ACK_DELAY 0x00000000 +#define LIBERO_SETTING_CFG_MIRROR_X16_BG0_BG1 0x00000000 +#define LIBERO_SETTING_CFG_DRAM_CLK_DISABLE_IN_SELF_RFH 0x00000000 +#define LIBERO_SETTING_CFG_CKSRE 0x00000008 +#define LIBERO_SETTING_CFG_CKSRX 0x0000000b +#define LIBERO_SETTING_CFG_RCD_STAB 0x00000000 +#define LIBERO_SETTING_CFG_DFI_T_CTRL_DELAY 0x00000000 +#define LIBERO_SETTING_CFG_DFI_T_DRAM_CLK_ENABLE 0x00000000 +#define LIBERO_SETTING_CFG_IDLE_TIME_TO_SELF_REFRESH 0x00000000 +#define LIBERO_SETTING_CFG_IDLE_TIME_TO_POWER_DOWN 0x00000000 +#define LIBERO_SETTING_CFG_BURST_RW_REFRESH_HOLDOFF 0x00000000 +#define LIBERO_SETTING_CFG_BG_INTERLEAVE 0x00000001 +#define LIBERO_SETTING_CFG_REFRESH_DURING_PHY_TRAINING 0x00000000 +#define LIBERO_SETTING_CFG_STARVE_TIMEOUT_P0 0x00000000 +#define LIBERO_SETTING_CFG_STARVE_TIMEOUT_P1 0x00000000 +#define LIBERO_SETTING_CFG_STARVE_TIMEOUT_P2 0x00000000 +#define LIBERO_SETTING_CFG_STARVE_TIMEOUT_P3 0x00000000 +#define LIBERO_SETTING_CFG_STARVE_TIMEOUT_P4 0x00000000 +#define LIBERO_SETTING_CFG_STARVE_TIMEOUT_P5 0x00000000 +#define LIBERO_SETTING_CFG_STARVE_TIMEOUT_P6 0x00000000 +#define LIBERO_SETTING_CFG_STARVE_TIMEOUT_P7 0x00000000 +#define LIBERO_SETTING_CFG_REORDER_EN 0x00000001 +#define LIBERO_SETTING_CFG_REORDER_QUEUE_EN 0x00000001 +#define LIBERO_SETTING_CFG_INTRAPORT_REORDER_EN 0x00000000 +#define LIBERO_SETTING_CFG_MAINTAIN_COHERENCY 0x00000001 +#define LIBERO_SETTING_CFG_Q_AGE_LIMIT 0x000000ff +#define LIBERO_SETTING_CFG_RO_CLOSED_PAGE_POLICY 0x00000000 +#define LIBERO_SETTING_CFG_REORDER_RW_ONLY 0x00000000 +#define LIBERO_SETTING_CFG_RO_PRIORITY_EN 0x00000000 +#define LIBERO_SETTING_CFG_DM_EN 0x00000001 +#define LIBERO_SETTING_CFG_RMW_EN 0x00000000 +#define LIBERO_SETTING_CFG_ECC_CORRECTION_EN 0x00000000 +#define LIBERO_SETTING_CFG_ECC_BYPASS 0x00000000 +#define LIBERO_SETTING_CFG_ECC_1BIT_INT_THRESH 0x00000000 +#define LIBERO_SETTING_CFG_ERROR_GROUP_SEL 0x00000000 +#define LIBERO_SETTING_CFG_DATA_SEL 0x00000000 +#define LIBERO_SETTING_CFG_TRIG_MODE 0x00000000 +#define LIBERO_SETTING_CFG_POST_TRIG_CYCS 0x00000000 +#define LIBERO_SETTING_CFG_TRIG_MASK 0x00000000 +#define LIBERO_SETTING_CFG_EN_MASK 0x00000000 +#define LIBERO_SETTING_CFG_TRIG_MT_ADDR_0 0x00000000 +#define LIBERO_SETTING_CFG_TRIG_MT_ADDR_1 0x00000000 +#define LIBERO_SETTING_CFG_TRIG_ERR_MASK_0 0x00000000 +#define LIBERO_SETTING_CFG_TRIG_ERR_MASK_1 0x00000000 +#define LIBERO_SETTING_CFG_TRIG_ERR_MASK_2 0x00000000 +#define LIBERO_SETTING_CFG_TRIG_ERR_MASK_3 0x00000000 +#define LIBERO_SETTING_CFG_TRIG_ERR_MASK_4 0x00000000 + +#define LIBERO_SETTING_MTC_ACQ_ADDR 0x00000000 +#define LIBERO_SETTING_MTC_ACQ_WR_DATA_0 0x00000000 +#define LIBERO_SETTING_MTC_ACQ_WR_DATA_1 0x00000000 +#define LIBERO_SETTING_MTC_ACQ_WR_DATA_2 0x00000000 + +#define LIBERO_SETTING_CFG_PRE_TRIG_CYCS 0x00000000 +#define LIBERO_SETTING_CFG_DATA_SEL_FIRST_ERROR 0x00000000 +#define LIBERO_SETTING_CFG_DQ_WIDTH 0x00000000 +#define LIBERO_SETTING_CFG_ACTIVE_DQ_SEL 0x00000000 +#define LIBERO_SETTING_CFG_DFI_T_RDDATA_EN 0x00000014 +#define LIBERO_SETTING_CFG_DFI_T_PHY_RDLAT 0x00000006 +#define LIBERO_SETTING_CFG_DFI_T_PHY_WRLAT 0x00000001 +#define LIBERO_SETTING_CFG_DFI_PHYUPD_EN 0x00000001 +#define LIBERO_SETTING_CFG_DFI_DATA_BYTE_DISABLE 0x00000000 +#define LIBERO_SETTING_CFG_DFI_LVL_SEL 0x00000000 +#define LIBERO_SETTING_CFG_DFI_LVL_PERIODIC 0x00000000 +#define LIBERO_SETTING_CFG_DFI_LVL_PATTERN 0x00000000 +#define LIBERO_SETTING_CFG_AXI_START_ADDRESS_AXI1_0 0x00000000 +#define LIBERO_SETTING_CFG_AXI_START_ADDRESS_AXI1_1 0x00000000 +#define LIBERO_SETTING_CFG_AXI_START_ADDRESS_AXI2_0 0x00000000 +#define LIBERO_SETTING_CFG_AXI_START_ADDRESS_AXI2_1 0x00000000 +#define LIBERO_SETTING_CFG_AXI_END_ADDRESS_AXI1_0 0xffffffff +#define LIBERO_SETTING_CFG_AXI_END_ADDRESS_AXI1_1 0x00000003 +#define LIBERO_SETTING_CFG_AXI_END_ADDRESS_AXI2_0 0xffffffff +#define LIBERO_SETTING_CFG_AXI_END_ADDRESS_AXI2_1 0x00000003 +#define LIBERO_SETTING_CFG_MEM_START_ADDRESS_AXI1_0 0x00000000 +#define LIBERO_SETTING_CFG_MEM_START_ADDRESS_AXI1_1 0x00000000 +#define LIBERO_SETTING_CFG_MEM_START_ADDRESS_AXI2_0 0x00000000 +#define LIBERO_SETTING_CFG_MEM_START_ADDRESS_AXI2_1 0x00000000 +#define LIBERO_SETTING_CFG_ENABLE_BUS_HOLD_AXI1 0x00000000 +#define LIBERO_SETTING_CFG_ENABLE_BUS_HOLD_AXI2 0x00000000 +#define LIBERO_SETTING_CFG_AXI_AUTO_PCH 0x00000000 + +#define LIBERO_SETTING_PHY_DFI_INIT_START 0x00000000 +#define LIBERO_SETTING_PHY_RESET_CONTROL 0x00008001 +#define LIBERO_SETTING_PHY_PC_RANK 0x00000001 +#define LIBERO_SETTING_PHY_RANKS_TO_TRAIN 0x00000001 +#define LIBERO_SETTING_PHY_WRITE_REQUEST 0x00000000 +#define LIBERO_SETTING_PHY_READ_REQUEST 0x00000000 +#define LIBERO_SETTING_PHY_WRITE_LEVEL_DELAY 0x00000000 +#define LIBERO_SETTING_PHY_GATE_TRAIN_DELAY 0x0000002f +#define LIBERO_SETTING_PHY_EYE_TRAIN_DELAY 0x0000003f +#define LIBERO_SETTING_PHY_EYE_PAT 0x00000000 +#define LIBERO_SETTING_PHY_START_RECAL 0x00000000 +#define LIBERO_SETTING_PHY_CLR_DFI_LVL_PERIODIC 0x00000000 +#define LIBERO_SETTING_PHY_TRAIN_STEP_ENABLE 0x00000018 +#define LIBERO_SETTING_PHY_LPDDR_DQ_CAL_PAT 0x00000000 +#define LIBERO_SETTING_PHY_INDPNDT_TRAINING 0x00000001 +#define LIBERO_SETTING_PHY_ENCODED_QUAD_CS 0x00000000 +#define LIBERO_SETTING_PHY_HALF_CLK_DLY_ENABLE 0x00000000 + +#define LIBERO_SETTING_SEG0_0 0x00007f80 +#define LIBERO_SETTING_SEG0_1 0x00007000 +#define LIBERO_SETTING_SEG0_2 0x00000000 +#define LIBERO_SETTING_SEG0_3 0x00000000 +#define LIBERO_SETTING_SEG0_4 0x00000000 +#define LIBERO_SETTING_SEG0_5 0x00000000 +#define LIBERO_SETTING_SEG0_6 0x00000000 +#define LIBERO_SETTING_SEG0_7 0x00000000 +#define LIBERO_SETTING_SEG1_0 0x00000000 +#define LIBERO_SETTING_SEG1_1 0x00000000 +#define LIBERO_SETTING_SEG1_2 0x00007f40 +#define LIBERO_SETTING_SEG1_3 0x00006c00 +#define LIBERO_SETTING_SEG1_4 0x00007f30 +#define LIBERO_SETTING_SEG1_5 0x00006800 +#define LIBERO_SETTING_SEG1_6 0x00000000 +#define LIBERO_SETTING_SEG1_7 0x00000000 + +#define LIBERO_SETTING_TIP_CONFIG_PARAMS_BCLK_VCOPHS_OFFSET 0x00000002 +#define LIBERO_SETTING_DDR_CLK 1600000000 + +#define LIBERO_SETTING_REFCLK_DDR3_1333_NUM_OFFSETS 3 +#define LIBERO_SETTING_REFCLK_DDR3L_1333_NUM_OFFSETS 3 +#define LIBERO_SETTING_REFCLK_DDR4_1600_NUM_OFFSETS 2 +#define LIBERO_SETTING_REFCLK_LPDDR3_1600_NUM_OFFSETS 3 +#define LIBERO_SETTING_REFCLK_LPDDR4_1600_NUM_OFFSETS 4 +#define LIBERO_SETTING_REFCLK_DDR3_1067_NUM_OFFSETS 2 +#define LIBERO_SETTING_REFCLK_DDR3L_1067_NUM_OFFSETS 2 +#define LIBERO_SETTING_REFCLK_DDR4_1333_NUM_OFFSETS 3 +#define LIBERO_SETTING_REFCLK_LPDDR3_1333_NUM_OFFSETS 2 +#define LIBERO_SETTING_REFCLK_LPDDR4_1333_NUM_OFFSETS 3 +#define LIBERO_SETTING_REFCLK_DDR3_1333_OFFSET_0 0 +#define LIBERO_SETTING_REFCLK_DDR3_1333_OFFSET_1 1 +#define LIBERO_SETTING_REFCLK_DDR3_1333_OFFSET_2 0 +#define LIBERO_SETTING_REFCLK_DDR3_1333_OFFSET_3 1 +#define LIBERO_SETTING_REFCLK_DDR3L_1333_OFFSET_0 0 +#define LIBERO_SETTING_REFCLK_DDR3L_1333_OFFSET_1 1 +#define LIBERO_SETTING_REFCLK_DDR3L_1333_OFFSET_2 0 +#define LIBERO_SETTING_REFCLK_DDR3L_1333_OFFSET_3 0 +#define LIBERO_SETTING_REFCLK_DDR4_1600_OFFSET_0 7 +#define LIBERO_SETTING_REFCLK_DDR4_1600_OFFSET_1 0 +#define LIBERO_SETTING_REFCLK_DDR4_1600_OFFSET_2 7 +#define LIBERO_SETTING_REFCLK_DDR4_1600_OFFSET_3 0 +#define LIBERO_SETTING_REFCLK_LPDDR3_1600_OFFSET_0 7 +#define LIBERO_SETTING_REFCLK_LPDDR3_1600_OFFSET_1 0 +#define LIBERO_SETTING_REFCLK_LPDDR3_1600_OFFSET_2 1 +#define LIBERO_SETTING_REFCLK_LPDDR3_1600_OFFSET_3 0 +#define LIBERO_SETTING_REFCLK_LPDDR4_1600_OFFSET_0 1 +#define LIBERO_SETTING_REFCLK_LPDDR4_1600_OFFSET_1 5 +#define LIBERO_SETTING_REFCLK_LPDDR4_1600_OFFSET_2 1 +#define LIBERO_SETTING_REFCLK_LPDDR4_1600_OFFSET_3 5 +#define LIBERO_SETTING_REFCLK_DDR3_1067_OFFSET_0 1 +#define LIBERO_SETTING_REFCLK_DDR3_1067_OFFSET_1 2 +#define LIBERO_SETTING_REFCLK_DDR3_1067_OFFSET_2 0 +#define LIBERO_SETTING_REFCLK_DDR3_1067_OFFSET_3 2 +#define LIBERO_SETTING_REFCLK_DDR3L_1067_OFFSET_0 1 +#define LIBERO_SETTING_REFCLK_DDR3L_1067_OFFSET_1 2 +#define LIBERO_SETTING_REFCLK_DDR3L_1067_OFFSET_2 0 +#define LIBERO_SETTING_REFCLK_DDR3L_1067_OFFSET_3 2 +#define LIBERO_SETTING_REFCLK_DDR4_1333_OFFSET_0 0 +#define LIBERO_SETTING_REFCLK_DDR4_1333_OFFSET_1 1 +#define LIBERO_SETTING_REFCLK_DDR4_1333_OFFSET_2 7 +#define LIBERO_SETTING_REFCLK_DDR4_1333_OFFSET_3 0 +#define LIBERO_SETTING_REFCLK_LPDDR3_1333_OFFSET_0 0 +#define LIBERO_SETTING_REFCLK_LPDDR3_1333_OFFSET_1 1 +#define LIBERO_SETTING_REFCLK_LPDDR3_1333_OFFSET_2 6 +#define LIBERO_SETTING_REFCLK_LPDDR3_1333_OFFSET_3 0 +#define LIBERO_SETTING_REFCLK_LPDDR4_1333_OFFSET_0 1 +#define LIBERO_SETTING_REFCLK_LPDDR4_1333_OFFSET_1 2 +#define LIBERO_SETTING_REFCLK_LPDDR4_1333_OFFSET_2 3 +#define LIBERO_SETTING_REFCLK_LPDDR4_1333_OFFSET_3 0 + +#define LIBERO_SETTING_TIP_CFG_PARAMS 0x07CFE003 + +#define LIBERO_SETTING_DDR_32_CACHE 0x80000000 +#define LIBERO_SETTING_DDR_32_CACHE_SIZE 0x100000 +#define LIBERO_SETTING_DDR_64_CACHE 0x1000000000 +#define LIBERO_SETTING_DDR_64_CACHE_SIZE 0x100000 +#define LIBERO_SETTING_DDR_32_NON_CACHE 0xc0000000 +#define LIBERO_SETTING_DDR_32_NON_CACHE_SIZE 0x100000 +#define LIBERO_SETTING_DDR_64_NON_CACHE 0x1400000000 +#define LIBERO_SETTING_DDR_64_NON_CACHE_SIZE 0x100000 + +#define LIBERO_SETTING_DPC_BITS 0x0004E563 +#define LIBERO_SETTING_DATA_LANES_USED 0x00000004 + +/* Cache settings */ + +#define LIBERO_SETTING_WAY_MASK_DMA 0x0000ffff +#define LIBERO_SETTING_WAY_MASK_AXI4_PORT_0 0x0000ffff +#define LIBERO_SETTING_WAY_MASK_AXI4_PORT_1 0x0000ffff +#define LIBERO_SETTING_WAY_MASK_AXI4_PORT_2 0x0000ffff +#define LIBERO_SETTING_WAY_MASK_AXI4_PORT_3 0x0000ffff +#define LIBERO_SETTING_WAY_MASK_E51_DCACHE 0x0000ffff +#define LIBERO_SETTING_WAY_MASK_E51_ICACHE 0x0000ffff +#define LIBERO_SETTING_WAY_MASK_U54_1_DCACHE 0x0000ffff +#define LIBERO_SETTING_WAY_MASK_U54_1_ICACHE 0x0000ffff +#define LIBERO_SETTING_WAY_MASK_U54_2_DCACHE 0x0000ffff +#define LIBERO_SETTING_WAY_MASK_U54_2_ICACHE 0x0000ffff +#define LIBERO_SETTING_WAY_MASK_U54_3_DCACHE 0x0000ffff +#define LIBERO_SETTING_WAY_MASK_U54_3_ICACHE 0x0000ffff +#define LIBERO_SETTING_WAY_MASK_U54_4_DCACHE 0x0000ffff +#define LIBERO_SETTING_WAY_MASK_U54_4_ICACHE 0x0000ffff +#define LIBERO_SETTING_NUM_SCRATCH_PAD_WAYS 0x00000000 +#define LIBERO_SETTING_L2_SHUTDOWN_CR 0x00000000 +#define LIBERO_SETTING_WAY_ENABLE 0x00000007 + +#endif /* __BOARDS_RISCV_MPFS_M100PFSEVP_INCLUDE_BOARD_LIBERODEFS_H */ diff --git a/boards/risc-v/mpfs/m100pfsevp/scripts/Make.defs b/boards/risc-v/mpfs/m100pfsevp/scripts/Make.defs new file mode 100755 index 0000000000..f21f3be78d --- /dev/null +++ b/boards/risc-v/mpfs/m100pfsevp/scripts/Make.defs @@ -0,0 +1,102 @@ +############################################################################ +# boards/risc-v/mpfs/m100pfsevp/scripts/Make.defs +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +include $(TOPDIR)/.config +include $(TOPDIR)/tools/Config.mk +include $(TOPDIR)/arch/risc-v/src/rv64gc/Toolchain.defs + +ifeq ($(CONFIG_MPFS_BOOTLOADER),y) + LDSCRIPT = ld-envm.script +else + LDSCRIPT = ld.script +endif + +ifeq ($(CONFIG_CYGWIN_WINTOOL),y) + ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)}" +else + ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT) +endif + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + ARCHOPTIMIZATION = -g + ASARCHCPUFLAGS += -Wa,-g +endif + +MAXOPTIMIZATION = -Os + +ifneq ($(CONFIG_DEBUG_NOOPT),y) + ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce +endif + +# The following options are for the toolchain from T-HEAD. +# For more info ahout the T-HEAD ISA extensions, please refer to the MPFS user guide. +# ARCHCPUFLAGS = -march=rv64gcxthead -mabi=lp64d -mcmodel=medany +# TODO: We are not going to enable this at this time for the CI compatiblity. + +ifeq ($(CONFIG_ARCH_HAVE_DPFPU),y) + ARCHCPUFLAGS = -march=rv64gc -mabi=lp64d -mcmodel=medany +else + ARCHCPUFLAGS = -march=rv64imac -mabi=lp64 -mcmodel=medany +endif + +ARCHCFLAGS = -fno-builtin -ffunction-sections -fdata-sections -fno-omit-frame-pointer +ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti +ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef +ARCHWARNINGSXX = -Wall -Wshadow -Wundef + +CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe +CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) +CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe +CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) +CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +AFLAGS += $(CFLAGS) -D__ASSEMBLY__ $(ASARCHCPUFLAGS) + +# NXFLAT module definitions + +NXFLATLDFLAGS1 = -r -d -warn-common +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections +LDNXFLATFLAGS = -e main -s 2048 + +# Loadable module definitions + +CMODULEFLAGS = $(CFLAGS) + +LDMODULEFLAGS = -r -e module_initialize +ifeq ($(CONFIG_CYGWIN_WINTOOL),y) + LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}" +else + LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld +endif + +# ELF module definitions + +CELFFLAGS = $(CFLAGS) -fno-common +CXXELFFLAGS = $(CXXFLAGS) -fno-common + +LDELFFLAGS = -r -e main +ifeq ($(CONFIG_CYGWIN_WINTOOL),y) + LDELFFLAGS += -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)gnu-elf.ld}" +else + LDELFFLAGS += -T $(BOARD_DIR)$(DELIM)scripts$(DELIM)gnu-elf.ld +endif + +# File extensions + +LDFLAGS += --gc-sections -melf64lriscv diff --git a/boards/risc-v/mpfs/m100pfsevp/scripts/gnu-elf.ld b/boards/risc-v/mpfs/m100pfsevp/scripts/gnu-elf.ld new file mode 100755 index 0000000000..a31737ff41 --- /dev/null +++ b/boards/risc-v/mpfs/m100pfsevp/scripts/gnu-elf.ld @@ -0,0 +1,115 @@ +/**************************************************************************** + * boards/risc-v/mpfs/m100pfsevp/scripts/gnu-elf.ld + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +SECTIONS +{ + .text 0x00000000 : + { + _stext = . ; + *(.text) + *(.text.*) + *(.gnu.warning) + *(.stub) + *(.glue_7) + *(.glue_7t) + *(.jcr) + + /* C++ support: The .init and .fini sections contain specific logic + * to manage static constructors and destructors. + */ + + *(.gnu.linkonce.t.*) + *(.init) /* Old ABI */ + *(.fini) /* Old ABI */ + _etext = . ; + } + + .rodata : + { + _srodata = . ; + *(.rodata) + *(.rodata1) + *(.rodata.*) + *(.gnu.linkonce.r*) + _erodata = . ; + } + + .data : + { + _sdata = . ; + *(.data) + *(.data1) + *(.data.*) + *(.gnu.linkonce.d*) + . = ALIGN(4); + _edata = . ; + } + + /* C++ support. For each global and static local C++ object, + * GCC creates a small subroutine to construct the object. Pointers + * to these routines (not the routines themselves) are stored as + * simple, linear arrays in the .ctors section of the object file. + * Similarly, pointers to global/static destructor routines are + * stored in .dtors. + */ + + .ctors : + { + _sctors = . ; + *(.ctors) /* Old ABI: Unallocated */ + *(.init_array) /* New ABI: Allocated */ + _edtors = . ; + } + + .dtors : + { + _sdtors = . ; + *(.dtors) /* Old ABI: Unallocated */ + *(.fini_array) /* New ABI: Allocated */ + _edtors = . ; + } + + .bss : + { + _sbss = . ; + *(.bss) + *(.bss.*) + *(.sbss) + *(.sbss.*) + *(.gnu.linkonce.b*) + *(COMMON) + _ebss = . ; + } + + /* Stabs debugging sections. */ + + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_info 0 : { *(.debug_info) } + .debug_line 0 : { *(.debug_line) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_aranges 0 : { *(.debug_aranges) } +} diff --git a/boards/risc-v/mpfs/m100pfsevp/scripts/hss-nuttx.yml b/boards/risc-v/mpfs/m100pfsevp/scripts/hss-nuttx.yml new file mode 100644 index 0000000000..05b4214a02 --- /dev/null +++ b/boards/risc-v/mpfs/m100pfsevp/scripts/hss-nuttx.yml @@ -0,0 +1,12 @@ +# HSS Payload Generator + +# First, we can optionally set a name for our image, otherwise one will be created dynamically +set-name: 'PolarFire-SoC-HSS::nuttx' + +# Next, we'll define the entry point addresses for each hart, as follows: +hart-entry-points: {u54_1: '0x80000000', u54_2: '0x80000000', u54_3: '0x80000000', u54_4: '0x80000000'} + +# +payloads: + nuttx.bin: {exec-addr: '0x80000000', owner-hart: u54_1, priv-mode: prv_m} + diff --git a/boards/risc-v/mpfs/m100pfsevp/scripts/ld-envm.script b/boards/risc-v/mpfs/m100pfsevp/scripts/ld-envm.script new file mode 100755 index 0000000000..3b0d09430a --- /dev/null +++ b/boards/risc-v/mpfs/m100pfsevp/scripts/ld-envm.script @@ -0,0 +1,98 @@ +/**************************************************************************** + * boards/risc-v/mpfs/m100pfsevp/scripts/ld-envm.script + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +MEMORY +{ + ddr (rx) : ORIGIN = 0x80000000, LENGTH = 2M /* w/ cache */ + envm (rx) : ORIGIN = 0x20220100, LENGTH = 128K - 256 /* 256 reserved for hss headers */ + lim (rwx) : ORIGIN = 0x08000000, LENGTH = 1024k +} + +OUTPUT_ARCH("riscv") + +ENTRY(_stext) +EXTERN(_vectors) +SECTIONS +{ + .text : { + _stext = ABSOLUTE(.); + *(.vectors) + *(.text .text.*) + *(.fixup) + *(.gnu.warning) + *(.rodata .rodata.* .srodata .srodata.*) + *(.gnu.linkonce.t.*) + *(.glue_7) + *(.glue_7t) + *(.got) + *(.gcc_except_table) + *(.gnu.linkonce.r.*) + _etext = ABSOLUTE(.); + } > envm + + .init_section : ALIGN(4) { + _sinit = ABSOLUTE(.); + KEEP(*(.init_array .init_array.*)) + _einit = ABSOLUTE(.); + } > envm + + _eronly = ABSOLUTE(.); + + .data : ALIGN(4) { + _sdata = ABSOLUTE(.); + *(.data .data.*) + *(.sdata .sdata.* .sdata2.*) + *(.gnu.linkonce.d.*) + *(.gnu.linkonce.s.*) + CONSTRUCTORS + . = ALIGN(4); + _edata = ABSOLUTE(.); + } > lim AT > envm + + PROVIDE(__global_pointer$ = _sdata + ((_edata - _sdata) / 2)); + + .bss : ALIGN(4) { + _sbss = ABSOLUTE(.); + *(.bss .bss.*) + *(.sbss .sbss.*) + *(.gnu.linkonce.b.*) + *(.gnu.linkonce.sb.*) + *(COMMON) + . = ALIGN(4); + _ebss = ABSOLUTE(.); + . = ALIGN(32); + _default_stack_limit = ABSOLUTE(.); + } > lim + + /* Stabs debugging sections. */ + + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_info 0 : { *(.debug_info) } + .debug_line 0 : { *(.debug_line) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_aranges 0 : { *(.debug_aranges) } +} diff --git a/boards/risc-v/mpfs/m100pfsevp/scripts/ld.script b/boards/risc-v/mpfs/m100pfsevp/scripts/ld.script new file mode 100755 index 0000000000..4694083c30 --- /dev/null +++ b/boards/risc-v/mpfs/m100pfsevp/scripts/ld.script @@ -0,0 +1,97 @@ +/**************************************************************************** + * boards/risc-v/mpfs/m100pfsevp/scripts/ld.script + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +MEMORY +{ + progmem (rx) : ORIGIN = 0x80000000, LENGTH = 2M /* w/ cache */ + sram (rwx) : ORIGIN = 0x80200000, LENGTH = 1M /* w/ cache */ +} + +OUTPUT_ARCH("riscv") + +ENTRY(_stext) +EXTERN(_vectors) +SECTIONS +{ + .text : { + _stext = ABSOLUTE(.); + *(.vectors) + *(.text .text.*) + *(.fixup) + *(.gnu.warning) + *(.rodata .rodata.* .srodata .srodata.*) + *(.gnu.linkonce.t.*) + *(.glue_7) + *(.glue_7t) + *(.got) + *(.gcc_except_table) + *(.gnu.linkonce.r.*) + _etext = ABSOLUTE(.); + } > progmem + + .init_section : ALIGN(4) { + _sinit = ABSOLUTE(.); + KEEP(*(.init_array .init_array.*)) + _einit = ABSOLUTE(.); + } > progmem + + _eronly = ABSOLUTE(.); + + .data : ALIGN(4) { + _sdata = ABSOLUTE(.); + *(.data .data.*) + *(.sdata .sdata.* .sdata2.*) + *(.gnu.linkonce.d.*) + *(.gnu.linkonce.s.*) + CONSTRUCTORS + . = ALIGN(4); + _edata = ABSOLUTE(.); + } > sram AT > progmem + + PROVIDE(__global_pointer$ = _sdata + ((_edata - _sdata) / 2)); + + .bss : ALIGN(4) { + _sbss = ABSOLUTE(.); + *(.bss .bss.*) + *(.sbss .sbss.*) + *(.gnu.linkonce.b.*) + *(.gnu.linkonce.sb.*) + *(COMMON) + . = ALIGN(4); + _ebss = ABSOLUTE(.); + . = ALIGN(32); + _default_stack_limit = ABSOLUTE(.); + } > sram + + /* Stabs debugging sections. */ + + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_info 0 : { *(.debug_info) } + .debug_line 0 : { *(.debug_line) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_aranges 0 : { *(.debug_aranges) } +} diff --git a/boards/risc-v/mpfs/m100pfsevp/scripts/memory.ld b/boards/risc-v/mpfs/m100pfsevp/scripts/memory.ld new file mode 100755 index 0000000000..5e3e46cf99 --- /dev/null +++ b/boards/risc-v/mpfs/m100pfsevp/scripts/memory.ld @@ -0,0 +1,35 @@ +/**************************************************************************** + * boards/risc-v/mpfs/m100pfsevp/scripts/memory.ld + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/* Reg Access Start addr End addr Size + * QEMU CPU w/ cache 0x00000000 - 0x003fffff : 4MB + * QEMU CPU w/o cache 0x1f000000 - 0x1f01ffff : 128KB + */ + +MEMORY +{ + kflash (rx) : ORIGIN = 0x80000000, LENGTH = 256K /* w/ cache */ + uflash (rx) : ORIGIN = 0x80040000, LENGTH = 256K /* w/ cache */ + xflash (rx) : ORIGIN = 0x80080000, LENGTH = 256K /* w/o cache */ + + ksram (rwx) : ORIGIN = 0x800C0000, LENGTH = 256K /* w/ cache */ + usram (rwx) : ORIGIN = 0x80100000, LENGTH = 256K /* w/ cache */ + xsram (rwx) : ORIGIN = 0x80140000, LENGTH = 256K /* w/o cache */ +} diff --git a/boards/risc-v/mpfs/m100pfsevp/scripts/user-space.ld b/boards/risc-v/mpfs/m100pfsevp/scripts/user-space.ld new file mode 100755 index 0000000000..4be0f7853d --- /dev/null +++ b/boards/risc-v/mpfs/m100pfsevp/scripts/user-space.ld @@ -0,0 +1,104 @@ +/**************************************************************************** + * boards/risc-v/mpfs/m100pfsevp/scripts/user-space.ld + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/* NOTE: This depends on the memory.ld script having been included prior to + * this script. + */ + +OUTPUT_ARCH("riscv") + +SECTIONS +{ + /* section info */ + + __ld_uflash_start = ORIGIN(uflash); + __ld_uflash_end = ORIGIN(uflash)+ LENGTH(uflash); + __ld_uflash_size = LENGTH(uflash); + + __ld_usram_start = ORIGIN(usram); + __ld_usram_end = ORIGIN(usram)+ LENGTH(usram); + __ld_usram_size = LENGTH(usram); + + .userspace : { + *(.userspace) + } > uflash + + .text : { + _stext = ABSOLUTE(.); + *(.text .text.*) + *(.fixup) + *(.gnu.warning) + *(.rodata .rodata.*) + *(.gnu.linkonce.t.*) + *(.glue_7) + *(.glue_7t) + *(.got) + *(.gcc_except_table) + *(.gnu.linkonce.r.*) + _etext = ABSOLUTE(.); + } > uflash + + .init_section : { + _sinit = ABSOLUTE(.); + KEEP(*(.init_array .init_array.*)) + _einit = ABSOLUTE(.); + } > uflash + + __exidx_start = ABSOLUTE(.); + + __exidx_end = ABSOLUTE(.); + + _eronly = ABSOLUTE(.); + + .data : { + _sdata = ABSOLUTE(.); + *(.data .data.*) + *(.sdata .sdata.* .sdata2.*) + *(.gnu.linkonce.d.*) + CONSTRUCTORS + . = ALIGN(4); + _edata = ABSOLUTE(.); + } > usram AT > uflash + + .bss : { + _sbss = ABSOLUTE(.); + *(.bss .bss.*) + *(.sbss .sbss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + . = ALIGN(4); + _ebss = ABSOLUTE(.); + } > usram + + /* Stabs debugging sections */ + + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_info 0 : { *(.debug_info) } + .debug_line 0 : { *(.debug_line) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_aranges 0 : { *(.debug_aranges) } +} diff --git a/boards/risc-v/mpfs/m100pfsevp/src/Make.defs b/boards/risc-v/mpfs/m100pfsevp/src/Make.defs new file mode 100755 index 0000000000..e5ee79368c --- /dev/null +++ b/boards/risc-v/mpfs/m100pfsevp/src/Make.defs @@ -0,0 +1,33 @@ +############################################################################ +# boards/risc-v/mpfs/m100pfsevp/src/Make.defs +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + +CSRCS = mpfs_bringup.c + +ifeq ($(CONFIG_ARCH_LEDS),y) + CSRCS += mpfs_autoleds.c +endif + +ifeq ($(CONFIG_BOARDCTL),y) + CSRCS += mpfs_appinit.c +endif + +DEPPATH += --dep-path board +VPATH += :board +CFLAGS += $(shell $(INCDIR) "$(CC)" $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board) \ No newline at end of file diff --git a/boards/risc-v/mpfs/m100pfsevp/src/board_config.h b/boards/risc-v/mpfs/m100pfsevp/src/board_config.h new file mode 100755 index 0000000000..8208a4e08a --- /dev/null +++ b/boards/risc-v/mpfs/m100pfsevp/src/board_config.h @@ -0,0 +1,39 @@ +/**************************************************************************** + * boards/risc-v/mpfs/m100pfsevp/src/board_config.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __BOARDS_RISCV_M100PFSEVP_MPFS_SRC_BOARD_CONFIG_H +#define __BOARDS_RISCV_M100PFSEVP_MPFS_SRC_BOARD_CONFIG_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#define SDIO_SLOTNO 0 +#define SDIO_MINOR 0 + +int mpfs_bringup(void); +int mpfs_board_spi_init(void); +int mpfs_board_i2c_init(void); +int mpfs_pwm_setup(void); +int mpfs_board_emmcsd_init(void); + +#endif /* __BOARDS_RISCV_M100PFSEVP_MPFS_SRC_BOARD_CONFIG_H */ diff --git a/boards/risc-v/mpfs/m100pfsevp/src/mpfs_appinit.c b/boards/risc-v/mpfs/m100pfsevp/src/mpfs_appinit.c new file mode 100755 index 0000000000..3a76975930 --- /dev/null +++ b/boards/risc-v/mpfs/m100pfsevp/src/mpfs_appinit.c @@ -0,0 +1,75 @@ +/**************************************************************************** + * boards/risc-v/mpfs/m100pfsevp/src/mpfs_appinit.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include + +#include "mpfs.h" +#include "board_config.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_app_initialize + * + * Description: + * Perform architecture specific initialization + * + * Input Parameters: + * arg - The boardctl() argument is passed to the board_app_initialize() + * implementation without modification. The argument has no + * meaning to NuttX; the meaning of the argument is a contract + * between the board-specific initialization logic and the + * matching application logic. The value could be such things as a + * mode enumeration value, a set of DIP switch switch settings, a + * pointer to configuration data read from a file or serial FLASH, + * or whatever you would like to do with it. Every implementation + * should accept zero/NULL as a default configuration. + * + * Returned Value: + * Zero (OK) is returned on success; a negated errno value is returned on + * any failure to indicate the nature of the failure. + * + ****************************************************************************/ + +int board_app_initialize(uintptr_t arg) +{ +#ifdef CONFIG_BOARD_LATE_INITIALIZE + /* Board initialization already performed by board_late_initialize() */ + + return OK; +#else + /* Perform board-specific initialization */ + + return mpfs_bringup(); +#endif +} diff --git a/boards/risc-v/mpfs/m100pfsevp/src/mpfs_autoleds.c b/boards/risc-v/mpfs/m100pfsevp/src/mpfs_autoleds.c new file mode 100755 index 0000000000..f9da8d664c --- /dev/null +++ b/boards/risc-v/mpfs/m100pfsevp/src/mpfs_autoleds.c @@ -0,0 +1,92 @@ +/**************************************************************************** + * boards/risc-v/mpfs/m100pfsevp/src/mpfs_autoleds.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include +#include "board_config.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_autoled_initialize + * + * Description: + * Init the LEDs. + * + ****************************************************************************/ + +void board_autoled_initialize(void) +{ + /* TODO */ +} + +/**************************************************************************** + * Name: board_autoled_on + * + * Description: + * Turn on the LED specificed. + * + * Input Parameters: + * led - The LED which is under this control + * + ****************************************************************************/ + +void board_autoled_on(int led) +{ + switch (led) + { + /* TODO */ + + default: + break; + } +} + +/**************************************************************************** + * Name: board_autoled_off + * + * Description: + * Turn off the LED specificed. + * + * Input Parameters: + * led - The LED which is under this control + * + ****************************************************************************/ + +void board_autoled_off(int led) +{ + switch (led) + { + /* TODO */ + + default: + break; + } +} diff --git a/boards/risc-v/mpfs/m100pfsevp/src/mpfs_bringup.c b/boards/risc-v/mpfs/m100pfsevp/src/mpfs_bringup.c new file mode 100755 index 0000000000..570b9b6cb5 --- /dev/null +++ b/boards/risc-v/mpfs/m100pfsevp/src/mpfs_bringup.c @@ -0,0 +1,105 @@ +/**************************************************************************** + * boards/risc-v/mpfs/m100pfsevp/src/mpfs_bringup.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include "board_config.h" +#include "mpfs_corepwm.h" +#include "mpfs.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: mpfs_bringup + ****************************************************************************/ + +int mpfs_bringup(void) +{ + int ret = OK; + +#if defined(CONFIG_I2C_DRIVER) + /* Configure I2C peripheral interfaces */ + + ret = mpfs_board_i2c_init(); + + if (ret < 0) + { + syslog(LOG_ERR, "Failed to initialize I2C driver: %d\n", ret); + } +#endif + +#ifdef CONFIG_FS_PROCFS + /* Mount the procfs file system */ + + ret = mount(NULL, "/proc", "procfs", 0, NULL); + if (ret < 0) + { + serr("ERROR: Failed to mount procfs at %s: %d\n", "/proc", ret); + } +#endif + +#if defined(CONFIG_MPFS_SPI0) || defined(CONFIG_MPFS_SPI1) + /* Configure SPI peripheral interfaces */ + + ret = mpfs_board_spi_init(); + + if (ret < 0) + { + syslog(LOG_ERR, "Failed to initialize SPI driver: %d\n", ret); + } +#endif + +#ifdef CONFIG_MPFS_HAVE_COREPWM + /* Configure PWM peripheral interfaces */ + + ret = mpfs_pwm_setup(); + + if (ret < 0) + { + syslog(LOG_ERR, "Failed to initialize CorePWM driver: %d\n", ret); + } +#endif + +#ifdef CONFIG_MPFS_EMMCSD + ret = mpfs_board_emmcsd_init(); + + if (ret < 0) + { + syslog(LOG_ERR, "Failed to init eMMCSD driver: %d\n", ret); + } +#endif + + return ret; +}