board: Arcturus: DM: Disable drivers without DM support.
authorOleksandr Zhadan <oleks@arcturusnetworks.com>
Mon, 17 Jun 2019 20:10:23 +0000 (16:10 -0400)
committerTom Rini <trini@konsulko.com>
Fri, 21 Jun 2019 14:07:11 +0000 (10:07 -0400)
Extra "not DM" controllers support is disabled.
u-boot BSP still good enough to upgrade and run images.

Signed-off-by: Oleksandr Zhadan <oleks@arcturusnetworks.com>
Signed-off-by: Michael Durrant <mdurrant@arcturusnetworks.com>
board/Arcturus/ucp1020/cmd_arc.c
board/Arcturus/ucp1020/ucp1020.c
board/Arcturus/ucp1020/ucp1020.h
configs/UCP1020_defconfig
include/configs/UCP1020.h

index 9579d52ffde34844057e69d81945c897fd2de870..7a510c61fb015c5d9c08a149f247b4e1e6e2e0bd 100644 (file)
@@ -2,8 +2,8 @@
 /*
  * Command for accessing Arcturus factory environment.
  *
- * Copyright 2013-2015 Arcturus Networks Inc.
- *           http://www.arcturusnetworks.com/products/ucp1020/
+ * Copyright 2013-2019 Arcturus Networks Inc.
+ *           https://www.arcturusnetworks.com/products/
  *           by Oleksandr G Zhadan et al.
  *
  */
 #include <div64.h>
 #include <malloc.h>
 #include <spi_flash.h>
-
+#include <mmc.h>
+#include <version.h>
+#include <environment.h>
 #include <asm/io.h>
 
-#define MAX_SERIAL_SIZE 15
-#define MAX_HWADDR_SIZE 17
-
-#define FIRM_ADDR1 (0x200 - sizeof(smac))
-#define FIRM_ADDR2 (0x400 - sizeof(smac))
-#define FIRM_ADDR3 (CONFIG_ENV_SECT_SIZE + 0x200 - sizeof(smac))
-#define FIRM_ADDR4 (CONFIG_ENV_SECT_SIZE + 0x400 - sizeof(smac))
-
-static struct spi_flash *flash;
-char smac[4][18];
+static ulong fwenv_addr[MAX_FWENV_ADDR];
+const char mystrerr[] = "ERROR: Failed to save factory info";
 
 static int ishwaddr(char *hwaddr)
 {
@@ -38,156 +32,349 @@ static int ishwaddr(char *hwaddr)
        return -1;
 }
 
-static int set_arc_product(int argc, char *const argv[])
+#if (FWENV_TYPE == FWENV_MMC)
+
+static char smac[29][18] __attribute__ ((aligned(0x200)));     /* 1 MMC block is 512 bytes */
+
+int set_mmc_arc_product(int argc, char *const argv[])
 {
-       int err = 0;
-       char *mystrerr = "ERROR: Failed to save factory info in spi location";
+       struct mmc *mmc;
+       u32 blk, cnt, n;
+       int i, err = 1;
+       void *addr;
+       const u8 mmc_dev_num = CONFIG_SYS_MMC_ENV_DEV;
+
+       mmc = find_mmc_device(mmc_dev_num);
+       if (!mmc) {
+               printf("No SD/MMC/eMMC card found\n");
+               return 0;
+       }
+       if (mmc_init(mmc)) {
+               printf("%s(%d) init failed\n", IS_SD(mmc) ? "SD" : "MMC",
+                      mmc_dev_num);
+               return 0;
+       }
+       if (mmc_getwp(mmc) == 1) {
+               printf("Error: card is write protected!\n");
+               return CMD_RET_FAILURE;
+       }
 
-       if (argc != 5)
-               return -1;
+       /* Save factory defaults */
+       addr = (void *)smac;
+       cnt = 1;                /* One 512 bytes block */
+
+       for (i = 0; i < MAX_FWENV_ADDR; i++)
+               if (fwenv_addr[i] != -1) {
+                       blk = fwenv_addr[i] / 512;
+                       n = blk_dwrite(mmc_get_blk_desc(mmc), blk, cnt, addr);
+                       if (n != cnt)
+                               printf("%s: %s [%d]\n", __func__, mystrerr, i);
+                       else
+                               err = 0;
+               }
+       if (err)
+               return -2;
 
-       /* Check serial number */
-       if (strlen(argv[1]) != MAX_SERIAL_SIZE)
-               return -1;
+       return err;
+}
 
-       /* Check HWaddrs */
-       if (ishwaddr(argv[2]) || ishwaddr(argv[3]) || ishwaddr(argv[4]))
-               return -1;
+static int read_mmc_arc_info(void)
+{
+       struct mmc *mmc;
+       u32 blk, cnt, n;
+       int i;
+       void *addr;
+       const u8 mmc_dev_num = CONFIG_SYS_MMC_ENV_DEV;
+
+       mmc = find_mmc_device(mmc_dev_num);
+       if (!mmc) {
+               printf("No SD/MMC/eMMC card found\n");
+               return 0;
+       }
+       if (mmc_init(mmc)) {
+               printf("%s(%d) init failed\n", IS_SD(mmc) ? "SD" : "MMC",
+                      mmc_dev_num);
+               return 0;
+       }
 
-       strcpy(smac[3], argv[1]);
-       strcpy(smac[2], argv[2]);
-       strcpy(smac[1], argv[3]);
-       strcpy(smac[0], argv[4]);
+       addr = (void *)smac;
+       cnt = 1;                /* One 512 bytes block */
 
-       flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
-                               CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
+       for (i = 0; i < MAX_FWENV_ADDR; i++)
+               if (fwenv_addr[i] != -1) {
+                       blk = fwenv_addr[i] / 512;
+                       n = blk_dread(mmc_get_blk_desc(mmc), blk, cnt, addr);
+                       flush_cache((ulong) addr, 512);
+                       if (n == cnt)
+                               return (i + 1);
+               }
+       return 0;
+}
+#endif
 
-       /*
-        * Save factory defaults
-        */
+#if (FWENV_TYPE == FWENV_SPI_FLASH)
 
-       if (spi_flash_write(flash, FIRM_ADDR1, sizeof(smac), smac)) {
-               printf("%s: %s [1]\n", __func__, mystrerr);
-               err++;
-       }
-       if (spi_flash_write(flash, FIRM_ADDR2, sizeof(smac), smac)) {
-               printf("%s: %s [2]\n", __func__, mystrerr);
-               err++;
-       }
+static struct spi_flash *flash;
+static char smac[4][18];
 
-       if (spi_flash_write(flash, FIRM_ADDR3, sizeof(smac), smac)) {
-               printf("%s: %s [3]\n", __func__, mystrerr);
-               err++;
-       }
+int set_spi_arc_product(int argc, char *const argv[])
+{
+       int i, err = 1;
 
-       if (spi_flash_write(flash, FIRM_ADDR4, sizeof(smac), smac)) {
-               printf("%s: %s [4]\n", __func__, mystrerr);
-               err++;
+       flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
+                               CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
+       if (!flash) {
+               printf("Failed to initialize SPI flash at %u:%u\n",
+                      CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS);
+               return -1;
        }
 
-       if (err == 4) {
-               printf("%s: %s [ALL]\n", __func__, mystrerr);
+       /* Save factory defaults */
+       for (i = 0; i < MAX_FWENV_ADDR; i++)
+               if (fwenv_addr[i] != -1)
+                       if (spi_flash_write
+                           (flash, fwenv_addr[i], sizeof(smac), smac))
+                               printf("%s: %s [%d]\n", __func__, mystrerr, i);
+                       else
+                               err = 0;
+       if (err)
                return -2;
-       }
 
-       return 0;
+       return err;
 }
 
-int get_arc_info(void)
+static int read_spi_arc_info(void)
 {
-       int location = 1;
-       char *myerr = "ERROR: Failed to read all 4 factory info spi locations";
+       int i;
 
        flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
                                CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
+       if (!flash) {
+               printf("Failed to initialize SPI flash at %u:%u\n",
+                      CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS);
+               return 0;
+       }
+       for (i = 0; i < MAX_FWENV_ADDR; i++)
+               if (fwenv_addr[i] != -1)
+                       if (!spi_flash_read
+                           (flash, fwenv_addr[i], sizeof(smac), smac))
+                               return (i + 1);
+       return 0;
+}
+#endif
+
+#if (FWENV_TYPE == FWENV_NOR_FLASH)
 
-       if (spi_flash_read(flash, FIRM_ADDR1, sizeof(smac), smac)) {
-               location++;
-               if (spi_flash_read(flash, FIRM_ADDR2, sizeof(smac), smac)) {
-                       location++;
-                       if (spi_flash_read(flash, FIRM_ADDR3, sizeof(smac),
-                                          smac)) {
-                               location++;
-                               if (spi_flash_read(flash, FIRM_ADDR4,
-                                                  sizeof(smac), smac)) {
-                                       printf("%s: %s\n", __func__, myerr);
-                                       return -2;
-                               }
-                       }
+static char smac[4][18];
+
+int set_nor_arc_product(int argc, char *const argv[])
+{
+       int i, err = 1;
+
+       /* Save factory defaults */
+       for (i = 0; i < MAX_FWENV_ADDR; i++)
+               if (fwenv_addr[i] != -1) {
+                       ulong fwenv_end = fwenv_addr[i] + 4;
+
+                       flash_sect_roundb(&fwenv_end);
+                       flash_sect_protect(0, fwenv_addr[i], fwenv_end);
+                       if (flash_write
+                           ((char *)smac, fwenv_addr[i], sizeof(smac)))
+                               printf("%s: %s [%d]\n", __func__, mystrerr, i);
+                       else
+                               err = 0;
+                       flash_sect_protect(1, fwenv_addr[i], fwenv_end);
                }
-       }
-       if (smac[3][0] != 0) {
-               if (location > 1)
-                       printf("Using region %d\n", location);
-               printf("SERIAL: ");
-               if (smac[3][0] == 0xFF) {
-                       printf("\t<not found>\n");
-               } else {
-                       printf("\t%s\n", smac[3]);
-                       env_set("SERIAL", smac[3]);
+       if (err)
+               return -2;
+
+       return err;
+}
+
+static int read_nor_arc_info(void)
+{
+       int i;
+
+       for (i = 0; i < MAX_FWENV_ADDR; i++)
+               if (fwenv_addr[i] != -1) {
+                       memcpy(smac, (void *)fwenv_addr[i], sizeof(smac));
+                       return (i + 1);
                }
+
+       return 0;
+}
+#endif
+
+int set_arc_product(int argc, char *const argv[])
+{
+       if (argc != 5)
+               return -1;
+
+       /* Check serial number */
+       if (strlen(argv[1]) != MAX_SERIAL_SIZE)
+               return -1;
+
+       /* Check HWaddrs */
+       if (ishwaddr(argv[2]) || ishwaddr(argv[3]) || ishwaddr(argv[4]))
+               return -1;
+
+       strcpy(smac[0], argv[1]);
+       strcpy(smac[1], argv[2]);
+       strcpy(smac[2], argv[3]);
+       strcpy(smac[3], argv[4]);
+
+#if (FWENV_TYPE == FWENV_NOR_FLASH)
+       return set_nor_arc_product(argc, argv);
+#endif
+#if (FWENV_TYPE == FWENV_SPI_FLASH)
+       return set_spi_arc_product(argc, argv);
+#endif
+#if (FWENV_TYPE == FWENV_MMC)
+       return set_mmc_arc_product(argc, argv);
+#endif
+       return -2;
+}
+
+static int read_arc_info(void)
+{
+#if (FWENV_TYPE == FWENV_NOR_FLASH)
+       return read_nor_arc_info();
+#endif
+#if (FWENV_TYPE == FWENV_SPI_FLASH)
+       return read_spi_arc_info();
+#endif
+#if (FWENV_TYPE == FWENV_MMC)
+       return read_mmc_arc_info();
+#endif
+       return 0;
+}
+
+static int do_get_arc_info(void)
+{
+       int l = read_arc_info();
+       char *oldserial = env_get("SERIAL");
+       char *oldversion = env_get("VERSION");
+
+       if (oldversion != NULL)
+               if (strcmp(oldversion, U_BOOT_VERSION) != 0)
+                       oldversion = NULL;
+
+       if (l == 0) {
+               printf("%s: failed to read factory info\n", __func__);
+               return -2;
        }
 
-       if (strcmp(smac[2], "00:00:00:00:00:00") == 0)
-               return 0;
+       printf("\rSERIAL:  ");
+       if (smac[0][0] == EMPY_CHAR) {
+               printf("<not found>\n");
+       } else {
+               printf("%s\n", smac[0]);
+               env_set("SERIAL", smac[0]);
+       }
 
-       printf("HWADDR0:");
-       if (smac[2][0] == 0xFF) {
-               printf("\t<not found>\n");
+       if (strcmp(smac[1], "00:00:00:00:00:00") == 0) {
+               env_set("ethaddr", NULL);
+               env_set("eth1addr", NULL);
+               env_set("eth2addr", NULL);
+               goto done;
+       }
+
+       printf("HWADDR0: ");
+       if (smac[1][0] == EMPY_CHAR) {
+               printf("<not found>\n");
        } else {
                char *ret = env_get("ethaddr");
 
-               if (strcmp(ret, __stringify(CONFIG_ETHADDR)) == 0) {
-                       env_set("ethaddr", smac[2]);
-                       printf("\t%s (factory)\n", smac[2]);
+               if (ret == NULL) {
+                       env_set("ethaddr", smac[1]);
+                       printf("%s\n", smac[1]);
+               } else if (strcmp(ret, __stringify(CONFIG_ETHADDR)) == 0) {
+                       env_set("ethaddr", smac[1]);
+                       printf("%s (factory)\n", smac[1]);
                } else {
-                       printf("\t%s\n", ret);
+                       printf("%s\n", ret);
                }
        }
 
-       if (strcmp(smac[1], "00:00:00:00:00:00") == 0) {
-               env_set("eth1addr", smac[2]);
-               env_set("eth2addr", smac[2]);
-               return 0;
+       if (strcmp(smac[2], "00:00:00:00:00:00") == 0) {
+               env_set("eth1addr", NULL);
+               env_set("eth2addr", NULL);
+               goto done;
        }
 
-       printf("HWADDR1:");
-       if (smac[1][0] == 0xFF) {
-               printf("\t<not found>\n");
+       printf("HWADDR1: ");
+       if (smac[2][0] == EMPY_CHAR) {
+               printf("<not found>\n");
        } else {
                char *ret = env_get("eth1addr");
 
-               if (strcmp(ret, __stringify(CONFIG_ETH1ADDR)) == 0) {
-                       env_set("eth1addr", smac[1]);
-                       printf("\t%s (factory)\n", smac[1]);
+               if (ret == NULL) {
+                       env_set("ethaddr", smac[2]);
+                       printf("%s\n", smac[2]);
+               } else if (strcmp(ret, __stringify(CONFIG_ETH1ADDR)) == 0) {
+                       env_set("eth1addr", smac[2]);
+                       printf("%s (factory)\n", smac[2]);
                } else {
-                       printf("\t%s\n", ret);
+                       printf("%s\n", ret);
                }
        }
 
-       if (strcmp(smac[0], "00:00:00:00:00:00") == 0) {
-               env_set("eth2addr", smac[1]);
-               return 0;
+       if (strcmp(smac[3], "00:00:00:00:00:00") == 0) {
+               env_set("eth2addr", NULL);
+               goto done;
        }
 
-       printf("HWADDR2:");
-       if (smac[0][0] == 0xFF) {
-               printf("\t<not found>\n");
+       printf("HWADDR2: ");
+       if (smac[3][0] == EMPY_CHAR) {
+               printf("<not found>\n");
        } else {
                char *ret = env_get("eth2addr");
 
-               if (strcmp(ret, __stringify(CONFIG_ETH2ADDR)) == 0) {
-                       env_set("eth2addr", smac[0]);
-                       printf("\t%s (factory)\n", smac[0]);
+               if (ret == NULL) {
+                       env_set("ethaddr", smac[3]);
+                       printf("%s\n", smac[3]);
+               } else if (strcmp(ret, __stringify(CONFIG_ETH2ADDR)) == 0) {
+                       env_set("eth2addr", smac[3]);
+                       printf("%s (factory)\n", smac[3]);
                } else {
-                       printf("\t%s\n", ret);
+                       printf("%s\n", ret);
                }
        }
+done:
+       if (oldserial == NULL || oldversion == NULL) {
+               if (oldversion == NULL)
+                       env_set("VERSION", U_BOOT_VERSION);
+               env_save();
+       }
 
        return 0;
 }
 
-static int do_arc_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int init_fwenv(void)
+{
+       int i, ret = -1;
+
+       fwenv_addr[0] = FWENV_ADDR1;
+       fwenv_addr[1] = FWENV_ADDR2;
+       fwenv_addr[2] = FWENV_ADDR3;
+       fwenv_addr[3] = FWENV_ADDR4;
+
+       for (i = 0; i < MAX_FWENV_ADDR; i++)
+               if (fwenv_addr[i] != -1)
+                       ret = 0;
+       if (ret)
+               printf("%s: No firmfare info storage address is defined\n",
+                      __func__);
+       return ret;
+}
+
+void get_arc_info(void)
+{
+       if (!init_fwenv())
+               do_get_arc_info();
+}
+
+static int do_arc_cmd(cmd_tbl_t * cmdtp, int flag, int argc, char *const argv[])
 {
        const char *cmd;
        int ret = -1;
@@ -196,15 +383,14 @@ static int do_arc_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
        --argc;
        ++argv;
 
-       if (strcmp(cmd, "product") == 0) {
+       if (init_fwenv())
+               return ret;
+
+       if (strcmp(cmd, "product") == 0)
                ret = set_arc_product(argc, argv);
-               goto done;
-       }
-       if (strcmp(cmd, "info") == 0) {
-               ret = get_arc_info();
-               goto done;
-       }
-done:
+       else if (strcmp(cmd, "info") == 0)
+               ret = do_get_arc_info();
+
        if (ret == -1)
                return CMD_RET_USAGE;
 
index 1a1fcb9be9cf396bb902371c4a8b7f21f6e73002..54fd1782cb1f2714f7775bf34fd902fe596aa50d 100644 (file)
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * Copyright 2013-2015 Arcturus Networks, Inc.
- *           http://www.arcturusnetworks.com/products/ucp1020/
+ * Copyright 2013-2019 Arcturus Networks, Inc.
+ *           https://www.arcturusnetworks.com/products/ucp1020/
  *           by Oleksandr G Zhadan et al.
  * based on board/freescale/p1_p2_rdb_pc/spl.c
  * original copyright follows:
@@ -108,7 +108,9 @@ int checkboard(void)
 {
        printf("Board: %s\n", CONFIG_BOARDNAME_LOCAL);
        board_gpio_init();
+#ifdef CONFIG_MMC
        printf("SD/MMC: 4-bit Mode\n");
+#endif
 
        return 0;
 }
@@ -193,7 +195,9 @@ int last_stage_init(void)
        static char newkernelargs[256];
        static u8 id1[16];
        static u8 id2;
+#ifdef CONFIG_MMC
        struct mmc *mmc;
+#endif
        char *sval, *kval;
 
        if (i2c_read(CONFIG_SYS_I2C_IDT6V49205B, 7, 1, &id1[0], 2) < 0) {
@@ -215,6 +219,7 @@ int last_stage_init(void)
 
        kval = env_get("kernelargs");
 
+#ifdef CONFIG_MMC
        mmc = find_mmc_device(0);
        if (mmc)
                if (!mmc_init(mmc)) {
@@ -234,6 +239,7 @@ int last_stage_init(void)
                                env_set("kernelargs", mmckargs);
                        }
                }
+#endif
        get_arc_info();
 
        if (kval) {
index cf1ddd718bb010c0cb8454c8e87e146cd0041954..1b527cdb1cf68c2280e1923f541bd5fa15eb5cc4 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
- * Copyright 2013-2015 Arcturus Networks, Inc.
- *           http://www.arcturusnetworks.com/products/ucp1020/
+ * Copyright 2013-2019 Arcturus Networks, Inc.
+ *           https://www.arcturusnetworks.com/products/ucp1020/
  *           by Oleksandr G Zhadan et al.
  */
 
 
 #define GPIO_WD                GPIO15
 
+#ifdef CONFIG_MMC
 static char *defkargs = "root=/dev/mtdblock1 rootfstype=cramfs ro";
 static char *mmckargs = "root=/dev/mmcblk0p1 rootwait rw";
+#endif
 
 int get_arc_info(void);
 
index 0a676d48c949ca831660b993b4667a0661644a37..128f10fa5d05b882881176922aa6d3f4af7c6bb9 100644 (file)
@@ -19,12 +19,9 @@ CONFIG_AUTOBOOT_STOP_STR="\x1b"
 CONFIG_CMD_IMLS=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
-CONFIG_CMD_MMC=y
 # CONFIG_CMD_NAND is not set
-CONFIG_CMD_MMC_SPI=y
-CONFIG_CMD_SF=y
-CONFIG_CMD_SPI=y
-CONFIG_CMD_USB=y
+# CONFIG_CMD_PCI is not set
+# CONFIG_CMD_SATA is not set
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
@@ -35,26 +32,18 @@ CONFIG_CMD_CRAMFS=y
 CONFIG_CMD_EXT2=y
 CONFIG_CMD_FAT=y
 CONFIG_ENV_IS_IN_FLASH=y
-CONFIG_FSL_ESDHC=y
+# CONFIG_SATA_SIL is not set
+# CONFIG_MMC is not set
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_CFI=y
-CONFIG_SPI_FLASH=y
-CONFIG_SF_DEFAULT_MODE=0
-CONFIG_SF_DEFAULT_SPEED=10000000
-CONFIG_SPI_FLASH_STMICRO=y
-CONFIG_SPI_FLASH_SST=y
-CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_PHY_MARVELL=y
 CONFIG_PHY_GIGE=y
 CONFIG_E1000=y
 CONFIG_MII=y
 CONFIG_TSEC_ENET=y
+# CONFIG_PCI is not set
 CONFIG_SYS_NS16550=y
-CONFIG_SPI=y
-CONFIG_FSL_ESPI=y
-CONFIG_USB=y
-CONFIG_USB_STORAGE=y
 CONFIG_FS_CRAMFS=y
 CONFIG_OF_LIBFDT=y
index b8040bb4d922756ccbc1dec7ce68640125dc5bc6..268a41c82c617057775aa1471f63e156ee628bf2 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
- * Copyright 2013-2015 Arcturus Networks, Inc.
- *           http://www.arcturusnetworks.com/products/ucp1020/
+ * Copyright 2013-2019 Arcturus Networks, Inc.
+ *           https://www.arcturusnetworks.com/products/ucp1020/
  * based on include/configs/p1_p2_rdb_pc.h
  * original copyright follows:
  * Copyright 2009-2011 Freescale Semiconductor, Inc.
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+/*** Arcturus FirmWare Environment */
+
+#define MAX_SERIAL_SIZE 15
+#define MAX_HWADDR_SIZE 17
+
+#define MAX_FWENV_ADDR 4
+
+#define FWENV_MMC      1
+#define FWENV_SPI_FLASH        2
+#define FWENV_NOR_FLASH        3
+/*
+ #define FWENV_TYPE    FWENV_MMC
+ #define FWENV_TYPE    FWENV_SPI_FLASH
+*/
+#define FWENV_TYPE     FWENV_NOR_FLASH
+
+#if (FWENV_TYPE == FWENV_MMC)
+#ifndef CONFIG_SYS_MMC_ENV_DEV
+#define CONFIG_SYS_MMC_ENV_DEV 1
+#endif
+#define FWENV_ADDR1 -1
+#define FWENV_ADDR2 -1
+#define FWENV_ADDR3 -1
+#define FWENV_ADDR4 -1
+#define EMPY_CHAR 0
+#endif
+
+#if (FWENV_TYPE == FWENV_SPI_FLASH)
+#ifndef CONFIG_SF_DEFAULT_SPEED
+#define CONFIG_SF_DEFAULT_SPEED        1000000
+#endif
+#ifndef CONFIG_SF_DEFAULT_MODE
+#define CONFIG_SF_DEFAULT_MODE SPI_MODE0
+#endif
+#ifndef CONFIG_SF_DEFAULT_CS
+#define CONFIG_SF_DEFAULT_CS   0
+#endif
+#ifndef CONFIG_SF_DEFAULT_BUS
+#define CONFIG_SF_DEFAULT_BUS  0
+#endif
+#define FWENV_ADDR1 (0x200 - sizeof(smac))
+#define FWENV_ADDR2 (0x400 - sizeof(smac))
+#define FWENV_ADDR3 (CONFIG_ENV_SECT_SIZE + 0x200 - sizeof(smac))
+#define FWENV_ADDR4 (CONFIG_ENV_SECT_SIZE + 0x400 - sizeof(smac))
+#define EMPY_CHAR 0xff
+#endif
+
+#if (FWENV_TYPE == FWENV_NOR_FLASH)
+#define FWENV_ADDR1 0xEC080000
+#define FWENV_ADDR2 -1
+#define FWENV_ADDR3 -1
+#define FWENV_ADDR4 -1
+#define EMPY_CHAR 0xff
+#endif
+/***********************************/
+
 #define CONFIG_PCIE1   /* PCIE controller 1 (slot 1) */
 #define CONFIG_PCIE2   /* PCIE controller 2 (slot 2) */
 #define CONFIG_FSL_PCI_INIT    /* Use common FSL init code */
@@ -37,8 +93,6 @@
 #define CONFIG_NETMASK         255.255.252.0
 #define CONFIG_ETHPRIME                "eTSEC3"
 
-#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
-
 #define CONFIG_SYS_L2_SIZE     (256 << 10)
 
 #endif
 #define CONFIG_BOARDNAME_LOCAL "uCP1020-64EEE512-OU1-XR"
 
 #define CONFIG_TSEC1
-#define CONFIG_TSEC2
 #define CONFIG_TSEC3
 #define CONFIG_HAS_ETH0
 #define CONFIG_HAS_ETH1
 #define CONFIG_NETMASK         255.255.255.0
 #define CONFIG_ETHPRIME                "eTSEC1"
 
-#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
+#undef CONFIG_SYS_REDUNDAND_ENVIRONMENT
 
 #define CONFIG_SYS_L2_SIZE     (256 << 10)