]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: mmc: Use the new select_hwpart() API
authorSimon Glass <sjg@chromium.org>
Sun, 1 May 2016 19:52:29 +0000 (13:52 -0600)
committerSimon Glass <sjg@chromium.org>
Tue, 17 May 2016 15:54:43 +0000 (09:54 -0600)
Avoid calling directly into the MMC code - use the new API call instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
cmd/mmc.c
common/env_mmc.c
common/spl/spl_mmc.c
drivers/dfu/dfu_mmc.c
drivers/mmc/mmc.c
drivers/mmc/mmc_write.c
include/mmc.h

index 4f251870ee53dae72f4646f6e832ab3525fdd0a6..8695c191879ee1cc436285db28d132b8ca5842b7 100644 (file)
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -314,12 +314,14 @@ static int do_mmcrpmb(cmd_tbl_t *cmdtp, int flag,
        }
        /* Switch to the RPMB partition */
        original_part = mmc->block_dev.hwpart;
-       if (mmc_select_hwpart(curr_device, MMC_PART_RPMB) != 0)
+       if (blk_select_hwpart_devnum(IF_TYPE_MMC, curr_device, MMC_PART_RPMB) !=
+           0)
                return CMD_RET_FAILURE;
        ret = cp->cmd(cmdtp, flag, argc, argv);
 
        /* Return to original partition */
-       if (mmc_select_hwpart(curr_device, original_part) != 0)
+       if (blk_select_hwpart_devnum(IF_TYPE_MMC, curr_device, original_part) !=
+           0)
                return CMD_RET_FAILURE;
        return ret;
 }
@@ -467,7 +469,7 @@ static int do_mmc_dev(cmd_tbl_t *cmdtp, int flag,
        if (!mmc)
                return CMD_RET_FAILURE;
 
-       ret = mmc_select_hwpart(dev, part);
+       ret = blk_select_hwpart_devnum(IF_TYPE_MMC, dev, part);
        printf("switch to partitions #%d, %s\n",
               part, (!ret) ? "OK" : "ERROR");
        if (ret)
index bdb452e58c598731c9edc8e93d5e37f19e280919..c7fef188cd21b9a6b816ab7b8c997de788b2d822 100644 (file)
@@ -86,8 +86,8 @@ static int mmc_set_env_part(struct mmc *mmc)
        dev = 0;
 #endif
 
-       env_mmc_orig_hwpart = mmc->block_dev.hwpart;
-       ret = mmc_select_hwpart(dev, part);
+       env_mmc_orig_hwpart = mmc_get_blk_desc(mmc)->hwpart;
+       ret = blk_select_hwpart_devnum(IF_TYPE_MMC, dev, part);
        if (ret)
                puts("MMC partition switch failed\n");
 
@@ -119,7 +119,7 @@ static void fini_mmc_for_env(struct mmc *mmc)
 #ifdef CONFIG_SPL_BUILD
        dev = 0;
 #endif
-       mmc_select_hwpart(dev, env_mmc_orig_hwpart);
+       blk_select_hwpart_devnum(IF_TYPE_MMC, dev, env_mmc_orig_hwpart);
 #endif
 }
 
index 8d588d13a365cae687437a58606069f27509d465..cf527da9f22b455e10879f3c418498d1156a817f 100644 (file)
@@ -296,7 +296,7 @@ int spl_mmc_load_image(u32 boot_device)
                        if (part == 7)
                                part = 0;
 
-                       err = mmc_switch_part(0, part);
+                       err = blk_dselect_hwpart(mmc_get_blk_desc(mmc), part);
                        if (err) {
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
                                puts("spl: mmc partition switch failed\n");
index faece8883ac0a5bcf6b11a67d3425260d1b6a1b1..78724e467b24c7f816fef09767022bd8876b42a8 100644 (file)
@@ -50,8 +50,9 @@ static int mmc_block_op(enum dfu_op op, struct dfu_entity *dfu,
 
        if (dfu->data.mmc.hw_partition >= 0) {
                part_num_bkp = mmc->block_dev.hwpart;
-               ret = mmc_select_hwpart(dfu->data.mmc.dev_num,
-                                       dfu->data.mmc.hw_partition);
+               ret = blk_select_hwpart_devnum(IF_TYPE_MMC,
+                                              dfu->data.mmc.dev_num,
+                                              dfu->data.mmc.hw_partition);
                if (ret)
                        return ret;
        }
@@ -75,12 +76,16 @@ static int mmc_block_op(enum dfu_op op, struct dfu_entity *dfu,
        if (n != blk_count) {
                error("MMC operation failed");
                if (dfu->data.mmc.hw_partition >= 0)
-                       mmc_select_hwpart(dfu->data.mmc.dev_num, part_num_bkp);
+                       blk_select_hwpart_devnum(IF_TYPE_MMC,
+                                                dfu->data.mmc.dev_num,
+                                                part_num_bkp);
                return -EIO;
        }
 
        if (dfu->data.mmc.hw_partition >= 0) {
-               ret = mmc_select_hwpart(dfu->data.mmc.dev_num, part_num_bkp);
+               ret = blk_select_hwpart_devnum(IF_TYPE_MMC,
+                                              dfu->data.mmc.dev_num,
+                                              part_num_bkp);
                if (ret)
                        return ret;
        }
index 49996a891c7331a7f0f4812cdbf99cf46d3a53e1..7322f3340452e1a6664f3832f83da54ad65f9438 100644 (file)
@@ -257,7 +257,7 @@ static ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start,
        if (!mmc)
                return 0;
 
-       err = mmc_select_hwpart(dev_num, block_dev->hwpart);
+       err = blk_dselect_hwpart(block_dev, block_dev->hwpart);
        if (err < 0)
                return 0;
 
index 7b186f8500d70c754b8237519c498741447e1f78..f4d42aaa76ccc22c6f8e40cefe3727eeaaf63481 100644 (file)
@@ -78,7 +78,8 @@ unsigned long mmc_berase(struct blk_desc *block_dev, lbaint_t start,
        if (!mmc)
                return -1;
 
-       err = mmc_select_hwpart(dev_num, block_dev->hwpart);
+       err = blk_select_hwpart_devnum(IF_TYPE_MMC, dev_num,
+                                      block_dev->hwpart);
        if (err < 0)
                return -1;
 
@@ -182,7 +183,7 @@ ulong mmc_bwrite(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
        if (!mmc)
                return 0;
 
-       err = mmc_select_hwpart(dev_num, block_dev->hwpart);
+       err = blk_select_hwpart_devnum(IF_TYPE_MMC, dev_num, block_dev->hwpart);
        if (err < 0)
                return 0;
 
index 36449c34ea14c3d14284a535970cd3078f9b9ae9..f01674d9fc86643fc1e140a79cc8edd4cfb1cfa7 100644 (file)
@@ -415,7 +415,6 @@ struct mmc *find_mmc_device(int dev_num);
 int mmc_set_dev(int dev_num);
 void print_mmc_devices(char separator);
 int get_mmc_num(void);
-int mmc_switch_part(int dev_num, unsigned int part_num);
 int mmc_hwpart_config(struct mmc *mmc, const struct mmc_hwpart_conf *conf,
                      enum mmc_hwpart_conf_mode mode);
 int mmc_getcd(struct mmc *mmc);