board/km: add support for seli8 design based on nxp ls102x
[platform/kernel/u-boot.git] / board / keymile / common / ivm.c
index e989bf6..14c70b9 100644 (file)
@@ -306,11 +306,7 @@ static int ivm_populate_env(unsigned char *buf, int len, int mac_address_offset)
                return 0;
        page2 = &buf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN * 2];
 
-       if (!IS_ENABLED(CONFIG_KMTEGR1)) {
-               /* if an offset is defined, add it */
-               process_mac(valbuf, page2, mac_address_offset, true);
-               env_set((char *)"ethaddr", (char *)valbuf);
-       } else {
+       if (IS_ENABLED(CONFIG_KMTEGR1)) {
                /* KMTEGR1 has a special setup. eth0 has no connection to the
                 * outside and gets an locally administred MAC address, eth1 is
                 * the debug interface and gets the official MAC address from
@@ -320,6 +316,24 @@ static int ivm_populate_env(unsigned char *buf, int len, int mac_address_offset)
                env_set((char *)"ethaddr", (char *)valbuf);
                process_mac(valbuf, page2, mac_address_offset, true);
                env_set((char *)"eth1addr", (char *)valbuf);
+       } else if (IS_ENABLED(CONFIG_ARCH_LS1021A)) {
+               /* LS102xA has 1xRGMII for debug connection and
+                * 2xSGMII for back-plane mgmt connection
+                */
+               process_mac(valbuf, page2, 1, true);
+               env_set((char *)"ethaddr", (char *)valbuf);
+               process_mac(valbuf, page2, 2, true);
+               env_set((char *)"eth1addr", (char *)valbuf);
+               process_mac(valbuf, page2, mac_address_offset, true);
+               env_set((char *)"eth2addr", (char *)valbuf);
+       } else {
+               process_mac(valbuf, page2, mac_address_offset, true);
+               env_set((char *)"ethaddr", (char *)valbuf);
+       }
+       if (IS_ENABLED(CONFIG_TARGET_KMCENT2)) {
+               /* 3rd ethernet interface */
+               process_mac(valbuf, page2, 2, true);
+               env_set((char *)"eth4addr", (char *)valbuf);
        }
 
        return 0;
@@ -328,7 +342,7 @@ static int ivm_populate_env(unsigned char *buf, int len, int mac_address_offset)
 int ivm_read_eeprom(unsigned char *buf, int len, int mac_address_offset)
 {
        int ret;
-#ifdef CONFIG_DM_I2C
+#if CONFIG_IS_ENABLED(DM_I2C)
        struct udevice *eedev = NULL;
 
        ret = i2c_get_chip_for_busnum(CONFIG_KM_IVM_BUS,