From patchwork Tue Aug 18 13:19:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 1346836 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=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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=BkWew//M; 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BWBMn5d4Yz9sPC for ; Tue, 18 Aug 2020 23:19:33 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D1FB3821D4; Tue, 18 Aug 2020 15:19:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="BkWew//M"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3F4E3821E0; Tue, 18 Aug 2020 15:19:28 +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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DAA8D821AF for ; Tue, 18 Aug 2020 15:19:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=aford173@gmail.com Received: by mail-il1-x144.google.com with SMTP id f12so9960018ils.6 for ; Tue, 18 Aug 2020 06:19:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=jtzqpY54iA5nNmtzg+e1Fou7PCzj8Dw8MLdb5aG6c+k=; b=BkWew//M/yh0cpCoelw6ss+dBn2wAtERxWrA29Uv7ecyKcwA6suo+ITQznVBDCPbLm RkJwCVCEMTFl/IUpmjQQZcgW/0wzC+R1KIJtCH/cTZRzdQQ06Xs3sV39xEyPuduah8c4 fPhm26Lqar/ensj/2D9Y0VfP5KBCtjZHofIK3rrGWujQhmIvhHLv23ppP5ihZ3yrvli2 GTkXGwWEtckbD/XCw4O9IM5605x4dAyTRLTChig40Oym///MYDmY0VNpVR53czN+LdAZ WYr8/0CUeNT0hmnPeptF2X2fmsga198juYqXgmuZqNpj+5S7tAK/pl9wFoZhLF8AJU/P nnMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=jtzqpY54iA5nNmtzg+e1Fou7PCzj8Dw8MLdb5aG6c+k=; b=Sh0/WTwCAI+UybVK0CTK7zVJZZPRaNbNO/nK3tWapIB6T546nw/Y5vECLIlJKQf0eL KatX0W5dJBzGxbmbuJz9EEGCUr/pQYhKCThzITriKQv73LENOVoi/jV/c87wvsXq2Qnd B8BV27jnBCHjtB24EEfCtgxn+aOmulpA/s8tAOaKxW7fCGiZUBPvLGcmrVpnf/Z6cQY3 fC3QCiPAa7PGDWBh0sKhi09LhXv4G3CLTb/IL92xE4JMs2/iAjyG19/zMZN/CrdPlrsN yWvfBj2miZp8SqeEKmEACC3C4GnGwed5txQ0XXJBbc3KqkB3GosR2HXOwNVGsuO4EmBX zkpQ== X-Gm-Message-State: AOAM533ZZQKop2z6zWFKEOTgAl0X44hSxl0HK33iyggysoTRDVi96sXx edYl/RcBBjNvYSOcZUYLCKfq5b++K0LaKQ== X-Google-Smtp-Source: ABdhPJwShNCsOPSCAPuakwtUtU6OFU1YxsG45+401ErB1ujcxQaHfGNvEPIB4iVT+zY0pXyqLmtCPw== X-Received: by 2002:a92:c811:: with SMTP id v17mr11658401iln.143.1597756763230; Tue, 18 Aug 2020 06:19:23 -0700 (PDT) Received: from aford-OptiPlex-7050.logicpd.com ([174.46.170.158]) by smtp.gmail.com with ESMTPSA id e5sm2992460ilc.61.2020.08.18.06.19.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2020 06:19:22 -0700 (PDT) From: Adam Ford To: u-boot@lists.denx.de Cc: joe.hershberger@ni.com, woods.technical@gmail.com, trini@konsulko.com, Adam Ford Subject: [PATCH V2] net: smc911x: Automatically Update ethaddr with MAC Date: Tue, 18 Aug 2020 08:19:02 -0500 Message-Id: <20200818131902.18533-1-aford173@gmail.com> X-Mailer: git-send-email 2.17.1 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 ethernet controller can read the MAC from EEPROM and display it, but if ethaddr is not set, the ethernet is still unavailable. This patch checks will automatically set the MAC address if it has not already been set. Signed-off-by: Adam Ford Acked-by: Joe Hershberger --- V2: Fix typo diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index 09372d7f6b..1fa3667b77 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include @@ -185,6 +186,8 @@ static void smc911x_handle_mac_address(struct smc911x_priv *priv) smc911x_set_mac_csr(priv, ADDRH, addrh); printf(DRIVERNAME ": MAC %pM\n", m); + if (!env_get("ethaddr")) + env_set("ethaddr", (const char *)m); } static bool smc911x_read_mac_address(struct smc911x_priv *priv)