]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
zynq: Add support to store environment in EEPROM
authorSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Fri, 14 Mar 2014 13:21:19 +0000 (18:51 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 17 Mar 2014 13:34:16 +0000 (14:34 +0100)
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 <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
board/xilinx/zynq/board.c
include/configs/zynq-common.h

index 52fbeb880636568a3999e8dd7bb493ab19ca386e..037154a5f9bad46204b96f79a2376d348fb60b8f 100644 (file)
@@ -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;
 }
index 662a4784e128adeebdece3c6a2e24a14f373253f..c0d24a3e16ec866c38282b4d822da0c0e89528c2 100644 (file)
 # 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 */