From patchwork Mon Nov 25 16:24:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Holger Brunck X-Patchwork-Id: 1200488 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ch.abb.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 47MC7H43hrz9sPJ for ; Tue, 26 Nov 2019 03:25:15 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 4B0AAC21E73; Mon, 25 Nov 2019 16:25:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 3A3BAC21DF3; Mon, 25 Nov 2019 16:25:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1EE18C21E02; Mon, 25 Nov 2019 16:25:06 +0000 (UTC) Received: from inet10.abb.com (inet10.abb.com [138.225.1.74]) by lists.denx.de (Postfix) with ESMTPS id D4D0BC21D72 for ; Mon, 25 Nov 2019 16:25:05 +0000 (UTC) Received: from gitsiv.ch.abb.com ([10.41.156.251]) by inet10.abb.com (8.14.7/8.14.7) with SMTP id xAPGOxUk006325; Mon, 25 Nov 2019 17:24:59 +0100 Received: from ch10641.keymile.net (ch10641.keymile.net [172.31.40.7]) by gitsiv.ch.abb.com (Postfix) with ESMTP id 8A6AD6254A2D; Mon, 25 Nov 2019 17:24:36 +0100 (CET) From: Holger Brunck To: u-boot@lists.denx.de Date: Mon, 25 Nov 2019 17:24:14 +0100 Message-Id: <20191125162416.9120-2-holger.brunck@ch.abb.com> X-Mailer: git-send-email 2.24.0.rc1 In-Reply-To: <20191125162416.9120-1-holger.brunck@ch.abb.com> References: <20191125162416.9120-1-holger.brunck@ch.abb.com> MIME-Version: 1.0 Cc: Marek Vasut , Holger Brunck , Stefan Roese , Valentin Longchamp Subject: [U-Boot] [PATCH 2/4] km/boards: add MAC address offset as argument to ivm_populate_env X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 CC: Stefan Roese CC: Valentin Longchamp CC: Marek Vasut Reviewed-by: Stefan Roese --- 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; }