Skip to contentSkip to conversation

OneNAND support

PATCH New Kyungmin Park 2 participants 4 messages Sep 7, 2007 – Sep 10, 2007 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 OneNAND support

[PATCH] OneNAND support

This patch enables the OneNAND at U-boot

---

Makefile +1 -0
index 0477cd3..d42f2ef 100644
@@ -211,6 +211,7 @@ LIBS += drivers/libdrivers.a
 LIBS += drivers/bios_emulator/libatibiosemu.a
 LIBS += drivers/nand/libnand.a
 LIBS += drivers/nand_legacy/libnand_legacy.a
+LIBS += drivers/onenand/libonenand.a
 LIBS += drivers/net/libnet.a
 ifeq ($(CPU),mpc83xx)
 LIBS += drivers/qe/qe.a
common/Makefile +2 -1
index ef7d097..fde5ad9 100644
@@ -37,13 +37,14 @@ COBJS	= main.o ACEX1K.o altera.o bedbug.o circbuf.o cmd_autoscript.o \
 	  cmd_load.o cmd_log.o \
 	  cmd_mem.o cmd_mii.o cmd_misc.o cmd_mmc.o \
 	  cmd_nand.o cmd_net.o cmd_nvedit.o \
+	  cmd_onenand.o \
 	  cmd_pci.o cmd_pcmcia.o cmd_portio.o \
 	  cmd_reginfo.o cmd_reiser.o cmd_sata.o cmd_scsi.o cmd_spi.o \
 	  cmd_universe.o cmd_usb.o cmd_vfd.o \
 	  command.o console.o cyclon2.o devices.o dlmalloc.o docecc.o \
 	  environment.o env_common.o \
 	  env_nand.o env_dataflash.o env_flash.o env_eeprom.o \
-	  env_nvram.o env_nowhere.o \
+	  env_onenand.o env_nvram.o env_nowhere.o \
 	  exports.o \
 	  fdt_support.o flash.o fpga.o ft_build.o \
 	  hush.o kgdb.o lcd.o lists.o lynxkdi.o \
common/cmd_nvedit.c +6 -3
index 1db0fc3..6770408 100644
@@ -57,8 +57,9 @@ DECLARE_GLOBAL_DATA_PTR;
     !defined(CFG_ENV_IS_IN_FLASH)	&& \
     !defined(CFG_ENV_IS_IN_DATAFLASH)	&& \
     !defined(CFG_ENV_IS_IN_NAND)	&& \
+    !defined(CFG_ENV_IS_IN_ONENAND)	&& \
     !defined(CFG_ENV_IS_NOWHERE)
-# error Define one of CFG_ENV_IS_IN_{NVRAM|EEPROM|FLASH|DATAFLASH|NOWHERE}
+# error Define one of CFG_ENV_IS_IN_{NVRAM|EEPROM|FLASH|DATAFLASH|ONENAND|NOWHERE}
 #endif
 
 #define XMK_STR(x)	#x
@@ -553,7 +554,8 @@ int getenv_r (char *name, char *buf, unsigned len)
 
 #if defined(CFG_ENV_IS_IN_NVRAM) || defined(CFG_ENV_IS_IN_EEPROM) \
     || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_FLASH)) \
-    || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND))
+    || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND)) \
+    || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_ONENAND))
 int do_saveenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	extern char * env_name_spec;
@@ -608,7 +610,8 @@ U_BOOT_CMD(
 
 #if defined(CFG_ENV_IS_IN_NVRAM) || defined(CFG_ENV_IS_IN_EEPROM) \
     || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_FLASH)) \
-    || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND))
+    || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND)) \
+    || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_ONENAND))
 U_BOOT_CMD(
 	saveenv, 1, 0,	do_saveenv,
 	"saveenv - save environment variables to persistent storage\n",
common/cmd_onenand.c new file +201 -0

201 lines not on this page · raw message

common/env_onenand.c new file +133 -0

133 lines not on this page · raw message

#1 lore raw

PATCH 1/5 OneNAND support

Quoted 3 lines · In message <20070907005723.GA19727@party> you wrote:

[PATCH] OneNAND support

This patch enables the OneNAND at U-boot

I cannot comment much on this code as I have no access to any hardware with such a device, but here are a few formal comments:

common/cmd_onenand.c line 197

Quoted 9 lines
common/cmd_onenand.c new file +9 -0
+U_BOOT_CMD (onenand, 6, 1, do_onenand,
+	    "onenand - OneNAND sub-system\n",
+	    "info   - show available OneNAND devices\n"
+	    "onenand read[.oob] addr ofs len - read data at ofs with len to addr\n"
+	    "onenand write addr ofs len - write data at ofs with len from addr\n"
+	    "onenand erase block start-end - erase block from start to end\n"
+	    "onenand erase saddr eaddr - erase block start addr to end addr\n"
+	    "onenand block[.oob] addr block [page] [len] - "
+	    "read data with (block [, page]) to addr\n"

This line is probably missing some additional indentation?

common/cmd_onenand.c line 199

Quoted 2 lines
common/cmd_onenand.c new file +2 -0
+	    "onenand unlock start-end - unlock block from start to end\n"
+	    "onenand save bootloader addr - save bootloader at addr\n");

I'm not happy with the parameter format of the "erase" and "unlock" commands - using an address specification of "start-end" breaks existing conventions in U-Boot. Please use two separate arguments instead.

Also, I don;t see what the difference between "erase block" and "erase" is - can we avoid "erase block" all together? If not, I recommend to change it into "eraseblock" (which could then be shortened to "eraseb") to avoid too different command formats.

After changing this, you have my ACK.

Thanks a lot.

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
In the beginning there was nothing.
And the Lord said "Let There Be Light!"
And still there was nothing, but at least now you could see it.
#2 lore raw

PATCH 1/5 OneNAND support

Quoted 4 lines
Quoted 1 line

This patch enables the OneNAND at U-boot

I cannot comment much on this code as I have no access to any hardware with such a device, but here are a few formal comments:

After committing the OneNAND patch, I will post the Apollon board patches which uses the OneNAND.

Quoted 12 lines

common/cmd_onenand.c line 197

Quoted 10 lines
common/cmd_onenand.c new file +9 -0
+U_BOOT_CMD (onenand, 6, 1, do_onenand,
+	    "onenand - OneNAND sub-system\n",
+	    "info   - show available OneNAND devices\n"
+	    "onenand read[.oob] addr ofs len - read data at ofs with len to addr\n"
+	    "onenand write addr ofs len - write data at ofs with len from addr\n"
+	    "onenand erase block start-end - erase block from start to end\n"
+	    "onenand erase saddr eaddr - erase block start addr to end addr\n"
+	    "onenand block[.oob] addr block [page] [len] - "
+	    "read data with (block [, page]) to addr\n"

This line is probably missing some additional indentation?

Yes, I add the tap indentation as nand does

Quoted 9 lines

common/cmd_onenand.c line 199

Quoted 3 lines
common/cmd_onenand.c new file +2 -0
+	    "onenand unlock start-end - unlock block from start to end\n"
+	    "onenand save bootloader addr - save bootloader at addr\n");

I'm not happy with the parameter format of the "erase" and "unlock" commands - using an address specification of "start-end" breaks existing conventions in U-Boot. Please use two separate arguments instead.

Quoted 5 lines

Also, I don;t see what the difference between "erase block" and "erase" is - can we avoid "erase block" all together? If not, I recommend to change it into "eraseblock" (which could then be shortened to "eraseb") to avoid too different command formats.

At code writing time, there are no strict rules to use address scheme, block scheme. No problem, which one is used. Now temporally I removed it

Thank you,
Kyungmin Park

P.S. Now I just send the modified parts, after full comments, I will send it at once.

+U_BOOT_CMD(
+ onenand, 6, 1, do_onenand,
+ "onenand - OneNAND sub-system\n",
+ "info - show available OneNAND devices\n"
+ "onenand read[.oob] addr ofs len - read data at ofs with len to addr\n"
+ "onenand write addr ofs len - write data at ofs with len from addr\n"
+ "onenand erase saddr eaddr - erase block start addr to end addr\n"
+ "onenand block[.oob] addr block [page] [len] - "
+ "read data with (block [, page]) to addr\n"
+);

#3 lore raw

PATCH 1/5 OneNAND support

Hello,

Quoted 2 lines · in message <[email protected]> you…

P.S. Now I just send the modified parts, after full comments, I will send it at once.

OK - thanks!

common/cmd_onenand.c line 197

Quoted 9 lines
common/cmd_onenand.c new file +9 -0
+U_BOOT_CMD(
+	onenand,	6,	1,	do_onenand,
+	"onenand - OneNAND sub-system\n",
+	"info   - show available OneNAND devices\n"
+	"onenand read[.oob] addr ofs len - read data at ofs with len to addr\n"
+	"onenand write addr ofs len - write data at ofs with len from addr\n"
+	"onenand erase saddr eaddr - erase block start addr to end addr\n"
+	"onenand block[.oob] addr block [page] [len] - "
+	"read data with (block [, page]) to addr\n"

Sorry for the nitpicking, but I recommend to make this:

common/cmd_onenand.c line 197

Quoted 3 lines
common/cmd_onenand.c new file +3 -0
+	"onenand erase saddr eaddr - erase block start addr to end addr\n"
+	"onenand block[.oob] addr block [page] [len] - "
+		"read data with (block [, page]) to addr\n"

so it's clearly visible what that will look like. You may even use an explicit continuation mark (trailing backslash) on the line before, even though it's not necessary - just as a reminder for the reader.

Best regards,

Wolfgang Denk

Signature · 5 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
Unsichtbar macht sich die Dummheit, indem sie immer  gr??ere  Ausma?e
annimmt.                             -- Bertold Brecht: Der Tui-Roman