netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: Also request modules for C45 IDs
@ 2018-11-30 13:27 Jose Abreu
  2018-11-30 21:29 ` Andrew Lunn
  0 siblings, 1 reply; 2+ messages in thread
From: Jose Abreu @ 2018-11-30 13:27 UTC (permalink / raw)
  To: netdev
  Cc: Jose Abreu, Andrew Lunn, Florian Fainelli, David S. Miller,
	Joao Pinto

Logic of phy_device_create() requests PHY modules according to PHY ID
but for C45 PHYs we use different field for the IDs.

Let's also request the modules for these IDs.

Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Joao Pinto <joao.pinto@synopsys.com>
---
 drivers/net/phy/phy_device.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 0904002b19a2..d0f6edfd3381 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -606,6 +606,18 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
 	 * there's no driver _already_ loaded.
 	 */
 	request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT, MDIO_ID_ARGS(phy_id));
+	if (c45_ids) {
+		const int num_ids = ARRAY_SIZE(c45_ids->device_ids);
+		int i;
+
+		for (i = 1; i < num_ids; i++) {
+			if (!(c45_ids->devices_in_package & (1 << i)))
+				continue;
+
+			request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT,
+				       MDIO_ID_ARGS(c45_ids->device_ids[i]));
+		}
+	}
 
 	device_initialize(&mdiodev->dev);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] net: phy: Also request modules for C45 IDs
  2018-11-30 13:27 [PATCH net-next] net: phy: Also request modules for C45 IDs Jose Abreu
@ 2018-11-30 21:29 ` Andrew Lunn
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Lunn @ 2018-11-30 21:29 UTC (permalink / raw)
  To: Jose Abreu; +Cc: netdev, Florian Fainelli, David S. Miller, Joao Pinto

> @@ -606,6 +606,18 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
>  	 * there's no driver _already_ loaded.
>  	 */
>  	request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT, MDIO_ID_ARGS(phy_id));

This line above is for C22. If you look at phy_bus_match(), it will
perform a match on the c45_ids->device_ids[] if it is a c45 PHY, or
the phy_id if it is c22. So i think we should also have this one or
the other here, not both.

Thanks
	Andrew

> +	if (c45_ids) {
> +		const int num_ids = ARRAY_SIZE(c45_ids->device_ids);
> +		int i;
> +
> +		for (i = 1; i < num_ids; i++) {
> +			if (!(c45_ids->devices_in_package & (1 << i)))
> +				continue;
> +
> +			request_module(MDIO_MODULE_PREFIX MDIO_ID_FMT,
> +				       MDIO_ID_ARGS(c45_ids->device_ids[i]));
> +		}
> +	}
>  
>  	device_initialize(&mdiodev->dev);
>  
> -- 
> 2.7.4
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-12-01  8:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-30 13:27 [PATCH net-next] net: phy: Also request modules for C45 IDs Jose Abreu
2018-11-30 21:29 ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).