From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Wed, 22 Aug 2018 22:19:29 +0200 Subject: [U-Boot] [PATCH] pci: Support parsing PCI controller DT subnodes In-Reply-To: References: <972158e3-e0bd-4798-699f-06a97d7100d1@gmail.com> <98561a43-18bf-3c76-d3c6-3320cdafdf4b@gmail.com> <7a1aa6ed-7ddd-551a-f445-171465dbbe46@gmail.com> <92b4b0cc-b3fb-45c8-20f9-a232c2891edf@gmail.com> <20180815112540.GG30947@bill-the-cat> Message-ID: <911fd0e4-de0e-f1af-0314-0583f1c1d4e0@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 08/22/2018 08:08 PM, Simon Glass wrote: [...] >> This is explained in the patch description and the thread again. Please >> read the thread before replying. Take a look at the r8a7794.dtsi and its >> PCI bindings, there are PCI controller subnodes which add extra >> information for PCI devices on the bus. These nodes do not have a >> compatible string, only a BFD. >> >> This is perfectly valid, since you can match a driver on the PCI IDs or >> classes (PCI_DEVICE()), but the driver doesn't have a DT node associated >> with it. If there is a DT node with a matching BFD, it is associated >> with the driver instance by this patch. >> >> This allows ie. the EHCI PCI driver to access that DT node and extract >> information about PHYs from the DT (in case of the r8a7794). > > But the code to do this already exists in pci_bind_bus_devices(). > > I know I am late to this thread but no one is going to read 45 messages, sorry. But then what is the point of having ML discussions archived at all if I have to explain the same thing over and over to everyone who comes into the thread ? > Why is pci_bus_find_devfn() failing? Because this function is a hack to force-bind drivers to PCI devices which are described in the DT with a compatible string. This does not apply to this case. If this function fails (correctly, no force-binding needs to happen because there is no compatible string, we want to match on PCI IDs), the code will continue and match on PCI ID/class with pci_find_and_bind_driver() . That function is where we need to verify if there isn't a PCI controller subnode in DT with a matching BFD which should be associated with the new driver instance. -- Best regards, Marek Vasut