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

2018-12-12 Thread Jagan Teki
On Mon, Dec 10, 2018 at 4:23 PM Patrick Delaunay
 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 
> ---
>
>  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
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


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

2018-12-10 Thread Petr Vorel
Hi Patrick,

> 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 
Reviewed-by: Petr Vorel 
> ---

>  env/Kconfig | 4 ++--
>  env/sf.c| 5 -
>  2 files changed, 6 insertions(+), 3 deletions(-)

...
> +++ 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

Maybe indent? (code style mix indent and not)
#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


Kind regards,
Petr
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


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

2018-12-10 Thread Simon Goldschmidt
On Mon, Dec 10, 2018 at 11:54 AM Patrick Delaunay
 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 
> ---
>
>  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: Simon Goldschmidt 

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


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

2018-12-10 Thread Lukasz Majewski
On Mon, 10 Dec 2018 11:52:45 +0100
Patrick Delaunay  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 
> ---
> 
>  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 


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: lu...@denx.de


pgpotDm0t1grI.pgp
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


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

2018-12-10 Thread Patrick Delaunay
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 
---

 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);
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot