dm: pci: Allow PCI bus numbering aliases
authorSimon Glass <sjg@chromium.org>
Mon, 11 May 2015 03:08:06 +0000 (21:08 -0600)
committerSimon Glass <sjg@chromium.org>
Thu, 4 Jun 2015 09:34:47 +0000 (03:34 -0600)
Commit 9cc36a2 'dm: core: Add a flag to control sequence numbering' changed
the default uclass behaviour to not support bus numbering. This is incorrect
for PCI and that commit should have enabled the flag for PCI.

Enable it so that PCI buses can be found and the 'pci' command works again.
Also add a test for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/pci/pci-uclass.c
test/dm/pci.c

index d48d865bac13ef0728afd08647063b44cb778242..de8750546699e0a66a5d70d9652184d1c5ba448b 100644 (file)
@@ -596,6 +596,7 @@ int pci_bridge_write_config(struct udevice *bus, pci_dev_t devfn, uint offset,
 UCLASS_DRIVER(pci) = {
        .id             = UCLASS_PCI,
        .name           = "pci",
+       .flags          = DM_UC_FLAG_SEQ_ALIAS,
        .post_bind      = pci_uclass_post_bind,
        .pre_probe      = pci_uclass_pre_probe,
        .post_probe     = pci_uclass_post_probe,
index 2f3ae7941b1b405bf1e298beace53dfcb1b6b881..3ab4ba811cf4280462cd3bacd2897fe08bc3a094 100644 (file)
@@ -21,6 +21,17 @@ static int dm_test_pci_base(struct unit_test_state *uts)
 }
 DM_TEST(dm_test_pci_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
 
+/* Test that sandbox PCI bus numbering works correctly */
+static int dm_test_pci_busnum(struct unit_test_state *uts)
+{
+       struct udevice *bus;
+
+       ut_assertok(uclass_get_device_by_seq(UCLASS_PCI, 0, &bus));
+
+       return 0;
+}
+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)
 {