[U-Boot] [PATCH] dm: mmc: Add the function for getting current device number
Jaehoon Chung
jh80.chung at samsung.com
Mon Jul 4 09:40:08 CEST 2016
get_mmc_num can be returned 0. Then if you use the "mmcinfo" command, it
can't print the mmc information.
If get_mmc_num is 0, it means that there is not mmc device.
So it added the get_mmc_curr_num() function for getting current device
number(index). And get_mmc_num() is returned the number of device.
This patch is only tested with mmc block..so i didn't touch the
blk-uclass.c.
Signed-off-by: Jaehoon Chung <jh80.chung at samsung.com>
---
drivers/mmc/mmc-uclass.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index 38ced41..a3f2463 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -111,6 +111,16 @@ struct mmc *find_mmc_device(int dev_num)
int get_mmc_num(void)
{
+ int devnum = blk_find_max_devnum(IF_TYPE_MMC);
+
+ if (devnum < 0)
+ return devnum;
+
+ return devnum + 1;
+}
+
+static int get_mmc_curr_num(void)
+{
return max(blk_find_max_devnum(IF_TYPE_MMC), 0);
}
@@ -118,7 +128,7 @@ int mmc_get_next_devnum(void)
{
int ret;
- ret = get_mmc_num();
+ ret = get_mmc_curr_num();
if (ret < 0)
return ret;
--
1.9.1
More information about the U-Boot
mailing list