From 6880142636037a19f893e454ef4c8e5467e62337 Mon Sep 17 00:00:00 2001 From: Siva Durga Prasad Paladugu Date: Fri, 14 Mar 2014 18:51:19 +0530 Subject: [PATCH] zynq: Add support to store environment in EEPROM Added support to store environment in EEPROM. Set the mux to select EEPROM during board init so that the env can be read from EEPROM later. Signed-off-by: Siva Durga Prasad Paladugu Signed-off-by: Michal Simek --- board/xilinx/zynq/board.c | 7 +++++++ include/configs/zynq-common.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c index 52fbeb88063..037154a5f9b 100644 --- a/board/xilinx/zynq/board.c +++ b/board/xilinx/zynq/board.c @@ -28,6 +28,9 @@ Xilinx_desc fpga100 = XILINX_XC7Z100_DESC(0x100); int board_init(void) { +#if defined(CONFIG_ENV_IS_IN_EEPROM) && !defined(CONFIG_SPL_BUILD) + unsigned char eepromsel = CONFIG_SYS_I2C_MUX_EEPROM_SEL; +#endif #ifdef CONFIG_FPGA u32 idcode; @@ -64,6 +67,10 @@ int board_init(void) (defined(CONFIG_SPL_FPGA_SUPPORT) && defined(CONFIG_SPL_BUILD)) fpga_init(); fpga_add(fpga_xilinx, &fpga); +#endif +#if defined(CONFIG_ENV_IS_IN_EEPROM) && !defined(CONFIG_SPL_BUILD) + if (eeprom_write(CONFIG_SYS_I2C_MUX_ADDR, 0, &eepromsel, 1)) + puts("I2C:EEPROM selection failed\n"); #endif return 0; } diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h index 662a4784e12..c0d24a3e16e 100644 --- a/include/configs/zynq-common.h +++ b/include/configs/zynq-common.h @@ -147,6 +147,8 @@ # define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 4 # define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5 # define CONFIG_SYS_EEPROM_SIZE 1024 /* Bytes */ +# define CONFIG_SYS_I2C_MUX_ADDR 0x74 +# define CONFIG_SYS_I2C_MUX_EEPROM_SEL 0x4 #endif /* Total Size of Environment Sector */ -- 2.47.3