From patchwork Thu Mar 19 01:50:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 6045091 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BADF1BF90F for ; Thu, 19 Mar 2015 01:49:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E3DDD20376 for ; Thu, 19 Mar 2015 01:49:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BD19420364 for ; Thu, 19 Mar 2015 01:49:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754777AbbCSBtK (ORCPT ); Wed, 18 Mar 2015 21:49:10 -0400 Received: from mail-pd0-f179.google.com ([209.85.192.179]:34055 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750964AbbCSBtJ (ORCPT ); Wed, 18 Mar 2015 21:49:09 -0400 Received: by pdbni2 with SMTP id ni2so60257466pdb.1; Wed, 18 Mar 2015 18:49:09 -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=0ozI2ACwHTnV9b5aFxqKXrxoD70uk9iZaTQ+k89IOR0=; b=JyWp6q5k1tZo08nbY/tUMrQYvdEKBaJsVd0tr2GpCB7p4LBOMgmTTJpAOPM4Vy/0FQ 0APHAHLF1+pr5vByYTdj7BYDIw/g4QM1KwGBAAyXXV69D4UGPIXRoUCB/6vhO52Akc+I swEt5dZa2kJ4Lf2bdHd9QolLasXpXvqdNyh9GO/PgZ/ONrhHQK7KDhxPE8H5hP7Row/C T1cU62/jNqjnAvZre6aelI0/KT/bJmyhHzwNmkWj/eAEu5CbTR8JTm02UgfT/LrKYqOx 2lxr/cEoTpAsjMQNuyyqUPdaBVfPs4bps4TMUS52ldLYpRPul95aiuU0bDV8nChyhA0N PIlQ== X-Received: by 10.66.90.168 with SMTP id bx8mr170549158pab.53.1426729749129; Wed, 18 Mar 2015 18:49:09 -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 fu14sm29752824pad.44.2015.03.18.18.49.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Mar 2015 18:49:08 -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:03 +0900 Message-Id: <20150319015003.14235.67489.sendpatchset@little-apple> In-Reply-To: <20150319014933.14235.44835.sendpatchset@little-apple> References: <20150319014933.14235.44835.sendpatchset@little-apple> Subject: [PATCH v2 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 --- Changes since V1: - Return true to default to asserted state in case modem signals exist 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 --- 0003/drivers/tty/serial/sh-sci.c +++ work/drivers/tty/serial/sh-sci.c 2015-03-19 09:17:37.856797004 +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 true; +} + static void sci_init_ctsrts_default(struct uart_port *port, bool hwflow_enabled) { struct sci_port *s = to_sci_port(port); @@ -1239,11 +1250,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 --- 0003/include/linux/serial_sci.h +++ work/include/linux/serial_sci.h 2015-03-19 09:15:59.446797358 +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 */