Commit 791e5f61 authored by Andrew Lunn's avatar Andrew Lunn Committed by David S. Miller

net: phy: mdio-octeon: Cleanup module loading dependencies

To ensure that the octeon MDIO driver has been loaded, the Cavium
ethernet drivers reference a dummy symbol in the MDIO driver. This
forces it to be loaded first. And this symbol has not been cleanly
implemented, resulting in warnings when build W=1 C=1.

Since device tree is being used, and a phandle points to the PHY on
the MDIO bus, we can make use of deferred probing. If the PHY fails to
connect, it should be because the MDIO bus driver has not loaded
yet. Return -EPROBE_DEFER so it will be tried again later.

Additionally, add a MODULE_SOFTDEP() to give user space a hint as to
what order it should load the modules.

v2:
s/octoen/octeon/
Add MODULE_SOFTDEP()

Cc: Sunil Goutham <sgoutham@marvell.com>
Cc: Robert Richter <rrichter@marvell.com>
Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
Tested-by: default avatarChris Packham <chris.packham@alliedtelesis.co.nz>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c7b04d10
...@@ -961,7 +961,7 @@ static int octeon_mgmt_init_phy(struct net_device *netdev) ...@@ -961,7 +961,7 @@ static int octeon_mgmt_init_phy(struct net_device *netdev)
PHY_INTERFACE_MODE_MII); PHY_INTERFACE_MODE_MII);
if (!phydev) if (!phydev)
return -ENODEV; return -EPROBE_DEFER;
return 0; return 0;
} }
...@@ -1554,12 +1554,8 @@ static struct platform_driver octeon_mgmt_driver = { ...@@ -1554,12 +1554,8 @@ static struct platform_driver octeon_mgmt_driver = {
.remove = octeon_mgmt_remove, .remove = octeon_mgmt_remove,
}; };
extern void octeon_mdiobus_force_mod_depencency(void);
static int __init octeon_mgmt_mod_init(void) static int __init octeon_mgmt_mod_init(void)
{ {
/* Force our mdiobus driver module to be loaded first. */
octeon_mdiobus_force_mod_depencency();
return platform_driver_register(&octeon_mgmt_driver); return platform_driver_register(&octeon_mgmt_driver);
} }
...@@ -1571,6 +1567,7 @@ static void __exit octeon_mgmt_mod_exit(void) ...@@ -1571,6 +1567,7 @@ static void __exit octeon_mgmt_mod_exit(void)
module_init(octeon_mgmt_mod_init); module_init(octeon_mgmt_mod_init);
module_exit(octeon_mgmt_mod_exit); module_exit(octeon_mgmt_mod_exit);
MODULE_SOFTDEP("pre: mdio-cavium");
MODULE_DESCRIPTION(DRV_DESCRIPTION); MODULE_DESCRIPTION(DRV_DESCRIPTION);
MODULE_AUTHOR("David Daney"); MODULE_AUTHOR("David Daney");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -108,12 +108,6 @@ static struct platform_driver octeon_mdiobus_driver = { ...@@ -108,12 +108,6 @@ static struct platform_driver octeon_mdiobus_driver = {
.remove = octeon_mdiobus_remove, .remove = octeon_mdiobus_remove,
}; };
void octeon_mdiobus_force_mod_depencency(void)
{
/* Let ethernet drivers force us to be loaded. */
}
EXPORT_SYMBOL(octeon_mdiobus_force_mod_depencency);
module_platform_driver(octeon_mdiobus_driver); module_platform_driver(octeon_mdiobus_driver);
MODULE_DESCRIPTION("Cavium OCTEON MDIO bus driver"); MODULE_DESCRIPTION("Cavium OCTEON MDIO bus driver");
......
...@@ -163,7 +163,7 @@ int cvm_oct_phy_setup_device(struct net_device *dev) ...@@ -163,7 +163,7 @@ int cvm_oct_phy_setup_device(struct net_device *dev)
of_node_put(phy_node); of_node_put(phy_node);
if (!phydev) if (!phydev)
return -ENODEV; return -EPROBE_DEFER;
priv->last_link = 0; priv->last_link = 0;
phy_start(phydev); phy_start(phydev);
......
...@@ -22,7 +22,5 @@ ...@@ -22,7 +22,5 @@
extern const struct ethtool_ops cvm_oct_ethtool_ops; extern const struct ethtool_ops cvm_oct_ethtool_ops;
void octeon_mdiobus_force_mod_depencency(void);
int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
int cvm_oct_phy_setup_device(struct net_device *dev); int cvm_oct_phy_setup_device(struct net_device *dev);
...@@ -689,8 +689,6 @@ static int cvm_oct_probe(struct platform_device *pdev) ...@@ -689,8 +689,6 @@ static int cvm_oct_probe(struct platform_device *pdev)
mtu_overhead += VLAN_HLEN; mtu_overhead += VLAN_HLEN;
#endif #endif
octeon_mdiobus_force_mod_depencency();
pip = pdev->dev.of_node; pip = pdev->dev.of_node;
if (!pip) { if (!pip) {
pr_err("Error: No 'pip' in /aliases\n"); pr_err("Error: No 'pip' in /aliases\n");
...@@ -987,6 +985,7 @@ static struct platform_driver cvm_oct_driver = { ...@@ -987,6 +985,7 @@ static struct platform_driver cvm_oct_driver = {
module_platform_driver(cvm_oct_driver); module_platform_driver(cvm_oct_driver);
MODULE_SOFTDEP("pre: mdio-cavium");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Cavium Networks <support@caviumnetworks.com>"); MODULE_AUTHOR("Cavium Networks <support@caviumnetworks.com>");
MODULE_DESCRIPTION("Cavium Networks Octeon ethernet driver."); MODULE_DESCRIPTION("Cavium Networks Octeon ethernet driver.");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment