Skip to contentSkip to conversation

Fix onenand command after ARM relocation changes.

PATCH New Enric Balletbo i Serra 5 participants 9 messages Oct 19, 2010 – Oct 27, 2010 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

cover Fix onenand command after ARM relocation changes.

Hello,

After ARM relocation support the onenand command seems broken, these patches attempt to solve this issue.

The first patch fixes the usage help for onenand command when no arguments are passed.

The second patch relocate the onenand command table manually, I think this is required after relocation changes but I'm not sure if this is the best solution, so comments are welcome.

Tested on IGEP v2 and OMAP3 IGEP module boards.

Cheers,
Enric

$ git diff --stat origin/master
 arch/arm/lib/board.c |    3 +++
 common/cmd_onenand.c |    9 +++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)
#1 lore raw

PATCH 1/2 cmd_onenand.c: Fix command usage help.

Running the onenand command without arguments does nothing, with this patch shows the command usage.

---
 common/cmd_onenand.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
common/cmd_onenand.c +3 -0
index 83d967b..317968f 100644
@@ -529,6 +529,9 @@ static int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]
 {
 	cmd_tbl_t *c;
 
+	if (argc < 2)
+		return cmd_usage(cmdtp);
+
 	mtd = &onenand_mtd;
 
 	/* Strip off leading 'onenand' command argument */
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 1/2 cmd_onenand.c: Fix command usage help.

Dear Enric Balletbo i Serra,

Quoted 7 lines · In message <[email protected]> you wrote:

Running the onenand command without arguments does nothing, with this patch shows the command usage.

---
 common/cmd_onenand.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
This all sounds complicated, but it mostly does excatly what you  ex-
pect. It's just difficult for us to explain what you expect...
                       - L. Wall & R. L. Schwartz, _Programming Perl_
#3 lore raw

PATCH 2/2 ARM: fix relocation support for onenand device.

In reply to Enric Balletbo i Serra

We also have to relocate the onenand command table manually, otherwise onenand command don't work.

---
 arch/arm/lib/board.c |    3 +++
 common/cmd_onenand.c |    6 ++++++
 2 files changed, 9 insertions(+), 0 deletions(-)
arch/arm/lib/board.c +3 -0
index 108e6c4..8a981e9 100644
@@ -715,6 +715,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #if defined(CONFIG_CMD_I2C)
 	i2c_reloc();
 #endif
+#if defined(CONFIG_CMD_ONENAND)
+	onenand_reloc();
+#endif
 #endif /* !defined(CONFIG_RELOC_FIXUP_WORKS) */
 
 #ifdef CONFIG_LOGBUFFER
common/cmd_onenand.c +6 -0
index 317968f..5550b40 100644
@@ -525,6 +525,12 @@ static cmd_tbl_t cmd_onenand_sub[] = {
 	U_BOOT_CMD_MKENT(markbad, CONFIG_SYS_MAXARGS, 0, do_onenand_markbad, "", ""),
 };
 
+#ifndef CONFIG_RELOC_FIXUP_WORKS
+void onenand_reloc(void) {
+	fixup_cmdtable(cmd_onenand_sub, ARRAY_SIZE(cmd_onenand_sub));
+}
+#endif
+
 static int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 {
 	cmd_tbl_t *c;
Signature · 1 line
1.7.0.4
#4 lore raw

PATCH 2/2 ARM: fix relocation support for onenand device.

Hello Enric,

Quoted 8 lines · Enric Balletbo i Serra

We also have to relocate the onenand command table manually, otherwise onenand command don't work.

---
 arch/arm/lib/board.c |    3 +++
 common/cmd_onenand.c |    6 ++++++
 2 files changed, 9 insertions(+), 0 deletions(-)

Could you try

git://git.denx.de/u-boot-arm.git elf_reloc

branch? With this branch, it is not longer necessary to do such fixups.

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#5 lore raw

PATCH 2/2 ARM: fix relocation support for onenand device.

Hello Heiko,

2010/10/19 Heiko Schocher <[email protected]>:

Quoted 12 lines

Hello Enric,

Quoted 8 lines · Enric Balletbo i Serra

We also have to relocate the onenand command table manually, otherwise onenand command don't work.

---
?arch/arm/lib/board.c | ? ?3 +++
?common/cmd_onenand.c | ? ?6 ++++++
?2 files changed, 9 insertions(+), 0 deletions(-)

Quoted 5 lines

Could you try

git://git.denx.de/u-boot-arm.git elf_reloc

branch?

Of course :-)

Quoted 1 line

With this branch, it is not longer necessary to do such fixups.

Here my tests:

U-Boot # onenand erase
OneNAND erase: whole chip
OK

Yes, seems the patch 2/2 it's not longer necessary, the onenand command works without this patch.

U-Boot # onenand
(hang)

I think the patch 1/2 it's also necessary, otherwise the onenand command without arguments hangs.

Cheers,
Enric

#6 lore raw

PATCH 2/2 ARM: fix relocation support for onenand device.

In reply to Enric Balletbo i Serra

Dear Enric Balletbo i Serra,

Quoted 8 lines · In message <[email protected]> you wrote:

We also have to relocate the onenand command table manually, otherwise onenand command don't work.

---
 arch/arm/lib/board.c |    3 +++
 common/cmd_onenand.c |    6 ++++++
 2 files changed, 9 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Every solution breeds new problems.
#7 lore raw

PATCH 2/2 ARM: fix relocation support for onenand device.

Quoted 11 lines · Wolfgang Denk

Dear Enric Balletbo i Serra,

Quoted 8 lines · In message<[email protected]> you wrote:

We also have to relocate the onenand command table manually, otherwise onenand command don't work.

---
  arch/arm/lib/board.c |    3 +++
  common/cmd_onenand.c |    6 ++++++
  2 files changed, 9 insertions(+), 0 deletions(-)

Is this patch still necessary? I thought the relocation change made it OBE.

Best Regards,
Bill Campbell

Quoted 6 lines

Applied, thanks.

Best regards,

Wolfgang Denk

#8 lore raw

PATCH 2/2 ARM: fix relocation support for onenand device.

Hello,

2010/10/24 J. William Campbell <[email protected]>:

Quoted 7 lines · Wolfgang Denk
Quoted 6 lines

Dear Enric Balletbo i Serra,

Quoted 3 lines · In message<[email protected]> ?you wrote:

We also have to relocate the onenand command table manually, otherwise onenand command don't work.

Quoted 7 lines
Quoted 5 lines
Quoted 5 lines

---
? arch/arm/lib/board.c | ? ?3 +++
? common/cmd_onenand.c | ? ?6 ++++++
? 2 files changed, 9 insertions(+), 0 deletions(-)

Is this patch still necessary? I thought the relocation change made it OBE.

As I reply to Heiko this patch [2/2] it's not necessary if elf_reloc branch is merged. OTOH I think the patch [1/2] of the same series it's necessary.

[PATCH 1/2] cmd_onenand.c: Fix command usage help.

Cheers,
Enric