diff options
Diffstat (limited to 'drivers/serial')
| -rw-r--r-- | drivers/serial/Makefile | 1 | ||||
| -rw-r--r-- | drivers/serial/ns16550.c | 25 | ||||
| -rw-r--r-- | drivers/serial/s3c64xx.c | 187 | ||||
| -rw-r--r-- | drivers/serial/serial.c | 2 | ||||
| -rw-r--r-- | drivers/serial/usbtty.c | 6 | 
5 files changed, 23 insertions, 198 deletions
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index de3f47199..fbc4e97e9 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile @@ -35,7 +35,6 @@ COBJS-$(CONFIG_LPC32XX_HSUART) += lpc32xx_hsuart.o  COBJS-$(CONFIG_MCFUART) += mcfuart.o  COBJS-$(CONFIG_OPENCORES_YANU) += opencores_yanu.o  COBJS-$(CONFIG_SYS_NS16550) += ns16550.o -COBJS-$(CONFIG_S3C64XX) += s3c64xx.o  COBJS-$(CONFIG_S5P) += serial_s5p.o  COBJS-$(CONFIG_SYS_NS16550_SERIAL) += serial_ns16550.o  COBJS-$(CONFIG_IMX_SERIAL) += serial_imx.o diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 87a091708..7f013ab33 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -36,17 +36,31 @@  void NS16550_init(NS16550_t com_port, int baud_divisor)  { -#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT)) +#if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_OMAP34XX)) +	/* +	 * On some OMAP3 devices when UART3 is configured for boot mode before +	 * SPL starts only THRE bit is set. We have to empty the transmitter +	 * before initialization starts. +	 */ +	if ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE)) +	     == UART_LSR_THRE) { +		serial_out(UART_LCR_DLAB, &com_port->lcr); +		serial_out(baud_divisor & 0xff, &com_port->dll); +		serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm); +		serial_out(UART_LCRVAL, &com_port->lcr); +		serial_out(0, &com_port->mdr1); +	} +#endif +  	while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))  		; -#endif  	serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);  #if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \ -					defined(CONFIG_AM33XX) +			defined(CONFIG_AM33XX) || defined(CONFIG_TI814X)  	serial_out(0x7, &com_port->mdr1);	/* mode select reset TL16C750*/  #endif -	serial_out(UART_LCR_BKSE | UART_LCRVAL, (ulong)&com_port->lcr); +	serial_out(UART_LCR_BKSE | UART_LCRVAL, &com_port->lcr);  	serial_out(0, &com_port->dll);  	serial_out(0, &com_port->dlm);  	serial_out(UART_LCRVAL, &com_port->lcr); @@ -57,7 +71,8 @@ void NS16550_init(NS16550_t com_port, int baud_divisor)  	serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm);  	serial_out(UART_LCRVAL, &com_port->lcr);  #if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \ -	defined(CONFIG_AM33XX) || defined(CONFIG_SOC_DA8XX) +	defined(CONFIG_AM33XX) || defined(CONFIG_SOC_DA8XX) || \ +	defined(CONFIG_TI814X)  #if defined(CONFIG_APTIX)  	/* /13 mode so Aptix 6MHz can hit 115200 */ diff --git a/drivers/serial/s3c64xx.c b/drivers/serial/s3c64xx.c deleted file mode 100644 index b590992dc..000000000 --- a/drivers/serial/s3c64xx.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * (C) Copyright 2002 - * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de> - * - * (C) Copyright 2008 - * Guennadi Liakhovetki, DENX Software Engineering, <lg@denx.de> - * - * 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 - * - */ - -#include <common.h> -#include <linux/compiler.h> -#include <serial.h> -#include <asm/arch/s3c6400.h> - -DECLARE_GLOBAL_DATA_PTR; - -#ifdef CONFIG_SERIAL1 -#define UART_NR	S3C64XX_UART0 - -#elif defined(CONFIG_SERIAL2) -#define UART_NR	S3C64XX_UART1 - -#elif defined(CONFIG_SERIAL3) -#define UART_NR	S3C64XX_UART2 - -#else -#error "Bad: you didn't configure serial ..." -#endif - -/* - * The coefficient, used to calculate the baudrate on S3C6400 UARTs is - * calculated as - * C = UBRDIV * 16 + number_of_set_bits_in_UDIVSLOT - * however, section 31.6.11 of the datasheet doesn't recomment using 1 for 1, - * 3 for 2, ... (2^n - 1) for n, instead, they suggest using these constants: - */ -static const int udivslot[] = { -	0, -	0x0080, -	0x0808, -	0x0888, -	0x2222, -	0x4924, -	0x4a52, -	0x54aa, -	0x5555, -	0xd555, -	0xd5d5, -	0xddd5, -	0xdddd, -	0xdfdd, -	0xdfdf, -	0xffdf, -}; - -static void s3c64xx_serial_setbrg(void) -{ -	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR); -	u32 pclk = get_PCLK(); -	u32 baudrate = gd->baudrate; -	int i; - -	i = (pclk / baudrate) % 16; - -	uart->UBRDIV = pclk / baudrate / 16 - 1; -	uart->UDIVSLOT = udivslot[i]; - -	for (i = 0; i < 100; i++) -		barrier(); -} - -/* - * Initialise the serial port with the given baudrate. The settings - * are always 8 data bits, no parity, 1 stop bit, no start bits. - */ -static int s3c64xx_serial_init(void) -{ -	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR); - -	/* reset and enable FIFOs, set triggers to the maximum */ -	uart->UFCON = 0xff; -	uart->UMCON = 0; -	/* 8N1 */ -	uart->ULCON = 3; -	/* No interrupts, no DMA, pure polling */ -	uart->UCON = 5; - -	serial_setbrg(); - -	return 0; -} - -/* - * Read a single byte from the serial port. Returns 1 on success, 0 - * otherwise. When the function is succesfull, the character read is - * written into its argument c. - */ -static int s3c64xx_serial_getc(void) -{ -	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR); - -	/* wait for character to arrive */ -	while (!(uart->UTRSTAT & 0x1)); - -	return uart->URXH & 0xff; -} - -#ifdef CONFIG_MODEM_SUPPORT -static int be_quiet; -void disable_putc(void) -{ -	be_quiet = 1; -} - -void enable_putc(void) -{ -	be_quiet = 0; -} -#endif - - -/* - * Output a single byte to the serial port. - */ -static void s3c64xx_serial_putc(const char c) -{ -	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR); - -#ifdef CONFIG_MODEM_SUPPORT -	if (be_quiet) -		return; -#endif - -	/* wait for room in the tx FIFO */ -	while (!(uart->UTRSTAT & 0x2)); - -	uart->UTXH = c; - -	/* If \n, also do \r */ -	if (c == '\n') -		serial_putc('\r'); -} - -/* - * Test whether a character is in the RX buffer - */ -static int s3c64xx_serial_tstc(void) -{ -	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR); - -	return uart->UTRSTAT & 0x1; -} - -static struct serial_device s3c64xx_serial_drv = { -	.name	= "s3c64xx_serial", -	.start	= s3c64xx_serial_init, -	.stop	= NULL, -	.setbrg	= s3c64xx_serial_setbrg, -	.putc	= s3c64xx_serial_putc, -	.puts	= default_serial_puts, -	.getc	= s3c64xx_serial_getc, -	.tstc	= s3c64xx_serial_tstc, -}; - -void s3c64xx_serial_initialize(void) -{ -	serial_register(&s3c64xx_serial_drv); -} - -__weak struct serial_device *default_serial_console(void) -{ -	return &s3c64xx_serial_drv; -} diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c index 7922bf066..9f0464355 100644 --- a/drivers/serial/serial.c +++ b/drivers/serial/serial.c @@ -165,7 +165,6 @@ serial_initfunc(atmel_serial_initialize);  serial_initfunc(lpc32xx_serial_initialize);  serial_initfunc(mcf_serial_initialize);  serial_initfunc(oc_serial_initialize); -serial_initfunc(s3c64xx_serial_initialize);  serial_initfunc(sandbox_serial_initialize);  serial_initfunc(clps7111_serial_initialize);  serial_initfunc(imx_serial_initialize); @@ -259,7 +258,6 @@ void serial_initialize(void)  	lpc32xx_serial_initialize();  	mcf_serial_initialize();  	oc_serial_initialize(); -	s3c64xx_serial_initialize();  	sandbox_serial_initialize();  	clps7111_serial_initialize();  	imx_serial_initialize(); diff --git a/drivers/serial/usbtty.c b/drivers/serial/usbtty.c index e47cb9a9e..8e0815334 100644 --- a/drivers/serial/usbtty.c +++ b/drivers/serial/usbtty.c @@ -63,7 +63,7 @@  /*   * Buffers to hold input and output data   */ -#define USBTTY_BUFFER_SIZE 256 +#define USBTTY_BUFFER_SIZE 2048  static circbuf_t usbtty_input;  static circbuf_t usbtty_output; @@ -971,8 +971,8 @@ static void usbtty_event_handler (struct usb_device_instance *device,  		/*  		 * is_usbd_high_speed routine needs to be defined by  		 * specific gadget driver -		 * It returns TRUE if device enumerates at High speed -		 * Retuns FALSE otherwise +		 * It returns true if device enumerates at High speed +		 * Retuns false otherwise  		 */  		for (i = 0; i < NUM_ENDPOINTS; i++) {  			if (((ep_descriptor_ptrs[i]->bmAttributes &  |