[U-Boot] [PATCH 2/9] mx23: Use XFER_COUNT field in HW_SSP_CTRL0 register in MMC PIO mode
Otavio Salvador
otavio at ossystems.com.br
Tue Jan 22 02:47:22 CET 2013
From: Marek Vasut <marex at denx.de>
Signed-off-by: Marek Vasut <marex at denx.de>
Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
---
drivers/mmc/mxsmmc.c | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/mxsmmc.c b/drivers/mmc/mxsmmc.c
index 0c4cd54..4b178be 100644
--- a/drivers/mmc/mxsmmc.c
+++ b/drivers/mmc/mxsmmc.c
@@ -211,14 +211,32 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
}
ctrl0 |= SSP_CTRL0_DATA_XFER;
+
+ reg = data->blocksize * data->blocks;
+#if defined(CONFIG_MX23)
+ if (reg & ~SSP_CTRL0_XFER_COUNT_MASK) {
+ printf("MMC%d: Transfer too large (%i bytes)!\n",
+ mmc->block_dev.dev, reg);
+ return -EINVAL;
+ }
+
+ ctrl0 |= reg & SSP_CTRL0_XFER_COUNT_MASK;
+
+ reg = readl(&ssp_regs->hw_ssp_cmd0);
+ reg &= ~0xfff00;
+ reg |= (data->blocks - 1) << 8;
+ reg |= (ffs(data->blocksize) - 1) << 16;
+
+ writel(reg, &ssp_regs->hw_ssp_cmd0);
+#elif defined(CONFIG_MX28)
+ writel(reg, &ssp_regs->hw_ssp_xfer_size);
+
reg = ((data->blocks - 1) <<
SSP_BLOCK_SIZE_BLOCK_COUNT_OFFSET) |
((ffs(data->blocksize) - 1) <<
SSP_BLOCK_SIZE_BLOCK_SIZE_OFFSET);
writel(reg, &ssp_regs->hw_ssp_block_size);
-
- reg = data->blocksize * data->blocks;
- writel(reg, &ssp_regs->hw_ssp_xfer_size);
+#endif
}
/* Kick off the command */
--
1.8.1
More information about the U-Boot
mailing list