From abe66b1b5decf9cc2fb5daad42c9e870e5b99b67 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Wed, 27 Feb 2019 15:20:38 +0100 Subject: Convert CONFIG_ENV_SPI_* to Kconfig This converts the following to Kconfig: CONFIG_ENV_SPI_BUS CONFIG_ENV_SPI_CS CONFIG_ENV_SPI_MAX_HZ CONFIG_ENV_SPI_MODE Most of time these value are not needed, CONFIG_SF_DEFAULT with same value is used, so I introduced CONFIG_USE_ENV_SPI_* to force the associated value for the environment. Signed-off-by: Patrick Delaunay --- env/Kconfig | 53 ++++++++++++++++++++++++++++++++++++++++++++++------- env/sf.c | 13 ------------- 2 files changed, 46 insertions(+), 20 deletions(-) (limited to 'env') diff --git a/env/Kconfig b/env/Kconfig index c22cbbd..7830066 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -324,18 +324,57 @@ config ENV_IS_IN_SPI_FLASH during a "saveenv" operation. CONFIG_ENV_OFFSET_REDUND must be aligned to an erase sector boundary. - - CONFIG_ENV_SPI_BUS (optional): - - CONFIG_ENV_SPI_CS (optional): +config USE_ENV_SPI_BUS + bool "SPI flash bus for environment" + depends on ENV_IS_IN_SPI_FLASH + help + Force the SPI bus for environment. + If not defined, use CONFIG_SF_DEFAULT_BUS. + +config ENV_SPI_BUS + int "Value of SPI flash bus for environment" + depends on USE_ENV_SPI_BUS + help + Value the SPI bus and chip select for environment. + +config USE_ENV_SPI_CS + bool "SPI flash chip select for environment" + depends on ENV_IS_IN_SPI_FLASH + help + Force the SPI chip select for environment. + If not defined, use CONFIG_SF_DEFAULT_CS. - Define the SPI bus and chip select. If not defined they will be 0. +config ENV_SPI_CS + int "Value of SPI flash chip select for environment" + depends on USE_ENV_SPI_CS + help + Value of the SPI chip select for environment. - - CONFIG_ENV_SPI_MAX_HZ (optional): +config USE_ENV_SPI_MAX_HZ + bool "SPI flash bus for environment" + depends on ENV_IS_IN_SPI_FLASH + help + Force the SPI max work clock for environment. + If not defined, use CONFIG_SF_DEFAULT_SPEED. - Define the SPI max work clock. If not defined then use 1MHz. +config ENV_SPI_MAX_HZ + int "Value of SPI flash max work for environment" + depends on USE_ENV_SPI_MAX_HZ + help + Value of the SPI max work clock for environment. - - CONFIG_ENV_SPI_MODE (optional): +config USE_ENV_SPI_MODE + bool "SPI flash mode for environment" + depends on ENV_IS_IN_SPI_FLASH + help + Force the SPI work mode for environment. - Define the SPI work mode. If not defined then use SPI_MODE_3. +config ENV_SPI_MODE + hex "Value of SPI flash work mode for environment" + depends on USE_ENV_SPI_MODE + help + Value of the SPI work mode for environment. + See include/spi.h for value. config ENV_IS_IN_UBI bool "Environment in a UBI volume" diff --git a/env/sf.c b/env/sf.c index 23cbad5..4f92ae0 100644 --- a/env/sf.c +++ b/env/sf.c @@ -18,19 +18,6 @@ #include #include -#ifndef CONFIG_ENV_SPI_BUS -# define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS -#endif -#ifndef CONFIG_ENV_SPI_CS -# define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS -#endif -#ifndef CONFIG_ENV_SPI_MAX_HZ -# define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED -#endif -#ifndef CONFIG_ENV_SPI_MODE -# define CONFIG_ENV_SPI_MODE CONFIG_SF_DEFAULT_MODE -#endif - #ifndef CONFIG_SPL_BUILD #define CMD_SAVEENV #define INITENV -- cgit v1.1