From patchwork Wed Jun 22 11:42:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 9192511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ACFB76075A for ; Wed, 22 Jun 2016 11:44:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C68A28364 for ; Wed, 22 Jun 2016 11:44:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 90F8B283FB; Wed, 22 Jun 2016 11:44:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2497D28364 for ; Wed, 22 Jun 2016 11:44:11 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bFgYQ-0002Uj-DR; Wed, 22 Jun 2016 11:42:46 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bFgYN-0002QW-Ib; Wed, 22 Jun 2016 11:42:44 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A93EE1BE2BC; Wed, 22 Jun 2016 11:42:22 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5MBgLtA019840; Wed, 22 Jun 2016 07:42:22 -0400 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 1050F827F4; Wed, 22 Jun 2016 13:42:21 +0200 (CEST) From: Gerd Hoffmann To: linux-rpi-kernel@lists.infradead.org Subject: [PATCH 4/5] mmc: bcm2835-sdhost: reset tweaks. [fixup] Date: Wed, 22 Jun 2016 13:42:17 +0200 Message-Id: <1466595738-2229-5-git-send-email-kraxel@redhat.com> In-Reply-To: <1466595738-2229-1-git-send-email-kraxel@redhat.com> References: <1466595738-2229-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 22 Jun 2016 11:42:22 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160622_044243_673052_86C0E93A X-CRM114-Status: GOOD ( 11.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Stephen Warren , Lee Jones , linux-mmc@vger.kernel.org, open list , Eric Anholt , Gerd Hoffmann , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Kill any pending stuff before calling reset_internal(), so there shouldn't be any completion callbacks interfering. This allows to call reset_internal without lock, which in turn allows to turn the mdelay calls into msleep calls. Also adjust the time from 10ms to 20ms as checkpatch warns about the 10ms. Signed-off-by: Gerd Hoffmann --- drivers/mmc/host/bcm2835-sdhost.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c index 8a05c02..a895561 100644 --- a/drivers/mmc/host/bcm2835-sdhost.c +++ b/drivers/mmc/host/bcm2835-sdhost.c @@ -321,9 +321,9 @@ static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) temp |= (FIFO_READ_THRESHOLD << SDEDM_READ_THRESHOLD_SHIFT) | (FIFO_WRITE_THRESHOLD << SDEDM_WRITE_THRESHOLD_SHIFT); bcm2835_sdhost_write(host, temp, SDEDM); - mdelay(10); + msleep(20); bcm2835_sdhost_set_power(host, true); - mdelay(10); + msleep(20); host->clock = 0; bcm2835_sdhost_write(host, host->hcfg, SDHCFG); bcm2835_sdhost_write(host, host->cdiv, SDCDIV); @@ -334,9 +334,10 @@ static void bcm2835_sdhost_reset(struct mmc_host *mmc) struct bcm2835_host *host = mmc_priv(mmc); unsigned long flags; - spin_lock_irqsave(&host->lock, flags); + if (host->dma_chan) + dmaengine_terminate_sync(host->dma_chan); + tasklet_kill(&host->finish_tasklet); bcm2835_sdhost_reset_internal(host); - spin_unlock_irqrestore(&host->lock, flags); } static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios);