From: DENX Support System Date: Fri, 28 Jul 2006 12:00:05 +0200 Subject: [U-Boot-Users] [DNX#2006072842000061] [PATCH 08/08]: tsi108 serial port support Message-ID: <1154080805.221457.482840182@castor.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello list, inside the automatic U-Boot patch tracking system a new ticket [DNX#2006072842000061] was created: > tsi108 serial port support. > > Signed-off-by: Alexandre Bounine > Signed-off-by: Roy Zang > > From 9600fae3923ce41269eb273116ad6080847512bc Mon Sep 17 00:00:00 2001 > From: roy zang > 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(-) > > diff --git a/board/mpc7448hpc2/ns16550.c b/board/mpc7448hpc2/ns16550.c > new file mode 100644 > index 0000000..47e01f7 > --- /dev/null > +++ b/board/mpc7448hpc2/ns16550.c > @@ -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 to support > + * the DUART on the Galileo Eval board. (db64360) > + */ > + > +#include > +#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) > +{ > + 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) ; > + 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) Your U-Boot support team