From 04e42a0db476312b9a767a2b3a2312f49d19ca0b Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 23 Oct 2014 10:39:02 +0200 Subject: 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. --- board/toradex/colibri_vf/Makefile | 1 + board/toradex/colibri_vf/colibri_vf.c | 7 +++++++ board/toradex/common/configblock.c | 7 +++++++ include/configs/colibri_vf.h | 7 +++++++ 4 files changed, 22 insertions(+) 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 #include +#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 #include +#include 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 -- cgit v1.2.3