Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3710691rdh; Tue, 28 Nov 2023 01:26:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IGPKTrg2VmG+an1FLoROHuDcPOX+uBLrRrDQkjDu6bfN1JrwhqCZEpS175xS84sLRyKiblt X-Received: by 2002:a05:6a20:e105:b0:18b:fd04:d1db with SMTP id kr5-20020a056a20e10500b0018bfd04d1dbmr19109492pzb.1.1701163615277; Tue, 28 Nov 2023 01:26:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701163615; cv=none; d=google.com; s=arc-20160816; b=NcG6S4Tz6+hRYccptN0ZrlvPy42Atfrinc6mjP3vkb2st2qo0LRBGpLXqB4MI/aIAg KoUcGfMhyKashOusTGzE2cyXc5f2KW4hzbB0C9rZN10iuvEKEsmRySK00HgRpxqdJ8hC rvP4APxB0LqEj29fM+1I4QVfZnRbiCZcuSnDku5NM6wsybDctCGaxk5gOfG78YmXBPae JGnplxpBdr3nNRaAVNPtt2JirUIytBF9xe9dHn0t9pp65xZRse+euOUwMf3/rIxDNE65 +OQ6L7HYBRhlbkik0knGrdOTIw6k0xLkDFt13ieYkSFr5VTJaosCQEY8BNeEmm/kDrjA yxWg== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=7SWqqO2Y/xiO+TRt8YQW+yLQIPdt2LTdZoHMxmm1Ics=; fh=/J916vkXelNiayUmscwOmBgOOQfOwj2JoATRRyvUhtU=; b=F1xhbOLRGVGrnD3McM5lAW2k1k5eRVHMtYY7XCvnG5CQPrbkGFu1Os7LgFN0PctxJ1 XWQH/mpCTk39dniYn9KNSQKkCAEEqn+gGQPvAwDRUNdOEFWX8Hcd5p0PG3ucknikawTZ UWOQJtRObD+FCvt1UobzTVNsMToGwEnX/w29EgbquvyJuALp4Tn0pPfYzs3QQe0IdNJr abXxmVkqYRyVI/cb6rBZ0deRM2cykTRdBJXc+HiDRlawFRmp4+o/gzBA2GKB5xdAiix4 hFH+A/e6SdgZi/yCl+1Lk2FhLRd9YeHeBUETOfnNeVLB4GXfCIlQ9uHB4UsewBIgF/qu nTcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Sjtn6l7z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id ck21-20020a056a02091500b0056a36ac322fsi12407436pgb.514.2023.11.28.01.26.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 01:26:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Sjtn6l7z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id AD67881A8AA2; Tue, 28 Nov 2023 01:26:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231414AbjK1J0i (ORCPT + 99 others); Tue, 28 Nov 2023 04:26:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230044AbjK1J0h (ORCPT ); Tue, 28 Nov 2023 04:26:37 -0500 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE405D0; Tue, 28 Nov 2023 01:26:42 -0800 (PST) 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 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-GND-Sasl: maxime.chevallier@bootlin.com X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 28 Nov 2023 01:26:52 -0800 (PST) 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