Commit 5fc7cf17 authored by David Daney's avatar David Daney Committed by David S. Miller

net: thunderx: Cleanup PHY probing code.

Remove the call to force the octeon-mdio driver to be loaded.  Allow
the standard driver loading mechanisms to load the PHY drivers, and
use -EPROBE_DEFER to cause the BGX driver to be probed only after the
PHY drivers are available.

Reorder the setting of MAC addresses and PHY probing to allow BGX
LMACs with no attached PHY to still be assigned a MAC address.
Signed-off-by: default avatarDavid Daney <david.daney@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0df83e7a
...@@ -978,27 +978,37 @@ static int bgx_init_of_phy(struct bgx *bgx) ...@@ -978,27 +978,37 @@ static int bgx_init_of_phy(struct bgx *bgx)
const char *mac; const char *mac;
device_for_each_child_node(&bgx->pdev->dev, fwn) { device_for_each_child_node(&bgx->pdev->dev, fwn) {
struct phy_device *pd;
struct device_node *phy_np; struct device_node *phy_np;
struct device_node *node = to_of_node(fwn); struct device_node *node = to_of_node(fwn);
/* If it is not an OF node we cannot handle it yet, so /* Should always be an OF node. But if it is not, we
* exit the loop. * cannot handle it, so exit the loop.
*/ */
if (!node) if (!node)
break; break;
phy_np = of_parse_phandle(node, "phy-handle", 0);
if (!phy_np)
continue;
bgx->lmac[lmac].phydev = of_phy_find_device(phy_np);
mac = of_get_mac_address(node); mac = of_get_mac_address(node);
if (mac) if (mac)
ether_addr_copy(bgx->lmac[lmac].mac, mac); ether_addr_copy(bgx->lmac[lmac].mac, mac);
SET_NETDEV_DEV(&bgx->lmac[lmac].netdev, &bgx->pdev->dev); SET_NETDEV_DEV(&bgx->lmac[lmac].netdev, &bgx->pdev->dev);
bgx->lmac[lmac].lmacid = lmac; bgx->lmac[lmac].lmacid = lmac;
phy_np = of_parse_phandle(node, "phy-handle", 0);
/* If there is no phy or defective firmware presents
* this cortina phy, for which there is no driver
* support, ignore it.
*/
if (phy_np &&
!of_device_is_compatible(phy_np, "cortina,cs4223-slice")) {
/* Wait until the phy drivers are available */
pd = of_phy_find_device(phy_np);
if (!pd)
return -EPROBE_DEFER;
bgx->lmac[lmac].phydev = pd;
}
lmac++; lmac++;
if (lmac == MAX_LMAC_PER_BGX) { if (lmac == MAX_LMAC_PER_BGX) {
of_node_put(node); of_node_put(node);
...@@ -1032,9 +1042,6 @@ static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1032,9 +1042,6 @@ static int bgx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
struct bgx *bgx = NULL; struct bgx *bgx = NULL;
u8 lmac; u8 lmac;
/* Load octeon mdio driver */
octeon_mdiobus_force_mod_depencency();
bgx = devm_kzalloc(dev, sizeof(*bgx), GFP_KERNEL); bgx = devm_kzalloc(dev, sizeof(*bgx), GFP_KERNEL);
if (!bgx) if (!bgx)
return -ENOMEM; return -ENOMEM;
......
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