dm: net: Convert rtl8169 to use DM PCI API
[oweals/u-boot.git] / drivers / net / e1000.c
index 7b830ff8c0515a66f763ff4c4270965f39a2e65a..027f2bfd11f7c273f9ebf3aec14872af68e8d218 100644 (file)
@@ -32,6 +32,7 @@ tested on both gig copper and gig fiber boards
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <memalign.h>
 #include <pci.h>
 #include "e1000.h"
 
@@ -5164,11 +5165,11 @@ _e1000_poll(struct e1000_hw *hw)
        inval_end = inval_start + roundup(sizeof(*rd), ARCH_DMA_MINALIGN);
        invalidate_dcache_range(inval_start, inval_end);
 
-       if (!(le32_to_cpu(rd->status)) & E1000_RXD_STAT_DD)
+       if (!(rd->status & E1000_RXD_STAT_DD))
                return 0;
        /* DEBUGOUT("recv: packet len=%d\n", rd->length); */
        /* Packet received, make sure the data are re-loaded from RAM. */
-       len = le32_to_cpu(rd->length);
+       len = le16_to_cpu(rd->length);
        invalidate_dcache_range((unsigned long)packet,
                                (unsigned long)packet +
                                roundup(len, ARCH_DMA_MINALIGN));
@@ -5627,8 +5628,8 @@ static int e1000_eth_probe(struct udevice *dev)
        int ret;
 
        hw->name = dev->name;
-       ret = e1000_init_one(hw, trailing_strtol(dev->name), pci_get_bdf(dev),
-                            plat->enetaddr);
+       ret = e1000_init_one(hw, trailing_strtol(dev->name),
+                            dm_pci_get_bdf(dev), plat->enetaddr);
        if (ret < 0) {
                printf(pr_fmt("failed to initialize card: %d\n"), ret);
                return ret;