Skip to contentSkip to conversation

: tsi108 serial port support

PATCH New DENX Support System 1 participant 1 message Jul 28, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 8/8 : tsi108 serial port support

Hello list,

inside the automatic U-Boot patch tracking system a new ticket [DNX#2006072842000061] was created:

<snip>

Quoted 90 lines

tsi108 serial port support.

From 9600fae3923ce41269eb273116ad6080847512bc Mon Sep 17 00:00:00 2001
From: roy zang <[email protected]>
Date: Fri, 28 Jul 2006 15:33:02 +0800
Subject: [PATCH] tsi108 serial port support

---
 board/mpc7448hpc2/ns16550.c |   77 ++++++++++++++++++++++++++++++++++
 board/mpc7448hpc2/ns16550.h |   98
+++++++++++++++++++++++++++++++++++++++++++
 board/mpc7448hpc2/serial.c |  117
++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 292 insertions(+), 0 deletions(-)
board/mpc7448hpc2/ns16550.c new file +16 -0
new file mode 100644
index 0000000..47e01f7
@@ -0,0 +1,77 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+

*-----------------------------------------------------------------------
--
+ * COM1 NS16550 support
+ * originally from linux source (arch/ppc/boot/ns16550.c)
+ * modified to use CFG_ISA_MEM and new defines
+ *
+ * further modified by Josh Huber <[email protected]> to support
+ * the DUART on the Galileo Eval board. (db64360)
+ */

board/mpc7448hpc2/ns16550.c new file +26 -0
+
+#include <config.h>
+#include "ns16550.h"
+
+const NS16550_t COM_PORTS[] = { (NS16550_t) (CFG_DUART_IO + 0),
+	(NS16550_t) (CFG_DUART_IO + 0x400)
+};
+
+volatile struct NS16550 *NS16550_init(int chan, int baud_divisor)
+{
+	volatile struct NS16550 *com_port;
+
+	com_port = (struct NS16550 *)COM_PORTS[chan];
+	com_port->ier = 0x00;
+	com_port->lcr = LCR_BKSE;	/* Access baud rate */
+	com_port->dll = baud_divisor & 0xff;	/* 9600 baud */
+	com_port->dlm = (baud_divisor >> 8) & 0xff;
+	com_port->lcr = LCR_8N1;	/* 8 data, 1 stop, no parity */
+	com_port->mcr = MCR_DTR | MCR_RTS;	/* RTS/DTR */
+
+	/* Clear & enable FIFOs */
+	com_port->fcr = FCR_FIFO_EN | FCR_RXSR | FCR_TXSR;
+	return (com_port);
+}
+
+void NS16550_reinit(volatile struct NS16550 *com_port, int

baud_divisor)

board/mpc7448hpc2/ns16550.c new file +15 -0
+{
+	com_port->ier = 0x00;
+	com_port->lcr = LCR_BKSE;	/* Access baud rate */
+	com_port->dll = baud_divisor & 0xff;	/* 9600 baud */
+	com_port->dlm = (baud_divisor >> 8) & 0xff;
+	com_port->lcr = LCR_8N1;	/* 8 data, 1 stop, no parity */
+	com_port->mcr = MCR_DTR | MCR_RTS;	/* RTS/DTR */
+
+	/* Clear & enable FIFOs */
+	com_port->fcr = FCR_FIFO_EN | FCR_RXSR | FCR_TXSR;
+}
+
+void NS16550_putc(volatile struct NS16550 *com_port, unsigned char c)
+{
+	while ((com_port->lsr & LSR_THRE) == 0) ;

board/mpc7448hpc2/ns16550.c

Quoted 10 lines
board/mpc7448hpc2/ns16550.c new file +10 -0
+	com_port->thr = c;
+}
+
+unsigned char NS16550_getc(volatile struct NS16550 *com_port)
+{
+	while ((com_port->lsr & LSR_DR) == 0) ;
+	return (com_port->rbr);
+}
+
+int NS16550_tstc(volatile struct NS16550 *com_port)

</snip>

Your U-Boot support team