public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Peter Korsgaard <jacmet@sunsite•dk>
To: linuxppc-embedded@ozlabs•org
Subject: Re: [PATCH] Xilinx UART Lite 2.6.18 driver
Date: Mon, 06 Nov 2006 16:44:16 +0100	[thread overview]
Message-ID: <87u01czijz.fsf@sleipner.barco.com> (raw)
In-Reply-To: <609d5c8e0610301145y30d058afs467d27d344149936@mail.gmail.com> (David Bolcsfoldi's message of "Mon, 30 Oct 2006 11:45:45 -0800")

>>>>> "David" == David Bolcsfoldi <dbolcsfoldi@gmail•com> writes:

Hi,
>> This doesn't help much as you don't use the com_port argument in
>> the other functions.

David> True, it's utterly useless. I was planning on having an array
David> with base addresses which would be used to support the com_port
David> argument.  But it didn't make it in this patch although I have
David> version that does this now.

You don't even need an array - you can use use the base address as the
com_port cookie, E.G.:

--- /dev/null
+++ linux-trunk/arch/ppc/boot/simple/uartlite_tty.c
@@ -0,0 +1,86 @@
+/*
+ * Boot support for Xilinx uartlite
+ *
+ * Copyright (C) 2006 David Bolcsfoldi <dbolcsfoldi@gmail•com>
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include <asm/io.h>
+#include <linux/serial_uartlite.h>
+#include <platforms/4xx/xparameters/xparameters.h>
+
+unsigned long serial_init(int chan, void *ignored)
+{
+	unsigned long com_port = 0;
+
+	switch (chan)  {
+#ifdef XPAR_UARTLITE_0_BASEADDR
+	case 0:
+		com_port = XPAR_UARTLITE_0_BASEADDR + 3;
+		break;
+#endif
+#ifdef XPAR_UARTLITE_1_BASEADDR
+	case 1:
+		com_port = XPAR_UARTLITE_1_BASEADDR + 3;
+		break;
+#endif
+#ifdef XPAR_UARTLITE_2_BASEADDR
+	case 2:
+		com_port = XPAR_UARTLITE_2_BASEADDR + 3;
+		break;
+#endif
+#ifdef XPAR_UARTLITE_3_BASEADDR
+	case 3:
+		com_port = XPAR_UARTLITE_3_BASEADDR + 3;
+		break;
+#endif
+	default:
+		break;
+	}
+
+	if (com_port) {
+		void __iomem *base = (void __iomem*)com_port;
+		writeb(0, base + ULITE_CONTROL);
+		writeb(ULITE_CONTROL_RST_RX | ULITE_CONTROL_RST_TX,
+		       base + ULITE_CONTROL);
+		writeb(0, base + ULITE_CONTROL);
+	}
+
+	return com_port;
+}
+
+
+int serial_tstc(unsigned long com_port)
+{
+	void __iomem *base = (void __iomem*)com_port;
+
+	if (base)
+		return readb(base + ULITE_STATUS) & ULITE_STATUS_RXVALID;
+	else
+		return 0;
+}
+
+void serial_putc(unsigned long com_port, unsigned char c)
+{
+	void __iomem *base = (void __iomem*)com_port;
+
+	if (base) {
+		while (readb(base + ULITE_STATUS) & ULITE_STATUS_TXFULL);
+		writeb(c, base + ULITE_TX);
+	}
+}
+
+unsigned char serial_getc(unsigned long com_port)
+{
+	void __iomem *base = (void __iomem*)com_port;
+
+	if (base) {
+		while (!serial_tstc(com_port));
+		return readb(base + ULITE_RX);
+	}
+	else
+		return 0;
+}


>> Where did you get the XPAR_XUL_UART_ defines from? Our
>> xparameters.h seem to contain XPAR_UARTLITE_ defines instead.

David> I think that name is picked up from the name of the device in your
David> design, the defines get names XPAR_NNN_ and mine are called
David> XUL_UART.

Crap - Ok, then people just have to add linux-compatible defines to
the end of their xparameters.h - E.G
#define XPAR_UARTLITE_0_BASEADDR XPAR_XUL_UART_BASEADDR

>> You can always use the ppc_md.progress() stuff for really early
>> debugging if needed. I would prefer to keep this workaround out of
>> uartlite.c if it isn't needed.

David> I am pretty certain probe won't get called until ppc_sys_init has been
David> called which is fairly far into the booting process and even if
David> it did the platform_bus hasn't been initialized before the
David> ppc_sys_init is called, at least not with any of the devices
David> exported by ppc_sys_devices.

True. For really early stuff you'll need to use ppc_md.progress() (or
some additional hacking)

David> Thanks for the review!  David

You're welcome.

-- 
Bye, Peter Korsgaard

  reply	other threads:[~2006-11-06 15:44 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-10 20:49 [PATCH] Xilinx UART Lite 2.6.18 driver David Bolcsfoldi
2006-10-10 22:04 ` Grant Likely
2006-10-11 22:06 ` David H. Lynch Jr.
2006-10-12 10:34 ` Peter Korsgaard
2006-10-12 21:12   ` David Bolcsfoldi
2006-10-13  5:21     ` David Bolcsfoldi
2006-10-13  7:04       ` David H. Lynch Jr.
2006-10-13  7:22         ` Peter Korsgaard
     [not found]           ` <45329C42.3030000@dlasys.net>
2006-10-16 19:42             ` Peter Korsgaard
2006-10-13  7:11       ` Peter Korsgaard
2006-10-15 23:48         ` David Bolcsfoldi
2006-10-20 19:41           ` Peter Korsgaard
2006-10-27 15:03             ` Peter Korsgaard
2006-10-28  3:29               ` David H. Lynch Jr.
2006-10-30  8:23                 ` Peter Korsgaard
2006-10-31 17:26                   ` David H. Lynch Jr.
2006-10-30 19:45               ` David Bolcsfoldi
2006-11-06 15:44                 ` Peter Korsgaard [this message]
2006-10-13  6:48     ` David H. Lynch Jr.
2006-10-13  7:15       ` Peter Korsgaard
2006-10-15 21:02         ` David H. Lynch Jr.
2006-10-16 19:49           ` Peter Korsgaard
2006-10-16 19:52           ` Peter Korsgaard
2006-10-13  7:08     ` Peter Korsgaard

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=87u01czijz.fsf@sleipner.barco.com \
    --to=jacmet@sunsite$(echo .)dk \
    --cc=linuxppc-embedded@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