]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/cmd_mmc.c
CONFIG_SYS_HZ fix for ARM902T S3C24X0 Boards
[karo-tx-uboot.git] / common / cmd_mmc.c
index bd55ff1c77b663cbf9d1ac1d50b0243d22628e9d..0e3393b5f44b9d5c7f4b4869658101e1574cd646 100644 (file)
@@ -26,7 +26,7 @@
 #include <mmc.h>
 
 #ifndef CONFIG_GENERIC_MMC
-int curr_device = -1;
+static int curr_device = -1;
 
 int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
@@ -89,7 +89,7 @@ U_BOOT_CMD(
        mmc, 3, 1, do_mmc,
        "MMC sub-system",
        "init [dev] - init MMC sub system\n"
-       "mmc device [dev] - show or set current device\n"
+       "mmc device [dev] - show or set current device"
 );
 #else /* !CONFIG_GENERIC_MMC */
 
@@ -135,9 +135,10 @@ int do_mmcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        return 0;
 }
 
-U_BOOT_CMD(mmcinfo,    2,      0,      do_mmcinfo,
-       "print MMC information",
-       "<dev num>\n");
+U_BOOT_CMD(mmcinfo, 2, 0, do_mmcinfo,
+       "mmcinfo <dev num>-- display MMC info\n",
+       ""
+);
 
 int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
@@ -149,6 +150,9 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                        int dev = simple_strtoul(argv[2], NULL, 10);
                        struct mmc *mmc = find_mmc_device(dev);
 
+                       if (!mmc)
+                               return 1;
+
                        mmc_init(mmc);
 
                        return 0;
@@ -175,6 +179,9 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                        u32 blk = simple_strtoul(argv[4], NULL, 16);
                        struct mmc *mmc = find_mmc_device(dev);
 
+                       if (!mmc)
+                               return 1;
+
                        printf("\nMMC read: dev # %d, block # %d, count %d ... ",
                                dev, blk, cnt);
 
@@ -197,6 +204,9 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
                        int blk = simple_strtoul(argv[4], NULL, 16);
 
+                       if (!mmc)
+                               return 1;
+
                        printf("\nMMC write: dev # %d, block # %d, count %d ... ",
                                dev, blk, cnt);
 
@@ -222,5 +232,5 @@ U_BOOT_CMD(
        "read <device num> addr blk# cnt\n"
        "mmc write <device num> addr blk# cnt\n"
        "mmc rescan <device num>\n"
-       "mmc list - list available devices\n");
+       "mmc list - lists available devices");
 #endif