From patchwork Tue Oct 11 12:18:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Eisele X-Patchwork-Id: 118974 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id EA274B6F6B for ; Tue, 11 Oct 2011 23:24:45 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751827Ab1JKMYp (ORCPT ); Tue, 11 Oct 2011 08:24:45 -0400 Received: from mail201c2.megamailservers.com ([69.49.111.102]:35666 "EHLO mail201c2.megamailservers.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750756Ab1JKMYp (ORCPT ); Tue, 11 Oct 2011 08:24:45 -0400 X-Authenticated-User: konrad.gaisler.com Received: from localhost.localdomain (gaisler.se [92.33.28.242]) (authenticated bits=0) by mail201c2.megamailservers.com (8.13.6/8.13.1) with ESMTP id p9BCOYBC019844; Tue, 11 Oct 2011 08:24:39 -0400 From: Konrad Eisele To: davem@davemloft.net Cc: sparclinux@vger.kernel.org, julian.calaby@gmail.com, kristoffer@gaisler.com, daniel@gaisler.com Subject: [PATCH 1/5] apbuart: add polling callbacks to apbuart driver Date: Tue, 11 Oct 2011 14:18:03 +0200 Message-Id: <1318335487-25506-2-git-send-email-konrad@gaisler.com> X-Mailer: git-send-email 1.6.4.1 In-Reply-To: <1318335487-25506-1-git-send-email-konrad@gaisler.com> References: <1318335487-25506-1-git-send-email-konrad@gaisler.com> X-CSC: 0 X-CHA: v=1.1 cv=3vroozmhezBP+7RX62VLXHfNRE6fEyW8fj8TCBGQ830= c=1 sm=1 a=tc-d-6chpU0A:10 a=U62ajLuCel8A:10 a=jXKJviUpWSOlMmIvGrHOfw==:17 a=ebG-ZW-8AAAA:8 a=XVC24ZDZkNTNZJrN_rIA:9 a=AfTYod3CC3Tghbhzkq0A:7 a=cCYF7-FHeg4A:10 a=jXKJviUpWSOlMmIvGrHOfw==:117 Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org Add the 2 callbacks poll_get_char and poll_put_char so that the driver can be used as an interface with KGDB. Signed-off-by: Konrad Eisele --- drivers/tty/serial/apbuart.c | 33 ++++++++++++++++++++++++++++++++- 1 files changed, 32 insertions(+), 1 deletions(-) diff --git a/drivers/tty/serial/apbuart.c b/drivers/tty/serial/apbuart.c index 19a9436..153e065 100644 --- a/drivers/tty/serial/apbuart.c +++ b/drivers/tty/serial/apbuart.c @@ -39,6 +39,10 @@ #define UART_DUMMY_RSR_RX 0x8000 /* for ignore all read */ static void apbuart_tx_chars(struct uart_port *port); +#ifdef CONFIG_CONSOLE_POLL +static int apbuart_poll_get_char(struct uart_port *port); +static void apbuart_poll_put_char(struct uart_port *port, unsigned char ch); +#endif static void apbuart_stop_tx(struct uart_port *port) { @@ -345,6 +349,10 @@ static struct uart_ops grlib_apbuart_ops = { .request_port = apbuart_request_port, .config_port = apbuart_config_port, .verify_port = apbuart_verify_port, +#ifdef CONFIG_CONSOLE_POLL + .poll_get_char = apbuart_poll_get_char, + .poll_put_char = apbuart_poll_put_char, +#endif }; static struct uart_port grlib_apbuart_ports[UART_NR]; @@ -420,7 +428,7 @@ static void apbuart_flush_fifo(struct uart_port *port) /* Console driver, if enabled */ /* ======================================================================== */ -#ifdef CONFIG_SERIAL_GRLIB_GAISLER_APBUART_CONSOLE +#if defined(CONFIG_SERIAL_GRLIB_GAISLER_APBUART_CONSOLE) || defined(CONFIG_CONSOLE_POLL) static void apbuart_console_putchar(struct uart_port *port, int ch) { @@ -431,6 +439,29 @@ static void apbuart_console_putchar(struct uart_port *port, int ch) UART_PUT_CHAR(port, ch); } +#endif + +#ifdef CONFIG_CONSOLE_POLL + +static int apbuart_poll_get_char(struct uart_port *port) +{ + int c = NO_POLL_CHAR; + unsigned int status = UART_GET_STATUS(port); + if (status & UART_STATUS_DR) { + c = UART_GET_CHAR(port); + } + return c; +} + +static void apbuart_poll_put_char(struct uart_port *port, unsigned char ch) +{ + apbuart_console_putchar(port, ch); +} + +#endif + +#ifdef CONFIG_SERIAL_GRLIB_GAISLER_APBUART_CONSOLE + static void apbuart_console_write(struct console *co, const char *s, unsigned int count) {