mmc: Resolve BKOPS compatability issue
authorAlexey Skidanov <alexey.skidanov@sandisk.com>
Thu, 29 Jan 2015 08:49:43 +0000 (10:49 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Thu, 29 Jan 2015 10:15:12 +0000 (11:15 +0100)
This patch is coming to fix compatibility issue of BKOPS_EN  field of EXT_CSD.
In eMMC-5.1, BKOPS_EN was changed, and now it has two operational bits:
Bit 0 - MANUAL_EN
Bit 1 - AUTO_EN
In previous eMMC revisions, only Bit 0 was supported.

Signed-off-by: Alexey Skidanov <alexey.skidanov@sandisk.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/core.c
drivers/mmc/core/mmc.c
include/linux/mmc/card.h
include/linux/mmc/mmc.h

index 1be7055548cb1ad1343d765e293b388f062b951e..0dc64e6e00d4de4a1aaa887ff321d65948ab1c7c 100644 (file)
@@ -275,7 +275,7 @@ void mmc_start_bkops(struct mmc_card *card, bool from_exception)
 
        BUG_ON(!card);
 
-       if (!card->ext_csd.bkops_en || mmc_card_doing_bkops(card))
+       if (!card->ext_csd.man_bkops_en || mmc_card_doing_bkops(card))
                return;
 
        err = mmc_read_bkops_status(card);
index 1fc48a2806597ae6f76c30801304a0b29cd1d1e7..1d41e8541f388d7a2f74f04e469b72841609f03b 100644 (file)
@@ -483,11 +483,13 @@ static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)
                /* check whether the eMMC card supports BKOPS */
                if (ext_csd[EXT_CSD_BKOPS_SUPPORT] & 0x1) {
                        card->ext_csd.bkops = 1;
-                       card->ext_csd.bkops_en = ext_csd[EXT_CSD_BKOPS_EN];
+                       card->ext_csd.man_bkops_en =
+                                       (ext_csd[EXT_CSD_BKOPS_EN] &
+                                               EXT_CSD_MANUAL_BKOPS_MASK);
                        card->ext_csd.raw_bkops_status =
                                ext_csd[EXT_CSD_BKOPS_STATUS];
-                       if (!card->ext_csd.bkops_en)
-                               pr_info("%s: BKOPS_EN bit is not set\n",
+                       if (!card->ext_csd.man_bkops_en)
+                               pr_info("%s: MAN_BKOPS_EN bit is not set\n",
                                        mmc_hostname(card->host));
                }
 
index 4d69c00497bdf4de58334a4c9805d6defea7957b..a6cf4c063e4e50f7d778ccd00ecbb373cc0e4717 100644 (file)
@@ -83,7 +83,7 @@ struct mmc_ext_csd {
        bool                    hpi;                    /* HPI support bit */
        unsigned int            hpi_cmd;                /* cmd used as HPI */
        bool                    bkops;          /* background support bit */
-       bool                    bkops_en;       /* background enable bit */
+       bool                    man_bkops_en;   /* manual bkops enable bit */
        unsigned int            data_sector_size;       /* 512 bytes or 4KB */
        unsigned int            data_tag_unit_size;     /* DATA TAG UNIT size */
        unsigned int            boot_ro_lock;           /* ro lock support */
index fb97b5cc91cdabc5951e62f5ddfef246dc17cc88..124f562118b8541384f05b3093f436a95be4cf00 100644 (file)
@@ -427,6 +427,11 @@ struct _mmc_csd {
  */
 #define EXT_CSD_BKOPS_LEVEL_2          0x2
 
+/*
+ * BKOPS modes
+ */
+#define EXT_CSD_MANUAL_BKOPS_MASK      0x01
+
 /*
  * MMC_SWITCH access modes
  */