From patchwork Tue Dec 12 22:18:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 13490063 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 F30D2C4332F for ; Tue, 12 Dec 2023 22:19:23 +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=0qfvVRcAfSt5dGxiJe8WmIqy2eOccruC5bnzZx0rEb0=; b=qc7CwbLxLqkRJJ 4QG5KKYdsQQIX/vvbtTyX0SsoqnitetdD85HlSHrCqZPgsppICqZEz7gdpjTwow9Q1/GBlfaOB77n zRyT4PFqtJ9Jd68M/H/xbjMKchkxPonxfbmCB0DZRZmBhoPnlkSBmTMhP79APoDP4h7y/n7eZuvP2 5XvRnvAUG17N2GhUHPcUvBMrqB8duJcqVlOvA9RTJuX5hhAAe3vNiKl2edgYzI0Sm8auFfPyh8VB7 CgylR5xHB71XsBjU73W0TU2EuRXDAu3SFXvkNs25oh3RfxVgWzOoBrrLEyNxILpRmbZ8kbJadVrU3 sUR4LK808Y22R7gZsLWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDB5Z-00CuXe-0D; Tue, 12 Dec 2023 22:18:53 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDB5V-00CuWY-2H for linux-arm-kernel@lists.infradead.org; Tue, 12 Dec 2023 22:18:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702419527; 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=niWso/AgTSlNDKs+hLJfqSanWTgF91oEfLP5s9hKVlo=; b=NkiDe0X3oLh53daKOMINJ+6VWJoFuV0ETyQqXCM2fnFgyPHpirjp6GAOE/k85NIlQtdgK+ NUkLaWrX/9plDYCYs8EslKxZwcco1/tSbNqumsC0kixSGmJjAVY2wq5XKPJaUz2Cl8q6UX xBq7fAOneSH7MxvQ5wdJbPLUDrFS6wE= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-192-FUYorhqzPp2IsZA2KD7CHA-1; Tue, 12 Dec 2023 17:18:44 -0500 X-MC-Unique: FUYorhqzPp2IsZA2KD7CHA-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-679ff96b259so84135046d6.0 for ; Tue, 12 Dec 2023 14:18:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702419524; x=1703024324; 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=niWso/AgTSlNDKs+hLJfqSanWTgF91oEfLP5s9hKVlo=; b=WmmyV4/JGFlZY9bSGITtQVsa7Z5j4PLEbCjBMDZ7urklQlJRdaZ/eEXNNNQWqu1jS4 4RwYTGTUZgiWJ1v19OdXdz+A7oiTThhXXjMEdTrZ+OvYxNcZli93jOLtnd+kDmpqxyxN h5BMNGiPsbGccdP3hKuHkjlNwT7OomiGyoaOHxXLuHMHG2Uh3Oc0wcS3Q+Xt4Wt57/UY zZfogoDIQhBsHVAJsJFH+sojH+p+uZaii7FryC3G068aM34rjCZ6pdcrI4nhunEDz6lM FaT6n5Hm3pw83eT81Q98IYcCK0LPZCEgM2FWYFTYd9VOKAxYiVMFu5idenS05orGp8dR OynA== X-Gm-Message-State: AOJu0YxIDdQv507/3/BZjZTFsOVynI1V6wdUTiuc/A04n2M2b2EOMcvM X8CB45NTEvLbXR0TPz4IlCoVm045fKGYCFMpRBodUCvze+iqxRFZ08UuR+/W3IDqsE3pU0Net0K 0ItqDSFNN8454IHmLqd8vVeb9No6VWpfO5iQ= X-Received: by 2002:a0c:c210:0:b0:67e:f58a:d6b0 with SMTP id l16-20020a0cc210000000b0067ef58ad6b0mr226807qvh.27.1702419524252; Tue, 12 Dec 2023 14:18:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IHXwgdCMDLzfi+fVcHm7+1qcErjuVF1ZgVVAksnjigHixsYAtg0Q68ahZCHFpj/G+kad1CZTA== X-Received: by 2002:a0c:c210:0:b0:67e:f58a:d6b0 with SMTP id l16-20020a0cc210000000b0067ef58ad6b0mr226790qvh.27.1702419524008; Tue, 12 Dec 2023 14:18:44 -0800 (PST) Received: from [192.168.1.163] ([2600:1700:1ff0:d0e0::37]) by smtp.gmail.com with ESMTPSA id uw2-20020a05620a4d8200b0077f103c8ad6sm4050578qkn.82.2023.12.12.14.18.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 14:18:43 -0800 (PST) From: Andrew Halaney Date: Tue, 12 Dec 2023 16:18:33 -0600 Subject: [PATCH net v2] net: stmmac: Handle disabled MDIO busses from devicetree MIME-Version: 1.0 Message-Id: <20231212-b4-stmmac-handle-mdio-enodev-v2-1-600171acf79f@redhat.com> X-B4-Tracking: v=1; b=H4sIADjceGUC/42NQQrDIBBFrxJm3SnRBCtd9R4lC+tMGqFqUZGW4 N0rOUGX7z94f4fMyXGG67BD4uqyi6GDPA1gNxOejI46gxzlJKQQ+JgxF++Nxa7pxejJReQQiSt qKZQmVtoqAz3xTry6z5G/Q+ACSx83l0tM3+OyikP9V68CBV4mK0c7z6smdUtMmylnGz0srbUfm X3voM4AAAA= 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, Simon Horman , 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-20231212_141849_827472_FB622B20 X-CRM114-Status: GOOD ( 14.07 ) 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 Reviewed-by: Serge Semin --- Changes in v2: - Improve error handling code (Serge) - Fix malformed Fixes tag (Simon) - Link to v1: https://lore.kernel.org/r/20231211-b4-stmmac-handle-mdio-enodev-v1-1-73c20c44f8d6@redhat.com --- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 6 +++++- 1 file changed, 5 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..0542cfd1817e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -591,7 +591,11 @@ 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 == -ENODEV) { + err = 0; + dev_info(dev, "MDIO bus is disabled\n"); + goto bus_register_fail; + } else if (err) { dev_err_probe(dev, err, "Cannot register the MDIO bus\n"); goto bus_register_fail; }