From patchwork Sat Jul 23 20:53:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hoffmann X-Patchwork-Id: 1659984 X-Patchwork-Delegate: daniel@makrotopia.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Fv7ulAJ/; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=3e8.eu header.i=@3e8.eu header.a=rsa-sha256 header.s=mail20211217 header.b=G7G3Dl3Y; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lqzfd5Bhlz9sGp for ; Sun, 24 Jul 2022 07:17:45 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LZAn7lM3ofTajT30FXg0j06jPGdHbbUdWX/ARo3HI5o=; b=Fv7ulAJ/d9zV29 Yq4iZQ+JeE0VCudIjxOaIt5i3XhApoHKxpRpye0NaMSEEZx22+xE++2PbPCTr9cxNdsTm6Lx2ORoV RqDSxnKPK/jul1OVWZyE7QulGSauw9KzxVmQ0Si+Xt2TMGPZD91pYMW8GQ2udqpBrTKLIcysCoBtf HxQZe8gaQ8Q0fdFKrjuGgrEzakRgFewPlD8BFQoWuZW0W7yP7djmtmwiHrBpNBPD8+O4QBN+k57aU mHGfqouRgMe0JD6ubZE02pTCydqgrIduaDMYKPdOYyLIBlJQyhyPF5PZwNCMbqYPoPjMqmXF6JfRB 463rJub/pUXUg5NJ4yDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oFMRC-007NbE-CD; Sat, 23 Jul 2022 21:13:27 +0000 Received: from srv4.3e8.eu ([2001:67c:12a0:200::2]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oFM83-007Db2-2D for openwrt-devel@lists.openwrt.org; Sat, 23 Jul 2022 20:53:41 +0000 Received: from localhost.localdomain (p200300c6cf1309a09555e5d92b92c48c.dip0.t-ipconnect.de [IPv6:2003:c6:cf13:9a0:9555:e5d9:2b92:c48c]) (using TLSv1.3 with cipher TLS_CHACHA20_POLY1305_SHA256 (256/256 bits)) (No client certificate requested) by srv4.3e8.eu (Postfix) with ESMTPSA id 4CD4A60211; Sat, 23 Jul 2022 22:53:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=3e8.eu; s=mail20211217; t=1658609615; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qvJdROZL2jjxEXoYy7096pf+vKrgpbBaOVvyjSFekBA=; b=G7G3Dl3YfBjA/UDNb0aQqXacJ6Q7+TjO2q7nPMfwhSBz+tnrN4+zY4Zw/OUh1eoEHH5/g/ yGHjxqCKsVXLFsJM/VliC6qxWcTf/fJdmdvXrECwzYZByKtm+wLYMl1wnQ4jzUWC9OZ/D8 WVtwZmnjtwLIcx2Cqc9g2F/lxfvfOu1azIMh8w9I2q+cYe0z4WUqjwy+kugsEmAWs3tWPC 4EmIzqdHScf6zafwn8MhkZySS8KrW1pnuvsLpF7rwowgEk23HbdbrCrtVCC9y+zHSa3s2H H6E5aAWYHD1ukp36+tRkTuX9XunsDjXCicR7bQD6fDviSdLMljzRwmXy871YVQ== From: Jan Hoffmann To: openwrt-devel@lists.openwrt.org Cc: Birger Koblitz , Sander Vanheule , Jan Hoffmann Subject: [PATCH 1/7] realtek: rtl83xx-phy: fix RTL8214FC media change Date: Sat, 23 Jul 2022 22:53:13 +0200 Message-Id: <20220723205319.3326374-2-jan@3e8.eu> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220723205319.3326374-1-jan@3e8.eu> References: <20220723205319.3326374-1-jan@3e8.eu> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220723_135339_463704_8BF0ACBB X-CRM114-Status: UNSURE ( 8.22 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Toggle power on the individual PHY instead of the package. Otherwise a media change always toggles power on the first port, and not the one that is being configured. Signed-off-by: Jan Hoffmann --- .../files-5.10/drivers/net/phy/rtl83xx-phy.c | 32 +++++++++ 1 file changed, 16 insertions(+), 16 deletions(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Toggle power on the individual PHY instead of the package. Otherwise a media change always toggles power on the first port, and not the one that is being configured. Signed-off-by: Jan Hoffmann --- .../files-5.10/drivers/net/phy/rtl83xx-phy.c | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/target/linux/realtek/files-5.10/drivers/net/phy/rtl83xx-phy.c b/target/linux/realtek/files-5.10/drivers/net/phy/rtl83xx-phy.c index f0c30b36555e..252389489106 100644 --- a/target/linux/realtek/files-5.10/drivers/net/phy/rtl83xx-phy.c +++ b/target/linux/realtek/files-5.10/drivers/net/phy/rtl83xx-phy.c @@ -949,19 +949,20 @@ static void rtl8380_rtl8214fc_media_set(struct phy_device *phydev, bool set_fibr pr_info("Current media %x\n", media); if (media & 0x2) { pr_info("Powering off COPPER\n"); - phy_package_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_COPPER); + phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_COPPER); /* Ensure power is off */ - power = phy_package_read_paged(phydev, RTL821X_PAGE_POWER, 0x10); + power = phy_read_paged(phydev, RTL821X_PAGE_POWER, 0x10); if (!(power & (1 << 11))) - phy_package_write_paged(phydev, RTL821X_PAGE_POWER, 0x10, power | (1 << 11)); + phy_write_paged(phydev, RTL821X_PAGE_POWER, 0x10, power | (1 << 11)); } else { - pr_info("Powering off FIBRE"); - phy_package_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_FIBRE); + pr_info("Powering off FIBRE\n"); + phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_FIBRE); /* Ensure power is off */ - power = phy_package_read_paged(phydev, RTL821X_PAGE_POWER, 0x10); + power = phy_read_paged(phydev, RTL821X_PAGE_POWER, 0x10); if (!(power & (1 << 11))) - phy_package_write_paged(phydev, RTL821X_PAGE_POWER, 0x10, power | (1 << 11)); + phy_write_paged(phydev, RTL821X_PAGE_POWER, 0x10, power | (1 << 11)); } + phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO); if (set_fibre) { val |= 1 << 10; @@ -975,22 +976,21 @@ static void rtl8380_rtl8214fc_media_set(struct phy_device *phydev, bool set_fibr phy_package_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO); if (set_fibre) { - pr_info("Powering on FIBRE"); - phy_package_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_FIBRE); + pr_info("Powering on FIBRE\n"); + phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_FIBRE); /* Ensure power is off */ - power = phy_package_read_paged(phydev, RTL821X_PAGE_POWER, 0x10); + power = phy_read_paged(phydev, RTL821X_PAGE_POWER, 0x10); if (power & (1 << 11)) - phy_package_write_paged(phydev, RTL821X_PAGE_POWER, 0x10, power & ~(1 << 11)); + phy_write_paged(phydev, RTL821X_PAGE_POWER, 0x10, power & ~(1 << 11)); } else { pr_info("Powering on COPPER\n"); - phy_package_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_COPPER); + phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_COPPER); /* Ensure power is off */ - power = phy_package_read_paged(phydev, RTL821X_PAGE_POWER, 0x10); + power = phy_read_paged(phydev, RTL821X_PAGE_POWER, 0x10); if (power & (1 << 11)) - phy_package_write_paged(phydev, RTL821X_PAGE_POWER, 0x10, power & ~(1 << 11)); + phy_write_paged(phydev, RTL821X_PAGE_POWER, 0x10, power & ~(1 << 11)); } - - phy_package_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO); + phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO); } static bool rtl8380_rtl8214fc_media_is_fibre(struct phy_device *phydev)