2009-06-22 15:03:36

by Pierre Tardy

[permalink] [raw]
Subject: Re: [PATCH 0/1] MMC: SDIO card reset support for Intel Moorestown platform

Li, Jiebing <jiebing.li <at> intel.com> writes:

>
> Hi Pierre and all,
>
> Here's a SDIO driver code patch which implements SDIO card reset support for
device driver to recover the
> card to the normal status in case that error occurs.

Another case that may need to be addressed is sdio reset in the scan sequence.
On some HC board, the sdio power survives upon board reset. A previously
initialised SD card will stay in IORDY mode, and wont answer to CMD5.
Though, a reset cmd52 should be sent before or after cmd0 in case of a io card
is still initialised from a previous boot.

One problem here is that mmc_io_rw_direct needs a struct mmc_card *, which is
not yet available in mmc_rescan().

I have a Q&D mmc_io_reset implementation, which works, but rely on
mmc_io_rw_direct implementation only to use card->host.

int mmc_io_reset(struct mmc_host *host)
{
struct mmc_card card;
u8 reg;
int ret;
card.host = host;
// not sure if we really need to read and modify.
// Reset wont reset the other bits anyway?
ret = mmc_io_rw_direct(&card, 0, 0, SDIO_CCCR_ABORT, 0, &reg);
if (ret)
reg = 0x08;
else
reg |= 0x08;

return mmc_io_rw_direct(&card, 1, 0, SDIO_CCCR_ABORT, reg, NULL);
}

Any idea on how to deal with this situation correctly?