From: stigge@antcom.de (Roland Stigge)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 5/6] ARM: LPC32xx: serial.c: HW bug workaround
Date: Sat, 25 Feb 2012 16:35:17 +0100 [thread overview]
Message-ID: <1330184118-10270-6-git-send-email-stigge@antcom.de> (raw)
In-Reply-To: <1330184118-10270-1-git-send-email-stigge@antcom.de>
This patch fixes a HW bug by flushing RX FIFOs of the UARTs on init.
Signed-off-by: Roland Stigge <stigge@antcom.de>
---
arch/arm/mach-lpc32xx/serial.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
--- linux-2.6.orig/arch/arm/mach-lpc32xx/serial.c
+++ linux-2.6/arch/arm/mach-lpc32xx/serial.c
@@ -88,6 +88,7 @@ struct uartinit {
char *uart_ck_name;
u32 ck_mode_mask;
void __iomem *pdiv_clk_reg;
+ resource_size_t mapbase;
};
static struct uartinit uartinit_data[] __initdata = {
@@ -97,6 +98,7 @@ static struct uartinit uartinit_data[] _
.ck_mode_mask =
LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 5),
.pdiv_clk_reg = LPC32XX_CLKPWR_UART5_CLK_CTRL,
+ .mapbase = LPC32XX_UART5_BASE,
},
#endif
#ifdef CONFIG_ARCH_LPC32XX_UART3_SELECT
@@ -105,6 +107,7 @@ static struct uartinit uartinit_data[] _
.ck_mode_mask =
LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 3),
.pdiv_clk_reg = LPC32XX_CLKPWR_UART3_CLK_CTRL,
+ .mapbase = LPC32XX_UART3_BASE,
},
#endif
#ifdef CONFIG_ARCH_LPC32XX_UART4_SELECT
@@ -113,6 +116,7 @@ static struct uartinit uartinit_data[] _
.ck_mode_mask =
LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 4),
.pdiv_clk_reg = LPC32XX_CLKPWR_UART4_CLK_CTRL,
+ .mapbase = LPC32XX_UART4_BASE,
},
#endif
#ifdef CONFIG_ARCH_LPC32XX_UART6_SELECT
@@ -121,6 +125,7 @@ static struct uartinit uartinit_data[] _
.ck_mode_mask =
LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 6),
.pdiv_clk_reg = LPC32XX_CLKPWR_UART6_CLK_CTRL,
+ .mapbase = LPC32XX_UART6_BASE,
},
#endif
};
@@ -165,6 +170,19 @@ void __init lpc32xx_serial_init(void)
/* pre-UART clock divider set to 1 */
__raw_writel(0x0101, uartinit_data[i].pdiv_clk_reg);
+
+ /*
+ * Force a flush of the RX FIFOs to work around a
+ * HW bug
+ */
+ puart = uartinit_data[i].mapbase;
+ __raw_writel(0xC1, LPC32XX_UART_IIR_FCR(puart));
+ __raw_writel(0x00, LPC32XX_UART_DLL_FIFO(puart));
+ j = LPC32XX_SUART_FIFO_SIZE;
+ while (j--)
+ tmp = __raw_readl(
+ LPC32XX_UART_DLL_FIFO(puart));
+ __raw_writel(0, LPC32XX_UART_IIR_FCR(puart));
}
/* This needs to be done after all UART clocks are setup */
next prev parent reply other threads:[~2012-02-25 15:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-25 15:35 [PATCH v2 0/6] ARM: LPC32xx: Patch set with further fixes for LPC32xx Roland Stigge
2012-02-25 15:35 ` [PATCH v2 1/6] ARM: LPC32xx: Fix irq on GPI_28 Roland Stigge
2012-02-25 15:35 ` [PATCH v2 2/6] ARM: LPC32xx: Fix missing and bad LPC32XX macros Roland Stigge
2012-02-25 15:35 ` [PATCH v2 3/6] ARM: LPC32xx: Fix interrupt controller init Roland Stigge
2012-02-25 15:35 ` [PATCH v2 4/6] ARM: LPC32xx: irq.c: Clear latched event Roland Stigge
2012-02-25 15:35 ` Roland Stigge [this message]
2012-02-27 14:14 ` [PATCH v2 5/6] ARM: LPC32xx: serial.c: HW bug workaround Wolfram Sang
2012-02-27 15:37 ` Roland Stigge
2012-02-27 15:48 ` Wolfram Sang
2012-02-27 19:02 ` Kevin Wells
2012-02-27 21:59 ` Roland Stigge
2012-02-25 15:35 ` [PATCH v2 6/6] ARM: LPC32xx: serial.c: Fixed loop limit Roland Stigge
2012-02-27 19:16 ` [PATCH v2 0/6] ARM: LPC32xx: Patch set with further fixes for LPC32xx Kevin Wells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1330184118-10270-6-git-send-email-stigge@antcom.de \
--to=stigge@antcom.de \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).