dm: core: Add ofnode function to read PCI vendor and device id

We don't have the live-tree version of fdtdec_get_pci_vendev().
This adds the API.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Bin Meng
2018-08-03 01:14:35 -07:00
committed by Simon Glass
parent d494131bc6
commit 7b9cbaddd5
2 changed files with 49 additions and 0 deletions

View File

@@ -585,6 +585,19 @@ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname,
int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type,
const char *propname, struct fdt_pci_addr *addr);
/**
* ofnode_read_pci_vendev() - look up PCI vendor and device id
*
* Look at the compatible property of a device node that represents a PCI
* device and extract pci vendor id and device id from it.
*
* @param node node to examine
* @param vendor vendor id of the pci device
* @param device device id of the pci device
* @return 0 if ok, negative on error
*/
int ofnode_read_pci_vendev(ofnode node, u16 *vendor, u16 *device);
/**
* ofnode_read_addr_cells() - Get the number of address cells for a node
*