[ar71xx] ag71xx: introduce SoC specific fuctions for DDR flush and PLL setup
[openwrt.git] / target / linux / ar71xx / files / drivers / net / ag71xx / ag71xx_main.c
index 6b10791..3d60a8b 100644 (file)
@@ -47,7 +47,7 @@ static void ag71xx_dump_regs(struct ag71xx *ag)
                ag71xx_rr(ag, AG71XX_REG_FIFO_CFG0),
                ag71xx_rr(ag, AG71XX_REG_FIFO_CFG1),
                ag71xx_rr(ag, AG71XX_REG_FIFO_CFG2));
-       DBG("%s: fifo_cfg3=%08x, fifo_cfg3=%08x, fifo_cfg5=%08x\n",
+       DBG("%s: fifo_cfg3=%08x, fifo_cfg4=%08x, fifo_cfg5=%08x\n",
                ag->dev->name,
                ag71xx_rr(ag, AG71XX_REG_FIFO_CFG3),
                ag71xx_rr(ag, AG71XX_REG_FIFO_CFG4),
@@ -85,7 +85,7 @@ static int ag71xx_ring_alloc(struct ag71xx_ring *ring, unsigned int size)
 
        return 0;
 
-err:
+ err:
        return err;
 }
 
@@ -268,6 +268,8 @@ static void ag71xx_hw_set_macaddr(struct ag71xx *ag, unsigned char *mac)
 #define MAC_CFG1_INIT  (MAC_CFG1_RXE | MAC_CFG1_TXE | MAC_CFG1_SRX \
                        | MAC_CFG1_STX)
 
+#define FIFO_CFG0_INIT (FIFO_CFG0_ALL << FIFO_CFG0_ENABLE_SHIFT)
+
 static void ag71xx_hw_init(struct ag71xx *ag)
 {
        struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag);
@@ -287,7 +289,7 @@ static void ag71xx_hw_init(struct ag71xx *ag)
        ag71xx_sb(ag, AG71XX_REG_MAC_CFG2,
                  MAC_CFG2_PAD_CRC_EN | MAC_CFG2_LEN_CHECK);
 
-       ag71xx_wr(ag, AG71XX_REG_FIFO_CFG0, 0x00001f00);
+       ag71xx_wr(ag, AG71XX_REG_FIFO_CFG0, FIFO_CFG0_INIT);
 
        ag71xx_mii_ctrl_set_if(ag, pdata->mii_if);
 
@@ -341,7 +343,7 @@ static int ag71xx_open(struct net_device *dev)
 
        return 0;
 
-err:
+ err:
        ag71xx_rings_cleanup(ag);
        return ret;
 }
@@ -382,7 +384,7 @@ static int ag71xx_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
        desc = &ring->descs[i];
 
        spin_lock_irqsave(&ag->lock, flags);
-       ar71xx_ddr_flush(pdata->flush_reg);
+       pdata->ddr_flush();
        spin_unlock_irqrestore(&ag->lock, flags);
 
        if (!ag71xx_desc_empty(desc))
@@ -419,7 +421,7 @@ static int ag71xx_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        return 0;
 
-err_drop:
+ err_drop:
        dev->stats.tx_dropped++;
 
        dev_kfree_skb(skb);
@@ -478,7 +480,7 @@ static void ag71xx_tx_packets(struct ag71xx *ag)
        DBG("%s: processing TX ring\n", ag->dev->name);
 
 #ifdef AG71XX_NAPI_TX
-       ar71xx_ddr_flush(pdata->flush_reg);
+       pdata->ddr_flush();
 #endif
 
        sent = 0;
@@ -521,7 +523,7 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit)
 
 #ifndef AG71XX_NAPI_TX
        spin_lock_irqsave(&ag->lock, flags);
-       ar71xx_ddr_flush(pdata->flush_reg);
+       pdata->ddr_flush();
        spin_unlock_irqrestore(&ag->lock, flags);
 #endif
 
@@ -590,7 +592,7 @@ static int ag71xx_poll(struct napi_struct *napi, int limit)
        int done;
 
 #ifdef AG71XX_NAPI_TX
-       ar71xx_ddr_flush(pdata->flush_reg);
+       pdata->ddr_flush();
        ag71xx_tx_packets(ag);
 #endif
 
@@ -812,19 +814,19 @@ static int __init ag71xx_probe(struct platform_device *pdev)
 
        return 0;
 
-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_base2:
+ err_unmap_base2:
        iounmap(ag->mac_base2);
-err_unmap_base1:
+ err_unmap_base1:
        iounmap(ag->mac_base);
-err_free_dev:
+ err_free_dev:
        kfree(dev);
-err_out:
+ err_out:
        platform_set_drvdata(pdev, NULL);
        return err;
 }
@@ -871,9 +873,9 @@ static int __init ag71xx_module_init(void)
 
        return 0;
 
-err_mdio_exit:
+ err_mdio_exit:
        ag71xx_mdio_driver_exit();
-err_out:
+ err_out:
        return ret;
 }
 
This page took 0.028594 seconds and 4 git commands to generate.