From patchwork Thu Mar 19 01:50:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 6045111 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 DEAA69F691 for ; Thu, 19 Mar 2015 01:49:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E3A9420364 for ; Thu, 19 Mar 2015 01:49:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0F2B12037C for ; Thu, 19 Mar 2015 01:49:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751074AbbCSBte (ORCPT ); Wed, 18 Mar 2015 21:49:34 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:35370 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755074AbbCSBta (ORCPT ); Wed, 18 Mar 2015 21:49:30 -0400 Received: by pabyw6 with SMTP id yw6so59717640pab.2; Wed, 18 Mar 2015 18:49:29 -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=jk/Ay92V67tzZ1Qr+1wC5/g6fEXcm6PQReYH93MrbgE=; b=mHGf5mTwkHJbNLDVT6QUrhQ88+POjtHh0E8T3TU/KTJnxCn6iAm3akCwZ01Pq0JZDf oAOWP8mi03nqiM6YQlCDTQXXRlZp+HUtq2PPET+JKIYR4TOEk/h09HJQ5M/4Q6gBpBrn zILl9Hfv+C3p7Xncw6KpvgLLG3kSZ6g9LGIDdobZBRnG7DlKw7sqsip0ePwbLj+bxtWZ 6mlEL8ZtvDB2lIA8p5VM6N4zgYtymGRjaYHAO2vn4euPW3GkDQZcCU+2EWgjLm0qtHps Vbx2qRso2VEBwH4QjePHBTRxRaI64IGw0FQFzcW/rzaQ9T/lczZ0h8rl05QTG9BQtv37 sgYg== X-Received: by 10.66.235.169 with SMTP id un9mr164959099pac.45.1426729769697; Wed, 18 Mar 2015 18:49:29 -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 pa6sm29754736pac.45.2015.03.18.18.49.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Mar 2015 18:49:28 -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:50:23 +0900 Message-Id: <20150319015023.14235.86850.sendpatchset@little-apple> In-Reply-To: <20150319014933.14235.44835.sendpatchset@little-apple> References: <20150319014933.14235.44835.sendpatchset@little-apple> Subject: [PATCH v2 05/05] serial: sh-sci: Expose SCIFA/SCIFB 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 CTS pin to serial core for the SCIFA/SCIFB case. Signed-off-by: Magnus Damm --- Changes since V1: - Added bit definition for SCPDR_CTSD drivers/tty/serial/sh-sci.c | 17 +++++++++++++++-- include/linux/serial_sci.h | 1 + 2 files changed, 16 insertions(+), 2 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 --- 0005/drivers/tty/serial/sh-sci.c +++ work/drivers/tty/serial/sh-sci.c 2015-03-19 09:57:43.266788360 +0900 @@ -564,6 +564,11 @@ static void sci_init_ctsrts_default(stru serial_port_out(port, SCSPTR, status); /* Set RTS = 0 */ } +static bool sci_cts_asserted_scifab(struct uart_port *port) +{ + return !(serial_port_in(port, SCPDR) & SCPDR_CTSD); +} + static void sci_init_ctsrts_scifab(struct uart_port *port, bool hwflow_enabled) { unsigned short control, data; @@ -1315,8 +1320,16 @@ static unsigned int sci_get_mctrl(struct * else is wired up. Keep it simple and simply assert DSR/CAR. */ - if (s->cfg->capabilities & SCIx_HAVE_RTSCTS) - cts_asserted = sci_cts_asserted_default(port); + if (s->cfg->capabilities & SCIx_HAVE_RTSCTS) { + switch (s->cfg->type) { + case PORT_SCIFA: + case PORT_SCIFB: + cts_asserted = sci_cts_asserted_scifab(port); + break; + default: + cts_asserted = sci_cts_asserted_default(port); + } + } return TIOCM_DSR | TIOCM_CAR | (cts_asserted ? TIOCM_CTS : 0); } --- 0005/include/linux/serial_sci.h +++ work/include/linux/serial_sci.h 2015-03-19 09:52:14.846789540 +0900 @@ -72,6 +72,7 @@ /* SCPDR (Serial Port Data Register) */ #define SCPDR_RTSD (1 << 4) /* Serial Port RTS Output Pin Data */ +#define SCPDR_CTSD (1 << 3) /* Serial Port CTS Input Pin Data */ enum { SCIx_PROBE_REGTYPE,