From: Simon Horman <horms@verge.net.au>
To: Paul Mundt <lethal@linux-sh.org>
Cc: linux-mmc@vger.kernel.org, linux-sh@vger.kernel.org,
Magnus Damm <magnus.damm@gmail.com>,
Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
Chris Ball <cjb@laptop.org>
Subject: Re: [PATCH 3/5] mmc: sdhi: Add write16_hook
Date: Mon, 20 Jun 2011 22:42:20 +0900 [thread overview]
Message-ID: <20110620134219.GE9325@verge.net.au> (raw)
In-Reply-To: <20110620062517.GA7920@linux-sh.org>
On Mon, Jun 20, 2011 at 03:25:22PM +0900, Paul Mundt wrote:
> On Mon, Jun 20, 2011 at 03:06:53PM +0900, Simon Horman wrote:
> > diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> > index b365429..6c56453 100644
> > --- a/drivers/mmc/host/sh_mobile_sdhi.c
> > +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> > @@ -27,6 +27,8 @@
> > #include <linux/mfd/tmio.h>
> > #include <linux/sh_dma.h>
> >
> > +#include <asm/delay.h>
> > +
> > #include "tmio_mmc.h"
> >
> linux/delay.h will suffice.
Thanks.
> > +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;
> > +
> > + switch (addr)
> > + {
> > + case CTL_SD_CMD:
> > + case CTL_STOP_INTERNAL_ACTION:
> > + case CTL_XFER_BLK_COUNT:
> > + case CTL_SD_CARD_CLK_CTL:
> > + case CTL_SD_XFER_LEN:
> > + case CTL_SD_MEM_CARD_OPT:
> > + case CTL_TRANSACTION_CTL:
> > + case CTL_DMA_ENABLE:
> > + sh_mobile_sdhi_wait_idle(host);
> > + }
> > +}
> > +
> The timeout error should really be handed down.
>
> > diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> > index 0c22df0..5912cf3 100644
> > --- a/drivers/mmc/host/tmio_mmc.h
> > +++ b/drivers/mmc/host/tmio_mmc.h
> > @@ -153,6 +153,8 @@ static inline u32 sd_ctrl_read32(struct tmio_mmc_host *host, int addr)
> >
> > static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val)
> > {
> > + if (host->pdata->write16_hook)
> > + host->pdata->write16_hook(host, addr);
> > writew(val, host->ctl + (addr << host->bus_shift));
> > }
> >
> If it times out you are unlikely to want to proceed with the write. At
> best you end up with a lost write cycle, at worst potentially a bus
> lockup you can't easily recover from.
As discussed off-line, I'll change this around so that
write16_hook() may return an error and the write will be
skipped if that occurs.
next prev parent reply other threads:[~2011-06-20 13:42 UTC|newest]
Thread overview: 20+ 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 ` [PATCH 1/5] mmc: tmio: name 0xd8 as CTL_DMA_ENABLE Simon Horman
2011-06-20 6:06 ` [PATCH 2/5] mmc: tmio: Share register access functions Simon Horman
2011-06-20 6:06 ` [PATCH 3/5] mmc: sdhi: Add write16_hook Simon Horman
2011-06-20 6:25 ` Paul Mundt
2011-06-20 13:42 ` Simon Horman [this message]
2011-06-20 6:29 ` Guennadi Liakhovetski
2011-06-20 13:40 ` Simon Horman
2011-06-20 7:04 ` Magnus Damm
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 ` [PATCH 5/5] ARM: mach-shmobile: ag5evm: SDHI requires waiting for idle 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-21 0:36 ` Magnus Damm
2011-06-21 0:50 ` Simon Horman
2011-06-21 0:59 ` Magnus Damm
2011-06-21 1:13 ` Simon Horman
2011-06-21 1:36 ` Magnus Damm
2011-06-21 2:09 ` Simon Horman
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=20110620134219.GE9325@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox