All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: uartps: Initialize ports according to aliases
@ 2014-01-23 14:45 ` Michal Simek
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2014-01-23 14:45 UTC (permalink / raw)
  To: linux-kernel, monstr
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, linux-arm-kernel

[-- 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 --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] tty: uartps: Initialize ports according to aliases
@ 2014-01-23 14:45 ` Michal Simek
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2014-01-23 14:45 UTC (permalink / raw)
  To: linux-arm-kernel

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>

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] tty: uartps: Initialize ports according to aliases
  2014-01-23 14:45 ` Michal Simek
@ 2014-01-23 14:49   ` Michal Simek
  -1 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2014-01-23 14:49 UTC (permalink / raw)
  To: Michal Simek
  Cc: linux-kernel, Greg Kroah-Hartman, Jiri Slaby, linux-serial,
	linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 711 bytes --]

On 01/23/2014 03:45 PM, Michal Simek wrote:
> 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>
> ---

oou - Ignore this version - will send v2.

Sorry,
Michal


-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] tty: uartps: Initialize ports according to aliases
@ 2014-01-23 14:49   ` Michal Simek
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2014-01-23 14:49 UTC (permalink / raw)
  To: linux-arm-kernel

On 01/23/2014 03:45 PM, Michal Simek wrote:
> 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>
> ---

oou - Ignore this version - will send v2.

Sorry,
Michal


-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140123/6108878a/attachment-0001.sig>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-01-23 14:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-23 14:45 [PATCH] tty: uartps: Initialize ports according to aliases Michal Simek
2014-01-23 14:45 ` Michal Simek
2014-01-23 14:49 ` Michal Simek
2014-01-23 14:49   ` Michal Simek

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.