From: Scott Wood <scottwood@freescale.com>
To: Curt Brune <curt@cumulusnetworks.com>, <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>
Cc: <linuxppc-dev@lists.ozlabs.org>, <devicetree@vger.kernel.org>
Subject: Re: [RFC 1/1] powerpc: legacy serial port use device tree cell-index property
Date: Mon, 21 Dec 2015 21:42:11 -0600 [thread overview]
Message-ID: <1450755731.18314.76.camel@freescale.com> (raw)
In-Reply-To: <1448477209-22340-2-git-send-email-curt@cumulusnetworks.com>
On Wed, 2015-11-25 at 10:46 -0800, Curt Brune wrote:
> Currently for PowerPC systems using device tree, the legacy serial
> ports are allocated in the order by which they are found in the device
> tree structure.
>
> This can cause problems in cases where the device tree nodes are
> sysnthesized by an external program (kexec for example), which may not
> preserve the original order of the device tree nodes. This in turn
> can result in the serial console changing from ttyS0 to ttyS1
> unexpectedly.
>
> This patch uses the 'cell-index' property (if present) to map UART
> device tree nodes to legacy serial port number. The cell-index
> property is widely used in all the Freescale .dts files for PowerPC.
>
> Signed-off-by: Curt Brune <curt@cumulusnetworks.com>
> ---
> arch/powerpc/kernel/legacy_serial.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/kernel/legacy_serial.c
> b/arch/powerpc/kernel/legacy_serial.c
> index 7b750c4..b717133 100644
> --- a/arch/powerpc/kernel/legacy_serial.c
> +++ b/arch/powerpc/kernel/legacy_serial.c
> @@ -164,6 +164,8 @@ static int __init add_legacy_soc_port(struct device_node
> *np,
> u64 addr;
> const __be32 *addrp;
> struct device_node *tsi = of_get_parent(np);
> + int index = -1, len;
> + u32 *indexp;
>
> /* We only support ports that have a clock frequency properly
> * encoded in the device-tree.
> @@ -188,14 +190,19 @@ static int __init add_legacy_soc_port(struct
> device_node *np,
> if (addr == OF_BAD_ADDR)
> return -1;
>
> + /* 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;
const u32 *
Or better, use of_read_number() or similar.
-Scott
next prev parent reply other threads:[~2015-12-22 3:42 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
2015-12-30 20:12 ` Segher Boessenkool
2015-12-22 3:42 ` Scott Wood [this message]
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=1450755731.18314.76.camel@freescale.com \
--to=scottwood@freescale.com \
--cc=benh@kernel.crashing.org \
--cc=curt@cumulusnetworks.com \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mark.rutland@arm.com \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.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).