diff options
author | Stelian Pop <stelian@popies.net> | 2008-03-26 22:52:35 +0100 |
---|---|---|
committer | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2008-03-30 21:19:40 +0200 |
commit | 880cc4381ea8360248cddcdf87a64566745a5724 (patch) | |
tree | 34f060d262bfe8068d3a21f9037802cd25981af3 | |
parent | f1b985f2d724ccaa4d3def07917f0caaf18fa77d (diff) | |
download | u-boot-imx-880cc4381ea8360248cddcdf87a64566745a5724.zip u-boot-imx-880cc4381ea8360248cddcdf87a64566745a5724.tar.gz u-boot-imx-880cc4381ea8360248cddcdf87a64566745a5724.tar.bz2 |
Fix CFG_NO_FLASH compilation.
Many Atmel boards have no "real" (NOR) flash on board, and rely only
on DataFlash and NAND memories. This patch enables CFG_NO_FLASH to
be present in a board configuration file, while still enabling flash
commands like 'flinfo', 'protect', etc.
Signed-off-by: Stelian Pop <stelian@popies.net>
-rw-r--r-- | common/cmd_flash.c | 25 | ||||
-rw-r--r-- | common/cmd_mem.c | 6 |
2 files changed, 27 insertions, 4 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 */ /**************************************************/ diff --git a/common/cmd_mem.c b/common/cmd_mem.c index 4262e26..d6d7a5b 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -492,7 +492,11 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } /* Check if we are copying from DataFlash to RAM */ - if (addr_dataflash(addr) && !addr_dataflash(dest) && (addr2info(dest)==NULL) ){ + if (addr_dataflash(addr) && !addr_dataflash(dest) +#ifndef CFG_NO_FLASH + && (addr2info(dest) == NULL) +#endif + ){ int rc; rc = read_dataflash(addr, count * size, (char *) dest); if (rc != 1) { |