X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=cmd%2Fmem.c;h=509b400b240fd66d7161a54b2060e8d83551ccde;hb=a1b73c18724eb8cb75f7a60d851578d933c78095;hp=27075e54a91255b1661fc478da6a707513942392;hpb=821560fd8e43eecc208c1c52ad24faadb6b52703;p=u-boot diff --git a/cmd/mem.c b/cmd/mem.c index 27075e54a9..509b400b24 100644 --- a/cmd/mem.c +++ b/cmd/mem.c @@ -1,8 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2000 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * SPDX-License-Identifier: GPL-2.0+ */ /* @@ -17,9 +16,6 @@ #include #include #include -#ifdef CONFIG_HAS_DATAFLASH -#include -#endif #include #include #include @@ -52,10 +48,8 @@ static ulong base_address = 0; #define DISP_LINE_LEN 16 static int do_mem_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - ulong addr, length; -#if defined(CONFIG_HAS_DATAFLASH) - ulong nbytes, linebytes; -#endif + ulong addr, length, bytes; + const void *buf; int size; int rc = 0; @@ -88,40 +82,13 @@ static int do_mem_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) length = simple_strtoul(argv[2], NULL, 16); } -#if defined(CONFIG_HAS_DATAFLASH) - /* Print the lines. - * - * We buffer all read data, so we can make sure data is read only - * once, and all accesses are with the specified bus width. - */ - nbytes = length * size; - do { - char linebuf[DISP_LINE_LEN]; - void* p; - linebytes = (nbytes>DISP_LINE_LEN)?DISP_LINE_LEN:nbytes; - - rc = read_dataflash(addr, (linebytes/size)*size, linebuf); - p = (rc == DATAFLASH_OK) ? linebuf : (void*)addr; - print_buffer(addr, p, size, linebytes/size, DISP_LINE_LEN/size); - - nbytes -= linebytes; - addr += linebytes; - if (ctrlc()) { - rc = 1; - break; - } - } while (nbytes > 0); -#else - { - ulong bytes = size * length; - const void *buf = map_sysmem(addr, bytes); + bytes = size * length; + buf = map_sysmem(addr, bytes); - /* Print the lines. */ - print_buffer(addr, buf, size, length, DISP_LINE_LEN / size); - addr += bytes; - unmap_sysmem(buf); - } -#endif + /* Print the lines. */ + print_buffer(addr, buf, size, length, DISP_LINE_LEN / size); + addr += bytes; + unmap_sysmem(buf); dp_last_addr = addr; dp_last_length = length; @@ -286,13 +253,6 @@ static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) count = simple_strtoul(argv[3], NULL, 16); -#ifdef CONFIG_HAS_DATAFLASH - if (addr_dataflash(addr1) | addr_dataflash(addr2)){ - puts ("Comparison with DataFlash space not supported.\n\r"); - return 0; - } -#endif - bytes = size * count; base = buf1 = map_sysmem(addr1, bytes); buf2 = map_sysmem(addr2, bytes); @@ -370,11 +330,7 @@ static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #ifdef CONFIG_MTD_NOR_FLASH /* check if we are copying to Flash */ - if ( (addr2info(dest) != NULL) -#ifdef CONFIG_HAS_DATAFLASH - && (!addr_dataflash(dest)) -#endif - ) { + if (addr2info(dest) != NULL) { int rc; puts ("Copy to Flash... "); @@ -389,44 +345,6 @@ static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const 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; - - puts ("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) -#ifdef CONFIG_MTD_NOR_FLASH - && (addr2info(dest) == NULL) -#endif - ){ - int rc; - rc = read_dataflash(addr, count * size, (char *) dest); - if (rc != 1) { - dataflash_perror (rc); - return (1); - } - return 0; - } - - if (addr_dataflash(addr) && addr_dataflash(dest)){ - puts ("Unsupported combination of source/destination.\n\r"); - return 1; - } -#endif - memcpy((void *)dest, (void *)addr, count * size); return 0; @@ -1072,13 +990,6 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[]) addr += base_address; } -#ifdef CONFIG_HAS_DATAFLASH - if (addr_dataflash(addr)){ - puts ("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. */