]> Git Repo - J-u-boot.git/blobdiff - drivers/net/macb.c
dm: treewide: Rename ofdata_to_platdata() to of_to_plat()
[J-u-boot.git] / drivers / net / macb.c
index 83594253787cefb0736e9e70a558b4338ddd7607..e287c29e69fa170991899576a2d2c611cfc07d46 100644 (file)
@@ -6,6 +6,8 @@
 #include <clk.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <log.h>
+#include <linux/delay.h>
 
 /*
  * The u-boot networking stack is a little weird.  It seems like the
@@ -38,7 +40,7 @@
 
 #include <linux/mii.h>
 #include <asm/io.h>
-#include <asm/dma-mapping.h>
+#include <linux/dma-mapping.h>
 #include <asm/arch/clk.h>
 #include <linux/errno.h>
 
@@ -327,8 +329,6 @@ static int _macb_send(struct macb_device *macb, const char *name, void *packet,
        macb->tx_ring[tx_head].addr = paddr;
        barrier();
        macb_flush_ring_desc(macb, TX);
-       /* Do we need check paddr and length is dcache line aligned? */
-       flush_dcache_range(paddr, paddr + ALIGN(length, ARCH_DMA_MINALIGN));
        macb_writel(macb, NCR, MACB_BIT(TE) | MACB_BIT(RE) | MACB_BIT(TSTART));
 
        /*
@@ -344,7 +344,7 @@ static int _macb_send(struct macb_device *macb, const char *name, void *packet,
                udelay(1);
        }
 
-       dma_unmap_single(packet, length, paddr);
+       dma_unmap_single(paddr, length, DMA_TO_DEVICE);
 
        if (i <= MACB_TX_TIMEOUT) {
                if (ctrl & MACB_BIT(TX_UNDERRUN))
@@ -809,7 +809,7 @@ static int _macb_init(struct macb_device *macb, const char *name)
        macb->next_rx_tail = 0;
 
 #ifdef CONFIG_MACB_ZYNQ
-       macb_writel(macb, DMACFG, MACB_ZYNQ_GEM_DMACR_INIT);
+       gem_writel(macb, DMACFG, MACB_ZYNQ_GEM_DMACR_INIT);
 #endif
 
        macb_writel(macb, RBQP, macb->rx_ring_dma);
@@ -1056,7 +1056,7 @@ static int macb_recv(struct eth_device *netdev)
        }
 }
 
-static int macb_init(struct eth_device *netdev, bd_t *bd)
+static int macb_init(struct eth_device *netdev, struct bd_info *bd)
 {
        struct macb_device *macb = to_macb(netdev);
 
@@ -1169,7 +1169,7 @@ static void macb_stop(struct udevice *dev)
 
 static int macb_write_hwaddr(struct udevice *dev)
 {
-       struct eth_pdata *plat = dev_get_platdata(dev);
+       struct eth_pdata *plat = dev_get_plat(dev);
        struct macb_device *macb = dev_get_priv(dev);
 
        return _macb_write_hwaddr(macb, plat->enetaddr);
@@ -1222,7 +1222,7 @@ static const struct macb_config default_gem_config = {
 
 static int macb_eth_probe(struct udevice *dev)
 {
-       struct eth_pdata *pdata = dev_get_platdata(dev);
+       struct eth_pdata *pdata = dev_get_plat(dev);
        struct macb_device *macb = dev_get_priv(dev);
        const char *phy_mode;
        int ret;
@@ -1283,25 +1283,25 @@ static int macb_eth_remove(struct udevice *dev)
 }
 
 /**
- * macb_late_eth_ofdata_to_platdata
+ * macb_late_eth_of_to_plat
  * @dev:       udevice struct
  * Returns 0 when operation success and negative errno number
  * when operation failed.
  */
-int __weak macb_late_eth_ofdata_to_platdata(struct udevice *dev)
+int __weak macb_late_eth_of_to_plat(struct udevice *dev)
 {
        return 0;
 }
 
-static int macb_eth_ofdata_to_platdata(struct udevice *dev)
+static int macb_eth_of_to_plat(struct udevice *dev)
 {
-       struct eth_pdata *pdata = dev_get_platdata(dev);
+       struct eth_pdata *pdata = dev_get_plat(dev);
 
        pdata->iobase = (phys_addr_t)dev_remap_addr(dev);
        if (!pdata->iobase)
                return -EINVAL;
 
-       return macb_late_eth_ofdata_to_platdata(dev);
+       return macb_late_eth_of_to_plat(dev);
 }
 
 static const struct macb_config sama5d4_config = {
@@ -1331,12 +1331,12 @@ U_BOOT_DRIVER(eth_macb) = {
        .name   = "eth_macb",
        .id     = UCLASS_ETH,
        .of_match = macb_eth_ids,
-       .ofdata_to_platdata = macb_eth_ofdata_to_platdata,
+       .of_to_plat = macb_eth_of_to_plat,
        .probe  = macb_eth_probe,
        .remove = macb_eth_remove,
        .ops    = &macb_eth_ops,
-       .priv_auto_alloc_size = sizeof(struct macb_device),
-       .platdata_auto_alloc_size = sizeof(struct eth_pdata),
+       .priv_auto      = sizeof(struct macb_device),
+       .plat_auto      = sizeof(struct eth_pdata),
 };
 #endif
 
This page took 0.025048 seconds and 4 git commands to generate.