aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/amba-pl011.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/amba-pl011.c')
-rw-r--r--drivers/serial/amba-pl011.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 40604a09292..08adc1de4a7 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -314,6 +314,32 @@ static void pl011_break_ctl(struct uart_port *port, int break_state)
314 spin_unlock_irqrestore(&uap->port.lock, flags); 314 spin_unlock_irqrestore(&uap->port.lock, flags);
315} 315}
316 316
317#ifdef CONFIG_CONSOLE_POLL
318static int pl010_get_poll_char(struct uart_port *port)
319{
320 struct uart_amba_port *uap = (struct uart_amba_port *)port;
321 unsigned int status;
322
323 do {
324 status = readw(uap->port.membase + UART01x_FR);
325 } while (status & UART01x_FR_RXFE);
326
327 return readw(uap->port.membase + UART01x_DR);
328}
329
330static void pl010_put_poll_char(struct uart_port *port,
331 unsigned char ch)
332{
333 struct uart_amba_port *uap = (struct uart_amba_port *)port;
334
335 while (readw(uap->port.membase + UART01x_FR) & UART01x_FR_TXFF)
336 barrier();
337
338 writew(ch, uap->port.membase + UART01x_DR);
339}
340
341#endif /* CONFIG_CONSOLE_POLL */
342
317static int pl011_startup(struct uart_port *port) 343static int pl011_startup(struct uart_port *port)
318{ 344{
319 struct uart_amba_port *uap = (struct uart_amba_port *)port; 345 struct uart_amba_port *uap = (struct uart_amba_port *)port;
@@ -572,6 +598,10 @@ static struct uart_ops amba_pl011_pops = {
572 .request_port = pl010_request_port, 598 .request_port = pl010_request_port,
573 .config_port = pl010_config_port, 599 .config_port = pl010_config_port,
574 .verify_port = pl010_verify_port, 600 .verify_port = pl010_verify_port,
601#ifdef CONFIG_CONSOLE_POLL
602 .poll_get_char = pl010_get_poll_char,
603 .poll_put_char = pl010_put_poll_char,
604#endif
575}; 605};
576 606
577static struct uart_amba_port *amba_ports[UART_NR]; 607static struct uart_amba_port *amba_ports[UART_NR];