From patchwork Tue Aug 18 15:43:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 7031971 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 057E6C05AC for ; Tue, 18 Aug 2015 15:46:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 167AB2066E for ; Tue, 18 Aug 2015 15:45:59 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 26C6620660 for ; Tue, 18 Aug 2015 15:45:58 +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 1ZRj3V-0007qw-45; Tue, 18 Aug 2015 15:44:05 +0000 Received: from mail-bl2on0106.outbound.protection.outlook.com ([65.55.169.106] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZRj3R-0007lj-J9 for linux-arm-kernel@lists.infradead.org; Tue, 18 Aug 2015 15:44:02 +0000 Received: from DM2PR03CA0038.namprd03.prod.outlook.com (10.141.96.37) by BY1PR0301MB1304.namprd03.prod.outlook.com (10.161.206.153) with Microsoft SMTP Server (TLS) id 15.1.225.19; Tue, 18 Aug 2015 15:43:36 +0000 Received: from BN1BFFO11OLC002.protection.gbl (2a01:111:f400:7c10::1:188) by DM2PR03CA0038.outlook.office365.com (2a01:111:e400:2428::37) with Microsoft SMTP Server (TLS) id 15.1.231.21 via Frontend Transport; Tue, 18 Aug 2015 15:43:36 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11OLC002.mail.protection.outlook.com (10.58.145.13) with Microsoft SMTP Server (TLS) id 15.1.243.9 via Frontend Transport; Tue, 18 Aug 2015 15:43:35 +0000 Received: from fabio-Latitude-E6410.am.freescale.net ([10.29.244.80]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t7IFhVsV017328; Tue, 18 Aug 2015 08:43:32 -0700 From: Fabio Estevam To: Subject: [PATCH] Revert "serial: imx: remove unbalanced clk_prepare" Date: Tue, 18 Aug 2015 12:43:12 -0300 Message-ID: <1439912592-14779-1-git-send-email-fabio.estevam@freescale.com> X-Mailer: git-send-email 1.9.1 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11OLC002; 1:TqBC3j+FCGg4/m1JmNHiY1++bO+5GELSF7G6ZgG6rmbUtlaSYx7gS2rm7FUb6QHdQlQUoPsn1EuC+xTLgl3RhK4Dm1uQEuFkDcHHkhfDhB3Iq0P8RONH+qa0kRuEeRVlMIxGGmXWI6fQHmcs65O7qReqHaLPWPskbFaR2mK/HMoqXZOwTC5Ty09wB7HLRv70uxJVCTEZW5EAvFxCbGsi0zdCwEo/RzcJ+ve6w+z5Ydb0gLSkBuAHKWOdmWaOyzdM5zU/8MhZZvNK4hmREAAsGrqIIUkfVs2XRaUZrKCUgREqDnIXswPf5grdUM2xzDLEkrVR5j+31/m7x+o/byY8bqd3dJjhiTGJVS5vpLQbt7P/pUEdbGOsg/tXzQOc9iLmk9txMINSCtnCnOyMdATK+Q== X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(339900001)(3050300001)(189002)(199003)(69596002)(33646002)(48376002)(87936001)(86362001)(81156007)(19580405001)(110136002)(5001830100001)(77156002)(4001540100001)(97736004)(5001960100002)(107886002)(5001860100001)(575784001)(68736005)(50226001)(50986999)(77096005)(19580395003)(6806004)(92566002)(106466001)(229853001)(2351001)(105606002)(104016003)(62966003)(50466002)(47776003)(46102003)(64706001)(5003940100001)(85426001)(189998001)(36756003)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:BY1PR0301MB1304; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1304; 2:Uc4sA/yeOiINFcFoF6n1ZFF1aD4M8zGU0cPU/JqYEHoeocglLa7zxUZ+Gxx1YnPWS2TulD4BOAbIbynVMzwLEFHJWEFOCRAIWspQTFrDAR8fx79j5/3YNc/UR/+yiYRn+veaesyNGdwKmEshTxPvxWbCth1Pq9VQgtTNLQVK54A=; 3:hm2PrLJGYDckrE1P5+CMnc8pIGzAUo//0gCXDjiTt8EQju5dvoaa+MS7lJ8fw9ttr/hw9g/pjI6gde4JWA9quE+jcmkIhZguok0yEIOVas9UCPkYwnmDX8Dy1Bvq6VmqvIcZHbmvR75w5Xmxo5k7ovoDyxYaWDw+gb6SonPp3BnRuiNQsnU1V5CzzUvnM4NN55YwysmtEF4MX0vVj4nR+PFH09E6649mOIPakKV9q7g=; 25:0mDRua6kOMcEy4X6ou20VtlP/YDKvqAixuUbR4bjhW2FeWqAOUQSswTrnqhJucX1HMM41mt9ZypVwYyP9i/COJw9SZducY4N1XNfqqJLBDlyhSaGeyps9ZphR1F0c3o4SWsm8ZxG6cJDonf32kI1rWg24mgSAgpi8nIyFunwbT/yP7BbC8jHzDEJ8qidHYi6xG4l/TLhirkhxKAbTd2jiboE917PDKRaZf7LFTolktGO5kuxEyTvkv3fqBJRHpl2 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1304; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1304; 20:tnjp5XngtelNdkl3E91UjEp247LtGQ1fjJ3XfVBJgtfjwnVLzxqcDFCLGo8KWyXOkyQHddxM1t64LqHKymFIVxWvSHsh2/26Wf8ccXWupcTmYLzRqURP7qJXhwDXuiMWgmLB5LyNoRfV6tNLI2OZMcbNOYpZUQCdxIogvMJb0IqJ9hWaLgIusOqTQMm/H0hQxH7xgKClBLs88lpcehnQxxq1tIiJDzE7RvXMIlYkmoCQmEVOdXt5iYyRjwho0zibE2Z3rIF2cHQZJHc52tUp5t09Sv2q6mJbZaPSzDY9Ydh05/nZxPj/7VFY6hxBUUSSlyqoQG38gJCQo91Q8HysBYLpOEr72ELnx2uV+Lw00lk=; 4:LvuVOTBzwUmC5/1/y/cGHQ+vjd9xki0Yfy+fC4NAVR2D+unv2tkDcwwtBKVqhKaIOW0/MaYHVIWm/rg0edexjo+CzdisFdTqArZP2zHTnhgNrwLRZGlffqLZl0kKyMHEOLVr1QYvq/uEakNIHU/apxiGHy942YxfErwiJmlsKy871thkNYl4CkOvyhiDsntY3RgbfYk65knwGwF5owuDiKiCd/y1Too45D+lBugNUqAIHbUjlSquRpS9GmdEH3+rk0jdIpJLuku5esbCUhzlbfGxeG/mq8ej1ZkuiO/HMUawslH3qOFBuddhmqW4gL9+ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(8121501046)(5005006)(3002001); SRVR:BY1PR0301MB1304; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0301MB1304; X-Forefront-PRVS: 067270ECAF X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0301MB1304; 23:ARK2O4X96n86kVzbA9kRR2gz9xuSbwZeaTgCbw0?= =?us-ascii?Q?GL8MUWZvIz2SGehU7jqkHybVEhaKZcmqUcJxkGnQc6/Ei8djtSeTLBNDh7gb?= =?us-ascii?Q?agnIs0UkILjVaRlkRdAtWTQAp57jU71AIRQpEAYKVY0H79x2196RziJVia4G?= =?us-ascii?Q?B4NBpjdMlNVNdq0n23WE3PsNFt39UAIJR+TXbovx6HV84G4M6nBTlPHQCX82?= =?us-ascii?Q?NVxebeF3s7p8yu+BKZVMb4S+S0KWpaEB6Zlw3qSPEfVoUwRcWrDAFFjyYnru?= =?us-ascii?Q?P+UuXE+bLr1v5ID//h1IXXda604G4IlAx2akm42ydvqFmJWS6pOhwJb6VTzN?= =?us-ascii?Q?wtADyDAPMvn72v+62+PdSlfV5AJpO610knDmAl1MRoQyry7oK+Hfb/7amrV+?= =?us-ascii?Q?8INm+k7LrG355SK21SdYi4J4FXynwAZhnm9NKgSFHqagKD2q+rD6sE9Fwl8I?= =?us-ascii?Q?kZd9Z0CfHecFqkTPZI/qik4CribPfGxn5J7zrwnGebmlVRx52XguUAEfEu/b?= =?us-ascii?Q?QJ/wIcZumgI9fn4y6w9U+JcpaekM0zRpXsvH7ctR/ZM5yllrGa/OVQEi//1k?= =?us-ascii?Q?6FSThO2a9SQx0rLfi4foPlwOwkz5DW7jB6iaNpwaSYqgZ0KAjlJT/Pr90eLr?= =?us-ascii?Q?z50YTs21WGJJhSYmyIdwLPtE0YAfn1xCXuZhCxAsQFmSzZaUisPfufeOxtmB?= =?us-ascii?Q?4EtOUitkL378Th8bcjrmf0scoTuN/qTPuwc0xu0VL+fM7xhEul8hPeLglRxm?= =?us-ascii?Q?SqdIITqFCbK0UOzLIjsxLyMsVWGQvnWY64yn5xojQ1xKizp64zwP4t3r435z?= =?us-ascii?Q?qJXwmGUYjylWjflvEe0XOixMLJIAM7ir540oO887Q00ntxyEMyX49AIpc2G6?= =?us-ascii?Q?4CGB93CZZKm03qbBTgjLqs6ke5fzRz2aEk0+WquDjT0zKJUeoEK2nYfGXMrM?= =?us-ascii?Q?34+Cb05zHS8EU1kU2rfnLf1SDR1URLh5IEO+B9n4/v+QRsmaPFoOo59VU6u6?= =?us-ascii?Q?d89qSdsFOnlGCe2cLFn+KnTTWjKj2T4mOUys0K8Run8tpARK7e2N7W41xP/H?= =?us-ascii?Q?RdMjS20zK+FqzDa5alQL4IUful6HuMWUe+X1gfgMjD/KfhNESdvjGvaEmVyk?= =?us-ascii?Q?mbo8X1DhcJii6R/4kEI5vw6jpzaDv+DAukEWw0cKk+dwP42UaVArE1g=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR0301MB1304; 5:ZeJ7qWedox8xEwUDcEbyyJ/ZjknVGRCEvMhn4SoDlD5uyvch921/+1GG1t0fCQ2OMBXLrDaFITl+5xjVnkdDhRIC6a8Jv4fOqe2Os/BwNRftUOLwnhwgzYiys4orIRE4zDmmb9/0tu6aEBbNkuGNDQ==; 24:y3+Lq+TIbY2F2Am/YXQBd+NVEoavwzhlqOJXlKfvoET2qg/0v5eaXmZ1ppCQsj4CUrKDcOMMExjrLbQyOc1aaeUCs6omRjWHlhG3G/oQ2h8=; 20:9FBNmCEW2l0UHCA+oFteBUxDYGZyuJpEWS72T1ok53YvUiWAXTPcjN67RHQw9kT63R7lYUsQXGkDGK7AIxaPIA== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2015 15:43:35.1838 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0301MB1304 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150818_084402_021809_CA31C77C X-CRM114-Status: GOOD ( 15.81 ) X-Spam-Score: -1.9 (-) 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: edubezval@gmail.com, Fabio Estevam , linux-arm-kernel@lists.infradead.org, linux-serial@vger.kernel.org, kernel@pengutronix.de 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.6 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, 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 This reverts commit 9e7b399d6528eac33a6fbfceb2b92af209c3454d. Commit ("9e7b399d6528ea") causes the following warning and sometimes also hangs the system: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 0 at kernel/locking/mutex.c:868 mutex_trylock+0x20c/0x22c() DEBUG_LOCKS_WARN_ON(in_interrupt()) Modules linked in: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.2.0-rc7-next-20150818-00001-g14418a6 #4 Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) Backtrace: [<80012f08>] (dump_backtrace) from [<800130a4>] (show_stack+0x18/0x1c) r6:00000364 r5:00000000 r4:00000000 r3:00000000 [<8001308c>] (show_stack) from [<807902b8>] (dump_stack+0x88/0xa4) [<80790230>] (dump_stack) from [<8002a604>] (warn_slowpath_common+0x80/0xbc) r5:807945c4 r4:80ab3b50 [<8002a584>] (warn_slowpath_common) from [<8002a6e4>] (warn_slowpath_fmt+0x38/0x40) r8:00000000 r7:8131100c r6:8054c3cc r5:8131300c r4:80b0a570 [<8002a6b0>] (warn_slowpath_fmt) from [<807945c4>] (mutex_trylock+0x20c/0x22c) r3:8095d0d8 r2:8095ab28 [<807943b8>] (mutex_trylock) from [<8054c3cc>] (clk_prepare_lock+0x14/0xf4) r7:8131100c r6:be3f0c80 r5:00000037 r4:be3f0c80 [<8054c3b8>] (clk_prepare_lock) from [<8054dbfc>] (clk_prepare+0x18/0x30) r5:00000037 r4:be3f0c80 [<8054dbe4>] (clk_prepare) from [<8036a600>] (imx_console_write+0x30/0x244) r4:812d0bc8 r3:8132b9a4 To reproduce the problem we only need to let the board idle for something like 30 seconds. Tested on a imx6q-sabresd. Signed-off-by: Fabio Estevam Reviewed-by: Eduardo Valentin --- drivers/tty/serial/imx.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index fe3d41c..d0388a0 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1631,12 +1631,12 @@ imx_console_write(struct console *co, const char *s, unsigned int count) int locked = 1; int retval; - retval = clk_prepare_enable(sport->clk_per); + retval = clk_enable(sport->clk_per); if (retval) return; - retval = clk_prepare_enable(sport->clk_ipg); + retval = clk_enable(sport->clk_ipg); if (retval) { - clk_disable_unprepare(sport->clk_per); + clk_disable(sport->clk_per); return; } @@ -1675,8 +1675,8 @@ imx_console_write(struct console *co, const char *s, unsigned int count) if (locked) spin_unlock_irqrestore(&sport->port.lock, flags); - clk_disable_unprepare(sport->clk_ipg); - clk_disable_unprepare(sport->clk_per); + clk_disable(sport->clk_ipg); + clk_disable(sport->clk_per); } /* @@ -1777,7 +1777,15 @@ imx_console_setup(struct console *co, char *options) retval = uart_set_options(&sport->port, co, baud, parity, bits, flow); - clk_disable_unprepare(sport->clk_ipg); + clk_disable(sport->clk_ipg); + if (retval) { + clk_unprepare(sport->clk_ipg); + goto error_console; + } + + retval = clk_prepare(sport->clk_per); + if (retval) + clk_disable_unprepare(sport->clk_ipg); error_console: return retval;