From patchwork Mon Jun 24 12:40:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Etienne_Dubl=C3=A9?= X-Patchwork-Id: 1951554 X-Patchwork-Delegate: ykai007@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=imag.fr header.i=@imag.fr header.a=rsa-sha256 header.s=2022 header.b=o3JYh8H3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W77FD6PLZz20X1 for ; Mon, 24 Jun 2024 22:53:52 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4A28D8852D; Mon, 24 Jun 2024 14:52:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=imag.fr 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=imag.fr header.i=@imag.fr header.b="o3JYh8H3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DD9048837A; Mon, 24 Jun 2024 14:40:16 +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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,PDS_BAD_THREAD_QP_64, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from zm-mta-out-3.u-ga.fr (zm-mta-out-3.u-ga.fr [152.77.200.56]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1562988137 for ; Mon, 24 Jun 2024 14:40:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=imag.fr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.duble@imag.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=imag.fr; s=2022; t=1719232814; bh=XpgCxsLjzZZx9lAL1X0kdCchmOWRcXFmmWvazs6O+zM=; h=Date:From:To:Cc:Subject:From; b=o3JYh8H3RaIlv72JAvt5vR54TJmk6e7M7NMY3z4gDGppGg8OEd2u1xweNU8KjaS0W botpg4kE48c6tfMbx7sFy8RcEh5vZRxEpegbi4NRwHdHiEGBra9hCY9Y4H0+8T8KEa NlWAH1ZuFCGeTmcmZ0I3l/b5ErSwNy/PCQsUwmu6+qdsbxgftaTC9S92QR2EXlr/kh ph9Hh8SQXCt72T7H7jZQdflaiMeBVsfBJKyD8z+Pa4Stm0pZ6XZ2e2VwV+CpenKnsd wMOx4EVwcD2n26DiauF0DgzxCGGjonznOtPu4txd0K8jiK+VtKfKNyO3BWz2xw+Aga Hq6pmrh6s/F2w== Received: from mailhub.u-ga.fr (mailhub-1.u-ga.fr [129.88.178.98]) by zm-mta-out-3.u-ga.fr (Postfix) with ESMTP id BCC94402C2; Mon, 24 Jun 2024 14:40:14 +0200 (CEST) Received: from mailhost.u-ga.fr (mailhost2.u-ga.fr [129.88.177.242]) by mailhub.u-ga.fr (Postfix) with ESMTP id B8CAD100053; Mon, 24 Jun 2024 14:40:14 +0200 (CEST) Received: from zm-mbx1.u-ga.fr (zm-mbx1.u-ga.fr [152.77.200.25]) by mailhost.u-ga.fr (Postfix) with ESMTP id 9BC046006F; Mon, 24 Jun 2024 14:40:14 +0200 (CEST) Date: Mon, 24 Jun 2024 14:40:14 +0200 (CEST) From: ETIENNE DUBLE To: Kever Yang , Philipp Tomsich , Simon Glass Cc: ETIENNE DUBLE , joe hershberger , Leo Yu-Chi Liang , Minda Chen , Philipp Tomsich , Ramon Fried , Sumit Garg , Tom Rini , u-boot Message-ID: <1978999632.15003049.1719232814587.JavaMail.zimbra@univ-grenoble-alpes.fr> Subject: [PATCH 1/3] net: give a different name to rtl8169 interfaces MIME-Version: 1.0 X-Originating-IP: [129.88.53.250] X-Mailer: Zimbra 10.0.8_GA_4611 (ZimbraWebClient - FF102 (Linux)/10.0.8_GA_4611) Thread-Index: HI29SiIfIDW7O0WwaHPk4KwLK/Cvuw== Thread-Topic: give a different name to rtl8169 interfaces X-Greylist: Whitelist-UGA MAILHOST (SMTP non authentifie) depuis 152.77.200.25 X-Mailman-Approved-At: Mon, 24 Jun 2024 14:52:21 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean This commit implements the .bind member function, and gives a different name to interfaces: "RTL8169#0", "RTL8169#1", etc. This was tested on a FriendlyElec Nanopi R5C board, which has two RTL-8125B interfaces managed by this driver. Since they were given the same name, it was previously not possible to select the 2nd one using ethact or ethprime environment variables. Signed-off-by: Etienne Dublé --- drivers/net/rtl8169.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c index 93e83661ce..b30d51731f 100644 --- a/drivers/net/rtl8169.c +++ b/drivers/net/rtl8169.c @@ -1091,6 +1091,16 @@ static int rtl8169_eth_probe(struct udevice *dev) return 0; } +static int rtl8169_eth_bind(struct udevice *dev) +{ + static int card_number; + char name[16]; + + sprintf(name, "RTL8169#%u", card_number++); + + return device_set_name(dev, name); +} + static const struct eth_ops rtl8169_eth_ops = { .start = rtl8169_eth_start, .send = rtl8169_eth_send, @@ -1108,6 +1118,7 @@ U_BOOT_DRIVER(eth_rtl8169) = { .name = "eth_rtl8169", .id = UCLASS_ETH, .of_match = rtl8169_eth_ids, + .bind = rtl8169_eth_bind, .probe = rtl8169_eth_probe, .ops = &rtl8169_eth_ops, .priv_auto = sizeof(struct rtl8169_private), From patchwork Mon Jun 24 12:40:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Etienne_Dubl=C3=A9?= X-Patchwork-Id: 1951555 X-Patchwork-Delegate: ykai007@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=imag.fr header.i=@imag.fr header.a=rsa-sha256 header.s=2022 header.b=xBHD/lGY; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W77FR6drGz20X1 for ; Mon, 24 Jun 2024 22:54:03 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A850B883A9; Mon, 24 Jun 2024 14:52:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=imag.fr 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=imag.fr header.i=@imag.fr header.b="xBHD/lGY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6878E8837A; Mon, 24 Jun 2024 14:40:30 +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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,PDS_BAD_THREAD_QP_64, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from zm-mta-out-3.u-ga.fr (zm-mta-out-3.u-ga.fr [152.77.200.56]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 904F188137 for ; Mon, 24 Jun 2024 14:40:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=imag.fr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.duble@imag.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=imag.fr; s=2022; t=1719232828; bh=VD4zS4vLM2AANRmBvpCm2cdV3RAzqDRgjQiAizgGN6M=; h=Date:From:To:Cc:Subject:From; b=xBHD/lGYg3zd69j1YiJs6OPpMwOn2e1iEkXkW4Yn7w+pTdlNVyYydFk9oa8FaRo5C eyBD7Kzyxd8ud0AQXj47hogGJGCnUsWZYpOLXdNbUJvwSxpOtkCrJWRY/usSqeyIl6 QbcgUsj4uE+OfS4jGjHDdzzdceJuuLoEq4nYjEkzbPx8BNVJ2jQuOps76+yoHVPmDD DMM4rv2WDLAToEZrLlVrF6fwRQfcU5tD0Ta2jfm7oIiPdOaHx0JNrW8xX1hTCbCOTB RINLxQaIClMLfl+EFS9gt3RI3785h2YubzzcUVwjdjUGAcaDVjth9hrwEJE115COIv 54sL83HAqw/Ww== Received: from mailhub.u-ga.fr (mailhub-2.u-ga.fr [129.88.178.102]) by zm-mta-out-3.u-ga.fr (Postfix) with ESMTP id 46BA6402E8; Mon, 24 Jun 2024 14:40:28 +0200 (CEST) Received: from mailhost.u-ga.fr (mailhost2.u-ga.fr [129.88.177.242]) by mailhub.u-ga.fr (Postfix) with ESMTP id 42A90100068; Mon, 24 Jun 2024 14:40:28 +0200 (CEST) Received: from zm-mbx1.u-ga.fr (zm-mbx1.u-ga.fr [152.77.200.25]) by mailhost.u-ga.fr (Postfix) with ESMTP id 254646006F; Mon, 24 Jun 2024 14:40:28 +0200 (CEST) Date: Mon, 24 Jun 2024 14:40:28 +0200 (CEST) From: ETIENNE DUBLE To: Kever Yang , Philipp Tomsich , Simon Glass Cc: ETIENNE DUBLE , joe hershberger , Leo Yu-Chi Liang , Minda Chen , Philipp Tomsich , Ramon Fried , Sumit Garg , Tom Rini , u-boot Message-ID: <1506177052.15003206.1719232828107.JavaMail.zimbra@univ-grenoble-alpes.fr> Subject: [PATCH 2/3] rockchip: fix wrong PCI range address in rk3568 dtsi MIME-Version: 1.0 X-Originating-IP: [129.88.53.250] X-Mailer: Zimbra 10.0.8_GA_4611 (ZimbraWebClient - FF102 (Linux)/10.0.8_GA_4611) Thread-Index: gsCTMu6Dd5jYg2yKhz8AMJXZz7CMPw== Thread-Topic: rockchip: fix wrong PCI range address in rk3568 dtsi X-Greylist: Whitelist-UGA MAILHOST (SMTP non authentifie) depuis 152.77.200.25 X-Mailman-Approved-At: Mon, 24 Jun 2024 14:52:21 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean One of the PCI ranges was wrong in this device tree. When testing with a FriendlyElec Nanopi R5C board, the 2nd ethernet interface (labelled "wan") was not working in u-boot because of that. With the correct value (found in FriendlyElec's downstream u-boot repository), this 2nd ethernet interface now works. Signed-off-by: Etienne Dublé --- dts/upstream/src/arm64/rockchip/rk3568.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dts/upstream/src/arm64/rockchip/rk3568.dtsi b/dts/upstream/src/arm64/rockchip/rk3568.dtsi index f1be76a54c..06aac034ca 100644 --- a/dts/upstream/src/arm64/rockchip/rk3568.dtsi +++ b/dts/upstream/src/arm64/rockchip/rk3568.dtsi @@ -150,7 +150,7 @@ <0x0 0xf0000000 0x0 0x00100000>; ranges = <0x01000000 0x0 0xf0100000 0x0 0xf0100000 0x0 0x00100000>, <0x02000000 0x0 0xf0200000 0x0 0xf0200000 0x0 0x01e00000>, - <0x03000000 0x0 0x40000000 0x3 0x80000000 0x0 0x40000000>; + <0x03000000 0x0 0x80000000 0x3 0x80000000 0x0 0x40000000>; reg-names = "dbi", "apb", "config"; resets = <&cru SRST_PCIE30X2_POWERUP>; reset-names = "pipe"; From patchwork Mon Jun 24 12:40:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Etienne_Dubl=C3=A9?= X-Patchwork-Id: 1951556 X-Patchwork-Delegate: ykai007@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=imag.fr header.i=@imag.fr header.a=rsa-sha256 header.s=2022 header.b=rkFLWXfe; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W77Ff1JWjz20X1 for ; Mon, 24 Jun 2024 22:54:14 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 15E5588477; Mon, 24 Jun 2024 14:52:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=imag.fr 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=imag.fr header.i=@imag.fr header.b="rkFLWXfe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8917F8837A; Mon, 24 Jun 2024 14:40:36 +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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,PDS_BAD_THREAD_QP_64, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from zm-mta-out-3.u-ga.fr (zm-mta-out-3.u-ga.fr [152.77.200.56]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AD0AD88137 for ; Mon, 24 Jun 2024 14:40:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=imag.fr Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.duble@imag.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=imag.fr; s=2022; t=1719232834; bh=Trh1vYljCGBfeLzUnxCPUpeh1nNFpdNu3cuxPlZl/z8=; h=Date:From:To:Cc:Subject:From; b=rkFLWXfeRnpuJJ/DEPXrTZ3GBXq0XeTmVoliD46s+7Tphv//wJGCO3Wp937eMlk7N 9Tb8m6cW4VMWmlKR8TqjEBiKKrp0jIelOB8+9nhkwkN6gRNO9KK8haKHqcWl+NywoS vsgrcTeIYOt3n5o6d04RBBEldBVZkA7BAZ1gxI2BIcp+CSqFUkzHAtOMmyUQwB57oW hX76cyZEHSQV3eUV2gQ7MUabyXBEsTRE3Ph5iqdQu5Q+BfwlC3wRAjM5TM1U07nTHY wpR5IXbeqqo4CWAksxa/ijDtODesZeMhDmkdF/gTQHS0Oc73ZNqdW+QxRFzDGgY77+ Wq32RrSJBcf5Q== Received: from mailhub.u-ga.fr (mailhub-2.u-ga.fr [129.88.178.102]) by zm-mta-out-3.u-ga.fr (Postfix) with ESMTP id 6296E402E8; Mon, 24 Jun 2024 14:40:34 +0200 (CEST) Received: from mailhost.u-ga.fr (mailhost2.u-ga.fr [129.88.177.242]) by mailhub.u-ga.fr (Postfix) with ESMTP id 5F6A1100068; Mon, 24 Jun 2024 14:40:34 +0200 (CEST) Received: from zm-mbx1.u-ga.fr (zm-mbx1.u-ga.fr [152.77.200.25]) by mailhost.u-ga.fr (Postfix) with ESMTP id 43E706006F; Mon, 24 Jun 2024 14:40:34 +0200 (CEST) Date: Mon, 24 Jun 2024 14:40:34 +0200 (CEST) From: ETIENNE DUBLE To: Kever Yang , Philipp Tomsich , Simon Glass Cc: ETIENNE DUBLE , joe hershberger , Leo Yu-Chi Liang , Minda Chen , Philipp Tomsich , Ramon Fried , Sumit Garg , Tom Rini , u-boot Message-ID: <1097774847.15003262.1719232834237.JavaMail.zimbra@univ-grenoble-alpes.fr> Subject: [PATCH 3/3] net: RTL-8125B -- write mac to MAC0_BKP MIME-Version: 1.0 X-Originating-IP: [129.88.53.250] X-Mailer: Zimbra 10.0.8_GA_4611 (ZimbraWebClient - FF102 (Linux)/10.0.8_GA_4611) Thread-Index: qdRVx/O8xTvENFyyHgIYL9coeK7rzQ== Thread-Topic: RTL-8125B -- write mac to MAC0_BKP X-Greylist: Whitelist-UGA MAILHOST (SMTP non authentifie) depuis 152.77.200.25 X-Mailman-Approved-At: Mon, 24 Jun 2024 14:52:21 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean In the case of RTL-8125B, Linux reads the mac address from register MAC0_BKP instead of MAC0, so let u-boot write the mac address there. Note: writing to MAC0 is still needed too, because this register is used by the hardware for mac filtering (the board will not receive packets if MAC0 is not set). Tested on a FriendlyElec Nanopi R5C board. Signed-off-by: Etienne Dublé --- drivers/net/rtl8169.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c index b30d51731f..7c4d658c6b 100644 --- a/drivers/net/rtl8169.c +++ b/drivers/net/rtl8169.c @@ -153,6 +153,7 @@ enum RTL8125_registers { IntrMask_8125 = 0x38, IntrStatus_8125 = 0x3C, TxPoll_8125 = 0x90, + MAC0_BKP = 0x19e0, }; enum RTL8169_register_content { @@ -881,6 +882,7 @@ void rtl8169_eth_stop(struct udevice *dev) static int rtl8169_write_hwaddr(struct udevice *dev) { struct eth_pdata *plat = dev_get_plat(dev); + struct pci_child_plat *pplat = dev_get_parent_plat(dev); unsigned int i; RTL_W8(Cfg9346, Cfg9346_Unlock); @@ -888,6 +890,19 @@ static int rtl8169_write_hwaddr(struct udevice *dev) for (i = 0; i < MAC_ADDR_LEN; i++) RTL_W8(MAC0 + i, plat->enetaddr[i]); + /* + * In the case of RTL8125, linux is reading the mac + * address from register MAC0_BKP instead of MAC0, + * so let's copy it there. + * Note: we still need to write the mac to MAC0 too + * (cf. the loop above) because the hardware uses MAC0 + * for mac filtering. + */ + if (pplat->device == 0x8125) { + for (i = 0; i < MAC_ADDR_LEN; i++) + RTL_W8(MAC0_BKP + i, plat->enetaddr[i]); + } + RTL_W8(Cfg9346, Cfg9346_Lock); return 0;