Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1410006

RE: [PATCH] mmc: sdhci: use udelay instead of mdelay

From "Baranowska, BeataX" <beatax.baranowska@intel.com>
Newsgroups linux.kernel
Subject RE: [PATCH] mmc: sdhci: use udelay instead of mdelay
Date 2016-05-31 11:00 +0200
Message-ID <rENGO-pS-15@gated-at.bofh.it> (permalink)
References <rEqhb-1fU-5@gated-at.bofh.it> <rEqqR-1yz-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> -----Original Message-----
> From: Arnd Bergmann [mailto:arnd@arndb.de]
> Sent: Monday, May 30, 2016 10:01 AM
> To: Baranowska, BeataX <beatax.baranowska@intel.com>
> Cc: Hunter, Adrian <adrian.hunter@intel.com>; Ulf Hansson
> <ulf.hansson@linaro.org>; linux-mmc@vger.kernel.org; linux-
> kernel@vger.kernel.org; Dong, Chuanxiao <chuanxiao.dong@intel.com>;
> Jarosz, SebastianX <sebastianx.jarosz@intel.com>
> Subject: Re: [PATCH] mmc: sdhci: use udelay instead of mdelay
> 
> On Monday, May 30, 2016 7:55:55 AM CEST Baranowska, BeataX wrote:
> > From: Chuanxiao Dong <chuanxiao.dong@intel.com>
> >
> > This patch will use udelay instead of mdelay when waiting for SDHCI
> > hardware to be stable. udelay can help to reduce the waiting time when
> > is in critical region which is protected by spinlock.
> >
> > With this patch, __sdhci_set_ios only take a few microseconds to be
> > done.
> >
> > Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
> > ---
> > drivers/mmc/host/sdhci.c | 18 +++++++++---------
> >  1 file changed, 9 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index
> > e010ea4eb6f5..56d2c7567d97 100644
> > --- a/drivers/mmc/host/sdhci.c
> > +++ b/drivers/mmc/host/sdhci.c
> > @@ -173,8 +173,8 @@ void sdhci_reset(struct sdhci_host *host, u8 mask)
> >                         sdhci_runtime_pm_bus_off(host);
> >         }
> >
> > -       /* Wait max 100 ms */
> > -       timeout = 100;
> > +       /* Wait max 10000 ms */
> > +       timeout = 10000;
> >
> >         /* hw clears the bit when it's done */
> >         while (sdhci_readb(host, SDHCI_SOFTWARE_RESET) & mask) { @@
> > -185,7 +185,7 @@ void sdhci_reset(struct sdhci_host *host, u8 mask)
> >                         return;
> >                 }
> >                 timeout--;
> > -               mdelay(1);
> > +               udelay(10);
> >         }
> >  }
> >  EXPORT_SYMBOL_GPL(sdhci_reset);
> 
> This can significantly increase the timeout length. I think you should instead
> use time_before() to see how many jiffies have passed since the start.
> 
> However, the real question is why the reset function gets called under a
> spinlock in the first place. Can you try to rearrange the code so it doesn't
> need the lock at all and you can just use msleep() instead?
> 
> 	Arnd

Thank you for your quick reply.
Could you please clarify what do you mean is called under a spinlock? Any is not used here?

Beata Baranowska

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] mmc: sdhci: use udelay instead of mdelay "Baranowska, BeataX" <beatax.baranowska@intel.com> - 2016-05-30 10:00 +0200
  Re: [PATCH] mmc: sdhci: use udelay instead of mdelay Arnd Bergmann <arnd@arndb.de> - 2016-05-30 10:10 +0200
    RE: [PATCH] mmc: sdhci: use udelay instead of mdelay "Baranowska, BeataX" <beatax.baranowska@intel.com> - 2016-05-31 11:00 +0200
      Re: [PATCH] mmc: sdhci: use udelay instead of mdelay Arnd Bergmann <arnd@arndb.de> - 2016-05-31 11:20 +0200
        RE: [PATCH] mmc: sdhci: use udelay instead of mdelay "Baranowska, BeataX" <beatax.baranowska@intel.com> - 2016-05-31 11:40 +0200

csiph-web