On Thursday 09 August 2007, Pierre Ossman wrote:
> > @@ -68,21 +72,26 @@ int mmc_io_rw_direct(struct mmc_card *ca
> > cmd.arg |= (write && out) ? 0x08000000 : 0x00000000;
> > cmd.arg |= addr << 9;
> > cmd.arg |= in;
> > - cmd.flags = MMC_RSP_R5 | MMC_CMD_AC;
> > + cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_AC;
> >
> > err = mmc_wait_for_cmd(card->host, &cmd, 0);
> > if (err)
> > return err;
> >
> > - if (cmd.resp[0] & R5_ERROR)
> > - return -EIO;
> > - if (cmd.resp[0] & R5_FUNCTION_NUMBER)
> > - return -EINVAL;
> > - if (cmd.resp[0] & R5_OUT_OF_RANGE)
> > - return -ERANGE;
> > + if (mmc_host_is_spi(card->host)) {
> > + if (out)
> > + *out = (cmd.resp[0] >> 8) & 0xFF;
> > + } else {
> > + if (cmd.resp[0] & R5_ERROR)
> > + return -EIO;
> > + if (cmd.resp[0] & R5_FUNCTION_NUMBER)
> > + return -EINVAL;
> > + if (cmd.resp[0] & R5_OUT_OF_RANGE)
> > + return -ERANGE;
> >
> > - if (out)
> > - *out = cmd.resp[0] & 0xFF;
> > + if (out)
> > + *out = cmd.resp[0] & 0xFF;
> > + }
> >
> > return 0;
> > }
>
> What about error bits in the spi case?
Either they're already handled correctly in the mmc_spi host code
(and don't need duplicate handling here), or they need attention
from someone with all the relevant hardware in hand...
> And could you do two if:s, one
> for the error bits, and one for the different handling of getting the
> data? I think that would be clearer in detailing the differences.
If you insist ... appended.
=========
Tweak the (untested) SDIO-over-SPI code paths.
Signed-off-by: David Brownell <[EMAIL PROTECTED]>
---
drivers/mmc/core/sdio_ops.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
--- g26.orig/drivers/mmc/core/sdio_ops.c 2007-08-09 08:29:36.000000000
-0700
+++ g26/drivers/mmc/core/sdio_ops.c 2007-08-09 08:32:32.000000000 -0700
@@ -79,8 +79,7 @@ int mmc_io_rw_direct(struct mmc_card *ca
return err;
if (mmc_host_is_spi(card->host)) {
- if (out)
- *out = (cmd.resp[0] >> 8) & 0xFF;
+ /* host driver already reported errors */
} else {
if (cmd.resp[0] & R5_ERROR)
return -EIO;
@@ -88,8 +87,12 @@ int mmc_io_rw_direct(struct mmc_card *ca
return -EINVAL;
if (cmd.resp[0] & R5_OUT_OF_RANGE)
return -ERANGE;
+ }
- if (out)
+ if (out) {
+ if (mmc_host_is_spi(card->host))
+ *out = (cmd.resp[0] >> 8) & 0xFF;
+ else
*out = cmd.resp[0] & 0xFF;
}
@@ -140,7 +143,9 @@ int mmc_io_rw_extended(struct mmc_card *
if (data.error)
return data.error;
- if (!mmc_host_is_spi(card->host)) {
+ if (mmc_host_is_spi(card->host)) {
+ /* host driver already reported errors */
+ } else {
if (cmd.resp[0] & R5_ERROR)
return -EIO;
if (cmd.resp[0] & R5_FUNCTION_NUMBER)
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
spi-devel-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spi-devel-general