From patchwork Wed Dec 17 12:52:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 5506851 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 689529F30B for ; Wed, 17 Dec 2014 12:50:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 855EC20A25 for ; Wed, 17 Dec 2014 12:50:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3991720A22 for ; Wed, 17 Dec 2014 12:50:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751815AbaLQMuD (ORCPT ); Wed, 17 Dec 2014 07:50:03 -0500 Received: from mail-pd0-f181.google.com ([209.85.192.181]:37511 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750829AbaLQMuC (ORCPT ); Wed, 17 Dec 2014 07:50:02 -0500 Received: by mail-pd0-f181.google.com with SMTP id v10so15875693pde.26 for ; Wed, 17 Dec 2014 04:50:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:date:message-id:in-reply-to:references:subject; bh=sOT/padHImQA7luF4RxtayuxVYtJtqNw2xhxpA1o1Rs=; b=Z96TJeKJ3B4fCPqnYmlIDP8rnKpRFgjDbzvHuURpoHsmBjBS1iTVIYArGXZ9Sa38uU vMR2mzQXV7tGOrRV5OpGsRr44U20IDGveIFp+s26nyUPSsAkn9F3xQ8kthHUYb1+74s9 GpQ6uZA+33Xd8b06Cjd3+duTBs8Fhp9egG0LC6yYh1wruCUPe5o0nQgUwFRlkO/rO+LN K+GlvU+UfaFMnGt/vHWt8d/JUta/UkuEXb6TEmdRgC928eJjF1CyXONyWSJj4Z4yitG5 fVBUTxugMO24YRLpweJyU7hQrv+nV00Kgw3Xben2wF4p/fCQwtCP8ElLXQ31djSibCsl 7Kfg== X-Received: by 10.66.241.202 with SMTP id wk10mr70880365pac.88.1418820601981; Wed, 17 Dec 2014 04:50:01 -0800 (PST) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by mx.google.com with ESMTPSA id f1sm3814370pds.93.2014.12.17.04.49.59 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Dec 2014 04:50:00 -0800 (PST) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: gregkh@linuxfoundation.org, Magnus Damm , jslaby@suse.cz, linux-serial@vger.kernel.org Date: Wed, 17 Dec 2014 21:52:46 +0900 Message-Id: <20141217125246.14480.41876.sendpatchset@w520> In-Reply-To: <20141217125236.14480.78833.sendpatchset@w520> References: <20141217125236.14480.78833.sendpatchset@w520> Subject: [PATCH 01/05] serial: sh-sci: Break out default CTS/RTS pin setup Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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 From: Magnus Damm Break out CTS/RTS pin setup for the default case. We only care about those pins in case SCIx_HAVE_RTSCTS is set. Signed-off-by: Magnus Damm --- drivers/tty/serial/sh-sci.c | 45 +++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 14 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0001/drivers/tty/serial/sh-sci.c +++ work/drivers/tty/serial/sh-sci.c 2014-12-16 14:40:31.000000000 +0900 @@ -509,10 +509,29 @@ static void sci_poll_put_char(struct uar } #endif /* CONFIG_CONSOLE_POLL || CONFIG_SERIAL_SH_SCI_CONSOLE */ -static void sci_init_pins(struct uart_port *port, unsigned int cflag) +static void sci_init_pins_default(struct uart_port *port, bool hwflow_enabled) { struct sci_port *s = to_sci_port(port); struct plat_sci_reg *reg = sci_regmap[s->cfg->regtype] + SCSPTR; + unsigned short status; + + /* If no SCSPTR register exists then skip. Same if hardware flow + * control has been enabled, in such case SCFCR.MCE will be set + * and the SCSPTR configuration is assumed to be overridden. + */ + if (!reg->size || hwflow_enabled) + return; + + status = serial_port_in(port, SCSPTR); + status &= ~SCSPTR_CTSIO; + status |= SCSPTR_RTSIO; + serial_port_out(port, SCSPTR, status); /* Set RTS = 1 */ +} + +static void sci_init_pins(struct uart_port *port, unsigned int cflag) +{ + struct sci_port *s = to_sci_port(port); + bool hwflow_enabled = cflag & CRTSCTS; /* * Use port-specific handler if provided. @@ -522,22 +541,20 @@ static void sci_init_pins(struct uart_po return; } - /* - * For the generic path SCSPTR is necessary. Bail out if that's - * unavailable, too. + /* SCIF hardware with RTS/CTS support needs special setup below. + * + * Please note that if RTS/CTS is available for the hardware + * platform depends on the particular SCIF channel on a certain + * SoC, and how this channel has been hooked up on the actual board. + * + * If the RTS/CTS signals will be used or not depends on what user + * space requests. In case RTS/CTS is available but not requested + * by user space we still need to configure the pins somehow. */ - if (!reg->size) + if (!(s->cfg->capabilities & SCIx_HAVE_RTSCTS)) return; - if ((s->cfg->capabilities & SCIx_HAVE_RTSCTS) && - ((!(cflag & CRTSCTS)))) { - unsigned short status; - - status = serial_port_in(port, SCSPTR); - status &= ~SCSPTR_CTSIO; - status |= SCSPTR_RTSIO; - serial_port_out(port, SCSPTR, status); /* Set RTS = 1 */ - } + sci_init_pins_default(port, hwflow_enabled); } static int sci_txfill(struct uart_port *port)