From 2abbe0754759f94c79125a2534fbc4be74f416bc Mon Sep 17 00:00:00 2001 From: wdenk Date: Mon, 16 Jun 2003 23:50:08 +0000 Subject: * Patch by Nicolas Lacressonniere, 11 Jun 2003: Modifications for Atmel AT91RM9200DK ARM920T based development kit - Add Atmel DataFlash support for reading and writing. - Add possibility to boot a Linux from DataFlash with BOOTM command. - Add Flash detection on Atmel AT91RM9200DK (between Atmel AT49BV1614 and AT49BV1614A flashes) - Replace old Ethernet PHY layer functions - Change link address * Patch by Frank Smith, 9 Jun 2003: use CRIT_EXCEPTION for machine check on 4xx * Patch by Detlev Zundel, 13 Jun 2003: added implementation of the "carinfo" command in cmd_immap.c --- common/cmd_mem.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) (limited to 'common/cmd_mem.c') diff --git a/common/cmd_mem.c b/common/cmd_mem.c index bbfe95848..aca69260a 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -33,6 +33,9 @@ #if (CONFIG_COMMANDS & CFG_CMD_MMC) #include #endif +#ifdef CONFIG_HAS_DATAFLASH +#include +#endif #if (CONFIG_COMMANDS & (CFG_CMD_MEMORY | CFG_CMD_PCI | CFG_CMD_I2C\ | CMD_CMD_PORTIO)) @@ -131,6 +134,23 @@ int do_mem_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) printf("%08lx:", addr); linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes; + +#ifdef CONFIG_HAS_DATAFLASH + if (read_dataflash(addr, (linebytes/size)*size, linebuf) != -1){ + + for (i=0; i 0) { @@ -311,7 +341,11 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) #ifndef CFG_NO_FLASH /* check if we are copying to Flash */ - if (addr2info(dest) != NULL) { + if ( (addr2info(dest) != NULL) +#ifdef CONFIG_HAS_DATAFLASH + && (!addr_dataflash(addr)) +#endif + ) { int rc; printf ("Copy to Flash... "); @@ -366,6 +400,35 @@ int do_mem_cp ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } #endif +#ifdef CONFIG_HAS_DATAFLASH + /* Check if we are copying from RAM or Flash to DataFlash */ + if (addr_dataflash(dest) && !addr_dataflash(addr)){ + int rc; + + printf ("Copy to DataFlash... "); + + rc = write_dataflash (dest, addr, count*size); + + if (rc != 1) { + dataflash_perror (rc); + return (1); + } + puts ("done\n"); + return 0; + } + + /* Check if we are copying from DataFlash to RAM */ + if (addr_dataflash(addr) && !addr_dataflash(dest) && (addr2info(dest)==NULL) ){ + read_dataflash(addr, count * size, (char *) dest); + return 0; + } + + if (addr_dataflash(addr) && addr_dataflash(dest)){ + printf("Unsupported combination of source/destination.\n\r"); + return 1; + } +#endif + while (count-- > 0) { if (size == 4) *((ulong *)dest) = *((ulong *)addr); @@ -805,6 +868,13 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[]) addr += base_address; } +#ifdef CONFIG_HAS_DATAFLASH + if (addr_dataflash(addr)){ + printf("Can't modify DataFlash in place. Use cp instead.\n\r"); + return 0; + } +#endif + /* Print the address, followed by value. Then accept input for * the next value. A non-converted value exits. */ -- cgit v1.2.3