Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2834688ybc; Mon, 25 Nov 2019 05:04:23 -0800 (PST) X-Google-Smtp-Source: APXvYqx3KzkZvpTWPy/SYRjbxHTRO0kwF8hfbCou+GMD4FnYKrBuUhSQJGLHlA2l2/yUy/BX3wpd X-Received: by 2002:a17:906:6847:: with SMTP id a7mr11222844ejs.95.1574687063736; Mon, 25 Nov 2019 05:04:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574687063; cv=none; d=google.com; s=arc-20160816; b=MKWjtRy89IKTjBNGKTTST9eTBNyN4Z4LPVKtP7yUJjQ+ypWPbYpT0crAgKodaD0t0s Y3L9F6ujpgjFHMpg5ytfvb0MZSO/xqCYnKZiUhSIBM4fiK02QGLVG+U64hB7HH4zvM7c u0tqaapKohKyBqMQLY0dIRT7m2qWl7xLCDE1c6Fbi3J6KdsdXJ6V2zqt97b/yAdz00D8 OpAyjZutHQXWPvn0bceauyI8wjHZM9w/LVTqHCRLVGaToWoRkWa5IsVUxitJcN07EZHH LkrrLy6ioiGGF3DUfF06ewAJVzx+OuMWSW7BqGXXbsvJPQwo8M1csnvFwkLpBaZ7joOE uQ5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=oszatAWapQSwxSmT7LOzYc2Yp8yGFLuD+U/0jWT1sgk=; b=B3aqi20cmM/+KhQz2yhjwct+NBTM3nLrfJWJ6jB17dlSfwQ1U4Le37II3PzHnrCg3r 6gmivB80t0Q/kJxzotORZZE2wru+O4tKCHS5V/Xm4jDE0UXNPb6i2gSf7DoRkcQzbJxR FLZQ/1s4TWdtMI/gDS3qZXThtTAHxEQ5hMS4OYctq1L9ygYLrRNpmlWdcPKg9nniiKXk 8WDZbMPNGQSO2fcrnQZPwqJtiivLfMBDfxdb1fe00xlqYRWcKLUpaTgUmXUsSD6kZSiu trerJJWRU/1n3fyMg0AReQ4lWuWPL7V3+XG5T/i/jn12fFg70ITjzK/n6UUGeCOkTUAG X7sA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fi6si4369727ejb.430.2019.11.25.05.03.59; Mon, 25 Nov 2019 05:04:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727227AbfKYNC4 (ORCPT + 99 others); Mon, 25 Nov 2019 08:02:56 -0500 Received: from mail-eopbgr820051.outbound.protection.outlook.com ([40.107.82.51]:56880 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725916AbfKYNC4 (ORCPT ); Mon, 25 Nov 2019 08:02:56 -0500 Received: from CH2PR02CA0030.namprd02.prod.outlook.com (2603:10b6:610:4e::40) by BYAPR02MB5688.namprd02.prod.outlook.com (2603:10b6:a03:a6::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.17; Mon, 25 Nov 2019 13:02:53 +0000 Received: from SN1NAM02FT028.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::200) by CH2PR02CA0030.outlook.office365.com (2603:10b6:610:4e::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.21 via Frontend Transport; Mon, 25 Nov 2019 13:02:51 +0000 Authentication-Results: spf=softfail (sender IP is 149.199.60.83) smtp.mailfrom=gmail.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=gmail.com; Received-SPF: SoftFail (protection.outlook.com: domain of transitioning gmail.com discourages use of 149.199.60.83 as permitted sender) Received: from xsj-pvapsmtpgw01 (149.199.60.83) by SN1NAM02FT028.mail.protection.outlook.com (10.152.72.105) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2474.17 via Frontend Transport; Mon, 25 Nov 2019 13:02:51 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1iZE0x-0008Av-2u; Mon, 25 Nov 2019 05:02:51 -0800 Received: from localhost ([127.0.0.1] helo=xsj-pvapsmtp01) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iZE0s-0008PM-0p; Mon, 25 Nov 2019 05:02:46 -0800 Received: from [10.140.6.59] (helo=xhdshubhraj40.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iZE0r-0008Ox-0S; Mon, 25 Nov 2019 05:02:45 -0800 From: shubhrajyoti.datta@gmail.com To: linux-kernel@vger.kernel.org Cc: michal.simek@xilinx.com, gregkh@linuxfoundation.org, arnd@arndb.de, Maarten Brock , Shubhrajyoti Datta Subject: [PATCH 1/3] serial: xilinx_uartps: Let get_mctrl return status Date: Mon, 25 Nov 2019 18:32:39 +0530 Message-Id: <1574686961-9588-1-git-send-email-shubhrajyoti.datta@gmail.com> X-Mailer: git-send-email 2.1.1 X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-Result: No--1.851-7.0-31-1 X-imss-scan-details: No--1.851-7.0-31-1;No--1.851-5.0-31-1 X-TM-AS-User-Approved-Sender: No;No X-TM-AS-Result-Xfilter: Match text exemption rules:No X-EOPAttributedMessage: 0 X-Matching-Connectors: 132191605717521843;(f9e945fa-a09a-4caa-7158-08d2eb1d8c44);() X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(396003)(39860400002)(376002)(136003)(346002)(189003)(199004)(498600001)(9786002)(48376002)(55446002)(50466002)(6666004)(70206006)(6916009)(5660300002)(51416003)(16586007)(86362001)(14444005)(70586007)(8936002)(305945005)(316002)(356004)(2906002)(107886003)(26005)(4326008)(73392003)(54906003)(76482006)(50226002)(47776003)(81166006)(81156014)(61266001)(9686003)(8676002)(426003)(336012)(2361001)(2616005)(36756003)(2351001)(82202003);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR02MB5688;H:xsj-pvapsmtpgw01;FPR:;SPF:SoftFail;LANG:en;PTR:unknown-60-83.xilinx.com;MX:1;A:1; MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 88e02b8a-fd64-4331-812b-08d771a7c784 X-MS-TrafficTypeDiagnostic: BYAPR02MB5688: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-Forefront-PRVS: 0232B30BBC X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: e4knotTV8KuVgr7wgjVGgYsC1gqBHLceqXmgMlzbRAyTWP8Lh9UXPi3sLaAcCvYFjvTbPsWF27K2iBHPs20GXOktJs+O/hNvwlj6KDRBvYyOMcZuWZvIAi0v0T7TuUbCR3m8y4g6B09NejZD+hbGR1CXn+zrkVkDspXdisHexHtBGs1jxZ69C1HGyxjnxv+ZmiMojlzoSoZGSblkowzzxmOyR17WSIRqLWxipzZSOvuT731j3SPEK84V72tN8QEU5Of46sKQnCD59I8AvzS5HmvtSaeG5PomA4f47ZW/PG3gxtiZw1DFEmMh+LjulvNakUDCArlIxWg45Yd+Ql6VNCxz4OBWzPRAGzXVJ/lWKrWbxnMp9rHYCHXgyU7f1NkNBcuXMrlAQdG+XG65OHIBMS5xxmuK//skQJHxtJb73eTElDNub+wR7WNwtQ9kHI6a X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Nov 2019 13:02:51.5910 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 88e02b8a-fd64-4331-812b-08d771a7c784 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB5688 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maarten Brock Some of the applications like microcom do not work if modem is disabled. To fix them we always return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR instead of 0 when using cts_override. Make get_mctrl return actual status when not using cts_override. Signed-off-by: Maarten Brock Signed-off-by: Shubhrajyoti Datta --- drivers/tty/serial/xilinx_uartps.c | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 4e55bc3..9e12589 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -158,6 +158,26 @@ MODULE_PARM_DESC(rx_timeout, "Rx timeout, 1-255"); #define CDNS_UART_MODEMCR_DTR 0x00000001 /* Data Terminal Ready */ /* + * Modem Status register: + * The read/write Modem Status register reports the interface with the modem + * or data set, or a peripheral device emulating a modem. + */ +#define CDNS_UART_MODEMSR_DCD BIT(7) /* Data Carrier Detect */ +#define CDNS_UART_MODEMSR_RI BIT(6) /* Ting Indicator */ +#define CDNS_UART_MODEMSR_DSR BIT(5) /* Data Set Ready */ +#define CDNS_UART_MODEMSR_CTS BIT(4) /* Clear To Send */ + +/* + * Modem Status register: + * The read/write Modem Status register reports the interface with the modem + * or data set, or a peripheral device emulating a modem. + */ +#define CDNS_UART_MODEMSR_DCD BIT(7) /* Data Carrier Detect */ +#define CDNS_UART_MODEMSR_RI BIT(6) /* Ting Indicator */ +#define CDNS_UART_MODEMSR_DSR BIT(5) /* Data Set Ready */ +#define CDNS_UART_MODEMSR_CTS BIT(4) /* Clear To Send */ + +/* * Channel Status Register: * The channel status register (CSR) is provided to enable the control logic * to monitor the status of bits in the channel interrupt status register, @@ -1007,12 +1027,24 @@ static void cdns_uart_config_port(struct uart_port *port, int flags) */ static unsigned int cdns_uart_get_mctrl(struct uart_port *port) { + u32 val; + unsigned int mctrl = 0; struct cdns_uart *cdns_uart_data = port->private_data; if (cdns_uart_data->cts_override) - return 0; - - return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR; + return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR; + + val = readl(port->membase + CDNS_UART_MODEMSR); + if (val & CDNS_UART_MODEMSR_CTS) + mctrl |= TIOCM_CTS; + if (val & CDNS_UART_MODEMSR_DSR) + mctrl |= TIOCM_DSR; + if (val & CDNS_UART_MODEMSR_RI) + mctrl |= TIOCM_RNG; + if (val & CDNS_UART_MODEMSR_DCD) + mctrl |= TIOCM_CAR; + + return mctrl; } static void cdns_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) -- 2.1.1