[U-Boot] [PATCH V4 3/9] DWMMC: Initialise dwmci and resolve EMMC read write issues
Amar
amarendra.xt at samsung.com
Fri Jan 4 10:34:04 CET 2013
This patch enumerates dwmci and set auto stop command during
dwmci initialisation.
EMMC read/write is not happening in current implementation
due to improper fifo size computation. Hence Modified the fifo size
computation to resolve EMMC read write issues.
Changes from V1:
1)Created the macros RX_WMARK_SHIFT and RX_WMARK_MASK in header file.
Changes from V2:
1)Updation of commit message and resubmition of proper patch set.
Changes from V3:
1)Updated to use the macro DWMCI_CTRL_SEND_AS_CCSD instead of
the hard coded value (1 << 10).
Signed-off-by: Amar <amarendra.xt at samsung.com>
---
drivers/mmc/dw_mmc.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
index 4070d4e..776fdb6 100644
--- a/drivers/mmc/dw_mmc.c
+++ b/drivers/mmc/dw_mmc.c
@@ -136,6 +136,7 @@ static int dwmci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
return TIMEOUT;
}
timeout--;
+ mdelay(1);
}
dwmci_writel(host, DWMCI_RINTSTS, DWMCI_INTMSK_ALL);
@@ -314,7 +315,7 @@ static void dwmci_set_ios(struct mmc *mmc)
static int dwmci_init(struct mmc *mmc)
{
struct dwmci_host *host = (struct dwmci_host *)mmc->priv;
- u32 fifo_size, fifoth_val;
+ u32 fifo_size, fifoth_val, ier;
dwmci_writel(host, DWMCI_PWREN, 1);
@@ -323,6 +324,14 @@ static int dwmci_init(struct mmc *mmc)
return -1;
}
+ /* Enumerate at 400KHz */
+ dwmci_setup_bus(host, mmc->f_min);
+
+ /* Set auto stop command */
+ ier = dwmci_readl(host, DWMCI_CTRL);
+ ier |= DWMCI_CTRL_SEND_AS_CCSD;
+ dwmci_writel(host, DWMCI_CTRL, ier);
+
dwmci_writel(host, DWMCI_RINTSTS, 0xFFFFFFFF);
dwmci_writel(host, DWMCI_INTMASK, 0);
@@ -332,10 +341,11 @@ static int dwmci_init(struct mmc *mmc)
dwmci_writel(host, DWMCI_BMOD, 1);
fifo_size = dwmci_readl(host, DWMCI_FIFOTH);
+ fifo_size = ((fifo_size & RX_WMARK_MASK) >> RX_WMARK_SHIFT) + 1;
if (host->fifoth_val)
fifoth_val = host->fifoth_val;
else
- fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size/2 -1) |
+ fifoth_val = MSIZE(0x2) | RX_WMARK(fifo_size/2 - 1) |
TX_WMARK(fifo_size/2);
dwmci_writel(host, DWMCI_FIFOTH, fifoth_val);
--
1.8.0
More information about the U-Boot
mailing list