devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
To: Chris Packham <chrisp-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
Cc: "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"florian-p3rKhJxN3npAfugRpC6u6w@public.gmane.org"
	<florian-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>,
	"davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org"
	<davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
	"linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org"
	<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: Re: Associating nodes with phandles for pci devices
Date: Mon, 26 Jan 2015 11:57:59 +0100	[thread overview]
Message-ID: <1519004.ps1fNkyql1@wuerfel> (raw)
In-Reply-To: <alpine.DEB.2.10.1501240828280.14228-VJzQ50X1/JKjhWACt5bsBotlCAj8ZROq@public.gmane.org>

On Saturday 24 January 2015 08:38:12 Chris Packham wrote:
> 
> Can you think of a good example. I found a few ppc boards that have an 
> PCI-ISA bridge that get's enumerated in the .dts. I think I can make sense
> of them but because they are bridges there's a lot of extra stuff for the 
> down stream devices.

I found a copy of the standard document at:

http://www.o3one.org/hwdocs/openfirmware/pci_supplement_2_1.pdf

I believe the only property we require in order to connect a Linux PCI
device to a device node is 'reg', which is in a very special format
for PCI devices, as there are three cells that encode all sorts of
information. In this case, you only need the 'device' and 'function'
bits to match. The bus numbers can be reassigned on probing the
buses, and the structure is implied by the device/function numbers of
the parents all the way up to the host bridge (if you have multiple
bridges at all).

Something like

	pci@1230000 {
		device_type = "pci";
		ranges = ...
		#address-cells = <3>;
		#size-cells = <2>;

		dsa@01,0 { /* device 1, function 0 */
			reg = <0x00000800 0 0  0 0>;
		};
		dsa@01,1 { /* device 1, function 1 */
			reg = <0x00000900 0 0  0 0>;
		};
	};

The above follows the "DD,F" naming for unit strings in PCI devices
as in section 2.2.1.2 of that document. If you only have one function,
this can be shortened to just the device number, which is in bits
11-15 of the first word of the reg property.

Note that the binding is meant to encode all the probing information,
so it documents how to represent everything from the config space
in properties, but we don't actually use that for probing in Linux
and instead rely on a very reduced interpretation of the binding.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2015-01-26 10:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23 19:02 Associating nodes with phandles for pci devices Chris Packham
     [not found] ` <9bcf67ede60f4567a396c05578cfceb7-5g7mGxlPNYb6GjIOKuZY+ItlCAj8ZROq@public.gmane.org>
2015-01-23 19:15   ` Arnd Bergmann
2015-01-23 19:38     ` Chris Packham
     [not found]       ` <alpine.DEB.2.10.1501240828280.14228-VJzQ50X1/JKjhWACt5bsBotlCAj8ZROq@public.gmane.org>
2015-01-23 22:40         ` Florian Fainelli
     [not found]           ` <54C2CDE6.8090400-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2015-03-08 22:01             ` Chris Packham
     [not found]               ` <54FCC6AC.4030202-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
2015-03-08 22:42                 ` Arnd Bergmann
2015-03-08 23:03                   ` Chris Packham
     [not found]                     ` <54FCD53D.7080700-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org>
2015-03-09  3:40                       ` Florian Fainelli
     [not found]                         ` <CAGVrzcYF266X-mUsfPtAr_jjJ3JW-TTHrKkznsnCCfrCzuf+qw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-09  5:19                           ` Chris Packham
2015-01-26 10:57         ` Arnd Bergmann [this message]

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=1519004.ps1fNkyql1@wuerfel \
    --to=arnd-r2ngtmty4d4@public.gmane.org \
    --cc=chrisp-6g8wRflRTwXFdCa3tKVlE6U/zSkkHjvu@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=florian-p3rKhJxN3npAfugRpC6u6w@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).