serial: pl01x: avoid pl01x type check two times
authorVikas Manocha <vikas.manocha@st.com>
Fri, 21 Nov 2014 18:34:23 +0000 (10:34 -0800)
committerTom Rini <trini@ti.com>
Mon, 8 Dec 2014 14:35:45 +0000 (09:35 -0500)
Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
Acked-by: Simon Glass <sjg@chromium.org>
drivers/serial/serial_pl01x.c

index 2a6b61d40da54ed2d682504bcca3988767b32baf..e1bf4965f92123ce0605cbc93d02f0a1d56da1f2 100644 (file)
@@ -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, &regs->pl010_cr);
+               break;
+       case TYPE_PL011:
 #ifdef CONFIG_PL011_SERIAL_FLUSH_ON_INIT
-       if (type == TYPE_PL011) {
                /* Empty RX fifo if necessary */
                if (readl(&regs->pl011_cr) & UART_PL011_CR_UARTEN) {
                        while (!(readl(&regs->fr) & UART_PL01x_FR_RXFE))
                                readl(&regs->dr);
                }
-       }
 #endif
-
-       switch (type) {
-       case TYPE_PL010:
-               /* disable everything */
-               writel(0, &regs->pl010_cr);
-               break;
-       case TYPE_PL011:
                /* disable everything */
                writel(0, &regs->pl011_cr);
                break;