Skip to contentSkip to conversation

dm: pci: Allow PCI bus numbering aliases

PATCH New Simon Glass 1 participant 2 messages May 11, 2015 – May 17, 2015 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm: pci: Allow PCI bus numbering aliases

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.

---

 drivers/pci/pci-uclass.c |  1 +
 test/dm/pci.c            | 11 +++++++++++
 2 files changed, 12 insertions(+)
drivers/pci/pci-uclass.c +1 -0
index d48d865..de87505 100644
@@ -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,
test/dm/pci.c +11 -0
index 6c63fa4..d80ed2d 100644
@@ -21,6 +21,17 @@ static int dm_test_pci_base(struct dm_test_state *dms)
 }
 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 dm_test_state *dms)
+{
+	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 dm_test_state *dms)
 {
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#1 lore raw

PATCH 1/1 dm: pci: Allow PCI bus numbering aliases

Quoted 1 line · Simon Glass

Commit 9cc36a2 'dm: core: Add a flag to control sequence numbering'

changed

Quoted 1 line

the default uclass behaviour to not support bus numbering. This is

incorrect

Quoted 3 lines

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.

Quoted 8 lines

Also add a test for this.

---

drivers/pci/pci-uclass.c | 1 +
test/dm/pci.c | 11 +++++++++++

2 files changed, 12 insertions(+)

Applied to u-boot-dm.