dm: pci: Add a function to read a PCI BAR

At present PCI address transaction is not supported so drivers must
manually read the correct BAR after reading the device tree info. The
ns16550 has a suitable implementation, so move this code into the core
DM support.

Note that there is no live-tree equivalent at present.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: correct the unclear comments in test.dts]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Simon Glass
2019-09-15 12:08:58 -06:00
committed by Bin Meng
parent 6a73cf3d8f
commit 33c215af4b
7 changed files with 128 additions and 32 deletions

View File

@@ -307,3 +307,14 @@ int dev_read_alias_highest_id(const char *stem)
return fdtdec_get_alias_highest_id(gd->fdt_blob, stem);
}
fdt_addr_t dev_read_addr_pci(struct udevice *dev)
{
ulong addr;
addr = dev_read_addr(dev);
if (addr == FDT_ADDR_T_NONE && !of_live_active())
addr = devfdt_get_addr_pci(dev);
return addr;
}