public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: John Linn <john.linn@xilinx•com>
To: linuxppc-dev@ozlabs•org
Cc: John Linn <john.linn@xilinx•com>
Subject: [PATCH 3/3] [POWERPC] Xilinx: boot support for Xilinx uart 16550.
Date: Thu, 20 Mar 2008 07:43:52 -0700	[thread overview]
Message-ID: <20080320144402.695C1518064@mail63-sin.bigfish.com> (raw)
In-Reply-To: <1206024232655-git-send-email-john.linn@xilinx.com>

The Xilinx 16550 uart core is not a standard 16550, because it uses
word-based addressing rather than byte-based addressing.  As a result,
it is not compatible with the open firmware 'ns16550' compatible
binding.

This code adds the Xilinx uart 16550 to the serial console
of the boot. A new initialization function for the Xilinx 16550 uart
is added to the ns16550 driver. It sets up the correct register base
and regshift properties specific to the Xilinx 16550.

Signed-off-by: John Linn <john.linn@xilinx•com>
---
 arch/powerpc/boot/ns16550.c |   24 ++++++++++++++++++++++++
 arch/powerpc/boot/ops.h     |    1 +
 arch/powerpc/boot/serial.c  |    8 ++++++++
 3 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/ns16550.c b/arch/powerpc/boot/ns16550.c
index f8f1b2f..5385255 100644
--- a/arch/powerpc/boot/ns16550.c
+++ b/arch/powerpc/boot/ns16550.c
@@ -77,3 +77,27 @@ int ns16550_console_init(void *devp, struct serial_console_data *scdp)
 
 	return 0;
 }
+
+int xilinx16550_console_init(void *devp, struct serial_console_data *scdp)
+{
+	int n;
+	unsigned long reg_phys;
+
+	n = getprop(devp, "virtual-reg", &reg_base, sizeof(reg_base));
+	if (n != sizeof(reg_base)) {
+		if (!dt_xlate_reg(devp, 0, &reg_phys, NULL))
+			return -1;
+
+		reg_base = (void *)reg_phys + 3;
+	}
+
+	reg_shift = 2;
+
+	scdp->open = ns16550_open;
+	scdp->putc = ns16550_putc;
+	scdp->getc = ns16550_getc;
+	scdp->tstc = ns16550_tstc;
+	scdp->close = NULL;
+
+	return 0;
+}
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
index a180b65..d8b864b 100644
--- a/arch/powerpc/boot/ops.h
+++ b/arch/powerpc/boot/ops.h
@@ -86,6 +86,7 @@ int mpsc_console_init(void *devp, struct serial_console_data *scdp);
 int cpm_console_init(void *devp, struct serial_console_data *scdp);
 int mpc5200_psc_console_init(void *devp, struct serial_console_data *scdp);
 int uartlite_console_init(void *devp, struct serial_console_data *scdp);
+int xilinx16550_console_init(void *devp, struct serial_console_data *scdp);
 void *simple_alloc_init(char *base, unsigned long heap_size,
 			unsigned long granularity, unsigned long max_allocs);
 extern void flush_cache(void *, unsigned long);
diff --git a/arch/powerpc/boot/serial.c b/arch/powerpc/boot/serial.c
index 7fa5078..fb5c91e 100644
--- a/arch/powerpc/boot/serial.c
+++ b/arch/powerpc/boot/serial.c
@@ -131,6 +131,14 @@ int serial_console_init(void)
 	else if (dt_is_compatible(devp, "xlnx,opb-uartlite-1.00.b") ||
                  dt_is_compatible(devp, "xlnx,xps-uartlite-1.00.a"))
 		rc = uartlite_console_init(devp, &serial_cd);
+	else if (dt_is_compatible(devp, "xlnx,opb-uart16550-1.00.c") ||
+		 dt_is_compatible(devp, "xlnx,opb-uart16550-1.00.d") ||
+		 dt_is_compatible(devp, "xlnx,opb-uart16550-1.00.e") ||
+		 dt_is_compatible(devp, "xlnx,plb-uart16550-1.00.c") ||
+		 dt_is_compatible(devp, "xlnx,xps-uart16550-1.00.a") ||
+		 dt_is_compatible(devp, "xlnx,xps-uart16550-2.00.a") ||
+		 dt_is_compatible(devp, "xlnx,xps-uart16550-2.00.b"))
+		rc = xilinx16550_console_init(devp, &serial_cd);
 
 	/* Add other serial console driver calls here */
 
-- 
1.5.2.1

  parent reply	other threads:[~2008-03-20 14:44 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <12060242324116-git-send-email-john.linn@xilinx.com>
2008-03-20 14:43 ` [PATCH 2/3] [POWERPC] Xilinx: of_serial support for Xilinx uart 16550 John Linn
2008-03-21  0:19   ` Grant Likely
2008-03-21  9:21     ` Paul Mackerras
2008-03-21 11:39       ` Segher Boessenkool
2008-03-21 16:08         ` [PATCH 2/3] [POWERPC] Xilinx: of_serial support for Xilinx uart16550 Stephen Neuendorffer
2008-03-21 16:48           ` Segher Boessenkool
2008-03-22 14:50       ` [PATCH 2/3] [POWERPC] Xilinx: of_serial support for Xilinx uart 16550 Grant Likely
2008-03-22 16:06         ` Sergei Shtylyov
2008-03-24 14:09         ` Sergei Shtylyov
2008-03-24 14:27           ` Grant Likely
2008-03-24 16:15             ` Sergei Shtylyov
2008-03-24 16:48               ` Grant Likely
2008-03-24 17:03               ` Sergei Shtylyov
2008-03-25 22:48                 ` John Linn
2008-03-21 13:00     ` Sergei Shtylyov
2008-03-21 15:37       ` Segher Boessenkool
2008-03-21 15:54         ` Sergei Shtylyov
2008-03-21 16:45           ` Segher Boessenkool
2008-03-21 16:50             ` [PATCH 2/3] [POWERPC] Xilinx: of_serial support for Xilinx uart16550 Stephen Neuendorffer
2008-03-21 17:01             ` [PATCH 2/3] [POWERPC] Xilinx: of_serial support for Xilinx uart 16550 Sergei Shtylyov
2008-03-22 15:06       ` Grant Likely
2008-03-22 16:40         ` Sergei Shtylyov
2008-03-21 16:14     ` [PATCH 2/3] [POWERPC] Xilinx: of_serial support for Xilinx uart16550 Stephen Neuendorffer
     [not found] ` <1206024232655-git-send-email-john.linn@xilinx.com>
2008-03-20 14:43   ` John Linn [this message]
2008-03-20 14:54     ` [PATCH 3/3] [POWERPC] Xilinx: boot support for Xilinx uart 16550 Grant Likely
2008-03-20 16:15       ` John Linn
2008-03-20 21:18         ` Grant Likely
     [not found]       ` <20080320175601.5D86217C8055@mail127-sin.bigfish.com>
2008-03-20 21:07         ` Grant Likely
2008-03-20 22:04     ` Grant Likely

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=20080320144402.695C1518064@mail63-sin.bigfish.com \
    --to=john.linn@xilinx$(echo .)com \
    --cc=linuxppc-dev@ozlabs$(echo .)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