[U-Boot] [PATCH v2 1/4] ns16550: Add function to drain serial output
Tom Warren
TWarren at nvidia.com
Fri Mar 9 21:59:38 CET 2012
Simon,
> -----Original Message-----
> From: Simon Glass [mailto:sjg at chromium.org]
> Sent: Friday, March 09, 2012 1:33 PM
> To: U-Boot Mailing List
> Cc: Tom Warren; Stephen Warren; Simon Glass
> Subject: [PATCH v2 1/4] ns16550: Add function to drain serial output
This patch series (v2, 1-4) works for me on my Seaboard - I get a message about 'No valid fdt found', etc.
So:
Tested-by: Tom Warren <twarren at nvidia.com>
Acked-by: Tom Warren <twarren at nvidia.com>
If no one objects, I'll apply this series, and Stephen's 'Makefile: fdt: Make the final build result be u-boot.bin' patch (which also works OK, BTW) to my previous pull request and resend to Albert.
Tom
--
nvpublic
>
> Sometimes we want to be sure that the output FIFO has fully drained (e.g.
> because we are about to reset or the port or reset the board). Add a
> function for this.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> Changes in v2:
> - Add function to drain the ns16550's FIFO
>
> drivers/serial/ns16550.c | 11 +++++++++++
> include/ns16550.h | 3 +++
> 2 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index
> 0c23955..a082112 100644
> --- a/drivers/serial/ns16550.c
> +++ b/drivers/serial/ns16550.c
> @@ -6,6 +6,7 @@
>
> #include <config.h>
> #include <ns16550.h>
> +#include <common.h>
> #include <watchdog.h>
> #include <linux/types.h>
> #include <asm/io.h>
> @@ -115,4 +116,14 @@ int NS16550_tstc(NS16550_t com_port)
> return (serial_in(&com_port->lsr) & UART_LSR_DR) != 0; }
>
> +/* Wait for the UART's output buffer and holding register to drain */
> +void NS16550_drain(NS16550_t regs) {
> + u32 mask = UART_LSR_TEMT | UART_LSR_THRE;
> +
> + /* Wait for the UART to finish sending */
> + while ((serial_in(®s->lsr) & mask) != mask)
> + udelay(100);
> +}
> +
> #endif /* CONFIG_NS16550_MIN_FUNCTIONS */ diff --git a/include/ns16550.h
> b/include/ns16550.h index e9d2eda..16b3828 100644
> --- a/include/ns16550.h
> +++ b/include/ns16550.h
> @@ -166,4 +166,7 @@ void NS16550_init(NS16550_t com_port, int baud_divisor);
> void NS16550_putc(NS16550_t com_port, char c); char NS16550_getc(NS16550_t
> com_port); int NS16550_tstc(NS16550_t com_port);
> +
> +/* Wait for the UART's output buffer and holding register to drain */
> +void NS16550_drain(NS16550_t regs);
> void NS16550_reinit(NS16550_t com_port, int baud_divisor);
> --
> 1.7.7.3
More information about the U-Boot
mailing list