From patchwork Thu Jul 30 23:34:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 1339164 X-Patchwork-Delegate: patrice.chotard@st.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=ZjwP/j2P; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BHmwv6WYJz9sR4 for ; Fri, 31 Jul 2020 09:35:09 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 173D681260; Fri, 31 Jul 2020 01:35:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1596152100; bh=MiXhKyKvx2TeWlwJGIezsQy5infU+yEo5XPhU97rdZs=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=ZjwP/j2PdFNzEJDzpbrDjQNFm8kRx7PoRvlRzX0BSBrYWyM+cjEk8w++BR7OSBZ8i Esi8RpjpZTGYjwKuPJOYKmcaNgA0s5++EIbC7Q5tOu83g+m+ftUmLxSqw6c8F/avcG CtloRmiM9abnDjmT7LNJCW3m1A7IAZwFKGyFpzyy95iFGx1xqPfp95HuFZyfS7yG5M hmDV0HTEwy63BhBkz+KHNtYFx1G38/Gryv+WjTxb2OpiqlOCAZXD/V0heJbAn3IIPt BJAV3LqSWJEqUHMUUhOtBjeIGK0otNTpU36PDoQQETgZOXiqYogukID7rTvzhJgjHk ULtl9i8eIHETg== Received: by phobos.denx.de (Postfix, from userid 109) id 6564B81269; Fri, 31 Jul 2020 01:34:58 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BFA3F808B3 for ; Fri, 31 Jul 2020 01:34:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=marex@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4BHmwZ3VBcz1qrMH; Fri, 31 Jul 2020 01:34:54 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4BHmwZ37Wnz1qxnx; Fri, 31 Jul 2020 01:34:54 +0200 (CEST) Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id SkLaNB-lo1HX; Fri, 31 Jul 2020 01:34:53 +0200 (CEST) X-Auth-Info: LiSCKLH77yUbz3ZvQe1ehXDr105uMLuI9BYafAC6TnI= Received: from desktop.lan (ip-86-49-101-166.net.upcbroadband.cz [86.49.101.166]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Fri, 31 Jul 2020 01:34:53 +0200 (CEST) From: Marek Vasut To: u-boot@lists.denx.de Cc: Marek Vasut , Patrice Chotard , Patrick Delaunay Subject: [PATCH] ARM: dts: stm32: Update eth1addr from EEPROM if eth1 present Date: Fri, 31 Jul 2020 01:34:50 +0200 Message-Id: <20200730233450.81792-1-marex@denx.de> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean The STM32MP1 DHCOM has two ethernet interfaces, the on-SoM DWMAC and KS8851. Set eth1addr for the KS8851 to a MAC address of the DWMAC incremented by 1. The MAC of the DWMAC is set from on-SoM EEPROM already, but the MAC address of KS8851 was left uninitialized, so fix this. Signed-off-by: Marek Vasut Cc: Patrice Chotard Cc: Patrick Delaunay Reviewed-by: Patrice Chotard --- arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi | 1 + board/dhelectronics/dh_stm32mp1/board.c | 25 ++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi b/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi index f96de9e7a3..92345b7ba3 100644 --- a/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi +++ b/arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi @@ -18,6 +18,7 @@ mmc1 = &sdmmc2; spi0 = &qspi; usb0 = &usbotg_hs; + ethernet1 = &ksz8851; }; config { diff --git a/board/dhelectronics/dh_stm32mp1/board.c b/board/dhelectronics/dh_stm32mp1/board.c index 17dbf20d76..17018716fd 100644 --- a/board/dhelectronics/dh_stm32mp1/board.c +++ b/board/dhelectronics/dh_stm32mp1/board.c @@ -84,11 +84,26 @@ DECLARE_GLOBAL_DATA_PTR; int setup_mac_address(void) { unsigned char enetaddr[6]; + bool skip_eth0 = false; + bool skip_eth1 = false; struct udevice *dev; int off, ret; ret = eth_env_get_enetaddr("ethaddr", enetaddr); if (ret) /* ethaddr is already set */ + skip_eth0 = true; + + off = fdt_path_offset(gd->fdt_blob, "ethernet1"); + if (off < 0) { + /* ethernet1 is not present in the system */ + skip_eth1 = true; + } else { + ret = eth_env_get_enetaddr("eth1addr", enetaddr); + if (ret) /* eth1addr is already set */ + skip_eth1 = true; + } + + if (skip_eth0 && skip_eth1) return 0; off = fdt_path_offset(gd->fdt_blob, "eeprom0"); @@ -109,8 +124,14 @@ int setup_mac_address(void) return ret; } - if (is_valid_ethaddr(enetaddr)) - eth_env_set_enetaddr("ethaddr", enetaddr); + if (is_valid_ethaddr(enetaddr)) { + if (!skip_eth0) + eth_env_set_enetaddr("ethaddr", enetaddr); + + enetaddr[5]++; + if (!skip_eth1) + eth_env_set_enetaddr("eth1addr", enetaddr); + } return 0; }