From patchwork Thu Jul 27 07:18:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Feiyang Chen X-Patchwork-Id: 13329053 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5619C2DA for ; Thu, 27 Jul 2023 07:18:59 +0000 (UTC) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2865B271C for ; Thu, 27 Jul 2023 00:18:57 -0700 (PDT) Received: from loongson.cn (unknown [112.20.109.108]) by gateway (Coremail) with SMTP id _____8CxtPBfGsJkd5wKAA--.26951S3; Thu, 27 Jul 2023 15:18:55 +0800 (CST) Received: from localhost.localdomain (unknown [112.20.109.108]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Ax8uReGsJkn7c8AA--.31333S2; Thu, 27 Jul 2023 15:18:54 +0800 (CST) From: Feiyang Chen To: andrew@lunn.ch, hkallweit1@gmail.com, peppe.cavallaro@st.com, alexandre.torgue@foss.st.com, joabreu@synopsys.com, chenhuacai@loongson.cn Cc: Feiyang Chen , linux@armlinux.org.uk, dongbiao@loongson.cn, loongson-kernel@lists.loongnix.cn, netdev@vger.kernel.org, loongarch@lists.linux.dev, chris.chenfeiyang@gmail.com Subject: [PATCH v2 08/10] net: stmmac: dwmac-loongson: Disable flow control for GMAC Date: Thu, 27 Jul 2023 15:18:51 +0800 Message-Id: <0ec0ae938964697010b3d035b7885e4dda89b012.1690439335.git.chenfeiyang@loongson.cn> X-Mailer: git-send-email 2.39.3 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Ax8uRe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_Gr1UMIIF0x vE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWxJVW8Jr1lIxAIcVC2z280 aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU0wqXPUUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 X-Patchwork-Delegate: kuba@kernel.org Loongson GMAC does not support Flow Control featurei. Use disable_flow_control flag to disable it. Signed-off-by: Feiyang Chen --- drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c | 2 ++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +++++ include/linux/stmmac.h | 1 + 3 files changed, 8 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c index 3ab55340a6b8..439a5f8bcabe 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c @@ -61,6 +61,8 @@ static int loongson_gmac_data(struct pci_dev *pdev, plat->phy_addr = -1; plat->phy_interface = PHY_INTERFACE_MODE_RGMII_ID; + plat->disable_flow_control = true; + return 0; } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 829de274e75d..4f69cad0be42 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3829,6 +3829,11 @@ static int __stmmac_open(struct net_device *dev, __func__, ret); goto init_phy_error; } + + if (priv->plat->disable_flow_control) { + phy_support_sym_pause(dev->phydev); + phy_set_sym_pause(dev->phydev, false, false, true); + } } /* Extra statistics */ diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index e21076f57205..54b9f308aabb 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -345,5 +345,6 @@ struct plat_stmmacenet_data { const struct dwmac_regs *dwmac_regs; bool dwmac_is_loongson; int has_lgmac; + bool disable_flow_control; }; #endif