summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-11-29 13:18:02 -0700
committerSimon Glass <sjg@chromium.org>2016-01-12 10:19:09 -0700
commitc032241234f726bed72c2f884044c66e1ffde243 (patch)
tree139f80eb41d621a28d09b98f870b64635e1c70b8 /test
parent96350f729c4244bae879c39449ef5d6caf553e62 (diff)
downloadu-boot-imx-c032241234f726bed72c2f884044c66e1ffde243.zip
u-boot-imx-c032241234f726bed72c2f884044c66e1ffde243.tar.gz
u-boot-imx-c032241234f726bed72c2f884044c66e1ffde243.tar.bz2
dm: test: Convert PCI tests to use the DM PCI API
Update these tests to use driver model API functions. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/dm/pci.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/test/dm/pci.c b/test/dm/pci.c
index 3ab4ba8..a5b1290 100644
--- a/test/dm/pci.c
+++ b/test/dm/pci.c
@@ -35,20 +35,17 @@ DM_TEST(dm_test_pci_busnum, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
/* Test that we can use the swapcase device correctly */
static int dm_test_pci_swapcase(struct unit_test_state *uts)
{
- pci_dev_t pci_dev = PCI_BDF(0, 0x1f, 0);
- struct pci_controller *hose;
- struct udevice *bus, *swap;
+ struct udevice *emul, *swap;
ulong io_addr, mem_addr;
char *ptr;
/* Check that asking for the device automatically fires up PCI */
- ut_assertok(uclass_get_device(UCLASS_PCI_EMUL, 0, &swap));
-
- ut_assertok(uclass_get_device(UCLASS_PCI, 0, &bus));
- hose = dev_get_uclass_priv(bus);
+ ut_assertok(uclass_get_device(UCLASS_PCI_EMUL, 0, &emul));
+ ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap));
+ ut_assert(device_active(swap));
/* First test I/O */
- io_addr = pci_read_bar32(hose, pci_dev, 0);
+ io_addr = dm_pci_read_bar32(swap, 0);
outb(2, io_addr);
ut_asserteq(2, inb(io_addr));
@@ -56,7 +53,7 @@ static int dm_test_pci_swapcase(struct unit_test_state *uts)
* Now test memory mapping - note we must unmap and remap to cause
* the swapcase emulation to see our data and response.
*/
- mem_addr = pci_read_bar32(hose, pci_dev, 1);
+ mem_addr = dm_pci_read_bar32(swap, 1);
ptr = map_sysmem(mem_addr, 20);
strcpy(ptr, "This is a TesT");
unmap_sysmem(ptr);