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

Jagan Teki jagan at amarulasolutions.com
Wed Dec 12 20:07:15 UTC 2018


On Mon, Dec 10, 2018 at 4:23 PM 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

Please try trim it for better, adding ifdef on top ifdef look, not
good. see my comment on 1/7


More information about the U-Boot mailing list