From mboxrd@z Thu Jan 1 00:00:00 1970 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 9DB02C4167B for ; Tue, 28 Nov 2023 09:27:15 +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:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8aZQ8Lw8nmLdhcGNtCKMwVkL75kp9O1qBUFNwtsFizg=; b=OBmNT3opzm3gE1 VwFlJlynJJ6v/ENqg0ienwm7LGOdbP/b1nQPDeujbbyPmqgcW3QEARCz0/ihiTf5P6a9Mgfr49Y2O 2lty9uslHiE941Y1JhB+ilfUARsWc1lSE13amW7HgwD/wFBppNDk/qKRVsCNiWHVzgV8zyv5rLy07 vP09455+7LtIeHwEtSlz53B1WJE0rBI29gn+nlY/QFMPEc5L6GbqJJwqk/kg4rzGsfhyRNlvCh1qX JzgcAxKB9eD4XjRene9zjNICDLl7EE6nNPL2jRS3+ZsnoZkzHFOHTKD1gkpP1+28MAo/XdkOX6Q52 82DJmJqfNgELxqBVPYuw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r7uMi-004jmP-09; Tue, 28 Nov 2023 09:26:48 +0000 Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r7uMe-004jls-2g for linux-arm-kernel@lists.infradead.org; Tue, 28 Nov 2023 09:26:46 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 14305E000C; Tue, 28 Nov 2023 09:26:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1701163601; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7SWqqO2Y/xiO+TRt8YQW+yLQIPdt2LTdZoHMxmm1Ics=; b=Sjtn6l7zR30mQxJLlA3aYzk9WnLTcPBVw0DYsqorv2X4Go8xgOK4V3aCzIINxp+nkLGQK5 Ayse/f/Mse7tHbDjEPE+MPdWmz3bMf42OLOslD8lN5W9elEuudOQOBJjNrD+tiwAbEWIAr SCTRi+QfaZVk0WJipImlHqNLPfi9dC88hjVDTFMScwVwr1vaJ5aeZQD3WVaCxQPTF2Ikz1 dlK4suG6cJLtk01cHyNVpoT0H7VlPB0VGUwvyIScf/5+mKM+5Bfq0T+bA2rNwRtCJDAFRP Jp/kVUBaLItB12epGtBbbim4dhUuRLuNfhMK3eet1bJq29qppvLkNdVT6MzFIA== Date: Tue, 28 Nov 2023 11:20:37 +0100 From: Maxime Chevallier To: Thomas Petazzoni Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jakub Kicinski , Eric Dumazet , Paolo Abeni , linux-arm-kernel@lists.infradead.org, Alexandre Torgue , Jose Abreu , Maxime Coquelin , Simon Horman , linux-stm32@st-md-mailman.stormreply.com, alexis.lothore@bootlin.com Subject: Re: [PATCH net] net: stmmac: dwmac-socfpga: Don't access SGMII adapter when not available Message-ID: <20231128112037.21e2d5aa@device.home> In-Reply-To: <20231128101841.627fc97e@windsurf> References: <20231128094538.228039-1-maxime.chevallier@bootlin.com> <20231128101841.627fc97e@windsurf> Organization: Bootlin X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-redhat-linux-gnu) MIME-Version: 1.0 X-GND-Sasl: maxime.chevallier@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231128_012644_996517_4220348F X-CRM114-Status: GOOD ( 21.25 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello Thomas, On Tue, 28 Nov 2023 10:18:41 +0100 Thomas Petazzoni wrote: > On Tue, 28 Nov 2023 10:45:37 +0100 > Maxime Chevallier wrote: > > > The SGMII adapter isn't present on all dwmac-socfpga implementations. > > Make sure we don't try to configure it if we don't have this adapter. > > > > Fixes: 5d1f3fe7d2d5 ("net: stmmac: dwmac-sogfpga: use the lynx pcs driver") > > Signed-off-by: Maxime Chevallier > > --- > > drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c > > index ba2ce776bd4d..ae120792e1b6 100644 > > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c > > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c > > @@ -243,7 +243,8 @@ static void socfpga_sgmii_config(struct socfpga_dwmac *dwmac, bool enable) > > { > > u16 val = enable ? SGMII_ADAPTER_ENABLE : SGMII_ADAPTER_DISABLE; > > > > - writew(val, dwmac->sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); > > + if (dwmac->sgmii_adapter_base) > > + writew(val, dwmac->sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG); > > } > > > > static int socfpga_set_phy_mode_common(int phymode, u32 *val) > > Reviewed-by: Thomas Petazzoni > > As a follow-up improvement, there's an open-coded version of > socfpga_sgmii_config() in socfpga_dwmac_fix_mac_speed(), which could be > rewritten as such: > > socfpga_sgmii_config(dwmac, false); > > if (splitter_base) { > val = readl(splitter_base + EMAC_SPLITTER_CTRL_REG); > val &= ~EMAC_SPLITTER_CTRL_SPEED_MASK; [...] I did saw this, but as this is merely a non-functional rework, I'd like to target this to net-next, so I'll wait for the fix to land and follow-up with this rework indeed. Thanks for the review, Maxime _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel