Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3693904rdh; Tue, 28 Nov 2023 00:50:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQInS39WNV2dtWb//WHpZ/cE9bUoh3jJhNO+y7Z3Y2JxvdQKI9dpr5WtPp9GWO9rknr+HI X-Received: by 2002:a17:902:e744:b0:1cf:c366:990f with SMTP id p4-20020a170902e74400b001cfc366990fmr9518489plf.15.1701161455081; Tue, 28 Nov 2023 00:50:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701161455; cv=none; d=google.com; s=arc-20160816; b=mLOl/r4yAtmpP+HuM6YxJ6D9kH1o/Mz53k/hAb/VJ2+0Wsjq4G3i9DeXc3kaLb/UsM GznnIVIZfKSYyInA1FYh3BVjJXYcidRuItq34+HSrZMK/C1qFNUQjr2hy97UYFfimXvg mvyZsQjIvE3xgNwqeLzZNscI/WZKRp6DY5n/6rFBLzdoaMgbXt5nMHYcihOkRJM7hP7I DIqh6j2Fbs8ToWtqxD96ddcEjjIu30+3hTBbbv2timj6VWjDDsG+9iKdeoCQEMx42IA+ nOtU1Php2Nnizl1kbbpQKgIr+wgOYi4EiwkrPOuJ314e6T87QFMve2ZFLYHZz5sypZCz COCA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=qYJnE4Z1r7jKRPOrGAwXhHc797bbl+1US3cszB9aa9E=; fh=hPtj/h/NSBXiXh9p0DfPt8/pirJa6GzTo0pcgGy579c=; b=FZ+Wy3Ckc83ne63mARo4gRwwR8bQGmr3DdoIM9Au7M1vVCPuIkI5H90FSnb1g4Bul5 vbg7N4I7wgOZAE0fkJ1EwgcqGKRO15Zqlk4FNCtz/VNaXya7KOaBQJrfGTdyNeKJL9WG mii+N1h53sUpa25xS5AWMT5hlQPTwWA5E8C8gT/eU94dC3Au5FXWSWaZxe9+ItWIJfBa SpMAuLTSkwz84ytnKfc2Do0/fWjAGrh0RhNYf6WaRxnSznxl8VcmUGKWtI/8TjNiaqIJ 2xr0N5VkStuGpH7uhuYwEOUlr/BoJPRtyTc7jFeEkyxBFbdzJTvOI/MC30hStY1qpF64 BGmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Biez3ElI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id u11-20020a17090341cb00b001cfdbd5fe0bsi2846756ple.551.2023.11.28.00.50.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 00:50:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Biez3ElI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 1B9FC807D8DB; Tue, 28 Nov 2023 00:50:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232806AbjK1IuF (ORCPT + 99 others); Tue, 28 Nov 2023 03:50:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234660AbjK1IuE (ORCPT ); Tue, 28 Nov 2023 03:50:04 -0500 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91230E7; Tue, 28 Nov 2023 00:50:09 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 2A138C0011; Tue, 28 Nov 2023 08:50:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1701161408; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=qYJnE4Z1r7jKRPOrGAwXhHc797bbl+1US3cszB9aa9E=; b=Biez3ElIDFQtKoAoSEC77AQXzKbt7Ch1XeZiVYhh0NXtG9v9GlfxXJMHUGbOSfb77LUOcn 3R+0msBidXWkzyP/oA03LjO59JoGEB8nwVxWQhzryO7/3lBgdfOGe+ccmpFTRzo+6Hyh/S GD+Y3ayQHKYfSpqkoEeBAFW7jASzaG7FBLQy3BcrLGsrxmfREYLffgYMaUk3magZpde8IY Jpkm3fVUL0fUT7BMlooYuZIqQDCRhLrK/p3fM+xSrJ+AkeIXExE94qMn2452ctDbzk7VWP 2n/LDss+hsxqQFoi5sfx/ccHyQ5hgvuoH436OaEzpLi2b4pI+5FaKvrDAG795Q== From: Maxime Chevallier To: davem@davemloft.net Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, 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: [PATCH net] net: stmmac: dwmac-socfpga: Don't access SGMII adapter when not available Date: Tue, 28 Nov 2023 10:45:37 +0100 Message-ID: <20231128094538.228039-1-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 howler.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 (howler.vger.email [0.0.0.0]); Tue, 28 Nov 2023 00:50:21 -0800 (PST) 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) -- 2.42.0