Serial: p1011: new vendor init options
Two new options: CONFIG_PL011_SERIAL_RLCR Some vendor versions of PL011 serial ports (e.g. ST-Ericsson U8500) have separate receive and transmit line control registers. Set this variable to initialize the extra register. CONFIG_PL011_SERIAL_FLUSH_ON_INIT On some platforms (e.g. U8500) U-Boot is loaded by a second stage boot loader that has already initialized the UART. Define this variable to flush the UART at init time. empty fifo on init Signed-off-by: John Rigby <john.rigby@linaro.org> Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
This commit is contained in:
parent
264eaa0ea9
commit
910f1ae3eb
12
README
12
README
@ -475,6 +475,18 @@ The following options need to be configured:
|
|||||||
define this to a list of base addresses for each (supported)
|
define this to a list of base addresses for each (supported)
|
||||||
port. See e.g. include/configs/versatile.h
|
port. See e.g. include/configs/versatile.h
|
||||||
|
|
||||||
|
CONFIG_PL011_SERIAL_RLCR
|
||||||
|
|
||||||
|
Some vendor versions of PL011 serial ports (e.g. ST-Ericsson U8500)
|
||||||
|
have separate receive and transmit line control registers. Set
|
||||||
|
this variable to initialize the extra register.
|
||||||
|
|
||||||
|
CONFIG_PL011_SERIAL_FLUSH_ON_INIT
|
||||||
|
|
||||||
|
On some platforms (e.g. U8500) U-Boot is loaded by a second stage
|
||||||
|
boot loader that has already initialized the UART. Define this
|
||||||
|
variable to flush the UART at init time.
|
||||||
|
|
||||||
|
|
||||||
- Console Interface:
|
- Console Interface:
|
||||||
Depending on board, define exactly one serial port
|
Depending on board, define exactly one serial port
|
||||||
|
@ -111,6 +111,15 @@ int serial_init (void)
|
|||||||
unsigned int divider;
|
unsigned int divider;
|
||||||
unsigned int remainder;
|
unsigned int remainder;
|
||||||
unsigned int fraction;
|
unsigned int fraction;
|
||||||
|
unsigned int lcr;
|
||||||
|
|
||||||
|
#ifdef CONFIG_PL011_SERIAL_FLUSH_ON_INIT
|
||||||
|
/* Empty RX fifo if necessary */
|
||||||
|
if (readl(®s->pl011_cr) & UART_PL011_CR_UARTEN) {
|
||||||
|
while (!(readl(®s->fr) & UART_PL01x_FR_RXFE))
|
||||||
|
readl(®s->dr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* First, disable everything */
|
/* First, disable everything */
|
||||||
writel(0, ®s->pl011_cr);
|
writel(0, ®s->pl011_cr);
|
||||||
@ -131,9 +140,24 @@ int serial_init (void)
|
|||||||
writel(fraction, ®s->pl011_fbrd);
|
writel(fraction, ®s->pl011_fbrd);
|
||||||
|
|
||||||
/* Set the UART to be 8 bits, 1 stop bit, no parity, fifo enabled */
|
/* Set the UART to be 8 bits, 1 stop bit, no parity, fifo enabled */
|
||||||
writel(UART_PL011_LCRH_WLEN_8 | UART_PL011_LCRH_FEN,
|
lcr = UART_PL011_LCRH_WLEN_8 | UART_PL011_LCRH_FEN;
|
||||||
®s->pl011_lcrh);
|
writel(lcr, ®s->pl011_lcrh);
|
||||||
|
|
||||||
|
#ifdef CONFIG_PL011_SERIAL_RLCR
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Program receive line control register after waiting
|
||||||
|
* 10 bus cycles. Delay be writing to readonly register
|
||||||
|
* 10 times
|
||||||
|
*/
|
||||||
|
for (i = 0; i < 10; i++)
|
||||||
|
writel(lcr, ®s->fr);
|
||||||
|
|
||||||
|
writel(lcr, ®s->pl011_rlcr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/* Finally, enable the UART */
|
/* Finally, enable the UART */
|
||||||
writel(UART_PL011_CR_UARTEN | UART_PL011_CR_TXE | UART_PL011_CR_RXE,
|
writel(UART_PL011_CR_UARTEN | UART_PL011_CR_TXE | UART_PL011_CR_RXE,
|
||||||
®s->pl011_cr);
|
®s->pl011_cr);
|
||||||
|
@ -43,7 +43,11 @@ struct pl01x_regs {
|
|||||||
u32 pl010_lcrl; /* 0x10 Line control register, low byte */
|
u32 pl010_lcrl; /* 0x10 Line control register, low byte */
|
||||||
u32 pl010_cr; /* 0x14 Control register */
|
u32 pl010_cr; /* 0x14 Control register */
|
||||||
u32 fr; /* 0x18 Flag register (Read only) */
|
u32 fr; /* 0x18 Flag register (Read only) */
|
||||||
|
#ifdef CONFIG_PL011_SERIAL_RLCR
|
||||||
|
u32 pl011_rlcr; /* 0x1c Receive line control register */
|
||||||
|
#else
|
||||||
u32 reserved;
|
u32 reserved;
|
||||||
|
#endif
|
||||||
u32 ilpr; /* 0x20 IrDA low-power counter register */
|
u32 ilpr; /* 0x20 IrDA low-power counter register */
|
||||||
u32 pl011_ibrd; /* 0x24 Integer baud rate register */
|
u32 pl011_ibrd; /* 0x24 Integer baud rate register */
|
||||||
u32 pl011_fbrd; /* 0x28 Fractional baud rate register */
|
u32 pl011_fbrd; /* 0x28 Fractional baud rate register */
|
||||||
|
Loading…
Reference in New Issue
Block a user