From patchwork Sat Sep 6 17:21:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Charkov X-Patchwork-Id: 4857901 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3A06DC0338 for ; Sat, 6 Sep 2014 17:24:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6480B20131 for ; Sat, 6 Sep 2014 17:24:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 94CCC20121 for ; Sat, 6 Sep 2014 17:24:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XQJhQ-0001DR-Fc; Sat, 06 Sep 2014 17:22:56 +0000 Received: from mail-lb0-x233.google.com ([2a00:1450:4010:c04::233]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XQJhM-000122-UW for linux-arm-kernel@lists.infradead.org; Sat, 06 Sep 2014 17:22:53 +0000 Received: by mail-lb0-f179.google.com with SMTP id p9so2375637lbv.38 for ; Sat, 06 Sep 2014 10:22:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DEsPgNelpY9jltmeDuP4zl9UHkoSq7g7xFM7Rdvx/pM=; b=VNi3mXxe3sdLNIUPKk24gBEWPdLhcwRLadofHnavNXc0F99Rkn8KSspJCtWHpM0fyz u8ikfh3SmNP0DLIJwDgiXvCht7fc/VNva3b6F2iMNHhFqWy4aZpOwkDUoePBjLp/dcpk rMZiM1b9cRtymYfnAsDiP20AIKctTNWFAeW1RuTtR+XW5r8Y1FAIU3tVhCY5HE0oEVxZ kVR0PLyok9Mqy0qAnQW/If9ie2p8UPQjP8bsQZyRUK0SRZRioRtW0iPlx+VOMzYS8dLy A2x/eTzjagRzXAtH+7tA1aC5vnE38PIhIsHeBmss9tBy7FTbnBQt9g5YMAYx0lnFnmhj IJIg== X-Received: by 10.152.43.46 with SMTP id t14mr18565339lal.15.1410024150099; Sat, 06 Sep 2014 10:22:30 -0700 (PDT) Received: from localhost.localdomain ([83.149.9.109]) by mx.google.com with ESMTPSA id vr9sm1883449lbb.36.2014.09.06.10.22.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 06 Sep 2014 10:22:29 -0700 (PDT) From: Alexey Charkov To: Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Tony Prisk , Greg Kroah-Hartman , Jiri Slaby , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-serial@vger.kernel.org Subject: [PATCH 4/4] tty: vt8500_serial: add polled console functions Date: Sat, 6 Sep 2014 21:21:15 +0400 Message-Id: <1410024075-1354-5-git-send-email-alchark@gmail.com> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1410024075-1354-1-git-send-email-alchark@gmail.com> References: <1410024075-1354-1-git-send-email-alchark@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140906_102253_167727_02EA2FE7 X-CRM114-Status: GOOD ( 11.13 ) X-Spam-Score: 0.5 (/) Cc: Alexey Charkov X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_WEB, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This adds simple polling functions for single-character transmit and receive, as used by kgdb. Signed-off-by: Alexey Charkov --- drivers/tty/serial/vt8500_serial.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c index bfcebfd..b2bc9e8 100644 --- a/drivers/tty/serial/vt8500_serial.c +++ b/drivers/tty/serial/vt8500_serial.c @@ -566,6 +566,33 @@ static struct console vt8500_console = { #define VT8500_CONSOLE NULL #endif +#ifdef CONFIG_CONSOLE_POLL +static int vt8500_get_poll_char(struct uart_port *port) +{ + unsigned int status = vt8500_read(port, VT8500_URFIDX); + + if (!(status & 0x1f00)) + return NO_POLL_CHAR; + + return vt8500_read(port, VT8500_RXFIFO) & 0xff; +} + +static void vt8500_put_poll_char(struct uart_port *port, unsigned char c) +{ + unsigned int status, tmout = 10000; + + do { + status = vt8500_read(port, VT8500_URFIDX); + + if (--tmout == 0) + break; + udelay(1); + } while (status & 0x10); + + vt8500_write(port, c, VT8500_TXFIFO); +} +#endif + static struct uart_ops vt8500_uart_pops = { .tx_empty = vt8500_tx_empty, .set_mctrl = vt8500_set_mctrl, @@ -583,6 +610,10 @@ static struct uart_ops vt8500_uart_pops = { .request_port = vt8500_request_port, .config_port = vt8500_config_port, .verify_port = vt8500_verify_port, +#ifdef CONFIG_CONSOLE_POLL + .poll_get_char = vt8500_get_poll_char, + .poll_put_char = vt8500_put_poll_char, +#endif }; static struct uart_driver vt8500_uart_driver = {