]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
km/boards: add MAC address offset as argument to ivm_populate_env
authorHolger Brunck <holger.brunck@ch.abb.com>
Mon, 25 Nov 2019 16:24:14 +0000 (17:24 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 10 Jan 2020 15:25:13 +0000 (10:25 -0500)
For upcoming SECU board we have different MAC address offsets depending
on which functional unit we are running. In this case we need to pass
this value to the ivm_populate_env function instead of using the hard
coded config option there.

Signed-off-by: Holger Brunck <holger.brunck@ch.abb.com>
CC: Stefan Roese <sr@denx.de>
CC: Valentin Longchamp <valentin.longchamp@ch.abb.com>
CC: Marek Vasut <marex@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>
board/keymile/common/common.h
board/keymile/common/ivm.c
board/keymile/km83xx/km83xx.c
board/keymile/km_arm/km_arm.c
board/keymile/kmp204x/kmp204x.c

index 42b760dc6ef3367a27d02336bde51ee7e2a8acc5..8251de4db8f3aace1dae133a625a0a5bbf341b2e 100644 (file)
@@ -121,7 +121,7 @@ struct bfticu_iomap {
 };
 
 int ethernet_present(void);
-int ivm_read_eeprom(unsigned char *buf, int len);
+int ivm_read_eeprom(unsigned char *buf, int len, int mac_address_offset);
 int ivm_analyze_eeprom(unsigned char *buf, int len);
 
 int trigger_fpga_config(void);
index 429e9c7914e11c7b9bc867d99cce5e09b49fbce0..fee7f03c8c6f338ea4402e9aac9b58225c39d47e 100644 (file)
@@ -297,7 +297,7 @@ int ivm_analyze_eeprom(unsigned char *buf, int len)
        return 0;
 }
 
-static int ivm_populate_env(unsigned char *buf, int len)
+static int ivm_populate_env(unsigned char *buf, int len, int mac_address_offset)
 {
        unsigned char   *page2;
        unsigned char   valbuf[MAC_STR_SZ];
@@ -309,23 +309,23 @@ static int ivm_populate_env(unsigned char *buf, int len)
 
 #ifndef CONFIG_KMTEGR1
        /* if an offset is defined, add it */
-       process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADDRESS_OFFSET, true);
+       process_mac(valbuf, page2, mac_address_offset, true);
        env_set((char *)"ethaddr", (char *)valbuf);
 #else
 /* 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 the IVM
  */
-       process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADDRESS_OFFSET, false);
+       process_mac(valbuf, page2, mac_address_offset, false);
        env_set((char *)"ethaddr", (char *)valbuf);
-       process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADDRESS_OFFSET, true);
+       process_mac(valbuf, page2, mac_address_offset, true);
        env_set((char *)"eth1addr", (char *)valbuf);
 #endif
 
        return 0;
 }
 
-int ivm_read_eeprom(unsigned char *buf, int len)
+int ivm_read_eeprom(unsigned char *buf, int len, int mac_address_offset)
 {
        int ret;
 
@@ -339,5 +339,5 @@ int ivm_read_eeprom(unsigned char *buf, int len)
                return -2;
        }
 
-       return ivm_populate_env(buf, len);
+       return ivm_populate_env(buf, len, mac_address_offset);
 }
index 5969d5139524950adb165c61957dd9569dca5ecb..feca7be37276701013cb6abd88db1056eabf2522 100644 (file)
@@ -186,7 +186,8 @@ int board_early_init_r(void)
 
 int misc_init_r(void)
 {
-       ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+       ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN,
+                       CONFIG_PIGGY_MAC_ADDRESS_OFFSET);
        return 0;
 }
 
index 7f83ec180ec448684453eebac5750b9d2b564703..627543a0aa3686efbf142b1cec19e7e122392224 100644 (file)
@@ -232,7 +232,8 @@ int misc_init_r(void)
        }
 #endif
 
-       ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+       ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN,
+                       CONFIG_PIGGY_MAC_ADDRESS_OFFSET);
 
        initialize_unit_leds();
        set_km_env();
index 88914c80e8796121a94c66818c15e68e898e04db..9e1956c8b7ffba834e6e326edcd390f1302554f9 100644 (file)
@@ -196,7 +196,8 @@ int misc_init_r(void)
                }
        }
 
-       ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+       ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN,
+                       CONFIG_PIGGY_MAC_ADDRESS_OFFSET);
        return 0;
 }