diff options
author | Paul Burton <paul.burton@imgtec.com> | 2016-09-08 06:47:33 (GMT) |
---|---|---|
committer | Daniel Schwierzeck <daniel.schwierzeck@gmail.com> | 2016-09-21 13:04:32 (GMT) |
commit | 154bf12f78c012895e7b42f844b7b92c4f015509 (patch) | |
tree | 85c3dfca8995bbadf2902f07fc9433ce74520879 | |
parent | 65f62b1ca12050c4e3b3e5ed641447918f4c4b7b (diff) | |
download | u-boot-154bf12f78c012895e7b42f844b7b92c4f015509.tar.xz |
net: pch_gbe: Use dm_pci_map_bar to discover MMIO base
Reading the PCI BAR & converting the result to a physical address is not
safe across all architectures. For example on MIPS the virtual:physical
mapping is not 1:1, so we cannot directly make use of the physical
address.
Use the more generic BAR-mapping function dm_pci_map_bar to discover the
MMIO base address, which should work across architectures.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
-rw-r--r-- | drivers/net/pch_gbe.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/net/pch_gbe.c b/drivers/net/pch_gbe.c index 137818b..2d0a700 100644 --- a/drivers/net/pch_gbe.c +++ b/drivers/net/pch_gbe.c @@ -421,7 +421,7 @@ int pch_gbe_probe(struct udevice *dev) { struct pch_gbe_priv *priv; struct eth_pdata *plat = dev_get_platdata(dev); - u32 iobase; + void *iobase; /* * The priv structure contains the descriptors and frame buffers which @@ -432,11 +432,9 @@ int pch_gbe_probe(struct udevice *dev) priv->dev = dev; - dm_pci_read_config32(dev, PCI_BASE_ADDRESS_1, &iobase); - iobase &= PCI_BASE_ADDRESS_MEM_MASK; - iobase = dm_pci_mem_to_phys(dev, iobase); + iobase = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_1, PCI_REGION_MEM); - plat->iobase = iobase; + plat->iobase = (ulong)iobase; priv->mac_regs = (struct pch_gbe_regs *)iobase; /* Read MAC address from SROM and initialize dev->enetaddr with it */ |