X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fnet%2Fcpmac.c;h=2b5740b3d1825dee5b91f9b3862060e71c266f8b;hb=7249db2c281ac688977ecc6862cdee9969d310e2;hp=6e12d48351b8e1a4b243efd80b5c669c689e6830;hpb=5db501d7e398c6a838a307adf0347cf6a2b015a3;p=linux-2.6-omap-h63xx.git diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c index 6e12d48351b..2b5740b3d18 100644 --- a/drivers/net/cpmac.c +++ b/drivers/net/cpmac.c @@ -42,6 +42,7 @@ MODULE_AUTHOR("Eugene Konev "); MODULE_DESCRIPTION("TI AR7 ethernet driver (CPMAC)"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:cpmac"); static int debug_level = 8; static int dumb_switch; @@ -661,9 +662,6 @@ static irqreturn_t cpmac_irq(int irq, void *dev_id) int queue; u32 status; - if (!dev) - return IRQ_NONE; - priv = netdev_priv(dev); status = cpmac_read(priv->regs, CPMAC_MAC_INT_VECTOR); @@ -848,15 +846,6 @@ static void cpmac_adjust_link(struct net_device *dev) spin_unlock(&priv->lock); } -static int cpmac_link_update(struct net_device *dev, - struct fixed_phy_status *status) -{ - status->link = 1; - status->speed = 100; - status->duplex = 1; - return 0; -} - static int cpmac_open(struct net_device *dev) { int i, size, res; @@ -999,11 +988,11 @@ static int external_switch; static int __devinit cpmac_probe(struct platform_device *pdev) { int rc, phy_id, i; + char *mdio_bus_id = "0"; struct resource *mem; struct cpmac_priv *priv; struct net_device *dev; struct plat_cpmac_data *pdata; - struct fixed_info *fixed_phy; DECLARE_MAC_BUF(mac); pdata = pdev->dev.platform_data; @@ -1017,9 +1006,21 @@ static int __devinit cpmac_probe(struct platform_device *pdev) } if (phy_id == PHY_MAX_ADDR) { - if (external_switch || dumb_switch) + if (external_switch || dumb_switch) { + struct fixed_phy_status status = {}; + + /* + * FIXME: this should be in the platform code! + * Since there is not platform code at all (that is, + * no mainline users of that driver), place it here + * for now. + */ phy_id = 0; - else { + status.link = 1; + status.duplex = 1; + status.speed = 100; + fixed_phy_add(PHY_POLL, phy_id, &status); + } else { printk(KERN_ERR "cpmac: no PHY present\n"); return -ENODEV; } @@ -1063,32 +1064,8 @@ static int __devinit cpmac_probe(struct platform_device *pdev) priv->msg_enable = netif_msg_init(debug_level, 0xff); memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr)); - if (phy_id == 31) { - snprintf(priv->phy_name, BUS_ID_SIZE, PHY_ID_FMT, cpmac_mii.id, - phy_id); - } else { - /* Let's try to get a free fixed phy... */ - for (i = 0; i < MAX_PHY_AMNT; i++) { - fixed_phy = fixed_mdio_get_phydev(i); - if (!fixed_phy) - continue; - if (!fixed_phy->phydev->attached_dev) { - strncpy(priv->phy_name, - fixed_phy->phydev->dev.bus_id, - BUS_ID_SIZE); - fixed_mdio_set_link_update(fixed_phy->phydev, - &cpmac_link_update); - goto phy_found; - } - } - if (netif_msg_drv(priv)) - printk(KERN_ERR "%s: Could not find fixed PHY\n", - dev->name); - rc = -ENODEV; - goto fail; - } + snprintf(priv->phy_name, BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id); -phy_found: priv->phy = phy_connect(dev, priv->phy_name, &cpmac_adjust_link, 0, PHY_INTERFACE_MODE_MII); if (IS_ERR(priv->phy)) { @@ -1127,6 +1104,7 @@ static int __devexit cpmac_remove(struct platform_device *pdev) static struct platform_driver cpmac_driver = { .driver.name = "cpmac", + .driver.owner = THIS_MODULE, .probe = cpmac_probe, .remove = __devexit_p(cpmac_remove), }; @@ -1165,6 +1143,7 @@ int __devinit cpmac_init(void) } cpmac_mii.phy_mask = ~(mask | 0x80000000); + snprintf(cpmac_mii.id, MII_BUS_ID_SIZE, "0"); res = mdiobus_register(&cpmac_mii); if (res)