From: Simon Horman <horms@verge.net.au>
To: Magnus Damm <magnus.damm@gmail.com>
Cc: linux-mmc@vger.kernel.org, linux-sh@vger.kernel.org,
Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
Paul Mundt <lethal@linux-sh.org>, Chris Ball <cjb@laptop.org>
Subject: Re: [PATCH 3/5] mmc: sdhi: Add write16_hook
Date: Mon, 20 Jun 2011 22:40:51 +0900 [thread overview]
Message-ID: <20110620134045.GD9325@verge.net.au> (raw)
In-Reply-To: <BANLkTikfMgR5AMZtq7wGKJ4LRP6yjtjhOA@mail.gmail.com>
On Mon, Jun 20, 2011 at 04:04:04PM +0900, Magnus Damm wrote:
> On Mon, Jun 20, 2011 at 3:06 PM, Simon Horman <horms@verge.net.au> wrote:
> > Some controllers require waiting for the bus to become idle
> > before writing to some registers. I have implemented this
> > by adding a hook to sd_ctrl_write16() and implementing
> > a hook for SDHI which waits for the bus to become idle.
> >
> > Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > Cc: Magnus Damm <magnus.damm@gmail.com>
> > Signed-off-by: Simon Horman <horms@verge.net.au>
> >
> > ---
>
> Hi Simon,
>
> Thanks for your work on this!
>
> > --- a/drivers/mmc/host/sh_mobile_sdhi.c
> > +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> > @@ -55,6 +57,37 @@ static int sh_mobile_sdhi_get_cd(struct platform_device *pdev)
> > return -ENOSYS;
> > }
> >
> > +static void sh_mobile_sdhi_wait_idle(struct tmio_mmc_host *host)
> > +{
> > + int timeout = 1000;
> > +
> > + while (--timeout && !(sd_ctrl_read16(host, CTL_STATUS2) & (1 << 13)))
> > + udelay(1);
> > +
> > + if (!timeout)
> > + dev_warn(host->pdata->dev, "timeout waiting for SD bus idle\n");
> > +
> > +}
> > +
> > +static void sh_mobile_sdhi_write16_hook(struct tmio_mmc_host *host, int addr)
> > +{
> > + if (!(host->pdata->flags & TMIO_MMC_HAS_IDLE_WAIT))
> > + return;
>
> and
>
> > @@ -86,6 +119,7 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev)
> > mmc_data->hclk = clk_get_rate(priv->clk);
> > mmc_data->set_pwr = sh_mobile_sdhi_set_pwr;
> > mmc_data->get_cd = sh_mobile_sdhi_get_cd;
> > + mmc_data->write16_hook = sh_mobile_sdhi_write16_hook;
> > mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
> > if (p) {
> > mmc_data->flags = p->tmio_flags;
>
> Doesn't it make more sense to do:
>
> if (!(host->pdata->flags & TMIO_MMC_HAS_IDLE_WAIT))
> mmc_data->write16_hook = sh_mobile_sdhi_write16_hook;
>
> and skip the check inside the sh_mobile_sdhi_write16_hook() function?
>
> No need to do that check on every register access unless really needed.
Sure, good idea.
WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <horms@verge.net.au>
To: Magnus Damm <magnus.damm@gmail.com>
Cc: linux-mmc@vger.kernel.org, linux-sh@vger.kernel.org,
Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
Paul Mundt <lethal@linux-sh.org>, Chris Ball <cjb@laptop.org>
Subject: Re: [PATCH 3/5] mmc: sdhi: Add write16_hook
Date: Mon, 20 Jun 2011 13:40:51 +0000 [thread overview]
Message-ID: <20110620134045.GD9325@verge.net.au> (raw)
In-Reply-To: <BANLkTikfMgR5AMZtq7wGKJ4LRP6yjtjhOA@mail.gmail.com>
On Mon, Jun 20, 2011 at 04:04:04PM +0900, Magnus Damm wrote:
> On Mon, Jun 20, 2011 at 3:06 PM, Simon Horman <horms@verge.net.au> wrote:
> > Some controllers require waiting for the bus to become idle
> > before writing to some registers. I have implemented this
> > by adding a hook to sd_ctrl_write16() and implementing
> > a hook for SDHI which waits for the bus to become idle.
> >
> > Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > Cc: Magnus Damm <magnus.damm@gmail.com>
> > Signed-off-by: Simon Horman <horms@verge.net.au>
> >
> > ---
>
> Hi Simon,
>
> Thanks for your work on this!
>
> > --- a/drivers/mmc/host/sh_mobile_sdhi.c
> > +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> > @@ -55,6 +57,37 @@ static int sh_mobile_sdhi_get_cd(struct platform_device *pdev)
> > return -ENOSYS;
> > }
> >
> > +static void sh_mobile_sdhi_wait_idle(struct tmio_mmc_host *host)
> > +{
> > + int timeout = 1000;
> > +
> > + while (--timeout && !(sd_ctrl_read16(host, CTL_STATUS2) & (1 << 13)))
> > + udelay(1);
> > +
> > + if (!timeout)
> > + dev_warn(host->pdata->dev, "timeout waiting for SD bus idle\n");
> > +
> > +}
> > +
> > +static void sh_mobile_sdhi_write16_hook(struct tmio_mmc_host *host, int addr)
> > +{
> > + if (!(host->pdata->flags & TMIO_MMC_HAS_IDLE_WAIT))
> > + return;
>
> and
>
> > @@ -86,6 +119,7 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev)
> > mmc_data->hclk = clk_get_rate(priv->clk);
> > mmc_data->set_pwr = sh_mobile_sdhi_set_pwr;
> > mmc_data->get_cd = sh_mobile_sdhi_get_cd;
> > + mmc_data->write16_hook = sh_mobile_sdhi_write16_hook;
> > mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
> > if (p) {
> > mmc_data->flags = p->tmio_flags;
>
> Doesn't it make more sense to do:
>
> if (!(host->pdata->flags & TMIO_MMC_HAS_IDLE_WAIT))
> mmc_data->write16_hook = sh_mobile_sdhi_write16_hook;
>
> and skip the check inside the sh_mobile_sdhi_write16_hook() function?
>
> No need to do that check on every register access unless really needed.
Sure, good idea.
next prev parent reply other threads:[~2011-06-20 13:40 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-20 6:06 [PATCH 0/5] mmc: sdhi: Allow waiting for idle Simon Horman
2011-06-20 6:06 ` Simon Horman
2011-06-20 6:06 ` [PATCH 1/5] mmc: tmio: name 0xd8 as CTL_DMA_ENABLE Simon Horman
2011-06-20 6:06 ` Simon Horman
2011-06-20 6:06 ` [PATCH 2/5] mmc: tmio: Share register access functions Simon Horman
2011-06-20 6:06 ` Simon Horman
2011-06-20 6:06 ` [PATCH 3/5] mmc: sdhi: Add write16_hook Simon Horman
2011-06-20 6:06 ` Simon Horman
2011-06-20 6:25 ` Paul Mundt
2011-06-20 6:25 ` Paul Mundt
2011-06-20 13:42 ` Simon Horman
2011-06-20 13:42 ` Simon Horman
2011-06-20 6:29 ` Guennadi Liakhovetski
2011-06-20 6:29 ` Guennadi Liakhovetski
2011-06-20 13:40 ` Simon Horman
2011-06-20 13:40 ` Simon Horman
2011-06-20 7:04 ` Magnus Damm
2011-06-20 7:04 ` Magnus Damm
2011-06-20 13:40 ` Simon Horman [this message]
2011-06-20 13:40 ` Simon Horman
2011-06-20 6:06 ` [PATCH 4/5] ARM: mach-shmobile: ag5evm: consistently name sdhi info structures Simon Horman
2011-06-20 6:06 ` Simon Horman
2011-06-20 6:06 ` [PATCH 5/5] ARM: mach-shmobile: ag5evm: SDHI requires waiting for idle Simon Horman
2011-06-20 6:06 ` Simon Horman
-- strict thread matches above, loose matches on Subject: below --
2011-06-20 23:00 [PATCH 0/5 v2] mmc: sdhi: Allow " Simon Horman
2011-06-20 23:00 ` [PATCH 3/5] mmc: sdhi: Add write16_hook Simon Horman
2011-06-20 23:00 ` Simon Horman
2011-06-21 0:36 ` Magnus Damm
2011-06-21 0:36 ` Magnus Damm
2011-06-21 0:50 ` Simon Horman
2011-06-21 0:50 ` Simon Horman
2011-06-21 0:59 ` Magnus Damm
2011-06-21 0:59 ` Magnus Damm
2011-06-21 1:13 ` Simon Horman
2011-06-21 1:13 ` Simon Horman
2011-06-21 1:36 ` Magnus Damm
2011-06-21 1:36 ` Magnus Damm
2011-06-21 2:09 ` Simon Horman
2011-06-21 2:09 ` Simon Horman
2011-06-21 2:34 ` Magnus Damm
2011-06-21 2:34 ` Magnus Damm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110620134045.GD9325@verge.net.au \
--to=horms@verge.net.au \
--cc=cjb@laptop.org \
--cc=g.liakhovetski@gmx.de \
--cc=lethal@linux-sh.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.