From patchwork Tue Jul 19 07:43:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhuvanchandra DV X-Patchwork-Id: 9236239 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 150E36075D for ; Tue, 19 Jul 2016 07:47:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06C502015F for ; Tue, 19 Jul 2016 07:47:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF4712074F; Tue, 19 Jul 2016 07:47:07 +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=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A09F52015F for ; Tue, 19 Jul 2016 07:47:07 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bPPiT-0007Eg-DJ; Tue, 19 Jul 2016 07:45:21 +0000 Received: from mail-ve1eur01on0138.outbound.protection.outlook.com ([104.47.1.138] helo=EUR01-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bPPi4-0006IE-1T for linux-arm-kernel@lists.infradead.org; Tue, 19 Jul 2016 07:44:58 +0000 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=rc1pwOxj6UqquDnpNcTYKltEyIwFtctxk6N5bq3Ks251GHjoDhjBy13yMiW5pFIW8cywuYXSUReQTCiAe18afc1bmge06rRFGhjQzlRZD90grhadSMvCXD+R7TNk98i1OkiHxEWQIV2dTkSwnvxlXqV8cDE2dT8oYWNfXyg9Iq0= 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 DB6PR0501MB2087.eurprd05.prod.outlook.com (10.168.9.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.544.10; Tue, 19 Jul 2016 07:44:40 +0000 From: Bhuvanchandra DV To: Subject: [PATCH RESEND v2 2/8] tty: serial: fsl_lpuart: support suspend/resume Date: Tue, 19 Jul 2016 13:13:04 +0530 Message-ID: <20160719074310.16872-3-bhuvanchandra.dv@toradex.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160719074310.16872-1-bhuvanchandra.dv@toradex.com> References: <20160719074310.16872-1-bhuvanchandra.dv@toradex.com> MIME-Version: 1.0 X-Originating-IP: [115.115.243.34] X-ClientProxiedBy: MA1PR01CA0045.INDPRD01.PROD.OUTLOOK.COM (10.164.116.145) To DB6PR0501MB2087.eurprd05.prod.outlook.com (10.168.9.139) X-MS-Office365-Filtering-Correlation-Id: 97cf2868-b986-4cb7-7ee9-08d3afa88c41 X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2087; 2:LGJ4NTsReBCE7N3a0Okzkxyi4ZpgEYAHV+EADGGdESaSQalzgQQQDYQDATtgqqLAfjxpPQkPDTuabGovoWnZTaF9AoU1m/zabwJLyBjSex4igB7cq1mkB2Il71NGiJOOwgN0hzxe0oxwfjd6Wq5NtPnCDKMepzvX+OCwh32fpsm7LvcoW1J0OcO2v4JCFv+v; 3:DgUuyWH39x0OLkyeiyiA4wLFh9x/gOtE5R/u21VV1HK85yASqAK+CVEA0bFS1yUXLqMeSeOXwO2Y1Jt++rYhK7j2MAKQqrZXcmaka6Lnz6zanBOiKBnIIh0RN47g/Up/ X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0501MB2087; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2087; 25:QeShoPd7dvbJ1uEG8ly/gNO7aMTYj+ndG15N3pzM+d0IItgPpfPvTlY98RTzk7KeSPcFKYvqksROI5v5lqEbFRY/pkOYIMhfLluLhFFjgePSqZtBgmzUh4Z5rDuMmdAeTAh+WlLKaLtGrEuurHZpMt5OC+uE3+pMnKYHWlR3VxrvLf2ixIZ9qDvNURURnGwO55K+jUmaYyz3IqY8083sRT+Fi05XoM51dnD8TubFOlxyu4HHi6i+qBzmpR2+YYdFy85to8Xbc02f0wQ1h4c60nWXIqB4azsGiKtPcMvIsCymMhs5V+zwfXOt+JGgjAdR/Zn3Bud1Vr73g6BusCt/d79ObWTOAKSHO4+HJ1JAgr9mr6UVEqAKZjxo8qi+FyWPN0oOSapfX4u42Y3xprm3CwCjiIyJvUJxx2IBs52V/2x/LkOHojjqZucZexPkFf08VnnRY18ITC9w3TGXMnrJ5wGaLuFxoO1OpXmFDYGJctbaBe6MjpbEXZYLJ4n8kyIM3LHciirLzIFXkSPFu+L0uAY7MJiipo04G0cnP5PigxoHi/HoveOWTcedgea7LvC3CIaQU00NbuNl5PI0rMQMRBlLhqiCCWt00N6Tujk1kAC/ldv2MfDkOUiUID0FmEGx0cragS84Cb6OsOCRQMqpnrN+pUSu8V/idb0n4oKkLGeHLDmAot7xDF/bQBBwIyZlndmPpakD9fJd8h0lbSrro4wMq0Fx+zrRUtsvhcq3utoDont8NwSfyId904Ycp40S X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2087; 31:kBPgMc912UedYsaXCl+zqmT0nHvgnlhagmdt1v45LxjcrcixXWnV4QhDYGnWlEUqu2U39OF17udF4oMKcgegwJNm50ji5SolDVCQvssFQo9sS9oDYlNvFnPYFGIms1xwHEBJ9GJ6OZfUTANZ0/wHdI8HFiNIyM02OdEphj4NNtdKzIOdtFbXT97ewYUERc08ZMb4wv0WZv1aCQs5Tf2IRA==; 20:e2jOWWEPMHl9GlDbG48fJgR5zttNFnoM2D2LB0ab8/mQtuCeRhdDYgtAh4XoZ8hnuQ1+A2s8EAJ6fTgEiNhdzYIoEJDbAwMVXFwToWCSqIEV6bUT6JTtHfC0uZE2IyOW5e1NHeAufM5F60GMSpKQ9b0zXnEPuftX529uYfYPIzlqjNVYcbcTpgApRImAQc2MtBBTNZEV6w79LY75fC3fu4rMTjaLIudqQpxXmalVfyliCITNT9iGsrtNVVFZK6RIDad0TBjUGJ9qiUsahB5mmEvlqi/HuMRZ03NyYaM7LZh43m5ewQ4Opv/kz/6m8bRSah4PFfTiiGStYJXKc1UJgA==; 4:cqPefw4lJH0pvvoWsjYUbqDX74xSRiD8Wzs5E77DzH9cSl1PlCK8IRn8tuVCKHW/HXH/IfDHqSx4Af2bjN5dPArvUoRNOhyZEJcqxPPcoDDjgRtS8I2bRTiHrErs2uCN9gVVt6U01jTpBgXk7DX4MrB7ii1xXFE2lQx/Svtb4/e4Ly1KbWZ1mkji6QZm/5uVNF8hpVJr+gOkBIrf+qD6CUKROlxv2svPa1fovCUx+YRwzkUo5o6qnU6ib6irjbXEn5nKEMTYG4OpGlCZTb5l0q/FOcc5/Y4KeMRcdicYdbvafaZa0KNeFN7qnRTwG5AIPu/C8ZEzuwm5pzA4pNgbSdSx7VQ+u8miPHVzOI83vnAS63n1233SzDTX3D3BJF53 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)(3002001)(10201501046); SRVR:DB6PR0501MB2087; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0501MB2087; X-Forefront-PRVS: 000800954F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(77096005)(36756003)(42186005)(69596002)(4001430100002)(19580395003)(86362001)(7736002)(19580405001)(47776003)(5003940100001)(2950100001)(92566002)(50466002)(66066001)(76176999)(50986999)(50226002)(4326007)(48376002)(6116002)(3846002)(1076002)(586003)(97736004)(305945005)(68736007)(189998001)(105586002)(8676002)(110136002)(15650500001)(107886002)(53416004)(101416001)(2906002)(2351001)(81156014)(81166006)(229853001)(106356001)(7846002)(33646002)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0501MB2087; 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; DB6PR0501MB2087; 23:0X6omi9sB8Vz3wF8H3K4NC3ti+HzSmChb7tRI00?= =?us-ascii?Q?o2Pxdudp5ggEnvwBcEsdnvhC+0LHQgyCHnno6BvFwHnCI+AeV/Tu4C9xy/yI?= =?us-ascii?Q?ZYpnyTMvPC9CtVFFZEZnXwH9ZxgmHmnheoS6UNPqlq4Ww3AFT23o3F6sQt9t?= =?us-ascii?Q?3+9xPrbEWfts467awBG377klunpAIZUoh2Q6t1J6ZQpYlLOxnzczpjpBQDd2?= =?us-ascii?Q?RjD3SVMCHzqrbe4OnkG9FsJFgzp9sDdLmeh+0r2ZX2Tw/E8tOwrcOPpuC00z?= =?us-ascii?Q?U3YCRq2ufJj3yQbGPH6afqMqg6PLqI9v/BDofwu6QcKyhnbBum9OtkCBnKBz?= =?us-ascii?Q?4r7Mpf97Ix1i4PiGEo6QG48A/Ubb8glAxEvmTRWkH36vm/BAkEkP1TliJ5NU?= =?us-ascii?Q?EsuC89fKssM26rikHXxWORB93huvG/duKcCVU1y+29cY5LlpYoVc2W7EyFYn?= =?us-ascii?Q?EHcI5+ARuo5rQ4kdpEXMn3Sbwg5v/7D0WoYSKRjVOrCziRPZNdrryhAOEa+a?= =?us-ascii?Q?jA6rkIFnKW/IkB8YNXBBTTikJvgqG3Csgu0gFtZD0F53bwPQOZKsGv8cTISI?= =?us-ascii?Q?8ybwjrnfcmNzk2GA7D/Vi5JbKUxy5HNqujEf62fmzsM/p+hDuPbNfIowcKh6?= =?us-ascii?Q?t6wjobHjeMyyp7sri/aMCHZj9b0R8x/9jlTowVIQP/dE8tdqm6ylxinB1yNb?= =?us-ascii?Q?QIcPV3JdGgxyqcVPdlL8jUkB1axomf/L14fMyLbWHo8KXqdnAMav4qaLV1m1?= =?us-ascii?Q?e8dmTHOf3EwBFXZGg17erRMof/GARmbgH3HXixQgUQvCYyulCwHCGZWPvF76?= =?us-ascii?Q?8behEUboaW7xtxGVSAh7qQMM1MfTKw3rBiDkiXnTL8TPRARdFHhYYfGhfsdZ?= =?us-ascii?Q?TxEau9bqqTj4Nzs49Y/gI6LFE0zLQq701N8zr1k9MHYJ6VgQ4+rELPYzSDz8?= =?us-ascii?Q?6hhI48FDvjblBnB726MF5omTfpEZcmE9DlPM3+r08A87nRmrIhRiv9zjGrbe?= =?us-ascii?Q?RbJb80k3hnB5jGMaDbrspojIM0aZW3wtXxFTSUz+stE+4bYf9FQgKA8qlFw7?= =?us-ascii?Q?2lkMF22VFt4P/tmDm3wrQICO6cngAVxvYcrwN0npNeR/3nOmCrdaeP+Zf5Lz?= =?us-ascii?Q?SoYCBBpBvNMkIV48U/FHcPjw5AIqXGbRB5YPk4d5Ug67lfX2WhzxtVaWSDJX?= =?us-ascii?Q?0i4PbHkMA6vw0PWf3e4tSf9Sy2AOugO0f5TeMsxZE8T3kc9iRWSdntaaWfw?= =?us-ascii?Q?=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2087; 6:i/GtAd6ckU54zTBDeVFp6KSrlxK/Moste112Gh9HJCS546MGeLoYuNA3UVlmBEZh79zne3UWLw7bmKB4VREMJk+/9/oIum9qotyfyphaorJ/KfVuWNchRq1itjnmA5RuO9SG/b3nW8l/Ho5z+xCl1+5cG2S52z+oj+qYxhYVvaB/m1tFF3H0DylPOFY9VqBkoAtdEbtUbBlIyB+TpAT2d8VBkjCPouSthLifTcTrtLGkvPwqWTFlKPQBf+O7OEhi59M122eHIlu+EAw690zdBl+8OSZ6+jyoLVNAw7ZTzJs=; 5:JkaFSBOddxEPTZVkq3bd8+kvIvNxWymKMvmrxQcyiEdECiyhSFOghMmn43ezow+8l8zQGjjqaGdaASErmYJ6Q3raFTCcm1pURO9hK4oB6NkTuK0zIwxPYyDs3euKrW/YoBx9IrHFg9L5lBFfDT+FLA==; 24:xD+tP4NuXlvsxg+KSpknGF6Pt8O/VFAtfKjyEVL50Fe3QHyXSLUnuebAPVao/SiGvHjIp0t71JF9/pMbb3ZmtSFXr/OreqXS5ULdymXikFU=; 7:xkorwcWYqFeWwX1Iszb1OwfpvSnbewmiJK8fZyroTz+06lJoGfCy9Uhy1PZfDfDWqwwnedlQOfYNYEWKmpoSTk1vow0WKl+ZHRYlA3LM6RtEl6Ye0wCu8KECDqD+hjt5WhSUaMW0mTO87nDl5CQ6Gys3eIFCu/33qiGDxAJL3SMkgN2eLWf+lODe71I1Dm4LNtfsjVC3tXnT9oT74RqjxsfQPkvFnmd3ICuaAFppZEvXFKT01jl+raY51pC1eZaY SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2016 07:44:40.5379 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2087 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160719_004456_434619_72E43A10 X-CRM114-Status: UNSURE ( 8.76 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-serial@vger.kernel.org, mturquette@baylibre.com, sboyd@codeaurora.org, linux-kernel@vger.kernel.org, stefan@agner.ch, kernel@pengutronix.de, jslaby@suse.com, shawnguo@kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bhuvanchandra DV Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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);