diff options
Diffstat (limited to 'common/cmd_flash.c')
-rw-r--r-- | common/cmd_flash.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/common/cmd_flash.c b/common/cmd_flash.c index f56443e..db5dec9 100644 --- a/common/cmd_flash.c +++ b/common/cmd_flash.c @@ -41,6 +41,7 @@ int find_dev_and_part(const char *id, struct mtd_device **dev, u8 *part_num, struct part_info **part); #endif +#ifndef CFG_NO_FLASH extern flash_info_t flash_info[]; /* info for FLASH chips */ /* @@ -275,15 +276,19 @@ flash_fill_sect_ranges (ulong addr_first, ulong addr_last, return rcode; } +#endif /* CFG_NO_FLASH */ int do_flinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { +#ifndef CFG_NO_FLASH ulong bank; +#endif #ifdef CONFIG_HAS_DATAFLASH dataflash_print_info(); #endif +#ifndef CFG_NO_FLASH if (argc == 1) { /* print info for all FLASH banks */ for (bank=0; bank <CFG_MAX_FLASH_BANKS; ++bank) { printf ("\nBank # %ld: ", bank+1); @@ -301,11 +306,13 @@ int do_flinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } printf ("\nBank # %ld: ", bank); flash_print_info (&flash_info[bank-1]); +#endif /* CFG_NO_FLASH */ return 0; } int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { +#ifndef CFG_NO_FLASH flash_info_t *info; ulong bank, addr_first, addr_last; int n, sect_first, sect_last; @@ -397,8 +404,12 @@ int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) rcode = flash_sect_erase(addr_first, addr_last); return rcode; +#else + return 0; +#endif /* CFG_NO_FLASH */ } +#ifndef CFG_NO_FLASH int flash_sect_erase (ulong addr_first, ulong addr_last) { flash_info_t *info; @@ -439,12 +450,17 @@ int flash_sect_erase (ulong addr_first, ulong addr_last) } return rcode; } +#endif /* CFG_NO_FLASH */ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { +#ifndef CFG_NO_FLASH flash_info_t *info; - ulong bank, addr_first, addr_last; - int i, p, n, sect_first, sect_last; + ulong bank; + int i, n, sect_first, sect_last; +#endif /* CFG_NO_FLASH */ + ulong addr_first, addr_last; + int p; #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE) struct mtd_device *dev; struct part_info *part; @@ -487,6 +503,7 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } #endif +#ifndef CFG_NO_FLASH if (strcmp(argv[2], "all") == 0) { for (bank=1; bank<=CFG_MAX_FLASH_BANKS; ++bank) { info = &flash_info[bank-1]; @@ -611,10 +628,11 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 1; } rcode = flash_sect_protect (p, addr_first, addr_last); +#endif /* CFG_NO_FLASH */ return rcode; } - +#ifndef CFG_NO_FLASH int flash_sect_protect (int p, ulong addr_first, ulong addr_last) { flash_info_t *info; @@ -667,6 +685,7 @@ int flash_sect_protect (int p, ulong addr_first, ulong addr_last) } return rcode; } +#endif /* CFG_NO_FLASH */ /**************************************************/ |