From patchwork Thu Mar 19 01:49:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 6045071 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7128F9F314 for ; Thu, 19 Mar 2015 01:48:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 879F720376 for ; Thu, 19 Mar 2015 01:48:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9F05520364 for ; Thu, 19 Mar 2015 01:48:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754798AbbCSBsu (ORCPT ); Wed, 18 Mar 2015 21:48:50 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:33679 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754489AbbCSBst (ORCPT ); Wed, 18 Mar 2015 21:48:49 -0400 Received: by pabxg6 with SMTP id xg6so46827396pab.0; Wed, 18 Mar 2015 18:48:49 -0700 (PDT) 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=lA6PAy9iXQ1xJoYJzlYkaDNSFNDINfsYRONxTuLBowg=; b=uZ7E4ThPX41knNI5nP50r3f708HQxvDdv8bliRdA1NoY1GoNGD5hVJZKaD1/waeTuC Az8bSedeZeLseEgM6xlwDDoVl1EBD1iKjpFsDhm3PilXO2vkrC8oA7G8ZEwxWHnvGj5K wZYJUpArIvWu7PD9YPXHwIQiloEjPtRr8KyTXNVxt6Vi7N16quVLpSWGz8VoANV27PMn U0UIBA7qLpRPF9z2qEaj/ZHyqpqyiYAmzZc5tlP9dzwnSNAy0OwCPuL1DgodkDGP6CXT ADJyyd4dslupWFXaMVaWsnAIBubdEu0aPk7G7HXj07lSRZyFn+HoA22lKAUZo9vVglt/ 7n2w== X-Received: by 10.70.89.174 with SMTP id bp14mr85273804pdb.14.1426729729134; Wed, 18 Mar 2015 18:48:49 -0700 (PDT) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by mx.google.com with ESMTPSA id fu14sm29752087pad.44.2015.03.18.18.48.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Mar 2015 18:48:48 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: gregkh@linuxfoundation.org, geert@glider.be, laurent.pinchart@ideasonboard.com, linux-serial@vger.kernel.org, Magnus Damm , jslaby@suse.cz Date: Thu, 19 Mar 2015 10:49:43 +0900 Message-Id: <20150319014943.14235.12896.sendpatchset@little-apple> In-Reply-To: <20150319014933.14235.44835.sendpatchset@little-apple> References: <20150319014933.14235.44835.sendpatchset@little-apple> Subject: [PATCH v2 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 --- Changes since V1: - Function name change, thanks Laurent! 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 2015-03-19 09:07:40.616799151 +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_ctsrts_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_ctsrts_default(port, hwflow_enabled); } static int sci_txfill(struct uart_port *port)