Subject: Re: [PATCH] Device tree bindings for Xilinx devices

From: David Gibson <[email-masked]>
Date: Thu, 11 Oct 2007 15:08:50 +1000

On Wed, Oct 10, 2007 at 10:58:25PM -0600, Grant Likely wrote:
> On 10/10/07, David Gibson <[email-masked]> wrote:
> > On Wed, Oct 10, 2007 at 10:18:50PM -0600, Grant Likely wrote:
> > > On 10/10/07, David Gibson <[email-masked]> wrote:
> > > > On Wed, Oct 10, 2007 at 08:25:36PM -0600, Grant Likely wrote:
> > > > > On 10/10/07, David Gibson <[email-masked]> wrote:
> > > > > > We've used 'cell-index' for similar purposes on other 4xx.
> > > > >
> > > > > Unfortunately, 'cell' has been used in the sense of a logic cell in an
> > > > > SoC.  In the case of the SystemACE, it is an external chip.
> > > > >
> > > > > What about "device-number"?
> > > >
> > > > Ok, I misunderstood.  If it's not on chip, what significance does this
> > > > serial number have?  Where would a driver need it?
> > >
> > > If there were 2 systemace devices on board; one attached to a CF slot
> > > labeled "1" and the other to one labeled "2".  :-)  Same problem as
> > > lining up serial device files to physical port numbers.
> > >
> > > The driver doesn't technically need it, but the information does need
> > > to flow through to the creation of logically numbered device files.
> >
> > Ah.  Then, I'm afraid it doesn't belong in the core binding.
> >
> > Preferably, you should just figure out something without help of this
> > property - plenty of other things have to figure out device names
> > without assistance like this.
> 
> I'm not too stuck on the method used, but I do think it is appropriate
> to encode this kind of data in the device tree in some form...
> However, for this particular device I'm probably just borrowing
> trouble.  I'll drop the property.
> 
> My main concern is that I don't like the implicit numbering that
> occurs simply based on the order of devices in the device tree.  If
> the probe algorithm ever changes to parse in reverse order or
> something reorders the tree, then the device numbers also change.  :-(

Way of the future, apparently, everything's supposed to use udev to
give things logical names.  No, I'm not thrilled at the prospect
either.

> I'd rather be explicit.  In fact I've already been bitten by this
> where the mpc5200 has 6 PSC, each of which can be configured as a
> serial port.  However, I've got access to 3 different boards; each of
> which has the logical port numbers 100% unrelated to the 'cell'
> number.

In any case, this can't really belong in a *device* binding.  Because
the numbering has to cross devices of the same basic type, but
different implementations.  Where "basic type" is based on how device
names are allocated, and is thus inherently Linux specific.

> > If you really must you could do this in analogy with the
> > "linux,network-index" property - but this would be, as that is, an
> > ugly hack, and should be recognized as such
> >
> > Segher's suggestion of using OF-style aliases for this is a fairly
> > good one, actually.  I just need to get to implementing it...
> 
> /me needs to look up what that look like and how I would use it.  My
> knowledge of OF is sadly lacking.

Short version by example:
/ {
	/* ... */
	aliases {
		hd = "/pci@f0000000/sata@f4000000/....";
		enet0 = "/soc/ethernet@c000";
		enet1 = "/soc/ethernet@d000";
		enet2 = "/pci@f0000000/isa/ethernet@i480"
		ttya = "/soc/serial@e000";
		ttyb = "/pci/isa/serail@3f8";
	}
}

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson