* [PATCH 0/2] tty: serial: kgdb support for fsl_lpuart @ 2016-10-04 12:46 Nicolae Rosia 2016-10-04 12:46 ` [PATCH 1/2] tty: serial: fsl_lpuart: add polled console functions Nicolae Rosia 2016-10-04 12:46 ` [PATCH 2/2] tty: serial: Makefile: move kgdb to be initialized last Nicolae Rosia 0 siblings, 2 replies; 3+ messages in thread From: Nicolae Rosia @ 2016-10-04 12:46 UTC (permalink / raw) To: linux-arm-kernel From: Nicolae Rosia <nicolae_rosia@mentor.com> This patch series enables kgdb to be used with fsl_lpuart on Vybrid processors. Tested on Vybrid VF61 Nicolae Rosia (2): tty: serial: fsl_lpuart: add polled console functions tty: serial: Makefile: move kgdb to be initialized last drivers/tty/serial/Makefile | 5 ++-- drivers/tty/serial/fsl_lpuart.c | 66 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 2 deletions(-) -- 2.5.5 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] tty: serial: fsl_lpuart: add polled console functions 2016-10-04 12:46 [PATCH 0/2] tty: serial: kgdb support for fsl_lpuart Nicolae Rosia @ 2016-10-04 12:46 ` Nicolae Rosia 2016-10-04 12:46 ` [PATCH 2/2] tty: serial: Makefile: move kgdb to be initialized last Nicolae Rosia 1 sibling, 0 replies; 3+ messages in thread From: Nicolae Rosia @ 2016-10-04 12:46 UTC (permalink / raw) To: linux-arm-kernel From: Nicolae Rosia <nicolae_rosia@mentor.com> This adds polling functions as used by kgdb. Signed-off-by: Nicolae Rosia <nicolae_rosia@mentor.com> Signed-off-by: Stefan Golinschi <stefan.golinschi@gmail.com> --- drivers/tty/serial/fsl_lpuart.c | 66 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index de9d510..49d7526 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -431,6 +431,67 @@ static void lpuart_flush_buffer(struct uart_port *port) } } +#if defined(CONFIG_CONSOLE_POLL) + +static int lpuart_poll_init(struct uart_port *port) +{ + struct lpuart_port *sport = container_of(port, + struct lpuart_port, port); + unsigned long flags; + unsigned char temp; + + sport->port.fifosize = 0; + + spin_lock_irqsave(&sport->port.lock, flags); + /* Disable Rx & Tx */ + writeb(0, sport->port.membase + UARTCR2); + + temp = readb(sport->port.membase + UARTPFIFO); + /* Enable Rx and Tx FIFO */ + writeb(temp | UARTPFIFO_RXFE | UARTPFIFO_TXFE, + sport->port.membase + UARTPFIFO); + + /* flush Tx and Rx FIFO */ + writeb(UARTCFIFO_TXFLUSH | UARTCFIFO_RXFLUSH, + sport->port.membase + UARTCFIFO); + + /* explicitly clear RDRF */ + if (readb(sport->port.membase + UARTSR1) & UARTSR1_RDRF) { + readb(sport->port.membase + UARTDR); + writeb(UARTSFIFO_RXUF, sport->port.membase + UARTSFIFO); + } + + writeb(0, sport->port.membase + UARTTWFIFO); + writeb(1, sport->port.membase + UARTRWFIFO); + + /* Enable Rx and Tx */ + writeb(UARTCR2_RE | UARTCR2_TE, sport->port.membase + UARTCR2); + spin_unlock_irqrestore(&sport->port.lock, flags); + + return 0; +} + +static void lpuart_poll_put_char(struct uart_port *port, unsigned char c) +{ + unsigned int status; + + /* drain */ + while (!(readb(port->membase + UARTSR1) & UARTSR1_TDRE)) + barrier(); + + writeb(c, port->membase + UARTDR); +} + +static int lpuart_poll_get_char(struct uart_port *port) +{ + if (!(readb(port->membase + UARTSR1) & UARTSR1_RDRF)) + return NO_POLL_CHAR; + + return readb(port->membase + UARTDR); +} + +#endif + static inline void lpuart_transmit_buffer(struct lpuart_port *sport) { struct circ_buf *xmit = &sport->port.state->xmit; @@ -1596,6 +1657,11 @@ static const struct uart_ops lpuart_pops = { .config_port = lpuart_config_port, .verify_port = lpuart_verify_port, .flush_buffer = lpuart_flush_buffer, +#if defined(CONFIG_CONSOLE_POLL) + .poll_init = lpuart_poll_init, + .poll_get_char = lpuart_poll_get_char, + .poll_put_char = lpuart_poll_put_char, +#endif }; static const struct uart_ops lpuart32_pops = { -- 2.5.5 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] tty: serial: Makefile: move kgdb to be initialized last 2016-10-04 12:46 [PATCH 0/2] tty: serial: kgdb support for fsl_lpuart Nicolae Rosia 2016-10-04 12:46 ` [PATCH 1/2] tty: serial: fsl_lpuart: add polled console functions Nicolae Rosia @ 2016-10-04 12:46 ` Nicolae Rosia 1 sibling, 0 replies; 3+ messages in thread From: Nicolae Rosia @ 2016-10-04 12:46 UTC (permalink / raw) To: linux-arm-kernel From: Nicolae Rosia <nicolae_rosia@mentor.com> fsl_lpuart cannot be used with kgdb because the kgdb initcall is called before the driver's init. Move kgdb to be initialized after all serial drivers have been inited. Signed-off-by: Nicolae Rosia <nicolae_rosia@mentor.com> Signed-off-by: Stefan Golinschi <stefan.golinschi@gmail.com> --- drivers/tty/serial/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile index 1278d37..8016ef9 100644 --- a/drivers/tty/serial/Makefile +++ b/drivers/tty/serial/Makefile @@ -62,13 +62,11 @@ obj-$(CONFIG_SERIAL_ATMEL) += atmel_serial.o obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o obj-$(CONFIG_SERIAL_MSM) += msm_serial.o obj-$(CONFIG_SERIAL_NETX) += netx-serial.o -obj-$(CONFIG_SERIAL_KGDB_NMI) += kgdb_nmi.o obj-$(CONFIG_SERIAL_KS8695) += serial_ks8695.o obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o obj-$(CONFIG_SERIAL_ALTERA_UART) += altera_uart.o obj-$(CONFIG_SERIAL_ST_ASC) += st-asc.o obj-$(CONFIG_SERIAL_TILEGX) += tilegx.o -obj-$(CONFIG_KGDB_SERIAL_CONSOLE) += kgdboc.o obj-$(CONFIG_SERIAL_QE) += ucc_uart.o obj-$(CONFIG_SERIAL_TIMBERDALE) += timbuart.o obj-$(CONFIG_SERIAL_GRLIB_GAISLER_APBUART) += apbuart.o @@ -96,3 +94,6 @@ obj-$(CONFIG_SERIAL_MPS2_UART) += mps2-uart.o # GPIOLIB helpers for modem control lines obj-$(CONFIG_SERIAL_MCTRL_GPIO) += serial_mctrl_gpio.o + +obj-$(CONFIG_SERIAL_KGDB_NMI) += kgdb_nmi.o +obj-$(CONFIG_KGDB_SERIAL_CONSOLE) += kgdboc.o -- 2.5.5 ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-04 12:46 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-10-04 12:46 [PATCH 0/2] tty: serial: kgdb support for fsl_lpuart Nicolae Rosia 2016-10-04 12:46 ` [PATCH 1/2] tty: serial: fsl_lpuart: add polled console functions Nicolae Rosia 2016-10-04 12:46 ` [PATCH 2/2] tty: serial: Makefile: move kgdb to be initialized last Nicolae Rosia
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).