[U-Boot] [PATCH v2 4/6] apalis/colibri_imx7/pxa270/t20/t30/vf: integrate config block handling

Marcel Ziswiler marcel.ziswiler at toradex.com
Wed Sep 28 11:35:06 CEST 2016


With our common code in place actually make use of it across all our
modules.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler at toradex.com>
---

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 ++++++++++++++
 board/toradex/common/Kconfig                  |  5 +++++
 include/configs/apalis_t30.h                  |  4 ++--
 include/configs/colibri_imx7.h                |  6 +++++-
 include/configs/colibri_pxa270.h              |  7 +++++--
 include/configs/colibri_t20.h                 |  2 +-
 include/configs/colibri_t30.h                 |  4 ++--
 include/configs/colibri_vf.h                  |  7 ++++---
 17 files changed, 152 insertions(+), 13 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..bf13053 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 <marcel at ziswiler.com>
  *
  * 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_RETRY		3
 
@@ -29,6 +31,14 @@ int arch_misc_init(void)
 	return 0;
 }
 
+int checkboard_fallback(void)
+{
+	printf("Model: Toradex Apalis T30 %dGB\n",
+	       (gd->ram_size == 0x40000000) ? 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..5737363 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 <marek.vasut at gmail.com>
+ * Copyright (C) 2016 Marcel Ziswiler <marcel.ziswiler at toradex.com>
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
@@ -32,6 +33,13 @@ int board_init(void)
 	return 0;
 }
 
+int checkboard_fallback(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 TDX_CFG_BLOCK
+	default y
+
+config TDX_HAVE_NAND
+	default y
+
+config TDX_CFG_BLOCK_OFFSET
+	default "3145728"
+
+source "board/toradex/common/Kconfig"
+
 endif
diff --git a/board/toradex/colibri_t20/colibri_t20.c b/board/toradex/colibri_t20/colibri_t20.c
index 68fbf49..24988eb 100644
--- a/board/toradex/colibri_t20/colibri_t20.c
+++ b/board/toradex/colibri_t20/colibri_t20.c
@@ -14,6 +14,9 @@
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <i2c.h>
+#include <nand.h>
+
+DECLARE_GLOBAL_DATA_PTR;
 
 #define PMU_I2C_ADDRESS		0x34
 #define MAX_I2C_RETRY		3
@@ -61,6 +64,16 @@ int arch_misc_init(void)
 	return 0;
 }
 
+int checkboard_fallback(void)
+{
+	printf("Model: Toradex Colibri T20 %dMB V%s\n",
+	       (gd->ram_size == 0x10000000) ? 256 : 512,
+	       (nand_info[0]->erasesize >> 10 == 512) ?
+	       ((gd->ram_size == 0x10000000) ? "1.1B" : "1.1C") : "1.2A");
+
+	return 0;
+}
+
 #ifdef CONFIG_TEGRA_MMC
 /*
  * Routine: pin_mux_mmc
diff --git a/board/toradex/colibri_t30/Kconfig b/board/toradex/colibri_t30/Kconfig
index 3e436a2..68ef82b 100644
--- a/board/toradex/colibri_t30/Kconfig
+++ b/board/toradex/colibri_t30/Kconfig
@@ -9,4 +9,22 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
 	default "colibri_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/colibri_t30/colibri_t30.c b/board/toradex/colibri_t30/colibri_t30.c
index e32362a..0c8ca5f 100644
--- a/board/toradex/colibri_t30/colibri_t30.c
+++ b/board/toradex/colibri_t30/colibri_t30.c
@@ -1,5 +1,5 @@
 /*
- *  (C) Copyright 2014
+ *  (C) Copyright 2014-2016
  *  Stefan Agner <stefan at agner.ch>
  *
  * SPDX-License-Identifier:	GPL-2.0+
@@ -24,6 +24,13 @@ int arch_misc_init(void)
 	return 0;
 }
 
+int checkboard_fallback(void)
+{
+	puts("Model: Toradex Colibri T30 1GB\n");
+
+	return 0;
+}
+
 /*
  * Routine: pinmux_init
  * Description: Do individual peripheral pinmux configs
diff --git a/board/toradex/colibri_vf/Kconfig b/board/toradex/colibri_vf/Kconfig
index 2c3cb30..bf9bb01 100644
--- a/board/toradex/colibri_vf/Kconfig
+++ b/board/toradex/colibri_vf/Kconfig
@@ -15,4 +15,18 @@ config SYS_SOC
 config SYS_CONFIG_NAME
 	default "colibri_vf"
 
+config TDX_CFG_BLOCK
+	default y
+
+config TDX_HAVE_NAND
+	default y
+
+config TDX_CFG_BLOCK_OFFSET
+	default "2048"
+
+config TDX_CFG_BLOCK_2ND_ETHADDR
+	default y
+
+source "board/toradex/common/Kconfig"
+
 endif
diff --git a/board/toradex/common/Kconfig b/board/toradex/common/Kconfig
index e269875..6278bcc 100644
--- a/board/toradex/common/Kconfig
+++ b/board/toradex/common/Kconfig
@@ -8,12 +8,17 @@ config CUSTOM_BOARDINFO
 menuconfig TDX_CFG_BLOCK
 	bool "Enable Toradex config block support"
 	select OF_BOARD_SETUP
+	select CUSTOM_BOARDINFO
 	help
 	  The Toradex config block stored production data on the on-module
 	  flash device (NAND, NOR or eMMC). The area is normally preserved by
 	  software and contains the serial number (out of which the MAC
 	  address is generated) and the exact module type.
 
+# Not from device tree model node
+config CUSTOM_BOARDINFO
+	bool
+
 # Helper config to determine the correct default location of the cfg block
 config TDX_HAVE_MMC
 	bool
diff --git a/include/configs/apalis_t30.h b/include/configs/apalis_t30.h
index dc17733..1a22973 100644
--- a/include/configs/apalis_t30.h
+++ b/include/configs/apalis_t30.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015 Marcel Ziswiler
+ * Copyright (c) 2014-2016 Marcel Ziswiler
  *
  * Configuration settings for the Toradex Apalis T30 modules.
  *
@@ -16,8 +16,8 @@
 #define CONFIG_ARCH_MISC_INIT
 
 /* High-level configuration options */
-#define CONFIG_TEGRA_BOARD_STRING	"Toradex Apalis T30"
 #undef CONFIG_DISPLAY_BOARDINFO		/* As defined in tegra-common */
+#define CONFIG_DISPLAY_BOARDINFO_LATE	/* Calls checkboard() */
 
 /* Board-specific serial config */
 #define CONFIG_TEGRA_ENABLE_UARTA
diff --git a/include/configs/colibri_imx7.h b/include/configs/colibri_imx7.h
index 16ae952..b659d53 100644
--- a/include/configs/colibri_imx7.h
+++ b/include/configs/colibri_imx7.h
@@ -21,10 +21,14 @@
 /*#define CONFIG_DBG_MONITOR*/
 #define PHYS_SDRAM_SIZE			SZ_512M
 
+#define CONFIG_ARCH_MISC_INIT
 #define CONFIG_BOARD_EARLY_INIT_F
 #define CONFIG_BOARD_LATE_INIT
 
-#define CONFIG_DISPLAY_BOARDINFO_LATE
+#define CONFIG_DISPLAY_BOARDINFO_LATE	/* Calls checkboard() */
+
+#define CONFIG_ENV_VARS_UBOOT_CONFIG
+#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN		(32 * SZ_1M)
diff --git a/include/configs/colibri_pxa270.h b/include/configs/colibri_pxa270.h
index ba8d93c..7a100de 100644
--- a/include/configs/colibri_pxa270.h
+++ b/include/configs/colibri_pxa270.h
@@ -2,7 +2,7 @@
  * Toradex Colibri PXA270 configuration file
  *
  * Copyright (C) 2010 Marek Vasut <marek.vasut at gmail.com>
- * Copyright (C) 2015 Marcel Ziswiler <marcel at ziswiler.com>
+ * Copyright (C) 2015-2016 Marcel Ziswiler <marcel at ziswiler.com>
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
@@ -21,10 +21,14 @@
 /* We will never enable dcache because we have to setup MMU first */
 #define CONFIG_SYS_DCACHE_OFF
 
+#define CONFIG_DISPLAY_BOARDINFO_LATE	/* Calls checkboard() */
+
 /*
  * Environment settings
  */
 #define	CONFIG_ENV_OVERWRITE
+#define CONFIG_ENV_VARS_UBOOT_CONFIG
+#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 #define	CONFIG_SYS_MALLOC_LEN		(128 * 1024)
 #define	CONFIG_ARCH_CPU_INIT
 #define	CONFIG_BOOTCOMMAND						\
@@ -39,7 +43,6 @@
 #define	CONFIG_TIMESTAMP
 #define	CONFIG_CMDLINE_TAG
 #define	CONFIG_SETUP_MEMORY_TAGS
-#define	CONFIG_LZMA			/* LZMA compression support */
 
 /*
  * Serial Console Configuration
diff --git a/include/configs/colibri_t20.h b/include/configs/colibri_t20.h
index 431fec0..ee5762e 100644
--- a/include/configs/colibri_t20.h
+++ b/include/configs/colibri_t20.h
@@ -14,8 +14,8 @@
 #define CONFIG_ARCH_MISC_INIT
 
 /* High-level configuration options */
-#define CONFIG_TEGRA_BOARD_STRING	"Toradex Colibri T20"
 #undef CONFIG_DISPLAY_BOARDINFO		/* As defined in tegra-common */
+#define CONFIG_DISPLAY_BOARDINFO_LATE	/* Calls checkboard() */
 
 /* Board-specific serial config */
 #define CONFIG_TEGRA_ENABLE_UARTA
diff --git a/include/configs/colibri_t30.h b/include/configs/colibri_t30.h
index d83c5a0..6b6496b 100644
--- a/include/configs/colibri_t30.h
+++ b/include/configs/colibri_t30.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2015 Stefan Agner
+ * Copyright (c) 2013-2016 Stefan Agner
  *
  * Configuration settings for the Toradex Colibri T30 modules.
  *
@@ -16,8 +16,8 @@
 #define CONFIG_ARCH_MISC_INIT
 
 /* High-level configuration options */
-#define CONFIG_TEGRA_BOARD_STRING	"Toradex Colibri T30"
 #undef CONFIG_DISPLAY_BOARDINFO		/* As defined in tegra-common */
+#define CONFIG_DISPLAY_BOARDINFO_LATE	/* Calls checkboard() */
 
 /* Board-specific serial config */
 #define CONFIG_TEGRA_ENABLE_UARTA
diff --git a/include/configs/colibri_vf.h b/include/configs/colibri_vf.h
index 597eb2c..38dbf35 100644
--- a/include/configs/colibri_vf.h
+++ b/include/configs/colibri_vf.h
@@ -1,7 +1,7 @@
 /*
- * Copyright 2015 Toradex, Inc.
+ * Copyright 2015-2016 Toradex, Inc.
  *
- * Configuration settings for the Toradex VF50/VF61 module.
+ * Configuration settings for the Toradex VF50/VF61 modules.
  *
  * Based on vf610twr.h:
  * Copyright 2013 Freescale Semiconductor, Inc.
@@ -21,8 +21,8 @@
 #define CONFIG_SYS_FSL_CLK
 
 #define CONFIG_ARCH_MISC_INIT
+#define CONFIG_DISPLAY_BOARDINFO_LATE	/* Calls checkboard() */
 #define CONFIG_DISPLAY_CPUINFO
-#define CONFIG_DISPLAY_BOARDINFO
 
 #define CONFIG_SKIP_LOWLEVEL_INIT
 
@@ -38,6 +38,7 @@
 
 /* Allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
+#define CONFIG_ENV_VARS_UBOOT_CONFIG
 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 #define CONFIG_BAUDRATE			115200
 
-- 
2.5.5



More information about the U-Boot mailing list