[PATCH 15/16] mips: mtmips: enable SPL for all boards

Stefan Roese sr at denx.de
Fri Jan 10 15:24:49 CET 2020


On 08.01.20 04:02, Weijie Gao wrote:
> This patch enables SPL for all mtmips boards. And also remove defconfig
> files which are intend to build ram bootable u-boot files.
> 
> Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
> ---
>   arch/mips/mach-mtmips/Kconfig                 | 26 -------
>   board/gardena/smart-gateway-mt7688/board.c    |  2 +
>   ...gardena-smart-gateway-mt7688-ram_defconfig | 75 -------------------
>   .../gardena-smart-gateway-mt7688_defconfig    |  7 +-
>   configs/linkit-smart-7688-ram_defconfig       | 65 ----------------
>   configs/linkit-smart-7688_defconfig           |  7 +-
>   .../configs/gardena-smart-gateway-mt7688.h    | 18 ++++-
>   include/configs/linkit-smart-7688.h           | 18 ++++-
>   8 files changed, 46 insertions(+), 172 deletions(-)
>   delete mode 100644 configs/gardena-smart-gateway-mt7688-ram_defconfig
>   delete mode 100644 configs/linkit-smart-7688-ram_defconfig
> 
> diff --git a/arch/mips/mach-mtmips/Kconfig b/arch/mips/mach-mtmips/Kconfig
> index 4556e7f4f6..7c674ecb2b 100644
> --- a/arch/mips/mach-mtmips/Kconfig
> +++ b/arch/mips/mach-mtmips/Kconfig
> @@ -51,7 +51,6 @@ config BOARD_GARDENA_SMART_GATEWAY_MT7688
>   	bool "GARDENA smart Gateway"
>   	depends on SOC_MT7628
>   	select BOARD_LATE_INIT
> -	select SUPPORTS_BOOT_RAM
>   	help
>   	  GARDENA smart Gateway boards have a MT7688 SoC with 128 MiB of RAM
>   	  and 8 MiB of flash (SPI NOR) and additional SPI NAND storage.
> @@ -59,7 +58,6 @@ config BOARD_GARDENA_SMART_GATEWAY_MT7688
>   config BOARD_LINKIT_SMART_7688
>   	bool "LinkIt Smart 7688"
>   	depends on SOC_MT7628
> -	select SUPPORTS_BOOT_RAM
>   	help
>   	  Seeed LinkIt Smart 7688 boards have a MT7688 SoC with 128 MiB of RAM
>   	  and 32 MiB of flash (SPI).
> @@ -69,30 +67,6 @@ config BOARD_LINKIT_SMART_7688
>   
>   endchoice
>   
> -choice
> -	prompt "Boot mode"
> -
> -config BOOT_RAM
> -	bool "RAM boot"
> -	depends on SUPPORTS_BOOT_RAM
> -	help
> -	  This builds an image that is linked to a RAM address. It can be used
> -	  for booting from CFE via TFTP using an ELF image, but it can also be
> -	  booted from RAM by other bootloaders using a BIN image.
> -
> -config BOOT_ROM
> -	bool "ROM boot"
> -	depends on SUPPORTS_BOOT_RAM
> -	help
> -	  This builds an image that is linked to a ROM address. It can be
> -	  used as main bootloader image which is programmed onto the onboard
> -	  flash storage (SPI NOR).
> -
> -endchoice
> -
> -config SUPPORTS_BOOT_RAM
> -	bool
> -
>   source "board/gardena/smart-gateway-mt7688/Kconfig"
>   source "board/seeed/linkit-smart-7688/Kconfig"
>   
> diff --git a/board/gardena/smart-gateway-mt7688/board.c b/board/gardena/smart-gateway-mt7688/board.c
> index ae03f0a434..80f9f1ae65 100644
> --- a/board/gardena/smart-gateway-mt7688/board.c
> +++ b/board/gardena/smart-gateway-mt7688/board.c
> @@ -294,8 +294,10 @@ err_free:
>   	return ret;
>   }
>   
> +#ifndef CONFIG_SPL_BUILD
>   U_BOOT_CMD(
>   	fd_write,	1,	0,	do_fd_write,
>   	"Write test factory-data values to SPI NOR",
>   	"\n"
>   );
> +#endif

Perhaps it would be better to drop compiling this file (board.c) for
SPL complete by changin the Makefile instead?

> diff --git a/configs/gardena-smart-gateway-mt7688-ram_defconfig b/configs/gardena-smart-gateway-mt7688-ram_defconfig
> deleted file mode 100644
> index 41e52a92cc..0000000000
> --- a/configs/gardena-smart-gateway-mt7688-ram_defconfig
> +++ /dev/null
> @@ -1,75 +0,0 @@
> -CONFIG_MIPS=y
> -CONFIG_SYS_TEXT_BASE=0x80010000
> -CONFIG_ENV_SIZE=0x10000
> -CONFIG_ENV_OFFSET=0xA0000
> -CONFIG_NR_DRAM_BANKS=1
> -CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y
> -CONFIG_SYS_BOOTCOUNT_ADDR=0xb000006c
> -CONFIG_ENV_SECT_SIZE=0x10000
> -CONFIG_ARCH_MTMIPS=y
> -CONFIG_BOARD_GARDENA_SMART_GATEWAY_MT7688=y
> -CONFIG_RESTORE_EXCEPTION_VECTOR_BASE=y
> -# CONFIG_MIPS_BOOT_ENV_LEGACY is not set
> -CONFIG_MIPS_BOOT_FDT=y
> -CONFIG_ENV_VARS_UBOOT_CONFIG=y
> -CONFIG_FIT=y
> -CONFIG_FIT_SIGNATURE=y
> -CONFIG_LEGACY_IMAGE_FORMAT=y
> -CONFIG_OF_STDOUT_VIA_ALIAS=y
> -CONFIG_USE_BOOTCOMMAND=y
> -CONFIG_BOOTCOMMAND="cp.b 83000000 84000000 10000 && dhcp uEnv.txt && env import -t ${fileaddr} ${filesize} && run do_u_boot_init; reset"
> -CONFIG_USE_PREBOOT=y
> -CONFIG_SYS_CONSOLE_INFO_QUIET=y
> -CONFIG_VERSION_VARIABLE=y
> -CONFIG_BOARD_EARLY_INIT_F=y
> -CONFIG_HUSH_PARSER=y
> -CONFIG_CMD_LICENSE=y
> -# CONFIG_CMD_ELF is not set
> -# CONFIG_CMD_XIMG is not set
> -CONFIG_CMD_MEMINFO=y
> -# CONFIG_CMD_FLASH is not set
> -CONFIG_CMD_GPIO=y
> -# CONFIG_CMD_LOADS is not set
> -CONFIG_CMD_MTD=y
> -CONFIG_CMD_SPI=y
> -CONFIG_CMD_WDT=y
> -CONFIG_CMD_DHCP=y
> -CONFIG_CMD_MII=y
> -CONFIG_CMD_PING=y
> -CONFIG_CMD_BOOTCOUNT=y
> -CONFIG_CMD_TIME=y
> -CONFIG_CMD_UUID=y
> -CONFIG_CMD_MTDPARTS=y
> -CONFIG_MTDIDS_DEFAULT="spi-nand0=spi0.1,nor0=spi0.0"
> -CONFIG_MTDPARTS_DEFAULT="spi0.0:640k(uboot),64k(uboot_env0),64k(uboot_env1),64k(factory),-(unused);spi0.1:-(nand)"
> -CONFIG_CMD_UBI=y
> -CONFIG_DEFAULT_DEVICE_TREE="gardena-smart-gateway-mt7688"
> -CONFIG_ENV_IS_IN_SPI_FLASH=y
> -CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
> -CONFIG_ENV_OFFSET_REDUND=0xB0000
> -CONFIG_SYS_RELOC_GD_ENV_ADDR=y
> -CONFIG_NET_RANDOM_ETHADDR=y
> -# CONFIG_DM_DEVICE_REMOVE is not set
> -CONFIG_HAVE_BLOCK_DEVICE=y
> -CONFIG_BOOTCOUNT_LIMIT=y
> -CONFIG_LED=y
> -CONFIG_LED_BLINK=y
> -CONFIG_LED_GPIO=y
> -CONFIG_MTD=y
> -CONFIG_DM_MTD=y
> -CONFIG_MTD_SPI_NAND=y
> -CONFIG_SPI_FLASH_GIGADEVICE=y
> -CONFIG_SPI_FLASH_MACRONIX=y
> -CONFIG_SPI_FLASH_SPANSION=y
> -CONFIG_SPI_FLASH_STMICRO=y
> -CONFIG_SPI_FLASH_WINBOND=y
> -CONFIG_SPI_FLASH_XMC=y
> -CONFIG_SPI_FLASH_MTD=y
> -CONFIG_MTD_UBI_BEB_LIMIT=22
> -CONFIG_MT7628_ETH=y
> -CONFIG_PHY=y
> -CONFIG_SPI=y
> -CONFIG_MT7621_SPI=y
> -CONFIG_WDT=y
> -CONFIG_WDT_MT7621=y
> -CONFIG_LZMA=y
> diff --git a/configs/gardena-smart-gateway-mt7688_defconfig b/configs/gardena-smart-gateway-mt7688_defconfig
> index 7cd06cb014..bbb163331b 100644
> --- a/configs/gardena-smart-gateway-mt7688_defconfig
> +++ b/configs/gardena-smart-gateway-mt7688_defconfig
> @@ -1,5 +1,4 @@
>   CONFIG_MIPS=y
> -CONFIG_SYS_TEXT_BASE=0x9c000000
>   CONFIG_ENV_SIZE=0x10000
>   CONFIG_ENV_OFFSET=0xA0000
>   CONFIG_NR_DRAM_BANKS=1
> @@ -8,7 +7,6 @@ CONFIG_SYS_BOOTCOUNT_ADDR=0xb000006c
>   CONFIG_ENV_SECT_SIZE=0x10000
>   CONFIG_ARCH_MTMIPS=y
>   CONFIG_BOARD_GARDENA_SMART_GATEWAY_MT7688=y
> -CONFIG_BOOT_ROM=y
>   CONFIG_RESTORE_EXCEPTION_VECTOR_BASE=y
>   # CONFIG_MIPS_BOOT_ENV_LEGACY is not set
>   CONFIG_MIPS_BOOT_FDT=y
> @@ -23,6 +21,11 @@ CONFIG_USE_PREBOOT=y
>   CONFIG_SYS_CONSOLE_INFO_QUIET=y
>   CONFIG_VERSION_VARIABLE=y
>   CONFIG_BOARD_EARLY_INIT_F=y
> +CONFIG_SPL=y
> +CONFIG_SPL_NOR_SUPPORT=y
> +CONFIG_SPL_SERIAL_SUPPORT=y
> +CONFIG_SPL_LIBCOMMON_SUPPORT=y
> +CONFIG_SPL_LIBGENERIC_SUPPORT=y
>   CONFIG_HUSH_PARSER=y
>   CONFIG_CMD_LICENSE=y
>   # CONFIG_CMD_ELF is not set
> diff --git a/configs/linkit-smart-7688-ram_defconfig b/configs/linkit-smart-7688-ram_defconfig
> deleted file mode 100644
> index 6d8969aacb..0000000000
> --- a/configs/linkit-smart-7688-ram_defconfig
> +++ /dev/null
> @@ -1,65 +0,0 @@
> -CONFIG_MIPS=y
> -CONFIG_SYS_TEXT_BASE=0x80010000
> -CONFIG_ENV_SIZE=0x4000
> -CONFIG_ENV_OFFSET=0x80000
> -CONFIG_NR_DRAM_BANKS=1
> -CONFIG_ENV_SECT_SIZE=0x10000
> -CONFIG_ARCH_MTMIPS=y
> -CONFIG_BOARD_LINKIT_SMART_7688=y
> -CONFIG_RESTORE_EXCEPTION_VECTOR_BASE=y
> -# CONFIG_MIPS_BOOT_ENV_LEGACY is not set
> -CONFIG_MIPS_BOOT_FDT=y
> -CONFIG_FIT=y
> -CONFIG_FIT_SIGNATURE=y
> -CONFIG_LEGACY_IMAGE_FORMAT=y
> -CONFIG_OF_STDOUT_VIA_ALIAS=y
> -CONFIG_SYS_CONSOLE_INFO_QUIET=y
> -CONFIG_BOARD_EARLY_INIT_F=y
> -CONFIG_HUSH_PARSER=y
> -CONFIG_CMD_LICENSE=y
> -# CONFIG_CMD_ELF is not set
> -# CONFIG_CMD_XIMG is not set
> -CONFIG_CMD_MEMINFO=y
> -# CONFIG_CMD_FLASH is not set
> -CONFIG_CMD_GPIO=y
> -# CONFIG_CMD_LOADS is not set
> -CONFIG_CMD_MTD=y
> -CONFIG_CMD_PART=y
> -CONFIG_CMD_SPI=y
> -CONFIG_CMD_USB=y
> -CONFIG_CMD_DHCP=y
> -CONFIG_CMD_MII=y
> -CONFIG_CMD_PING=y
> -CONFIG_CMD_TIME=y
> -CONFIG_CMD_FS_GENERIC=y
> -# CONFIG_DOS_PARTITION is not set
> -CONFIG_DEFAULT_DEVICE_TREE="linkit-smart-7688"
> -CONFIG_ENV_IS_IN_SPI_FLASH=y
> -CONFIG_SYS_RELOC_GD_ENV_ADDR=y
> -CONFIG_NET_RANDOM_ETHADDR=y
> -# CONFIG_DM_DEVICE_REMOVE is not set
> -CONFIG_BLK=y
> -CONFIG_LED=y
> -CONFIG_LED_BLINK=y
> -CONFIG_LED_GPIO=y
> -CONFIG_MTD=y
> -CONFIG_SPI_FLASH_GIGADEVICE=y
> -CONFIG_SPI_FLASH_MACRONIX=y
> -CONFIG_SPI_FLASH_SPANSION=y
> -CONFIG_SPI_FLASH_STMICRO=y
> -CONFIG_SPI_FLASH_WINBOND=y
> -CONFIG_SPI_FLASH_MTD=y
> -CONFIG_MT7628_ETH=y
> -CONFIG_PHY=y
> -CONFIG_MT76X8_USB_PHY=y
> -CONFIG_SPI=y
> -CONFIG_MT7621_SPI=y
> -CONFIG_USB=y
> -CONFIG_DM_USB=y
> -CONFIG_USB_EHCI_HCD=y
> -CONFIG_USB_EHCI_GENERIC=y
> -CONFIG_USB_STORAGE=y
> -CONFIG_FS_EXT4=y
> -CONFIG_FS_FAT=y
> -CONFIG_LZMA=y
> -CONFIG_LZO=y
> diff --git a/configs/linkit-smart-7688_defconfig b/configs/linkit-smart-7688_defconfig
> index 9ddee9a861..07d4a01235 100644
> --- a/configs/linkit-smart-7688_defconfig
> +++ b/configs/linkit-smart-7688_defconfig
> @@ -1,12 +1,10 @@
>   CONFIG_MIPS=y
> -CONFIG_SYS_TEXT_BASE=0x9c000000
>   CONFIG_ENV_SIZE=0x4000
>   CONFIG_ENV_OFFSET=0x80000
>   CONFIG_NR_DRAM_BANKS=1
>   CONFIG_ENV_SECT_SIZE=0x10000
>   CONFIG_ARCH_MTMIPS=y
>   CONFIG_BOARD_LINKIT_SMART_7688=y
> -CONFIG_BOOT_ROM=y
>   CONFIG_RESTORE_EXCEPTION_VECTOR_BASE=y
>   # CONFIG_MIPS_BOOT_ENV_LEGACY is not set
>   CONFIG_MIPS_BOOT_FDT=y
> @@ -16,6 +14,11 @@ CONFIG_LEGACY_IMAGE_FORMAT=y
>   CONFIG_OF_STDOUT_VIA_ALIAS=y
>   CONFIG_SYS_CONSOLE_INFO_QUIET=y
>   CONFIG_BOARD_EARLY_INIT_F=y
> +CONFIG_SPL=y
> +CONFIG_SPL_NOR_SUPPORT=y
> +CONFIG_SPL_SERIAL_SUPPORT=y
> +CONFIG_SPL_LIBCOMMON_SUPPORT=y
> +CONFIG_SPL_LIBGENERIC_SUPPORT=y
>   CONFIG_HUSH_PARSER=y
>   CONFIG_CMD_LICENSE=y
>   # CONFIG_CMD_ELF is not set
> diff --git a/include/configs/gardena-smart-gateway-mt7688.h b/include/configs/gardena-smart-gateway-mt7688.h
> index 59c60743d2..59868247d3 100644
> --- a/include/configs/gardena-smart-gateway-mt7688.h
> +++ b/include/configs/gardena-smart-gateway-mt7688.h
> @@ -16,10 +16,26 @@
>   
>   #define CONFIG_SYS_INIT_SP_OFFSET	0x400000
>   
> -#ifdef CONFIG_BOOT_RAM
> +/* SPL */
> +#if defined(CONFIG_SPL) && !defined(CONFIG_SPL_BUILD)
>   #define CONFIG_SKIP_LOWLEVEL_INIT
>   #endif
>   
> +#define CONFIG_SYS_UBOOT_BASE		(CONFIG_SPL_TEXT_BASE + 0x4000)
> +#define CONFIG_SYS_UBOOT_START		CONFIG_SYS_TEXT_BASE
> +#define CONFIG_SPL_BSS_START_ADDR	0x80010000
> +#define CONFIG_SPL_BSS_MAX_SIZE		0x10000
> +#define CONFIG_SPL_MAX_SIZE		0x4000
> +
> +/* Serial SPL */
> +#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_SERIAL_SUPPORT)
> +#define CONFIG_SYS_NS16550_MEM32
> +#define CONFIG_SYS_NS16550_CLK		40000000
> +#define CONFIG_SYS_NS16550_REG_SIZE	-4
> +#define CONFIG_SYS_NS16550_COM1		0xb0000c00
> +#define CONFIG_CONS_INDEX		1
> +#endif

Did you consider using DT based probing for SPL as well
(CONFIG_SPL_OF_CONTROL)? These additions would not be needed in this
case. But I assume that the resulting code size would be quite a bit
bigger. If the size increase is not too bad, I would personally
prefer this DT based probing in SPI as well. But if your reasoning
is size increase and if you have limits here, then please continue
this way.

Thanks,
Stefan


More information about the U-Boot mailing list