ar71xx: ag71xx: Add netpoll support
[openwrt.git] / target / linux / ar71xx / files / drivers / net / ag71xx / ag71xx_main.c
index 3644b2d..8244239 100644 (file)
@@ -415,12 +415,12 @@ static void ag71xx_hw_set_macaddr(struct ag71xx *ag, unsigned char *mac)
 {
        u32 t;
 
-       t = (((u32) mac[0]) << 24) | (((u32) mac[1]) << 16)
-         | (((u32) mac[2]) << 8) | ((u32) mac[3]);
+       t = (((u32) mac[5]) << 24) | (((u32) mac[4]) << 16)
+         | (((u32) mac[3]) << 8) | ((u32) mac[2]);
 
        ag71xx_wr(ag, AG71XX_REG_MAC_ADDR1, t);
 
-       t = (((u32) mac[4]) << 24) | (((u32) mac[5]) << 16);
+       t = (((u32) mac[1]) << 24) | (((u32) mac[0]) << 16);
        ag71xx_wr(ag, AG71XX_REG_MAC_ADDR2, t);
 }
 
@@ -580,15 +580,15 @@ static int ag71xx_stop(struct net_device *dev)
        struct ag71xx *ag = netdev_priv(dev);
        unsigned long flags;
 
+       netif_carrier_off(dev);
+       ag71xx_phy_stop(ag);
+
        spin_lock_irqsave(&ag->lock, flags);
 
        netif_stop_queue(dev);
 
        ag71xx_hw_stop(ag);
 
-       netif_carrier_off(dev);
-       ag71xx_phy_stop(ag);
-
        napi_disable(&ag->napi);
        del_timer_sync(&ag->oom_timer);
 
@@ -926,6 +926,20 @@ static void ag71xx_set_multicast_list(struct net_device *dev)
        /* TODO */
 }
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/*
+ * Polling 'interrupt' - used by things like netconsole to send skbs
+ * without having to re-enable interrupts. It's not called while
+ * the interrupt routine is executing.
+ */
+static void ag71xx_netpoll(struct net_device *dev)
+{
+       disable_irq(dev->irq);
+       ag71xx_interrupt(dev->irq, dev);
+       enable_irq(dev->irq);
+}
+#endif
+
 static const struct net_device_ops ag71xx_netdev_ops = {
        .ndo_open               = ag71xx_open,
        .ndo_stop               = ag71xx_stop,
@@ -936,6 +950,9 @@ static const struct net_device_ops ag71xx_netdev_ops = {
        .ndo_change_mtu         = eth_change_mtu,
        .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller    = ag71xx_netpoll,
+#endif
 };
 
 static int __init ag71xx_probe(struct platform_device *pdev)
This page took 0.031173 seconds and 4 git commands to generate.