[U-Boot] [PATCH] common: env_sf: Use CONFIG_SF_DEFAULT_xxx as the default value for CONFIG_ENV_SPI_xxx

Jean-Jacques Hiblot jjhiblot at ti.com
Wed Feb 1 14:51:47 CET 2017


The default values for the configuration defines CONFIG_ENV_SPI_xxx are
arbitrary values. It makes more sense to set them to the values used by
the sf command.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot at ti.com>
---

On DRA7 evm, reading the environment doesn't work in the SPL because
CONFIG_ENV_SPI_MODE is not defined in dra7xx_evm.h.
Instead of defining CONFIG_ENV_SPI_MODE there along CONFIG_SF_DEFAULT_MODE,
I propose that the default value for CONFIG_ENV_SPI_MODE is set to 
CONFIG_SF_DEFAULT_MODE. IMO it makes no real sense to have different values
for both defines.

And the same goes for the other default values:
* CONFIG_ENV_SPI_BUS
* CONFIG_ENV_SPI_CS
* CONFIG_ENV_SPI_MAX_HZ

For the platforms that do not define some of the CONFIG_SF_DEFAULT_xxx, it
has no impact as the default values are the same:
# define CONFIG_SF_DEFAULT_SPEED	1000000
# define CONFIG_SF_DEFAULT_MODE		SPI_MODE_3
# define CONFIG_SF_DEFAULT_CS		0
# define CONFIG_SF_DEFAULT_BUS		0



 common/env_sf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/common/env_sf.c b/common/env_sf.c
index c53200f..27b4d12 100644
--- a/common/env_sf.c
+++ b/common/env_sf.c
@@ -19,16 +19,16 @@
 #include <dm/device-internal.h>
 
 #ifndef CONFIG_ENV_SPI_BUS
-# define CONFIG_ENV_SPI_BUS	0
+# define CONFIG_ENV_SPI_BUS	CONFIG_SF_DEFAULT_BUS
 #endif
 #ifndef CONFIG_ENV_SPI_CS
-# define CONFIG_ENV_SPI_CS	0
+# define CONFIG_ENV_SPI_CS	CONFIG_SF_DEFAULT_CS
 #endif
 #ifndef CONFIG_ENV_SPI_MAX_HZ
-# define CONFIG_ENV_SPI_MAX_HZ	1000000
+# define CONFIG_ENV_SPI_MAX_HZ	CONFIG_SF_DEFAULT_SPEED
 #endif
 #ifndef CONFIG_ENV_SPI_MODE
-# define CONFIG_ENV_SPI_MODE	SPI_MODE_3
+# define CONFIG_ENV_SPI_MODE	CONFIG_SF_DEFAULT_MODE
 #endif
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-- 
1.9.1



More information about the U-Boot mailing list