summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2014-10-23 10:39:02 +0200
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2014-10-28 09:41:23 +0100
commit04e42a0db476312b9a767a2b3a2312f49d19ca0b (patch)
treef921cd1e8b0d280ff675bb9ba49f252eb981cb5c
parentd118bc314f2889c52686951165576181b6a4adc8 (diff)
colibri_vf: read Toradex config block
Add Toradex config block support using the new common config block handling. Extend common config block handling to support reading from NAND too.
-rw-r--r--board/toradex/colibri_vf/Makefile1
-rw-r--r--board/toradex/colibri_vf/colibri_vf.c7
-rw-r--r--board/toradex/common/configblock.c7
-rw-r--r--include/configs/colibri_vf.h7
4 files changed, 22 insertions, 0 deletions
diff --git a/board/toradex/colibri_vf/Makefile b/board/toradex/colibri_vf/Makefile
index c7e5134ba1..efd3087577 100644
--- a/board/toradex/colibri_vf/Makefile
+++ b/board/toradex/colibri_vf/Makefile
@@ -5,3 +5,4 @@
#
obj-y := colibri_vf.o
+obj-y += ../common/configblock.o
diff --git a/board/toradex/colibri_vf/colibri_vf.c b/board/toradex/colibri_vf/colibri_vf.c
index a977f64c9f..5e990553f9 100644
--- a/board/toradex/colibri_vf/colibri_vf.c
+++ b/board/toradex/colibri_vf/colibri_vf.c
@@ -20,6 +20,8 @@
#include <netdev.h>
#include <i2c.h>
+#include "../common/configblock.h"
+
DECLARE_GLOBAL_DATA_PTR;
#define UART_PAD_CTRL (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
@@ -276,6 +278,11 @@ int board_late_init(void)
setenv("bootdelay", "-1");
}
+#ifdef CONFIG_TRDX_CFG_BLOCK
+ if (read_trdx_cfg_block())
+ printf("Missing Colibri config block\n");
+#endif
+
return 0;
}
#endif /* CONFIG_BOARD_LATE_INIT */
diff --git a/board/toradex/common/configblock.c b/board/toradex/common/configblock.c
index 5d28bc7d38..bd76b845a8 100644
--- a/board/toradex/common/configblock.c
+++ b/board/toradex/common/configblock.c
@@ -8,6 +8,7 @@
#include <malloc.h>
#include <mmc.h>
+#include <nand.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -141,6 +142,12 @@ int read_trdx_cfg_block(void)
/* Switch back to regular eMMC user partition */
mmc_switch_part(0, 0);
#endif /* CONFIG_TRDX_CFG_BLOCK_IS_IN_MMC */
+#ifdef CONFIG_TRDX_CFG_BLOCK_IS_IN_NAND
+ /* Read production parameter config block from first NAND block */
+ if (nand_read_skip_bad(&nand_info[0], CONFIG_TRDX_CFG_BLOCK_OFFSET,
+ &size, NULL, nand_info[0].size, config_block))
+ return 1;
+#endif
/* Check validity */
cfg_block_ethaddr = config_block + 8;
diff --git a/include/configs/colibri_vf.h b/include/configs/colibri_vf.h
index 5aeffb037d..87aa617a57 100644
--- a/include/configs/colibri_vf.h
+++ b/include/configs/colibri_vf.h
@@ -111,6 +111,13 @@
#define CONFIG_BOOTDELAY 1
#define CONFIG_BOARD_LATE_INIT
+#define CONFIG_TRDX_CFG_BLOCK
+#define CONFIG_TRDX_CFG_BLOCK_IS_IN_NAND
+#define CONFIG_TRDX_CFG_BLOCK_OFFSET 0x800
+#define CONFIG_TRDX_CFG_BLOCK_SIZE 2048
+#define CONFIG_REVISION_TAG
+#define CONFIG_SERIAL_TAG
+
#define CONFIG_LOADADDR 0x80008000
#define CONFIG_FDTADDR 0x84000000