From patchwork Wed Mar 11 22:15:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 5989021 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 C3EA8BF90F for ; Wed, 11 Mar 2015 22:26:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E782520375 for ; Wed, 11 Mar 2015 22:26:02 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1E5CC20374 for ; Wed, 11 Mar 2015 22:26:02 +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 1YVp2P-00071d-DV; Wed, 11 Mar 2015 22:23:37 +0000 Received: from mail-ie0-x22a.google.com ([2607:f8b0:4001:c03::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YVp2I-0006nS-I3 for linux-arm-kernel@lists.infradead.org; Wed, 11 Mar 2015 22:23:31 +0000 Received: by ieclw3 with SMTP id lw3so2728430iec.2 for ; Wed, 11 Mar 2015 15:23:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=Dgad6L+BMk+DqBeOSfizr0jZbrKXegVkIDjQJUrUqo4=; b=a3UerZYspOcYjU5OnUCaxd+dvCe2nKiyPCdIreQ+Ww+U3u26ygJkVgMDQ2TzOYated IhQ0bAOsAH3uw7UP8W9psr7R+EayUcuTKj1MC/r7PLj83eqSNXkfhSQ2lBDFjEKpp0k0 +ABXvtFGdCRMu6uu4Aa5Z5UaVXFdmIoDrZq9U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Dgad6L+BMk+DqBeOSfizr0jZbrKXegVkIDjQJUrUqo4=; b=iBB2U6SeSvVN77KtMRTLwvfquzlbFZx2ubEHRqXYqNcoUa8z5wheca4nSCtmCxe8mQ xsHRqrFboyElBX9phIBu0yvCP1qlUnXILVVDJiFSbH23k+d+LA3hcTG8crVbAI3nNRJ4 ArFlTS1CEi70lTuJBPcJ840O1hhrGp4PF/20NkwUTtt9f2p4d/JWLs9AL9s/Ra05QRky ljhWP3gl1zVRRCEW1b/uDLqhXx/IZNArt95NT8SWsBLvnnzRcMlp41kQNLb2EfBVrG37 i3eTY4BRn3gcxMAwxXdSlcMleSJOCRfFSnngh714rvgnBDVSrZbgtuPwGBBL99+VI+yz 02IQ== X-Gm-Message-State: ALoCoQnHGL2s69VroQKLlb05ANLGD66bSkzRsW9vDPo+xTeezJ3bbo0QXKWF4eV2Qf8HrTjqe5+o X-Received: by 10.50.97.41 with SMTP id dx9mr94308558igb.1.1426112136335; Wed, 11 Mar 2015 15:15:36 -0700 (PDT) Received: from tictac.mtv.corp.google.com ([172.22.65.76]) by mx.google.com with ESMTPSA id 192sm3229684ioo.38.2015.03.11.15.15.34 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Mar 2015 15:15:35 -0700 (PDT) From: Doug Anderson To: Ulf Hansson , Heiko Stuebner , Jaehoon Chung , Seungwon Jeon Subject: [PATCH v4 1/4] mmc: dw_mmc: Don't try to enable the CD until we're sure we're not deferring Date: Wed, 11 Mar 2015 15:15:14 -0700 Message-Id: <1426112117-18220-1-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150311_152330_703991_51F83A4F X-CRM114-Status: GOOD ( 11.36 ) X-Spam-Score: -0.8 (/) Cc: Addy Ke , Alexandru Stan , Andrew Bresticker , linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, Doug Anderson , chris@printf.net, linux-rockchip@lists.infradead.org, Mark Brown , Alim Akhtar , Sonny Rao , javier.martinez@collabora.co.uk, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 If dw_mci_init_slot() returns that we got a probe deferral then it may leave slot->mmc as NULL. That will cause dw_mci_enable_cd() to crash when it calls mmc_gpio_get_cd(). Fix this by moving the call of dw_mci_enable_cd() until we're sure that we're good. Note that if we have more than one slot and one defers (but the others don't) things won't work so well. ...but that's not a new thing and everyone has already agreed that multislot support ought to be removed from dw_mmc eventually anyway since it is unused, untested, and you can see several bugs like this by inspecting the code. Fixes: bcafaf5470f0 ("mmc: dw_mmc: Only enable CD after setup and only if needed") Signed-off-by: Doug Anderson --- Changes in v4: - Defer vs. card detect fix patch new for v4. Changes in v3: None Changes in v2: None drivers/mmc/host/dw_mmc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 47dfd0e..e2811cf 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -2863,9 +2863,6 @@ int dw_mci_probe(struct dw_mci *host) init_slots++; } - /* Now that slots are all setup, we can enable card detect */ - dw_mci_enable_cd(host); - if (init_slots) { dev_info(host->dev, "%d slots initialized\n", init_slots); } else { @@ -2874,6 +2871,9 @@ int dw_mci_probe(struct dw_mci *host) goto err_dmaunmap; } + /* Now that slots are all setup, we can enable card detect */ + dw_mci_enable_cd(host); + if (host->quirks & DW_MCI_QUIRK_IDMAC_DTO) dev_info(host->dev, "Internal DMAC interrupt fix enabled.\n");