1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2025-04-21 12:27:27 +03:00

ar71xx: sync ethernet driver changes with trunk to fix MDIO issues on ar7240

git-svn-id: svn://svn.openwrt.org/openwrt/branches/backfire@26672 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nbd
2011-04-15 00:05:44 +00:00
parent c8564630f3
commit 2d335ddc1c
9 changed files with 175 additions and 137 deletions

View File

@@ -14,14 +14,14 @@
#include "ag71xx.h"
#define AG71XX_DEFAULT_MSG_ENABLE \
( NETIF_MSG_DRV \
(NETIF_MSG_DRV \
| NETIF_MSG_PROBE \
| NETIF_MSG_LINK \
| NETIF_MSG_TIMER \
| NETIF_MSG_IFDOWN \
| NETIF_MSG_IFUP \
| NETIF_MSG_RX_ERR \
| NETIF_MSG_TX_ERR )
| NETIF_MSG_TX_ERR)
static int ag71xx_msg_level = -1;
@@ -119,14 +119,15 @@ static int ag71xx_ring_alloc(struct ag71xx_ring *ring, unsigned int size)
}
for (i = 0; i < size; i++) {
ring->buf[i].desc = (struct ag71xx_desc *)&ring->descs_cpu[i * ring->desc_size];
int idx = i * ring->desc_size;
ring->buf[i].desc = (struct ag71xx_desc *)&ring->descs_cpu[idx];
DBG("ag71xx: ring %p, desc %d at %p\n",
ring, i, ring->buf[i].desc);
}
return 0;
err:
err:
return err;
}
@@ -573,16 +574,12 @@ static void ag71xx_hw_stop(struct ag71xx *ag)
static int ag71xx_open(struct net_device *dev)
{
struct ag71xx *ag = netdev_priv(dev);
struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag);
int ret;
ret = ag71xx_rings_init(ag);
if (ret)
goto err;
if (pdata->is_ar724x)
ag71xx_hw_init(ag);
napi_enable(&ag->napi);
netif_carrier_off(dev);
@@ -599,7 +596,7 @@ static int ag71xx_open(struct net_device *dev)
return 0;
err:
err:
ag71xx_rings_cleanup(ag);
return ret;
}
@@ -676,7 +673,7 @@ static netdev_tx_t ag71xx_hard_start_xmit(struct sk_buff *skb,
return NETDEV_TX_OK;
err_drop:
err_drop:
dev->stats.tx_dropped++;
dev_kfree_skb(skb);
@@ -685,7 +682,6 @@ static netdev_tx_t ag71xx_hard_start_xmit(struct sk_buff *skb,
static int ag71xx_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
struct mii_ioctl_data *data = (struct mii_ioctl_data *) &ifr->ifr_data;
struct ag71xx *ag = netdev_priv(dev);
int ret;
@@ -717,7 +713,7 @@ static int ag71xx_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
if (ag->phy_dev == NULL)
break;
return phy_mii_ioctl(ag->phy_dev, data, cmd);
return phy_mii_ioctl(ag->phy_dev, ifr, cmd);
default:
break;
@@ -747,8 +743,13 @@ static void ag71xx_tx_timeout(struct net_device *dev)
static void ag71xx_restart_work_func(struct work_struct *work)
{
struct ag71xx *ag = container_of(work, struct ag71xx, restart_work);
struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag);
ag71xx_stop(ag->dev);
if (pdata->is_ar724x)
ag71xx_hw_init(ag);
ag71xx_open(ag->dev);
}
@@ -909,12 +910,12 @@ static int ag71xx_poll(struct napi_struct *napi, int limit)
return rx_done;
}
more:
more:
DBG("%s: stay in polling mode, rx=%d, tx=%d, limit=%d\n",
dev->name, rx_done, tx_done, limit);
return rx_done;
oom:
oom:
if (netif_msg_rx_err(ag))
printk(KERN_DEBUG "%s: out of memory\n", dev->name);
@@ -991,7 +992,7 @@ static const struct net_device_ops ag71xx_netdev_ops = {
#endif
};
static int __init ag71xx_probe(struct platform_device *pdev)
static int __devinit ag71xx_probe(struct platform_device *pdev)
{
struct net_device *dev;
struct resource *res;
@@ -1058,7 +1059,7 @@ static int __init ag71xx_probe(struct platform_device *pdev)
dev->irq = platform_get_irq(pdev, 0);
err = request_irq(dev->irq, ag71xx_interrupt,
IRQF_DISABLED | IRQF_SAMPLE_RANDOM,
IRQF_DISABLED,
dev->name, dev);
if (err) {
dev_err(&pdev->dev, "unable to request IRQ %d\n", dev->irq);
@@ -1106,24 +1107,24 @@ static int __init ag71xx_probe(struct platform_device *pdev)
return 0;
err_phy_disconnect:
err_phy_disconnect:
ag71xx_phy_disconnect(ag);
err_unregister_netdev:
err_unregister_netdev:
unregister_netdev(dev);
err_free_irq:
err_free_irq:
free_irq(dev->irq, dev);
err_unmap_mii_ctrl:
err_unmap_mii_ctrl:
iounmap(ag->mii_ctrl);
err_unmap_base:
err_unmap_base:
iounmap(ag->mac_base);
err_free_dev:
err_free_dev:
kfree(dev);
err_out:
err_out:
platform_set_drvdata(pdev, NULL);
return err;
}
static int __exit ag71xx_remove(struct platform_device *pdev)
static int __devexit ag71xx_remove(struct platform_device *pdev)
{
struct net_device *dev = platform_get_drvdata(pdev);
@@ -1169,11 +1170,11 @@ static int __init ag71xx_module_init(void)
return 0;
err_mdio_exit:
err_mdio_exit:
ag71xx_mdio_driver_exit();
err_debugfs_exit:
err_debugfs_exit:
ag71xx_debugfs_root_exit();
err_out:
err_out:
return ret;
}