Skip to contentSkip to conversation

pci: Support parsing PCI controller DT subnodes

PATCH Superseded Marek Vasut 4 participants 34 messages Aug 24, 2018 – Sep 26, 2018 PCI

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

The PCI controller can have DT subnodes describing extra properties of particular PCI devices, ie. a PHY attached to an EHCI controller on a PCI bus. This patch parses those DT subnodes and assigns a node to the PCI device instance, so that the driver can extract details from that node and ie. configure the PHY using the PHY subsystem.

---
V2: Move the whole machinery to pci_bind_bus_devices(), right after
the driver instance platform data are updated. This reduces the number of times the DT is traversed and works for both DT nodes with and without compat string.

---
 drivers/pci/pci-uclass.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/pci/pci-uclass.c +15 -0
index e9671d9b76..cf3e38a6f2 100644
@@ -733,6 +733,7 @@ int pci_bind_bus_devices(struct udevice *bus)
 	ulong vendor, device;
 	ulong header_type;
 	pci_dev_t bdf, end;
+	ofnode node;
 	bool found_multi;
 	int ret;
 
@@ -803,6 +804,20 @@ int pci_bind_bus_devices(struct udevice *bus)
 		pplat->vendor = vendor;
 		pplat->device = device;
 		pplat->class = class;
+
+		/* Associate potention OF node */
+		dev_for_each_subnode(node, bus) {
+			phys_addr_t df, size;
+			df = ofnode_get_addr_size(node, "reg", &size);
+			if (df == FDT_ADDR_T_NONE)
+				continue;
+
+			if (PCI_FUNC(df) == PCI_FUNC(bdf) &&
+			    PCI_DEV(df) == PCI_DEV(bdf)) {
+				dev->node = node;
+				break;
+			}
+		}
 	}
 
 	return 0;
Signature · 1 line
2.16.2
#1 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Quoted 9 lines · Marek Vasut

The PCI controller can have DT subnodes describing extra properties of particular PCI devices, ie. a PHY attached to an EHCI controller on a PCI bus. This patch parses those DT subnodes and assigns a node to the PCI device instance, so that the driver can extract details from that node and ie. configure the PHY using the PHY subsystem.

Well, bump ?

This is the only missing patch to get my hardware working properly.

Quoted 43 lines

---
V2: Move the whole machinery to pci_bind_bus_devices(), right after
the driver instance platform data are updated. This reduces the number of times the DT is traversed and works for both DT nodes with and without compat string.

---
 drivers/pci/pci-uclass.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/pci/pci-uclass.c +15 -0
index e9671d9b76..cf3e38a6f2 100644
@@ -733,6 +733,7 @@ int pci_bind_bus_devices(struct udevice *bus)
 	ulong vendor, device;
 	ulong header_type;
 	pci_dev_t bdf, end;
+	ofnode node;
 	bool found_multi;
 	int ret;
 
@@ -803,6 +804,20 @@ int pci_bind_bus_devices(struct udevice *bus)
 		pplat->vendor = vendor;
 		pplat->device = device;
 		pplat->class = class;
+
+		/* Associate potention OF node */
+		dev_for_each_subnode(node, bus) {
+			phys_addr_t df, size;
+			df = ofnode_get_addr_size(node, "reg", &size);
+			if (df == FDT_ADDR_T_NONE)
+				continue;
+
+			if (PCI_FUNC(df) == PCI_FUNC(bdf) &&
+			    PCI_DEV(df) == PCI_DEV(bdf)) {
+				dev->node = node;
+				break;
+			}
+		}
 	}
 
 	return 0;
Signature · 2 lines
Best regards,
Marek Vasut
#2 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

+Simon

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 6 lines · Marek Vasut

The PCI controller can have DT subnodes describing extra properties of particular PCI devices, ie. a PHY attached to an EHCI controller on a PCI bus. This patch parses those DT subnodes and assigns a node to the PCI device instance, so that the driver can extract details from that node and ie. configure the PHY using the PHY subsystem.

Quoted 7 lines
Quoted 3 lines

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a long email that pointed out what Linux does seems like a 'fallback' to find a node with no compatible string.

Back to this, if we have to go with this way, please create a test case to cover this scenario.

Regards,
Bin

#3 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Quoted 19 lines · Bin Meng

+Simon

Hi Marek,

Quoted 14 lines · Marek Vasut
Quoted 9 lines · Marek Vasut

The PCI controller can have DT subnodes describing extra properties of particular PCI devices, ie. a PHY attached to an EHCI controller on a PCI bus. This patch parses those DT subnodes and assigns a node to the PCI device instance, so that the driver can extract details from that node and ie. configure the PHY using the PHY subsystem.

Well, bump ?

Quoted 8 lines
Quoted 1 line

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a long email that pointed out what Linux does seems like a 'fallback' to find a node with no compatible string.

Back to this, if we have to go with this way, please create a test case to cover this scenario.

The fact that it works on a particular board is not tested enough? Do we need a custom, special, synthetic test ?

Anyway, any feedback on the patch ? Did you test it ? I again only see "do this random stuff and that random stuff" , but zero actual feedback.

Signature · 2 lines
Best regards,
Marek Vasut
#4 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Quoted 26 lines · Marek Vasut
Quoted 25 lines · Bin Meng

+Simon

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 6 lines · Marek Vasut

The PCI controller can have DT subnodes describing extra properties of particular PCI devices, ie. a PHY attached to an EHCI controller on a PCI bus. This patch parses those DT subnodes and assigns a node to the PCI device instance, so that the driver can extract details from that node and ie. configure the PHY using the PHY subsystem.

Quoted 7 lines
Quoted 3 lines

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a long email that pointed out what Linux does seems like a 'fallback' to find a node with no compatible string.

Quoted 5 lines
Quoted 2 lines

Back to this, if we have to go with this way, please create a test case to cover this scenario.

The fact that it works on a particular board is not tested enough? Do we need a custom, special, synthetic test ?

I agree that we should include test coverage for this case in some automated fashion, so that nobody breaks support for it by accident.

What's the easiest way to get us there?

Quoted 2 lines

Anyway, any feedback on the patch ? Did you test it ? I again only see "do this random stuff and that random stuff" , but zero actual feedback.

I think "potention" is a typo in your patch. Apart from that the logic feels very sound to me though. It's perfectly valid in DT to refer to subdevices by reg only.

Alex

#5 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

In reply to Marek Vasut

Hi Marek,

Quoted 27 lines · Marek Vasut
Quoted 25 lines · Bin Meng

+Simon

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 6 lines · Marek Vasut

The PCI controller can have DT subnodes describing extra properties of particular PCI devices, ie. a PHY attached to an EHCI controller on a PCI bus. This patch parses those DT subnodes and assigns a node to the PCI device instance, so that the driver can extract details from that node and ie. configure the PHY using the PHY subsystem.

Quoted 7 lines
Quoted 3 lines

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a long email that pointed out what Linux does seems like a 'fallback' to find a node with no compatible string.

Quoted 6 lines
Quoted 2 lines

Back to this, if we have to go with this way, please create a test case to cover this scenario.

The fact that it works on a particular board is not tested enough? Do we need a custom, special, synthetic test ?

I believe that's always been the requirement against the DM code changes. I was requested in the past when I changed something in the DM and I see other people were asked to do so. Like Alex said, it does not mean this patch was not tested enough, but to ensure future commits won't break this.

Quoted 3 lines

Anyway, any feedback on the patch ? Did you test it ? I again only see "do this random stuff and that random stuff" , but zero actual feedback.

If "this and that random stuff" means test case I asked for, please check my proposal on the v1 patch thread which indicated that a proper test case should be created. You seems to have missed that.

Regards,
Bin

#6 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Quoted 37 lines · Bin Meng

Hi Marek,

Quoted 27 lines · Marek Vasut
Quoted 25 lines · Bin Meng

+Simon

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 6 lines · Marek Vasut

The PCI controller can have DT subnodes describing extra properties of particular PCI devices, ie. a PHY attached to an EHCI controller on a PCI bus. This patch parses those DT subnodes and assigns a node to the PCI device instance, so that the driver can extract details from that node and ie. configure the PHY using the PHY subsystem.

Quoted 7 lines
Quoted 3 lines

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a long email that pointed out what Linux does seems like a 'fallback' to find a node with no compatible string.

Quoted 6 lines
Quoted 2 lines

Back to this, if we have to go with this way, please create a test case to cover this scenario.

The fact that it works on a particular board is not tested enough? Do we need a custom, special, synthetic test ?

Quoted 5 lines

I believe that's always been the requirement against the DM code changes. I was requested in the past when I changed something in the DM and I see other people were asked to do so. Like Alex said, it does not mean this patch was not tested enough, but to ensure future commits won't break this.

So, do you have any suggestion how to implement this test ? It seems Alex posed the same question. It doesn't seem to be trivial in the context of sandbox.

Quoted 7 lines
Quoted 3 lines

Anyway, any feedback on the patch ? Did you test it ? I again only see "do this random stuff and that random stuff" , but zero actual feedback.

If "this and that random stuff" means test case I asked for, please check my proposal on the v1 patch thread which indicated that a proper test case should be created. You seems to have missed that.

So, any feedback on this actual patch ?

Signature · 2 lines
Best regards,
Marek Vasut
#7 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Hi Marek,

Quoted 44 lines · Marek Vasut
Quoted 37 lines · Bin Meng

Hi Marek,

Quoted 27 lines · Marek Vasut
Quoted 25 lines · Bin Meng

+Simon

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 6 lines · Marek Vasut

The PCI controller can have DT subnodes describing extra properties of particular PCI devices, ie. a PHY attached to an EHCI controller on a PCI bus. This patch parses those DT subnodes and assigns a node to the PCI device instance, so that the driver can extract details from that node and ie. configure the PHY using the PHY subsystem.

Quoted 7 lines
Quoted 3 lines

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a long email that pointed out what Linux does seems like a 'fallback' to find a node with no compatible string.

Quoted 6 lines
Quoted 2 lines

Back to this, if we have to go with this way, please create a test case to cover this scenario.

The fact that it works on a particular board is not tested enough? Do we need a custom, special, synthetic test ?

Quoted 5 lines

I believe that's always been the requirement against the DM code changes. I was requested in the past when I changed something in the DM and I see other people were asked to do so. Like Alex said, it does not mean this patch was not tested enough, but to ensure future commits won't break this.

Quoted 3 lines

So, do you have any suggestion how to implement this test ? It seems Alex posed the same question. It doesn't seem to be trivial in the context of sandbox.

I suppose you need a PCI_DEVICE() declaration for sandbox, with an associated DT node and no compatible string. Then check that you can locate the device and that it read a DT property correctly.

Quoted 10 lines
Quoted 8 lines
Quoted 4 lines

Anyway, any feedback on the patch ? Did you test it ? I again only see "do this random stuff and that random stuff" , but zero actual feedback.

If "this and that random stuff" means test case I asked for, please check my proposal on the v1 patch thread which indicated that a proper test case should be created. You seems to have missed that.

So, any feedback on this actual patch ?

What is 'potention'?

Is there any check needed that it does not attach the same DT node to two different devices? Or perhaps that cannot happen, since we shouldn't expect two nodes to share a BDF?

I think it looks OK, assuming this is the way we want to go.

Regards,
Simon

#8 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Quoted 47 lines · Simon Glass

Hi Marek,

Quoted 44 lines · Marek Vasut
Quoted 42 lines · Bin Meng

Hi Marek,

Quoted 27 lines · Marek Vasut
Quoted 25 lines · Bin Meng

+Simon

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 6 lines · Marek Vasut

The PCI controller can have DT subnodes describing extra properties of particular PCI devices, ie. a PHY attached to an EHCI controller on a PCI bus. This patch parses those DT subnodes and assigns a node to the PCI device instance, so that the driver can extract details from that node and ie. configure the PHY using the PHY subsystem.

Quoted 7 lines
Quoted 3 lines

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a long email that pointed out what Linux does seems like a 'fallback' to find a node with no compatible string.

Quoted 6 lines
Quoted 2 lines

Back to this, if we have to go with this way, please create a test case to cover this scenario.

The fact that it works on a particular board is not tested enough? Do we need a custom, special, synthetic test ?

I believe that's always been the requirement against the DM code changes. I was requested in the past when I changed something in the DM and I see other people were asked to do so. Like Alex said, it does not mean this patch was not tested enough, but to ensure future commits won't break this.

Quoted 7 lines
Quoted 3 lines

So, do you have any suggestion how to implement this test ? It seems Alex posed the same question. It doesn't seem to be trivial in the context of sandbox.

I suppose you need a PCI_DEVICE() declaration for sandbox, with an associated DT node and no compatible string. Then check that you can locate the device and that it read a DT property correctly.

Is there any example of this stuff already ?

Quoted 11 lines
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines

Anyway, any feedback on the patch ? Did you test it ? I again only see "do this random stuff and that random stuff" , but zero actual feedback.

If "this and that random stuff" means test case I asked for, please check my proposal on the v1 patch thread which indicated that a proper test case should be created. You seems to have missed that.

So, any feedback on this actual patch ?

What is 'potention'?

potential typo .

Quoted 3 lines

Is there any check needed that it does not attach the same DT node to two different devices? Or perhaps that cannot happen, since we shouldn't expect two nodes to share a BDF?

I guess it could happen and I didn't find a good solution to this even in Linux. The current take on this possibility seems to be "let's live with it".

Quoted 5 lines

I think it looks OK, assuming this is the way we want to go.

Regards,
Simon

Signature · 2 lines
Best regards,
Marek Vasut
#9 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Hi Marek,

Quoted 53 lines · Marek Vasut
Quoted 51 lines · Simon Glass

Hi Marek,

Quoted 47 lines · Marek Vasut
Quoted 37 lines · Bin Meng

Hi Marek,

Quoted 27 lines · Marek Vasut
Quoted 25 lines · Bin Meng

+Simon

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 6 lines · Marek Vasut

The PCI controller can have DT subnodes describing extra properties of particular PCI devices, ie. a PHY attached to an EHCI controller on a PCI bus. This patch parses those DT subnodes and assigns a node to the PCI device instance, so that the driver can extract details from that node and ie. configure the PHY using the PHY subsystem.

Quoted 7 lines
Quoted 3 lines

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a long email that pointed out what Linux does seems like a 'fallback' to find a node with no compatible string.

Quoted 6 lines
Quoted 2 lines

Back to this, if we have to go with this way, please create a test case to cover this scenario.

The fact that it works on a particular board is not tested enough? Do we need a custom, special, synthetic test ?

Quoted 5 lines

I believe that's always been the requirement against the DM code changes. I was requested in the past when I changed something in the DM and I see other people were asked to do so. Like Alex said, it does not mean this patch was not tested enough, but to ensure future commits won't break this.

So, do you have any suggestion how to implement this test ? It seems Alex posed the same question. It doesn't seem to be trivial in the context of sandbox.

Quoted 5 lines
Quoted 3 lines

I suppose you need a PCI_DEVICE() declaration for sandbox, with an associated DT node and no compatible string. Then check that you can locate the device and that it read a DT property correctly.

Is there any example of this stuff already ?

See the bottom of swap_case.c. You might be able to add a new one of those,

If you look at pci-controller2 in test.dts it has a device with a compatible string. You could try adding a second device with no compatible string.

Quoted 15 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

Anyway, any feedback on the patch ? Did you test it ? I again only see "do this random stuff and that random stuff" , but zero actual feedback.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

If "this and that random stuff" means test case I asked for, please check my proposal on the v1 patch thread which indicated that a proper test case should be created. You seems to have missed that.

So, any feedback on this actual patch ?

What is 'potention'?

potential typo .

Quoted 7 lines
Quoted 3 lines

Is there any check needed that it does not attach the same DT node to two different devices? Or perhaps that cannot happen, since we shouldn't expect two nodes to share a BDF?

I guess it could happen and I didn't find a good solution to this even in Linux. The current take on this possibility seems to be "let's live with it".

OK.

Quoted 11 lines
Quoted 6 lines

I think it looks OK, assuming this is the way we want to go.

Regards,
Simon

--
Best regards,
Marek Vasut

Regards,
Simon

#10 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 58 lines · Marek Vasut
Quoted 57 lines · Simon Glass
Quoted 54 lines

Hi Marek,

Quoted 44 lines · Marek Vasut
Quoted 37 lines · Bin Meng

Hi Marek,

Quoted 27 lines · Marek Vasut
Quoted 25 lines · Bin Meng

+Simon

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 6 lines · Marek Vasut

The PCI controller can have DT subnodes describing extra properties of particular PCI devices, ie. a PHY attached to an EHCI controller on a PCI bus. This patch parses those DT subnodes and assigns a node to the PCI device instance, so that the driver can extract details from that node and ie. configure the PHY using the PHY subsystem.

Quoted 7 lines
Quoted 3 lines

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a long email that pointed out what Linux does seems like a 'fallback' to find a node with no compatible string.

Quoted 6 lines
Quoted 2 lines

Back to this, if we have to go with this way, please create a test case to cover this scenario.

The fact that it works on a particular board is not tested enough? Do we need a custom, special, synthetic test ?

Quoted 5 lines

I believe that's always been the requirement against the DM code changes. I was requested in the past when I changed something in the DM and I see other people were asked to do so. Like Alex said, it does not mean this patch was not tested enough, but to ensure future commits won't break this.

Quoted 3 lines

So, do you have any suggestion how to implement this test ? It seems Alex posed the same question. It doesn't seem to be trivial in the context of sandbox.

I suppose you need a PCI_DEVICE() declaration for sandbox, with an associated DT node and no compatible string. Then check that you can locate the device and that it read a DT property correctly.

Quoted 7 lines
Quoted 1 line

Is there any example of this stuff already ?

See the bottom of swap_case.c. You might be able to add a new one of those,

If you look at pci-controller2 in test.dts it has a device with a compatible string. You could try adding a second device with no compatible string.

And how does that test anything ?

Signature · 2 lines
Best regards,
Marek Vasut
#11 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Hi Marek,

Quoted 66 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 60 lines · Marek Vasut
Quoted 58 lines · Simon Glass
Quoted 47 lines

Hi Marek,

Quoted 44 lines · Marek Vasut
Quoted 42 lines · Bin Meng

Hi Marek,

Quoted 27 lines · Marek Vasut
Quoted 25 lines · Bin Meng

+Simon

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 6 lines · Marek Vasut

The PCI controller can have DT subnodes describing extra properties of particular PCI devices, ie. a PHY attached to an EHCI controller on a PCI bus. This patch parses those DT subnodes and assigns a node to the PCI device instance, so that the driver can extract details from that node and ie. configure the PHY using the PHY subsystem.

Quoted 7 lines
Quoted 3 lines

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a long email that pointed out what Linux does seems like a 'fallback' to find a node with no compatible string.

Quoted 6 lines
Quoted 2 lines

Back to this, if we have to go with this way, please create a test case to cover this scenario.

The fact that it works on a particular board is not tested enough? Do we need a custom, special, synthetic test ?

I believe that's always been the requirement against the DM code changes. I was requested in the past when I changed something in the DM and I see other people were asked to do so. Like Alex said, it does not mean this patch was not tested enough, but to ensure future commits won't break this.

Quoted 7 lines
Quoted 3 lines

So, do you have any suggestion how to implement this test ? It seems Alex posed the same question. It doesn't seem to be trivial in the context of sandbox.

I suppose you need a PCI_DEVICE() declaration for sandbox, with an associated DT node and no compatible string. Then check that you can locate the device and that it read a DT property correctly.

Is there any example of this stuff already ?

Quoted 7 lines
Quoted 5 lines

See the bottom of swap_case.c. You might be able to add a new one of those,

If you look at pci-controller2 in test.dts it has a device with a compatible string. You could try adding a second device with no compatible string.

And how does that test anything ?

You can test that your code actually attaches the DT node to the probed device. Without you code the test would fail. Wit it, it would pass.

Regards,
Simon

#12 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Quoted 75 lines · Simon Glass

Hi Marek,

Quoted 72 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 65 lines · Marek Vasut
Quoted 53 lines · Simon Glass
Quoted 51 lines

Hi Marek,

Quoted 47 lines · Marek Vasut
Quoted 37 lines · Bin Meng

Hi Marek,

Quoted 27 lines · Marek Vasut
Quoted 25 lines · Bin Meng

+Simon

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 6 lines · Marek Vasut

The PCI controller can have DT subnodes describing extra properties of particular PCI devices, ie. a PHY attached to an EHCI controller on a PCI bus. This patch parses those DT subnodes and assigns a node to the PCI device instance, so that the driver can extract details from that node and ie. configure the PHY using the PHY subsystem.

Quoted 7 lines
Quoted 3 lines

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a long email that pointed out what Linux does seems like a 'fallback' to find a node with no compatible string.

Quoted 6 lines
Quoted 2 lines

Back to this, if we have to go with this way, please create a test case to cover this scenario.

The fact that it works on a particular board is not tested enough? Do we need a custom, special, synthetic test ?

Quoted 5 lines

I believe that's always been the requirement against the DM code changes. I was requested in the past when I changed something in the DM and I see other people were asked to do so. Like Alex said, it does not mean this patch was not tested enough, but to ensure future commits won't break this.

So, do you have any suggestion how to implement this test ? It seems Alex posed the same question. It doesn't seem to be trivial in the context of sandbox.

Quoted 5 lines
Quoted 3 lines

I suppose you need a PCI_DEVICE() declaration for sandbox, with an associated DT node and no compatible string. Then check that you can locate the device and that it read a DT property correctly.

Is there any example of this stuff already ?

See the bottom of swap_case.c. You might be able to add a new one of those,

If you look at pci-controller2 in test.dts it has a device with a compatible string. You could try adding a second device with no compatible string.

Quoted 5 lines
Quoted 1 line

And how does that test anything ?

You can test that your code actually attaches the DT node to the probed device. Without you code the test would fail. Wit it, it would pass.

Well it won't, because the sandbox swap_case.c requires the compatible. This all seems like a big hack to support virtual PCI devices.

The driver binds with a compatible and then pins the read/write config reg accessors to emulate their return values. Those include PCI IDs. So you cannot instantiate virtual PCI device without this compatible string and thus also cannot write such a test easily.

Now I also understand where this whole discussion about compatible strings came from though.

Signature · 2 lines
Best regards,
Marek Vasut
#13 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Hi Marek,

Quoted 77 lines · Marek Vasut
Quoted 75 lines · Simon Glass

Hi Marek,

Quoted 72 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 65 lines · Marek Vasut
Quoted 53 lines · Simon Glass
Quoted 51 lines

Hi Marek,

Quoted 47 lines · Marek Vasut
Quoted 37 lines · Bin Meng

Hi Marek,

Quoted 27 lines · Marek Vasut
Quoted 25 lines · Bin Meng

+Simon

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 6 lines · Marek Vasut

The PCI controller can have DT subnodes describing extra properties of particular PCI devices, ie. a PHY attached to an EHCI controller on a PCI bus. This patch parses those DT subnodes and assigns a node to the PCI device instance, so that the driver can extract details from that node and ie. configure the PHY using the PHY subsystem.

Quoted 7 lines
Quoted 3 lines

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a long email that pointed out what Linux does seems like a 'fallback' to find a node with no compatible string.

Quoted 6 lines
Quoted 2 lines

Back to this, if we have to go with this way, please create a test case to cover this scenario.

The fact that it works on a particular board is not tested enough? Do we need a custom, special, synthetic test ?

Quoted 5 lines

I believe that's always been the requirement against the DM code changes. I was requested in the past when I changed something in the DM and I see other people were asked to do so. Like Alex said, it does not mean this patch was not tested enough, but to ensure future commits won't break this.

So, do you have any suggestion how to implement this test ? It seems Alex posed the same question. It doesn't seem to be trivial in the context of sandbox.

Quoted 5 lines
Quoted 3 lines

I suppose you need a PCI_DEVICE() declaration for sandbox, with an associated DT node and no compatible string. Then check that you can locate the device and that it read a DT property correctly.

Is there any example of this stuff already ?

See the bottom of swap_case.c. You might be able to add a new one of those,

If you look at pci-controller2 in test.dts it has a device with a compatible string. You could try adding a second device with no compatible string.

Quoted 9 lines
Quoted 5 lines
Quoted 1 line

And how does that test anything ?

You can test that your code actually attaches the DT node to the probed device. Without you code the test would fail. Wit it, it would pass.

Well it won't, because the sandbox swap_case.c requires the compatible. This all seems like a big hack to support virtual PCI devices.

The sandbox swap_case.c indeed supports dynamic driver binding, just like real PCI devices. Please check doc/driver-model/pci-info.txt (since you were modifying the same doc, I guess you missed that part ..)

Quoted 7 lines

The driver binds with a compatible and then pins the read/write config reg accessors to emulate their return values. Those include PCI IDs. So you cannot instantiate virtual PCI device without this compatible string and thus also cannot write such a test easily.

Now I also understand where this whole discussion about compatible strings came from though.

Regards,
Bin

#14 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Quoted 86 lines · Bin Meng

Hi Marek,

Quoted 83 lines · Marek Vasut
Quoted 80 lines · Simon Glass

Hi Marek,

Quoted 66 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 60 lines · Marek Vasut
Quoted 58 lines · Simon Glass
Quoted 47 lines

Hi Marek,

Quoted 44 lines · Marek Vasut
Quoted 42 lines · Bin Meng

Hi Marek,

Quoted 27 lines · Marek Vasut
Quoted 25 lines · Bin Meng

+Simon

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 6 lines · Marek Vasut

The PCI controller can have DT subnodes describing extra properties
of particular PCI devices, ie. a PHY attached to an EHCI controller
on a PCI bus. This patch parses those DT subnodes and assigns a node
to the PCI device instance, so that the driver can extract details
from that node and ie. configure the PHY using the PHY subsystem.

Quoted 7 lines
Quoted 3 lines

Signed-off-by: Marek Vasut <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tom Rini <[email protected]>

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a long email that pointed out what Linux does seems like a 'fallback' to find a node with no compatible string.

Quoted 6 lines
Quoted 2 lines

Back to this, if we have to go with this way, please create a test case to cover this scenario.

The fact that it works on a particular board is not tested enough? Do we need a custom, special, synthetic test ?

I believe that's always been the requirement against the DM code changes. I was requested in the past when I changed something in the DM and I see other people were asked to do so. Like Alex said, it does not mean this patch was not tested enough, but to ensure future commits won't break this.

Quoted 7 lines
Quoted 3 lines

So, do you have any suggestion how to implement this test ? It seems Alex posed the same question. It doesn't seem to be trivial in the context of sandbox.

I suppose you need a PCI_DEVICE() declaration for sandbox, with an associated DT node and no compatible string. Then check that you can locate the device and that it read a DT property correctly.

Is there any example of this stuff already ?

Quoted 7 lines
Quoted 5 lines

See the bottom of swap_case.c. You might be able to add a new one of those,

If you look at pci-controller2 in test.dts it has a device with a compatible string. You could try adding a second device with no compatible string.

And how does that test anything ?

You can test that your code actually attaches the DT node to the probed device. Without you code the test would fail. Wit it, it would pass.

Quoted 8 lines
Quoted 3 lines

Well it won't, because the sandbox swap_case.c requires the compatible. This all seems like a big hack to support virtual PCI devices.

The sandbox swap_case.c indeed supports dynamic driver binding, just like real PCI devices. Please check doc/driver-model/pci-info.txt (since you were modifying the same doc, I guess you missed that part ..)

Any specific part I am looking for ?

Signature · 2 lines
Best regards,
Marek Vasut
#15 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Hi Marek,

Quoted 92 lines · Marek Vasut
Quoted 90 lines · Bin Meng

Hi Marek,

Quoted 86 lines · Marek Vasut
Quoted 75 lines · Simon Glass

Hi Marek,

Quoted 72 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 65 lines · Marek Vasut
Quoted 53 lines · Simon Glass
Quoted 51 lines

Hi Marek,

Quoted 47 lines · Marek Vasut
Quoted 37 lines · Bin Meng

Hi Marek,

Quoted 27 lines · Marek Vasut
Quoted 25 lines · Bin Meng

+Simon

Hi Marek,

Quoted 15 lines · Marek Vasut

On 08/24/2018 08:27 PM, Marek Vasut wrote:
The PCI controller can have DT subnodes describing extra properties
of particular PCI devices, ie. a PHY attached to an EHCI controller
on a PCI bus. This patch parses those DT subnodes and assigns a node
to the PCI device instance, so that the driver can extract details
from that node and ie. configure the PHY using the PHY subsystem.

Signed-off-by: Marek Vasut <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tom Rini <[email protected]>

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a long email that pointed out what Linux does seems like a 'fallback' to find a node with no compatible string.

Quoted 6 lines
Quoted 2 lines

Back to this, if we have to go with this way, please create a test case to cover this scenario.

The fact that it works on a particular board is not tested enough? Do we need a custom, special, synthetic test ?

Quoted 5 lines

I believe that's always been the requirement against the DM code changes. I was requested in the past when I changed something in the DM and I see other people were asked to do so. Like Alex said, it does not mean this patch was not tested enough, but to ensure future commits won't break this.

So, do you have any suggestion how to implement this test ? It seems Alex posed the same question. It doesn't seem to be trivial in the context of sandbox.

Quoted 5 lines
Quoted 3 lines

I suppose you need a PCI_DEVICE() declaration for sandbox, with an associated DT node and no compatible string. Then check that you can locate the device and that it read a DT property correctly.

Is there any example of this stuff already ?

See the bottom of swap_case.c. You might be able to add a new one of those,

If you look at pci-controller2 in test.dts it has a device with a compatible string. You could try adding a second device with no compatible string.

Quoted 5 lines
Quoted 1 line

And how does that test anything ?

You can test that your code actually attaches the DT node to the probed device. Without you code the test would fail. Wit it, it would pass.

Well it won't, because the sandbox swap_case.c requires the compatible. This all seems like a big hack to support virtual PCI devices.

Quoted 6 lines
Quoted 4 lines

The sandbox swap_case.c indeed supports dynamic driver binding, just like real PCI devices. Please check doc/driver-model/pci-info.txt (since you were modifying the same doc, I guess you missed that part ..)

Any specific part I am looking for ?

In the pci-info.txt, search for "The sandbox PCI drivers also support dynamic driver binding". The arch/sandbox/dts/test.dts already has one PCI controller and two swap_case devices setup for this testing. You can start from there.

Regards,
Bin

#16 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

In reply to Marek Vasut

Hi Marek,

Quoted 86 lines · Marek Vasut
Quoted 75 lines · Simon Glass

Hi Marek,

Quoted 72 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 65 lines · Marek Vasut
Quoted 53 lines · Simon Glass
Quoted 51 lines

Hi Marek,

Quoted 47 lines · Marek Vasut
Quoted 37 lines · Bin Meng

Hi Marek,

Quoted 27 lines · Marek Vasut
Quoted 25 lines · Bin Meng

+Simon

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 6 lines · Marek Vasut

The PCI controller can have DT subnodes describing extra properties of particular PCI devices, ie. a PHY attached to an EHCI controller on a PCI bus. This patch parses those DT subnodes and assigns a node to the PCI device instance, so that the driver can extract details from that node and ie. configure the PHY using the PHY subsystem.

Quoted 7 lines
Quoted 3 lines

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a long email that pointed out what Linux does seems like a 'fallback' to find a node with no compatible string.

Quoted 6 lines
Quoted 2 lines

Back to this, if we have to go with this way, please create a test case to cover this scenario.

The fact that it works on a particular board is not tested enough? Do we need a custom, special, synthetic test ?

Quoted 5 lines

I believe that's always been the requirement against the DM code changes. I was requested in the past when I changed something in the DM and I see other people were asked to do so. Like Alex said, it does not mean this patch was not tested enough, but to ensure future commits won't break this.

So, do you have any suggestion how to implement this test ? It seems Alex posed the same question. It doesn't seem to be trivial in the context of sandbox.

Quoted 5 lines
Quoted 3 lines

I suppose you need a PCI_DEVICE() declaration for sandbox, with an associated DT node and no compatible string. Then check that you can locate the device and that it read a DT property correctly.

Is there any example of this stuff already ?

See the bottom of swap_case.c. You might be able to add a new one of those,

If you look at pci-controller2 in test.dts it has a device with a compatible string. You could try adding a second device with no compatible string.

Quoted 5 lines
Quoted 1 line

And how does that test anything ?

You can test that your code actually attaches the DT node to the probed device. Without you code the test would fail. Wit it, it would pass.

Well it won't, because the sandbox swap_case.c requires the compatible. This all seems like a big hack to support virtual PCI devices.

Quoted 7 lines

The driver binds with a compatible and then pins the read/write config reg accessors to emulate their return values. Those include PCI IDs. So you cannot instantiate virtual PCI device without this compatible string and thus also cannot write such a test easily.

Now I also understand where this whole discussion about compatible strings came from though.

The compatible string is needed for the emulation driver but not for the thing that connects to it. However as things stand you can't attach an emulator to a bus without nesting it under the device which it attaches to.

I suspect the best answer is to move the emulator so it is a direct child of the bus. You would need to update sandbox_pci_get_emul() to call device_find_first_child() on 'bus' instead of 'dev'.

Regards,
Simon

#17 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Quoted 97 lines · Simon Glass

Hi Marek,

Quoted 86 lines · Marek Vasut
Quoted 75 lines · Simon Glass

Hi Marek,

Quoted 72 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 65 lines · Marek Vasut
Quoted 53 lines · Simon Glass
Quoted 51 lines

Hi Marek,

Quoted 47 lines · Marek Vasut
Quoted 37 lines · Bin Meng

Hi Marek,

Quoted 27 lines · Marek Vasut
Quoted 25 lines · Bin Meng

+Simon

Hi Marek,

Quoted 8 lines · Marek Vasut
Quoted 6 lines · Marek Vasut

The PCI controller can have DT subnodes describing extra properties
of particular PCI devices, ie. a PHY attached to an EHCI controller
on a PCI bus. This patch parses those DT subnodes and assigns a node
to the PCI device instance, so that the driver can extract details
from that node and ie. configure the PHY using the PHY subsystem.

Quoted 7 lines
Quoted 3 lines

Signed-off-by: Marek Vasut <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tom Rini <[email protected]>

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a long email that pointed out what Linux does seems like a 'fallback' to find a node with no compatible string.

Quoted 6 lines
Quoted 2 lines

Back to this, if we have to go with this way, please create a test case to cover this scenario.

The fact that it works on a particular board is not tested enough? Do we need a custom, special, synthetic test ?

Quoted 5 lines

I believe that's always been the requirement against the DM code changes. I was requested in the past when I changed something in the DM and I see other people were asked to do so. Like Alex said, it does not mean this patch was not tested enough, but to ensure future commits won't break this.

So, do you have any suggestion how to implement this test ? It seems Alex posed the same question. It doesn't seem to be trivial in the context of sandbox.

Quoted 5 lines
Quoted 3 lines

I suppose you need a PCI_DEVICE() declaration for sandbox, with an associated DT node and no compatible string. Then check that you can locate the device and that it read a DT property correctly.

Is there any example of this stuff already ?

See the bottom of swap_case.c. You might be able to add a new one of those,

If you look at pci-controller2 in test.dts it has a device with a compatible string. You could try adding a second device with no compatible string.

Quoted 5 lines
Quoted 1 line

And how does that test anything ?

You can test that your code actually attaches the DT node to the probed device. Without you code the test would fail. Wit it, it would pass.

Well it won't, because the sandbox swap_case.c requires the compatible. This all seems like a big hack to support virtual PCI devices.

Quoted 7 lines

The driver binds with a compatible and then pins the read/write config reg accessors to emulate their return values. Those include PCI IDs. So you cannot instantiate virtual PCI device without this compatible string and thus also cannot write such a test easily.

Now I also understand where this whole discussion about compatible strings came from though.

Quoted 8 lines

The compatible string is needed for the emulation driver but not for the thing that connects to it. However as things stand you can't attach an emulator to a bus without nesting it under the device which it attaches to.

I suspect the best answer is to move the emulator so it is a direct child of the bus. You would need to update sandbox_pci_get_emul() to call device_find_first_child() on 'bus' instead of 'dev'.

Sounds to me _way_ out of scope for this patchset.

Signature · 2 lines
Best regards,
Marek Vasut
#18 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Hi Marek,

Quoted 104 lines · Marek Vasut
Quoted 102 lines · Simon Glass

Hi Marek,

Quoted 86 lines · Marek Vasut
Quoted 75 lines · Simon Glass

Hi Marek,

Quoted 72 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 65 lines · Marek Vasut
Quoted 53 lines · Simon Glass
Quoted 51 lines

Hi Marek,

Quoted 47 lines · Marek Vasut
Quoted 37 lines · Bin Meng

Hi Marek,

Quoted 27 lines · Marek Vasut
Quoted 25 lines · Bin Meng

+Simon

Hi Marek,

Quoted 15 lines · Marek Vasut

On 08/24/2018 08:27 PM, Marek Vasut wrote:
The PCI controller can have DT subnodes describing extra properties
of particular PCI devices, ie. a PHY attached to an EHCI controller
on a PCI bus. This patch parses those DT subnodes and assigns a node
to the PCI device instance, so that the driver can extract details
from that node and ie. configure the PHY using the PHY subsystem.

Signed-off-by: Marek Vasut <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tom Rini <[email protected]>

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a long email that pointed out what Linux does seems like a 'fallback' to find a node with no compatible string.

Quoted 6 lines
Quoted 2 lines

Back to this, if we have to go with this way, please create a test case to cover this scenario.

The fact that it works on a particular board is not tested enough? Do we need a custom, special, synthetic test ?

Quoted 5 lines

I believe that's always been the requirement against the DM code changes. I was requested in the past when I changed something in the DM and I see other people were asked to do so. Like Alex said, it does not mean this patch was not tested enough, but to ensure future commits won't break this.

So, do you have any suggestion how to implement this test ? It seems Alex posed the same question. It doesn't seem to be trivial in the context of sandbox.

Quoted 5 lines
Quoted 3 lines

I suppose you need a PCI_DEVICE() declaration for sandbox, with an associated DT node and no compatible string. Then check that you can locate the device and that it read a DT property correctly.

Is there any example of this stuff already ?

See the bottom of swap_case.c. You might be able to add a new one of those,

If you look at pci-controller2 in test.dts it has a device with a compatible string. You could try adding a second device with no compatible string.

Quoted 5 lines
Quoted 1 line

And how does that test anything ?

You can test that your code actually attaches the DT node to the probed device. Without you code the test would fail. Wit it, it would pass.

Well it won't, because the sandbox swap_case.c requires the compatible. This all seems like a big hack to support virtual PCI devices.

Quoted 7 lines

The driver binds with a compatible and then pins the read/write config reg accessors to emulate their return values. Those include PCI IDs. So you cannot instantiate virtual PCI device without this compatible string and thus also cannot write such a test easily.

Now I also understand where this whole discussion about compatible strings came from though.

The compatible string is needed for the emulation driver but not for the thing that connects to it. However as things stand you can't attach an emulator to a bus without nesting it under the device which it attaches to.

Quoted 5 lines
Quoted 3 lines

I suspect the best answer is to move the emulator so it is a direct child of the bus. You would need to update sandbox_pci_get_emul() to call device_find_first_child() on 'bus' instead of 'dev'.

Sounds to me _way_ out of scope for this patchset.

Dynamic binding is already supported on Sandbox. I guess Simon may have missed the part.

Regards,
Bin

#19 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Quoted 107 lines · Bin Meng

Hi Marek,

Quoted 104 lines · Marek Vasut
Quoted 102 lines · Simon Glass

Hi Marek,

Quoted 86 lines · Marek Vasut
Quoted 75 lines · Simon Glass

Hi Marek,

Quoted 72 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 65 lines · Marek Vasut
Quoted 53 lines · Simon Glass
Quoted 51 lines

Hi Marek,

Quoted 47 lines · Marek Vasut
Quoted 37 lines · Bin Meng

Hi Marek,

Quoted 27 lines · Marek Vasut
Quoted 25 lines · Bin Meng

+Simon

Hi Marek,

On Wed, Aug 29, 2018 at 10:22 PM Marek Vasut <[email protected]> wrote:

On 08/24/2018 08:27 PM, Marek Vasut wrote:
The PCI controller can have DT subnodes describing extra properties
of particular PCI devices, ie. a PHY attached to an EHCI controller
on a PCI bus. This patch parses those DT subnodes and assigns a node
to the PCI device instance, so that the driver can extract details
from that node and ie. configure the PHY using the PHY subsystem.

Signed-off-by: Marek Vasut <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tom Rini <[email protected]>

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a
long email that pointed out what Linux does seems like a 'fallback' to
find a node with no compatible string.

Quoted 6 lines
Quoted 2 lines

Back to this, if we have to go with this way, please create a test
case to cover this scenario.

The fact that it works on a particular board is not tested enough? Do we need a custom, special, synthetic test ?

Quoted 5 lines

I believe that's always been the requirement against the DM code changes. I was requested in the past when I changed something in the DM and I see other people were asked to do so. Like Alex said, it does not mean this patch was not tested enough, but to ensure future commits won't break this.

So, do you have any suggestion how to implement this test ? It seems Alex posed the same question. It doesn't seem to be trivial in the context of sandbox.

Quoted 5 lines
Quoted 3 lines

I suppose you need a PCI_DEVICE() declaration for sandbox, with an associated DT node and no compatible string. Then check that you can locate the device and that it read a DT property correctly.

Is there any example of this stuff already ?

See the bottom of swap_case.c. You might be able to add a new one of those,

If you look at pci-controller2 in test.dts it has a device with a compatible string. You could try adding a second device with no compatible string.

Quoted 5 lines
Quoted 1 line

And how does that test anything ?

You can test that your code actually attaches the DT node to the probed device. Without you code the test would fail. Wit it, it would pass.

Well it won't, because the sandbox swap_case.c requires the compatible. This all seems like a big hack to support virtual PCI devices.

Quoted 7 lines

The driver binds with a compatible and then pins the read/write config reg accessors to emulate their return values. Those include PCI IDs. So you cannot instantiate virtual PCI device without this compatible string and thus also cannot write such a test easily.

Now I also understand where this whole discussion about compatible strings came from though.

The compatible string is needed for the emulation driver but not for the thing that connects to it. However as things stand you can't attach an emulator to a bus without nesting it under the device which it attaches to.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I suspect the best answer is to move the emulator so it is a direct child of the bus. You would need to update sandbox_pci_get_emul() to call device_find_first_child() on 'bus' instead of 'dev'.

Sounds to me _way_ out of scope for this patchset.

Dynamic binding is already supported on Sandbox. I guess Simon may have missed the part.

Well, where is an example of that ? Because I am not seeing one.

Signature · 2 lines
Best regards,
Marek Vasut
#20 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Hi Marek,

Quoted 113 lines · Marek Vasut
Quoted 111 lines · Bin Meng

Hi Marek,

Quoted 108 lines · Marek Vasut
Quoted 105 lines · Simon Glass

Hi Marek,

Quoted 86 lines · Marek Vasut
Quoted 75 lines · Simon Glass

Hi Marek,

Quoted 72 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 65 lines · Marek Vasut
Quoted 53 lines · Simon Glass
Quoted 51 lines

Hi Marek,

Quoted 47 lines · Marek Vasut
Quoted 37 lines · Bin Meng

Hi Marek,

Quoted 33 lines · Marek Vasut

On 08/29/2018 05:15 PM, Bin Meng wrote:
+Simon

Hi Marek,

On Wed, Aug 29, 2018 at 10:22 PM Marek Vasut <[email protected]> wrote:

On 08/24/2018 08:27 PM, Marek Vasut wrote:
The PCI controller can have DT subnodes describing extra properties
of particular PCI devices, ie. a PHY attached to an EHCI controller
on a PCI bus. This patch parses those DT subnodes and assigns a node
to the PCI device instance, so that the driver can extract details
from that node and ie. configure the PHY using the PHY subsystem.

Signed-off-by: Marek Vasut <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tom Rini <[email protected]>

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a
long email that pointed out what Linux does seems like a 'fallback' to
find a node with no compatible string.

Back to this, if we have to go with this way, please create a test
case to cover this scenario.

The fact that it works on a particular board is not tested enough?
Do we need a custom, special, synthetic test ?

Quoted 5 lines

I believe that's always been the requirement against the DM code changes. I was requested in the past when I changed something in the DM and I see other people were asked to do so. Like Alex said, it does not mean this patch was not tested enough, but to ensure future commits won't break this.

So, do you have any suggestion how to implement this test ? It seems Alex posed the same question. It doesn't seem to be trivial in the context of sandbox.

Quoted 5 lines
Quoted 3 lines

I suppose you need a PCI_DEVICE() declaration for sandbox, with an associated DT node and no compatible string. Then check that you can locate the device and that it read a DT property correctly.

Is there any example of this stuff already ?

See the bottom of swap_case.c. You might be able to add a new one of those,

If you look at pci-controller2 in test.dts it has a device with a compatible string. You could try adding a second device with no compatible string.

Quoted 5 lines
Quoted 1 line

And how does that test anything ?

You can test that your code actually attaches the DT node to the probed device. Without you code the test would fail. Wit it, it would pass.

Well it won't, because the sandbox swap_case.c requires the compatible. This all seems like a big hack to support virtual PCI devices.

Quoted 7 lines

The driver binds with a compatible and then pins the read/write config reg accessors to emulate their return values. Those include PCI IDs. So you cannot instantiate virtual PCI device without this compatible string and thus also cannot write such a test easily.

Now I also understand where this whole discussion about compatible strings came from though.

The compatible string is needed for the emulation driver but not for the thing that connects to it. However as things stand you can't attach an emulator to a bus without nesting it under the device which it attaches to.

I suspect the best answer is to move the emulator so it is a direct child of the bus. You would need to update sandbox_pci_get_emul() to call device_find_first_child() on 'bus' instead of 'dev'.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Sounds to me _way_ out of scope for this patchset.

Dynamic binding is already supported on Sandbox. I guess Simon may have missed the part.

Well, where is an example of that ? Because I am not seeing one.

I already pointed out in the previous email. In arch/sandbox/dts/test.dts, the 2nd PCI controller has two swap_case devices and the 3rd controller has one.
In swap_case.c, U_BOOT_PCI_DEVICE() is there which is also a clear sign that the driver supports dynamic binding. Of course, the driver supports "compatible" too as you noticed.

Regards,
Bin

#21 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Quoted 121 lines · Bin Meng

Hi Marek,

Quoted 118 lines · Marek Vasut
Quoted 115 lines · Bin Meng

Hi Marek,

Quoted 104 lines · Marek Vasut
Quoted 102 lines · Simon Glass

Hi Marek,

Quoted 86 lines · Marek Vasut
Quoted 75 lines · Simon Glass

Hi Marek,

Quoted 72 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 65 lines · Marek Vasut
Quoted 53 lines · Simon Glass
Quoted 51 lines

Hi Marek,

Quoted 47 lines · Marek Vasut
Quoted 42 lines · Bin Meng

Hi Marek,

On Thu, Aug 30, 2018 at 1:07 AM Marek Vasut <[email protected]> wrote:

On 08/29/2018 05:15 PM, Bin Meng wrote:
+Simon

Hi Marek,

On Wed, Aug 29, 2018 at 10:22 PM Marek Vasut <[email protected]> wrote:

On 08/24/2018 08:27 PM, Marek Vasut wrote:
The PCI controller can have DT subnodes describing extra properties
of particular PCI devices, ie. a PHY attached to an EHCI controller
on a PCI bus. This patch parses those DT subnodes and assigns a node
to the PCI device instance, so that the driver can extract details
from that node and ie. configure the PHY using the PHY subsystem.

Signed-off-by: Marek Vasut <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tom Rini <[email protected]>

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a
long email that pointed out what Linux does seems like a 'fallback' to
find a node with no compatible string.

Back to this, if we have to go with this way, please create a test
case to cover this scenario.

The fact that it works on a particular board is not tested enough?
Do we need a custom, special, synthetic test ?

I believe that's always been the requirement against the DM code
changes. I was requested in the past when I changed something in the
DM and I see other people were asked to do so. Like Alex said, it does
not mean this patch was not tested enough, but to ensure future
commits won't break this.

So, do you have any suggestion how to implement this test ? It seems Alex posed the same question. It doesn't seem to be trivial in the context of sandbox.

Quoted 5 lines
Quoted 3 lines

I suppose you need a PCI_DEVICE() declaration for sandbox, with an associated DT node and no compatible string. Then check that you can locate the device and that it read a DT property correctly.

Is there any example of this stuff already ?

See the bottom of swap_case.c. You might be able to add a new one of those,

If you look at pci-controller2 in test.dts it has a device with a compatible string. You could try adding a second device with no compatible string.

Quoted 5 lines
Quoted 1 line

And how does that test anything ?

You can test that your code actually attaches the DT node to the probed device. Without you code the test would fail. Wit it, it would pass.

Well it won't, because the sandbox swap_case.c requires the compatible. This all seems like a big hack to support virtual PCI devices.

Quoted 7 lines

The driver binds with a compatible and then pins the read/write config reg accessors to emulate their return values. Those include PCI IDs. So you cannot instantiate virtual PCI device without this compatible string and thus also cannot write such a test easily.

Now I also understand where this whole discussion about compatible strings came from though.

The compatible string is needed for the emulation driver but not for the thing that connects to it. However as things stand you can't attach an emulator to a bus without nesting it under the device which it attaches to.

Quoted 5 lines
Quoted 3 lines

I suspect the best answer is to move the emulator so it is a direct child of the bus. You would need to update sandbox_pci_get_emul() to call device_find_first_child() on 'bus' instead of 'dev'.

Sounds to me _way_ out of scope for this patchset.

Dynamic binding is already supported on Sandbox. I guess Simon may have missed the part.

Quoted 6 lines
Quoted 2 lines

Well, where is an example of that ? Because I am not seeing one.

I already pointed out in the previous email. In arch/sandbox/dts/test.dts, the 2nd PCI controller has two swap_case devices and the 3rd controller has one.

By "second" you mean pci1: or pci2: ? Because pci1: is second , after pci0 . It'd really help if you were clearer in what you refer to.

Quoted 3 lines

In swap_case.c, U_BOOT_PCI_DEVICE() is there which is also a clear sign that the driver supports dynamic binding. Of course, the driver supports "compatible" too as you noticed.

Are you talking about sandbox,dev-info DT property here ?

Signature · 2 lines
Best regards,
Marek Vasut
#22 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Hi Marek,

Quoted 126 lines · Marek Vasut
Quoted 124 lines · Bin Meng

Hi Marek,

Quoted 120 lines · Marek Vasut
Quoted 107 lines · Bin Meng

Hi Marek,

Quoted 104 lines · Marek Vasut
Quoted 102 lines · Simon Glass

Hi Marek,

Quoted 86 lines · Marek Vasut
Quoted 75 lines · Simon Glass

Hi Marek,

Quoted 72 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 65 lines · Marek Vasut
Quoted 53 lines · Simon Glass
Quoted 51 lines

Hi Marek,

Quoted 47 lines · Marek Vasut

On 08/30/2018 03:32 PM, Bin Meng wrote:
Hi Marek,

On Thu, Aug 30, 2018 at 1:07 AM Marek Vasut <[email protected]> wrote:

On 08/29/2018 05:15 PM, Bin Meng wrote:
+Simon

Hi Marek,

On Wed, Aug 29, 2018 at 10:22 PM Marek Vasut <[email protected]> wrote:

On 08/24/2018 08:27 PM, Marek Vasut wrote:
The PCI controller can have DT subnodes describing extra properties
of particular PCI devices, ie. a PHY attached to an EHCI controller
on a PCI bus. This patch parses those DT subnodes and assigns a node
to the PCI device instance, so that the driver can extract details
from that node and ie. configure the PHY using the PHY subsystem.

Signed-off-by: Marek Vasut <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tom Rini <[email protected]>

Well, bump ?

This is the only missing patch to get my hardware working properly.

I don't think we ever had an agreement on the v1 patch. Simon had a
long email that pointed out what Linux does seems like a 'fallback' to
find a node with no compatible string.

Back to this, if we have to go with this way, please create a test
case to cover this scenario.

The fact that it works on a particular board is not tested enough?
Do we need a custom, special, synthetic test ?

I believe that's always been the requirement against the DM code
changes. I was requested in the past when I changed something in the
DM and I see other people were asked to do so. Like Alex said, it does
not mean this patch was not tested enough, but to ensure future
commits won't break this.

So, do you have any suggestion how to implement this test ? It seems
Alex posed the same question. It doesn't seem to be trivial in the
context of sandbox.

Quoted 5 lines
Quoted 3 lines

I suppose you need a PCI_DEVICE() declaration for sandbox, with an associated DT node and no compatible string. Then check that you can locate the device and that it read a DT property correctly.

Is there any example of this stuff already ?

See the bottom of swap_case.c. You might be able to add a new one of those,

If you look at pci-controller2 in test.dts it has a device with a compatible string. You could try adding a second device with no compatible string.

Quoted 5 lines
Quoted 1 line

And how does that test anything ?

You can test that your code actually attaches the DT node to the probed device. Without you code the test would fail. Wit it, it would pass.

Well it won't, because the sandbox swap_case.c requires the compatible. This all seems like a big hack to support virtual PCI devices.

Quoted 7 lines

The driver binds with a compatible and then pins the read/write config reg accessors to emulate their return values. Those include PCI IDs. So you cannot instantiate virtual PCI device without this compatible string and thus also cannot write such a test easily.

Now I also understand where this whole discussion about compatible strings came from though.

The compatible string is needed for the emulation driver but not for the thing that connects to it. However as things stand you can't attach an emulator to a bus without nesting it under the device which it attaches to.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I suspect the best answer is to move the emulator so it is a direct child of the bus. You would need to update sandbox_pci_get_emul() to call device_find_first_child() on 'bus' instead of 'dev'.

Sounds to me _way_ out of scope for this patchset.

Dynamic binding is already supported on Sandbox. I guess Simon may have missed the part.

Well, where is an example of that ? Because I am not seeing one.

Quoted 7 lines
Quoted 3 lines

I already pointed out in the previous email. In arch/sandbox/dts/test.dts, the 2nd PCI controller has two swap_case devices and the 3rd controller has one.

By "second" you mean pci1: or pci2: ? Because pci1: is second , after pci0 . It'd really help if you were clearer in what you refer to.

It's pci1. You can see there is no subnode under pci1 there yet if you type 'pci 1' from the U-Boot shell you see two PCI devices.

Quoted 5 lines
Quoted 3 lines

In swap_case.c, U_BOOT_PCI_DEVICE() is there which is also a clear sign that the driver supports dynamic binding. Of course, the driver supports "compatible" too as you noticed.

Are you talking about sandbox,dev-info DT property here ?

This is the property Sandbox uses to make the dynamic binding work. You can bypass this. The key here is that swap_case driver supports both "compatible" and dynamic binding, so you can write test cases to cover this newly added ofnode scenario.

Regards,
Bin

#23 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

On 09/20/2018 03:47 AM, Bin Meng wrote:
[...]

Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I suspect the best answer is to move the emulator so it is a direct child of the bus. You would need to update sandbox_pci_get_emul() to call device_find_first_child() on 'bus' instead of 'dev'.

Sounds to me _way_ out of scope for this patchset.

Dynamic binding is already supported on Sandbox. I guess Simon may have missed the part.

Well, where is an example of that ? Because I am not seeing one.

I already pointed out in the previous email. In arch/sandbox/dts/test.dts, the 2nd PCI controller has two swap_case devices and the 3rd controller has one.

Quoted 6 lines
Quoted 3 lines

By "second" you mean pci1: or pci2: ? Because pci1: is second , after pci0 . It'd really help if you were clearer in what you refer to.

It's pci1. You can see there is no subnode under pci1 there yet if you type 'pci 1' from the U-Boot shell you see two PCI devices.

I'd really appreciate it if you could be more precise when referring to things.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

In swap_case.c, U_BOOT_PCI_DEVICE() is there which is also a clear sign that the driver supports dynamic binding. Of course, the driver supports "compatible" too as you noticed.

Are you talking about sandbox,dev-info DT property here ?

This is the property Sandbox uses to make the dynamic binding work. You can bypass this.

Why would I want to bypass this ?

Quoted 3 lines

The key here is that swap_case driver supports
both "compatible" and dynamic binding, so you can write test cases to cover this newly added ofnode scenario.

That's great, and after spending even more time on this (probably days by now), I just keep finding more and more limitations of the virtual PCI subsystem which makes writing this testcase really hard. And none of that really helps fixing the real problem on my real hardware, which really stays broken.

Signature · 2 lines
Best regards,
Marek Vasut
#24 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Hi Marek,

Quoted 44 lines · Marek Vasut

On 09/20/2018 03:47 AM, Bin Meng wrote:
[...]

Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I suspect the best answer is to move the emulator so it is a direct child of the bus. You would need to update sandbox_pci_get_emul() to call device_find_first_child() on 'bus' instead of 'dev'.

Sounds to me _way_ out of scope for this patchset.

Dynamic binding is already supported on Sandbox. I guess Simon may have missed the part.

Well, where is an example of that ? Because I am not seeing one.

I already pointed out in the previous email. In arch/sandbox/dts/test.dts, the 2nd PCI controller has two swap_case devices and the 3rd controller has one.

Quoted 6 lines
Quoted 3 lines

By "second" you mean pci1: or pci2: ? Because pci1: is second , after pci0 . It'd really help if you were clearer in what you refer to.

It's pci1. You can see there is no subnode under pci1 there yet if you type 'pci 1' from the U-Boot shell you see two PCI devices.

I'd really appreciate it if you could be more precise when referring to things.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

In swap_case.c, U_BOOT_PCI_DEVICE() is there which is also a clear sign that the driver supports dynamic binding. Of course, the driver supports "compatible" too as you noticed.

Are you talking about sandbox,dev-info DT property here ?

This is the property Sandbox uses to make the dynamic binding work. You can bypass this.

Why would I want to bypass this ?

Quoted 3 lines

The key here is that swap_case driver supports
both "compatible" and dynamic binding, so you can write test cases to cover this newly added ofnode scenario.

Quoted 5 lines

That's great, and after spending even more time on this (probably days by now), I just keep finding more and more limitations of the virtual PCI subsystem which makes writing this testcase really hard. And none of that really helps fixing the real problem on my real hardware, which really stays broken.

You could fix that with a 5-minute patch to add a compatible string :-)

The problem is that you want to do it a certain way. Yes the test system has limitations but it is better than what we had before (no tests). We should expand its capability as we add new functionality.

Regards,
Simon

#25 lore raw

PATCH v2 1/2 pci: Support parsing PCI controller DT subnodes

Quoted 47 lines · Simon Glass

Hi Marek,

Quoted 44 lines · Marek Vasut

On 09/20/2018 03:47 AM, Bin Meng wrote:
[...]

Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I suspect the best answer is to move the emulator so it is a direct child of the bus. You would need to update sandbox_pci_get_emul() to call device_find_first_child() on 'bus' instead of 'dev'.

Sounds to me _way_ out of scope for this patchset.

Dynamic binding is already supported on Sandbox. I guess Simon may have missed the part.

Well, where is an example of that ? Because I am not seeing one.

I already pointed out in the previous email. In arch/sandbox/dts/test.dts, the 2nd PCI controller has two swap_case devices and the 3rd controller has one.

Quoted 6 lines
Quoted 3 lines

By "second" you mean pci1: or pci2: ? Because pci1: is second , after pci0 . It'd really help if you were clearer in what you refer to.

It's pci1. You can see there is no subnode under pci1 there yet if you type 'pci 1' from the U-Boot shell you see two PCI devices.

I'd really appreciate it if you could be more precise when referring to things.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

In swap_case.c, U_BOOT_PCI_DEVICE() is there which is also a clear sign that the driver supports dynamic binding. Of course, the driver supports "compatible" too as you noticed.

Are you talking about sandbox,dev-info DT property here ?

This is the property Sandbox uses to make the dynamic binding work. You can bypass this.

Why would I want to bypass this ?

Quoted 3 lines

The key here is that swap_case driver supports
both "compatible" and dynamic binding, so you can write test cases to cover this newly added ofnode scenario.

Quoted 7 lines
Quoted 5 lines

That's great, and after spending even more time on this (probably days by now), I just keep finding more and more limitations of the virtual PCI subsystem which makes writing this testcase really hard. And none of that really helps fixing the real problem on my real hardware, which really stays broken.

You could fix that with a 5-minute patch to add a compatible string :-)

No, that's a hack.

Quoted 7 lines

The problem is that you want to do it a certain way. Yes the test system has limitations but it is better than what we had before (no tests). We should expand its capability as we add new functionality.

Regards,
Simon

Signature · 2 lines
Best regards,
Marek Vasut
#26 lore raw

PATCH v2 2/2 pci: Update documentation to make 'compatible' string optional

In reply to Marek Vasut

Reword the documentation to make it clear the compatible string is now optional, yet still matching on it takes precedence over PCI IDs and PCI classes.

---
V2: New patch

---
 doc/driver-model/pci-info.txt | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
doc/driver-model/pci-info.txt +9 -5
index e1701d1fbc..14364c5c75 100644
@@ -34,11 +34,15 @@ under that bus.
 Note that this is all done on a lazy basis, as needed, so until something is
 touched on PCI (eg: a call to pci_find_devices()) it will not be probed.
 
-PCI devices can appear in the flattened device tree. If they do this serves to
-specify the driver to use for the device. In this case they will be bound at
-first. Each PCI device node must have a compatible string list as well as a
-<reg> property, as defined by the IEEE Std 1275-1994 PCI bus binding document
-v2.1. Note we must describe PCI devices with the same bus hierarchy as the
+PCI devices can appear in the flattened device tree. If they do, their node
+often contains extra information which cannot be derived from the PCI IDs or
+PCI class of the device. Each PCI device node must have a <reg> property, as
+defined by the IEEE Std 1275-1994 PCI bus binding document v2.1. Compatible
+string list is optional and generally not needed, since PCI is discoverable
+bus, albeit there are justified exceptions. If the compatible string is
+present, matching on it takes precedence over PCI IDs and PCI classes.
+
+Note we must describe PCI devices with the same bus hierarchy as the
 hardware, otherwise driver model cannot detect the correct parent/children
 relationship during PCI bus enumeration thus PCI devices won't be bound to
 their drivers accordingly. A working example like below:
Signature · 1 line
2.16.2
#27 lore raw

PATCH v2 2/2 pci: Update documentation to make 'compatible' string optional

Hi Marek,

Quoted 39 lines · Marek Vasut

Reword the documentation to make it clear the compatible string is now optional, yet still matching on it takes precedence over PCI IDs and PCI classes.

---
V2: New patch

---
 doc/driver-model/pci-info.txt | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
doc/driver-model/pci-info.txt +9 -6
index e1701d1fbc..14364c5c75 100644
@@ -34,11 +34,15 @@ under that bus.
 Note that this is all done on a lazy basis, as needed, so until something is
 touched on PCI (eg: a call to pci_find_devices()) it will not be probed.
 
-PCI devices can appear in the flattened device tree. If they do this serves to
-specify the driver to use for the device. In this case they will be bound at
-first. Each PCI device node must have a compatible string list as well as a
-<reg> property, as defined by the IEEE Std 1275-1994 PCI bus binding document
-v2.1. Note we must describe PCI devices with the same bus hierarchy as the
+PCI devices can appear in the flattened device tree. If they do, their node
+often contains extra information which cannot be derived from the PCI IDs or
+PCI class of the device. Each PCI device node must have a <reg> property, as
+defined by the IEEE Std 1275-1994 PCI bus binding document v2.1. Compatible
+string list is optional and generally not needed, since PCI is discoverable
+bus, albeit there are justified exceptions. If the compatible string is
+present, matching on it takes precedence over PCI IDs and PCI classes.
+
+Note we must describe PCI devices with the same bus hierarchy as the
 hardware, otherwise driver model cannot detect the correct parent/children
 relationship during PCI bus enumeration thus PCI devices won't be bound to
 their drivers accordingly. A working example like below:
--
Quoted 2 lines

2.16.2

Are we really saying that compatible strings are 'generally not needed'?

device tree pci supplement 2.1 talks about some new formats for the compatible string, but doesn't say it is not needed. I much prefer a compatible string since it is easy to find the driver in the source code.

Can way say that a compatible string is preferred, but in extremis you can avoid it by...

Regards,
Simon

#28 lore raw

PATCH v2 2/2 pci: Update documentation to make 'compatible' string optional

Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 36 lines · Marek Vasut
Quoted 35 lines

Reword the documentation to make it clear the compatible string is now optional, yet still matching on it takes precedence over PCI IDs and PCI classes.

---
V2: New patch

---
 doc/driver-model/pci-info.txt | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
doc/driver-model/pci-info.txt +9 -5
index e1701d1fbc..14364c5c75 100644
@@ -34,11 +34,15 @@ under that bus.
 Note that this is all done on a lazy basis, as needed, so until something is
 touched on PCI (eg: a call to pci_find_devices()) it will not be probed.
 
-PCI devices can appear in the flattened device tree. If they do this serves to
-specify the driver to use for the device. In this case they will be bound at
-first. Each PCI device node must have a compatible string list as well as a
-<reg> property, as defined by the IEEE Std 1275-1994 PCI bus binding document
-v2.1. Note we must describe PCI devices with the same bus hierarchy as the
+PCI devices can appear in the flattened device tree. If they do, their node
+often contains extra information which cannot be derived from the PCI IDs or
+PCI class of the device. Each PCI device node must have a <reg> property, as
+defined by the IEEE Std 1275-1994 PCI bus binding document v2.1. Compatible
+string list is optional and generally not needed, since PCI is discoverable
+bus, albeit there are justified exceptions. If the compatible string is
+present, matching on it takes precedence over PCI IDs and PCI classes.
+
+Note we must describe PCI devices with the same bus hierarchy as the
Quoted 8 lines
Quoted 6 lines
doc/driver-model/pci-info.txt +0 -1
 hardware, otherwise driver model cannot detect the correct parent/children
 relationship during PCI bus enumeration thus PCI devices won't be bound to
 their drivers accordingly. A working example like below:
--

2.16.2

Are we really saying that compatible strings are 'generally not needed'?

Yes, PCI is a discoverable bus.

Quoted 4 lines

device tree pci supplement 2.1 talks about some new formats for the compatible string, but doesn't say it is not needed. I much prefer a compatible string since it is easy to find the driver in the source code.

But it duplicates (badly) what the PCI IDs and classes are used for since PCI's inception.

Quoted 2 lines

Can way say that a compatible string is preferred, but in extremis you can avoid it by...

No, see above, PCI is discoverable by design.

Signature · 2 lines
Best regards,
Marek Vasut
#29 lore raw

PATCH v2 2/2 pci: Update documentation to make 'compatible' string optional

Hi Marek,

Quoted 57 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 36 lines · Marek Vasut
Quoted 35 lines

Reword the documentation to make it clear the compatible string is now optional, yet still matching on it takes precedence over PCI IDs and PCI classes.

---
V2: New patch

---
 doc/driver-model/pci-info.txt | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
doc/driver-model/pci-info.txt +9 -5
index e1701d1fbc..14364c5c75 100644
@@ -34,11 +34,15 @@ under that bus.
 Note that this is all done on a lazy basis, as needed, so until something is
 touched on PCI (eg: a call to pci_find_devices()) it will not be probed.
 
-PCI devices can appear in the flattened device tree. If they do this serves to
-specify the driver to use for the device. In this case they will be bound at
-first. Each PCI device node must have a compatible string list as well as a
-<reg> property, as defined by the IEEE Std 1275-1994 PCI bus binding document
-v2.1. Note we must describe PCI devices with the same bus hierarchy as the
+PCI devices can appear in the flattened device tree. If they do, their node
+often contains extra information which cannot be derived from the PCI IDs or
+PCI class of the device. Each PCI device node must have a <reg> property, as
+defined by the IEEE Std 1275-1994 PCI bus binding document v2.1. Compatible
+string list is optional and generally not needed, since PCI is discoverable
+bus, albeit there are justified exceptions. If the compatible string is
+present, matching on it takes precedence over PCI IDs and PCI classes.
+
+Note we must describe PCI devices with the same bus hierarchy as the
Quoted 8 lines
Quoted 6 lines
doc/driver-model/pci-info.txt +0 -1
 hardware, otherwise driver model cannot detect the correct parent/children
 relationship during PCI bus enumeration thus PCI devices won't be bound to
 their drivers accordingly. A working example like below:
--

2.16.2

Are we really saying that compatible strings are 'generally not needed'?

Yes, PCI is a discoverable bus.

Quoted 4 lines

device tree pci supplement 2.1 talks about some new formats for the compatible string, but doesn't say it is not needed. I much prefer a compatible string since it is easy to find the driver in the source code.

Quoted 7 lines

But it duplicates (badly) what the PCI IDs and classes are used for since PCI's inception.

Quoted 2 lines

Can way say that a compatible string is preferred, but in extremis you can avoid it by...

No, see above, PCI is discoverable by design.

I feel that these two things are orthogonal.

You can probe the bus and find a device. That is the 'discoverable' part.

But it is not automatically configurable. If it it were, there would be no DT node and no settings in the DT for the device. But from your patch, in some cases we need more information, and the DT node provides that.

So to get the settings to pass to the driver, you have to find the device-tree node to use for the device. The only way U-Boot supports is to use the 'reg' property, which specifies the PCI address. (We don't support a compatible string starting with "pci...". We could support that, but it is more code for essentially the same purpose.)

So we are not talking about the discoverability, which is already supported by U-Boot. We are talking about the configuration of the device, via settings passed to the driver.

In fact the only issue here is whether to require a compatible string for PCI nodes or allow matching solely based on the 'reg' property. Is the latter widely used in Linux? Presumably not on x86, which doesn't even use DT.

Regards,
Simon

#30 lore raw

PATCH v2 2/2 pci: Update documentation to make 'compatible' string optional

Quoted 68 lines · Simon Glass

Hi Marek,

Quoted 57 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 36 lines · Marek Vasut
Quoted 35 lines

Reword the documentation to make it clear the compatible string is now optional, yet still matching on it takes precedence over PCI IDs and PCI classes.

---
V2: New patch

---
 doc/driver-model/pci-info.txt | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
doc/driver-model/pci-info.txt +9 -5
index e1701d1fbc..14364c5c75 100644
@@ -34,11 +34,15 @@ under that bus.
 Note that this is all done on a lazy basis, as needed, so until something is
 touched on PCI (eg: a call to pci_find_devices()) it will not be probed.
 
-PCI devices can appear in the flattened device tree. If they do this serves to
-specify the driver to use for the device. In this case they will be bound at
-first. Each PCI device node must have a compatible string list as well as a
-<reg> property, as defined by the IEEE Std 1275-1994 PCI bus binding document
-v2.1. Note we must describe PCI devices with the same bus hierarchy as the
+PCI devices can appear in the flattened device tree. If they do, their node
+often contains extra information which cannot be derived from the PCI IDs or
+PCI class of the device. Each PCI device node must have a <reg> property, as
+defined by the IEEE Std 1275-1994 PCI bus binding document v2.1. Compatible
+string list is optional and generally not needed, since PCI is discoverable
+bus, albeit there are justified exceptions. If the compatible string is
+present, matching on it takes precedence over PCI IDs and PCI classes.
+
+Note we must describe PCI devices with the same bus hierarchy as the
Quoted 8 lines
Quoted 6 lines
doc/driver-model/pci-info.txt +0 -1
 hardware, otherwise driver model cannot detect the correct parent/children
 relationship during PCI bus enumeration thus PCI devices won't be bound to
 their drivers accordingly. A working example like below:
--

2.16.2

Are we really saying that compatible strings are 'generally not needed'?

Yes, PCI is a discoverable bus.

Quoted 4 lines

device tree pci supplement 2.1 talks about some new formats for the compatible string, but doesn't say it is not needed. I much prefer a compatible string since it is easy to find the driver in the source code.

Quoted 7 lines

But it duplicates (badly) what the PCI IDs and classes are used for since PCI's inception.

Quoted 2 lines

Can way say that a compatible string is preferred, but in extremis you can avoid it by...

No, see above, PCI is discoverable by design.

Quoted 8 lines

I feel that these two things are orthogonal.

You can probe the bus and find a device. That is the 'discoverable' part.

But it is not automatically configurable. If it it were, there would be no DT node and no settings in the DT for the device. But from your patch, in some cases we need more information, and the DT node provides that.

Pretty much, you can have stuff on the PCI card which needs extra info.

Quoted 5 lines

So to get the settings to pass to the driver, you have to find the device-tree node to use for the device. The only way U-Boot supports is to use the 'reg' property, which specifies the PCI address. (We don't support a compatible string starting with "pci...". We could support that, but it is more code for essentially the same purpose.)

Yes

Quoted 3 lines

So we are not talking about the discoverability, which is already supported by U-Boot. We are talking about the configuration of the device, via settings passed to the driver.

Yes

Quoted 4 lines

In fact the only issue here is whether to require a compatible string for PCI nodes or allow matching solely based on the 'reg' property. Is the latter widely used in Linux? Presumably not on x86, which doesn't even use DT.

I only see the compatible string used for bridges, the rest of the subdevices match on reg property.

Signature · 2 lines
Best regards,
Marek Vasut
#31 lore raw

PATCH v2 2/2 pci: Update documentation to make 'compatible' string optional

Hi,

Quoted 94 lines · Marek Vasut
Quoted 68 lines · Simon Glass

Hi Marek,

Quoted 57 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 36 lines · Marek Vasut
Quoted 35 lines

Reword the documentation to make it clear the compatible string is now optional, yet still matching on it takes precedence over PCI IDs and PCI classes.

---
V2: New patch

---
 doc/driver-model/pci-info.txt | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
doc/driver-model/pci-info.txt +9 -5
index e1701d1fbc..14364c5c75 100644
@@ -34,11 +34,15 @@ under that bus.
 Note that this is all done on a lazy basis, as needed, so until something is
 touched on PCI (eg: a call to pci_find_devices()) it will not be probed.
 
-PCI devices can appear in the flattened device tree. If they do this serves to
-specify the driver to use for the device. In this case they will be bound at
-first. Each PCI device node must have a compatible string list as well as a
-<reg> property, as defined by the IEEE Std 1275-1994 PCI bus binding document
-v2.1. Note we must describe PCI devices with the same bus hierarchy as the
+PCI devices can appear in the flattened device tree. If they do, their node
+often contains extra information which cannot be derived from the PCI IDs or
+PCI class of the device. Each PCI device node must have a <reg> property, as
+defined by the IEEE Std 1275-1994 PCI bus binding document v2.1. Compatible
+string list is optional and generally not needed, since PCI is discoverable
+bus, albeit there are justified exceptions. If the compatible string is
+present, matching on it takes precedence over PCI IDs and PCI classes.
+
+Note we must describe PCI devices with the same bus hierarchy as the
Quoted 8 lines
Quoted 6 lines
doc/driver-model/pci-info.txt +0 -1
 hardware, otherwise driver model cannot detect the correct parent/children
 relationship during PCI bus enumeration thus PCI devices won't be bound to
 their drivers accordingly. A working example like below:
--

2.16.2

Are we really saying that compatible strings are 'generally not needed'?

Yes, PCI is a discoverable bus.

Quoted 4 lines

device tree pci supplement 2.1 talks about some new formats for the compatible string, but doesn't say it is not needed. I much prefer a compatible string since it is easy to find the driver in the source code.

Quoted 7 lines

But it duplicates (badly) what the PCI IDs and classes are used for since PCI's inception.

Quoted 2 lines

Can way say that a compatible string is preferred, but in extremis you can avoid it by...

No, see above, PCI is discoverable by design.

Quoted 8 lines

I feel that these two things are orthogonal.

You can probe the bus and find a device. That is the 'discoverable' part.

But it is not automatically configurable. If it it were, there would be no DT node and no settings in the DT for the device. But from your patch, in some cases we need more information, and the DT node provides that.

Pretty much, you can have stuff on the PCI card which needs extra info.

Quoted 5 lines

So to get the settings to pass to the driver, you have to find the device-tree node to use for the device. The only way U-Boot supports is to use the 'reg' property, which specifies the PCI address. (We don't support a compatible string starting with "pci...". We could support that, but it is more code for essentially the same purpose.)

Yes

Quoted 3 lines

So we are not talking about the discoverability, which is already supported by U-Boot. We are talking about the configuration of the device, via settings passed to the driver.

Yes

Quoted 7 lines
Quoted 4 lines

In fact the only issue here is whether to require a compatible string for PCI nodes or allow matching solely based on the 'reg' property. Is the latter widely used in Linux? Presumably not on x86, which doesn't even use DT.

I only see the compatible string used for bridges, the rest of the subdevices match on reg property.

Where are you looking?

Regards,
Simon

#32 lore raw

PATCH v2 2/2 pci: Update documentation to make 'compatible' string optional

Quoted 102 lines · Simon Glass

Hi,

Quoted 99 lines · Marek Vasut
Quoted 68 lines · Simon Glass

Hi Marek,

Quoted 57 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 36 lines · Marek Vasut
Quoted 35 lines

Reword the documentation to make it clear the compatible string is now optional, yet still matching on it takes precedence over PCI IDs and PCI classes.

---
V2: New patch

---
 doc/driver-model/pci-info.txt | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
doc/driver-model/pci-info.txt +9 -5
index e1701d1fbc..14364c5c75 100644
@@ -34,11 +34,15 @@ under that bus.
 Note that this is all done on a lazy basis, as needed, so until something is
 touched on PCI (eg: a call to pci_find_devices()) it will not be probed.
 
-PCI devices can appear in the flattened device tree. If they do this serves to
-specify the driver to use for the device. In this case they will be bound at
-first. Each PCI device node must have a compatible string list as well as a
-<reg> property, as defined by the IEEE Std 1275-1994 PCI bus binding document
-v2.1. Note we must describe PCI devices with the same bus hierarchy as the
+PCI devices can appear in the flattened device tree. If they do, their node
+often contains extra information which cannot be derived from the PCI IDs or
+PCI class of the device. Each PCI device node must have a <reg> property, as
+defined by the IEEE Std 1275-1994 PCI bus binding document v2.1. Compatible
+string list is optional and generally not needed, since PCI is discoverable
+bus, albeit there are justified exceptions. If the compatible string is
+present, matching on it takes precedence over PCI IDs and PCI classes.
+
+Note we must describe PCI devices with the same bus hierarchy as the
Quoted 8 lines
Quoted 6 lines
doc/driver-model/pci-info.txt +0 -1
 hardware, otherwise driver model cannot detect the correct parent/children
 relationship during PCI bus enumeration thus PCI devices won't be bound to
 their drivers accordingly. A working example like below:
--

2.16.2

Are we really saying that compatible strings are 'generally not needed'?

Yes, PCI is a discoverable bus.

Quoted 4 lines

device tree pci supplement 2.1 talks about some new formats for the compatible string, but doesn't say it is not needed. I much prefer a compatible string since it is easy to find the driver in the source code.

Quoted 7 lines

But it duplicates (badly) what the PCI IDs and classes are used for since PCI's inception.

Quoted 2 lines

Can way say that a compatible string is preferred, but in extremis you can avoid it by...

No, see above, PCI is discoverable by design.

Quoted 8 lines

I feel that these two things are orthogonal.

You can probe the bus and find a device. That is the 'discoverable' part.

But it is not automatically configurable. If it it were, there would be no DT node and no settings in the DT for the device. But from your patch, in some cases we need more information, and the DT node provides that.

Pretty much, you can have stuff on the PCI card which needs extra info.

Quoted 5 lines

So to get the settings to pass to the driver, you have to find the device-tree node to use for the device. The only way U-Boot supports is to use the 'reg' property, which specifies the PCI address. (We don't support a compatible string starting with "pci...". We could support that, but it is more code for essentially the same purpose.)

Yes

Quoted 3 lines

So we are not talking about the discoverability, which is already supported by U-Boot. We are talking about the configuration of the device, via settings passed to the driver.

Yes

Quoted 4 lines

In fact the only issue here is whether to require a compatible string for PCI nodes or allow matching solely based on the 'reg' property. Is the latter widely used in Linux? Presumably not on x86, which doesn't even use DT.

Quoted 4 lines
Quoted 2 lines

I only see the compatible string used for bridges, the rest of the subdevices match on reg property.

Where are you looking?

Roughly 'git grep -A 10 pci arch/arm*/boot/dts' in Linux

Signature · 2 lines
Best regards,
Marek Vasut
#33 lore raw

PATCH v2 2/2 pci: Update documentation to make 'compatible' string optional

Hi Marek,

Quoted 103 lines · Marek Vasut
Quoted 102 lines · Simon Glass

Hi,

Quoted 99 lines · Marek Vasut
Quoted 68 lines · Simon Glass

Hi Marek,

Quoted 57 lines · Marek Vasut
Quoted 1 line · Simon Glass

Hi Marek,

Hi,

Quoted 36 lines · Marek Vasut
Quoted 35 lines

Reword the documentation to make it clear the compatible string is now optional, yet still matching on it takes precedence over PCI IDs and PCI classes.

---
V2: New patch

---
 doc/driver-model/pci-info.txt | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
doc/driver-model/pci-info.txt +9 -5
index e1701d1fbc..14364c5c75 100644
@@ -34,11 +34,15 @@ under that bus.
 Note that this is all done on a lazy basis, as needed, so until something is
 touched on PCI (eg: a call to pci_find_devices()) it will not be probed.
 
-PCI devices can appear in the flattened device tree. If they do this serves to
-specify the driver to use for the device. In this case they will be bound at
-first. Each PCI device node must have a compatible string list as well as a
-<reg> property, as defined by the IEEE Std 1275-1994 PCI bus binding document
-v2.1. Note we must describe PCI devices with the same bus hierarchy as the
+PCI devices can appear in the flattened device tree. If they do, their node
+often contains extra information which cannot be derived from the PCI IDs or
+PCI class of the device. Each PCI device node must have a <reg> property, as
+defined by the IEEE Std 1275-1994 PCI bus binding document v2.1. Compatible
+string list is optional and generally not needed, since PCI is discoverable
+bus, albeit there are justified exceptions. If the compatible string is
+present, matching on it takes precedence over PCI IDs and PCI classes.
+
+Note we must describe PCI devices with the same bus hierarchy as the
Quoted 8 lines
Quoted 6 lines
doc/driver-model/pci-info.txt +0 -1
 hardware, otherwise driver model cannot detect the correct parent/children
 relationship during PCI bus enumeration thus PCI devices won't be bound to
 their drivers accordingly. A working example like below:
--

2.16.2

Are we really saying that compatible strings are 'generally not needed'?

Yes, PCI is a discoverable bus.

Quoted 4 lines

device tree pci supplement 2.1 talks about some new formats for the compatible string, but doesn't say it is not needed. I much prefer a compatible string since it is easy to find the driver in the source code.

Quoted 7 lines

But it duplicates (badly) what the PCI IDs and classes are used for since PCI's inception.

Quoted 2 lines

Can way say that a compatible string is preferred, but in extremis you can avoid it by...

No, see above, PCI is discoverable by design.

Quoted 8 lines

I feel that these two things are orthogonal.

You can probe the bus and find a device. That is the 'discoverable' part.

But it is not automatically configurable. If it it were, there would be no DT node and no settings in the DT for the device. But from your patch, in some cases we need more information, and the DT node provides that.

Pretty much, you can have stuff on the PCI card which needs extra info.

Quoted 5 lines

So to get the settings to pass to the driver, you have to find the device-tree node to use for the device. The only way U-Boot supports is to use the 'reg' property, which specifies the PCI address. (We don't support a compatible string starting with "pci...". We could support that, but it is more code for essentially the same purpose.)

Yes

Quoted 3 lines

So we are not talking about the discoverability, which is already supported by U-Boot. We are talking about the configuration of the device, via settings passed to the driver.

Yes

Quoted 4 lines

In fact the only issue here is whether to require a compatible string for PCI nodes or allow matching solely based on the 'reg' property. Is the latter widely used in Linux? Presumably not on x86, which doesn't even use DT.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

I only see the compatible string used for bridges, the rest of the subdevices match on reg property.

Where are you looking?

Roughly 'git grep -A 10 pci arch/arm*/boot/dts' in Linux

I don't really understand why we need 'status = "okay"' on a bridge, since it should be enumerated anyway.

But I did find some bridges (I think( with settings like reset-gpios and no compatible strings.

I'm OK with supporting this if you want to.

Tom do you have any thoughts on this?

Regards,
Simon