diff options
author | Aditya Prayoga <aditya@kobol.io> | 2018-12-05 00:57:24 +0800 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2018-12-08 16:19:41 +0100 |
commit | 8d7d97e2d1a340ddc2ebe2286bb212ae3f54da62 (patch) | |
tree | 7a2aa7c5383fc387770ec0185d76e5960787a792 | |
parent | 16b6aefafdabe1c8733e876f02f54cdaaad5f409 (diff) |
arm: mvebu: helios4: Enable SPI flash support
Enable SPI flash support under U-Boot and SPL. The ENV size and offset,
ported from U-Boot 2013.01 Marvell version: 2015_T1.0p16
To create U-Boot image for SPI flash, user would need to replace
* CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC with CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI
* CONFIG_ENV_IS_IN_MMC with CONFIG_ENV_IS_IN_SPI_FLASH
Signed-off-by: Aditya Prayoga <aditya@kobol.io>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-By: Dennis Gilmore <dgilmore@redhat.com>
Reviewed-By: Dennis Gilmore <dgilmore@redhat.com>
Signed-off-by: Stefan Roese <sr@denx.de>
-rw-r--r-- | arch/arm/dts/armada-388-helios4-u-boot.dtsi | 10 | ||||
-rw-r--r-- | configs/helios4_defconfig | 1 | ||||
-rw-r--r-- | include/configs/helios4.h | 31 |
3 files changed, 41 insertions, 1 deletions
diff --git a/arch/arm/dts/armada-388-helios4-u-boot.dtsi b/arch/arm/dts/armada-388-helios4-u-boot.dtsi index bd8c6ce5016..4bc00aec10f 100644 --- a/arch/arm/dts/armada-388-helios4-u-boot.dtsi +++ b/arch/arm/dts/armada-388-helios4-u-boot.dtsi @@ -4,5 +4,15 @@ aliases { i2c0 = &i2c0; i2c1 = &i2c1; + spi1 = &spi1; }; }; + +&spi1 { + u-boot,dm-spl; +}; + +&w25q32 { + status = "okay"; + u-boot,dm-spl; +}; diff --git a/configs/helios4_defconfig b/configs/helios4_defconfig index 53995fe157b..3bb4622fbee 100644 --- a/configs/helios4_defconfig +++ b/configs/helios4_defconfig @@ -6,7 +6,6 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_HELIOS4=y CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC=y -CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL_SYS_MALLOC_SIMPLE=y CONFIG_SPL=y diff --git a/include/configs/helios4.h b/include/configs/helios4.h index e665340f1e0..3157225f067 100644 --- a/include/configs/helios4.h +++ b/include/configs/helios4.h @@ -6,6 +6,8 @@ #ifndef _CONFIG_HELIOS4_H #define _CONFIG_HELIOS4_H +#include <linux/sizes.h> + /* * High Level Configuration Options (easy to change) */ @@ -23,6 +25,9 @@ /* SPI NOR flash default params, used by sf commands */ #define CONFIG_SF_DEFAULT_BUS 1 +#define CONFIG_SF_DEFAULT_CS 0 +#define CONFIG_SF_DEFAULT_SPEED 104000000 +#define CONFIG_SF_DEFAULT_MODE SPI_MODE_3 /* * SDIO/MMC Card Configuration @@ -43,6 +48,21 @@ #define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ CONFIG_SYS_SCSI_MAX_LUN) +#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI +/* + * SPI Flash configuration for the environment access + */ +#define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS +#define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS +#define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED + +/* Environment in SPI NOR flash */ +#define CONFIG_ENV_SECT_SIZE SZ_64K +#define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE +#define CONFIG_ENV_OFFSET SZ_1M +#endif + +#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC /* Environment in MMC */ #define CONFIG_SYS_MMC_ENV_DEV 0 #define CONFIG_ENV_SECT_SIZE 0x200 @@ -50,6 +70,7 @@ /* stay within first 1M */ #define CONFIG_ENV_OFFSET (SZ_1M - CONFIG_ENV_SIZE) #define CONFIG_ENV_ADDR CONFIG_ENV_OFFSET +#endif #define CONFIG_PHY_MARVELL /* there is a marvell phy */ #define PHY_ANEG_TIMEOUT 8000 /* PHY needs a longer aneg time */ @@ -69,7 +90,13 @@ */ #define SPL_BOOT_SPI_NOR_FLASH 1 #define SPL_BOOT_SDIO_MMC_CARD 2 + +#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_SPI +#define CONFIG_SPL_BOOT_DEVICE SPL_BOOT_SPI_NOR_FLASH +#endif +#ifdef CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC #define CONFIG_SPL_BOOT_DEVICE SPL_BOOT_SDIO_MMC_CARD +#endif /* Defines for SPL */ #define CONFIG_SPL_SIZE (140 << 10) @@ -88,12 +115,16 @@ #if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SPI_NOR_FLASH /* SPL related SPI defines */ +#define CONFIG_SPL_SPI_FLASH_SUPPORT +#define CONFIG_SPL_SPI_LOAD +#define CONFIG_SPL_SPI_SUPPORT #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000 #define CONFIG_SYS_U_BOOT_OFFS CONFIG_SYS_SPI_U_BOOT_OFFS #endif #if CONFIG_SPL_BOOT_DEVICE == SPL_BOOT_SDIO_MMC_CARD /* SPL related MMC defines */ +#define CONFIG_SPL_MMC_SUPPORT #define CONFIG_SYS_MMC_U_BOOT_OFFS (160 << 10) #define CONFIG_SYS_U_BOOT_OFFS CONFIG_SYS_MMC_U_BOOT_OFFS #ifdef CONFIG_SPL_BUILD |