Message ID | 54d94f230908062049u722bce51j53847830cecb3995@mail.gmail.com (mailing list archive) |
---|---|
State | Rejected |
Headers | show |
On Thursday 06 August 2009, PhaneendraKumar A wrote: > Observed some issues during the initialization of SDIO cards. The > initialization sequence for SDIO card is not according to the SDIO > specification. Hence the card is not getting initialized during module > reload with card always present in the slot. This patch fixes the > issue. This needs to go to LKML and merge to mainline ... > Signed-off-by: phani@embwise.com > --- > drivers/mmc/core/core.c | 1 + > drivers/mmc/core/sdio_ops.c | 22 ++++++++++++++++++++++ > drivers/mmc/core/sdio_ops.h | 1 + > 3 files changed, 24 insertions(+), 0 deletions(-) > > diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c > index d84c880..5ec7e75 100644 > --- a/drivers/mmc/core/core.c > +++ b/drivers/mmc/core/core.c > @@ -890,6 +890,7 @@ void mmc_rescan(struct work_struct *work) > mmc_claim_host(host); > > mmc_power_up(host); > + mmc_reset_sdio(host); > mmc_go_idle(host); > > mmc_send_if_cond(host, host->ocr_avail); > diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c > index 4eb7825..2e77ab8 100644 > --- a/drivers/mmc/core/sdio_ops.c > +++ b/drivers/mmc/core/sdio_ops.c > @@ -19,6 +19,28 @@ > #include "core.h" > #include "sdio_ops.h" > > +int mmc_reset_sdio(struct mmc_host *host) > +{ > + struct mmc_command cmd; > + int err = 0; > + > + BUG_ON(!host); > + > + memset(&cmd, 0, sizeof(struct mmc_command)); > + > + cmd.opcode = SD_IO_RW_DIRECT; > + cmd.arg = 0x80000000; > + cmd.arg |= (SDIO_CCCR_ABORT) << 9; > + cmd.arg |= (1<<3); > + cmd.flags = MMC_RSP_R5 | MMC_CMD_AC; > + > + err = mmc_wait_for_cmd(host, &cmd, 0); > + if (err) > + return err; > + > + return 0; > +} > + > int mmc_send_io_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) > { > struct mmc_command cmd; > diff --git a/drivers/mmc/core/sdio_ops.h b/drivers/mmc/core/sdio_ops.h > index e2e74b0..2ef70b8 100644 > --- a/drivers/mmc/core/sdio_ops.h > +++ b/drivers/mmc/core/sdio_ops.h > @@ -17,6 +17,7 @@ int mmc_io_rw_direct(struct mmc_card *card, int > write, unsigned fn, > unsigned addr, u8 in, u8* out); > int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn, > unsigned addr, int incr_addr, u8 *buf, unsigned blocks, unsigned blksz); > +int mmc_reset_sdio(struct mmc_host *host); > > #endif > > -- > 1.6.0.4 >
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index d84c880..5ec7e75 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -890,6 +890,7 @@ void mmc_rescan(struct work_struct *work) mmc_claim_host(host); mmc_power_up(host); + mmc_reset_sdio(host); mmc_go_idle(host); mmc_send_if_cond(host, host->ocr_avail); diff --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c index 4eb7825..2e77ab8 100644 --- a/drivers/mmc/core/sdio_ops.c +++ b/drivers/mmc/core/sdio_ops.c @@ -19,6 +19,28 @@ #include "core.h" #include "sdio_ops.h" +int mmc_reset_sdio(struct mmc_host *host) +{ + struct mmc_command cmd; + int err = 0; + + BUG_ON(!host); + + memset(&cmd, 0, sizeof(struct mmc_command)); + + cmd.opcode = SD_IO_RW_DIRECT; + cmd.arg = 0x80000000; + cmd.arg |= (SDIO_CCCR_ABORT) << 9; + cmd.arg |= (1<<3); + cmd.flags = MMC_RSP_R5 | MMC_CMD_AC; + + err = mmc_wait_for_cmd(host, &cmd, 0); + if (err) + return err; + + return 0; +} + int mmc_send_io_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr) { struct mmc_command cmd; diff --git a/drivers/mmc/core/sdio_ops.h b/drivers/mmc/core/sdio_ops.h index e2e74b0..2ef70b8 100644 --- a/drivers/mmc/core/sdio_ops.h +++ b/drivers/mmc/core/sdio_ops.h @@ -17,6 +17,7 @@ int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn, unsigned addr, u8 in, u8* out); int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn, unsigned addr, int incr_addr, u8 *buf, unsigned blocks, unsigned blksz); +int mmc_reset_sdio(struct mmc_host *host); #endif
Observed some issues during the initialization of SDIO cards. The initialization sequence for SDIO card is not according to the SDIO specification. Hence the card is not getting initialized during module reload with card always present in the slot. This patch fixes the issue. Signed-off-by: phani@embwise.com --- drivers/mmc/core/core.c | 1 + drivers/mmc/core/sdio_ops.c | 22 ++++++++++++++++++++++ drivers/mmc/core/sdio_ops.h | 1 + 3 files changed, 24 insertions(+), 0 deletions(-)