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: 13488096 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VhSO/qrz" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F387CB8 for ; Mon, 11 Dec 2023 13:31:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702330306; 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=VhSO/qrzb9qwflrUwK5C4jAAcISs4g5JgJP0dMs5jtaDNO8i+eJTIZq+y4IWRpX8nLfsQM 8RSwXoEDNmpr6ghakOLGLMTj5bbtbNqvHOJXcoR6BQo+kIBpExrVQdnGsBsg94B0pMDaIM 1IpXsSeRGSYNMC6AOMl3Xl9BvSGXWv8= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-187-CW85fzqkMS2YhpT2qWkCnA-1; Mon, 11 Dec 2023 16:31:40 -0500 X-MC-Unique: CW85fzqkMS2YhpT2qWkCnA-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-67bd67fe537so70468946d6.2 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=meuhgz+w1lV5JF2Yj6sJcsdgNJ8+1M8mA40MSrGlM59q33EH0SJ5lTQnMab/MNIz7Q IEOZqTo0gNEWd7d0iYa2WO25VSjmal8ZHwEPh+Tv8q+Usn4mdbX12DS/dtcEdyuGVRaR CmuSNl002TyQAjcHw8Qs7FB2bFZDVc9tTG/GuTvPY+UiJGj0IEN89MfenZDEhw/4TLN5 SoYkpeJ0tLuFsXRnZ8Tf77ip0ckUE9jACK/bs2vHpecVyG8GVjBbVP71GufYpW4owOjs bcl2Dnt/XZBb4os2FDHwaS/TZDiNU6GIMbFuHfjG/baSGUDOF3QuarZRRIm83SygQqPi 9m9w== X-Gm-Message-State: AOJu0YxbDA+odnKjxvf7gPbHn91IEVQCAhKBQgthQxzGb47tH1K0ERKf mBjwZ3AuyNLfe4rrp2wLxf2G1A2MvU+oNx4KwjWsUc3mkxadZcCUuOjjXvMb4Kc4xofg9r+Yp/l 0bh0hI3Gzo3PDQTo9 X-Received: by 2002:a0c:fb42:0:b0:67a:98bc:4b45 with SMTP id b2-20020a0cfb42000000b0067a98bc4b45mr6325900qvq.25.1702330299796; 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 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-Patchwork-Delegate: kuba@kernel.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; }