From: Michael Walle <mwalle@kernel.org>
To: "Andrew Lunn" <andrew@lunn.ch>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"Russell King" <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Yisen Zhuang" <yisen.zhuang@huawei.com>,
"Salil Mehta" <salil.mehta@huawei.com>,
"Florian Fainelli" <florian.fainelli@broadcom.com>,
"Broadcom internal kernel review list"
<bcm-kernel-feedback-list@broadcom.com>,
"Marek Behún" <kabel@kernel.org>, "Xu Liang" <lxu@maxlinear.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Michael Walle <mwalle@kernel.org>
Subject: [PATCH net-next v2 05/10] net: phy: make the "prevent_c45_scan" a property of the MII bus
Date: Fri, 23 Jun 2023 12:29:14 +0200 [thread overview]
Message-ID: <20230620-feature-c45-over-c22-v2-5-def0ab9ccee2@kernel.org> (raw)
In-Reply-To: <20230620-feature-c45-over-c22-v2-0-def0ab9ccee2@kernel.org>
The blacklist will also be used elsewhere in the kernel, e.g. in the
DT scanning code. Make it a property of mii_bus and export the function.
Signed-off-by: Michael Walle <mwalle@kernel.org>
---
drivers/net/phy/mdio_bus.c | 17 ++++++++---------
include/linux/phy.h | 5 +++++
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index a31eb1204f63..00b25f6803bc 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -613,9 +613,9 @@ static int mdiobus_scan_bus_c45(struct mii_bus *bus)
* 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.
+ * should prohibit any C45 transactions.
*/
-static bool mdiobus_prevent_c45_scan(struct mii_bus *bus)
+void mdiobus_scan_for_broken_c45_access(struct mii_bus *bus)
{
int i;
@@ -628,10 +628,11 @@ static bool mdiobus_prevent_c45_scan(struct mii_bus *bus)
continue;
oui = phydev->phy_id >> 10;
- if (oui == MICREL_OUI)
- return true;
+ if (oui == MICREL_OUI) {
+ bus->prevent_c45_access = true;
+ break;
+ }
}
- return false;
}
/**
@@ -652,7 +653,6 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
{
struct mdio_device *mdiodev;
struct gpio_desc *gpiod;
- bool prevent_c45_scan;
int i, err;
if (!bus || !bus->name)
@@ -724,9 +724,8 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
goto error;
}
- prevent_c45_scan = mdiobus_prevent_c45_scan(bus);
-
- if (!prevent_c45_scan && bus->read_c45) {
+ mdiobus_scan_for_broken_c45_access(bus);
+ if (!bus->prevent_c45_access && bus->read_c45) {
err = mdiobus_scan_bus_c45(bus);
if (err)
goto error;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 12679bbd4b91..a7aff91f4eb0 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -410,6 +410,9 @@ struct mii_bus {
/** @phy_ignore_ta_mask: PHY addresses to ignore the TA/read failure */
u32 phy_ignore_ta_mask;
+ /** @prevent_c45_access: Don't do any C45 transactions on the bus */
+ unsigned prevent_c45_access:1;
+
/**
* @irq: An array of interrupts, each PHY's interrupt at the index
* matching its address
@@ -462,6 +465,8 @@ 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_c22(struct mii_bus *bus, int addr);
+void mdiobus_scan_for_broken_c45_access(struct mii_bus *bus);
+
#define PHY_INTERRUPT_DISABLED false
#define PHY_INTERRUPT_ENABLED true
--
2.39.2
next prev parent reply other threads:[~2023-06-23 10:30 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-23 10:29 [PATCH net-next v2 00/10] net: phy: C45-over-C22 access Michael Walle
2023-06-23 10:29 ` [PATCH net-next v2 01/10] net: phy: add error checks in mmd_phy_indirect() and export it Michael Walle
2023-06-23 10:29 ` [PATCH net-next v2 02/10] net: phy: get rid of redundant is_c45 information Michael Walle
2023-06-23 10:29 ` [PATCH net-next v2 03/10] net: phy: introduce phy_is_c45() Michael Walle
2023-06-23 17:15 ` Andrew Lunn
2023-06-23 10:29 ` [PATCH net-next v2 04/10] net: phy: replace is_c45 with phy_accces_mode Michael Walle
2023-06-23 17:34 ` Andrew Lunn
2023-06-23 19:54 ` Andrew Lunn
2023-06-26 6:31 ` Michael Walle
2023-06-23 10:29 ` Michael Walle [this message]
2023-06-23 10:29 ` [PATCH net-next v2 06/10] net: phy: print an info if a broken C45 bus is found Michael Walle
2023-06-23 17:42 ` Andrew Lunn
2023-06-23 20:35 ` Simon Horman
2023-06-26 6:50 ` Michael Walle
2023-06-23 10:29 ` [PATCH net-next v2 07/10] net: phy: add support for C45-over-C22 transfers Michael Walle
2023-06-23 20:43 ` Simon Horman
2023-06-24 20:15 ` Andrew Lunn
2023-06-26 7:14 ` Michael Walle
2023-06-23 10:29 ` [PATCH net-next v2 08/10] net: phy: introduce phy_promote_to_c45() Michael Walle
2023-06-23 10:29 ` [PATCH net-next v2 09/10] net: mdio: add C45-over-C22 fallback to fwnode_mdiobus_register_phy() Michael Walle
2023-06-23 10:29 ` [PATCH net-next v2 10/10] net: mdio: support C45-over-C22 when probed via OF Michael Walle
2023-06-23 20:48 ` Simon Horman
2023-06-26 7:37 ` Michael Walle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230620-feature-c45-over-c22-v2-5-def0ab9ccee2@kernel.org \
--to=mwalle@kernel.org \
--cc=andrew@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=hkallweit1@gmail.com \
--cc=kabel@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lxu@maxlinear.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=salil.mehta@huawei.com \
--cc=yisen.zhuang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®