Allow kgdboc to work on sparc hardware with the Zilog serial chips.
CC: "David S. Miller" <davem at davemloft.net>
Signed-off-by: Jason Wessel <jason.wessel at windriver.com>
---
drivers/serial/sunzilog.c | 52 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index 2c7a66a..8748796 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -102,6 +102,8 @@ struct uart_sunzilog_port {
#endif
};
+static void sunzilog_putchar(struct uart_port *port, int ch);
+
#define ZILOG_CHANNEL_FROM_PORT(PORT) ((struct zilog_channel __iomem *)((PORT)->membase))
#define UART_ZILOG(PORT) ((struct uart_sunzilog_port *)(PORT))
@@ -996,6 +998,52 @@ static int sunzilog_verify_port(struct uart_port *port, struct serial_struct *se
return -EINVAL;
}
+#ifdef CONFIG_CONSOLE_POLL
+static int sunzilog_get_poll_char(struct uart_port *port)
+{
+ unsigned char ch, r1;
+ struct uart_sunzilog_port *up = (struct uart_sunzilog_port *) port;
+ struct zilog_channel __iomem *channel
+ = ZILOG_CHANNEL_FROM_PORT(&up->port);
+
+
+ r1 = read_zsreg(channel, R1);
+ if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR)) {
+ writeb(ERR_RES, &channel->control);
+ ZSDELAY();
+ ZS_WSYNC(channel);
+ }
+
+ ch = readb(&channel->control);
+ ZSDELAY();
+
+ /* This funny hack depends upon BRK_ABRT not interfering
+ * with the other bits we care about in R1.
+ */
+ if (ch & BRK_ABRT)
+ r1 |= BRK_ABRT;
+
+ if (!(ch & Rx_CH_AV))
+ return NO_POLL_CHAR;
+
+ ch = readb(&channel->data);
+ ZSDELAY();
+
+ ch &= up->parity_mask;
+ return ch;
+}
+
+static void sunzilog_put_poll_char(struct uart_port *port,
+ unsigned char ch)
+{
+ struct uart_sunzilog_port *up = (struct uart_sunzilog_port *)port;
+
+ sunzilog_putchar(&up->port, ch);
+ udelay(2);
+
+}
+#endif /* CONFIG_CONSOLE_POLL */
+
static struct uart_ops sunzilog_pops = {
.tx_empty = sunzilog_tx_empty,
.set_mctrl = sunzilog_set_mctrl,
@@ -1013,6 +1061,10 @@ static struct uart_ops sunzilog_pops = {
.request_port = sunzilog_request_port,
.config_port = sunzilog_config_port,
.verify_port = sunzilog_verify_port,
+#ifdef CONFIG_CONSOLE_POLL
+ .poll_get_char = sunzilog_get_poll_char,
+ .poll_put_char = sunzilog_put_poll_char,
+#endif
};
static int uart_chip_count;
--
1.6.4.rc1
- References:
- [PATCH 0/37] kgdb, kdb and atomic kernel modesetting series
- [PATCH 01/37] softlockup: add sched_clock_tick() to avoid kernel warning on kgdb resume
- [PATCH 02/37] x86, hw_breakpoint, kgdb: kgdb to use hw_breakpoint API
- [PATCH 03/37] Move kernel/kgdb.c to kernel/debug/debug_core.c
- [PATCH 04/37] Separate the gdbstub from the debug core
- [PATCH 05/37] kdb: core for kgdb back end
- [PATCH 06/37] kgdb: eliminate kgdb_wait(), all cpus enter the same way
- [PATCH 07/37] kgdb,sparc: Add in kgdb_arch_set_pc for sparc
- [PATCH 08/37] kgdb, sh: update superh kgdb exception handling
- [PATCH 09/37] kgdb, blackfin: Add in kgdb_arch_set_pc for blackfin
- [PATCH 10/37] kgdb: Make mem access function weak in kgdb.c and kgdb.h
- [PATCH 11/37] kgdb: Fix kernel-doc format error in kgdb.h
- [PATCH 12/37] kgdb: core changes to support kdb
- [PATCH 13/37] kgdb, 8250, pl011: Return immediately from console poll
- [PATCH 14/37] sh, sh-sci: Use NO_POLL_CHAR in the SCIF polled console code
[Linux USB Devel]
[Video for Linux]
[Linux Audio Users]
[Photo]
[Yosemite News]
[Yosemite Photos]
[Free Online Dating]
[Linux Kernel]
[Linux SCSI]
[XFree86]