From patchwork Wed Jan 18 10:01:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 45163 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2267264wrn; Wed, 18 Jan 2023 02:56:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXvFqnMKp8JwTstVoAaXLf3JPslvTcy8Q6wxXZ75NzzgQFaR78A/lI2/C3+xpGTaA649OdZH X-Received: by 2002:a17:907:7e9c:b0:86e:2c11:9bca with SMTP id qb28-20020a1709077e9c00b0086e2c119bcamr8242242ejc.30.1674039392979; Wed, 18 Jan 2023 02:56:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674039392; cv=none; d=google.com; s=arc-20160816; b=n3pldEuI++E4zWiuLXN1z4srujJgc4BnNfmii9gxEizHhtLmQ0Di39ySnGZScVy5qD fRtsbShTDDRIr2WHjb8qj87u+6zxgQpnKPh97IhjGbCK3Tj1ZPLaw3Y0TnfnyPajn5Wh TUQQzPl8ttrJr4TTa1WICaUVlVIyT5Et/f1klogzDBD6tZz55vICLkvcnF+nG1OGVUNx WLB89Fp17Mq185/U8aKpm0/H89O9k0ztE87Gdg5K3iWsAX7iawsF8lfasifixyJoZZD2 /adyb41zeZlabZi1yv5CxBWM5ajsHcxt9kz9ww16CNJYQ2cSA1XXzea6zt5BJ6cxSTmY maSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=Bi1ar46rbvnQqsoEQKKLvDAlQMVa/GezJoHRqvFBwes=; b=aToKziBh4hWOAEiPw6F3m47O9Fr5Hmz1lMw2Gwpd2NKr/zIOyWXGydNvfLTloQ+L3/ jixkTsCysfdLbSZBpPykF9+9um5sLksanGeERMu9MPymw+Tnv6N35UYT9GN13HQOuWSJ bFzUC8/Z46Ur/KEQvLy5aNIgr5vXi8bjWqRE0I/GDyjcH1efy0yHIZG43qzZDBPhWVzD R6B5SK/ja5a1vLwXwjsuOG5mYanPF+yepCFPdRw831QANb6vp+k8JLT+mKY9yrmz+1tA soTvoa5K/Ilxtk1E7aI2UXbPdutBR6HTPYu9ISwzKqpQVNIi3NvomOcm3WOHbN0dF3FB yGpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=eunLPQUh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga8-20020a1709070c0800b00870558f5f0fsi12182089ejc.256.2023.01.18.02.56.09; Wed, 18 Jan 2023 02:56:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=eunLPQUh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229988AbjARKzj (ORCPT + 99 others); Wed, 18 Jan 2023 05:55:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229994AbjARKxB (ORCPT ); Wed, 18 Jan 2023 05:53:01 -0500 Received: from mail.3ffe.de (0001.3ffe.de [159.69.201.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38F9682D75; Wed, 18 Jan 2023 02:01:46 -0800 (PST) Received: from mwalle01.sab.local (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.3ffe.de (Postfix) with ESMTPSA id 85C6E166A; Wed, 18 Jan 2023 11:01:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1674036104; 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=Bi1ar46rbvnQqsoEQKKLvDAlQMVa/GezJoHRqvFBwes=; b=eunLPQUhQUsgOOtPbRzh/TpQxbKy0JOosphj29cyRTBxnl6WE7bNZULm9T+Srkk9rU8D9H K3k3teRsI1UZVX5yYZorFutpISPpQtaZ5A4DPUsP98OOkkg7G91YWjAARV3h2/74N9PqaE z3fGgZdORDa9knPUzYEnC9Z8YWtv+9pHYVB/qoQLfD9KgeLJ74bqFDsxVooJTSjPo+lI46 Supkfn+7YEmUW/9PZDkuDikNcJVWMo7NEAADbm5kIZpdA/E/0soeHhzmqncD0pTQlri6R6 160v7ljE5BjiWNEAvL6r8xe3GoH3Ypl069kmSIzMT9zldCNYJzZJxTPhfpLwSw== From: Michael Walle Date: Wed, 18 Jan 2023 11:01:35 +0100 Subject: [PATCH net-next v2 1/6] net: mdio: Move mdiobus_scan() within file MIME-Version: 1.0 Message-Id: <20230116-net-next-remove-probe-capabilities-v2-1-15513b05e1f4@walle.cc> References: <20230116-net-next-remove-probe-capabilities-v2-0-15513b05e1f4@walle.cc> In-Reply-To: <20230116-net-next-remove-probe-capabilities-v2-0-15513b05e1f4@walle.cc> To: Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Matthias Brugger , Bryan Whitehead , UNGLinuxDriver@microchip.com, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Joel Stanley , Andrew Jeffery Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-aspeed@lists.ozlabs.org, Andrew Lunn , Michael Walle , Jesse Brandeburg X-Mailer: b4 0.11.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755357530327503475?= X-GMAIL-MSGID: =?utf-8?q?1755357530327503475?= From: Andrew Lunn No functional change, just place it earlier in preparation for some refactoring. While at it, correct the comment format and one typo. Signed-off-by: Andrew Lunn Signed-off-by: Michael Walle Reviewed-by: Jesse Brandeburg --- drivers/net/phy/mdio_bus.c | 101 ++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 51 deletions(-) diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 902e1c88ef58..61c33c6098a1 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -506,6 +506,56 @@ static int mdiobus_create_device(struct mii_bus *bus, return ret; } +/** + * mdiobus_scan - scan a bus for MDIO devices. + * @bus: mii_bus to scan + * @addr: address on bus to scan + * + * This function scans the MDIO bus, looking for devices which can be + * identified using a vendor/product ID in registers 2 and 3. Not all + * MDIO devices have such registers, but PHY devices typically + * do. Hence this function assumes anything found is a PHY, or can be + * treated as a PHY. Other MDIO devices, such as switches, will + * probably not be found during the scan. + */ +struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr) +{ + struct phy_device *phydev = ERR_PTR(-ENODEV); + int err; + + switch (bus->probe_capabilities) { + case MDIOBUS_NO_CAP: + case MDIOBUS_C22: + phydev = get_phy_device(bus, addr, false); + break; + case MDIOBUS_C45: + phydev = get_phy_device(bus, addr, true); + break; + case MDIOBUS_C22_C45: + phydev = get_phy_device(bus, addr, false); + if (IS_ERR(phydev)) + phydev = get_phy_device(bus, addr, true); + break; + } + + if (IS_ERR(phydev)) + return phydev; + + /* For DT, see if the auto-probed phy has a corresponding child + * in the bus node, and set the of_node pointer in this case. + */ + of_mdiobus_link_mdiodev(bus, &phydev->mdio); + + err = phy_device_register(phydev); + if (err) { + phy_device_free(phydev); + return ERR_PTR(-ENODEV); + } + + return phydev; +} +EXPORT_SYMBOL(mdiobus_scan); + /** * __mdiobus_register - bring up all the PHYs on a given bus and attach them to bus * @bus: target mii_bus @@ -679,57 +729,6 @@ void mdiobus_free(struct mii_bus *bus) } EXPORT_SYMBOL(mdiobus_free); -/** - * mdiobus_scan - scan a bus for MDIO devices. - * @bus: mii_bus to scan - * @addr: address on bus to scan - * - * This function scans the MDIO bus, looking for devices which can be - * identified using a vendor/product ID in registers 2 and 3. Not all - * MDIO devices have such registers, but PHY devices typically - * do. Hence this function assumes anything found is a PHY, or can be - * treated as a PHY. Other MDIO devices, such as switches, will - * probably not be found during the scan. - */ -struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr) -{ - struct phy_device *phydev = ERR_PTR(-ENODEV); - int err; - - switch (bus->probe_capabilities) { - case MDIOBUS_NO_CAP: - case MDIOBUS_C22: - phydev = get_phy_device(bus, addr, false); - break; - case MDIOBUS_C45: - phydev = get_phy_device(bus, addr, true); - break; - case MDIOBUS_C22_C45: - phydev = get_phy_device(bus, addr, false); - if (IS_ERR(phydev)) - phydev = get_phy_device(bus, addr, true); - break; - } - - if (IS_ERR(phydev)) - return phydev; - - /* - * For DT, see if the auto-probed phy has a correspoding child - * in the bus node, and set the of_node pointer in this case. - */ - of_mdiobus_link_mdiodev(bus, &phydev->mdio); - - err = phy_device_register(phydev); - if (err) { - phy_device_free(phydev); - return ERR_PTR(-ENODEV); - } - - return phydev; -} -EXPORT_SYMBOL(mdiobus_scan); - static void mdiobus_stats_acct(struct mdio_bus_stats *stats, bool op, int ret) { preempt_disable(); From patchwork Wed Jan 18 10:01:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 45168 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2267645wrn; Wed, 18 Jan 2023 02:57:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXvAmO+Hzp+OLDnUtcnnl1NNdHmLjJM4AlnUq6g1QcR7nLE7SXk2QwfPXWUsh+h96PJHPaNC X-Received: by 2002:a17:907:7f12:b0:7c1:9eb:845b with SMTP id qf18-20020a1709077f1200b007c109eb845bmr25070700ejc.16.1674039446320; Wed, 18 Jan 2023 02:57:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674039446; cv=none; d=google.com; s=arc-20160816; b=wZnz84Zb9Yl4k7MTQM6Rcw/0Nzw+w9dUFS0VdfxH4S9KhRpmRS6wEiMIKdeXsyBGBr JvI0uQy22SAl+gWimT76vRZR52RF/K4k3ysaDGr5jaVE6tTKGMGXUlxD8vEJPBh8uKz8 2NKpKAeRWzzDrEPDv9dl8lnUTy4L49M40G/O9vnu74hZOxdpLspvfjLRaFGx+Y8Iykg1 J1LEssk3+JfJ4gjJb3A+9lSymDFGKC9Muu1I/to01uaIHhus6+ytR8BT3cVaqTKsmda7 kMQ2jORUwPlLdR6zVODI7LQlmZhBFaaFX2uFN2ZO/Pv0B+UZP2t+MZVIZRXYVlphT2wa wgjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=5sGIMeo0xOf+3HRghClVH+PZ/YqsQ1nE+ZFy+ze4Ous=; b=Hv1ug4GlbwzyqZ8WwGHat7Y5hN5J08YPsodSFzx++X/c6oWbCj5K7WdSJ0+FtST4DP kK4fnz5cMANAxPLKL5qIN3EgtxsuA7UdHcHSG5UpzzQLg9ykPYWcRaRDhZAN6kXcBs9N xfyzghQVfPJWe7sRR64tMyRDPCIOB6Pxx/9fYK1zlFtgKuvTDwjb/W2BcOQXAq6WrSRI Vqm1gYT0XyzNhSuvoVJTGrmBkX4/8nHp4r4H4kTZgS1JCVVUMsN2O9eeQl5peJveh+Xb r0vOuEPzutENvqTDUXeolJ4Zk42kGIHX6o/c45IQqPhjCx096Cl9QOMan/QHLtDQ/631 joSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=NHUX7muh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wt10-20020a170906ee8a00b007c4fb4ee06bsi39696645ejb.534.2023.01.18.02.57.02; Wed, 18 Jan 2023 02:57:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=NHUX7muh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230096AbjARK4Z (ORCPT + 99 others); Wed, 18 Jan 2023 05:56:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229998AbjARKxB (ORCPT ); Wed, 18 Jan 2023 05:53:01 -0500 Received: from mail.3ffe.de (0001.3ffe.de [159.69.201.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABADA86EF4; Wed, 18 Jan 2023 02:01:47 -0800 (PST) Received: from mwalle01.sab.local (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.3ffe.de (Postfix) with ESMTPSA id 2C9B91670; Wed, 18 Jan 2023 11:01:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1674036105; 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=5sGIMeo0xOf+3HRghClVH+PZ/YqsQ1nE+ZFy+ze4Ous=; b=NHUX7muhruWGH3lnBOr/S/uqJpQ+U4zAk0U/A2nUwtxZLpL0RBfibHeDxRw5e4aOxxUbaD ya4muCRnd7Qu8R6EFopsvjujS/YdUdBgnZ0tnHqOwJCw9JcOMy4z3FtmH2468mjwN0agCf rEbaTvNKyxHEULtle3rEqhPxjH3Ool1Y11EUiJU4wlfX66sx9tKtKRm7a0zunpNLv9/B/H ueF1cQy679mgce3HqSBI6T5peevtcxc5KhX7JlcC0zgQ5wyJYTikR9hNKhPH8mFPLOdjth LJGAUxVuGg8AX6A8skIK3qhwxOgrAS8x/biP8JqsHA7NN36fOSzrnJcwOx7dXQ== From: Michael Walle Date: Wed, 18 Jan 2023 11:01:36 +0100 Subject: [PATCH net-next v2 2/6] net: mdio: Rework scanning of bus ready for quirks MIME-Version: 1.0 Message-Id: <20230116-net-next-remove-probe-capabilities-v2-2-15513b05e1f4@walle.cc> References: <20230116-net-next-remove-probe-capabilities-v2-0-15513b05e1f4@walle.cc> In-Reply-To: <20230116-net-next-remove-probe-capabilities-v2-0-15513b05e1f4@walle.cc> To: Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Matthias Brugger , Bryan Whitehead , UNGLinuxDriver@microchip.com, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Joel Stanley , Andrew Jeffery Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-aspeed@lists.ozlabs.org, Andrew Lunn , Michael Walle , Jesse Brandeburg X-Mailer: b4 0.11.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755357586569784920?= X-GMAIL-MSGID: =?utf-8?q?1755357586569784920?= From: Andrew Lunn Some C22 PHYs do bad things when there are C45 transactions on the bus. In order to handle this, the bus needs to be scanned first for C22 at all addresses, and then C45 scanned for all addresses. The Marvell pxa168 driver scans a specific address on the bus to find its PHY. This is a C22 only device, so update it to use the c22 helper. Signed-off-by: Andrew Lunn Signed-off-by: Michael Walle Reviewed-by: Jesse Brandeburg --- v2: [mw] Avoid the use of unitialized variabe. Thanks Jakub. Just iterate over all possible addresses in the error path. --- drivers/net/ethernet/marvell/pxa168_eth.c | 2 +- drivers/net/phy/mdio_bus.c | 125 ++++++++++++++++++++---------- include/linux/phy.h | 2 +- 3 files changed, 88 insertions(+), 41 deletions(-) diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c index cf456d62677f..87fff539d39d 100644 --- a/drivers/net/ethernet/marvell/pxa168_eth.c +++ b/drivers/net/ethernet/marvell/pxa168_eth.c @@ -965,7 +965,7 @@ static int pxa168_init_phy(struct net_device *dev) if (dev->phydev) return 0; - phy = mdiobus_scan(pep->smi_bus, pep->phy_addr); + phy = mdiobus_scan_c22(pep->smi_bus, pep->phy_addr); if (IS_ERR(phy)) return PTR_ERR(phy); diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 61c33c6098a1..667247f661c5 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -506,38 +506,12 @@ static int mdiobus_create_device(struct mii_bus *bus, return ret; } -/** - * mdiobus_scan - scan a bus for MDIO devices. - * @bus: mii_bus to scan - * @addr: address on bus to scan - * - * This function scans the MDIO bus, looking for devices which can be - * identified using a vendor/product ID in registers 2 and 3. Not all - * MDIO devices have such registers, but PHY devices typically - * do. Hence this function assumes anything found is a PHY, or can be - * treated as a PHY. Other MDIO devices, such as switches, will - * probably not be found during the scan. - */ -struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr) +static struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr, bool c45) { struct phy_device *phydev = ERR_PTR(-ENODEV); int err; - switch (bus->probe_capabilities) { - case MDIOBUS_NO_CAP: - case MDIOBUS_C22: - phydev = get_phy_device(bus, addr, false); - break; - case MDIOBUS_C45: - phydev = get_phy_device(bus, addr, true); - break; - case MDIOBUS_C22_C45: - phydev = get_phy_device(bus, addr, false); - if (IS_ERR(phydev)) - phydev = get_phy_device(bus, addr, true); - break; - } - + phydev = get_phy_device(bus, addr, c45); if (IS_ERR(phydev)) return phydev; @@ -554,7 +528,77 @@ struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr) return phydev; } -EXPORT_SYMBOL(mdiobus_scan); + +/** + * mdiobus_scan_c22 - scan one address on a bus for C22 MDIO devices. + * @bus: mii_bus to scan + * @addr: address on bus to scan + * + * This function scans one address on the MDIO bus, looking for + * devices which can be identified using a vendor/product ID in + * registers 2 and 3. Not all MDIO devices have such registers, but + * PHY devices typically do. Hence this function assumes anything + * found is a PHY, or can be treated as a PHY. Other MDIO devices, + * such as switches, will probably not be found during the scan. + */ +struct phy_device *mdiobus_scan_c22(struct mii_bus *bus, int addr) +{ + return mdiobus_scan(bus, addr, false); +} +EXPORT_SYMBOL(mdiobus_scan_c22); + +/** + * mdiobus_scan_c45 - scan one address on a bus for C45 MDIO devices. + * @bus: mii_bus to scan + * @addr: address on bus to scan + * + * This function scans one address on the MDIO bus, looking for + * devices which can be identified using a vendor/product ID in + * registers 2 and 3. Not all MDIO devices have such registers, but + * PHY devices typically do. Hence this function assumes anything + * found is a PHY, or can be treated as a PHY. Other MDIO devices, + * such as switches, will probably not be found during the scan. + */ +static struct phy_device *mdiobus_scan_c45(struct mii_bus *bus, int addr) +{ + return mdiobus_scan(bus, addr, true); +} + +static int mdiobus_scan_bus_c22(struct mii_bus *bus) +{ + int i; + + for (i = 0; i < PHY_MAX_ADDR; i++) { + if ((bus->phy_mask & BIT(i)) == 0) { + struct phy_device *phydev; + + phydev = mdiobus_scan_c22(bus, i); + if (IS_ERR(phydev) && (PTR_ERR(phydev) != -ENODEV)) + return PTR_ERR(phydev); + } + } + return 0; +} + +static int mdiobus_scan_bus_c45(struct mii_bus *bus) +{ + int i; + + for (i = 0; i < PHY_MAX_ADDR; i++) { + if ((bus->phy_mask & BIT(i)) == 0) { + struct phy_device *phydev; + + /* Don't scan C45 if we already have a C22 device */ + if (bus->mdio_map[i]) + continue; + + phydev = mdiobus_scan_c45(bus, i); + if (IS_ERR(phydev) && (PTR_ERR(phydev) != -ENODEV)) + return PTR_ERR(phydev); + } + } + return 0; +} /** * __mdiobus_register - bring up all the PHYs on a given bus and attach them to bus @@ -639,16 +683,19 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) goto error_reset_gpiod; } - for (i = 0; i < PHY_MAX_ADDR; i++) { - if ((bus->phy_mask & BIT(i)) == 0) { - struct phy_device *phydev; + if (bus->probe_capabilities == MDIOBUS_NO_CAP || + bus->probe_capabilities == MDIOBUS_C22 || + bus->probe_capabilities == MDIOBUS_C22_C45) { + err = mdiobus_scan_bus_c22(bus); + if (err) + goto error; + } - phydev = mdiobus_scan(bus, i); - if (IS_ERR(phydev) && (PTR_ERR(phydev) != -ENODEV)) { - err = PTR_ERR(phydev); - goto error; - } - } + if (bus->probe_capabilities == MDIOBUS_C45 || + bus->probe_capabilities == MDIOBUS_C22_C45) { + err = mdiobus_scan_bus_c45(bus); + if (err) + goto error; } mdiobus_setup_mdiodev_from_board_info(bus, mdiobus_create_device); @@ -658,7 +705,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) return 0; error: - while (--i >= 0) { + for (i = 0; i < PHY_MAX_ADDR; i++) { mdiodev = bus->mdio_map[i]; if (!mdiodev) continue; diff --git a/include/linux/phy.h b/include/linux/phy.h index b3cf1e08e880..fceaac0fb319 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -464,7 +464,7 @@ static inline struct mii_bus *devm_mdiobus_alloc(struct device *dev) } struct mii_bus *mdio_find_bus(const char *mdio_name); -struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); +struct phy_device *mdiobus_scan_c22(struct mii_bus *bus, int addr); #define PHY_INTERRUPT_DISABLED false #define PHY_INTERRUPT_ENABLED true From patchwork Wed Jan 18 10:01:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 45164 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2267268wrn; Wed, 18 Jan 2023 02:56:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXsQ/SF6JhBvmcEcM+g8ji81pAihkM9+PSIgMC0+NImSVDAwgzLeoelZN76D48Vi11QIKsZE X-Received: by 2002:aa7:98ce:0:b0:58b:25f9:52c1 with SMTP id e14-20020aa798ce000000b0058b25f952c1mr32230246pfm.31.1674039393246; Wed, 18 Jan 2023 02:56:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674039393; cv=none; d=google.com; s=arc-20160816; b=YXUALFHrP1bgp7ud8rn5kXT935M6oimQixA5za/dKUJwKfviN0pDVGaVFR9gHpjiyp hN0A3JtTz7nN+/MJlrjuOFkWqTSd2wW69mtN8Bm1Ykmi7rOWl1uaXNtacLob8H05BA5e CiHbrwnJI43iGoYLC6Wcwjp2mKretGyCkcXA23TfZV3k3bQBBteQP/J4clhUPI95k6mt xrhbLnBTC5RJ+kD2R7sMv4MG08bi5j72JVlTRuXd8b4W+DWwgorhrVd7CfAuhWBlk8D7 DvhgI0A6d96JwNMAs96/lNk5WCfRhAEbLiA1S1KNf8WbM5selsUGfECf92WcY3dUuSiA PO8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=7i9qbwSDlGkaEMAao/7IOBLlkWEf4kE9vsL/6dW7DOw=; b=EHFEemuaJNjJNfXqff2UngNr9QjIESjwyEgpCSl6T4JYAs6eVAHjKNC21VKmcKQBNH rCmsOGuMQJY+5sjd2F8uswA6GhCvp9cOeQKg6jWQUFThZh7IFSaioChZTrxJHmBJwRsN I3Tmqgruvl3+f5L5HMSCUqG2SbBhtuzwWhVQ/IyyaMBV3qpnIUoy1HI3QKistXGxcEKV 8q+zF7HmhmXuc4wJukKyXD63m3UYVKDYrFiTXFKQwjMNvqp0aZT0QZsFxyN/1I21VM42 9+lbWmyjD8cJC2nZ1DBdVBtCnw2BXwBPT0SnTSKVel8SJU9Tnh+wxz1p66l8lDQGDwYm i9Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=sfpSS9Kj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y18-20020aa78f32000000b00587efd87345si30468901pfr.330.2023.01.18.02.56.21; Wed, 18 Jan 2023 02:56:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=sfpSS9Kj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230045AbjARKz6 (ORCPT + 99 others); Wed, 18 Jan 2023 05:55:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229995AbjARKxB (ORCPT ); Wed, 18 Jan 2023 05:53:01 -0500 Received: from mail.3ffe.de (0001.3ffe.de [IPv6:2a01:4f8:c0c:9d57::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1923388742; Wed, 18 Jan 2023 02:01:48 -0800 (PST) Received: from mwalle01.sab.local (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.3ffe.de (Postfix) with ESMTPSA id CF3581671; Wed, 18 Jan 2023 11:01:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1674036106; 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=7i9qbwSDlGkaEMAao/7IOBLlkWEf4kE9vsL/6dW7DOw=; b=sfpSS9Kjd9842sP40iyX+WvxgWIzof0diOjdpmoYAZE3RTcYKt2G38MkWRx4WLhkoRrVjX v/4fI/4AbkKptvvqLKhYqdYf9fC29BSzA89BeZWQLwEF3iYIXtFaSsn0aRvEeHUz/Vr67C CgefUeD6AcNz8oorpMrkwONDcoKdufbdmEbDonIsUeubP4W5+teBXU3A8Q1SzDKs9cIpvm TLplpA7l4ioD8wtn3Lz+RI3+7xCXSa3ednymkbTwHDjs37GP2fYgRKzpTkA1UbSrwLVzEo azg3IK2lO195nKysbe5d3R1dGqi+Rrnrkkt2qDss8UJKO9VFnpEB5I62KoZIqg== From: Michael Walle Date: Wed, 18 Jan 2023 11:01:37 +0100 Subject: [PATCH net-next v2 3/6] net: mdio: Add workaround for Micrel PHYs which are not C45 compatible MIME-Version: 1.0 Message-Id: <20230116-net-next-remove-probe-capabilities-v2-3-15513b05e1f4@walle.cc> References: <20230116-net-next-remove-probe-capabilities-v2-0-15513b05e1f4@walle.cc> In-Reply-To: <20230116-net-next-remove-probe-capabilities-v2-0-15513b05e1f4@walle.cc> To: Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Matthias Brugger , Bryan Whitehead , UNGLinuxDriver@microchip.com, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Joel Stanley , Andrew Jeffery Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-aspeed@lists.ozlabs.org, Andrew Lunn , Michael Walle , Jesse Brandeburg X-Mailer: b4 0.11.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755357530682680638?= X-GMAIL-MSGID: =?utf-8?q?1755357530682680638?= From: Andrew Lunn After scanning the bus for C22 devices, check if any Micrel PHYs have been found. They are known to do bad things if there are C45 transactions on the bus. Prevent the scanning of the bus using C45 if such a PHY has been detected. Signed-off-by: Andrew Lunn Signed-off-by: Michael Walle --- v2: [mw] move variable declaration into the loop. Thanks, Jesse. --- drivers/net/phy/mdio_bus.c | 37 ++++++++++++++++++++++++++++++++++--- include/linux/micrel_phy.h | 2 ++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 667247f661c5..a664eeb1868d 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -600,6 +601,32 @@ static int mdiobus_scan_bus_c45(struct mii_bus *bus) return 0; } +/* There are some C22 PHYs which do bad things when where is a C45 + * transaction on the bus, like accepting a read themselves, and + * stomping over the true devices reply, to performing a write to + * themselves which was intended for another device. Now that C22 + * devices have been found, see if any of them are bad for C45, and if we + * should skip the C45 scan. + */ +static bool mdiobus_prevent_c45_scan(struct mii_bus *bus) +{ + int i; + + for (i = 0; i < PHY_MAX_ADDR; i++) { + struct phy_device *phydev; + u32 oui; + + phydev = mdiobus_get_phy(bus, i); + if (!phydev) + continue; + oui = phydev->phy_id >> 10; + + if (oui == MICREL_OUI) + return true; + } + return false; +} + /** * __mdiobus_register - bring up all the PHYs on a given bus and attach them to bus * @bus: target mii_bus @@ -617,8 +644,9 @@ static int mdiobus_scan_bus_c45(struct mii_bus *bus) int __mdiobus_register(struct mii_bus *bus, struct module *owner) { struct mdio_device *mdiodev; - int i, err; struct gpio_desc *gpiod; + bool prevent_c45_scan; + int i, err; if (!bus || !bus->name) return -EINVAL; @@ -691,8 +719,11 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) goto error; } - if (bus->probe_capabilities == MDIOBUS_C45 || - bus->probe_capabilities == MDIOBUS_C22_C45) { + prevent_c45_scan = mdiobus_prevent_c45_scan(bus); + + if (!prevent_c45_scan && + (bus->probe_capabilities == MDIOBUS_C45 || + bus->probe_capabilities == MDIOBUS_C22_C45)) { err = mdiobus_scan_bus_c45(bus); if (err) goto error; diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h index 1f7c33b2f5a3..771e050883db 100644 --- a/include/linux/micrel_phy.h +++ b/include/linux/micrel_phy.h @@ -8,6 +8,8 @@ #ifndef _MICREL_PHY_H #define _MICREL_PHY_H +#define MICREL_OUI 0x0885 + #define MICREL_PHY_ID_MASK 0x00fffff0 #define PHY_ID_KSZ8873MLL 0x000e7237 From patchwork Wed Jan 18 10:01:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 45165 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2267341wrn; Wed, 18 Jan 2023 02:56:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXu6fc6oIQHMQdqHCKx0hady6wGJf3/XYi02lHKVsw/SSyVRCsPASs6f76WS+1TEQRQoVf+J X-Received: by 2002:a17:902:8304:b0:194:9de0:bed1 with SMTP id bd4-20020a170902830400b001949de0bed1mr5812538plb.32.1674039403272; Wed, 18 Jan 2023 02:56:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674039403; cv=none; d=google.com; s=arc-20160816; b=ey6A+66mJh0OidvR7P6HZ2TARFeaU0ZoZsnAidFt54/hn13XNCWPdnOCs0Rw+2fg4B QI1u0xRphulK4ST44783Nd6Sy663iQ2yDYM3b3JqeGolbMpzJoz9gzwtFVAmv8VFMxtk /8mOtXj5n1E/0gvBKzg56Fm/3QIDOG+6PdDMSy3RVhfjjrYkKSTsqsoSVFBcnQ+gKnyj caHM1GThAq/Nbdepr9BEb606saKr7coqMXRXUWAjZJPg6e5Xes0jPYPmq3dVMhxqcPzu TxJrvKFqjSs1fk5HYKAWiHGQrxIkNa9pJHmbmoQvxlE3kkoSgYqp2LEiIVAHxyuA3Lxr Bu4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=mwRgH1gwGvw1Zmyg8lEWyK1RUMWeRROk6pcDON7Mutc=; b=hu+XQMRybzmbRRUOIZU1LBzyUV6Uv5JhlxrC6qsWZSa0QA1+9yrXqd1tagIIDyvxe6 412gzQYE4bD6shr/sPaRe3VN1C/EqZpUugronrgDdx+zR7P78341gjc/+kb6UQSd9Pm+ J9ZY6SPZ+TWI/7iOcBUu5rSZUyuET2MfMO7FGwtjHar4awkW1aCniSz9WL6u9eZug/r5 +61DzJCSGUANNmFwgvw7f9CFUakC15TqOrxCDap1GKTzdn9xW6NrYIoZU61orJjX7L4o JKH+ScSMwe4IHK+fXerC0S54gCnEibtUW6UERuppUvn5iL38+xkEMyCEvsOcIaoKyzHg IGvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=sL7klO90; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b23-20020a170902b61700b00194821e608dsi11370825pls.387.2023.01.18.02.56.31; Wed, 18 Jan 2023 02:56:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=sL7klO90; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229909AbjARK4J (ORCPT + 99 others); Wed, 18 Jan 2023 05:56:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230002AbjARKxB (ORCPT ); Wed, 18 Jan 2023 05:53:01 -0500 Received: from mail.3ffe.de (0001.3ffe.de [IPv6:2a01:4f8:c0c:9d57::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 926C888744; Wed, 18 Jan 2023 02:01:48 -0800 (PST) Received: from mwalle01.sab.local (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.3ffe.de (Postfix) with ESMTPSA id 403D11696; Wed, 18 Jan 2023 11:01:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1674036106; 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=mwRgH1gwGvw1Zmyg8lEWyK1RUMWeRROk6pcDON7Mutc=; b=sL7klO901P68+Qf+oOucnTQ8o7LJqALT6i87nmTOHVWPOS9ZYlXtiknTB/H8z//VkltPnb UztiV9XdRDU5w++sTB8S4n9hEz4uwMs5H6JSVhAdg07jAhK2O5B0+DDv56MqvpmlTPTOVG Bdnqi9+Oi61wYHTPU4EWyb81JqFpSw1jtqsaaDKW6TbkpXPTRDfdMPyt37OO1t2W/dCSta tJAhIrZ68UvwOcCHU3CPygVZ/L2zVoGL6wP2g/NfT+DzQe+VOMXSxGDsGfaF5qdRk6p3t9 2kYLiT8zedHyBMw554J6/N5RiVOWfwIwYvnxaCY8VPMRyDTl2QL2tXiB4bxLLg== From: Michael Walle Date: Wed, 18 Jan 2023 11:01:38 +0100 Subject: [PATCH net-next v2 4/6] net: mdio: scan bus based on bus capabilities for C22 and C45 MIME-Version: 1.0 Message-Id: <20230116-net-next-remove-probe-capabilities-v2-4-15513b05e1f4@walle.cc> References: <20230116-net-next-remove-probe-capabilities-v2-0-15513b05e1f4@walle.cc> In-Reply-To: <20230116-net-next-remove-probe-capabilities-v2-0-15513b05e1f4@walle.cc> To: Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Matthias Brugger , Bryan Whitehead , UNGLinuxDriver@microchip.com, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Joel Stanley , Andrew Jeffery Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-aspeed@lists.ozlabs.org, Andrew Lunn , Michael Walle , Jesse Brandeburg X-Mailer: b4 0.11.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755357541168361694?= X-GMAIL-MSGID: =?utf-8?q?1755357541168361694?= From: Andrew Lunn Now that all MDIO bus drivers which set probe_capabilities to MDIOBUS_C22_C45 have been converted to use the name API for C45 transactions, perform the scanning of the bus based on which methods the bus provides. Signed-off-by: Andrew Lunn Signed-off-by: Michael Walle Reviewed-by: Jesse Brandeburg --- drivers/net/phy/mdio_bus.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index a664eeb1868d..5b2f48c09a6a 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -711,9 +711,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) goto error_reset_gpiod; } - if (bus->probe_capabilities == MDIOBUS_NO_CAP || - bus->probe_capabilities == MDIOBUS_C22 || - bus->probe_capabilities == MDIOBUS_C22_C45) { + if (bus->read) { err = mdiobus_scan_bus_c22(bus); if (err) goto error; @@ -721,9 +719,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) prevent_c45_scan = mdiobus_prevent_c45_scan(bus); - if (!prevent_c45_scan && - (bus->probe_capabilities == MDIOBUS_C45 || - bus->probe_capabilities == MDIOBUS_C22_C45)) { + if (!prevent_c45_scan && bus->read_c45) { err = mdiobus_scan_bus_c45(bus); if (err) goto error; From patchwork Wed Jan 18 10:01:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 45167 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2267606wrn; Wed, 18 Jan 2023 02:57:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXsKZBqMjqlF2Wn65YSdjO5N33PaKgrANjZfLB+O5JXpL9pkxJzXJQUilGsl00v1Uh6xgQzs X-Received: by 2002:a17:906:c283:b0:86a:833d:e7d8 with SMTP id r3-20020a170906c28300b0086a833de7d8mr6578699ejz.17.1674039441654; Wed, 18 Jan 2023 02:57:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674039441; cv=none; d=google.com; s=arc-20160816; b=LhvXcP+l5YNlrSr2foHzPzcgHr8PmPLkWLVKXZ+Wx+BBuNUHDe7k6dTyhIwlufNRNQ PK1N9GXYsl37b+O+e5Egnzd32FyCkYCfikaLsJv87y1CwPe+IDLIlroywX5D/sURZ3DS Z0x3T9Yw+5QfLCCc4P14Cgu2IqbQkD70QqO9WrGUyt6l2ObYoJx/37uyrvQWd3BzKulW KqZx5gna5uRPIB8u7wfHhB7YeLXQX223Gg/yLbpGb/a9LFERBEbCPnPZDqvB0jU1rbII SGnww83DOoEIoixKfTm4KXPI+CQZgHKtwFMmg+QaFDP9Vhyla2CnsAtehPrJCfos7pf3 K7eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=ZH4+OHjOJvEjns1sGRC3xSqdKJqWf+w8GTyoq+9lXgo=; b=BYtTljYqi1SAoE8lfSFbPIp+6KQHY0YeP7xxCXkWlcVN3iU9dEsC1bvw8W4PslZ991 T5sqoS+heBH9/tkyy7G/MpkE0raGPjuEmCPYSU38ogWTlciarRFHc1ZMeHAUrkaZ8ylj /tzrro6MhiyxHQJOuct7sBoj5FKcZIPEWfkcnmLek5vW+MvoMWhohIBqr9ZAFpqRbI0V 05jXQl4BZxCBPR+ZW8gTS9Svl5dAG0x1P9cGgdkXhuePIPeybMfhEPV4mmxxQFbiL+UL lKz49LB96SdQ6j8bI2s439D+LW2AYyRj8UWGo6anB9lXcNH1LRI5vWGILMHJ9XipnUIv dImQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=2r2KHe1D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt8-20020a1709072d8800b0087091d24e3csi10539475ejc.88.2023.01.18.02.56.57; Wed, 18 Jan 2023 02:57:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=2r2KHe1D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230076AbjARK4U (ORCPT + 99 others); Wed, 18 Jan 2023 05:56:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230008AbjARKxD (ORCPT ); Wed, 18 Jan 2023 05:53:03 -0500 Received: from mail.3ffe.de (0001.3ffe.de [IPv6:2a01:4f8:c0c:9d57::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD8F988745; Wed, 18 Jan 2023 02:01:48 -0800 (PST) Received: from mwalle01.sab.local (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.3ffe.de (Postfix) with ESMTPSA id DD86B169D; Wed, 18 Jan 2023 11:01:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1674036107; 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=ZH4+OHjOJvEjns1sGRC3xSqdKJqWf+w8GTyoq+9lXgo=; b=2r2KHe1DmFIf4Lgpk0io5RVoe+g9QAtgjFx+mClhOLyAFX8f28TFqxaDfxZZwLnuoC+S16 zcHLbBx0oLT2fZcsrPnykrHvGUFeLePaK7GSBQo4sc4GdN0z+v3iQTAZRRknRTB4IM05Jm 2zdasTrndyWqGfqaUXOZN9vkmzYCAFued1Y2z8qlQqcFaXf6wQH/YAAO44PJWdcUCn6U7o slzwPdEySB3eFWInF+kuMj4JDb+NiS0Tp6Um2UMvU8naJWJNksz+A9w71L+1nF5yEGqkpY FtqMp/nRosYWFdEGOXAT8+l2TyIiHGgXOpB21wlmahHIOK28ZlrACOGbGhhQ1g== From: Michael Walle Date: Wed, 18 Jan 2023 11:01:39 +0100 Subject: [PATCH net-next v2 5/6] net: phy: Decide on C45 capabilities based on presence of method MIME-Version: 1.0 Message-Id: <20230116-net-next-remove-probe-capabilities-v2-5-15513b05e1f4@walle.cc> References: <20230116-net-next-remove-probe-capabilities-v2-0-15513b05e1f4@walle.cc> In-Reply-To: <20230116-net-next-remove-probe-capabilities-v2-0-15513b05e1f4@walle.cc> To: Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Matthias Brugger , Bryan Whitehead , UNGLinuxDriver@microchip.com, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Joel Stanley , Andrew Jeffery Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-aspeed@lists.ozlabs.org, Andrew Lunn , Michael Walle , Jesse Brandeburg X-Mailer: b4 0.11.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755357581847434278?= X-GMAIL-MSGID: =?utf-8?q?1755357581847434278?= From: Andrew Lunn Some PHYs provide invalid IDs in C22 space. If C45 is supported on the bus an attempt can be made to get the IDs from the C45 space. Decide on this based on the presence of the C45 read method in the bus structure. This will allow the unreliable probe_capabilities to be removed. Signed-off-by: Andrew Lunn Signed-off-by: Michael Walle Reviewed-by: Jesse Brandeburg --- drivers/net/phy/phy_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 0d371a0a49f2..9ba8f973f26f 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -946,7 +946,7 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45) * probe with C45 to see if we're able to get a valid PHY ID in the C45 * space, if successful, create the C45 PHY device. */ - if (!is_c45 && phy_id == 0 && bus->probe_capabilities >= MDIOBUS_C45) { + if (!is_c45 && phy_id == 0 && bus->read_c45) { r = get_phy_c45_ids(bus, addr, &c45_ids); if (!r) return phy_device_create(bus, addr, phy_id, From patchwork Wed Jan 18 10:01:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 45166 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2267376wrn; Wed, 18 Jan 2023 02:56:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXvTRGmtnAs5qZtAwyaTz1z4bnC3guD0RfH2kI6yAXwlDHJUHdU9/qCVw5NgIFaeX2fBohB/ X-Received: by 2002:a05:6a00:1d1c:b0:58c:972f:92cb with SMTP id a28-20020a056a001d1c00b0058c972f92cbmr7750638pfx.1.1674039409383; Wed, 18 Jan 2023 02:56:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674039409; cv=none; d=google.com; s=arc-20160816; b=rdXGTLgP9u8cCAMGshWYGlYEuyzzw9+o9zddEIaKQdIskFcZ1G9xYZhvtcgFwTk15P /FEBsE/cn1ktsB2mp+V+FiMUySqxnB3xEut4kEzjo9fncyV+XxofsQdIxWJJDAnFjdz1 +YKhczo9L9v7EILg/HPRSuAKydSRl9kSv9yU8Dvm7b9WgARKt5iaGpTV6zuwAX24XBTa 03vG/cepOIWmyNbuyV29IOBliC9LH8cR8A5snmUC80BDykjej2hBY8nfmc4XAUgCOujC Zr2gkBVIIOuTr9yiWOHXM0Sbwumg66v6HYnq9vyxJeS0P22BluKJXbb7l85PJtYQKjqw pCxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=qmS5PwsqlNKYFNsXJSmOQNGOMIlR870TlCO69KtLAI8=; b=lifjBX+xzsnvk4kouJpOX/16jkbTphbT3gZcg77qy1vVsRP3DZkU4vkPnE9I8hfoQY IQFe0bEC+6sTDGkUI2pDtov7o4AvIc9lk6UnbGPmOUeIyhXWAMkLs0W5y7FNKHP+YsLt md/RbHLgETLI/mS+qmpaKOvrzqjbzjCkbECfNuIddFOZ2Jn/GoUZagORZEKqVY7EOo+c rzGBKkNL54XmOnNQHooVfQhl9h/tRIy/6A2oFgg3Vu/KjChGdrzlgoTB7OqyFyyHGVRF fiNXQ/DkGMqmTGdPcArrCQg/ruQ/hWZxVBXJ/ttmBsBMqv6NRQjhVBxa+xOqp+2Zz65+ kkTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=mkSwwTTn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l64-20020a638843000000b004b92aef22f7si21525950pgd.3.2023.01.18.02.56.37; Wed, 18 Jan 2023 02:56:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=mkSwwTTn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=walle.cc Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230057AbjARK4Q (ORCPT + 99 others); Wed, 18 Jan 2023 05:56:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229682AbjARKxF (ORCPT ); Wed, 18 Jan 2023 05:53:05 -0500 Received: from mail.3ffe.de (0001.3ffe.de [159.69.201.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A57D88747; Wed, 18 Jan 2023 02:01:49 -0800 (PST) Received: from mwalle01.sab.local (unknown [213.135.10.150]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.3ffe.de (Postfix) with ESMTPSA id 4FAB216A1; Wed, 18 Jan 2023 11:01:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1674036107; 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=qmS5PwsqlNKYFNsXJSmOQNGOMIlR870TlCO69KtLAI8=; b=mkSwwTTn69Y4Vq1/O3eHn5Gs9dlh7bMN7HnjIbK4qkNqZtDPAhNmzh8xVBHjRzmIFZgRvG 6W4W924Ykc7WJgFGrVkIKtbjBboSMfmK3/vamcZMRqFoslB/psSGow7v/gMeRxHAX6cefk shKNXwoHPkxtnGx1sh+ON/zL/PiCMB8b13MlHD4ipJGzGMBrYXttSu++DY7QcYgIhPUGwR QK3ivxWZA/hlGyD9gnsMS66OWpQESTArNFRW1ZVwZ4TquMU+ulLENoVQ9eFfBZ9VlQ70m/ Gmfr//iACJ9TJzRYwoORt22EWJ2yYZflUXPqpC+9CbTzZsQf0e9MSq9LcMz/1Q== From: Michael Walle Date: Wed, 18 Jan 2023 11:01:40 +0100 Subject: [PATCH net-next v2 6/6] net: phy: Remove probe_capabilities MIME-Version: 1.0 Message-Id: <20230116-net-next-remove-probe-capabilities-v2-6-15513b05e1f4@walle.cc> References: <20230116-net-next-remove-probe-capabilities-v2-0-15513b05e1f4@walle.cc> In-Reply-To: <20230116-net-next-remove-probe-capabilities-v2-0-15513b05e1f4@walle.cc> To: Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Matthias Brugger , Bryan Whitehead , UNGLinuxDriver@microchip.com, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Joel Stanley , Andrew Jeffery Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-aspeed@lists.ozlabs.org, Andrew Lunn , Michael Walle , Jesse Brandeburg X-Mailer: b4 0.11.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755357547788099856?= X-GMAIL-MSGID: =?utf-8?q?1755357547788099856?= From: Andrew Lunn Deciding if to probe of PHYs using C45 is now determine by if the bus provides the C45 read method. This makes probe_capabilities redundant so remove it. Signed-off-by: Andrew Lunn Signed-off-by: Michael Walle Reviewed-by: Jesse Brandeburg Acked-by: Andrew Jeffery --- drivers/net/ethernet/adi/adin1110.c | 1 - drivers/net/ethernet/freescale/xgmac_mdio.c | 1 - drivers/net/ethernet/mediatek/mtk_eth_soc.c | 1 - drivers/net/ethernet/microchip/lan743x_main.c | 2 -- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 3 --- drivers/net/mdio/mdio-aspeed.c | 1 - include/linux/phy.h | 8 -------- 7 files changed, 17 deletions(-) diff --git a/drivers/net/ethernet/adi/adin1110.c b/drivers/net/ethernet/adi/adin1110.c index 0805f249fff2..25f55756681d 100644 --- a/drivers/net/ethernet/adi/adin1110.c +++ b/drivers/net/ethernet/adi/adin1110.c @@ -523,7 +523,6 @@ static int adin1110_register_mdiobus(struct adin1110_priv *priv, mii_bus->priv = priv; mii_bus->parent = dev; mii_bus->phy_mask = ~((u32)GENMASK(2, 0)); - mii_bus->probe_capabilities = MDIOBUS_C22; snprintf(mii_bus->id, MII_BUS_ID_SIZE, "%s", dev_name(dev)); ret = devm_mdiobus_register(dev, mii_bus); diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c index 8b5a4cd8ff08..a13b4ba4d6e1 100644 --- a/drivers/net/ethernet/freescale/xgmac_mdio.c +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c @@ -397,7 +397,6 @@ static int xgmac_mdio_probe(struct platform_device *pdev) bus->read_c45 = xgmac_mdio_read_c45; bus->write_c45 = xgmac_mdio_write_c45; bus->parent = &pdev->dev; - bus->probe_capabilities = MDIOBUS_C22_C45; snprintf(bus->id, MII_BUS_ID_SIZE, "%pa", &res->start); priv = bus->priv; diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index dc50e0b227a6..d67ec28b2ba3 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -808,7 +808,6 @@ static int mtk_mdio_init(struct mtk_eth *eth) eth->mii_bus->write = mtk_mdio_write_c22; eth->mii_bus->read_c45 = mtk_mdio_read_c45; eth->mii_bus->write_c45 = mtk_mdio_write_c45; - eth->mii_bus->probe_capabilities = MDIOBUS_C22_C45; eth->mii_bus->priv = eth; eth->mii_bus->parent = eth->dev; diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c index e205edf477de..86b81df374da 100644 --- a/drivers/net/ethernet/microchip/lan743x_main.c +++ b/drivers/net/ethernet/microchip/lan743x_main.c @@ -3279,7 +3279,6 @@ static int lan743x_mdiobus_init(struct lan743x_adapter *adapter) lan743x_csr_write(adapter, SGMII_CTL, sgmii_ctl); netif_dbg(adapter, drv, adapter->netdev, "SGMII operation\n"); - adapter->mdiobus->probe_capabilities = MDIOBUS_C22_C45; adapter->mdiobus->read = lan743x_mdiobus_read_c22; adapter->mdiobus->write = lan743x_mdiobus_write_c22; adapter->mdiobus->read_c45 = lan743x_mdiobus_read_c45; @@ -3295,7 +3294,6 @@ static int lan743x_mdiobus_init(struct lan743x_adapter *adapter) netif_dbg(adapter, drv, adapter->netdev, "RGMII operation\n"); // Only C22 support when RGMII I/F - adapter->mdiobus->probe_capabilities = MDIOBUS_C22; adapter->mdiobus->read = lan743x_mdiobus_read_c22; adapter->mdiobus->write = lan743x_mdiobus_write_c22; adapter->mdiobus->name = "lan743x-mdiobus"; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index d2cb22f49ce5..21aaa2730ac8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -553,9 +553,6 @@ int stmmac_mdio_register(struct net_device *ndev) new_bus->name = "stmmac"; - if (priv->plat->has_gmac4) - new_bus->probe_capabilities = MDIOBUS_C22_C45; - if (priv->plat->has_xgmac) { new_bus->read = &stmmac_xgmac2_mdio_read_c22; new_bus->write = &stmmac_xgmac2_mdio_write_c22; diff --git a/drivers/net/mdio/mdio-aspeed.c b/drivers/net/mdio/mdio-aspeed.c index 2f4bbda5e56c..c727103c8b05 100644 --- a/drivers/net/mdio/mdio-aspeed.c +++ b/drivers/net/mdio/mdio-aspeed.c @@ -164,7 +164,6 @@ static int aspeed_mdio_probe(struct platform_device *pdev) bus->write = aspeed_mdio_write_c22; bus->read_c45 = aspeed_mdio_read_c45; bus->write_c45 = aspeed_mdio_write_c45; - bus->probe_capabilities = MDIOBUS_C22_C45; rc = of_mdiobus_register(bus, pdev->dev.of_node); if (rc) { diff --git a/include/linux/phy.h b/include/linux/phy.h index fceaac0fb319..fbeba4fee8d4 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -419,14 +419,6 @@ struct mii_bus { /** @reset_gpiod: Reset GPIO descriptor pointer */ struct gpio_desc *reset_gpiod; - /** @probe_capabilities: bus capabilities, used for probing */ - enum { - MDIOBUS_NO_CAP = 0, - MDIOBUS_C22, - MDIOBUS_C45, - MDIOBUS_C22_C45, - } probe_capabilities; - /** @shared_lock: protect access to the shared element */ struct mutex shared_lock;