public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Curt Brune <curt@cumulusnetworks•com>
To: Segher Boessenkool <segher@kernel•crashing.org>
Cc: galak@codeaurora•org, ijc+devicetree@hellion•org.uk,
	mark.rutland@arm•com, pawel.moll@arm•com,
	benh@kernel•crashing.org, paulus@samba•org, mpe@ellerman•id.au,
	robh+dt@kernel•org, devicetree@vger•kernel.org,
	linuxppc-dev@lists•ozlabs.org
Subject: Re: [RFC 1/1] powerpc: legacy serial port use device tree cell-index property
Date: Wed, 30 Dec 2015 08:36:01 -0800	[thread overview]
Message-ID: <20151230163601.GX14046@cumulusnetworks.com> (raw)
In-Reply-To: <20151220150225.GA27380@gate.crashing.org>

On Sun Dec 20 09:02, Segher Boessenkool wrote:
> On Wed, Nov 25, 2015 at 10:46:49AM -0800, Curt Brune wrote:
> > +	/* Check if the ports have an ordering, defined by 'cell-index' */
> > +	if (((indexp = (u32*)of_get_property(np, "cell-index", &len)) != NULL) &&
> > +	    (len == sizeof(u32)))
> > +		index = *indexp;
> > +
> >  	/* Add port, irq will be dealt with later. We passed a translated
> >  	 * IO port value. It will be fixed up later along with the irq
> >  	 */
> >  	if (tsi && !strcmp(tsi->type, "tsi-bridge"))
> > -		return add_legacy_port(np, -1, UPIO_TSI, addr, addr,
> > +		return add_legacy_port(np, index, UPIO_TSI, addr, addr,
> >  				       NO_IRQ, legacy_port_flags, 0);
> >  	else
> > -		return add_legacy_port(np, -1, UPIO_MEM, addr, addr,
> > +		return add_legacy_port(np, index, UPIO_MEM, addr, addr,
> >  				       NO_IRQ, legacy_port_flags, 0);
> 
> What does this do if the value in cell-index is a duplicate. or the port
> with that number is already created some other way?  Are the numbers in
> cell-index global anyway, or relative to some parent device (I couldn't
> find the documentation for this).
> 
> 
> Segher

add_legacy_port() has support for handling duplicate index entries.
Reading that code it looks like the recent entry wins and the older
entry is moved to the next available index.

The numbers in cell-index are not global nor explicitly relative to a
parent device.  I also could not find documentation on this.

In common usage, however, the cell-index property is used in two
different ways:

1.  For devices that have "channels" or "regions" (DMA for example),
the parent device node has child nodes enumerated by cell-index.  For
example see:  arch/powerpc/boot/dts/fsl/pq3-dma-0.dtsi

2.  For multiple instances of a device, for example UARTS,
each device node is enumerated using cell-index.  See:
arch/powerpc/boot/dts/fsl/qoriq-duart-0.dtsi

Cheers,
Curt

  reply	other threads:[~2015-12-30 16:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25 18:46 [RFC 1/1] powerpc: legacy serial port use device tree cell-index property Curt Brune
2015-12-20 15:02 ` Segher Boessenkool
2015-12-30 16:36   ` Curt Brune [this message]
2015-12-30 20:12     ` Segher Boessenkool
2015-12-22  3:42 ` Scott Wood
2015-12-30 16:37   ` Curt Brune
2015-12-30 22:34 ` 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=20151230163601.GX14046@cumulusnetworks.com \
    --to=curt@cumulusnetworks$(echo .)com \
    --cc=benh@kernel$(echo .)crashing.org \
    --cc=devicetree@vger$(echo .)kernel.org \
    --cc=galak@codeaurora$(echo .)org \
    --cc=ijc+devicetree@hellion$(echo .)org.uk \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=mark.rutland@arm$(echo .)com \
    --cc=mpe@ellerman$(echo .)id.au \
    --cc=paulus@samba$(echo .)org \
    --cc=pawel.moll@arm$(echo .)com \
    --cc=robh+dt@kernel$(echo .)org \
    --cc=segher@kernel$(echo .)crashing.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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