Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp452769imm; Tue, 3 Jul 2018 23:30:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe25FRA5AtQ9FDLMxLi4zYcb5HPZBlm6Ev+kcBaq/Y1u9T8ylhQ1sGi8GRQJdQAGiz8ARRX X-Received: by 2002:a17:902:3181:: with SMTP id x1-v6mr828868plb.198.1530685849739; Tue, 03 Jul 2018 23:30:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530685849; cv=none; d=google.com; s=arc-20160816; b=jJoVUSeJnoomxwz5kjhzMsrITxQ/TBBuXLuGXFf4wuhASi6fk+qAfY14HU879i4stj o/loR11HYulZWirwYMr02zoxYCe/FXeSOoo0snw1JXt1fzaZ9I2uQR9/3D3W+1+gNr01 1iVrmzVzoOekyDp0CSiqTnceeU64cYgAcoPJRa/8vbad4kLnzR7aRPxzgHdRJCT5ZuKy mlUtZ0y8RrzJeqxSeD1U3Lfp/NpgpCd3rYHA6SVSJhfZSSiVZebNwctzcyxP61bAjkQv c7vLHSVWJYNBSGvTspU0W6SelMANKin6FTfLQlGTTY2f1Lu/ReLQHtHkUsnex7vB0j++ VLhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=FfcUVOGG6VZ0hpywgMdpxWV46ztcHUCi+R5tFzeH9eU=; b=CuaZ+eag1+a1mIRq0HTWF1TgUDfZigbLO3nS3vRZcvnLN3mcPtNmJHO2IV9Pru10P0 MTkTukIfhJNIv3XpU6439SD7Hp4lnVK+5O9Q9Hd0l5a2vj14yRuzaWMEJkwGRfGOtGmQ rx7DzA3evyZtozeLvEE1dN+G6OubttAjMpFoOFALluqR0aF8rPsiYDzE90dj/Ri1VoU0 YhoYFKBUt19OLhgy9a235WWbpfAgkUrEBL2fyMjOS7PmZjA8sbt3w+Xo2AwrNXngHNhE ytOx4fpbBWlTNMw03NQ0FyOFxjbYuAi4xNXjWUyaztakAqCE+or15uvBxJNvpZr7XYMk ipQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1-v6si2605575pgo.175.2018.07.03.23.30.35; Tue, 03 Jul 2018 23:30:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933722AbeGDG33 (ORCPT + 99 others); Wed, 4 Jul 2018 02:29:29 -0400 Received: from olimex.com ([184.105.72.32]:41883 "EHLO olimex.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933692AbeGDG31 (ORCPT ); Wed, 4 Jul 2018 02:29:27 -0400 Received: from localhost.localdomain ([195.238.85.143]) by olimex.com with ESMTPSA (ECDHE-RSA-AES128-SHA256:TLSv1.2:Kx=ECDH:Au=RSA:Enc=AES(128):Mac=SHA256) (SMTP-AUTH username stefan@olimex.com, mechanism PLAIN) for ; Tue, 3 Jul 2018 23:29:25 -0700 From: Stefan Mavrodiev To: Ulf Hansson , Maxime Ripard , Chen-Yu Tsai , linux-mmc@vger.kernel.org (open list:MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND...), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support), linux-kernel@vger.kernel.org (open list) Cc: Stefan Mavrodiev Subject: [PATCH v2 1/1] mmc: sunxi: Disable irq during pm_suspend Date: Wed, 4 Jul 2018 09:28:59 +0300 Message-Id: <1530685741-20604-1-git-send-email-stefan@olimex.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When mmc host controller enters suspend state, the clocks are disabled, but irqs are not. For some reason the irqchip emits false interrupts, which causes system lock loop. Debug log is: ... sunxi-mmc 1c11000.mmc: setting clk to 52000000, rounded 51200000 sunxi-mmc 1c11000.mmc: enabling the clock sunxi-mmc 1c11000.mmc: cmd 13(8000014d) arg 10000 ie 0x0000bbc6 len 0 sunxi-mmc 1c11000.mmc: irq: rq (ptrval) mi 00000004 idi 00000000 sunxi-mmc 1c11000.mmc: cmd 6(80000146) arg 3210101 ie 0x0000bbc6 len 0 sunxi-mmc 1c11000.mmc: irq: rq (ptrval) mi 00000004 idi 00000000 sunxi-mmc 1c11000.mmc: cmd 13(8000014d) arg 10000 ie 0x0000bbc6 len 0 sunxi-mmc 1c11000.mmc: irq: rq (ptrval) mi 00000004 idi 00000000 mmc1: new DDR MMC card at address 0001 mmcblk1: mmc1:0001 AGND3R 14.6 GiB mmcblk1boot0: mmc1:0001 AGND3R partition 1 4.00 MiB mmcblk1boot1: mmc1:0001 AGND3R partition 2 4.00 MiB sunxi-mmc 1c11000.mmc: cmd 18(80003352) arg 0 ie 0x0000fbc2 len 409 sunxi-mmc 1c11000.mmc: irq: rq (ptrval) mi 00004000 idi 00000002 mmcblk1: p1 sunxi-mmc 1c11000.mmc: irq: rq (null) mi 00000000 idi 00000000 sunxi-mmc 1c11000.mmc: irq: rq (null) mi 00000000 idi 00000000 sunxi-mmc 1c11000.mmc: irq: rq (null) mi 00000000 idi 00000000 sunxi-mmc 1c11000.mmc: irq: rq (null) mi 00000000 idi 00000000 and so on... This issue apears on eMMC cards, routed on MMC2 slot. The patch is tested with A20-OLinuXino-MICRO/LIME/LIME2 boards. Fixes: 9a8e1e8cc2c0 ("mmc: sunxi: Add runtime_pm support") Signed-off-by: Stefan Mavrodiev --- Changes in v2: - Add comment why disable_irq() is necessary --- drivers/mmc/host/sunxi-mmc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c index e747259..8e7f3e3 100644 --- a/drivers/mmc/host/sunxi-mmc.c +++ b/drivers/mmc/host/sunxi-mmc.c @@ -1446,6 +1446,7 @@ static int sunxi_mmc_runtime_resume(struct device *dev) sunxi_mmc_init_host(host); sunxi_mmc_set_bus_width(host, mmc->ios.bus_width); sunxi_mmc_set_clk(host, &mmc->ios); + enable_irq(host->irq); return 0; } @@ -1455,6 +1456,12 @@ static int sunxi_mmc_runtime_suspend(struct device *dev) struct mmc_host *mmc = dev_get_drvdata(dev); struct sunxi_mmc_host *host = mmc_priv(mmc); + /* + * When clocks are off, it's possible receiving + * fake interrupts, which will stall the system. + * Disabling the irq will prevent this. + */ + disable_irq(host->irq); sunxi_mmc_reset_host(host); sunxi_mmc_disable(host); -- 2.7.4