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: 5988921 Return-Path: X-Original-To: patchwork-linux-rockchip@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 50B12BF90F for ; Wed, 11 Mar 2015 22:16:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 753CC2034B for ; Wed, 11 Mar 2015 22:16:21 +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 A5CED202EB for ; Wed, 11 Mar 2015 22:16:20 +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 1YVovM-0002Wf-At; Wed, 11 Mar 2015 22:16:20 +0000 Received: from mail-ie0-x234.google.com ([2607:f8b0:4001:c03::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YVovJ-0002Ms-Ic for linux-rockchip@lists.infradead.org; Wed, 11 Mar 2015 22:16:18 +0000 Received: by iecsl2 with SMTP id sl2so2520326iec.1 for ; Wed, 11 Mar 2015 15:15:56 -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=mNt4NVfPnXGVRBq6gsYU+mBWjUTX0vSzcmBQQ0rI6VZ8Lsq40JRBrgkkFQbYI3sbww QR/9eWnjTKyHQptkA3EcLMSCjf7mxno9N6NlDMuBMcQJOycsr/HpxV2dTj7O4E6bOGo4 oVKju7K5TaOoz0XKHYCgdl9Mpl8r5cm0O5EvRX19RWUUuYLLVwzNKF4pcBGV6QKjOzbm +9u8ZXofUC3l4yJ76nOTPWSepMfC2Gmr+lgwtwvbw1xl7fxxvif9cZ4Fa/udfr8jeg0X BkauL2bTHKByWB9pF44oNkgrISuJ4Pz8Vg44UDahdTOPY4j2CKtpHlUJelnengwLE9c2 1SVw== X-Gm-Message-State: ALoCoQkEyySV9J6DieY5azdJI47CNM0bWnbU7EMmBuIPsJhVxPLsaQZ6aXeT0jKhUquC9NokJr0b 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_151617_678761_54AFE10C X-CRM114-Status: UNSURE ( 9.91 ) X-CRM114-Notice: Please train this message. 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-rockchip@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=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");