From patchwork Mon Jun 1 05:21:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhuvanchandra DV X-Patchwork-Id: 6517331 Return-Path: X-Original-To: patchwork-linux-arm@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 432C3C0020 for ; Mon, 1 Jun 2015 05:24:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 55431205BB for ; Mon, 1 Jun 2015 05:24:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 79F17205C6 for ; Mon, 1 Jun 2015 05:24:28 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YzIBR-0003Ag-9b; Mon, 01 Jun 2015 05:22:45 +0000 Received: from mail-db3on0148.outbound.protection.outlook.com ([157.55.234.148] helo=emea01-db3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YzIAo-0002w8-5u for linux-arm-kernel@lists.infradead.org; Mon, 01 Jun 2015 05:22:07 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=bhuvanchandra.dv@toradex.com; Received: from tdx.toradex.int (115.115.225.206) by DB3PR05MB267.eurprd05.prod.outlook.com (10.141.4.26) with Microsoft SMTP Server (TLS) id 15.1.172.22; Mon, 1 Jun 2015 05:21:47 +0000 From: Bhuvanchandra DV To: Subject: [PATCH V2 2/3] tty: serial: fsl_lpuart: remove RTS/CTS control from set/get_mctrl Date: Mon, 1 Jun 2015 10:51:06 +0530 Message-ID: <1433136067-20644-3-git-send-email-bhuvanchandra.dv@toradex.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1433136067-20644-1-git-send-email-bhuvanchandra.dv@toradex.com> References: <1433136067-20644-1-git-send-email-bhuvanchandra.dv@toradex.com> MIME-Version: 1.0 X-Originating-IP: [115.115.225.206] X-ClientProxiedBy: HK2PR0201CA0018.apcprd02.prod.outlook.com (25.162.206.28) To DB3PR05MB267.eurprd05.prod.outlook.com (10.141.4.26) X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB3PR05MB267; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(520003)(5005006)(3002001); SRVR:DB3PR05MB267; BCL:0; PCL:0; RULEID:; SRVR:DB3PR05MB267; X-Forefront-PRVS: 05947791E4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(189002)(199003)(77096005)(50226001)(5001960100002)(2950100001)(77156002)(68736005)(46102003)(189998001)(92566002)(50466002)(50986999)(86362001)(62966003)(66066001)(48376002)(87976001)(105586002)(53416004)(229853001)(2351001)(107886002)(69596002)(19580395003)(5001830100001)(5001920100001)(5001860100001)(101416001)(19580405001)(81156007)(42186005)(110136002)(36756003)(47776003)(64706001)(106356001)(33646002)(4001540100001)(76176999)(40100003)(97736004)(122386002)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:DB3PR05MB267; H:tdx.toradex.int; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: toradex.com does not designate permitted sender hosts) X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2015 05:21:47.1374 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR05MB267 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150531_222206_381828_1D1AA163 X-CRM114-Status: GOOD ( 13.76 ) X-Spam-Score: -1.1 (-) Cc: devicetree@vger.kernel.org, linux-serial@vger.kernel.org, moorray3@wp.pl, linux-kernel@vger.kernel.org, stefan@agner.ch, bhuvanchandra.dv@gmail.com, kernel@pengutronix.de, shawn.guo@linaro.org, jslaby@suse.cz, linux-arm-kernel@lists.infradead.org, Bhuvanchandra DV X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 The LPUART does not provide manual control of RTS/CTS signals, those can only be controlled by the hardware directly. Therefore manual control of those signals through mctrl can not be provided. The current implementation enables/disables the automatic control, which is not what mctrl should do, hence remove the incorrect implementation. Signed-off-by: Bhuvanchandra DV --- drivers/tty/serial/fsl_lpuart.c | 63 +++++------------------------------------ 1 file changed, 7 insertions(+), 56 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 08ce76f..532cfb7 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -822,64 +822,15 @@ static unsigned int lpuart32_tx_empty(struct uart_port *port) static unsigned int lpuart_get_mctrl(struct uart_port *port) { - unsigned int temp = 0; - unsigned char reg; - - reg = readb(port->membase + UARTMODEM); - if (reg & UARTMODEM_TXCTSE) - temp |= TIOCM_CTS; - - if (reg & UARTMODEM_RXRTSE) - temp |= TIOCM_RTS; - - return temp; -} - -static unsigned int lpuart32_get_mctrl(struct uart_port *port) -{ - unsigned int temp = 0; - unsigned long reg; - - reg = lpuart32_read(port->membase + UARTMODIR); - if (reg & UARTMODIR_TXCTSE) - temp |= TIOCM_CTS; - - if (reg & UARTMODIR_RXRTSE) - temp |= TIOCM_RTS; - - return temp; + return TIOCM_CAR | TIOCM_CTS | TIOCM_DSR; } static void lpuart_set_mctrl(struct uart_port *port, unsigned int mctrl) { - unsigned char temp; - - temp = readb(port->membase + UARTMODEM) & - ~(UARTMODEM_RXRTSE | UARTMODEM_TXCTSE); - - if (mctrl & TIOCM_RTS) - temp |= UARTMODEM_RXRTSE; - - if (mctrl & TIOCM_CTS) - temp |= UARTMODEM_TXCTSE; - - writeb(temp, port->membase + UARTMODEM); -} - -static void lpuart32_set_mctrl(struct uart_port *port, unsigned int mctrl) -{ - unsigned long temp; - - temp = lpuart32_read(port->membase + UARTMODIR) & - ~(UARTMODIR_RXRTSE | UARTMODIR_TXCTSE); - - if (mctrl & TIOCM_RTS) - temp |= UARTMODIR_RXRTSE; - - if (mctrl & TIOCM_CTS) - temp |= UARTMODIR_TXCTSE; - - lpuart32_write(temp, port->membase + UARTMODIR); + /* + * CTS/RTS can _only_ be handled + * automatically by the hardware. + */ } static void lpuart_break_ctl(struct uart_port *port, int break_state) @@ -1515,8 +1466,8 @@ static struct uart_ops lpuart_pops = { static struct uart_ops lpuart32_pops = { .tx_empty = lpuart32_tx_empty, - .set_mctrl = lpuart32_set_mctrl, - .get_mctrl = lpuart32_get_mctrl, + .set_mctrl = lpuart_set_mctrl, + .get_mctrl = lpuart_get_mctrl, .stop_tx = lpuart32_stop_tx, .start_tx = lpuart32_start_tx, .stop_rx = lpuart32_stop_rx,