Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755212AbbLaDTo (ORCPT ); Wed, 30 Dec 2015 22:19:44 -0500 Received: from mout.perfora.net ([74.208.4.196]:62567 "EHLO mout.perfora.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752168AbbLaDTm (ORCPT ); Wed, 30 Dec 2015 22:19:42 -0500 X-Greylist: delayed 333 seconds by postgrey-1.27 at vger.kernel.org; Wed, 30 Dec 2015 22:19:41 EST From: Marcel Ziswiler To: linux-arm-kernel@lists.infradead.org Cc: =?UTF-8?q?Petr=20=C5=A0tetiar?= , Marcel Ziswiler , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Jiri Slaby Subject: [PATCH] serial: imx: fix dcd interrupt firing during probe Date: Thu, 31 Dec 2015 04:12:45 +0100 Message-Id: <1451531565-1233-1-git-send-email-marcel.ziswiler@toradex.com> X-Mailer: git-send-email 2.5.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:6jZp+pQBF8xdi3MMr1ax/oaFePMmj8yClkLtS4GfJD+FY9jbKuf VCJqlwQXN7f83ze4KNyn5+Pd7ABGpYup7H7L0pnVdLqeemZDggyoh1j0JxCje+cUV2/Sa4o tFjeRt7mGOUcZTA3Q/e79V8DiNmyLODBgoyrTbf2VhEixzw7SExYrMomGb6Mfz3nYeXVzG5 AJWfHArNi2D1aLAemDkmw== X-UI-Out-Filterresults: notjunk:1;V01:K0:WHHf099DOuQ=:Mq1A7ow8HhhtkARhcJodGx PPmqLgRoXXQ734WWFATlWJOQong6j3qeFpl0ODHZtqLtKIPlH8fGqP5pZwdJlVbABsJY01W// 4NKH5Wd/zul9gLBrWuxSJ5p3KWd97CXg6socGPD7IXJ9yTl4sOvfC4PA3wWBwyB+qgB/wlGqi dUXAGCJUaeIe49SAqWKna9qqz2C/Zl/L5EsPAvra7FZW4sovWFQGO1djS4tPVOw0+ePVWkzXK lOJqqpSexM8zApwWsZuLey6XHQ1oc3fDLnp2wWFeLpbfzYMK3+vcGpVgclahtmXHbroHH10Yc vRwEe7hbQEbMfFtuNfrBLEoTGHrPacRTsCqMgmvsKFia8Z12phR07SzuSA2XTWVWeQjseNQ6s xJBcUk5ZHGVXbjmxMsLg485eBbCN7Yz9F6Ijakh7HvmSrM3xaZ85E3vdOCC0BA5ypkzv6626j ne0sKA/NjDvC57fZdbJKMVnXEB6Gam7nIwiJbf9eh9AgqHJ3TqpUWnlaCO/IE3lQiWNUfubg9 h2ezXGAuj04xIhSAhL4WJ+iWveuI2W+jhqiuE9d69rqWMsfE9/5WBvVp4xffMJPzqcXWjtqYZ X1+8ZRSDlgxCBvToZI2N135uUQQdm8dcaa9BPBhHiLM2RALliCtzXD8zVC1ZLZymT89zKVS5i 8sInuYR7pKhYa29v+k22GBChAyT95cko2CPUMfptbT092bGxAQ6wOMmgEsFB6hRnkNZ5VCi5U opTTgJjQ8Z4dwrTt Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3101 Lines: 75 Continuing on the Apalis iMX6 mainlining work started by Petr Štetiar I noticed that it only boots when rebooting from NXP's downstream 3.14.28 kernel or mainline otherwise (e.g. when cold booted) I did not get any serial debug output at all. Enabling earlyprintk I got the following: [ 1.136806] INFO: trying to register non-static key. [ 1.136871] 2020000.serial: ttymxc0 at MMIO 0x2020000 (irq = 25, base_baud = 5000000) is a IMX [ 1.150651] the code is fine but needs lockdep annotation. [ 1.150653] turning off the locking correctness validator. [ 1.150664] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.0-rc6- next-20151223-00002-g6008f30-dirty #27 [ 1.150668] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) [ 1.150675] Backtrace: [ 1.150701] [] (dump_backtrace) from [] (show_stack+0x18/0x1c) [ 1.150722] r7:00000000 r6:c0d20848 r5:00000000 r4:00000000 [ 1.150739] [] (show_stack) from [] (dump_stack+0x8c/0xa4) [ 1.150760] [] (dump_stack) from [] (__lock_acquire+0x1d88/0x1eb4) [ 1.150774] r7:00000000 r6:c0d063f8 r5:c155f834 r4:e503bc20 [ 1.150785] [] (__lock_acquire) from [] (lock_acquire+0x74/0x94) [ 1.150803] r10:c0d6eb5e r9:e597b300 r8:00000019 r7:00000001 r6:00000001 r5:60000193 [ 1.150808] r4:00000000 [ 1.150821] [] (lock_acquire) from [] (_raw_spin_lock_irqsave+0x40/0x54) [ 1.150834] r7:000052c8 r6:c0481470 r5:40000193 r4:e503bc10 [ 1.150852] [] (_raw_spin_lock_irqsave) from [] (imx_rxint+0x20/0x2a4) [ 1.150862] r6:00000000 r5:000052d0 r4:e503bc10 [ 1.150874] [] (imx_rxint) from [] (imx_int+0x170/0x1f4) Debugging a little further I noticed this actually happening after calling devm_request_irq() during serial_imx_probe() even before uart_add_one_port() did initialise the spin_lock acquired in imx_rxint(). Turns out the data carrier detect interrupt fired immediately upon requesting interrupts. This patch fixes this by explicitly disabling data carrier detect before requesting interrupts. Signed-off-by: Marcel Ziswiler --- drivers/tty/serial/imx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 9362f54c..b1588f9 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -2032,6 +2032,11 @@ static int serial_imx_probe(struct platform_device *pdev) UCR1_TXMPTYEN | UCR1_RTSDEN); writel_relaxed(reg, sport->port.membase + UCR1); + /* Disable data carrier detect before requesting interrupts */ + reg = readl_relaxed(sport->port.membase + UCR3); + reg &= ~(UCR3_DCD); + writel_relaxed(reg, sport->port.membase + UCR3); + clk_disable_unprepare(sport->clk_ipg); /* -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/