|
@@ -49,7 +49,6 @@
|
|
|
#include "stmmac.h"
|
|
|
|
|
|
#define STMMAC_RESOURCE_NAME "stmmaceth"
|
|
|
-#define PHY_RESOURCE_NAME "stmmacphy"
|
|
|
|
|
|
#undef STMMAC_DEBUG
|
|
|
/*#define STMMAC_DEBUG*/
|
|
@@ -305,18 +304,13 @@ static int stmmac_init_phy(struct net_device *dev)
|
|
|
priv->speed = 0;
|
|
|
priv->oldduplex = -1;
|
|
|
|
|
|
- if (priv->phy_addr == -1) {
|
|
|
- /* We don't have a PHY, so do nothing */
|
|
|
- return 0;
|
|
|
- }
|
|
|
-
|
|
|
snprintf(bus_id, MII_BUS_ID_SIZE, "%x", priv->plat->bus_id);
|
|
|
snprintf(phy_id, MII_BUS_ID_SIZE + 3, PHY_ID_FMT, bus_id,
|
|
|
- priv->phy_addr);
|
|
|
+ priv->plat->phy_addr);
|
|
|
pr_debug("stmmac_init_phy: trying to attach to %s\n", phy_id);
|
|
|
|
|
|
phydev = phy_connect(dev, phy_id, &stmmac_adjust_link, 0,
|
|
|
- priv->phy_interface);
|
|
|
+ priv->plat->interface);
|
|
|
|
|
|
if (IS_ERR(phydev)) {
|
|
|
pr_err("%s: Could not attach to PHY\n", dev->name);
|
|
@@ -335,7 +329,7 @@ static int stmmac_init_phy(struct net_device *dev)
|
|
|
return -ENODEV;
|
|
|
}
|
|
|
pr_debug("stmmac_init_phy: %s: attached to PHY (UID 0x%x)"
|
|
|
- " Link = %d\n", dev->name, phydev->phy_id, phydev->link);
|
|
|
+ " Link = %d\n", dev->name, phydev->phy_id, phydev->link);
|
|
|
|
|
|
priv->phydev = phydev;
|
|
|
|
|
@@ -1528,71 +1522,6 @@ static int stmmac_mac_device_setup(struct net_device *dev)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-static int stmmacphy_dvr_probe(struct platform_device *pdev)
|
|
|
-{
|
|
|
- struct plat_stmmacphy_data *plat_dat = pdev->dev.platform_data;
|
|
|
-
|
|
|
- pr_debug("stmmacphy_dvr_probe: added phy for bus %d\n",
|
|
|
- plat_dat->bus_id);
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-static int stmmacphy_dvr_remove(struct platform_device *pdev)
|
|
|
-{
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
-static struct platform_driver stmmacphy_driver = {
|
|
|
- .driver = {
|
|
|
- .name = PHY_RESOURCE_NAME,
|
|
|
- },
|
|
|
- .probe = stmmacphy_dvr_probe,
|
|
|
- .remove = stmmacphy_dvr_remove,
|
|
|
-};
|
|
|
-
|
|
|
-/**
|
|
|
- * stmmac_associate_phy
|
|
|
- * @dev: pointer to device structure
|
|
|
- * @data: points to the private structure.
|
|
|
- * Description: Scans through all the PHYs we have registered and checks if
|
|
|
- * any are associated with our MAC. If so, then just fill in
|
|
|
- * the blanks in our local context structure
|
|
|
- */
|
|
|
-static int stmmac_associate_phy(struct device *dev, void *data)
|
|
|
-{
|
|
|
- struct stmmac_priv *priv = (struct stmmac_priv *)data;
|
|
|
- struct plat_stmmacphy_data *plat_dat = dev->platform_data;
|
|
|
-
|
|
|
- DBG(probe, DEBUG, "%s: checking phy for bus %d\n", __func__,
|
|
|
- plat_dat->bus_id);
|
|
|
-
|
|
|
- /* Check that this phy is for the MAC being initialised */
|
|
|
- if (priv->plat->bus_id != plat_dat->bus_id)
|
|
|
- return 0;
|
|
|
-
|
|
|
- /* OK, this PHY is connected to the MAC.
|
|
|
- Go ahead and get the parameters */
|
|
|
- DBG(probe, DEBUG, "%s: OK. Found PHY config\n", __func__);
|
|
|
- priv->phy_irq =
|
|
|
- platform_get_irq_byname(to_platform_device(dev), "phyirq");
|
|
|
- DBG(probe, DEBUG, "%s: PHY irq on bus %d is %d\n", __func__,
|
|
|
- plat_dat->bus_id, priv->phy_irq);
|
|
|
-
|
|
|
- /* Override with kernel parameters if supplied XXX CRS XXX
|
|
|
- * this needs to have multiple instances */
|
|
|
- if ((phyaddr >= 0) && (phyaddr <= 31))
|
|
|
- plat_dat->phy_addr = phyaddr;
|
|
|
-
|
|
|
- priv->phy_addr = plat_dat->phy_addr;
|
|
|
- priv->phy_mask = plat_dat->phy_mask;
|
|
|
- priv->phy_interface = plat_dat->interface;
|
|
|
- priv->phy_reset = plat_dat->phy_reset;
|
|
|
-
|
|
|
- DBG(probe, DEBUG, "%s: exiting\n", __func__);
|
|
|
- return 1; /* forces exit of driver_for_each_device() */
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* stmmac_dvr_probe
|
|
|
* @pdev: platform device pointer
|
|
@@ -1683,14 +1612,10 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
|
|
|
if (ret < 0)
|
|
|
goto out_plat_exit;
|
|
|
|
|
|
- /* associate a PHY - it is provided by another platform bus */
|
|
|
- if (!driver_for_each_device
|
|
|
- (&(stmmacphy_driver.driver), NULL, (void *)priv,
|
|
|
- stmmac_associate_phy)) {
|
|
|
- pr_err("No PHY device is associated with this MAC!\n");
|
|
|
- ret = -ENODEV;
|
|
|
- goto out_unregister;
|
|
|
- }
|
|
|
+ /* Override with kernel parameters if supplied XXX CRS XXX
|
|
|
+ * this needs to have multiple instances */
|
|
|
+ if ((phyaddr >= 0) && (phyaddr <= 31))
|
|
|
+ priv->plat->phy_addr = phyaddr;
|
|
|
|
|
|
pr_info("\t%s - (dev. name: %s - id: %d, IRQ #%d\n"
|
|
|
"\tIO base addr: 0x%p)\n", ndev->name, pdev->name,
|
|
@@ -1890,11 +1815,6 @@ static int __init stmmac_init_module(void)
|
|
|
{
|
|
|
int ret;
|
|
|
|
|
|
- if (platform_driver_register(&stmmacphy_driver)) {
|
|
|
- pr_err("No PHY devices registered!\n");
|
|
|
- return -ENODEV;
|
|
|
- }
|
|
|
-
|
|
|
ret = platform_driver_register(&stmmac_driver);
|
|
|
return ret;
|
|
|
}
|
|
@@ -1905,7 +1825,6 @@ static int __init stmmac_init_module(void)
|
|
|
*/
|
|
|
static void __exit stmmac_cleanup_module(void)
|
|
|
{
|
|
|
- platform_driver_unregister(&stmmacphy_driver);
|
|
|
platform_driver_unregister(&stmmac_driver);
|
|
|
}
|
|
|
|