From: Vikas Manocha Date: Fri, 21 Nov 2014 18:34:23 +0000 (-0800) Subject: serial: pl01x: avoid pl01x type check two times X-Git-Tag: v2015.01-rc3~19 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=eb8a4fe0dc5db5f586ae26d04aa132c76535b27c;p=oweals%2Fu-boot.git serial: pl01x: avoid pl01x type check two times Signed-off-by: Vikas Manocha Acked-by: Simon Glass --- diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c index 2a6b61d40d..e1bf4965f9 100644 --- a/drivers/serial/serial_pl01x.c +++ b/drivers/serial/serial_pl01x.c @@ -72,22 +72,19 @@ static int pl01x_tstc(struct pl01x_regs *regs) static int pl01x_generic_serial_init(struct pl01x_regs *regs, enum pl01x_type type) { + switch (type) { + case TYPE_PL010: + /* disable everything */ + writel(0, ®s->pl010_cr); + break; + case TYPE_PL011: #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) { - case TYPE_PL010: - /* disable everything */ - writel(0, ®s->pl010_cr); - break; - case TYPE_PL011: /* disable everything */ writel(0, ®s->pl011_cr); break;