From 55e26ad62107d2f14f757de3ae0b14b9aa7aed94 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 13 Jul 2007 21:41:44 +0200 Subject: [FIX] correct help for rspr --- common/cmd_mfsl.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'common') diff --git a/common/cmd_mfsl.c b/common/cmd_mfsl.c index ffa2666935..337dfbb24e 100644 --- a/common/cmd_mfsl.c +++ b/common/cmd_mfsl.c @@ -357,7 +357,7 @@ int do_rspr (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) reg = (unsigned int)simple_strtoul (argv[1], NULL, 16); val = (unsigned int)simple_strtoul (argv[2], NULL, 16); - if (argc < 1) { + if (argc < 2) { printf ("Usage:\n%s\n", cmdtp->usage); return 1; } @@ -382,6 +382,7 @@ int do_rspr (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) puts ("ESR"); break; default: + puts ("Unsupported register\n"); return 1; } printf (": 0x%08lx\n", val); @@ -408,10 +409,10 @@ U_BOOT_CMD (fwr, 4, 1, do_fwr, " 3 - blocking control write\n"); U_BOOT_CMD (rspr, 3, 1, do_rspr, - "rmsr - read/write special purpose register\n", + "rspr - read/write special purpose register\n", "- reg_num [write value] read/write special purpose register\n" - " 0 - MSR - Machine status register\n" - " 1 - EAR - Exception address register\n" - " 2 - ESR - Exception status register\n"); + " 1 - MSR - Machine status register\n" + " 3 - EAR - Exception address register\n" + " 5 - ESR - Exception status register\n"); #endif /* CONFIG_MICROBLAZE & CFG_CMD_MFSL */ -- cgit From 91bb4ca665d2e0cf7f60c4b5b370990250ec0c43 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Sat, 14 Jul 2007 12:41:23 +0200 Subject: [FS] Added support for ROMFS --- common/cmd_jffs2.c | 52 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 17 deletions(-) (limited to 'common') diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c index 7fd1fa33da..147ab10966 100644 --- a/common/cmd_jffs2.c +++ b/common/cmd_jffs2.c @@ -28,7 +28,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -85,7 +85,7 @@ */ /* - * JFFS2/CRAMFS support + * JFFS2/CRAMFS/ROMFS support */ #include #include @@ -110,7 +110,7 @@ #define DEBUG_JFFS #undef DEBUG_JFFS -#ifdef DEBUG_JFFS +#ifdef DEBUG_JFFS # define DEBUGF(fmt, args...) printf(fmt ,##args) #else # define DEBUGF(fmt, args...) @@ -175,6 +175,11 @@ extern int cramfs_load (char *loadoffset, struct part_info *info, char *filename extern int cramfs_ls (struct part_info *info, char *filename); extern int cramfs_info (struct part_info *info); +extern int romfs_check (struct part_info *info); +extern int romfs_load (char *loadoffset, struct part_info *info, char *filename); +extern int romfs_ls (struct part_info *info, char *filename); +extern int romfs_info (struct part_info *info); + static struct part_info* jffs2_part_info(struct mtd_device *dev, unsigned int part_num); /* command line only routines */ @@ -184,10 +189,10 @@ static struct mtdids* id_find_by_mtd_id(const char *mtd_id, unsigned int mtd_id_ static int device_del(struct mtd_device *dev); /** - * Parses a string into a number. The number stored at ptr is + * Parses a string into a number. The number stored at ptr is * potentially suffixed with K (for kilobytes, or 1024 bytes), * M (for megabytes, or 1048576 bytes), or G (for gigabytes, or - * 1073741824). If the number is suffixed with K, M, or G, then + * 1073741824). If the number is suffixed with K, M, or G, then * the return value is the number multiplied by one kilobyte, one * megabyte, or one gigabyte, respectively. * @@ -676,7 +681,7 @@ static int part_parse(const char *const partdef, const char **ret, struct part_i return 1; } - /* allocate memory */ + /* allocate memory */ part = (struct part_info *)malloc(sizeof(struct part_info) + name_len); if (!part) { printf("out of memory\n"); @@ -1832,9 +1837,9 @@ static struct part_info* jffs2_part_info(struct mtd_device *dev, unsigned int pa return NULL; } -/***************************************************/ -/* U-boot commands */ -/***************************************************/ +/*************************************************/ +/* U-boot commands */ +/*************************************************/ /** * Routine implementing fsload u-boot command. This routine tries to load @@ -1874,14 +1879,22 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) if ((part = jffs2_part_info(current_dev, current_partnum))){ - /* check partition type for cramfs */ - fsname = (cramfs_check(part) ? "CRAMFS" : "JFFS2"); + /* check partition type for JFFS2, cramfs, romfs */ + if (cramfs_check(part)) { + fsname = "CRAMFS"; + } else if (romfs_check(part)) { + fsname = "ROMFS"; + } else { + fsname = "JFFS2"; + } printf("### %s loading '%s' to 0x%lx\n", fsname, filename, offset); if (cramfs_check(part)) { size = cramfs_load ((char *) offset, part, filename); + } else if (romfs_check(part)){ + size = romfs_load ((char *) offset, part, filename); } else { - /* if this is not cramfs assume jffs2 */ + /* if this is not cramfs or romfs assume jffs2 */ size = jffs2_1pass_load((char *)offset, part, filename); } @@ -1928,8 +1941,10 @@ int do_jffs2_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /* check partition type for cramfs */ if (cramfs_check(part)) { ret = cramfs_ls (part, filename); + } else if (romfs_check(part)) { + ret = romfs_ls (part, filename); } else { - /* if this is not cramfs assume jffs2 */ + /* if this is not cramfs or romfs assume jffs2 */ ret = jffs2_1pass_ls(part, filename); } @@ -1951,7 +1966,6 @@ int do_jffs2_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) int do_jffs2_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { struct part_info *part; - char *fsname; int ret; /* make sure we are in sync with env variables */ @@ -1961,13 +1975,17 @@ int do_jffs2_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) if ((part = jffs2_part_info(current_dev, current_partnum))){ /* check partition type for cramfs */ - fsname = (cramfs_check(part) ? "CRAMFS" : "JFFS2"); - printf("### filesystem type is %s\n", fsname); + puts("### filesystem type is "); if (cramfs_check(part)) { + puts("CRAMFS\n"); ret = cramfs_info (part); + } else if (romfs_check(part)) { + puts("ROMFS\n"); + ret = romfs_info (part); } else { - /* if this is not cramfs assume jffs2 */ + /* if this is not cramfs or romfs assume jffs2 */ + puts("JFFS2\n"); ret = jffs2_1pass_info(part); } -- cgit From ab4b956d3143f8f8174089053f5dfabbb04762b0 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 6 Aug 2007 23:31:49 +0200 Subject: [FIX] Coding style cleanup - Wolfgang's suggestions --- common/cmd_jffs2.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'common') diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c index 147ab10966..8ea683d997 100644 --- a/common/cmd_jffs2.c +++ b/common/cmd_jffs2.c @@ -28,7 +28,7 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License @@ -110,7 +110,7 @@ #define DEBUG_JFFS #undef DEBUG_JFFS -#ifdef DEBUG_JFFS +#ifdef DEBUG_JFFS # define DEBUGF(fmt, args...) printf(fmt ,##args) #else # define DEBUGF(fmt, args...) @@ -189,10 +189,10 @@ static struct mtdids* id_find_by_mtd_id(const char *mtd_id, unsigned int mtd_id_ static int device_del(struct mtd_device *dev); /** - * Parses a string into a number. The number stored at ptr is + * Parses a string into a number. The number stored at ptr is * potentially suffixed with K (for kilobytes, or 1024 bytes), * M (for megabytes, or 1048576 bytes), or G (for gigabytes, or - * 1073741824). If the number is suffixed with K, M, or G, then + * 1073741824). If the number is suffixed with K, M, or G, then * the return value is the number multiplied by one kilobyte, one * megabyte, or one gigabyte, respectively. * @@ -681,7 +681,7 @@ static int part_parse(const char *const partdef, const char **ret, struct part_i return 1; } - /* allocate memory */ + /* allocate memory */ part = (struct part_info *)malloc(sizeof(struct part_info) + name_len); if (!part) { printf("out of memory\n"); @@ -1837,9 +1837,9 @@ static struct part_info* jffs2_part_info(struct mtd_device *dev, unsigned int pa return NULL; } -/*************************************************/ -/* U-boot commands */ -/*************************************************/ +/***************************************************/ +/* U-boot commands */ +/***************************************************/ /** * Routine implementing fsload u-boot command. This routine tries to load -- cgit From d7e8ce101a4a45ed6ed45739fc2de5f87b13f7f1 Mon Sep 17 00:00:00 2001 From: Kyungmin Park Date: Mon, 10 Sep 2007 17:15:14 +0900 Subject: OneNAND support (take #2) [PATCH 3/3] OneNAND support (take #2) OneNAND support at U-Boot Signed-off-by: Kyungmin Park --- common/Makefile | 3 +- common/cmd_nvedit.c | 9 ++- common/cmd_onenand.c | 155 +++++++++++++++++++++++++++++++++++++++++++++++++++ common/env_onenand.c | 134 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 297 insertions(+), 4 deletions(-) create mode 100644 common/cmd_onenand.c create mode 100644 common/env_onenand.c (limited to 'common') diff --git a/common/Makefile b/common/Makefile index ef7d097078..fde5ad903d 100644 --- a/common/Makefile +++ b/common/Makefile @@ -37,13 +37,14 @@ COBJS = main.o ACEX1K.o altera.o bedbug.o circbuf.o cmd_autoscript.o \ cmd_load.o cmd_log.o \ cmd_mem.o cmd_mii.o cmd_misc.o cmd_mmc.o \ cmd_nand.o cmd_net.o cmd_nvedit.o \ + cmd_onenand.o \ cmd_pci.o cmd_pcmcia.o cmd_portio.o \ cmd_reginfo.o cmd_reiser.o cmd_sata.o cmd_scsi.o cmd_spi.o \ cmd_universe.o cmd_usb.o cmd_vfd.o \ command.o console.o cyclon2.o devices.o dlmalloc.o docecc.o \ environment.o env_common.o \ env_nand.o env_dataflash.o env_flash.o env_eeprom.o \ - env_nvram.o env_nowhere.o \ + env_onenand.o env_nvram.o env_nowhere.o \ exports.o \ fdt_support.o flash.o fpga.o ft_build.o \ hush.o kgdb.o lcd.o lists.o lynxkdi.o \ diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 1db0fc3c03..6770408810 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -57,8 +57,9 @@ DECLARE_GLOBAL_DATA_PTR; !defined(CFG_ENV_IS_IN_FLASH) && \ !defined(CFG_ENV_IS_IN_DATAFLASH) && \ !defined(CFG_ENV_IS_IN_NAND) && \ + !defined(CFG_ENV_IS_IN_ONENAND) && \ !defined(CFG_ENV_IS_NOWHERE) -# error Define one of CFG_ENV_IS_IN_{NVRAM|EEPROM|FLASH|DATAFLASH|NOWHERE} +# error Define one of CFG_ENV_IS_IN_{NVRAM|EEPROM|FLASH|DATAFLASH|ONENAND|NOWHERE} #endif #define XMK_STR(x) #x @@ -553,7 +554,8 @@ int getenv_r (char *name, char *buf, unsigned len) #if defined(CFG_ENV_IS_IN_NVRAM) || defined(CFG_ENV_IS_IN_EEPROM) \ || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_FLASH)) \ - || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND)) + || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND)) \ + || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_ONENAND)) int do_saveenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { extern char * env_name_spec; @@ -608,7 +610,8 @@ U_BOOT_CMD( #if defined(CFG_ENV_IS_IN_NVRAM) || defined(CFG_ENV_IS_IN_EEPROM) \ || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_FLASH)) \ - || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND)) + || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND)) \ + || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_ONENAND)) U_BOOT_CMD( saveenv, 1, 0, do_saveenv, "saveenv - save environment variables to persistent storage\n", diff --git a/common/cmd_onenand.c b/common/cmd_onenand.c new file mode 100644 index 0000000000..dcda099c84 --- /dev/null +++ b/common/cmd_onenand.c @@ -0,0 +1,155 @@ +/* + * U-Boot command for OneNAND support + * + * Copyright (C) 2005-2007 Samsung Electronics + * Kyungmin Park + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include + +#ifdef CONFIG_CMD_ONENAND + +#include +#include +#include + +#include + +extern struct mtd_info onenand_mtd; +extern struct onenand_chip onenand_chip; + +int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) +{ + int ret = 0; + + switch (argc) { + case 0: + case 1: + printf("Usage:\n%s\n", cmdtp->usage); + return 1; + + case 2: + if (strncmp(argv[1], "open", 4) == 0) { + onenand_init(); + return 0; + } + onenand_print_device_info(onenand_chip.device_id, 1); + return 0; + + default: + /* At least 4 args */ + if (strncmp(argv[1], "erase", 5) == 0) { + struct erase_info instr; + ulong start, end; + ulong block; + + start = simple_strtoul(argv[2], NULL, 10); + end = simple_strtoul(argv[3], NULL, 10); + start -= (unsigned long)onenand_chip.base; + end -= (unsigned long)onenand_chip.base; + + if (!end || end < 0) + end = start; + + printf("Erase block from %d to %d\n", start, end); + + for (block = start; block <= end; block++) { + instr.addr = block << onenand_chip.erase_shift; + instr.len = 1 << onenand_chip.erase_shift; + ret = onenand_erase(&onenand_mtd, &instr); + if (ret) { + printf("erase failed %d\n", block); + break; + } + } + + return 0; + } + + if (strncmp(argv[1], "read", 4) == 0) { + ulong addr = simple_strtoul(argv[2], NULL, 16); + ulong ofs = simple_strtoul(argv[3], NULL, 16); + size_t len = simple_strtoul(argv[4], NULL, 16); + size_t retlen = 0; + int oob = strncmp(argv[1], "read.oob", 8) ? 0 : 1; + + ofs -= (unsigned long)onenand_chip.base; + + if (oob) + onenand_read_oob(&onenand_mtd, ofs, len, + &retlen, (u_char *) addr); + else + onenand_read(&onenand_mtd, ofs, len, &retlen, + (u_char *) addr); + printf("Done\n"); + + return 0; + } + + if (strncmp(argv[1], "write", 5) == 0) { + ulong addr = simple_strtoul(argv[2], NULL, 16); + ulong ofs = simple_strtoul(argv[3], NULL, 16); + size_t len = simple_strtoul(argv[4], NULL, 16); + size_t retlen = 0; + + ofs -= (unsigned long)onenand_chip.base; + + onenand_write(&onenand_mtd, ofs, len, &retlen, + (u_char *) addr); + printf("Done\n"); + + return 0; + } + + if (strncmp(argv[1], "block", 5) == 0) { + ulong addr = simple_strtoul(argv[2], NULL, 16); + ulong block = simple_strtoul(argv[3], NULL, 10); + ulong page = simple_strtoul(argv[4], NULL, 10); + size_t len = simple_strtol(argv[5], NULL, 10); + size_t retlen = 0; + ulong ofs; + int oob = strncmp(argv[1], "block.oob", 9) ? 0 : 1; + + ofs = block << onenand_chip.erase_shift; + if (page) + ofs += page << onenand_chip.page_shift; + + if (!len) { + if (oob) + len = 64; + else + len = 512; + } + + if (oob) + onenand_read_oob(&onenand_mtd, ofs, len, + &retlen, (u_char *) addr); + else + onenand_read(&onenand_mtd, ofs, len, &retlen, + (u_char *) addr); + return 0; + } + + break; + } + + return 0; +} + +U_BOOT_CMD( + onenand, 6, 1, do_onenand, + "onenand - OneNAND sub-system\n", + "info - show available OneNAND devices\n" + "onenand read[.oob] addr ofs len - read data at ofs with len to addr\n" + "onenand write addr ofs len - write data at ofs with len from addr\n" + "onenand erase saddr eaddr - erase block start addr to end addr\n" + "onenand block[.oob] addr block [page] [len] - " + "read data with (block [, page]) to addr" +); + +#endif /* CONFIG_CMD_ONENAND */ diff --git a/common/env_onenand.c b/common/env_onenand.c new file mode 100644 index 0000000000..66107f91f1 --- /dev/null +++ b/common/env_onenand.c @@ -0,0 +1,134 @@ +/* + * (C) Copyright 2005-2007 Samsung Electronics + * Kyungmin Park + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include + +#if defined(CFG_ENV_IS_IN_ONENAND) /* Environment is in OneNAND */ + +#include +#include +#include +#include + +#include +#include +#include + +extern struct mtd_info onenand_mtd; +extern struct onenand_chip onenand_chip; + +/* References to names in env_common.c */ +extern uchar default_environment[]; + +#define ONENAND_ENV_SIZE(mtd) (mtd.oobblock - ENV_HEADER_SIZE) + +char *env_name_spec = "OneNAND"; + +#ifdef ENV_IS_EMBEDDED +extern uchar environment[]; +env_t *env_ptr = (env_t *) (&environment[0]); +#else /* ! ENV_IS_EMBEDDED */ +static unsigned char onenand_env[MAX_ONENAND_PAGESIZE]; +env_t *env_ptr = (env_t *) onenand_env; +#endif /* ENV_IS_EMBEDDED */ + +uchar env_get_char_spec(int index) +{ + DECLARE_GLOBAL_DATA_PTR; + + return (*((uchar *) (gd->env_addr + index))); +} + +void env_relocate_spec(void) +{ + DECLARE_GLOBAL_DATA_PTR; + unsigned long env_addr; + int use_default = 0; + int retlen; + + env_addr = CFG_ENV_ADDR; + env_addr -= (unsigned long)onenand_chip.base; + + /* Check OneNAND exist */ + if (onenand_mtd.oobblock) + /* Ignore read fail */ + onenand_read(&onenand_mtd, env_addr, onenand_mtd.oobblock, + &retlen, (u_char *) env_ptr); + else + onenand_mtd.oobblock = MAX_ONENAND_PAGESIZE; + + if (crc32(0, env_ptr->data, ONENAND_ENV_SIZE(onenand_mtd)) != + env_ptr->crc) + use_default = 1; + + if (use_default) { + memcpy(env_ptr->data, default_environment, + ONENAND_ENV_SIZE(onenand_mtd)); + env_ptr->crc = + crc32(0, env_ptr->data, ONENAND_ENV_SIZE(onenand_mtd)); + } + + gd->env_addr = (ulong) & env_ptr->data; + gd->env_valid = 1; +} + +int saveenv(void) +{ + unsigned long env_addr = CFG_ENV_ADDR; + struct erase_info instr; + int retlen; + + instr.len = CFG_ENV_SIZE; + instr.addr = env_addr; + instr.addr -= (unsigned long)onenand_chip.base; + if (onenand_erase(&onenand_mtd, &instr)) { + printf("OneNAND: erase failed at 0x%08x\n", env_addr); + return 1; + } + + /* update crc */ + env_ptr->crc = + crc32(0, env_ptr->data, onenand_mtd.oobblock - ENV_HEADER_SIZE); + + env_addr -= (unsigned long)onenand_chip.base; + if (onenand_write(&onenand_mtd, env_addr, onenand_mtd.oobblock, &retlen, + (u_char *) env_ptr)) { + printf("OneNAND: write failed at 0x%08x\n", instr.addr); + return 2; + } + + return 0; +} + +int env_init(void) +{ + DECLARE_GLOBAL_DATA_PTR; + + /* use default */ + gd->env_addr = (ulong) & default_environment[0]; + gd->env_valid = 1; + + return 0; +} + +#endif /* CFG_ENV_IS_IN_ONENAND */ -- cgit From b90c045f035c3cc9b5d2edaed6048dfb74e40763 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 24 Sep 2007 00:08:37 +0200 Subject: synchronizition with mainline --- common/cmd_jffs2.c | 36 +++++++++--------------------------- common/cmd_mfsl.c | 11 +++++------ 2 files changed, 14 insertions(+), 33 deletions(-) (limited to 'common') diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c index 3e6061a520..513a226c43 100644 --- a/common/cmd_jffs2.c +++ b/common/cmd_jffs2.c @@ -85,7 +85,7 @@ */ /* - * JFFS2/CRAMFS/ROMFS support + * JFFS2/CRAMFS support */ #include #include @@ -175,11 +175,6 @@ extern int cramfs_load (char *loadoffset, struct part_info *info, char *filename extern int cramfs_ls (struct part_info *info, char *filename); extern int cramfs_info (struct part_info *info); -extern int romfs_check (struct part_info *info); -extern int romfs_load (char *loadoffset, struct part_info *info, char *filename); -extern int romfs_ls (struct part_info *info, char *filename); -extern int romfs_info (struct part_info *info); - static struct part_info* jffs2_part_info(struct mtd_device *dev, unsigned int part_num); /* command line only routines */ @@ -1879,22 +1874,14 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) if ((part = jffs2_part_info(current_dev, current_partnum))){ - /* check partition type for JFFS2, cramfs, romfs */ - if (cramfs_check(part)) { - fsname = "CRAMFS"; - } else if (romfs_check(part)) { - fsname = "ROMFS"; - } else { - fsname = "JFFS2"; - } + /* check partition type for cramfs */ + fsname = (cramfs_check(part) ? "CRAMFS" : "JFFS2"); printf("### %s loading '%s' to 0x%lx\n", fsname, filename, offset); if (cramfs_check(part)) { size = cramfs_load ((char *) offset, part, filename); - } else if (romfs_check(part)){ - size = romfs_load ((char *) offset, part, filename); } else { - /* if this is not cramfs or romfs assume jffs2 */ + /* if this is not cramfs assume jffs2 */ size = jffs2_1pass_load((char *)offset, part, filename); } @@ -1941,10 +1928,8 @@ int do_jffs2_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /* check partition type for cramfs */ if (cramfs_check(part)) { ret = cramfs_ls (part, filename); - } else if (romfs_check(part)) { - ret = romfs_ls (part, filename); } else { - /* if this is not cramfs or romfs assume jffs2 */ + /* if this is not cramfs assume jffs2 */ ret = jffs2_1pass_ls(part, filename); } @@ -1966,6 +1951,7 @@ int do_jffs2_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) int do_jffs2_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { struct part_info *part; + char *fsname; int ret; /* make sure we are in sync with env variables */ @@ -1975,17 +1961,13 @@ int do_jffs2_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) if ((part = jffs2_part_info(current_dev, current_partnum))){ /* check partition type for cramfs */ - puts("### filesystem type is "); + fsname = (cramfs_check(part) ? "CRAMFS" : "JFFS2"); + printf("### filesystem type is %s\n", fsname); if (cramfs_check(part)) { - puts("CRAMFS\n"); ret = cramfs_info (part); - } else if (romfs_check(part)) { - puts("ROMFS\n"); - ret = romfs_info (part); } else { - /* if this is not cramfs or romfs assume jffs2 */ - puts("JFFS2\n"); + /* if this is not cramfs assume jffs2 */ ret = jffs2_1pass_info(part); } diff --git a/common/cmd_mfsl.c b/common/cmd_mfsl.c index 93cc873b05..8d4c1a38d7 100644 --- a/common/cmd_mfsl.c +++ b/common/cmd_mfsl.c @@ -357,7 +357,7 @@ int do_rspr (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) reg = (unsigned int)simple_strtoul (argv[1], NULL, 16); val = (unsigned int)simple_strtoul (argv[2], NULL, 16); - if (argc < 2) { + if (argc < 1) { printf ("Usage:\n%s\n", cmdtp->usage); return 1; } @@ -382,7 +382,6 @@ int do_rspr (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) puts ("ESR"); break; default: - puts ("Unsupported register\n"); return 1; } printf (": 0x%08lx\n", val); @@ -409,10 +408,10 @@ U_BOOT_CMD (fwr, 4, 1, do_fwr, " 3 - blocking control write\n"); U_BOOT_CMD (rspr, 3, 1, do_rspr, - "rspr - read/write special purpose register\n", + "rmsr - read/write special purpose register\n", "- reg_num [write value] read/write special purpose register\n" - " 1 - MSR - Machine status register\n" - " 3 - EAR - Exception address register\n" - " 5 - ESR - Exception status register\n"); + " 0 - MSR - Machine status register\n" + " 1 - EAR - Exception address register\n" + " 2 - ESR - Exception status register\n"); #endif -- cgit From 481d4328618804add1f818a6c96296121cd0528e Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 24 Sep 2007 00:17:42 +0200 Subject: [FIX] repair MFSL commands --- common/cmd_mfsl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'common') diff --git a/common/cmd_mfsl.c b/common/cmd_mfsl.c index 8d4c1a38d7..9d1d87551a 100644 --- a/common/cmd_mfsl.c +++ b/common/cmd_mfsl.c @@ -355,19 +355,18 @@ int do_rspr (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) unsigned int reg = 0; unsigned int val = 0; - reg = (unsigned int)simple_strtoul (argv[1], NULL, 16); - val = (unsigned int)simple_strtoul (argv[2], NULL, 16); - if (argc < 1) { + if (argc < 2) { printf ("Usage:\n%s\n", cmdtp->usage); return 1; } + reg = (unsigned int)simple_strtoul (argv[1], NULL, 16); + val = (unsigned int)simple_strtoul (argv[2], NULL, 16); switch (reg) { case 0x1: if (argc > 2) { MTS (val, rmsr); NOP; MFS (val, rmsr); - } else { MFS (val, rmsr); } @@ -382,6 +381,7 @@ int do_rspr (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) puts ("ESR"); break; default: + puts ("Unsupported register\n"); return 1; } printf (": 0x%08lx\n", val); @@ -408,10 +408,10 @@ U_BOOT_CMD (fwr, 4, 1, do_fwr, " 3 - blocking control write\n"); U_BOOT_CMD (rspr, 3, 1, do_rspr, - "rmsr - read/write special purpose register\n", + "rspr - read/write special purpose register\n", "- reg_num [write value] read/write special purpose register\n" - " 0 - MSR - Machine status register\n" - " 1 - EAR - Exception address register\n" - " 2 - ESR - Exception status register\n"); + " 1 - MSR - Machine status register\n" + " 3 - EAR - Exception address register\n" + " 5 - ESR - Exception status register\n"); #endif -- cgit From 0d38effc6e359e6b1b0c78d66e8bc1a4dc15a2ae Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Tue, 25 Sep 2007 15:48:05 -0600 Subject: Fpga: fix incorrect test of CFG_FPGA_XILINX macro CFG_FPGA_XILINX is a bit value used to test against the value in CONFIG_FPGA. Testing for a value will always return TRUE. I don't think that is the intention in this code. Signed-off-by: Grant Likely --- common/cmd_fpga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common') diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c index 3fc4fca9ae..cce23ad70d 100644 --- a/common/cmd_fpga.c +++ b/common/cmd_fpga.c @@ -60,6 +60,7 @@ static int fpga_get_op (char *opstr); /* Convert bitstream data and load into the fpga */ int fpga_loadbitstream(unsigned long dev, char* fpgadata, size_t size) { +#if (CONFIG_FPGA & CFG_FPGA_XILINX) unsigned int length; unsigned char* swapdata; unsigned int swapsize; @@ -72,7 +73,6 @@ int fpga_loadbitstream(unsigned long dev, char* fpgadata, size_t size) dataptr = (unsigned char *)fpgadata; -#if CFG_FPGA_XILINX /* skip the first bytes of the bitsteam, their meaning is unknown */ length = (*dataptr << 8) + *(dataptr+1); dataptr+=2; -- cgit