---
 drivers/mmc/sunxi_mmc.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index bbfe8a3..f0cb760 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -173,8 +173,6 @@ static int mmc_core_init(struct mmc *mmc)
        /* Reset controller */
        writel(SUNXI_MMC_GCTRL_RESET, &mmchost->reg->gctrl);
        udelay(1000);
-       /* Always read / write data through the CPU */
-       writel(SUNXI_MMC_GCTRL_ACCESS_BY_AHB, &mmchost->reg->gctrl);
 
        return 0;
 }
@@ -189,6 +187,13 @@ static int mmc_trans_data_by_cpu(struct mmc *mmc, struct 
mmc_data *data)
        unsigned byte_cnt = data->blocksize * data->blocks;
        unsigned timeout_msecs = 2000;
        unsigned *buff = (unsigned int *)(reading ? data->dest : data->src);
+       unsigned int gctrl;
+
+       /* Always read / write data through the CPU */
+       gctrl = readl(&mmchost->reg->gctrl);
+       gctrl &= ~SUNXI_MMC_GCTRL_ACCESS_BY_AHB;
+       gctrl |= SUNXI_MMC_GCTRL_ACCESS_BY_AHB;
+       writel(gctrl, &mmchost->reg->gctrl);
 
        for (i = 0; i < (byte_cnt >> 2); i++) {
                while (readl(&mmchost->reg->status) & status_bit) {
-- 
1.8.3.2

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to