]> git.sur5r.net Git - u-boot/commitdiff
mmc: Access mode validation for eMMC cards > 2 GiB
authorŁukasz Majewski <l.majewski@samsung.com>
Tue, 5 Jul 2011 02:19:44 +0000 (02:19 +0000)
committerAndy Fleming <afleming@freescale.com>
Sat, 16 Jul 2011 01:29:21 +0000 (20:29 -0500)
This patch provides handling of the two way handshake when SEND_OP_COND
(CMD1) is send to mmc card. It is necessary to inform eMMC card if the
host can work with high capacity cards (Jedec JESD84-A441, point 7.4.3).

The extra flag MMC_MODE_HC (high capacity) is added to indicate if the
host is capable of handling the high capacity eMMC cards.

Since this change is added to the generic mmc framework, then it requires
other boards to indicate if their mmc controllers can handle high capacity
cards. As it is now - the old behaviour of the framework is preserved.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
drivers/mmc/mmc.c
drivers/mmc/s5p_mmc.c
include/mmc.h

index 4e4e0fb0f3cf43bb77e758d3f55c5d18bd14e7c8..cbd75673b8b501b23bcea85c79253a7f737868f3 100644 (file)
@@ -531,6 +531,10 @@ int mmc_send_op_cond(struct mmc *mmc)
                                (mmc->voltages &
                                (cmd.response[0] & OCR_VOLTAGE_MASK)) |
                                (cmd.response[0] & OCR_ACCESS_MODE));
+
+               if (mmc->host_caps & MMC_MODE_HC)
+                       cmd.cmdarg |= OCR_HCS;
+
                cmd.flags = 0;
 
                err = mmc_send_cmd(mmc, &cmd, NULL);
@@ -1010,7 +1014,7 @@ int mmc_startup(struct mmc *mmc)
                        capacity = ext_csd[212] << 0 | ext_csd[213] << 8 |
                                   ext_csd[214] << 16 | ext_csd[215] << 24;
                        capacity *= 512;
-                       if (capacity > 2 * 1024 * 1024 * 1024)
+                       if ((capacity >> 20) > 2 * 1024)
                                mmc->capacity = capacity;
                }
 
index 280738fbf4eb191e2fe4ae29239c053214bda451..f1368132a3b2c53c461500747dc1dc4d708dab17 100644 (file)
@@ -462,7 +462,7 @@ static int s5p_mmc_initialize(int dev_index, int bus_width)
                mmc->host_caps = MMC_MODE_8BIT;
        else
                mmc->host_caps = MMC_MODE_4BIT;
-       mmc->host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
+       mmc->host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS | MMC_MODE_HC;
 
        mmc->f_min = 400000;
        mmc->f_max = 52000000;
index 1c8a3607177f9aba81f38760bf4912061c4cd3d3..53aff9b4b485005006254c3c6eeee127da93a230 100644 (file)
@@ -45,6 +45,7 @@
 #define MMC_MODE_4BIT          0x100
 #define MMC_MODE_8BIT          0x200
 #define MMC_MODE_SPI           0x400
+#define MMC_MODE_HC            0x800
 
 #define SD_DATA_4BIT   0x00040000