diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/Makefile | 2 | ||||
-rw-r--r-- | common/cmd_mmc.c | 63 | ||||
-rw-r--r-- | common/cmd_mtdparts.c | 9 | ||||
-rw-r--r-- | common/cmd_ubi.c | 26 | ||||
-rw-r--r-- | common/cmd_ubifs.c | 6 | ||||
-rw-r--r-- | common/image.c | 8 |
6 files changed, 92 insertions, 22 deletions
diff --git a/common/Makefile b/common/Makefile index e2d2f45..b9f4ca7 100644 --- a/common/Makefile +++ b/common/Makefile @@ -52,7 +52,9 @@ COBJS-y += env_common.o COBJS-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o COBJS-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o +COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += env_embedded.o COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o +COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o COBJS-$(CONFIG_ENV_IS_IN_MG_DISK) += env_mgdisk.o COBJS-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c index 16c919b..f1fa32f 100644 --- a/common/cmd_mmc.c +++ b/common/cmd_mmc.c @@ -26,19 +26,70 @@ #include <mmc.h> #ifndef CONFIG_GENERIC_MMC +int curr_device = -1; + int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { - if (mmc_legacy_init (1) != 0) { - printf ("No MMC card found\n"); + int dev; + + if (argc < 2) { + cmd_usage(cmdtp); return 1; } + + if (strcmp(argv[1], "init") == 0) { + if (argc == 2) { + if (curr_device < 0) + dev = 1; + else + dev = curr_device; + } else if (argc == 3) { + dev = (int)simple_strtoul(argv[2], NULL, 10); + } else { + cmd_usage(cmdtp); + return 1; + } + + if (mmc_legacy_init(dev) != 0) { + puts("No MMC card found\n"); + return 1; + } + + curr_device = dev; + printf("mmc%d is available\n", curr_device); + } else if (strcmp(argv[1], "device") == 0) { + if (argc == 2) { + if (curr_device < 0) { + puts("No MMC device available\n"); + return 1; + } + } else if (argc == 3) { + dev = (int)simple_strtoul(argv[2], NULL, 10); + +#ifdef CONFIG_SYS_MMC_SET_DEV + if (mmc_set_dev(dev) != 0) + return 1; +#endif + curr_device = dev; + } else { + cmd_usage(cmdtp); + return 1; + } + + printf("mmc%d is current device\n", curr_device); + } else { + cmd_usage(cmdtp); + return 1; + } + return 0; } U_BOOT_CMD( - mmcinit, 1, 0, do_mmc, - "init mmc card", - NULL + mmc, 3, 1, do_mmc, + "MMC sub-system", + "init [dev] - init MMC sub system\n" + "mmc device [dev] - show or set current device\n" ); #else /* !CONFIG_GENERIC_MMC */ @@ -166,7 +217,7 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( mmc, 6, 1, do_mmcops, - "mmc - MMC sub system\n", + "MMC sub system", "mmc read <device num> addr blk# cnt\n" "mmc write <device num> addr blk# cnt\n" "mmc rescan <device num>\n" diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c index c8bf2c6..3d437c0 100644 --- a/common/cmd_mtdparts.c +++ b/common/cmd_mtdparts.c @@ -84,13 +84,10 @@ * */ -/* - * JFFS2/CRAMFS support - */ #include <common.h> #include <command.h> #include <malloc.h> -#include <jffs2/jffs2.h> +#include <jffs2/load_kernel.h> #include <linux/list.h> #include <linux/ctype.h> #include <cramfs/cramfs_fs.h> @@ -375,7 +372,7 @@ static int part_validate_nor(struct mtdids *id, struct part_info *part) */ static int part_validate_nand(struct mtdids *id, struct part_info *part) { -#if defined(CONFIG_JFFS2_NAND) && defined(CONFIG_CMD_NAND) +#if defined(CONFIG_CMD_NAND) /* info for NAND chips */ nand_info_t *nand; @@ -780,7 +777,7 @@ int mtd_device_validate(u8 type, u8 num, u32 *size) printf("support for FLASH devices not present\n"); #endif } else if (type == MTD_DEV_TYPE_NAND) { -#if defined(CONFIG_JFFS2_NAND) && defined(CONFIG_CMD_NAND) +#if defined(CONFIG_CMD_NAND) if (num < CONFIG_SYS_MAX_NAND_DEVICE) { #ifndef CONFIG_NAND_LEGACY *size = nand_info[num].size; diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c index b99fd58..9c17d71 100644 --- a/common/cmd_ubi.c +++ b/common/cmd_ubi.c @@ -404,9 +404,6 @@ static int ubi_dev_scan(struct mtd_info *info, char *ubidev) u8 pnum; int err; - if (mtdparts_init() != 0) - return 1; - if (find_dev_and_part(ubidev, &dev, &pnum, &part) != 0) return 1; @@ -445,6 +442,11 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) return 1; } + if (mtdparts_init() != 0) { + printf("Error initializing mtdparts!\n"); + return 1; + } + if (strcmp(argv[1], "part") == 0) { /* Print current partition */ if (argc == 2) { @@ -475,7 +477,7 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) } /* - * Check for nand|onenand selection + * Check for nor|nand|onenand selection */ #if defined(CONFIG_CMD_NAND) if (strcmp(argv[2], "nand") == 0) { @@ -486,9 +488,23 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) #endif #if defined(CONFIG_FLASH_CFI_MTD) if (strcmp(argv[2], "nor") == 0) { + char mtd_dev[16]; + struct mtd_device *dev; + struct part_info *part; + u8 pnum; + + /* + * Search the mtd device number where this partition + * is located + */ + if (find_dev_and_part(argv[3], &dev, &pnum, &part)) { + printf("Partition %s not found!\n", argv[3]); + return 1; + } + sprintf(mtd_dev, "nor%d", dev->id->num); + ubi_dev.mtd_info = get_mtd_device_nm(mtd_dev); strcpy(ubi_dev.dev_name, "NOR"); ubi_dev.type = DEV_TYPE_NOR; - ubi_dev.mtd_info = get_mtd_device_nm(CFI_MTD_DEV_NAME); } #endif #if defined(CONFIG_CMD_ONENAND) diff --git a/common/cmd_ubifs.c b/common/cmd_ubifs.c index b2e0f4f..4767aa4 100644 --- a/common/cmd_ubifs.c +++ b/common/cmd_ubifs.c @@ -118,15 +118,15 @@ int do_ubifs_load(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) U_BOOT_CMD( ubifsmount, 2, 0, do_ubifs_mount, - "ubifsmount- mount UBIFS volume\n", + "mount UBIFS volume", "\n"); U_BOOT_CMD(ubifsls, 2, 0, do_ubifs_ls, - "ubifsls - list files in a directory\n", + "list files in a directory", "[directory]\n" " - list files in a 'directory' (default '/')\n"); U_BOOT_CMD(ubifsload, 4, 0, do_ubifs_load, - "ubifsload- load file from an UBIFS filesystem\n", + "load file from an UBIFS filesystem", "<addr> <filename> [bytes]\n" " - load file 'filename' to address 'addr'\n"); diff --git a/common/image.c b/common/image.c index daa68bc..e22c974 100644 --- a/common/image.c +++ b/common/image.c @@ -518,7 +518,11 @@ static char *get_table_entry_name (table_entry_t *table, char *msg, int id) { for (; table->id >= 0; ++table) { if (table->id == id) - return (table->lname); +#ifdef USE_HOSTCC + return table->lname; +#else + return table->lname + gd->reloc_off; +#endif } return (msg); } @@ -579,7 +583,7 @@ static int get_table_entry_id (table_entry_t *table, fprintf (stderr, "\n"); #else for (t = table; t->id >= 0; ++t) { - if (t->sname && strcmp(t->sname, name) == 0) + if (t->sname && strcmp(t->sname + gd->reloc_off, name) == 0) return (t->id); } debug ("Invalid %s Type: %s\n", table_name, name); |