Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp830595rwa; Sat, 20 Aug 2022 16:05:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR7/Jq6YgdlnatTmTZ0EcYjXAFMKWV+VXP978nAvJDYa9FIGMvE4bEr7BN82OaVlzQjNRdDW X-Received: by 2002:a17:907:3f98:b0:730:cfce:9c0f with SMTP id hr24-20020a1709073f9800b00730cfce9c0fmr8899166ejc.475.1661036758290; Sat, 20 Aug 2022 16:05:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661036758; cv=none; d=google.com; s=arc-20160816; b=o7gnjZvSnsFHVnISFoimDkKQmIohi4ieqmK+mNEzyuKUFeUeUdc81KiQ8pzj12I88R wNlPmhnRc+rvaOjxmiFAYqvie60CdFwGW491SOHXDkn1tjjtXTPnkHKoOKdK9qw3meoM 3T0McK5sZBLfoCvvZDzPMW+WGB8VDH8qzuyAw61GCI9iBAcrWp2Uxo1ys6kioYDWM8PP fkPX8DSvU+ya+UWdGByDLDHoq10YM+CjojWNH+oweS9nqwU86Th5TDQEd9UG4EC5IBAY mFt1K7JYMzhx+u9EfgdB85hUQCsD7Q+9LLBtpKx1vM5Krm3f9Z7WIv7OYcldO6N+csKp wEKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dAZIRY5AGxEnOQppN8jQUMbg7mSLVLi2n6oyk0nmHQc=; b=ylFutAyzHzrVXx2AHxARH2MoD1Y7Y3dZ4eQp8jjGeUoYdeDvJff4OtbqWuxTNBPTN/ bASpcn6f0JXMyo88Xq336VyxG8zsEraKZMbzrkIuofqMMe6KkaUSgJ5i8I3XFkeErsWn MCeN1hKVpjBn3Vn/IcCbv3RFfZiIItI8Jt0OdtwVhUMhfTAaDnc3Gf5A/U9QkGcywvd3 U1C+2m8zZ67Hutoe43UOpehkdXtriNIP6eWiWm3Fg3HT5RJyYcMDlXfLgatiAHwweVX9 28kRTSvfWlSU6k+9J6wewAJbuddJAW9Ymy6BG8UyRPlAH7G/ZZK3WdoO8ATHGmHY3AC4 69rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@fe80.eu header.s=20190804 header.b=HKS+WKBa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fe80.eu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8-20020a056402090800b0043cdf660c18si6654168edz.323.2022.08.20.16.05.25; Sat, 20 Aug 2022 16:05:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@fe80.eu header.s=20190804 header.b=HKS+WKBa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fe80.eu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235539AbiHTWqk (ORCPT + 99 others); Sat, 20 Aug 2022 18:46:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234960AbiHTWq0 (ORCPT ); Sat, 20 Aug 2022 18:46:26 -0400 Received: from mail.base45.de (mail.base45.de [IPv6:2001:67c:2050:320::77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02414222BE; Sat, 20 Aug 2022 15:46:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=fe80.eu; s=20190804; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=dAZIRY5AGxEnOQppN8jQUMbg7mSLVLi2n6oyk0nmHQc=; b=HKS+WKBa2OPxVQmxIefBthHbZi xhs40fnMMNPcdvxnnR2B+ofNMO8gWecn6A6tStW6DF8CqRzb+SgLtXhLLnwRJK9q3ZFOfYwbfAnai FuoVSAMYU3sXlpiI6lCnjRZcMKwGlHEv/rv29vlBlnGptMZLvD1+URGaZi5q4YKXUUJwvOMJJ6mq0 SdEV1mTVi6k9z5H+gPZ9GjasrIG2sz6z+j0bRbKJzMsPhrQ9v6fblWpdZRR5rA9GF3IRlcRK4692X yBnfdQEjV0bK8OhcKouTr55MDnmtNXmCLp1ajImbkcz9qjFgZOzr7CTI2+T5eFmsMXPUtj57q86aG 2bb7suYg==; Received: from [2a02:2454:9869:1a:9eb6:54ff:0:fa5] (helo=cerator.lan) by mail.base45.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oPXE5-00G2sh-8A; Sat, 20 Aug 2022 22:45:57 +0000 From: Alexander Couzens To: Felix Fietkau , John Crispin , Sean Wang , Mark Lee Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , Russell King , netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Daniel Golle , Alexander Couzens Subject: [PATCH 1/4] net: mediatek: sgmii: fix powering up the SGMII phy Date: Sun, 21 Aug 2022 00:45:35 +0200 Message-Id: <20220820224538.59489-2-lynxis@fe80.eu> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220820224538.59489-1-lynxis@fe80.eu> References: <20220820224538.59489-1-lynxis@fe80.eu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are cases when the SGMII_PHYA_PWD register contains 0x9 which prevents SGMII from working. The SGMII still shows link but no traffic can flow. Writing 0x0 to the PHYA_PWD register fix the issue. 0x0 was taken from a good working state of the SGMII interface. Signed-off-by: Alexander Couzens --- drivers/net/ethernet/mediatek/mtk_sgmii.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_sgmii.c b/drivers/net/ethernet/mediatek/mtk_sgmii.c index 736839c84130..a01bb20ea957 100644 --- a/drivers/net/ethernet/mediatek/mtk_sgmii.c +++ b/drivers/net/ethernet/mediatek/mtk_sgmii.c @@ -36,9 +36,7 @@ static int mtk_pcs_setup_mode_an(struct mtk_pcs *mpcs) val |= SGMII_AN_RESTART; regmap_write(mpcs->regmap, SGMSYS_PCS_CONTROL_1, val); - regmap_read(mpcs->regmap, SGMSYS_QPHY_PWR_STATE_CTRL, &val); - val &= ~SGMII_PHYA_PWD; - regmap_write(mpcs->regmap, SGMSYS_QPHY_PWR_STATE_CTRL, val); + regmap_write(mpcs->regmap, SGMSYS_QPHY_PWR_STATE_CTRL, 0); return 0; @@ -70,9 +68,7 @@ static int mtk_pcs_setup_mode_force(struct mtk_pcs *mpcs, regmap_write(mpcs->regmap, SGMSYS_SGMII_MODE, val); /* Release PHYA power down state */ - regmap_read(mpcs->regmap, SGMSYS_QPHY_PWR_STATE_CTRL, &val); - val &= ~SGMII_PHYA_PWD; - regmap_write(mpcs->regmap, SGMSYS_QPHY_PWR_STATE_CTRL, val); + regmap_write(mpcs->regmap, SGMSYS_QPHY_PWR_STATE_CTRL, 0); return 0; } -- 2.35.1