/* bufcopy: copy content of a NOR flash into SDRAM through SRAM buffer  */
int do_bufcopy(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
/* bufcopy: copy content of a NOR flash into SDRAM through SRAM buffer  */
int do_bufcopy(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
	ulong dst;
	ulong src;
	ulong size;
	int ret = 0;
	if (argc != 4) {
		printf("%s: dst src size\n", (char *) argv[0]);
		goto Done;
	}
	dst = simple_strtoul(argv[1], NULL, 16);
	src = simple_strtoul(argv[2], NULL, 16);
	size = simple_strtoul(argv[3], NULL, 16);
	if (dst < CONFIG_SYS_RAM_BASE) {
		printf("%s: dst is outside SDRAM\n", (char *) argv[0]);
		goto Done;
	}
	if ((ret = nor_sdram_bufcopy(dst, src, size)) < 0) {
		printf("%s: nor_sdram_bufcopy failed: %d\n",
						(char *) argv[0], ret);
		goto Done;
	}
Done:
	return ret;
}