From patchwork Mon Jan 16 12:55:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 44114 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1179865wrn; Mon, 16 Jan 2023 05:04:54 -0800 (PST) X-Google-Smtp-Source: AMrXdXtMveD14OoS2PRPyP1VPxiEWGd2s21riBdcr3adrEeouQr1TACz7zA/Aq/SXkyf9O85URZZ X-Received: by 2002:aa7:d653:0:b0:47e:15ec:155e with SMTP id v19-20020aa7d653000000b0047e15ec155emr75053067edr.26.1673874293899; Mon, 16 Jan 2023 05:04:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673874293; cv=none; d=google.com; s=arc-20160816; b=rQFwe0vz+qV+oco53CThR9ywMAkwDci9QrDdcdwR9n07+DkDf/TonNedbQIUL/IFE5 uv6mWj/1QzNvbV9u2W5FN/CNHACCzpuyeZnzhysaDsi4eMHH13XS4cNu0/59lAaT3XSW lnwqyCvPhA9GgdIKJxQrw86zPGtKquXphQjcEzyqrGqIJtR9T8GA28q1QZ1xEnzjZw5t nYB/BZgopvxRuwE3PlFoQpQbCIWGk5C3eS+rQXeCweuDpeVTAFJ3clpYLgfPQEUyUapN jWZyQ9FrI085IV+Y+Tsezl+/PoQkRSLKaDfLk+ycqIKTImN9H9fi8ypJSfTXqwBxtf1L hfsA== 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=ykfQZOm+BASL1GRgngyr2+aX6xmiGeCmWuvPVEfYj38=; b=XHGkiU6RvgN4N4pts/ZvUYoxQFo1lvoFSrlAbeDVX8NXwGGQ8J3YcWLzz8HilqPkHY tmsc3zpA5IcCNBpPLBU1eR0BqYt/OsedQWlG6Rpq2t5B0sAAia1a9mndOqMKaiWFjFGt lNRwEnN6dUDE7L6f7nBij44CjoeCWjBryZyZDGMHNlxfzCmf5NqM2XVNLNjhh8sAf0yU ovHO0ng2vIL9Ha0r9PW404BBay2QSCfV8x4uAurwHA8lm86+Ff9AJ4GNI/IXtst/3EZ4 2+GY1sR1CTiDO3cIU81jdu0dYve5SkQ97fpdRg1h2OZhl2B2nHCK89mpM4Nzw1oHoxtt jDMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=aA2u2Wx7; 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 i17-20020a0564020f1100b0049defd69a6fsi6851328eda.622.2023.01.16.05.04.30; Mon, 16 Jan 2023 05:04:53 -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=aA2u2Wx7; 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 S231366AbjAPM5d (ORCPT + 99 others); Mon, 16 Jan 2023 07:57:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231326AbjAPM4q (ORCPT ); Mon, 16 Jan 2023 07:56:46 -0500 Received: from mail.3ffe.de (0001.3ffe.de [IPv6:2a01:4f8:c0c:9d57::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA8A21F5DE; Mon, 16 Jan 2023 04:55:37 -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 ACA07166C; Mon, 16 Jan 2023 13:55:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1673873735; 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=ykfQZOm+BASL1GRgngyr2+aX6xmiGeCmWuvPVEfYj38=; b=aA2u2Wx7ZKyQuxkNpuPYxgfMS5B+GnVIDNIN0zt/QCu4YlEArWbIuUj1GPucDXwmCAEf+Y LW64GMhF9PVSps9IXsahMzdwBBcHskaGdAVgCZTKTscquNL2binpZ0yUk4+SLET4biR23t 9b2HL1qR6ZJkbDFjYIBmYsN4XKzBdPpldXAvm7QEE+Dv6Efv50hndXE0bMdf0heUf5AQKn QBqi1c6Lw709w3D78JQrXFIogAKBWkK/z4e+tRzY2OJmbh1VhZFidD3TWO21LWYEpAf9BC VI6DXXHhh1ej+LTrxSCDkupqF3eaOEpaT5m2s8PUTzkOCeD34Acd0db3+oRK9g== From: Michael Walle Date: Mon, 16 Jan 2023 13:55:13 +0100 Subject: [PATCH net-next 1/6] net: mdio: Move mdiobus_scan() within file MIME-Version: 1.0 Message-Id: <20230116-net-next-remove-probe-capabilities-v1-1-5aa29738a023@walle.cc> References: <20230116-net-next-remove-probe-capabilities-v1-0-5aa29738a023@walle.cc> In-Reply-To: <20230116-net-next-remove-probe-capabilities-v1-0-5aa29738a023@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 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?1755184411669147207?= X-GMAIL-MSGID: =?utf-8?q?1755184411669147207?= 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 Mon Jan 16 12:55:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 44124 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1182362wrn; Mon, 16 Jan 2023 05:09:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXuq6T/mygl8zgpDOZpJYM0xRVa8wjQVk1aQtKCIMkBNn6PKKdnLm43z3KwupNAh4JwNBAZp X-Received: by 2002:a17:907:3e9d:b0:86f:9ee6:2e2b with SMTP id hs29-20020a1709073e9d00b0086f9ee62e2bmr6687340ejc.72.1673874571157; Mon, 16 Jan 2023 05:09:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673874571; cv=none; d=google.com; s=arc-20160816; b=jv7kK4jGBdc6XM0XQXd2IUI17qaKMh6DR2nx1bSTRcTGs3aAsjx5paaS1KJPCXJAB8 o6IFXes5sTVaFShFrssUYSnMmT3tAYcFP1AScbu9ZvVlxxzai9ckYMZYc/VcY+tCVq2H OlfTocuKYAf1zN46NoHJ2QcZr7RXYT27yovpr+3otZeAw2SyJav51onCULsCUFecclGU yc4ucRYI45jb9TwpCnie+srqtHff3SLcdQGQEr8WEkszAfQj0ddQs8LUMU9JnxBM9PCl v5gyavebGqr6//bf/jHrhVkfC7UzeGqUS4eNXr+e3RB9LRtlYvFIHyueFs4Z96O4Gymc sIhg== 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=Yr2NORBSCEQzLcadIYW0ER8YcDgLHVyF8s5GGXOqM/0=; b=QYGE+o2SobqUHcCwQFK1JuojK9k4sklAa7LX2Or8alImi2tEbR/p3oElL6DNX+suw0 owULzA9j/cschSHLvBzDy3OhfRezvCGw7ZYyQXrOpCAuL38JXp30les6IcDObBRbIq2A VNPEA04k5poC4w/hbXd0LhEofWhITgIXFhFerG62rgqBWF18jRLMAuZmhP8v4iBNzwvH gPJRAYK6WsA5eziuHCS8C5LhaL5XzfIn22asnY6qHk6WDshO+FftdkVEgBovOpsX6tvc gB4ljAnVpLY2JHLvrbezhRCJsp0VvGrOqLnVeO5AX9Xdd5TMTOTHQrQt6PuLcxeo2g5q JBzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=iujqjS5G; 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 ds8-20020a0564021cc800b0049db936930bsi5633278edb.95.2023.01.16.05.09.07; Mon, 16 Jan 2023 05:09:31 -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=iujqjS5G; 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 S231195AbjAPM5V (ORCPT + 99 others); Mon, 16 Jan 2023 07:57:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230469AbjAPM4s (ORCPT ); Mon, 16 Jan 2023 07:56:48 -0500 Received: from mail.3ffe.de (0001.3ffe.de [159.69.201.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2B441F91D; Mon, 16 Jan 2023 04:55:38 -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 52F641693; Mon, 16 Jan 2023 13:55:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1673873736; 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=Yr2NORBSCEQzLcadIYW0ER8YcDgLHVyF8s5GGXOqM/0=; b=iujqjS5GzttHoM3AZRBPHyJXUxzurtJo3pvMcQNLMKHyaqqVudo8CJtxrfMlo7YAbvQn7F qBF/LeJMxMtF8AcaWBmw9e7lK/Hux36og2l7+IEjgEDy+5jTHJTOY5Qu5hqLY9+DYBezTP R+kppHvrasBdBzdJvBWJXAenIZjV95SRdsR/xU53+4Fa4NuGwfC6bzdoqFZA7sR92HoczS tI4zs9LJ3RlAjg6Jhxy55BPh4PK6ScVftbtL7qxSVPARCavGvWe95ie2WtwISd7WmQRBWV agi5r6ImYKAbRJClKjEAM8jbprZGFn6yHU9U6CJZj1qSM+8MRW7B6vZOJTmhEw== From: Michael Walle Date: Mon, 16 Jan 2023 13:55:14 +0100 Subject: [PATCH net-next 2/6] net: mdio: Rework scanning of bus ready for quirks MIME-Version: 1.0 Message-Id: <20230116-net-next-remove-probe-capabilities-v1-2-5aa29738a023@walle.cc> References: <20230116-net-next-remove-probe-capabilities-v1-0-5aa29738a023@walle.cc> In-Reply-To: <20230116-net-next-remove-probe-capabilities-v1-0-5aa29738a023@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 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?1755184702342442361?= X-GMAIL-MSGID: =?utf-8?q?1755184702342442361?= 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 --- drivers/net/ethernet/marvell/pxa168_eth.c | 2 +- drivers/net/phy/mdio_bus.c | 123 +++++++++++++++++++++--------- include/linux/phy.h | 2 +- 3 files changed, 87 insertions(+), 40 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..25a964b98bc6 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); 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 Mon Jan 16 12:55:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 44119 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1181749wrn; Mon, 16 Jan 2023 05:08:22 -0800 (PST) X-Google-Smtp-Source: AMrXdXvuHA8l7/TROhv946h5xauG76UmptUpW7Fye3lmi4eArbg68gBbMrWtrxoP8hofXuI5ZW04 X-Received: by 2002:a05:6402:450f:b0:499:bf1b:5ee with SMTP id ez15-20020a056402450f00b00499bf1b05eemr26407063edb.6.1673874501867; Mon, 16 Jan 2023 05:08:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673874501; cv=none; d=google.com; s=arc-20160816; b=ZJ2BvzVv5uj2CQ7RIIpHv8om0VYEsSPTyNFNBNktw1Lqr4Q9S9lLBxUCq0heX1yLQx nl6ln1KCvblp3S0KHcTUingK5hVv+Bs2tGlR8btyuiU0cc3KahwYrl8dB5MqYgOtGT03 /ezknAnXOqQGmi92WdHUTwwWQKf9qfdp9vZP3/ExI194F9qhDwAipY9YNkcKYVIi72Po rs6j4RfbCfEFYK3fEYrNxMiIWPPGnAqw+xWdoIaY3gAL+2Sw8Iat6vFa5phjh4gblavJ HBSsMzUVGuucQ+WuURT0FlPCgPqos9NAKubDoduRe7m+fN6ktO0R2X76DjcOCcIrTbKs UnSg== 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=mOdDk7qwM6KUEnwMOgYHBFHa54fOPcgwCfCBJX4vAW4=; b=gcBobA/vzVbyAicGdk5duS0XzH9l8WXUZnHAfzISxxBkSILj2AFtLD4aqHmxlaLYiU iacu3aSv7S1qB453L3pzKSpIyBPcoKxZOoMfsZhHcIw4OX1B58INymWgUu8Myd8WJ4Q/ Jes1PvERKyPjnLVlpQvQ/Xkicj6awWd0B+HK4Pix+1Wx9VDI1ddL7kznjX41ILOcMDzK brXS+N7ehsWyOB6XGyWz+7M95k8bpZr9g7HSRjXShk90Z7gAvO/fdD7dGzH9JqOaE6Ho ghhLakaK/mbhYnXllG7Ztaa9SXBoKuxaUh6bv5Uv5FqdTN1bIoBLhGxW4YUFs9D4+crg eXhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=rth6PUzu; 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 h6-20020a50ed86000000b0049b67ac6ecdsi11116887edr.556.2023.01.16.05.07.57; Mon, 16 Jan 2023 05:08: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=rth6PUzu; 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 S231390AbjAPM5P (ORCPT + 99 others); Mon, 16 Jan 2023 07:57:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231267AbjAPM4r (ORCPT ); Mon, 16 Jan 2023 07:56:47 -0500 Received: from mail.3ffe.de (0001.3ffe.de [IPv6:2a01:4f8:c0c:9d57::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19A161F923; Mon, 16 Jan 2023 04:55:39 -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 047F016AE; Mon, 16 Jan 2023 13:55:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1673873737; 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=mOdDk7qwM6KUEnwMOgYHBFHa54fOPcgwCfCBJX4vAW4=; b=rth6PUzujx7tCIfgztgrsh2zQJqux1ncT1wDPw36a1KamHLyr8BHG6ACVmZUhn6afvUi35 L5b9RYITB+ctJL9lojjnvvEAJgiA9QtzZdxwy2R3ZlnEPh0kZPtUIVhSzF3wHVB/JP7UL4 xbGumpX0EArRziQAVyjxeuRgEU24zZpy0xc0l4AAjc0cu5VeMXljYv7qhwkcDbbSYEOdq9 FrD6pXadv+kz6oEaJCLtVB1z2UuwVvf8UJ/U1jJWUF/5J2VmXCK/RAp7xnQ+EIzwM0uvyq 8yvj17bZn37bpi5CX7/xT5mbl5Tq8dNvaTcpcObt36w/m+fkrAc/1m1Geu1s1w== From: Michael Walle Date: Mon, 16 Jan 2023 13:55:15 +0100 Subject: [PATCH net-next 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-v1-3-5aa29738a023@walle.cc> References: <20230116-net-next-remove-probe-capabilities-v1-0-5aa29738a023@walle.cc> In-Reply-To: <20230116-net-next-remove-probe-capabilities-v1-0-5aa29738a023@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 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?1755184629669105222?= X-GMAIL-MSGID: =?utf-8?q?1755184629669105222?= 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 --- drivers/net/phy/mdio_bus.c | 36 +++++++++++++++++++++++++++++++++--- include/linux/micrel_phy.h | 2 ++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 25a964b98bc6..f173c91842e0 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,31 @@ 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) +{ + struct phy_device *phydev; + u32 oui; + int i; + + for (i = 0; i < PHY_MAX_ADDR; i++) { + 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 +643,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 +718,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 Mon Jan 16 12:55:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 44112 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1179287wrn; Mon, 16 Jan 2023 05:03:55 -0800 (PST) X-Google-Smtp-Source: AMrXdXsCIowZpiKU2DoOg2D8CJYzKJ7ZhIST7BSUJxnTh9+g2KYFOufnAj5luX8tHmC/ftdrljWE X-Received: by 2002:a17:907:a2cd:b0:84d:4e03:1644 with SMTP id re13-20020a170907a2cd00b0084d4e031644mr26076986ejc.68.1673874234990; Mon, 16 Jan 2023 05:03:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673874234; cv=none; d=google.com; s=arc-20160816; b=xMO9jqLm9jPwtktalJ1RVwud2fkoltWDYrrqX8Mequ74wsT6StPlntGxmLb/v6DK5N by2Y44DBmR4p3flr5grfZuvEUaX4pGIV0TrCmX148QAXNZplGxGdGNlBsAIHcnEvxioy K7JfWhQWXWDR7eLKp0R/M/+ZDiyILw5eMgjh59lsznQmuq6tVy/k719YknXvz/yyC8ow onQvy6q/eC6UuZeFkIzbbXOfDV5hfkpZbEDiJLZGkpU+5tb+PVq17E2XVQsvOMXVOtnq +WuE0L+Xwns0rPUL/2CTgvGQdG8zL20dqi111WGIVyr2EGv+eWW/Jq/M/56TNyW6b9fi inDA== 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=W5Spwn+5qRW864bp5C5OgGPVSnNBAMvY7J7oVAjQX4k=; b=G4bIazrXdksr2CYX0msBHmI3exSMlFDVw1Bqgy4Ijqq9xhhKVHBy6qJYdpawh7gMh3 Ef8h8BxtqtAgFWzCVGRrVm619sbbMdIImwsovEp5bv5TAW6sNn3Sa80RuOSPFYsmB6oV lLtphA0exQv0KKKfDAwqLZCwPnhjqGlySnYe+DkfAdWSm5yyq7qrGCU65jWc/MCdD5xc 48Isy2ETnzqyKgbrmFEkYNtRrS9eoZvdq2zUOfS9hgCBuk9MLuqH5CS5lgxNh39tfiQo EP3PKvaLYmkqyyo/E+mTTCYs0f5sFheGnVGsEtxrjRxe0TDr4saCuIlqosBJA7XUhZcu fXSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=yEEVhq99; 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 ww2-20020a170907084200b0084cbde35b49si5721653ejb.990.2023.01.16.05.03.29; Mon, 16 Jan 2023 05:03:54 -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=yEEVhq99; 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 S231408AbjAPM52 (ORCPT + 99 others); Mon, 16 Jan 2023 07:57:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231304AbjAPM4s (ORCPT ); Mon, 16 Jan 2023 07:56:48 -0500 Received: from mail.3ffe.de (0001.3ffe.de [IPv6:2a01:4f8:c0c:9d57::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB8A01F926; Mon, 16 Jan 2023 04:55:39 -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 68D5516E8; Mon, 16 Jan 2023 13:55:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1673873737; 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=W5Spwn+5qRW864bp5C5OgGPVSnNBAMvY7J7oVAjQX4k=; b=yEEVhq99moifusghajmavnVyJawstON1afqC5Ff04kQU5FcGh+uBKpXdm+vTexU/67q7MJ kNEKHriYbGV8HSHSiTGmNNbXJIDYPz2PCIJL0w513IT7/2JFtP4uLWM5tvmoRwMjo6zV79 bm9Iy1ZK89C+HNt09RugGpVqIBI5yHMoAFsiR4x8JNl8M+XS3zLGLcIkh4Vs3U0x4RGofZ elYe1Bd8q3AOX/HETYv5xgbWsoQ/52E8XVlda3GogtajUnjVfaEEoPPhRNwXhVwOLZrg7f za0L4cmjFrEnvbiFWil9a5tSr1ZwDB2XxgTfW+xqEu+OPu/ZSp9YAp/vYTdSjQ== From: Michael Walle Date: Mon, 16 Jan 2023 13:55:16 +0100 Subject: [PATCH net-next 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-v1-4-5aa29738a023@walle.cc> References: <20230116-net-next-remove-probe-capabilities-v1-0-5aa29738a023@walle.cc> In-Reply-To: <20230116-net-next-remove-probe-capabilities-v1-0-5aa29738a023@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 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?1755184349755077354?= X-GMAIL-MSGID: =?utf-8?q?1755184349755077354?= 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 f173c91842e0..34790e601cb1 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -710,9 +710,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; @@ -720,9 +718,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 Mon Jan 16 12:55:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 44117 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1181297wrn; Mon, 16 Jan 2023 05:07:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXspZNrblJ88D9KgAjOZzvT/S1NPcA9D+bJ8UwCCIlkMpmUNTId2ubKyexxKcQPUeESB2Q+b X-Received: by 2002:a17:906:d211:b0:870:8b4f:8a86 with SMTP id w17-20020a170906d21100b008708b4f8a86mr3470828ejz.6.1673874450882; Mon, 16 Jan 2023 05:07:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673874450; cv=none; d=google.com; s=arc-20160816; b=KUGzU7AAQo/DQigQazASOdhl5uCZ2DFC2D90QzCwjg/F60yQtsJD8zPEpJXmSedk/N HW1ZpRccrQvPKEXmaSpsJ8P3ZnPQztQRVS5ld/rOAWtN9UuhTZq0pmmDvVrVGjS1Scys bkH7FQAuGKq9X+KjhPLpuHJLG20bqDb0ZRfOrUxsd4gH0TVkx6w5wzbn5SazvHr/bBBr UCmFcQlbrONYouSLTchyJIFpONSzmwFLqgWckD8Oe6kEUOPYfYAGB8AssEoajrQeWJQt RYsSdzi+MHZh2733pySeeduH0f9YugE1ufqWDDyvsp7YuWrMtOEzpufqoo7DMRy52Ri9 3FeA== 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=AmefAQEWD+GXbgOk3BMV9ynZkxYglIuiK7s798TPecY=; b=ll5+YXsdFNZENRJ50VCO+NAbLYwIFSBAJznAYaaIAySpGpgCShd8hmrAqshsA2LIm7 1YrcMFGJOvmBfGUFSE3/iNDAfs4rxeLsf3YT1KDordwtf1pvG8gF5gMoGwDlQo2kGCUy RoCO0k7Ra15NS3JDyHZSXXc6vc7TeJc1RmqVG1B66n8Ia3vn0+SIQWZycI5pno4ACN97 RPUDiT4NLEK/ymsy8eczLgF+LTfcmT7fKLLqJUsYFOLHAnQWojwjlx5+PfM5BdLTPdNI QZc3qTFSmyQExwfd1uOW1V0RkkIBczJh1fLewZGVk+RV9ES+muadVn0dUl6N0S3+1ezw dikw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=sLKvbJrI; 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 di15-20020a170906730f00b007ae4ed48290si33132868ejc.279.2023.01.16.05.07.07; Mon, 16 Jan 2023 05:07:30 -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=sLKvbJrI; 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 S230340AbjAPM6N (ORCPT + 99 others); Mon, 16 Jan 2023 07:58:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231348AbjAPM47 (ORCPT ); Mon, 16 Jan 2023 07:56:59 -0500 Received: from mail.3ffe.de (0001.3ffe.de [159.69.201.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2081620059; Mon, 16 Jan 2023 04:55:45 -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 12FAB16EC; Mon, 16 Jan 2023 13:55:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1673873738; 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=AmefAQEWD+GXbgOk3BMV9ynZkxYglIuiK7s798TPecY=; b=sLKvbJrI4kgqXVv0pEyIqGsNsTL/zk7yE0HThyFFkMmz/0rL8L46ETSp/M2C0OK5DLoXWT hIZ5SC4WG761f39d6rCOdGeKQX6iOI5FJp0GUBhh5L1nRnI/5bZbFJw/myihMni8gH/jyz hWsb962vtJC7Uof5rECX095OR++UDFZnmcNWvPM2WM4T7frVlwzFjAY0HafVGNTVYH6eIa 9odv6m9nZ3CVvnGVh+x8ybF5zJAvxIiaBwMrs6o1/lItG+yZCcHPSsF8YXi7ENJArrdPx9 XtMC2MoIHkjkhaTJrsB+UC+OY6qqAW/BSZhNftyh8yjqV+XOvVJx+yF/uOJBOA== From: Michael Walle Date: Mon, 16 Jan 2023 13:55:17 +0100 Subject: [PATCH net-next 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-v1-5-5aa29738a023@walle.cc> References: <20230116-net-next-remove-probe-capabilities-v1-0-5aa29738a023@walle.cc> In-Reply-To: <20230116-net-next-remove-probe-capabilities-v1-0-5aa29738a023@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 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?1755184576031573540?= X-GMAIL-MSGID: =?utf-8?q?1755184576031573540?= 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 Mon Jan 16 12:55:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Walle X-Patchwork-Id: 44122 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1182001wrn; Mon, 16 Jan 2023 05:08:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXuLJm9XFle92EsCHYcr7P15iQuVqaSXMQYFe47mTdpn4pBqd+dEvnEp9n2/1Ro9V35H1qun X-Received: by 2002:a17:907:970a:b0:7c0:fd1a:79ee with SMTP id jg10-20020a170907970a00b007c0fd1a79eemr118515855ejc.63.1673874531770; Mon, 16 Jan 2023 05:08:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673874531; cv=none; d=google.com; s=arc-20160816; b=UEF2Te2OZk1txzSHIkc7hQoQTq3dLrn3g1pi32QzWqS1jAFb9A6RLl0kcFs58NFE/M T1zMjoLzTpW/TPwEjAqlmB921vXrOZEslQIWWUXRLzoyoyDVO0eI3ohZ1CuNhV8J1ZZ9 c5CbFNVXTvF4NBnXl1H8BM9FvnWXiSxALWUsp6lpSkgTiRP+QGPkQQ9DHltk7+Z23JOq jvjJGj9iA/B79xjpFPtV0bTWXi/A6hRCjTOgahKKvMWiaC+Supt4+6V8V8sIOgC54QZC Si90/pzgtx0EtNOBxytEzGHdkIJNGkoZHeSx88gjggmTAQj+ZmBNImgd91+JRUk0jmjV YHtA== 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=N/4W4B+W4pbypXR0XLXo8vwK/KzTHK+Yr6B7LFX8zfE=; b=o9knj8Ne1JuVHKD7uatfFM2Q40JEA2Ezv+lR4pdU5y8IbjRq5ZCGRGHa+hkmDQ3g4J p2BdKhSOMu2X/mXREPTCX53b1/itLvuZT2wNaURUEOWKapbSRVW3AO3FZIrrp3koEszm tf7iGTZ+UCKGd2xXbn+U9gqrkaG+gbRu2uibkc9SabxAJNcjyYRui/F4DAyw1XXlBhT0 4jONTpy53Qdmaoo550Lz8RV8o4faQxZ8p3tMsaML1frjRr7dwfA0tIzzfG+WKFuG5F05 IBhT+qKqObIJ5nuI9e7FdZBaTS87NbaP13bBIujopA0yS1s9cUsyMJpXdDG14cd+4CRb ixvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2022082101 header.b=xmPF+pbQ; 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 hq24-20020a1709073f1800b0086c669eab27si7507714ejc.16.2023.01.16.05.08.28; Mon, 16 Jan 2023 05:08:51 -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=xmPF+pbQ; 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 S231433AbjAPM6H (ORCPT + 99 others); Mon, 16 Jan 2023 07:58:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231292AbjAPM46 (ORCPT ); Mon, 16 Jan 2023 07:56:58 -0500 Received: from mail.3ffe.de (0001.3ffe.de [159.69.201.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4B781F91B; Mon, 16 Jan 2023 04:55:45 -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 D9DE016F2; Mon, 16 Jan 2023 13:55:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1673873739; 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=N/4W4B+W4pbypXR0XLXo8vwK/KzTHK+Yr6B7LFX8zfE=; b=xmPF+pbQnuFJOIntAfRbp9TykBDBlvpixmjoiiWQ1ZmDbGhat5vqpLYOEh8b0FThavc0Hp XQmq5Zs+X+BSLhhO7tisGY1ZyxhoyWi+gz2tHrj28iKFKYNmFm8bCBasoF0aAV/ZyYZ79a 4IYKgYHHAzbPN54vhPfSQbf7VQ0DeWm7Y/mPClv6SFdDFyQEDb2NnvAjpNzYFqn4ICwqgb A2EVliCxWfRccD+6tIO+yyyhMucYX+KVvjH8ElwfZH/YgPNnuNB8FIe+CwO0xP3EgD7VfK cUMALh+rWueQwiQjMXst9NEXnuW4FLyXKQpKRxSqLV+CB0Rrz7B3kkzBIN7buw== From: Michael Walle Date: Mon, 16 Jan 2023 13:55:18 +0100 Subject: [PATCH net-next 6/6] net: phy: Remove probe_capabilities MIME-Version: 1.0 Message-Id: <20230116-net-next-remove-probe-capabilities-v1-6-5aa29738a023@walle.cc> References: <20230116-net-next-remove-probe-capabilities-v1-0-5aa29738a023@walle.cc> In-Reply-To: <20230116-net-next-remove-probe-capabilities-v1-0-5aa29738a023@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 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?1755184660685574630?= X-GMAIL-MSGID: =?utf-8?q?1755184660685574630?= 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 --- 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;