Re: [U-Boot] [PATCH v4 5/7] apalis/colibri_imx7/pxa270/t20/t30/vf: integrate config block handling

2016-11-14 Thread Stefan Agner
Hi Marcel,

Just found an issue with this patch.

On 2016-11-07 05:36, Marcel Ziswiler wrote:
> With our common code in place actually make use of it across all our
> modules.
> 
> Signed-off-by: Marcel Ziswiler 
> Acked-by: Max Krummenacher 
> 
> ---
> 
> Changes in v4: None
> Changes in v3:
> - use checkboard() rather than checkboard_fallback()
> - drop CUSTOM_BOARDINFO
> 
> Changes in v2: None
> 
>  board/toradex/apalis_t30/Kconfig  | 18 ++
>  board/toradex/apalis_t30/apalis_t30.c | 12 +++-
>  board/toradex/colibri_imx7/Kconfig| 16 
>  board/toradex/colibri_pxa270/Kconfig  | 11 +++
>  board/toradex/colibri_pxa270/colibri_pxa270.c |  8 
>  board/toradex/colibri_t20/Kconfig | 11 +++
>  board/toradex/colibri_t20/colibri_t20.c   | 13 +
>  board/toradex/colibri_t30/Kconfig | 18 ++
>  board/toradex/colibri_t30/colibri_t30.c   |  9 -
>  board/toradex/colibri_vf/Kconfig  | 14 ++
>  configs/colibri_vf_defconfig  |  1 +
>  include/configs/apalis_t30.h  |  4 ++--
>  include/configs/colibri_imx7.h|  6 +-
>  include/configs/colibri_pxa270.h  |  6 +-
>  include/configs/colibri_t20.h |  2 +-
>  include/configs/colibri_t30.h |  4 ++--
>  include/configs/colibri_vf.h  |  6 --
>  17 files changed, 148 insertions(+), 11 deletions(-)
> 
> diff --git a/board/toradex/apalis_t30/Kconfig 
> b/board/toradex/apalis_t30/Kconfig
> index f1dcda5..16224da 100644
> --- a/board/toradex/apalis_t30/Kconfig
> +++ b/board/toradex/apalis_t30/Kconfig
> @@ -9,4 +9,22 @@ config SYS_VENDOR
>  config SYS_CONFIG_NAME
>   default "apalis_t30"
>  
> +config TDX_CFG_BLOCK
> + default y
> +
> +config TDX_HAVE_MMC
> + default y
> +
> +config TDX_CFG_BLOCK_DEV
> + default "0"
> +
> +config TDX_CFG_BLOCK_PART
> + default "1"
> +
> +# Toradex config block in eMMC, at the end of 1st "boot sector"
> +config TDX_CFG_BLOCK_OFFSET
> + default "-512"
> +
> +source "board/toradex/common/Kconfig"

Sourcing the common Kconfig in every board file leads to multiple
entries (e.g. make menuconfig looks rather crowded).

I just checked Documentation/kbuild/kconfig-language.txt, you can't
conditionally include a Kconfig file. It will always include it, that
seems to cause the issue.

I suggest to just add it to arch/arm/Kconfig once, there are some other
"common" includes already.

--
Stefan

> +
>  endif
> diff --git a/board/toradex/apalis_t30/apalis_t30.c
> b/board/toradex/apalis_t30/apalis_t30.c
> index 3f56971..3d83491 100644
> --- a/board/toradex/apalis_t30/apalis_t30.c
> +++ b/board/toradex/apalis_t30/apalis_t30.c
> @@ -1,5 +1,5 @@
>  /*
> - *  (C) Copyright 2014
> + *  (C) Copyright 2014-2016
>   *  Marcel Ziswiler 
>   *
>   * SPDX-License-Identifier:  GPL-2.0+
> @@ -17,6 +17,8 @@
>  
>  #include "pinmux-config-apalis_t30.h"
>  
> +DECLARE_GLOBAL_DATA_PTR;
> +
>  #define PMU_I2C_ADDRESS  0x2D
>  #define MAX_I2C_RETRY3
>  
> @@ -29,6 +31,14 @@ int arch_misc_init(void)
>   return 0;
>  }
>  
> +int checkboard(void)
> +{
> + printf("Model: Toradex Apalis T30 %dGB\n",
> +(gd->ram_size == 0x4000) ? 1 : 2);
> +
> + return 0;
> +}
> +
>  /*
>   * Routine: pinmux_init
>   * Description: Do individual peripheral pinmux configs
> diff --git a/board/toradex/colibri_imx7/Kconfig
> b/board/toradex/colibri_imx7/Kconfig
> index 7bba26b..414a600 100644
> --- a/board/toradex/colibri_imx7/Kconfig
> +++ b/board/toradex/colibri_imx7/Kconfig
> @@ -16,5 +16,21 @@ config COLIBRI_IMX7_EXT_PHYCLK
> clock source.
>   default y
>  
> +config TDX_CFG_BLOCK
> + default y
> +
> +config TDX_HAVE_NAND
> + default y
> +
> +config TDX_CFG_BLOCK_OFFSET
> + default "2048"
> +
> +config TDX_CFG_BLOCK_OFFSET2
> + default "133120"
> +
> +config TDX_CFG_BLOCK_2ND_ETHADDR
> + default y
> +
> +source "board/toradex/common/Kconfig"
>  
>  endif
> diff --git a/board/toradex/colibri_pxa270/Kconfig
> b/board/toradex/colibri_pxa270/Kconfig
> index 949407a..f646baa 100644
> --- a/board/toradex/colibri_pxa270/Kconfig
> +++ b/board/toradex/colibri_pxa270/Kconfig
> @@ -9,4 +9,15 @@ config SYS_VENDOR
>  config SYS_CONFIG_NAME
>   default "colibri_pxa270"
>  
> +config TDX_CFG_BLOCK
> + default y
> +
> +config TDX_HAVE_NOR
> + default y
> +
> +config TDX_CFG_BLOCK_OFFSET
> + default "262144"
> +
> +source "board/toradex/common/Kconfig"
> +
>  endif
> diff --git a/board/toradex/colibri_pxa270/colibri_pxa270.c
> b/board/toradex/colibri_pxa270/colibri_pxa270.c
> index 3def0a6..de8cb28 100644
> --- a/board/toradex/colibri_pxa270/colibri_pxa270.c
> +++ b/board/toradex/colibri_pxa270/colibri_pxa270.c
> 

[U-Boot] [PATCH v4 5/7] apalis/colibri_imx7/pxa270/t20/t30/vf: integrate config block handling

2016-11-07 Thread Marcel Ziswiler
With our common code in place actually make use of it across all our
modules.

Signed-off-by: Marcel Ziswiler 
Acked-by: Max Krummenacher 

---

Changes in v4: None
Changes in v3:
- use checkboard() rather than checkboard_fallback()
- drop CUSTOM_BOARDINFO

Changes in v2: None

 board/toradex/apalis_t30/Kconfig  | 18 ++
 board/toradex/apalis_t30/apalis_t30.c | 12 +++-
 board/toradex/colibri_imx7/Kconfig| 16 
 board/toradex/colibri_pxa270/Kconfig  | 11 +++
 board/toradex/colibri_pxa270/colibri_pxa270.c |  8 
 board/toradex/colibri_t20/Kconfig | 11 +++
 board/toradex/colibri_t20/colibri_t20.c   | 13 +
 board/toradex/colibri_t30/Kconfig | 18 ++
 board/toradex/colibri_t30/colibri_t30.c   |  9 -
 board/toradex/colibri_vf/Kconfig  | 14 ++
 configs/colibri_vf_defconfig  |  1 +
 include/configs/apalis_t30.h  |  4 ++--
 include/configs/colibri_imx7.h|  6 +-
 include/configs/colibri_pxa270.h  |  6 +-
 include/configs/colibri_t20.h |  2 +-
 include/configs/colibri_t30.h |  4 ++--
 include/configs/colibri_vf.h  |  6 --
 17 files changed, 148 insertions(+), 11 deletions(-)

diff --git a/board/toradex/apalis_t30/Kconfig b/board/toradex/apalis_t30/Kconfig
index f1dcda5..16224da 100644
--- a/board/toradex/apalis_t30/Kconfig
+++ b/board/toradex/apalis_t30/Kconfig
@@ -9,4 +9,22 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "apalis_t30"
 
+config TDX_CFG_BLOCK
+   default y
+
+config TDX_HAVE_MMC
+   default y
+
+config TDX_CFG_BLOCK_DEV
+   default "0"
+
+config TDX_CFG_BLOCK_PART
+   default "1"
+
+# Toradex config block in eMMC, at the end of 1st "boot sector"
+config TDX_CFG_BLOCK_OFFSET
+   default "-512"
+
+source "board/toradex/common/Kconfig"
+
 endif
diff --git a/board/toradex/apalis_t30/apalis_t30.c 
b/board/toradex/apalis_t30/apalis_t30.c
index 3f56971..3d83491 100644
--- a/board/toradex/apalis_t30/apalis_t30.c
+++ b/board/toradex/apalis_t30/apalis_t30.c
@@ -1,5 +1,5 @@
 /*
- *  (C) Copyright 2014
+ *  (C) Copyright 2014-2016
  *  Marcel Ziswiler 
  *
  * SPDX-License-Identifier:GPL-2.0+
@@ -17,6 +17,8 @@
 
 #include "pinmux-config-apalis_t30.h"
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #define PMU_I2C_ADDRESS0x2D
 #define MAX_I2C_RETRY  3
 
@@ -29,6 +31,14 @@ int arch_misc_init(void)
return 0;
 }
 
+int checkboard(void)
+{
+   printf("Model: Toradex Apalis T30 %dGB\n",
+  (gd->ram_size == 0x4000) ? 1 : 2);
+
+   return 0;
+}
+
 /*
  * Routine: pinmux_init
  * Description: Do individual peripheral pinmux configs
diff --git a/board/toradex/colibri_imx7/Kconfig 
b/board/toradex/colibri_imx7/Kconfig
index 7bba26b..414a600 100644
--- a/board/toradex/colibri_imx7/Kconfig
+++ b/board/toradex/colibri_imx7/Kconfig
@@ -16,5 +16,21 @@ config COLIBRI_IMX7_EXT_PHYCLK
  clock source.
default y
 
+config TDX_CFG_BLOCK
+   default y
+
+config TDX_HAVE_NAND
+   default y
+
+config TDX_CFG_BLOCK_OFFSET
+   default "2048"
+
+config TDX_CFG_BLOCK_OFFSET2
+   default "133120"
+
+config TDX_CFG_BLOCK_2ND_ETHADDR
+   default y
+
+source "board/toradex/common/Kconfig"
 
 endif
diff --git a/board/toradex/colibri_pxa270/Kconfig 
b/board/toradex/colibri_pxa270/Kconfig
index 949407a..f646baa 100644
--- a/board/toradex/colibri_pxa270/Kconfig
+++ b/board/toradex/colibri_pxa270/Kconfig
@@ -9,4 +9,15 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "colibri_pxa270"
 
+config TDX_CFG_BLOCK
+   default y
+
+config TDX_HAVE_NOR
+   default y
+
+config TDX_CFG_BLOCK_OFFSET
+   default "262144"
+
+source "board/toradex/common/Kconfig"
+
 endif
diff --git a/board/toradex/colibri_pxa270/colibri_pxa270.c 
b/board/toradex/colibri_pxa270/colibri_pxa270.c
index 3def0a6..de8cb28 100644
--- a/board/toradex/colibri_pxa270/colibri_pxa270.c
+++ b/board/toradex/colibri_pxa270/colibri_pxa270.c
@@ -2,6 +2,7 @@
  * Toradex Colibri PXA270 Support
  *
  * Copyright (C) 2010 Marek Vasut 
+ * Copyright (C) 2016 Marcel Ziswiler 
  *
  * SPDX-License-Identifier:GPL-2.0+
  */
@@ -32,6 +33,13 @@ int board_init(void)
return 0;
 }
 
+int checkboard(void)
+{
+   puts("Model: Toradex Colibri PXA270\n");
+
+   return 0;
+}
+
 int dram_init(void)
 {
pxa2xx_dram_init();
diff --git a/board/toradex/colibri_t20/Kconfig 
b/board/toradex/colibri_t20/Kconfig
index 7f373b2..a43acdd 100644
--- a/board/toradex/colibri_t20/Kconfig
+++ b/board/toradex/colibri_t20/Kconfig
@@ -9,4 +9,15 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "colibri_t20"
 
+config