Skip to contentSkip to conversation

common: env_sf: Use CONFIG_SF_DEFAULT_xxx as the default value for CONFIG_ENV_SPI_xxx

PATCH In review Jean-Jacques Hiblot 2 participants 3 messages Feb 1, 2017 – Feb 9, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common: env_sf: Use CONFIG_SF_DEFAULT_xxx as the default value for CONFIG_ENV_SPI_xxx

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.

---

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(-)
common/env_sf.c +4 -4
index c53200f..27b4d12 100644
@@ -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
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 common: env_sf: Use CONFIG_SF_DEFAULT_xxx as the default value for CONFIG_ENV_SPI_xxx

Quoted 5 lines · Jean-Jacques Hiblot

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.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170203/441a2be5/attachment.sig>
#2 lore raw
In reply to Jean-Jacques Hiblot
Quoted 6 lines · Jean-Jacques Hiblot

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170208/7a005fbc/attachment.sig>