drivers: eth_e1000: use device MMIO

The ethernet driver no longer continues to try to initialize
itself if PCIe probing fails.

This device is always PCIe so we don't need to reserve ROM MMIO
storage.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2020-06-26 12:03:17 -07:00 committed by Carles Cufí
parent a810c7b5a0
commit d15a531197
2 changed files with 15 additions and 9 deletions

View file

@ -216,17 +216,23 @@ int e1000_probe(struct device *device)
{
const pcie_bdf_t bdf = PCIE_BDF(0, 3, 0);
struct e1000_dev *dev = device->driver_data;
int retval = -ENODEV;
uint32_t ral, rah;
uintptr_t phys_addr;
size_t size;
if (pcie_probe(bdf, PCIE_ID(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_I82540EM))) {
dev->address = pcie_get_mbar(bdf, 0);
pcie_set_cmd(bdf, PCIE_CONF_CMDSTAT_MEM |
PCIE_CONF_CMDSTAT_MASTER, true);
retval = 0;
if (!pcie_probe(bdf, PCIE_ID(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_I82540EM))) {
return -ENODEV;
}
phys_addr = pcie_get_mbar(bdf, 0);
pcie_set_cmd(bdf, PCIE_CONF_CMDSTAT_MEM |
PCIE_CONF_CMDSTAT_MASTER, true);
size = KB(128); /* TODO: get from PCIe */
device_map(&dev->address, phys_addr, size,
K_MEM_CACHE_NONE);
/* Setup TX descriptor */
iow32(dev, TDBAL, (uint32_t) &dev->tx);
@ -258,7 +264,7 @@ int e1000_probe(struct device *device)
memcpy(dev->mac, &ral, 4);
memcpy(dev->mac + 4, &rah, 2);
return retval;
return 0;
}
static void e1000_iface_init(struct net_if *iface)

View file

@ -77,7 +77,7 @@ struct e1000_rx {
struct e1000_dev {
volatile struct e1000_tx tx __aligned(16);
volatile struct e1000_rx rx __aligned(16);
uint32_t address;
mm_reg_t address;
/* If VLAN is enabled, there can be multiple VLAN interfaces related to
* this physical device. In that case, this iface pointer value is not
* really used for anything.