public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: nsaenzju@redhat.com
To: Rob Herring <robh@kernel.org>
Cc: f.fainelli@gmail.com, gregkh@linuxfoundation.org,
	devicetree@vger.kernel.org,
	bcm-kernel-feedback-list@broadcom.com,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, stefan.wahren@i2se.com
Subject: Re: [PATCH] ARM: dts: bcm2711-rpi-4-b: Fix pcie0's unit address
Date: Mon, 30 Aug 2021 18:45:31 +0200	[thread overview]
Message-ID: <22bbfdefb2b9a1a65a807d0aecee67e607b7ff60.camel@redhat.com> (raw)
In-Reply-To: <YSzfoyesEzAuLkSS@robh.at.kernel.org>

On Mon, 2021-08-30 at 08:39 -0500, Rob Herring wrote:
> On Mon, Aug 30, 2021 at 12:39:09PM +0200, Nicolas Saenz Julienne wrote:
> > dtbs_check currently complains that:
> > 
> > arch/arm/boot/dts/bcm2711-rpi-4-b.dts:220.10-231.4: Warning
> > (pci_device_reg): /scb/pcie@7d500000/pci@1,0: PCI unit address format
> > error, expected "0,0"
> > 
> > Unsurprisingly pci@0,0 is the right address, as illustrated by its reg
> > property:
> > 
> > 	&pcie0 {
> > 		pci@0,0 {
> > 			/*
> > 			 * As defined in the IEEE Std 1275-1994 document,
> > 			 * reg is a five-cell address encoded as (phys.hi
> > 			 * phys.mid phys.lo size.hi size.lo). phys.hi
> > 			 * should contain the device's BDF as 0b00000000
> > 			 * bbbbbbbb dddddfff 00000000. The other cells
> > 			 * should be zero.
> > 			 */
> > 			reg = <0 0 0 0 0>;
> > 		};
> > 	};
> > 
> > The bus is clearly 0. So fix it.
> 
> s/bus/device/
> 
> The unit-address format is '<device>,<function>' (and function is 
> optional). The bus number is not part of the unit-address because that 
> is dynamic and then the path would not be fixed/known. The bus is part 
> of 'reg' for true OpenFirmware, but for FDT I think it should always be 
> 0 as the DT is static. 
> 
> Looks like the child node is wrong (both unit-address and reg) as well:
> 
>                 usb@1,0 {
>                         reg = <0x10000 0 0 0 0>;
>                         resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>;
>                 };
> 
> It doesn't warn because the bridge node is also missing 'device_type = 
> "pci";'.
> 
> This is all fairly hard to get right (see recent hikey970 patches for a 
> complex example). I'm thinking about writing a tool that generates a DT 
> with PCI nodes by reading the PCI hierachy from sysfs.

Just to double-check I understood everything, with:

	lspci -D -PP
	0000:00:00.0 PCI bridge: Broadcom Inc. and subsidiaries BCM2711 PCIe Bridge (rev 10)
	0000:00:00.0/01:00.0 USB controller: VIA Technologies, Inc. VL805/806 xHCI USB 3.0 Controller (rev 01)

It should look like this:

	&pcie0 {
		pci@0,0 {
			device_type = "pci";
			#address-cells = <3>;
			#size-cells = <2>;
			ranges;

			reg = <0 0 0 0 0>;

			usb@0,0 {
				reg = <0 0 0 0 0>;
				resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>;
			};
		};
	};

Thanks!

-- 
Nicolás Sáenz


  parent reply	other threads:[~2021-08-30 16:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30 10:39 [PATCH] ARM: dts: bcm2711-rpi-4-b: Fix pcie0's unit address Nicolas Saenz Julienne
2021-08-30 13:39 ` Rob Herring
2021-08-30 13:52   ` nsaenzju
2021-08-30 16:45   ` nsaenzju [this message]
2021-08-30 21:56     ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22bbfdefb2b9a1a65a807d0aecee67e607b7ff60.camel@redhat.com \
    --to=nsaenzju@redhat.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=robh@kernel.org \
    --cc=stefan.wahren@i2se.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox