
Hi Simon,
On Fri, Jul 27, 2018 at 11:51 AM, Bin Meng bmeng.cn@gmail.com wrote:
Hi Simon,
On Fri, Jul 27, 2018 at 8:35 AM, Simon Glass sjg@chromium.org wrote:
On 25 July 2018 at 03:39, Bin Meng bmeng.cn@gmail.com wrote:
The correct driver data comes from the matching 'id' instead of 'find_id' in pci_find_and_bind_driver().
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/pci/pci-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org
Perhaps the pci test should be updated to check this.
I looked at this and found out that the test to pci_bind_bus_devices(), the API that calls pci_find_and_bind_driver(), cannot be done due to a chicken and egg issue. pci_find_and_bind_driver() will only get called if no PCI device is explicitly declared in the device tree, however:
- without a emulation device (eg: "sandbox,swap-case") in the device
tree, the emulation device won't be probed, hence pci_config_read() to the emulation device returns nothing
- without a vendor id & device id from pci_config_read() results,
pci_find_and_bind_driver() won't work.
Do you have better ideas?
Looks I figured out a way. I will send v2 to include test cases.
Regards, Bin