---
 common/Makefile                |  1 +
 common/cmd_a20_nandread.c      | 26 ++++++++++++++++++++++++++
 include/configs/sunxi-common.h |  2 ++
 3 files changed, 29 insertions(+)
 create mode 100644 common/cmd_a20_nandread.c

diff --git a/common/Makefile b/common/Makefile
index cecd81a..c65dd50 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -125,6 +125,7 @@ obj-$(CONFIG_CMD_MMC) += cmd_mmc.o
 obj-$(CONFIG_CMD_MMC_SPI) += cmd_mmc_spi.o
 obj-$(CONFIG_MP) += cmd_mp.o
 obj-$(CONFIG_CMD_MTDPARTS) += cmd_mtdparts.o
+obj-$(CONFIG_CMD_A20_NANDREAD) += cmd_a20_nandread.o
 obj-$(CONFIG_CMD_NAND) += cmd_nand.o
 obj-$(CONFIG_CMD_NET) += cmd_net.o
 obj-$(CONFIG_CMD_ONENAND) += cmd_onenand.o
diff --git a/common/cmd_a20_nandread.c b/common/cmd_a20_nandread.c
new file mode 100644
index 0000000..e975d64
--- /dev/null
+++ b/common/cmd_a20_nandread.c
@@ -0,0 +1,26 @@
+#include <common.h>
+#include <command.h>
+
+int nand_spl_load_image(uint32_t offs, unsigned int size, void *dest) ;
+
+static int do_a20_nandread(cmd_tbl_t *cmdtp, int flag, int argc, char * const 
argv[])
+{
+        if (argc != 4) {
+                printf("usage: a20_nandread <address> <offset> <bytes>\n");
+                return 1;
+        }
+
+        uint32_t dst = simple_strtoul (argv[1], NULL, 16);
+        uint32_t src = simple_strtoul (argv[2], NULL, 16);
+        uint32_t cnt = simple_strtoul (argv[3], NULL, 16);
+        printf("Loading 0x%08XB @ 0x%08X -> 0x%08X: ", cnt, src, dst);
+        nand_spl_load_image(src, cnt, (void *)dst);
+        return 0;
+}
+
+U_BOOT_CMD(
+        a20_nandread,   CONFIG_SYS_MAXARGS,     3,      do_a20_nandread,
+        "a20_nandread",
+        "[offset size bytes]\n"
+        "   "
+);
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index c017909..aaf8ddc 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -76,6 +76,8 @@
 #define CONFIG_SYS_NAND_U_BOOT_OFFS             0x008000
 #define CONFIG_SYS_NAND_U_BOOT_BACKUP_OFFS      0x208000
 #define CONFIG_SYS_NAND_PAGE_SIZE               0x002000        /* 8kb*/
+
+#define CONFIG_CMD_A20_NANDREAD
 /* ~ Nand config */
 
 #define CONFIG_CMD_MEMORY
-- 
2.2.1

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to