From: Michal Simek <michal.simek@xilinx.com> To: linux-kernel@vger.kernel.org, monstr@monstr.eu Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jiri Slaby <jslaby@suse.cz>, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] tty: uartps: Initialize ports according to aliases Date: Thu, 23 Jan 2014 15:45:14 +0100 [thread overview] Message-ID: <c1882ea5f2e45b19cc1930b624254cb1b59b2fe0.1390488303.git.michal.simek@xilinx.com> (raw) [-- Attachment #1: Type: text/plain, Size: 1290 bytes --] Register port numbers according to order in DT aliases. If aliases are not defined, order in DT is used. If aliases are defined, register port id based on that. This patch ensures proper ttyPS0/1 assignment. Signed-off-by: Michal Simek <michal.simek@xilinx.com> --- drivers/tty/serial/xilinx_uartps.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 528f16a..8c09a3b 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -1038,10 +1038,20 @@ static struct uart_port *xuartps_get_port(void) struct uart_port *port; int id; - /* Find the next unused port */ - for (id = 0; id < XUARTPS_NR_PORTS; id++) - if (xuartps_port[id].mapbase == 0) - break; + /* Look for a serialN alias */ + id = of_alias_get_id(pdev->dev.of_node, "serial"); + if (id < 0) { + dev_warn(&pdev->dev, "failed to get alias id, errno %d\n", id); + id = 0; + } + + /* Try the given port id if failed use default method */ + if (xuartps_port[id].mapbase != 0) { + /* Find the next unused port */ + for (id = 0; id < XUARTPS_NR_PORTS; id++) + if (xuartps_port[id].mapbase == 0) + break; + } if (id >= XUARTPS_NR_PORTS) return NULL; -- 1.8.2.3 [-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: michal.simek@xilinx.com (Michal Simek) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] tty: uartps: Initialize ports according to aliases Date: Thu, 23 Jan 2014 15:45:14 +0100 [thread overview] Message-ID: <c1882ea5f2e45b19cc1930b624254cb1b59b2fe0.1390488303.git.michal.simek@xilinx.com> (raw) Register port numbers according to order in DT aliases. If aliases are not defined, order in DT is used. If aliases are defined, register port id based on that. This patch ensures proper ttyPS0/1 assignment. Signed-off-by: Michal Simek <michal.simek@xilinx.com> --- drivers/tty/serial/xilinx_uartps.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 528f16a..8c09a3b 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -1038,10 +1038,20 @@ static struct uart_port *xuartps_get_port(void) struct uart_port *port; int id; - /* Find the next unused port */ - for (id = 0; id < XUARTPS_NR_PORTS; id++) - if (xuartps_port[id].mapbase == 0) - break; + /* Look for a serialN alias */ + id = of_alias_get_id(pdev->dev.of_node, "serial"); + if (id < 0) { + dev_warn(&pdev->dev, "failed to get alias id, errno %d\n", id); + id = 0; + } + + /* Try the given port id if failed use default method */ + if (xuartps_port[id].mapbase != 0) { + /* Find the next unused port */ + for (id = 0; id < XUARTPS_NR_PORTS; id++) + if (xuartps_port[id].mapbase == 0) + break; + } if (id >= XUARTPS_NR_PORTS) return NULL; -- 1.8.2.3 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140123/45598a8d/attachment.sig>
next reply other threads:[~2014-01-23 14:45 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-01-23 14:45 Michal Simek [this message] 2014-01-23 14:45 ` [PATCH] tty: uartps: Initialize ports according to aliases Michal Simek 2014-01-23 14:49 ` Michal Simek 2014-01-23 14:49 ` Michal Simek
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=c1882ea5f2e45b19cc1930b624254cb1b59b2fe0.1390488303.git.michal.simek@xilinx.com \ --to=michal.simek@xilinx.com \ --cc=gregkh@linuxfoundation.org \ --cc=jslaby@suse.cz \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-serial@vger.kernel.org \ --cc=monstr@monstr.eu \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.