diff mbox

[U-Boot,3/4] sunxi: nand: Add a20_nandread command to load image from NAND in SPL

Message ID 1437045915-25755-4-git-send-email-pzierhoffer@antmicro.com
State Superseded
Delegated to: Hans de Goede
Headers show

Commit Message

Piotr Zierhoffer July 16, 2015, 11:25 a.m. UTC
From: Piotr Zierhoffer <piotr.zierhoffer@cs.put.poznan.pl>

The usage of the command is:

a20_nandread <address> <offset> <bytes>

It allows user to copy data from NAND to memory. It employs
nand_spl_load_image from the sunxi NAND driver.

It is added only when the NAND support is enabled.

Signed-off-by: Peter Gielda <pgielda@antmicro.com>
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
Signed-off-by: Piotr Zierhoffer <pzierhoffer@antmicro.com>
---

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

Comments

Scott Wood July 16, 2015, 9:20 p.m. UTC | #1
On Thu, 2015-07-16 at 13:25 +0200, Piotr Zierhoffer wrote:
> From: Piotr Zierhoffer <piotr.zierhoffer@cs.put.poznan.pl>
> 
> The usage of the command is:
> 
> a20_nandread <address> <offset> <bytes>
> 
> It allows user to copy data from NAND to memory. It employs
> nand_spl_load_image from the sunxi NAND driver.
> 
> It is added only when the NAND support is enabled.

Please respond to the comments received when it was posted at 
http://patchwork.ozlabs.org/patch/466149/

> Signed-off-by: Peter Gielda <pgielda@antmicro.com>
> Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
> Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
> Signed-off-by: Piotr Zierhoffer <pzierhoffer@antmicro.com>

Why does the same code now have a completely different author and sign-off 
chain?

-Scott
Piotr Zierhoffer July 17, 2015, 2:25 p.m. UTC | #2
Hello

2015-07-16 23:20 GMT+02:00 Scott Wood <scottwood@freescale.com>:
> On Thu, 2015-07-16 at 13:25 +0200, Piotr Zierhoffer wrote:
>> Signed-off-by: Peter Gielda <pgielda@antmicro.com>
>> Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
>> Signed-off-by: Mateusz Holenko <mholenko@antmicro.com>
>> Signed-off-by: Piotr Zierhoffer <pzierhoffer@antmicro.com>
>
> Why does the same code now have a completely different author and sign-off
> chain?
>
> -Scott

This code had a wrong copyright/Signed-off-by chain, and was reverted
in da9971d1b3bdb554d4a4ac948119f8b2616bbcce.

I am going to resubmit a v2 patch set without this command.

Best regards

Piotr Zierhoffer
Antmicro Ltd | www.antmicro.com
diff mbox

Patch

diff --git a/common/Makefile b/common/Makefile
index d6c1d48..ef31646 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -126,6 +126,7 @@  obj-$(CONFIG_ID_EEPROM) += cmd_mac.o
 obj-$(CONFIG_CMD_MD5SUM) += cmd_md5sum.o
 obj-$(CONFIG_CMD_MEMORY) += cmd_mem.o
 obj-$(CONFIG_CMD_IO) += cmd_io.o
+obj-$(CONFIG_CMD_A20_NANDREAD) += cmd_a20_nandread.o
 obj-$(CONFIG_CMD_MFSL) += cmd_mfsl.o
 obj-$(CONFIG_MII) += miiphyutil.o
 obj-$(CONFIG_CMD_MII) += miiphyutil.o
diff --git a/common/cmd_a20_nandread.c b/common/cmd_a20_nandread.c
new file mode 100644
index 0000000..6469535
--- /dev/null
+++ b/common/cmd_a20_nandread.c
@@ -0,0 +1,25 @@ 
+#include <common.h>
+#include <command.h>
+#include <nand.h>
+
+static int do_a20_nandread(cmd_tbl_t *cmdtp, int flag, int argc,
+		char * const argv[])
+{
+	if (argc != 4) {
+		printf("usage: a20_nandread <destination> <source> <size>\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("Reading 0x%08X bytes from NAND @ 0x%08X to MEM @ 0x%08X...\n",
+	       cnt, src, dst);
+	nand_spl_load_image(src, cnt, (void *)dst);
+	printf("\n");
+	return 0;
+}
+
+U_BOOT_CMD(a20_nandread, CONFIG_SYS_MAXARGS, 3,
+	   do_a20_nandread, "a20_nandread", "[destination source size]\n" "   "
+);
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 83922ab..e9cfa9a 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -148,6 +148,8 @@ 
 #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x008000
 #define CONFIG_SYS_NAND_PAGE_SIZE 0x002000 /* 8kb*/
 #define CONFIG_SUNXI_ECC_STRENGTH 40
+
+#define CONFIG_CMD_A20_NANDREAD
 #endif
 
 /* mmc config */