From patchwork Tue Jun 28 05:32:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhuvanchandra DV X-Patchwork-Id: 9202115 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 688E96075F for ; Tue, 28 Jun 2016 07:07:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57CFF285F1 for ; Tue, 28 Jun 2016 07:07:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C441285F4; Tue, 28 Jun 2016 07:07:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCEB0285F1 for ; Tue, 28 Jun 2016 07:07:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752074AbcF1HHY (ORCPT ); Tue, 28 Jun 2016 03:07:24 -0400 Received: from mail-db3on0138.outbound.protection.outlook.com ([157.55.234.138]:43221 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752215AbcF1HHU (ORCPT ); Tue, 28 Jun 2016 03:07:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toradex.onmicrosoft.com; s=selector1-toradex-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Qa3A3Xu7qAZipXiIHf+j4d05LoiAaAcKemO2FXSjFfk=; b=DvmShKVq38NfSpmp09FZg+eVREEov5/Buht6F7WPlaX0becA0VPglu/N3c4I89hV8z7rKd4yWQM76nGTawaqV0kENIRl6qVgBxx4GVs22Cj/T/pyr25MaYXIcSFGPf0vhH2yjNfujA9YYa9KwbapXzkDqajWCQ4q1R4Ka/ye7ME= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=bhuvanchandra.dv@toradex.com; Received: from tdx-in-nb-0014.toradex.ext (115.115.243.34) by HE1PR0501MB2089.eurprd05.prod.outlook.com (10.167.246.9) with Microsoft SMTP Server (TLS) id 15.1.523.12; Tue, 28 Jun 2016 05:33:19 +0000 From: Bhuvanchandra DV To: CC: , , , , , , , , , , "Bhuvanchandra DV" Subject: [PATCH v2 3/9] tty: serial: fsl_lpuart: support suspend/resume Date: Tue, 28 Jun 2016 11:02:29 +0530 Message-ID: <20160628053235.5114-4-bhuvanchandra.dv@toradex.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160628053235.5114-1-bhuvanchandra.dv@toradex.com> References: <20160628053235.5114-1-bhuvanchandra.dv@toradex.com> MIME-Version: 1.0 X-Originating-IP: [115.115.243.34] X-ClientProxiedBy: BM1PR01CA0056.INDPRD01.PROD.OUTLOOK.COM (10.163.199.28) To HE1PR0501MB2089.eurprd05.prod.outlook.com (10.167.246.9) X-MS-Office365-Filtering-Correlation-Id: 178338cf-e14f-423e-b1a5-08d39f15b7a3 X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2089; 2:F44RaX0WOui2Gjhv1vVXpncvTC+EPn49u+/6D49TWSzQEVlNxZOv0XUNG7RFPwpVIB0Po3b9BUR/3VCN/sXH/5K1QxDRkxF/VutP18fq/bA1YnxUKNs2JO/u4+RP5mBbMf/psmkdTCYO6HfJmjr1odnVE6FaILsVcNdU7/jClkeoHtIl4HzCKQlZ9fJrcp27; 3:QIdcRQw+RC703Lxt7sz2r1lglM3GPGpdO+ncLDV3GNOvLky3Vnwa+RyCr9hWI4i62jp+Fn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vgVpNgR4A6rs5liX45e+yPVItXg7gwUvQBPsxVzNb4RhHCbLraTa77cq+/dsOz0/CfrYG8wOS5+ugnjGdygyZX0k4O4A8DcawdVLPy/JunCccHOF/PB8MAFV913XQV5meGPKktkCBTZprDrmsI6sxRmOGGjOQZnkopzyf272wgmggUxVgI9eIRmg/fw+TZw7Te/eJarMA1kidl9hPauB6YmHdFSbxLMXiK8f1rdw47Hxl7DyeyLpoQ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001); SRVR:HE1PR0501MB2089; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0501MB2089; X-Forefront-PRVS: 0987ACA2E2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(189998001)(50226002)(110136002)(107886002)(7846002)(47776003)(66066001)(36756003)(8676002)(101416001)(1076002)(48376002)(33646002)(6116002)(81166006)(92566002)(3846002)(50986999)(586003)(81156014)(50466002)(2351001)(2950100001)(77096005)(105586002)(229853001)(86362001)(76176999)(5003940100001)(68736007)(305945005)(106356001)(4326007)(7736002)(53416004)(4001430100002)(15650500001)(19580405001)(19580395003)(69596002)(42186005)(97736004)(2906002); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0501MB2089; H:tdx-in-nb-0014.toradex.ext; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: toradex.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0501MB2089; 23:xkyWnMKupZypikKClswn727JpqnR0IvPjnRU6l/?= =?us-ascii?Q?14ScZMPpxr/E1ktx6mTZZSRatQ56LkfejTg++23vYeT0ftQ1/vCPIYG46uWS?= =?us-ascii?Q?OaG3zEpvRPG1LknZR/gRM5r7XYC33WHTTLI/p+gk7Kij/vkDxzLezoa19kM4?= =?us-ascii?Q?RW59aWCzxOG4ei8GDDgHYri7lNOEKM88cHXQgLj4zuF/oWLljOyJZyGXnmKg?= =?us-ascii?Q?WZhD8DKQz9VNQqISxA24v8ARS2/U4F753OOUbYtk9hHvhnwcMJz5OCitQf8E?= =?us-ascii?Q?5VQUOfQ3i14SWeTSascm07TgpVbjTaKLwCcq2wfullEIN9NQel14h0vwNNTg?= =?us-ascii?Q?xBsCmK7gIsIY9KK/go27WO8Jl9Mb6zCBgJwR6XoP16wE7myJ7v8roKj7b3es?= =?us-ascii?Q?3cil5dKKZyoBdoLzYUNKVU1kT68gwvgy/1r9dclwucezaxGUVZYJZWEJ09w3?= =?us-ascii?Q?xeeod0rzITqUYFglIX5eM5ej8/DLlep5WSoU5pYPOrOAOAJyCA1XxZcz/zUb?= =?us-ascii?Q?T82ElH5UVab1ON+s/4asnLvl8Vbdu/kjD1S6WvXQo+yKy8ZUDpyHWjw54eyX?= =?us-ascii?Q?HCA2rqGscJZjgXAkgjHLo02gG8Tn6H4owdAC9EKUuyO9TrbpId83bQKNJwa3?= =?us-ascii?Q?0rR/mMs6H4l3UD4SxZt09ZvS/GqC4Ai6HQO+0JBnFyeTh2Tqgf3//0xJvJtD?= =?us-ascii?Q?qgcHyMlx+24eDAS+SnEkAgyzwHvMykYGL1VdVMpQIMJhazHSahTaFMd8gBL+?= =?us-ascii?Q?55b1wtXq6iOEQ9XmCKk+drhlTTuE6wi7ih3CDfvwO5MGyeWvla99ySpA12Kl?= =?us-ascii?Q?OITEAhqE6mK5owg0FIlbWSEmosjmd18mTmGOMGw13swuK+10GMru9LqgIh80?= =?us-ascii?Q?OndZEHXQ28kqYuW0bP1u5lVNEOcqOz4PBSiUmwWyKALmONesSFFyqz/rOtsT?= =?us-ascii?Q?k9jDJZe6U0rDvGqlkvZUWnflfVF49smAdpmzQ5xBmHgLbB0w0OuxYG6aGlIX?= =?us-ascii?Q?BV4DuX3Ft56ctBprJLLbqkeUMC4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BfL5lGHZa8qAg3uj4C9Dchgru1bzkhsb0j2oH4wIgu0g== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2016 05:33:19.0258 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0501MB2089 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Stefan Agner Add suspend/resume support. Signed-off-by: Stefan Agner Signed-off-by: Bhuvanchandra DV --- drivers/tty/serial/fsl_lpuart.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index fabfa7e..75a2098 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -483,9 +483,8 @@ static void lpuart_dma_rx_complete(void *arg) spin_unlock_irqrestore(&sport->port.lock, flags); } -static void lpuart_timer_func(unsigned long data) +static void lpuart_dma_rx_terminate(struct lpuart_port *sport) { - struct lpuart_port *sport = (struct lpuart_port *)data; struct tty_port *port = &sport->port.state->port; struct dma_tx_state state; unsigned long flags; @@ -510,6 +509,11 @@ static void lpuart_timer_func(unsigned long data) spin_unlock_irqrestore(&sport->port.lock, flags); } +static void lpuart_timer_func(unsigned long data) +{ + lpuart_dma_rx_terminate((struct lpuart_port *)data); +} + static inline void lpuart_prepare_rx(struct lpuart_port *sport) { unsigned long flags; @@ -1925,7 +1929,12 @@ static int lpuart_suspend(struct device *dev) writeb(temp, sport->port.membase + UARTCR2); } + if (sport->dma_rx_in_progress) + lpuart_dma_rx_terminate(sport); + uart_suspend_port(&lpuart_reg, &sport->port); + if (sport->port.suspended && !sport->port.irq_wake) + clk_disable_unprepare(sport->clk); return 0; } @@ -1935,6 +1944,9 @@ static int lpuart_resume(struct device *dev) struct lpuart_port *sport = dev_get_drvdata(dev); unsigned long temp; + if (sport->port.suspended && !sport->port.irq_wake) + clk_prepare_enable(sport->clk); + if (sport->lpuart32) { lpuart32_setup_watermark(sport); temp = lpuart32_read(sport->port.membase + UARTCTRL);