From patchwork Thu Dec 17 07:26:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 344916 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp930346jai; Wed, 16 Dec 2020 23:27:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJxB1ZXn2g+E1PBWZYF9b7LY2xYwIZRFo3b/2HhMo86TekCDCcytUClAVhfTwvbgtE/eMkl5 X-Received: by 2002:a17:906:38c3:: with SMTP id r3mr33933869ejd.193.1608190039869; Wed, 16 Dec 2020 23:27:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608190039; cv=none; d=google.com; s=arc-20160816; b=lqq7oX/vT6c0Wtcot1UQYwVGvpwhI06iKrp6CSbo3xzhK4ibdA0d4mQ6HLo+phFqz3 bjIQNssSfY1JNCNuu00hCF8DLtOZQp/Tp4uV4P4PkJ9+eCaNDQSmMOh9eQ9AxluyWmaR GbL4wPuc3Th0K0yeoM0o7vlIUnDg+4Z2QqiWozbShcDccsVQmbcLe4Leh+Bszmb9QEBi oWptV3gp2Lv89jQ/Rnp/0tXr4eRCnSCmii4HPmJikBCOY7DQKTTXiGxQuryQQ6PWvhit 7itTDxegwdVnC+MuITJCvnsWwqwBwGOUIhwO91YJNGBBU25GeFXKm5OvSoYewNwDOnFc HXLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:cms-type:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter; bh=6HXGVy0vs+JH5gQhNHksnoTv+uhTeIpuVxmsYjMg0PU=; b=OKye8PpUlbWAEDi4bBPCPC1WhzoqZqkuhyhgZl9zqZ1u4Phxso1R5JYIsfh+51uHWb jifIbSdRioTsg3D7OFtlk8Fgz24V9GI2bZCtSS1Dij5sqRAwAa6vCRlsw7qyvcbI8TI1 hIBqbpNgPd3F9tAwtpS2npdAgWqrgQZrvZrTJyd2GWLyuCUFXjelE+A0eydMSNJf0WSA RaPtA6s4LsqUbOubKdzQS1NC0tigrCWtKzkkJ7ziRee2LNK/2nY15CF2uw67YtdQyL1r de+Lc0f3RvO/w2+2V1vLjXrF2ZZ2eGdazuc9N9Qmlvxr5w0dyR8I5HNjn4NS1JqqO/Uj 8z3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=BUHBthbe; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id n27si2003581ejh.345.2020.12.16.23.27.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Dec 2020 23:27:19 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=BUHBthbe; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AD90B82B3F; Thu, 17 Dec 2020 08:27:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="BUHBthbe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3D05A82B41; Thu, 17 Dec 2020 08:27:16 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4785182B3D for ; Thu, 17 Dec 2020 08:27:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=m.szyprowski@samsung.com Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201217072701euoutp01d8aca191d0833cec146a6fa4a6be001e~RcE26n8kd1746917469euoutp012 for ; Thu, 17 Dec 2020 07:27:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201217072701euoutp01d8aca191d0833cec146a6fa4a6be001e~RcE26n8kd1746917469euoutp012 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1608190021; bh=6HXGVy0vs+JH5gQhNHksnoTv+uhTeIpuVxmsYjMg0PU=; h=From:To:Cc:Subject:Date:References:From; b=BUHBthbeiPSe9ZVm1/w0M9p1Z67GTgLJXyLACVS2OVs3KWjLF3KAearRWh1u0MfXg Gg3yvZIl/74MLGPgi9LMUKBh0fBU4cAgTmPhvYW44XuKVa18SlkWDIHYVY0QfXPxwE +DOUtq4DqcIqZV41yGW+OJGWhUBEHsEULX2RFfQE= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201217072655eucas1p11f334e88e5b4508e14476c97a94614b3~RcEyCNUdQ0330203302eucas1p1w; Thu, 17 Dec 2020 07:26:55 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 06.5D.45488.F380BDF5; Thu, 17 Dec 2020 07:26:55 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201217072655eucas1p123aa0a548e4de21a8ac580dbc990c760~RcExlREEY0051100511eucas1p1m; Thu, 17 Dec 2020 07:26:55 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20201217072655eusmtrp12389fc1e89df770253524e7242c4e430~RcExko6xz2613026130eusmtrp1M; Thu, 17 Dec 2020 07:26:55 +0000 (GMT) X-AuditID: cbfec7f5-c77ff7000000b1b0-0d-5fdb083f1cf1 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 4B.C7.16282.F380BDF5; Thu, 17 Dec 2020 07:26:55 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20201217072654eusmtip23ebcf01325566722c1d42594a7b8753f~RcExOdDX01513515135eusmtip2T; Thu, 17 Dec 2020 07:26:54 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de, u-boot-amlogic@groups.io Cc: Marek Szyprowski , Neil Armstrong , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH] board: amlogic: vim3: read ethernet MAC address from efuse Date: Thu, 17 Dec 2020 08:26:42 +0100 Message-Id: <20201217072642.1319-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOIsWRmVeSWpSXmKPExsWy7djP87r2HLfjDVY817HYOGM9q8WNX22s FmuP3GW3ONQXbTFpwi82i7d7O9kd2Dze32hl95jf+Z3J4+ydHYwefVtWMQawRHHZpKTmZJal FunbJXBlHP/TzlxwirPi2aofrA2M79i7GDk4JARMJN7Ps+xi5OIQEljBKNG7ehIrhPOFUeL/ xTNMEM5nRok1LxuAHE6wjiVN39hAbCGB5YwSpzdXwXUcPXeTHSTBJmAo0fW2C6xIRMBI4lLT DhaQImaB3YwS7ZeaWEASwgLeEnevdYHZLAKqEv8PvgVr5hWwkdjadYsVYpu8xOoNB5hBmiUE 3rJL3Jm3kRHicBeJ9TMSIGqEJV4d38IOYctInJ7cwwJR38wo8fDcWnYIp4dR4nLTDEaIKmuJ O+d+sYEMYhbQlFi/Sx8i7Cix8O9XVoj5fBI33gqChJmBzEnbpjNDhHklOtqEIKrVJGYdXwe3 9uCFS8wQtofEy2fbWSEBFCvR0djMNIFRbhbCrgWMjKsYxVNLi3PTU4uN81LL9YoTc4tL89L1 kvNzNzEC4/70v+NfdzCuePVR7xAjEwfjIUYJDmYlEd6EAzfjhXhTEiurUovy44tKc1KLDzFK c7AoifPu2romXkggPbEkNTs1tSC1CCbLxMEp1cBULP2wYKHQzoXyT5v3eh2Jmz/HOu6p2ocN DbL/jux2Wzpn3a7rpk7clRNV3XJP6VW8zzl+cNXG5detJLfVLj3s/1SA/5Xoohul4l0NsY7V hWlzTuas8qxnyOzosmxTfTo99KdFaQ3L/l3Lk3Y9nuT/4qHBiT/PZ6e/0W2dvT97a4xW2csF y2+yq915d+3UxPVW/8/Ou9H6gKG82i6dT/rxj5mt5xdvK5d6ZTs15uzTuNZ1fQ8NtvwK3P24 6Po887P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VN3 jcECAAA= X-CMS-MailID: 20201217072655eucas1p123aa0a548e4de21a8ac580dbc990c760 X-Msg-Generator: CA X-RootMTR: 20201217072655eucas1p123aa0a548e4de21a8ac580dbc990c760 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201217072655eucas1p123aa0a548e4de21a8ac580dbc990c760 References: 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 Add the board specific code for reading built-in ethernet MAC address from efuse. Signed-off-by: Marek Szyprowski --- board/amlogic/vim3/vim3.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) -- 2.17.1 Reviewed-by: Neil Armstrong Reviewed-by: Jaehoon Chung Tested-by: Jaehoon Chung diff --git a/board/amlogic/vim3/vim3.c b/board/amlogic/vim3/vim3.c index 09ef39ff30..a36df61583 100644 --- a/board/amlogic/vim3/vim3.c +++ b/board/amlogic/vim3/vim3.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include "khadas-mcu.h" @@ -129,9 +130,27 @@ int meson_ft_board_setup(void *blob, struct bd_info *bd) return 0; } +#define EFUSE_MAC_OFFSET 0 +#define EFUSE_MAC_SIZE 6 + int misc_init_r(void) { + uint8_t mac_addr[EFUSE_MAC_SIZE]; + ssize_t len; + meson_eth_init(PHY_INTERFACE_MODE_RGMII, 0); + if (!eth_env_get_enetaddr("ethaddr", mac_addr)) { + len = meson_sm_read_efuse(EFUSE_MAC_OFFSET, + mac_addr, EFUSE_MAC_SIZE); + if (len != EFUSE_MAC_SIZE) + return 0; + + if (is_valid_ethaddr(mac_addr)) + eth_env_set_enetaddr("ethaddr", mac_addr); + else + meson_generate_serial_ethaddr(); + } + return 0; }