Skip to contentSkip to conversation

OneNAND support

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

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 5/5 OneNAND support

[PATCH] OneNAND support

---

include/config_cmd_all.h +1 -0
index 3d91e99..f8eca87 100644
@@ -59,6 +59,7 @@
 #define CONFIG_CMD_NAND		/* NAND support			*/
 #define CONFIG_CMD_NET		/* bootp, tftpboot, rarpboot	*/
 #define CONFIG_CMD_NFS		/* NFS support			*/
+#define CONFIG_CMD_ONENAND	/* OneNAND support		*/
 #define CONFIG_CMD_PCI		/* pciinfo			*/
 #define CONFIG_CMD_PCMCIA	/* PCMCIA support		*/
 #define CONFIG_CMD_PING		/* ping support			*/
include/linux/mtd/bbm.h new file +127 -0

127 lines not on this page · raw message

include/linux/mtd/onenand.h new file +143 -0

143 lines not on this page · raw message

include/linux/mtd/onenand_regs.h new file +181 -0

181 lines not on this page · raw message

include/onenand_uboot.h new file +114 -0

114 lines not on this page · raw message

lib_arm/board.c +8 -0
index d37e5da..b1c89ea 100644
@@ -58,6 +58,10 @@ DECLARE_GLOBAL_DATA_PTR;
 void nand_init (void);
 #endif
 
+#if defined(CONFIG_CMD_ONENAND)
+void onenand_init(void);
+#endif
+
 ulong monitor_flash_len;
 
 #ifdef CONFIG_HAS_DATAFLASH
@@ -301,6 +305,10 @@ void start_armboot (void)
 	nand_init();		/* go init the NAND */
 #endif
 
+#if defined(CONFIG_CMD_ONENAND)
+	onenand_init();
+#endif
+
 #ifdef CONFIG_HAS_DATAFLASH
 	AT91F_DataflashInit();
 	dataflash_print_info();
#1 lore raw

PATCH 5/5 OneNAND support

include/config_cmd_all.h line 62

Quoted 13 lines · In message <20070907010137.GA20130@party> you wrote:

[PATCH] OneNAND support

---

include/config_cmd_all.h +1 -0
index 3d91e99..f8eca87 100644
@@ -59,6 +59,7 @@
 #define CONFIG_CMD_NAND		/* NAND support			*/
 #define CONFIG_CMD_NET		/* bootp, tftpboot, rarpboot	*/
 #define CONFIG_CMD_NFS		/* NFS support			*/
+#define CONFIG_CMD_ONENAND	/* OneNAND support		*/

NAK.

CONFIG_CMD_ONENAND is definitely NOT a candiate for config_cmd_all.h

Quoted 1 line
include/config_cmd_all.h +1 -0
+++ b/include/onenand_uboot.h

...

Quoted 1 line

+#define DEBUG_LEVEL 2

This should probably be 0 for production code?

include/config_cmd_all.h

Quoted 10 lines
include/config_cmd_all.h +10 -0
+#ifdef ONENAND_DEBUG
+#define DEBUG(level, args...)						\
+do {									\
+	if (level <= DEBUG_LEVEL) {					\
+		printf(args);						\
+	}								\
+} while (0)
+#else
+#define DEBUG(level, args...)		do { } while (0)
+#endif

Please do not reinvent yoru own debug macros, please use the existing ones instead.

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
"The X11 source code style is ATROCIOUS and should not be used  as  a
model."                                                   - Doug Gwyn
#2 lore raw

PATCH 5/5 OneNAND support

Quoted 12 lines

include/config_cmd_all.h line 62

Quoted 9 lines
include/config_cmd_all.h +1 -0
index 3d91e99..f8eca87 100644
@@ -59,6 +59,7 @@
 #define CONFIG_CMD_NAND		/* NAND support			*/
 #define CONFIG_CMD_NET		/* bootp, tftpboot, rarpboot	*/
 #define CONFIG_CMD_NFS		/* NFS support			*/
+#define CONFIG_CMD_ONENAND	/* OneNAND support		*/

NAK.

Quoted 1 line

CONFIG_CMD_ONENAND is definitely NOT a candiate for config_cmd_all.h

No problem.
I just add it as comments in "config_cmd_all" file. "Alphabetical list of all possible commands."

Quoted 8 lines
Quoted 3 lines
include/config_cmd_all.h +1 -0
+++ b/include/onenand_uboot.h

...

Quoted 1 line

+#define DEBUG_LEVEL 2

This should probably be 0 for production code?

Quoted 14 lines

include/config_cmd_all.h

Quoted 10 lines
include/config_cmd_all.h +10 -0
+#ifdef ONENAND_DEBUG
+#define DEBUG(level, args...)						\
+do {									\
+	if (level <= DEBUG_LEVEL) {					\
+		printf(args);						\
+	}								\
+} while (0)
+#else
+#define DEBUG(level, args...)		do { } while (0)
+#endif

Please do not reinvent yoru own debug macros, please use the existing ones instead.

After new NAND implementation, there are required macro and filed. I added <linux/mtd/compat.h> and <linux/mtd/mtd.h> headers at required files

Others such as spinlock, wait_queue_head_t are typedef-ed. In NAND case, it disabled it by "if 0".
And kvec also will be removed at next code update.

Thank you,
Kyungmin Park

#ifndef __UBOOT_ONENAND_H
#define __UBOOT_ONENAND_H

struct kvec {
        void *iov_base;
        size_t iov_len;
};

typedef int spinlock_t;
typedef int wait_queue_head_t;

/* Functions */
extern void onenand_init(void);
extern int onenand_read(struct mtd_info *mtd, loff_t from, size_t len,

                        size_t * retlen, u_char * buf);
extern int onenand_read_oob(struct mtd_info *mtd, loff_t from, size_t len,
                            size_t * retlen, u_char * buf);
extern int onenand_write(struct mtd_info *mtd, loff_t from, size_t len,
                         size_t * retlen, const u_char * buf);

extern int onenand_erase(struct mtd_info *mtd, struct erase_info *instr);

extern int onenand_unlock(struct mtd_info *mtd, loff_t ofs, size_t len);

extern void onenand_print_device_info(int device, int verbose);

#endif /* __UBOOT_ONENAND_H */

#3 lore raw

PATCH 5/5 OneNAND support

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

CONFIG_CMD_ONENAND is definitely NOT a candiate for config_cmd_all.h

No problem.
I just add it as comments in "config_cmd_all" file. "Alphabetical list of all possible commands."

Sorry. Iwas totally wrong here - I confused this with include/config_cmd_default.h where it really doe snot belong, but you did not try adding it there.

Of course you were right - it should be added to
include/config_cmd_all.h

Please leave this part as is, and excuse my confusion.

Quoted 17 lines
Quoted 16 lines

This should probably be 0 for production code?

include/onenand_uboot.h line 42

Quoted 10 lines
include/onenand_uboot.h new file +10 -0
+#ifdef ONENAND_DEBUG
+#define DEBUG(level, args...)						\
+do {									\
+	if (level <= DEBUG_LEVEL) {					\
+		printf(args);						\
+	}								\
+} while (0)
+#else
+#define DEBUG(level, args...)		do { } while (0)
+#endif

Please do not reinvent yoru own debug macros, please use the existing ones instead.

Quoted 6 lines

After new NAND implementation, there are required macro and filed. I added <linux/mtd/compat.h> and <linux/mtd/mtd.h> headers at required files

Others such as spinlock, wait_queue_head_t are typedef-ed. In NAND case, it disabled it by "if 0".
And kvec also will be removed at next code update.

I still think you should NOT redefine DEBUG but instead use the existing definitions for debug() resp. debugX(); please see include/common.h

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
Man is the best computer we can put aboard a spacecraft ...  and  the
only one that can be mass produced with unskilled labor.
                                                  - Wernher von Braun
#4 lore raw

PATCH 5/5 OneNAND support

Quoted 21 lines
Quoted 21 lines
Quoted 17 lines

This should probably be 0 for production code?

include/onenand_uboot.h line 42

Quoted 10 lines
include/onenand_uboot.h new file +10 -0
+#ifdef ONENAND_DEBUG
+#define DEBUG(level, args...)						\
+do {									\
+	if (level <= DEBUG_LEVEL) {					\
+		printf(args);						\
+	}								\
+} while (0)
+#else
+#define DEBUG(level, args...)		do { } while (0)
+#endif

Please do not reinvent yoru own debug macros, please use the existing ones instead.

After new NAND implementation, there are required macro and filed. I added <linux/mtd/compat.h> and <linux/mtd/mtd.h> headers at required files

Quoted 7 lines
Quoted 3 lines

Others such as spinlock, wait_queue_head_t are typedef-ed. In NAND case, it disabled it by "if 0".
And kvec also will be removed at next code update.

I still think you should NOT redefine DEBUG but instead use the existing definitions for debug() resp. debugX(); please see include/common.h

Yes, I *don't* redefine the DEBUG. Now it used DEBUG macro at linux/mtd/mtd.h

Thank you,
Kyungmin Park

#5 lore raw

PATCH 5/5 OneNAND support

Quoted 6 lines · In message <[email protected]> you…
Quoted 4 lines

I still think you should NOT redefine DEBUG but instead use the existing definitions for debug() resp. debugX(); please see include/common.h

Yes, I *don't* redefine the DEBUG. Now it used DEBUG macro at linux/mtd/mtd.h

So linux/mtd/mtd.h redefines it. We should get rid of this, too. Later.

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
He who hesitates is not only lost, but miles from the next exit.