diff options
author | Jason Wessel <jason.wessel@windriver.com> | 2008-02-20 13:33:39 -0600 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 20:05:39 +0200 |
commit | 84b5ae15216aa3ea0314f395536ef9829af21e14 (patch) | |
tree | 10ebd7ce14730148772bbb000caeaffe80802c9a /drivers/serial | |
parent | b4b8ac524d9b6ed7229017145afa1d7afbea4a48 (diff) |
kgdb: kgdboc pl011 I/O module
Implement the serial polling hooks for the pl011 uart for use with
kgdboc.
This patch was specifically tested on the ARM Versatile AB reference
platform.
[ mingo@elte.hu: minor cleanups. ]
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/amba-pl011.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c index 40604a092921..08adc1de4a79 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) spin_unlock_irqrestore(&uap->port.lock, flags); } +#ifdef CONFIG_CONSOLE_POLL +static int pl010_get_poll_char(struct uart_port *port) +{ + struct uart_amba_port *uap = (struct uart_amba_port *)port; + unsigned int status; + + do { + status = readw(uap->port.membase + UART01x_FR); + } while (status & UART01x_FR_RXFE); + + return readw(uap->port.membase + UART01x_DR); +} + +static void pl010_put_poll_char(struct uart_port *port, + unsigned char ch) +{ + struct uart_amba_port *uap = (struct uart_amba_port *)port; + + while (readw(uap->port.membase + UART01x_FR) & UART01x_FR_TXFF) + barrier(); + + writew(ch, uap->port.membase + UART01x_DR); +} + +#endif /* CONFIG_CONSOLE_POLL */ + static int pl011_startup(struct uart_port *port) { struct uart_amba_port *uap = (struct uart_amba_port *)port; @@ -572,6 +598,10 @@ static struct uart_ops amba_pl011_pops = { .request_port = pl010_request_port, .config_port = pl010_config_port, .verify_port = pl010_verify_port, +#ifdef CONFIG_CONSOLE_POLL + .poll_get_char = pl010_get_poll_char, + .poll_put_char = pl010_put_poll_char, +#endif }; static struct uart_amba_port *amba_ports[UART_NR]; |