summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/mmc/mmc-uclass.c6
-rw-r--r--include/mmc.h6
2 files changed, 9 insertions, 3 deletions
diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index 38ced41..f262c6e 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -111,18 +111,18 @@ struct mmc *find_mmc_device(int dev_num)
int get_mmc_num(void)
{
- return max(blk_find_max_devnum(IF_TYPE_MMC), 0);
+ return max((blk_find_max_devnum(IF_TYPE_MMC) + 1), 0);
}
int mmc_get_next_devnum(void)
{
int ret;
- ret = get_mmc_num();
+ ret = blk_find_max_devnum(IF_TYPE_MMC);
if (ret < 0)
return ret;
- return ret + 1;
+ return ret;
}
struct blk_desc *mmc_get_blk_desc(struct mmc *mmc)
diff --git a/include/mmc.h b/include/mmc.h
index 8f309f1..dd47f34 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -503,6 +503,12 @@ void mmc_set_clock(struct mmc *mmc, uint clock);
struct mmc *find_mmc_device(int dev_num);
int mmc_set_dev(int dev_num);
void print_mmc_devices(char separator);
+
+/**
+ * get_mmc_num() - get the total MMC device number
+ *
+ * @return 0 if there is no MMC device, else the number of devices
+ */
int get_mmc_num(void);
int mmc_hwpart_config(struct mmc *mmc, const struct mmc_hwpart_conf *conf,
enum mmc_hwpart_conf_mode mode);