From patchwork Wed Dec 17 12:53:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 5506871 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@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 250A2BEEA8 for ; Wed, 17 Dec 2014 12:50:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3F9C420A16 for ; Wed, 17 Dec 2014 12:50:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F5C6209E5 for ; Wed, 17 Dec 2014 12:50:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751797AbaLQMuX (ORCPT ); Wed, 17 Dec 2014 07:50:23 -0500 Received: from mail-pd0-f172.google.com ([209.85.192.172]:64111 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750829AbaLQMuW (ORCPT ); Wed, 17 Dec 2014 07:50:22 -0500 Received: by mail-pd0-f172.google.com with SMTP id y13so16212883pdi.3 for ; Wed, 17 Dec 2014 04:50:21 -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=2ByudCv6aKYxnASmjc7dl+vuplvGZUsrJ9XVx4dRNWM=; b=q6KkDgvfdBKKV29HpdZlWht56oH0dtCONPvHR0PgLYXhHVh24w7SzTfgz+BaPz8VG5 gbI8mo5mP7DewPi4Y1cmlbKFDbnAmDJHEACKs9JrO26eAuHK1Lx7qC95yUz7GiXWfYI4 Xqq6QEx0XWcQ4+KVkueaPyt7GJDPT8V2O+Wp4iRuslvsWV6gXx2NoifO0DtzTmd2PRw9 gZwt1ULeizK2AS8wD1qcFtCJd0RLvWulXkV6e0iM5D9usMgtjY8yGYpnJ2IEZJXXGCWt jnsez4YEoPSRYZwy6vW+UYYGH33muSrcFimzjYA4Kf3BXCM53vOdIBfZsfDBW5TmSrUI aCPg== X-Received: by 10.67.14.71 with SMTP id fe7mr69494179pad.27.1418820621767; Wed, 17 Dec 2014 04:50:21 -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 bb3sm3931595pbc.15.2014.12.17.04.50.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Dec 2014 04:50:20 -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:53:05 +0900 Message-Id: <20141217125305.14480.3038.sendpatchset@w520> In-Reply-To: <20141217125236.14480.78833.sendpatchset@w520> References: <20141217125236.14480.78833.sendpatchset@w520> Subject: [PATCH 03/05] serial: sh-sci: Expose default CTS pin 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 Expose the CTS pin to the ->get_mctrl() callback for the default case. Without this patch the serial core can not retrieve the CTS pin state from the SCIF driver. Signed-off-by: Magnus Damm --- drivers/tty/serial/sh-sci.c | 20 +++++++++++++++++++- include/linux/serial_sci.h | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) -- 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 --- 0021/drivers/tty/serial/sh-sci.c +++ work/drivers/tty/serial/sh-sci.c 2014-12-17 18:44:31.000000000 +0900 @@ -509,6 +509,17 @@ static void sci_poll_put_char(struct uar } #endif /* CONFIG_CONSOLE_POLL || CONFIG_SERIAL_SH_SCI_CONSOLE */ +static bool sci_cts_asserted_default(struct uart_port *port) +{ + struct sci_port *s = to_sci_port(port); + struct plat_sci_reg *reg = sci_regmap[s->cfg->regtype] + SCSPTR; + + if (reg->size) + return !(serial_port_in(port, SCSPTR) & SCSPTR_CTSDT); + + return false; +} + static void sci_init_pins_default(struct uart_port *port, bool hwflow_enabled) { struct sci_port *s = to_sci_port(port); @@ -1227,11 +1238,18 @@ static void sci_set_mctrl(struct uart_po static unsigned int sci_get_mctrl(struct uart_port *port) { + struct sci_port *s = to_sci_port(port); + bool cts_asserted = false; + /* * CTS/RTS is handled in hardware when supported, while nothing * else is wired up. Keep it simple and simply assert DSR/CAR. */ - return TIOCM_DSR | TIOCM_CAR; + + if (s->cfg->capabilities & SCIx_HAVE_RTSCTS) + cts_asserted = sci_cts_asserted_default(port); + + return TIOCM_DSR | TIOCM_CAR | (cts_asserted ? TIOCM_CTS : 0); } #ifdef CONFIG_SERIAL_SH_SCI_DMA --- 0021/include/linux/serial_sci.h +++ work/include/linux/serial_sci.h 2014-12-17 17:52:55.000000000 +0900 @@ -59,6 +59,7 @@ #define SCSPTR_RTSIO (1 << 7) /* Serial Port RTS Pin Input/Output */ #define SCSPTR_RTSDT (1 << 6) /* Serial Port RTS Pin Data */ #define SCSPTR_CTSIO (1 << 5) /* Serial Port CTS Pin Input/Output */ +#define SCSPTR_CTSDT (1 << 4) /* Serial Port CTS Pin Data */ #define SCSPTR_SPB2IO (1 << 1) /* Serial Port Break Input/Output */ #define SCSPTR_SPB2DT (1 << 0) /* Serial Port Break Data */