Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: drivers/serial/ns16550.c

Issue 6715017: Fix Seaboard UART corruption on SPI activity (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/u-boot-next.git@chromeos-v2010.09
Patch Set: Chopped back a little Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | drivers/spi/tegra2_spi.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: drivers/serial/ns16550.c
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 7e833fde5fd52e5c14be3727be740b781baf99a4..b778babc528a8d4f252379c751d73a4fd983fe3d 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -64,6 +64,28 @@ void NS16550_reinit (NS16550_t com_port, int baud_divisor)
serial_out((baud_divisor >> 8) & 0xff, &com_port->dlm);
serial_out(UART_LCRVAL, &com_port->lcr);
}
+
+/* Clear the UART's RX FIFO */
+
+void NS16550_clear(NS16550_t com_port)
+{
+ /* Reset RX fifo */
+ serial_out(UART_FCR_FIFO_EN | UART_FCR_RXSR, &com_port->fcr);
+
+ /* Remove any pending characters */
+ while (NS16550_tstc(com_port))
+ NS16550_getc(com_port);
+}
+
+/* Wait for the UART's output buffer and holding register to drain */
+
+void NS16550_drain(NS16550_t com_port)
+{
+ /* Wait for the UART to finish sending */
+ while(!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
+ udelay(100);
+}
+
#endif /* CONFIG_NS16550_MIN_FUNCTIONS */
void NS16550_putc (NS16550_t com_port, char c)
« no previous file with comments | « no previous file | drivers/spi/tegra2_spi.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698