Skip to content

Commit

Permalink
mmc: fix cid and csd byte order
Browse files Browse the repository at this point in the history
MMC over SPI sends the CID and CSD registers as data, not responses,
which means that the host driver won't do the necessary byte flipping
for us.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
  • Loading branch information
Pierre Ossman committed Oct 27, 2007
1 parent 6356a9d commit 78e4807
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions drivers/mmc/core/mmc_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,23 +267,41 @@ mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host,

int mmc_send_csd(struct mmc_card *card, u32 *csd)
{
int ret, i;

if (!mmc_host_is_spi(card->host))
return mmc_send_cxd_native(card->host, card->rca << 16,
csd, MMC_SEND_CSD);

return mmc_send_cxd_data(card, card->host, MMC_SEND_CSD, csd, 16);
ret = mmc_send_cxd_data(card, card->host, MMC_SEND_CSD, csd, 16);
if (ret)
return ret;

for (i = 0;i < 4;i++)
csd[i] = be32_to_cpu(csd[i]);

return 0;
}

int mmc_send_cid(struct mmc_host *host, u32 *cid)
{
int ret, i;

if (!mmc_host_is_spi(host)) {
if (!host->card)
return -EINVAL;
return mmc_send_cxd_native(host, host->card->rca << 16,
cid, MMC_SEND_CID);
}

return mmc_send_cxd_data(NULL, host, MMC_SEND_CID, cid, 16);
ret = mmc_send_cxd_data(NULL, host, MMC_SEND_CID, cid, 16);
if (ret)
return ret;

for (i = 0;i < 4;i++)
cid[i] = be32_to_cpu(cid[i]);

return 0;
}

int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd)
Expand Down

0 comments on commit 78e4807

Please sign in to comment.