From patchwork Mon Dec 11 21:31:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 13488098 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 CE4EBC4332F for ; Mon, 11 Dec 2023 21:32:22 +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:Cc:To:Message-Id:MIME-Version:Subject: Date:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=cn/eEYqnTX8TVXoY7C+qEi22pD3u8bfprbAEmLvoljk=; b=f5R/TTw55y+xfd JNve/cZz7zjovvZhF4hNKP+x7Eg2YQZC94JXO1jRVSPhd6QqFIa9JxejoEiEiAu64UVGrEd4A6wrT jhLjEf7Jom/fVT+DF2sCDIxLqlYIVdhbOfSLeV2drniLMgTaHO6n2oxbt8aUGUC1zqbRLrTidU+YT E0QzBZVdK1h7jllsprgp2DQ3UcLlm7P3cs08vf1WBMD1SNHi4U5zKWcLokA2kN6qGGBgZwNMlVbgq py4HTu2sGHUr57YEmSEzl31El7k4Zg4xWbv5KmUX/wlP6brlTcXriFgArCmAMEG4QlS7+Wo7OHnEe kloZLr/AAR4hdMSCTyGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rCnsU-008eHW-0G; Mon, 11 Dec 2023 21:31:50 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rCnsR-008eDq-1z for linux-arm-kernel@lists.infradead.org; Mon, 11 Dec 2023 21:31:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702330303; 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; bh=3m2lRSq/x6O1AvE2D5Tmo4LBWE3DJjeKHdxsqLlOX9k=; b=ec70QmQuJGx6twr5DK2gm6pSrMcuuJ9SFeNBD7wE9ZRqpOHCXxEnto8JJbWHIdj1i67VIE IyhINJw9anVoUkcRlvLZtOpS8voFoc0p6qAVKeK9yVaPHN2q1RT8BIaAxPFvQXkyfWYElO nB3p65fR1g01PXZw3m1ARVzstnZhacw= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-35-d-Dp_2MFO52ZLu2VyfYFPg-1; Mon, 11 Dec 2023 16:31:40 -0500 X-MC-Unique: d-Dp_2MFO52ZLu2VyfYFPg-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-67ab7e9d393so70537106d6.1 for ; Mon, 11 Dec 2023 13:31:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702330299; x=1702935099; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3m2lRSq/x6O1AvE2D5Tmo4LBWE3DJjeKHdxsqLlOX9k=; b=HlXEqVdU/Vcv7Cz2m2wE1nmE29RhIo1eEsvvaoqugBwSpN2LN9RHdh+X5CPvwMNVSZ 67MCeg4G9b7+fQsPNa7mfV2jCcbi3Vpg6y/WwEjjC49H50gtXrF3ULR5vw7hpDSyMN5l Lp/rTYljX97RIfeJUHcOy1/PYAWS74Jl89SEhi+UhlNRB87miQUHdWCR+m5OHwv5Fw0X /Sabc5F0LWqlK7IeecF/RNmDuYPjlGyxuXyclLyAytuv9SO3712w2lnjYmCr6AyX3kjQ sSRMEWZx123soP6qv7y3gBhx60QEURTggiLHjx3w0eheIun6jnzuoitTvnBszHaxuF2A 7pWA== X-Gm-Message-State: AOJu0Yy2CxtN9hjLCRpI1YKEXVBLjJLffpe8OyHYIWfXRFVPZa9kqkMp rVpcGK99ujm6L3652LB93o5ar7YoV9m4r+Tyt1F54DU2QgC3GLdW602suVKr6N+3eRoJQ3wzzdu dKImT8H1sOoat8uGO6mBGRnec61griQf01o8= X-Received: by 2002:a0c:fb42:0:b0:67a:98bc:4b45 with SMTP id b2-20020a0cfb42000000b0067a98bc4b45mr6325913qvq.25.1702330299819; Mon, 11 Dec 2023 13:31:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IHfOr5Qchzr/j+FGRg3RKaC+dHzH5m7JUsZDA1GvPXcQq/y9SyQGFh3KmV3W0rrIbwNAaai2g== X-Received: by 2002:a0c:fb42:0:b0:67a:98bc:4b45 with SMTP id b2-20020a0cfb42000000b0067a98bc4b45mr6325895qvq.25.1702330299614; Mon, 11 Dec 2023 13:31:39 -0800 (PST) Received: from [192.168.1.164] ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id t18-20020a05621405d200b00677a12f11bcsm3579945qvz.24.2023.12.11.13.31.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 13:31:39 -0800 (PST) From: Andrew Halaney Date: Mon, 11 Dec 2023 15:31:17 -0600 Subject: [PATCH net] net: stmmac: Handle disabled MDIO busses from devicetree MIME-Version: 1.0 Message-Id: <20231211-b4-stmmac-handle-mdio-enodev-v1-1-73c20c44f8d6@redhat.com> X-B4-Tracking: v=1; b=H4sIAKR/d2UC/x3MQQrCMBBG4auUWTvgxBKCVxEXMfOrAyaRpJRC6 d0NLj8evJ06mqHTddqpYbVutQzIaaL0juUFNh0md3YXcSL8mLkvOcfEI+sHnNUqo1TFysGJDwo fko80Ft+Gp23//Y0KFrofxw8QHoykcwAAAA== To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Giuseppe Cavallaro Cc: Andrew Lunn , Serge Semin , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Andrew Halaney X-Mailer: b4 0.12.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231211_133147_722012_9FF80E82 X-CRM114-Status: GOOD ( 13.81 ) 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 Many hardware configurations have the MDIO bus disabled, and are instead using some other MDIO bus to talk to the MAC's phy. of_mdiobus_register() returns -ENODEV in this case. Let's handle it gracefully instead of failing to probe the MAC. Fixes: 47dd7a540b8a (net: add support for STMicroelectronics Ethernet controllers.") Signed-off-by: Andrew Halaney --- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- base-commit: bbd220ce4e29ed55ab079007cff0b550895258eb change-id: 20231211-b4-stmmac-handle-mdio-enodev-82168de68c6a Best regards, diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index fa9e7e7040b9..a39be15d41a8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -591,7 +591,13 @@ int stmmac_mdio_register(struct net_device *ndev) new_bus->parent = priv->device; err = of_mdiobus_register(new_bus, mdio_node); - if (err != 0) { + if (err) { + if (err == -ENODEV) { + /* The bus is disabled in the devicetree, that's ok */ + mdiobus_free(new_bus); + return 0; + } + dev_err_probe(dev, err, "Cannot register the MDIO bus\n"); goto bus_register_fail; }