From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751628AbcFUN1k (ORCPT ); Tue, 21 Jun 2016 09:27:40 -0400 Received: from plane.gmane.org ([80.91.229.3]:37095 "EHLO plane.gmane.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751879AbcFUN1i (ORCPT ); Tue, 21 Jun 2016 09:27:38 -0400 X-Injected-Via-Gmane: http://gmane.org/ To: linux-kernel@vger.kernel.org From: Gerd Hoffmann Subject: Re: [PATCH 21/32] mmc: bcm2835-sdhost: Add new driver for the internal SD controller. Date: Tue, 21 Jun 2016 12:33:59 +0000 (UTC) Message-ID: References: <1464817421-8519-1-git-send-email-kraxel@redhat.com> <1464817421-8519-22-git-send-email-kraxel@redhat.com> <4715245.LFBOAeJdHc@wuerfel> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 79.194.156.205 (Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, > > + mmiowb(); > > +} > > What is the barrier for? Same question for all the other instances No idea. Removed them all, seems to work fine still. Guess writel() & friends have the needed barriers on arm? > > + > > +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); > > + bcm2835_sdhost_reset_internal(host); > > + spin_unlock_irqrestore(&host->lock, flags); > > +} > > The spinlock seems to only protect the reset from happening concurrently > with bcm2835_sdhost_dma_complete() here. So if you ensure that this > function is no longer pending, you can probably use msleep() above. There is also a tasklet. And IRQs. But bcm2835_sdhost_reset_internal clears hcfg (temporately), so IRQs shouldn't be a problem I think. So how about this? @@ -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); } > > + if (IS_ERR_OR_NULL(host->dma_chan_tx) || > > + IS_ERR_OR_NULL(host->dma_chan_rx)) { > > + pr_err("%s: unable to initialise DMA channels. Falling back to PIO\n", > > + mmc_hostname(mmc)); > > When are these ever NULL? When there are no dma channels configured in the device tree. cheers, Gerd