]> git.sur5r.net Git - u-boot/blobdiff - drivers/mmc/s5p_mmc.c
Merge branch 'master' of git://git.denx.de/u-boot-arm
[u-boot] / drivers / mmc / s5p_mmc.c
index 872f0bb2acffef685a7f97b041bd2ce32e300561..668c28bded9c0b505235f0828a3c2b8d3ee26de3 100644 (file)
@@ -30,11 +30,7 @@ struct mmc_host mmc_host[4];
 static inline struct s5p_mmc *s5p_get_base_mmc(int dev_index)
 {
        unsigned long offset = dev_index * sizeof(struct s5p_mmc);
-
-       if (cpu_is_s5pc100())
-               return (struct s5p_mmc *)(S5PC100_MMC_BASE + offset);
-       else
-               return (struct s5p_mmc *)(S5PC110_MMC_BASE + offset);
+       return (struct s5p_mmc *)(samsung_get_base_mmc() + offset);
 }
 
 static void mmc_prepare_data(struct mmc_host *host, struct mmc_data *data)
@@ -55,7 +51,7 @@ static void mmc_prepare_data(struct mmc_host *host, struct mmc_data *data)
        writeb(ctrl, &host->reg->hostctl);
 
        /* We do not handle DMA boundaries, so set it to max (512 KiB) */
-       writew((7 << 12) | (512 << 0), &host->reg->blksize);
+       writew((7 << 12) | (data->blocksize & 0xFFF), &host->reg->blksize);
        writew(data->blocks, &host->reg->blkcnt);
 }
 
@@ -356,11 +352,16 @@ static void mmc_set_ios(struct mmc *mmc)
        ctrl = readb(&host->reg->hostctl);
 
        /*
+        * WIDE8[5]
+        * 0 = Depend on WIDE4
+        * 1 = 8-bit mode
         * WIDE4[1]
         * 1 = 4-bit mode
         * 0 = 1-bit mode
         */
-       if (mmc->bus_width == 4)
+       if (mmc->bus_width == 8)
+               ctrl |= (1 << 5);
+       else if (mmc->bus_width == 4)
                ctrl |= (1 << 1);
        else
                ctrl &= ~(1 << 1);
@@ -441,7 +442,7 @@ static int mmc_core_init(struct mmc *mmc)
        return 0;
 }
 
-static int s5p_mmc_initialize(int dev_index)
+static int s5p_mmc_initialize(int dev_index, int bus_width)
 {
        struct mmc *mmc;
 
@@ -454,19 +455,24 @@ static int s5p_mmc_initialize(int dev_index)
        mmc->init = mmc_core_init;
 
        mmc->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195;
-       mmc->host_caps = MMC_MODE_4BIT | MMC_MODE_HS_52MHz | MMC_MODE_HS;
+       if (bus_width == 8)
+               mmc->host_caps = MMC_MODE_8BIT;
+       else
+               mmc->host_caps = MMC_MODE_4BIT;
+       mmc->host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
 
        mmc->f_min = 400000;
        mmc->f_max = 52000000;
 
        mmc_host[dev_index].clock = 0;
        mmc_host[dev_index].reg = s5p_get_base_mmc(dev_index);
+       mmc->m_bmax = 0;
        mmc_register(mmc);
 
        return 0;
 }
 
-int s5p_mmc_init(int dev_index)
+int s5p_mmc_init(int dev_index, int bus_width)
 {
-       return s5p_mmc_initialize(dev_index);
+       return s5p_mmc_initialize(dev_index, bus_width);
 }