mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-19 21:51:31 +00:00
serial: pl01x: avoid pl01x type check two times
Signed-off-by: Vikas Manocha <vikas.manocha@st.com> Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
f7e517b4eb
commit
eb8a4fe0dc
1 changed files with 7 additions and 10 deletions
|
@ -72,22 +72,19 @@ static int pl01x_tstc(struct pl01x_regs *regs)
|
||||||
static int pl01x_generic_serial_init(struct pl01x_regs *regs,
|
static int pl01x_generic_serial_init(struct pl01x_regs *regs,
|
||||||
enum pl01x_type type)
|
enum pl01x_type type)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_PL011_SERIAL_FLUSH_ON_INIT
|
|
||||||
if (type == TYPE_PL011) {
|
|
||||||
/* 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
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TYPE_PL010:
|
case TYPE_PL010:
|
||||||
/* disable everything */
|
/* disable everything */
|
||||||
writel(0, ®s->pl010_cr);
|
writel(0, ®s->pl010_cr);
|
||||||
break;
|
break;
|
||||||
case TYPE_PL011:
|
case TYPE_PL011:
|
||||||
|
#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
|
||||||
/* disable everything */
|
/* disable everything */
|
||||||
writel(0, ®s->pl011_cr);
|
writel(0, ®s->pl011_cr);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue