From patchwork Fri Feb 7 14:00:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 3605311 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6C717BF418 for ; Fri, 7 Feb 2014 14:00:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9DEF720117 for ; Fri, 7 Feb 2014 14:00:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BEB8520115 for ; Fri, 7 Feb 2014 14:00:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753461AbaBGOA4 (ORCPT ); Fri, 7 Feb 2014 09:00:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37772 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752163AbaBGOA4 (ORCPT ); Fri, 7 Feb 2014 09:00:56 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s17E0per024154 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 7 Feb 2014 09:00:51 -0500 Received: from localhost.localdomain.com (vpn1-7-169.ams2.redhat.com [10.36.7.169]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s17E0j7x027623; Fri, 7 Feb 2014 09:00:49 -0500 From: Hans de Goede To: =?UTF-8?q?David=20Lanzend=C3=B6rfer?= Cc: Maxime Ripard , linux-mmc@vger.kernel.org, linux-sunxi@googlegroups.com, Hans de Goede Subject: [PATCH 2/2] sunxi-mci: Fix hang on boot caused by irq storm Date: Fri, 7 Feb 2014 15:00:41 +0100 Message-Id: <1391781641-7382-3-git-send-email-hdegoede@redhat.com> In-Reply-To: <1391781641-7382-1-git-send-email-hdegoede@redhat.com> References: <1391781641-7382-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 On power up / reboot sometimes the mmc controller will have its irq line asserted. Getting this de-asserted requires enabling the clocks and then resetting the mmc controller. Signed-off-by: Hans de Goede --- drivers/mmc/host/sunxi-mci.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/sunxi-mci.c b/drivers/mmc/host/sunxi-mci.c index 0eb59be..8b47c99 100644 --- a/drivers/mmc/host/sunxi-mci.c +++ b/drivers/mmc/host/sunxi-mci.c @@ -737,13 +737,6 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host, if (IS_ERR(host->reg_base)) return PTR_ERR(host->reg_base); - host->irq = platform_get_irq(pdev, 0); - ret = devm_request_irq(&pdev->dev, host->irq, sunxi_mmc_irq, 0, - "sunxi-mci", host); - if (ret) - return ret; - disable_irq(host->irq); - host->clk_ahb = devm_clk_get(&pdev->dev, "ahb"); if (IS_ERR(host->clk_ahb)) { dev_err(&pdev->dev, "Could not get ahb clock\n"); @@ -756,7 +749,21 @@ static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host, return PTR_ERR(host->clk_mod); } - return 0; + /* Make sure the controller is in a sane state before enabling irqs */ + ret = sunxi_mmc_init_host(host->mmc); + if (ret) + return ret; + + host->irq = platform_get_irq(pdev, 0); + ret = devm_request_irq(&pdev->dev, host->irq, sunxi_mmc_irq, 0, + "sunxi-mci", host); + if (ret == 0) + disable_irq(host->irq); + + /* And put it back in reset */ + sunxi_mmc_exit_host(host); + + return ret; } static int sunxi_mmc_probe(struct platform_device *pdev)