[U-Boot] [PATCH 2/4] km/boards: add MAC address offset as argument to ivm_populate_env
Stefan Roese
sr at denx.de
Tue Nov 26 13:21:08 UTC 2019
On 25.11.19 17:24, Holger Brunck wrote:
> 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 at ch.abb.com>
> CC: Stefan Roese <sr at denx.de>
> CC: Valentin Longchamp <valentin.longchamp at ch.abb.com>
> CC: Marek Vasut <marex at denx.de>
Reviewed-by: Stefan Roese <sr at denx.de>
Thanks,
Stefan
> ---
> board/keymile/common/common.h | 2 +-
> board/keymile/common/ivm.c | 12 ++++++------
> board/keymile/km83xx/km83xx.c | 3 ++-
> board/keymile/km_arm/km_arm.c | 3 ++-
> board/keymile/kmp204x/kmp204x.c | 3 ++-
> 5 files changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h
> index 42b760dc6e..8251de4db8 100644
> --- a/board/keymile/common/common.h
> +++ b/board/keymile/common/common.h
> @@ -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);
> diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c
> index 429e9c7914..fee7f03c8c 100644
> --- a/board/keymile/common/ivm.c
> +++ b/board/keymile/common/ivm.c
> @@ -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);
> }
> diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
> index 8846b64f7d..59347a3990 100644
> --- a/board/keymile/km83xx/km83xx.c
> +++ b/board/keymile/km83xx/km83xx.c
> @@ -185,7 +185,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;
> }
>
> diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
> index 922cc621f7..2724d8bd48 100644
> --- a/board/keymile/km_arm/km_arm.c
> +++ b/board/keymile/km_arm/km_arm.c
> @@ -231,7 +231,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();
> diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
> index 4d1e38aa3a..e7c321c326 100644
> --- a/board/keymile/kmp204x/kmp204x.c
> +++ b/board/keymile/kmp204x/kmp204x.c
> @@ -195,7 +195,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;
> }
>
>
Viele Grüße,
Stefan
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
More information about the U-Boot
mailing list