ag71xx_wr(ag, AG71XX_REG_RX_CTRL, 0);
ag71xx_wr(ag, AG71XX_REG_TX_CTRL, 0);
+ /*
+ * give the hardware some time to really stop all rx/tx activity
+ * clearing the descriptors too early causes random memory corruption
+ */
+ mdelay(1);
+
/* clear descriptor addresses */
ag71xx_wr(ag, AG71XX_REG_TX_DESC, 0);
ag71xx_wr(ag, AG71XX_REG_RX_DESC, 0);
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);
return sent;
}
-static void ag71xx_rx_align_skb(struct ag71xx *ag, struct sk_buff *skb, int len)
-{
- int offset = ((unsigned long) skb->data) % 4;
- void *data;
-
- if (offset == 2)
- return;
-
- if (ag->phy_dev && ag->phy_dev->pkt_align != 0)
- return;
-
- if (len > 128)
- return;
-
- if (WARN_ON(skb_headroom(skb) < 2))
- return;
-
- data = skb->data;
- skb->data -= 2;
- memmove(skb->data, data, len);
-}
-
static int ag71xx_rx_packets(struct ag71xx *ag, int limit)
{
struct net_device *dev = ag->dev;
if (ag71xx_has_ar8216(ag))
err = ag71xx_remove_ar8216_header(ag, skb, pktlen);
- ag71xx_rx_align_skb(ag, skb, pktlen);
-
if (err) {
dev->stats.rx_dropped++;
kfree_skb(skb);