]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mmc: core: Add helper function for EXT_CSD support
authorUlf Hansson <ulf.hansson@linaro.org>
Mon, 20 Oct 2014 09:33:53 +0000 (11:33 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 10 Nov 2014 11:40:41 +0000 (12:40 +0100)
The helper function mmc_can_ext_csd() will return a positive value if
the card supports the EXT_CSD register. Start using it at relavant
places in the mmc core.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/mmc.c
drivers/mmc/core/mmc_ops.c
drivers/mmc/core/mmc_ops.h

index 5226ef8c0c2dc704fbdfb5586d94e4a4dc58ac6e..7c257c93ecd78ff8327cab377f1392265682e7e1 100644 (file)
@@ -190,7 +190,7 @@ static int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd)
 
        *new_ext_csd = NULL;
 
-       if (card->csd.mmca_vsn < CSD_SPEC_VER_4)
+       if (!mmc_can_ext_csd(card))
                return 0;
 
        /*
@@ -852,7 +852,7 @@ static int mmc_select_powerclass(struct mmc_card *card)
        int err, ddr;
 
        /* Power class selection is supported for versions >= 4.0 */
-       if (card->csd.mmca_vsn < CSD_SPEC_VER_4)
+       if (!mmc_can_ext_csd(card))
                return 0;
 
        bus_width = host->ios.bus_width;
@@ -913,7 +913,7 @@ static int mmc_select_bus_width(struct mmc_card *card)
        unsigned idx, bus_width = 0;
        int err = 0;
 
-       if ((card->csd.mmca_vsn < CSD_SPEC_VER_4) &&
+       if (!mmc_can_ext_csd(card) &&
            !(host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)))
                return 0;
 
@@ -1154,7 +1154,7 @@ static int mmc_select_timing(struct mmc_card *card)
 {
        int err = 0;
 
-       if (card->csd.mmca_vsn < CSD_SPEC_VER_4)
+       if (!mmc_can_ext_csd(card))
                goto bus_speed;
 
        if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200)
index 7911e0510a1d6c2ed131e0fb74c913b2a9cc0162..1db60be43c37778ad7f9c3a583612528982d846b 100644 (file)
@@ -675,3 +675,8 @@ int mmc_send_hpi_cmd(struct mmc_card *card, u32 *status)
 
        return 0;
 }
+
+int mmc_can_ext_csd(struct mmc_card *card)
+{
+       return (card && card->csd.mmca_vsn > CSD_SPEC_VER_3);
+}
index f752ec67c1026bcc93ad4226f735eecc8ca5ccd0..6f4b00ed93de9e7176464ee35d1c8a5aec0c6525 100644 (file)
@@ -26,6 +26,7 @@ int mmc_spi_read_ocr(struct mmc_host *host, int highcap, u32 *ocrp);
 int mmc_spi_set_crc(struct mmc_host *host, int use_crc);
 int mmc_bus_test(struct mmc_card *card, u8 bus_width);
 int mmc_send_hpi_cmd(struct mmc_card *card, u32 *status);
+int mmc_can_ext_csd(struct mmc_card *card);
 
 #endif