[U-Boot] [PATCH 6/7] env: Read default speed and mode values from DT

Lukasz Majewski lukma at denx.de
Mon Dec 10 11:23:08 UTC 2018


On Mon, 10 Dec 2018 11:52:45 +0100
Patrick Delaunay <patrick.delaunay at st.com> wrote:

> In case of DT boot, don't read default speed and mode for SPI from
> CONFIG_*, instead read from DT node.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
> ---
> 
>  env/Kconfig | 4 ++--
>  env/sf.c    | 5 ++++-
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/env/Kconfig b/env/Kconfig
> index 9011109..0f760ce 100644
> --- a/env/Kconfig
> +++ b/env/Kconfig
> @@ -329,11 +329,11 @@ config ENV_IS_IN_SPI_FLASH
>  
>  	  Define the SPI bus and chip select. If not defined they
> will be 0. 
> -	  - CONFIG_ENV_SPI_MAX_HZ (optional):
> +	  - CONFIG_ENV_SPI_MAX_HZ (optional if !DM_SPI_FLASH):
>  
>  	  Define the SPI max work clock. If not defined then use
> 1MHz. 
> -	  - CONFIG_ENV_SPI_MODE (optional):
> +	  - CONFIG_ENV_SPI_MODE (optional if !DM_SPI_FLASH):
>  
>  	  Define the SPI work mode. If not defined then use
> SPI_MODE_3. 
> diff --git a/env/sf.c b/env/sf.c
> index 2e3c600..edd36f1 100644
> --- a/env/sf.c
> +++ b/env/sf.c
> @@ -24,12 +24,15 @@
>  #ifndef CONFIG_ENV_SPI_CS
>  # define CONFIG_ENV_SPI_CS	CONFIG_SF_DEFAULT_CS
>  #endif
> +
> +#ifndef CONFIG_DM_SPI_FLASH
>  #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
> +#endif
>  
>  #ifndef CONFIG_SPL_BUILD
>  #define CMD_SAVEENV
> @@ -58,7 +61,7 @@ static int setup_flash_device(void)
>  
>  	/* speed and mode will be read from DT */
>  	ret = spi_flash_probe_bus_cs(CONFIG_ENV_SPI_BUS,
> CONFIG_ENV_SPI_CS,
> -				     CONFIG_ENV_SPI_MAX_HZ,
> CONFIG_ENV_SPI_MODE,
> +				     0, 0,
>  				     &new);
>  	if (ret) {
>  		set_default_env("spi_flash_probe_bus_cs() failed",
> 0);

Reviewed-by: Lukasz Majewski <lukma at denx.de>


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181210/0a8388d1/attachment.sig>


More information about the U-Boot mailing list