diff options
author | Simon Glass <sjg@chromium.org> | 2015-11-29 13:17:51 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2016-01-12 10:19:09 -0700 |
commit | 9fbdb94667b7316ef2a48fce325ae2da147d7d66 (patch) | |
tree | 76e1d4339fb6cc79660d3f716e00fcd73ed592dc /common/cmd_scsi.c | |
parent | 5c0bf647c4e1659fdeb83a66f56ec27add72b561 (diff) | |
download | u-boot-imx-9fbdb94667b7316ef2a48fce325ae2da147d7d66.zip u-boot-imx-9fbdb94667b7316ef2a48fce325ae2da147d7d66.tar.gz u-boot-imx-9fbdb94667b7316ef2a48fce325ae2da147d7d66.tar.bz2 |
dm: pci: scsi: Use driver-model PCI API
Adjust the SCSI command to use driver model for its PCI interface.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'common/cmd_scsi.c')
-rw-r--r-- | common/cmd_scsi.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index 31c4319..8695408 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -184,7 +184,7 @@ int scsi_get_disk_count(void) #if defined(CONFIG_PCI) && !defined(CONFIG_SCSI_AHCI_PLAT) void scsi_init(void) { - int busdevfunc; + int busdevfunc = -1; int i; /* * Find a device from the list, this driver will support a single @@ -192,9 +192,21 @@ void scsi_init(void) */ for (i = 0; i < ARRAY_SIZE(scsi_device_list); i++) { /* get PCI Device ID */ +#ifdef CONFIG_DM_PCI + struct udevice *dev; + int ret; + + ret = dm_pci_find_device(scsi_device_list[i].vendor, + scsi_device_list[i].device, 0, &dev); + if (!ret) { + busdevfunc = dm_pci_get_bdf(dev); + break; + } +#else busdevfunc = pci_find_device(scsi_device_list[i].vendor, scsi_device_list[i].device, 0); +#endif if (busdevfunc != -1) break; } |