From patchwork Fri May 24 21:02:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13673753 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 14EDEC25B79 for ; Fri, 24 May 2024 21:04:03 +0000 (UTC) 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=YT+08laol/rxHhAD1FJF3IpHisq/RaFwSUBKO/a5tR8=; b=ru9DT3Wkrdf/lU 7zQRdjBtGwEagCBVjec6pnWgJFQBXIybINRLeNWtSBXa33a9gXedveULZpSssVeZfv+4vcwx4VoVh SfD2KKD0jeaFjJSFE5gy2N6Wx6lp/VjChNmogdS3SgYFc62UC5/k8czQNfH3zZ7m4xy9ZYKCvH7MQ qT4DfIJNarBKwTdwCZRwJOLIHQTHr2Fqvsf6wsEo7igfVDOkinGTrlDCWBBCiwDhSxX8LwuE8jHpo qlfcT+REMnIsnfitia1ZwtIbo91prdcbL9DPHK7j2DSn7dhSx1WHN6LSadZXdDwPVKVznfrl4Rrf+ TZQ6rFfGxWNGGIPp5fkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sAc4u-00000009szj-2Gj0; Fri, 24 May 2024 21:03:52 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sAc4Y-00000009srE-3iKC for linux-arm-kernel@lists.infradead.org; Fri, 24 May 2024 21:03:33 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-5295f201979so1547602e87.2 for ; Fri, 24 May 2024 14:03:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716584605; x=1717189405; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6SsA/DX4FQd1mwIvYQLseyq3XbpKYYuZmRUlHTPnong=; b=YRmmHh7WVa2vwlfD9E9Zb9tMB8JCz6xlXuUhUQGmBQ1wXHzCfCeL8P10TAkLRh4UGU vmBLTuISBEyTMCERq9Dve8/k+SSNUs4cOuPWZZ11E74BKQIWbPBYkMeVvou58nAUqcJa TuuuwjEuHRdGu4V0mqj0f2ihP9rZh/4DxrZ4asY2eVJt36oC1NLOr6NBns+MeNmDbSaw Lri/kBQmRTUngBzvI6Nl83xorADXJqZ/yrow9MPuAL0pRC+cCQLFF7qfXdU1u3Y4vWSN SIlcpAZIegUIdhz9P5aeR+ZLZlNmUoMf1VSzlgJbD/xbAaXtFguerPy5yFVO2e0faE1l eNsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716584605; x=1717189405; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6SsA/DX4FQd1mwIvYQLseyq3XbpKYYuZmRUlHTPnong=; b=vo2hF2a7+gqeFyYGyO00MvL7yiO1vB1dHvrT9y6r/TzIHf5KV5+Ux7VASH+Wb09DwB Ouh4VSvNBypQkVxOZrNXSkFfgcQ/9UZAB6EDRNnE2bqr+cGKTzLydeVuvrjUxS1sxiXs jMn72oshq9MkYV9yqdnyRS9D6gBDJT8PPamjSVYC8oaOUeVj9K7RAY0BfeExhFWTzRx9 05QzNyKzx8Idlesufu0Y3HCvL9wb9ixq5QifUSIGklu6Q6BXbxiecVvRCPuNbpyhFc07 4M91uSC8Uy5hrp+5W2Gn2jFEtLjItFrztAqmIFHEPclrhrei2zaPPHZkysIW2zgHDMj6 KpWQ== X-Forwarded-Encrypted: i=1; AJvYcCUV1IcERmCHMgWPHp+znV+YsjJdOyM8GZgCxEpMnYv9724cKIoV3oRLqGeHrUoIExyz/QvLo4IuS0c8zumaLa5GQKYEAUTdApnTmfGvbrhAFSHn07Q= X-Gm-Message-State: AOJu0YwJETXuZV7S/oAUun5tJWqRAuMZe2UE7rGPpf6BTi438jocOfiE TR4pqc9Z+aI40D4YiIrQrNw8JlzxlBcYSRgYFc2wNcKz3BDrZrfL X-Google-Smtp-Source: AGHT+IG0PT+7TnzaGJ6HfS/LUBBacBaRk08p6C1KaUcsx5/G5OJ+ElDL8rqeNbSK5PYnnNXLPfqj6Q== X-Received: by 2002:ac2:454c:0:b0:523:a924:3268 with SMTP id 2adb3069b0e04-52964109a01mr1779610e87.6.1716584604952; Fri, 24 May 2024 14:03:24 -0700 (PDT) Received: from localhost ([95.79.182.53]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5297066bcd6sm237510e87.164.2024.05.24.14.03.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 14:03:24 -0700 (PDT) From: Serge Semin To: Russell King , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin Cc: Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , bpf@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC net-next 3/3] net: stmmac: Drop TBI/RTBI PCS flags Date: Sat, 25 May 2024 00:02:59 +0300 Message-ID: <20240524210304.9164-3-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240524210304.9164-1-fancer.lancer@gmail.com> References: <20240524210304.9164-1-fancer.lancer@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240524_140331_067341_561A6AA3 X-CRM114-Status: GOOD ( 18.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org First of all the flags are never set by any of the driver parts. If nobody have them set then the respective statements will always have the same result. Thus the statements can be simplified or even dropped with no risk to break things. Secondly shall any of the TBI or RTBI flag is set the MDIO-bus registration will be bypassed. Why? It really seems weird. It's perfectly fine to have a TBI/RTBI-capable PHY configured over the MDIO bus interface. Based on the notes above the TBI/RTBI PCS flags can be freely dropped thus simplifying the driver code. Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/common.h | 2 - .../net/ethernet/stmicro/stmmac/stmmac_main.c | 37 ++++++------------- 2 files changed, 11 insertions(+), 28 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index b02b905bc892..40a930ea4ff3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h @@ -268,8 +268,6 @@ struct stmmac_safety_stats { /* PCS defines */ #define STMMAC_PCS_RGMII (1 << 0) #define STMMAC_PCS_SGMII (1 << 1) -#define STMMAC_PCS_TBI (1 << 2) -#define STMMAC_PCS_RTBI (1 << 3) #define SF_DMA_MODE 1 /* DMA STORE-AND-FORWARD Operation Mode */ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 6c4e90b1fea3..06f95dfdf09e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -471,13 +471,6 @@ bool stmmac_eee_init(struct stmmac_priv *priv) { int eee_tw_timer = priv->eee_tw_timer; - /* Using PCS we cannot dial with the phy registers at this stage - * so we do not support extra feature like EEE. - */ - if (priv->hw->pcs == STMMAC_PCS_TBI || - priv->hw->pcs == STMMAC_PCS_RTBI) - return false; - /* Check if MAC core supports the EEE feature. */ if (!priv->dma_cap.eee) return false; @@ -3945,9 +3938,7 @@ static int __stmmac_open(struct net_device *dev, if (ret < 0) return ret; - if (priv->hw->pcs != STMMAC_PCS_TBI && - priv->hw->pcs != STMMAC_PCS_RTBI && - (!priv->hw->xpcs || + if ((!priv->hw->xpcs || xpcs_get_an_mode(priv->hw->xpcs, mode) != DW_AN_C73) && !priv->hw->lynx_pcs) { ret = stmmac_init_phy(dev); @@ -7724,16 +7715,12 @@ int stmmac_dvr_probe(struct device *device, if (!pm_runtime_enabled(device)) pm_runtime_enable(device); - if (priv->hw->pcs != STMMAC_PCS_TBI && - priv->hw->pcs != STMMAC_PCS_RTBI) { - /* MDIO bus Registration */ - ret = stmmac_mdio_register(ndev); - if (ret < 0) { - dev_err_probe(priv->device, ret, - "%s: MDIO bus (id: %d) registration failed\n", - __func__, priv->plat->bus_id); - goto error_mdio_register; - } + ret = stmmac_mdio_register(ndev); + if (ret < 0) { + dev_err_probe(priv->device, ret, + "MDIO bus (id: %d) registration failed\n", + priv->plat->bus_id); + goto error_mdio_register; } if (priv->plat->speed_mode_2500) @@ -7776,9 +7763,7 @@ int stmmac_dvr_probe(struct device *device, phylink_destroy(priv->phylink); error_xpcs_setup: error_phy_setup: - if (priv->hw->pcs != STMMAC_PCS_TBI && - priv->hw->pcs != STMMAC_PCS_RTBI) - stmmac_mdio_unregister(ndev); + stmmac_mdio_unregister(ndev); error_mdio_register: stmmac_napi_del(ndev); error_hw_init: @@ -7817,9 +7802,9 @@ void stmmac_dvr_remove(struct device *dev) if (priv->plat->stmmac_rst) reset_control_assert(priv->plat->stmmac_rst); reset_control_assert(priv->plat->stmmac_ahb_rst); - if (priv->hw->pcs != STMMAC_PCS_TBI && - priv->hw->pcs != STMMAC_PCS_RTBI) - stmmac_mdio_unregister(ndev); + + stmmac_mdio_unregister(ndev); + destroy_workqueue(priv->wq); mutex_destroy(&priv->lock); bitmap_free(priv->af_xdp_zc_qps);