mmc: print out partition table
authorLei Wen <leiwen@marvell.com>
Mon, 13 Sep 2010 14:07:28 +0000 (22:07 +0800)
committerWolfgang Denk <wd@denx.de>
Sat, 18 Sep 2010 21:47:28 +0000 (23:47 +0200)
Signed-off-by: Lei Wen <leiwen@marvell.com>
common/cmd_mmc.c
disk/part.c

index 2b14a42dcb4f056720bd78573bd002b19cb4562b..4e7bcdf82a528cd96b49a259fa54cef5432da453 100644 (file)
@@ -154,6 +154,25 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                        mmc_init(mmc);
 
                        return 0;
+               } else if (strncmp(argv[1], "part", 4) == 0) {
+                       int dev = simple_strtoul(argv[2], NULL, 10);
+                       block_dev_desc_t *mmc_dev;
+                       struct mmc *mmc = find_mmc_device(dev);
+
+                       if (!mmc) {
+                               puts("no mmc devices available\n");
+                               return 1;
+                       }
+                       mmc_init(mmc);
+                       mmc_dev = mmc_get_dev(dev);
+                       if (mmc_dev != NULL &&
+                           mmc_dev->type != DEV_TYPE_UNKNOWN) {
+                               print_part(mmc_dev);
+                               return 0;
+                       }
+
+                       puts("get mmc type error!\n");
+                       return 1;
                }
 
        case 0:
@@ -230,5 +249,6 @@ U_BOOT_CMD(
        "read <device num> addr blk# cnt\n"
        "mmc write <device num> addr blk# cnt\n"
        "mmc rescan <device num>\n"
+       "mmc part <device num> - lists available partition on mmc\n"
        "mmc list - lists available devices");
 #endif
index 3ba88c7e817b5dc8b146545ed46586c70e5ce85c..1806fe6e18f0a1a91d837e4c8d16bdbb6ce1355b 100644 (file)
@@ -364,6 +364,9 @@ static void print_part_header (const char *type, block_dev_desc_t * dev_desc)
        case IF_TYPE_DOC:
                puts ("DOC");
                break;
+       case IF_TYPE_MMC:
+               puts ("MMC");
+               break;
        default:
                puts ("UNKNOWN");
                break;