diff options
author | Simon Glass | 2016-05-01 13:52:26 -0600 |
---|---|---|
committer | Simon Glass | 2016-05-17 09:54:43 -0600 |
commit | e17d1143c1a3f6f9bb1b21acb50e5e6a79855023 (patch) | |
tree | 90f0e5101c5468f418012000d3a1f5e27a22d251 /drivers/mmc | |
parent | ff3882ac23fcfda81284f372924063036bea507b (diff) |
dm: mmc: Implement the select_hwpart() method
Implement this method so that hardware partitions will work correctly with
MMC.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/mmc.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 2211ac6d994..e270f5f6447 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -606,6 +606,27 @@ int mmc_switch_part(int dev_num, unsigned int part_num) return ret; } +static int mmc_select_hwpartp(struct blk_desc *desc, int hwpart) +{ + struct mmc *mmc = find_mmc_device(desc->devnum); + int ret; + + if (!mmc) + return -ENODEV; + + if (mmc->block_dev.hwpart == hwpart) + return 0; + + if (mmc->part_config == MMCPART_NOAVAILABLE) + return -EMEDIUMTYPE; + + ret = mmc_switch_part(desc->devnum, hwpart); + if (ret) + return ret; + + return 0; +} + int mmc_select_hwpart(int dev_num, int hwpart) { struct mmc *mmc = find_mmc_device(dev_num); @@ -1973,4 +1994,5 @@ U_BOOT_LEGACY_BLK(mmc) = { .if_type = IF_TYPE_MMC, .max_devs = -1, .get_dev = mmc_get_dev, + .select_hwpart = mmc_select_hwpartp, }; |