aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2007-10-27 08:14:23 -0400
committerPierre Ossman <drzeus@drzeus.cx>2007-10-27 08:14:23 -0400
commit78e480731ab89e311ecdb455d04903cafbe163ca (patch)
tree80d443e1f723314ac8921623475ea23ac70a5d18 /drivers
parent6356a9d955e1898eadaa8cba9a5137b1787c0c7e (diff)
mmc: fix cid and csd byte order
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/core/mmc_ops.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index bf4bc6adcfef..7471d49909b2 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -267,15 +267,26 @@ mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host,
267 267
268int mmc_send_csd(struct mmc_card *card, u32 *csd) 268int mmc_send_csd(struct mmc_card *card, u32 *csd)
269{ 269{
270 int ret, i;
271
270 if (!mmc_host_is_spi(card->host)) 272 if (!mmc_host_is_spi(card->host))
271 return mmc_send_cxd_native(card->host, card->rca << 16, 273 return mmc_send_cxd_native(card->host, card->rca << 16,
272 csd, MMC_SEND_CSD); 274 csd, MMC_SEND_CSD);
273 275
274 return mmc_send_cxd_data(card, card->host, MMC_SEND_CSD, csd, 16); 276 ret = mmc_send_cxd_data(card, card->host, MMC_SEND_CSD, csd, 16);
277 if (ret)
278 return ret;
279
280 for (i = 0;i < 4;i++)
281 csd[i] = be32_to_cpu(csd[i]);
282
283 return 0;
275} 284}
276 285
277int mmc_send_cid(struct mmc_host *host, u32 *cid) 286int mmc_send_cid(struct mmc_host *host, u32 *cid)
278{ 287{
288 int ret, i;
289
279 if (!mmc_host_is_spi(host)) { 290 if (!mmc_host_is_spi(host)) {
280 if (!host->card) 291 if (!host->card)
281 return -EINVAL; 292 return -EINVAL;
@@ -283,7 +294,14 @@ int mmc_send_cid(struct mmc_host *host, u32 *cid)
283 cid, MMC_SEND_CID); 294 cid, MMC_SEND_CID);
284 } 295 }
285 296
286 return mmc_send_cxd_data(NULL, host, MMC_SEND_CID, cid, 16); 297 ret = mmc_send_cxd_data(NULL, host, MMC_SEND_CID, cid, 16);
298 if (ret)
299 return ret;
300
301 for (i = 0;i < 4;i++)
302 cid[i] = be32_to_cpu(cid[i]);
303
304 return 0;
287} 305}
288 306
289int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd) 307int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd)