Skip to contentSkip to conversation

KB9202: Add NAND support

PATCH Superseded Matthias Kaehlcke 5 participants 21 messages May 15, 2009 – Aug 6, 2009

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

PATCH 2/2 KB9202: Add NAND support

KB9202: Add NAND support

This is a forward port of the patch submitted by Christian from Kwikbyte in 06/2007
(http://lists.denx.de/pipermail/u-boot/2007-June/022068.html)

--

board/kb9202/Makefile +1 -1
@@ -28,7 +28,7 @@
 
 LIB	= $(obj)lib$(BOARD).a
 
-COBJS	:= kb9202.o
+COBJS	:= kb9202.o nand.o
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
board/kb9202/nand.c new file +158 -0

158 lines not on this page · raw message

include/configs/kb9202.h +13 -1
@@ -62,6 +62,11 @@
 #ifdef CONFIG_KB9202B
 #define	CONFIG_BOOTARGS	"console=ttyS0,115200 noinitrd root=/dev/mtdblock0 rootfstype=jffs2 mem=64M"
 #define	CONFIG_BOOTCOMMAND	"bootm 0x10000000"
+#define NAND_MAX_CHIPS 1
+#define CONFIG_SYS_MAX_NAND_DEVICE 1
+#define CONFIG_SYS_NAND_BASE 0x40000000
+#define CONFIG_JFFS2_NAND
+#define CONFIG_JFFS2_CMDLINE
 #endif
 
 
@@ -71,7 +76,7 @@
 /*
  * Size of malloc() pool
  */
-#define CONFIG_SYS_MALLOC_LEN	(128*1024)
+#define CONFIG_SYS_MALLOC_LEN (1024*1024)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* size in bytes reserved for initial data */
 
 #define CONFIG_BAUDRATE 115200
@@ -111,6 +116,9 @@
 #define CONFIG_CMD_EEPROM
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DHCP
+#ifdef CONFIG_KB9202B
+#define CONFIG_CMD_NAND
+#endif
 #define CONFIG_CMD_JFFS2
 
 #undef CONFIG_CMD_BDI
@@ -140,7 +148,11 @@
 #define PHYS_FLASH_SIZE			0x200000
 #endif
 
+#ifdef CONFIG_KB9202B_ATL
+#define CFG_MAX_FLASH_BANKS    0
+#else
 #define CONFIG_SYS_MAX_FLASH_BANKS		1
+#endif
 #define CONFIG_SYS_MAX_FLASH_SECT		256
 
 #define	CONFIG_HARD_I2C
Signature · 10 lines
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona

      El trabajo es el refugio de los que no tienen nada que hacer
                            (Oscar Wilde)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
#1 lore raw

PATCH 2/2 KB9202: Add NAND support

board/kb9202/nand.c line 85

Quoted 7 lines · Matthias Kaehlcke
board/kb9202/nand.c new file +7 -0
+/*
+ * Board-specific function to access the device ready signal.
+ */
+static int kb9202_nand_ready(struct mtd_info *mtd)
+{
+	return (((AT91C_BASE_PIOC->PIO_PDSR) & KB9202_NAND_BUSY) != 0);
+}

Use I/O accessors.

Quoted 3 lines
board/kb9202/nand.c new file +3 -0
+int board_nand_init(struct nand_chip *nand)
+{
+	unsigned	value;

[snip]

Quoted 4 lines

board/kb9202/nand.c line 136

Quoted 4 lines
board/kb9202/nand.c new file +4 -0
+	/* enable internal NAND controller */
+	value = *(AT91C_EBI_CSA);
+	value |= AT91C_EBI_CS3A_SMC_SmartMedia;
+	*(AT91C_EBI_CSA) = value;

This is a hardware register. Surely it has a defined width?

board/kb9202/nand.c line 131

Quoted 9 lines
board/kb9202/nand.c new file +9 -0
+	/* setup nand flash access (allow ample margin) */
+	/* 4 wait states, 1 setup, 1 hold, 1 float for 8-bit device */
+	((AT91PS_SMC2)AT91C_BASE_SMC2)->SMC2_CSR[3] =
+		AT91C_SMC2_WSEN |
+		(4 & AT91C_SMC2_NWS) |
+		((1 << 8) & AT91C_SMC2_TDF) |
+		AT91C_SMC2_DBW_8 |
+		((1 << 24) & AT91C_SMC2_RWSETUP) |
+		((1 << 29) & AT91C_SMC2_RWHOLD);

What is AT91PS_SMC2? Please don't hide pointers inside typedefs. Please define symbols to have the proper type in the first place, rather than casting@the point of use.

include/configs/kb9202.h line 153

Quoted 3 lines
include/configs/kb9202.h +3 -0
+#ifdef CONFIG_KB9202B_ATL
+#define CFG_MAX_FLASH_BANKS    0
+#else

Is this really the recommended way of turning off flash support?

-Scott

#2 lore raw

PATCH 2/2 KB9202: Add NAND support

Hi Scott

El Fri, May 15, 2009 at 05:30:48PM -0500 Scott Wood ha dit:

Quoted 36 lines

board/kb9202/nand.c line 85

Quoted 7 lines · Matthias Kaehlcke
board/kb9202/nand.c new file +7 -0
+/*
+ * Board-specific function to access the device ready signal.
+ */
+static int kb9202_nand_ready(struct mtd_info *mtd)
+{
+	return (((AT91C_BASE_PIOC->PIO_PDSR) & KB9202_NAND_BUSY) != 0);
+}

Use I/O accessors.

Quoted 3 lines
board/kb9202/nand.c new file +3 -0
+int board_nand_init(struct nand_chip *nand)
+{
+	unsigned	value;

[snip]

Quoted 4 lines

board/kb9202/nand.c line 136

Quoted 4 lines
board/kb9202/nand.c new file +4 -0
+	/* enable internal NAND controller */
+	value = *(AT91C_EBI_CSA);
+	value |= AT91C_EBI_CS3A_SMC_SmartMedia;
+	*(AT91C_EBI_CSA) = value;

This is a hardware register. Surely it has a defined width?

board/kb9202/nand.c line 131

Quoted 9 lines
board/kb9202/nand.c new file +9 -0
+	/* setup nand flash access (allow ample margin) */
+	/* 4 wait states, 1 setup, 1 hold, 1 float for 8-bit device */
+	((AT91PS_SMC2)AT91C_BASE_SMC2)->SMC2_CSR[3] =
+		AT91C_SMC2_WSEN |
+		(4 & AT91C_SMC2_NWS) |
+		((1 << 8) & AT91C_SMC2_TDF) |
+		AT91C_SMC2_DBW_8 |
+		((1 << 24) & AT91C_SMC2_RWSETUP) |
+		((1 << 29) & AT91C_SMC2_RWHOLD);

What is AT91PS_SMC2? Please don't hide pointers inside typedefs. Please define symbols to have the proper type in the first place, rather than casting at the point of use.

Quoted 5 lines

include/configs/kb9202.h line 153

Quoted 3 lines
include/configs/kb9202.h +3 -0
+#ifdef CONFIG_KB9202B_ATL
+#define CFG_MAX_FLASH_BANKS    0
+#else

Is this really the recommended way of turning off flash support?

thanks for your review and your comments.

i'm new to u-boot development, could you point me to the correct way of turning of flash support? i found this in the original patch provided by kwikbyte and just ported it to the current u-boot version.

Signature · 11 lines
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona

              You can't separate peace from freedom because no
               one can be at peace unless he has his freedom
                              (Malcolm X)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
#3 lore raw

PATCH 2/2 KB9202: Add NAND support

Quoted 10 lines · Matthias Kaehlcke
Quoted 4 lines

include/configs/kb9202.h line 153

Quoted 3 lines
include/configs/kb9202.h +3 -0
+#ifdef CONFIG_KB9202B_ATL
+#define CFG_MAX_FLASH_BANKS    0
+#else

Is this really the recommended way of turning off flash support?

thanks for your review and your comments.

i'm new to u-boot development, could you point me to the correct way of turning of flash support? i found this in the original patch provided by kwikbyte and just ported it to the current u-boot version.

To disable NOR flash support, do not define CONFIG_FLASH_CFI_* or CONFIG_CMD_FLASH, and do define CONFIG_SYS_NO_FLASH.

-Scott

#4 lore raw

PATCH 2/2 KB9202: Add NAND support

El Mon, May 18, 2009 at 12:38:35PM -0500 Scott Wood ha dit:

Quoted 6 lines
Quoted 5 lines · Matthias Kaehlcke
Quoted 4 lines

include/configs/kb9202.h line 153

Quoted 3 lines
include/configs/kb9202.h +3 -0
+#ifdef CONFIG_KB9202B_ATL
+#define CFG_MAX_FLASH_BANKS    0
+#else

Is this really the recommended way of turning off flash support?

Quoted 8 lines
Quoted 5 lines

thanks for your review and your comments.

i'm new to u-boot development, could you point me to the correct way of turning of flash support? i found this in the original patch provided by kwikbyte and just ported it to the current u-boot version.

To disable NOR flash support, do not define CONFIG_FLASH_CFI_* or CONFIG_CMD_FLASH, and do define CONFIG_SYS_NO_FLASH.

thanks for the pointer! actually i made an attempt with CONFIG_SYS_NO_FLASH, but this seems disable flash support at all (NOR and NAND), the linker complained about unresolved symbols in the JFFS code.

at the moment my development system is down due to some hardware fault. as soon as i recover it i'll prepare a patch that addresses the concerns you have raised

Signature · 11 lines
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona

    Yo soy como soy y t? eres como eres, construyamos un mundo donde yo
    pueda ser sin dejar de ser yo, donde t? puedas ser sin dejar de ser
    t?, y donde ni yo ni t? obliguemos al otro a ser como yo o como t?
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
#5 lore raw

PATCH 2/2 KB9202: Add NAND support

In reply to Scott Wood

hi,

El Fri, May 15, 2009 at 05:30:48PM -0500 Scott Wood ha dit:

Quoted 22 lines

Review

Quoted 7 lines · Matthias Kaehlcke
(quoted diff) +7 -0
+/*
+ * Board-specific function to access the device ready signal.
+ */
+static int kb9202_nand_ready(struct mtd_info *mtd)
+{
+	return (((AT91C_BASE_PIOC->PIO_PDSR) & KB9202_NAND_BUSY) != 0);
+}

Use I/O accessors.

Quoted 3 lines
(quoted diff) +3 -0
+int board_nand_init(struct nand_chip *nand)
+{
+	unsigned	value;

[snip]

Quoted 4 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+	/* enable internal NAND controller */
+	value = *(AT91C_EBI_CSA);
+	value |= AT91C_EBI_CS3A_SMC_SmartMedia;
+	*(AT91C_EBI_CSA) = value;

This is a hardware register. Surely it has a defined width?

Quoted 13 lines

Review

Quoted 9 lines
(quoted diff) +9 -0
+	/* setup nand flash access (allow ample margin) */
+	/* 4 wait states, 1 setup, 1 hold, 1 float for 8-bit device */
+	((AT91PS_SMC2)AT91C_BASE_SMC2)->SMC2_CSR[3] =
+		AT91C_SMC2_WSEN |
+		(4 & AT91C_SMC2_NWS) |
+		((1 << 8) & AT91C_SMC2_TDF) |
+		AT91C_SMC2_DBW_8 |
+		((1 << 24) & AT91C_SMC2_RWSETUP) |
+		((1 << 29) & AT91C_SMC2_RWHOLD);

What is AT91PS_SMC2? Please don't hide pointers inside typedefs. Please define symbols to have the proper type in the first place, rather than casting at the point of use.

here is a version of the patch that addresses the issues you pointed out. sorry for the late response, my development system died and i needed some time to get a new machine and restore the setup

--

This is a forward port of the patch submitted by Christian from Kwikbyte in 06/2007
(http://lists.denx.de/pipermail/u-boot/2007-June/022068.html)

---
 board/kb9202/Makefile    |    2 +-
 board/kb9202/nand.c      |  153 ++++++++++++++++++++++++++++++++++++++++++++++
 include/configs/kb9202.h |   10 +++-
 3 files changed, 163 insertions(+), 2 deletions(-)
 create mode 100644 board/kb9202/nand.c
board/kb9202/Makefile +1 -1
index 363f665..0ba4fcc 100644
@@ -28,7 +28,7 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).a
 
-COBJS	:= kb9202.o
+COBJS	:= kb9202.o nand.o
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
board/kb9202/nand.c new file +153 -0

153 lines not on this page · raw message

include/configs/kb9202.h +9 -1
index 8651e53..cd4c577 100644
@@ -62,6 +62,11 @@
 #ifdef CONFIG_KB9202B
 #define	CONFIG_BOOTARGS	"console=ttyS0,115200 noinitrd root=/dev/mtdblock0 rootfstype=jffs2 mem=64M"
 #define	CONFIG_BOOTCOMMAND	"bootm 0x10000000"
+#define NAND_MAX_CHIPS 1
+#define CONFIG_SYS_MAX_NAND_DEVICE 1
+#define CONFIG_SYS_NAND_BASE 0x40000000
+#define CONFIG_JFFS2_NAND
+#define CONFIG_JFFS2_CMDLINE
 #endif
 
 
@@ -71,7 +76,7 @@
 /*
  * Size of malloc() pool
  */
-#define CONFIG_SYS_MALLOC_LEN	(128*1024)
+#define CONFIG_SYS_MALLOC_LEN (1024*1024)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* size in bytes reserved for initial data */
 
 #define CONFIG_BAUDRATE 115200
@@ -112,6 +117,9 @@
 #define CONFIG_CMD_EEPROM
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DHCP
+#ifdef CONFIG_KB9202B
+#define CONFIG_CMD_NAND
+#endif
 #define CONFIG_CMD_JFFS2
 
 #undef CONFIG_CMD_BDI
Signature · 13 lines
1.6.3.1

-- 
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona

    Me lo contaron y lo olvid?, lo vi y lo entend?, lo hice y lo aprend?
                              (Confucio)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
#6 lore raw

PATCH 2/2 KB9202: Add NAND support

Quoted 13 lines · Matthias Kaehlcke

hi,

El Fri, May 15, 2009 at 05:30:48PM -0500 Scott Wood ha dit:

Quoted 9 lines

board/kb9202/nand.c line 82

Quoted 7 lines · Matthias Kaehlcke
board/kb9202/nand.c new file +7 -0
+/*
+ * Board-specific function to access the device ready signal.
+ */
+static int kb9202_nand_ready(struct mtd_info *mtd)
+{
+	return (((AT91C_BASE_PIOC->PIO_PDSR) & KB9202_NAND_BUSY) != 0);
+}

Use I/O accessors.

[snip]

board/kb9202/nand.c line 66

Quoted 4 lines
board/kb9202/nand.c new file +4 -0
+		if (ctrl & NAND_NCE)
+			AT91C_BASE_PIOC->PIO_CODR = KB9202_NAND_NCE;
+		else
+			AT91C_BASE_PIOC->PIO_SODR = KB9202_NAND_NCE;

You're still not using I/O accessors in many places.

Quoted 1 line

+#ifdef CONFIG_CMD_NAND

Put this in the makefile instead.

board/kb9202/nand.c line 82

Quoted 6 lines
board/kb9202/nand.c new file +6 -0
+static int kb9202_nand_ready(struct mtd_info *mtd)
+{
+	const unsigned int value = readl(AT91C_PIOC_PDSR);
+
+	return ((value & KB9202_NAND_BUSY) != 0);
+}

static int kb9202_nand_ready(struct mtd_info *mtd)

{
	return readl(AT91C_PIOC_PDSR) & KB9202_NAND_BUSY;
}

board/kb9202/nand.c line 111

Quoted 7 lines
board/kb9202/nand.c new file +7 -0
+int board_nand_init(struct nand_chip *nand)
+{
+	unsigned int value;
+	struct _AT91S_SMC2 *at91s_smc2 = AT91C_BASE_SMC2;
+
+	nand->ecc.mode = NAND_ECC_SOFT;
+	nand->options &= ~(NAND_BUSWIDTH_16);

Unnecessary parens.

board/kb9202/nand.c line 116

Quoted 5 lines
board/kb9202/nand.c new file +5 -0
+	nand->cmd_ctrl = kb9202_nand_hwcontrol;
+	nand->dev_ready = kb9202_nand_ready;
+
+	/* in case running outside of bootloader */
+	AT91C_BASE_PMC->PMC_PCER = ((unsigned) 1 << AT91C_ID_PIOC);

Unnecessary cast and parens.

board/kb9202/nand.c line 126

Quoted 7 lines
board/kb9202/nand.c new file +7 -0
+	at91s_smc2->SMC2_CSR[3] =
+		AT91C_SMC2_WSEN |
+		(4 & AT91C_SMC2_NWS) |
+		((1 << 8) & AT91C_SMC2_TDF) |
+		AT91C_SMC2_DBW_8 |
+		((1 << 24) & AT91C_SMC2_RWSETUP) |
+		((1 << 29) & AT91C_SMC2_RWHOLD);

Are those instances of (constant1 & constant2) ever going to evaluate to anything but constant1? Can we get rid of the magic numbers?

Otherwise, ACK.

-Scott

#8 lore raw

PATCH 2/2 KB9202: Add NAND support

In reply to Matthias Kaehlcke

On Wednesday 03 June 2009 19:42:00 Matthias Kaehlcke wrote:

<snip>

Quoted 10 lines

here is a version of the patch that addresses the issues you pointed out. sorry for the late response, my development system died and i needed some time to get a new machine and restore the setup

--

This is a forward port of the patch submitted by Christian from Kwikbyte in 06/2007
(http://lists.denx.de/pipermail/u-boot/2007-June/022068.html)

Quoted 8 lines
---
 board/kb9202/Makefile    |    2 +-
 board/kb9202/nand.c      |  153
++++++++++++++++++++++++++++++++++++++++++++++ include/configs/kb9202.h |  
10 +++-
 3 files changed, 163 insertions(+), 2 deletions(-)
 create mode 100644 board/kb9202/nand.c

I suggest to move this driver to drivers/mtd/nand instead.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#7 lore raw

PATCH 2/2 KB9202: Add NAND support

In reply to Scott Wood

El Wed, Jun 03, 2009 at 02:50:40PM -0500 Scott Wood ha dit:

Quoted 67 lines
Quoted 13 lines · Matthias Kaehlcke

hi,

El Fri, May 15, 2009 at 05:30:48PM -0500 Scott Wood ha dit:

Quoted 9 lines

Review

Quoted 7 lines · Matthias Kaehlcke
(quoted diff) +7 -0
+/*
+ * Board-specific function to access the device ready signal.
+ */
+static int kb9202_nand_ready(struct mtd_info *mtd)
+{
+	return (((AT91C_BASE_PIOC->PIO_PDSR) & KB9202_NAND_BUSY) != 0);
+}

Use I/O accessors.

[snip]

Review

Quoted 4 lines
(quoted diff) +4 -0
+		if (ctrl & NAND_NCE)
+			AT91C_BASE_PIOC->PIO_CODR = KB9202_NAND_NCE;
+		else
+			AT91C_BASE_PIOC->PIO_SODR = KB9202_NAND_NCE;

You're still not using I/O accessors in many places.

Quoted 1 line

+#ifdef CONFIG_CMD_NAND

Put this in the makefile instead.

Review

Quoted 6 lines
(quoted diff) +6 -0
+static int kb9202_nand_ready(struct mtd_info *mtd)
+{
+	const unsigned int value = readl(AT91C_PIOC_PDSR);
+
+	return ((value & KB9202_NAND_BUSY) != 0);
+}

static int kb9202_nand_ready(struct mtd_info *mtd)

{
	return readl(AT91C_PIOC_PDSR) & KB9202_NAND_BUSY;
}

Review

Quoted 7 lines
(quoted diff) +7 -0
+int board_nand_init(struct nand_chip *nand)
+{
+	unsigned int value;
+	struct _AT91S_SMC2 *at91s_smc2 = AT91C_BASE_SMC2;
+
+	nand->ecc.mode = NAND_ECC_SOFT;
+	nand->options &= ~(NAND_BUSWIDTH_16);

Unnecessary parens.

Review

Quoted 5 lines
(quoted diff) +5 -0
+	nand->cmd_ctrl = kb9202_nand_hwcontrol;
+	nand->dev_ready = kb9202_nand_ready;
+
+	/* in case running outside of bootloader */
+	AT91C_BASE_PMC->PMC_PCER = ((unsigned) 1 << AT91C_ID_PIOC);

Unnecessary cast and parens.

Review

Quoted 7 lines
(quoted diff) +7 -0
+	at91s_smc2->SMC2_CSR[3] =
+		AT91C_SMC2_WSEN |
+		(4 & AT91C_SMC2_NWS) |
+		((1 << 8) & AT91C_SMC2_TDF) |
+		AT91C_SMC2_DBW_8 |
+		((1 << 24) & AT91C_SMC2_RWSETUP) |
+		((1 << 29) & AT91C_SMC2_RWHOLD);

Are those instances of (constant1 & constant2) ever going to evaluate to anything but constant1? Can we get rid of the magic numbers?

Quoted 1 line

Otherwise, ACK.

thanks for your comments!

i hope this version of the patch addresses all your concerns

--

This is a forward port of the patch submitted by Christian from Kwikbyte in 06/2007
(http://lists.denx.de/pipermail/u-boot/2007-June/022068.html)

---
 board/kb9202/Makefile                        |    1 +
 board/kb9202/nand.c                          |  151 ++++++++++++++++++++++++++
 include/asm-arm/arch-at91rm9200/AT91RM9200.h |    2 +
 include/configs/kb9202.h                     |   10 ++-
 4 files changed, 163 insertions(+), 1 deletions(-)
 create mode 100644 board/kb9202/nand.c
board/kb9202/Makefile +1 -0
index 363f665..d78454d 100644
@@ -29,6 +29,7 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(BOARD).a
 
 COBJS	:= kb9202.o
+COBJS-$(CONFIG_CMD_NAND)   += nand.o
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
board/kb9202/nand.c new file +151 -0

151 lines not on this page · raw message

include/asm-arm/arch-at91rm9200/AT91RM9200.h +2 -0
index 00bae1c..2e40565 100644
@@ -737,6 +737,7 @@ typedef struct _AT91S_PDC
 #define AT91C_SMC2_ACSS_STANDARD	((unsigned int) 0x0 << 16) /* (SMC2) Standard, asserted at the beginning of the access and deasserted at the end. */
 #define AT91C_SMC2_DBW_8	((unsigned int) 0x2 << 13) /* (SMC2) 8-bit. */
 #define AT91C_SMC2_WSEN		((unsigned int) 0x1 <<  7) /* (SMC2) Wait State Enable */
+#define AT91C_PIOC_OER		((AT91_REG *)	0xFFFFF810) /* (PIOC) PIO Output Enable Register */
 #define AT91C_PIOC_ASR		((AT91_REG *)	0xFFFFF870) /* (PIOC) Select A Register */
 #define AT91C_PIOC_SODR		((AT91_REG *)	0xFFFFF830) /* (PIOC) Set Output Data Register */
 #define AT91C_PIOC_CODR		((AT91_REG *)	0xFFFFF834) /* (PIOC) Clear Output Data Register */
@@ -790,6 +791,7 @@ typedef struct _AT91S_PDC
 #define AT91C_MC_AASR		0xFFFFFF08
 #define AT91C_EBI_CFGR		0xFFFFFF64
 #define AT91C_SMC_CSR0		0xFFFFFF70
+#define AT91C_SMC_CSR3		0xFFFFFF7C
 
 /* clocks */
 #define AT91C_PLLAR		0xFFFFFC28
include/configs/kb9202.h +9 -1
index 8651e53..cd4c577 100644
@@ -62,6 +62,11 @@
 #ifdef CONFIG_KB9202B
 #define	CONFIG_BOOTARGS	"console=ttyS0,115200 noinitrd root=/dev/mtdblock0 rootfstype=jffs2 mem=64M"
 #define	CONFIG_BOOTCOMMAND	"bootm 0x10000000"
+#define NAND_MAX_CHIPS 1
+#define CONFIG_SYS_MAX_NAND_DEVICE 1
+#define CONFIG_SYS_NAND_BASE 0x40000000
+#define CONFIG_JFFS2_NAND
+#define CONFIG_JFFS2_CMDLINE
 #endif
 
 
@@ -71,7 +76,7 @@
 /*
  * Size of malloc() pool
  */
-#define CONFIG_SYS_MALLOC_LEN	(128*1024)
+#define CONFIG_SYS_MALLOC_LEN (1024*1024)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* size in bytes reserved for initial data */
 
 #define CONFIG_BAUDRATE 115200
@@ -112,6 +117,9 @@
 #define CONFIG_CMD_EEPROM
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DHCP
+#ifdef CONFIG_KB9202B
+#define CONFIG_CMD_NAND
+#endif
 #define CONFIG_CMD_JFFS2
 
 #undef CONFIG_CMD_BDI
Signature · 14 lines
1.6.3.1

-- 
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona

             If liberty means anything@all, it means the
           right to tell people what they do not want to hear
                            (George Orwell)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
#9 lore raw

PATCH 2/2 KB9202: Add NAND support

In reply to Stefan Roese

El Thu, Jun 04, 2009 at 08:53:10AM +0200 Stefan Roese ha dit:

Quoted 23 lines · On Wednesday 03 June 2009 19:42:00 Matthias Kaehlcke wrote:

<snip>

Quoted 10 lines

here is a version of the patch that addresses the issues you pointed out. sorry for the late response, my development system died and i needed some time to get a new machine and restore the setup

--

This is a forward port of the patch submitted by Christian from Kwikbyte in 06/2007
(http://lists.denx.de/pipermail/u-boot/2007-June/022068.html)

Quoted 8 lines
---
 board/kb9202/Makefile    |    2 +-
 board/kb9202/nand.c      |  153
++++++++++++++++++++++++++++++++++++++++++++++ include/configs/kb9202.h |  
10 +++-
 3 files changed, 163 insertions(+), 2 deletions(-)
 create mode 100644 board/kb9202/nand.c
Quoted 1 line

I suggest to move this driver to drivers/mtd/nand instead.

i thought drivers/mtd/nand is for generic nand drivers, mine - at least atm - is kb9202 specific. if it's really preferred to have board specific drivers in drivers/mtd/nand i'll the adapt the patch happily.

Signature · 11 lines
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona

    Yo soy como soy y t? eres como eres, construyamos un mundo donde yo
    pueda ser sin dejar de ser yo, donde t? puedas ser sin dejar de ser
    t?, y donde ni yo ni t? obliguemos al otro a ser como yo o como t?
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
#10 lore raw

PATCH 2/2 KB9202: Add NAND support

Quoted 13 lines · On Thursday 04 June 2009 19:49:25 Matthias Kaehlcke wrote:
Quoted 13 lines
Quoted 12 lines

This is a forward port of the patch submitted by Christian from Kwikbyte in 06/2007
(http://lists.denx.de/pipermail/u-boot/2007-June/022068.html)

---
 board/kb9202/Makefile    |    2 +-
 board/kb9202/nand.c      |  153
++++++++++++++++++++++++++++++++++++++++++++++ include/configs/kb9202.h
| 10 +++-
 3 files changed, 163 insertions(+), 2 deletions(-)
 create mode 100644 board/kb9202/nand.c
Quoted 3 lines
Quoted 1 line

I suggest to move this driver to drivers/mtd/nand instead.

i thought drivers/mtd/nand is for generic nand drivers,

No, it's for all NAND driver using the common NAND MTD infrastructure. Same as in Linux.

Quoted 3 lines

mine - at least
atm - is kb9202 specific. if it's really preferred to have board specific drivers in drivers/mtd/nand i'll the adapt the patch happily.

Yes, please move it. It's better to collect all NAND related drivers in one place.

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#11 lore raw

PATCH 2/2 KB9202: Add NAND support

El Thu, Jun 04, 2009 at 08:08:04PM +0200 Stefan Roese ha dit:

Quoted 21 lines · On Thursday 04 June 2009 19:49:25 Matthias Kaehlcke wrote:
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines

This is a forward port of the patch submitted by Christian from Kwikbyte in 06/2007
(http://lists.denx.de/pipermail/u-boot/2007-June/022068.html)

---
 board/kb9202/Makefile    |    2 +-
 board/kb9202/nand.c      |  153
++++++++++++++++++++++++++++++++++++++++++++++ include/configs/kb9202.h
| 10 +++-
 3 files changed, 163 insertions(+), 2 deletions(-)
 create mode 100644 board/kb9202/nand.c
Quoted 3 lines
Quoted 1 line

I suggest to move this driver to drivers/mtd/nand instead.

i thought drivers/mtd/nand is for generic nand drivers,

No, it's for all NAND driver using the common NAND MTD infrastructure. Same as in Linux.

Quoted 6 lines
Quoted 3 lines

mine - at least
atm - is kb9202 specific. if it's really preferred to have board specific drivers in drivers/mtd/nand i'll the adapt the patch happily.

Yes, please move it. It's better to collect all NAND related drivers in one place.

thanks for your explication, below is the driver in the corresponding directory

--

Add NAND support for the KwikByte KB9202

---
 drivers/mtd/nand/Makefile                    |    1 +
 drivers/mtd/nand/kb9202_nand.c               |  151 ++++++++++++++++++++++++++
 include/asm-arm/arch-at91rm9200/AT91RM9200.h |    2 +
 include/configs/kb9202.h                     |   11 ++-
 4 files changed, 164 insertions(+), 1 deletions(-)
 create mode 100644 drivers/mtd/nand/kb9202_nand.c
drivers/mtd/nand/Makefile +1 -0
index 471cd6b..d2f3e61 100644
@@ -44,6 +44,7 @@ COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o
 COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.c
 COBJS-$(CONFIG_NAND_S3C64XX) += s3c64xx.o
 COBJS-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o
+COBJS-$(CONFIG_NAND_KB9202) += kb9202_nand.o
 endif
 
 COBJS	:= $(COBJS-y)
drivers/mtd/nand/kb9202_nand.c new file +151 -0

151 lines not on this page · raw message

include/asm-arm/arch-at91rm9200/AT91RM9200.h +2 -0
index 00bae1c..aaab2c2 100644
@@ -737,6 +737,7 @@ typedef struct _AT91S_PDC
 #define AT91C_SMC2_ACSS_STANDARD	((unsigned int) 0x0 << 16) /* (SMC2) Standard, asserted at the beginning of the access and deasserted@the end. */
 #define AT91C_SMC2_DBW_8	((unsigned int) 0x2 << 13) /* (SMC2) 8-bit. */
 #define AT91C_SMC2_WSEN		((unsigned int) 0x1 <<  7) /* (SMC2) Wait State Enable */
+#define AT91C_PIOC_OER		((AT91_REG *)	0xFFFFF810) /* (PIOC) PIO Output Enable Register */
 #define AT91C_PIOC_ASR		((AT91_REG *)	0xFFFFF870) /* (PIOC) Select A Register */
 #define AT91C_PIOC_SODR		((AT91_REG *)	0xFFFFF830) /* (PIOC) Set Output Data Register */
 #define AT91C_PIOC_CODR		((AT91_REG *)	0xFFFFF834) /* (PIOC) Clear Output Data Register */
@@ -780,6 +781,7 @@ typedef struct _AT91S_PDC
 #define AT91C_PIOB_PER		((AT91_REG *)	0xFFFFF600) /* (PIOB) PIO Enable Register */
 #define AT91C_PIOB_ODR		((AT91_REG *)	0xFFFFF614) /* (PIOB) Output Disable Registerr */
 #define AT91C_PIOB_PDSR		((AT91_REG *)	0xFFFFF63C) /* (PIOB) Pin Data Status Register */
+#define AT91C_SMC_CSR3		((AT91_REG *)	0xFFFFFF7C) /* (SMC) Chip Select Register 3 */
 
 #else
 /* flash */
include/configs/kb9202.h +10 -1
index 8651e53..c51845e 100644
@@ -62,6 +62,12 @@
 #ifdef CONFIG_KB9202B
 #define	CONFIG_BOOTARGS	"console=ttyS0,115200 noinitrd root=/dev/mtdblock0 rootfstype=jffs2 mem=64M"
 #define	CONFIG_BOOTCOMMAND	"bootm 0x10000000"
+#define CONFIG_NAND_KB9202
+#define NAND_MAX_CHIPS 1
+#define CONFIG_SYS_MAX_NAND_DEVICE 1
+#define CONFIG_SYS_NAND_BASE 0x40000000
+#define CONFIG_JFFS2_NAND
+#define CONFIG_JFFS2_CMDLINE
 #endif
 
 
@@ -71,7 +77,7 @@
 /*
  * Size of malloc() pool
  */
-#define CONFIG_SYS_MALLOC_LEN	(128*1024)
+#define CONFIG_SYS_MALLOC_LEN (1024*1024)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* size in bytes reserved for initial data */
 
 #define CONFIG_BAUDRATE 115200
@@ -112,6 +118,9 @@
 #define CONFIG_CMD_EEPROM
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DHCP
+#ifdef CONFIG_KB9202B
+#define CONFIG_CMD_NAND
+#endif
 #define CONFIG_CMD_JFFS2
 
 #undef CONFIG_CMD_BDI
Signature · 10 lines
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona

      The assumption that what currently exists must necessarily
        exist is the acid that corrodes all visionary thinking
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
#12 lore raw

PATCH 2/2 KB9202: Add NAND support

Dear Matthias Kaehlcke,

Quoted 5 lines · In message <20090604185024.GB4398@darwin> you wrote:

thanks for your explication, below is the driver in the corresponding directory

--

Suchg comment is supposed to go *below* the "--" line, not above.

Quoted 1 line

Add NAND support for the KwikByte KB9202

And such a commit message must go *above* the "--" line, not below.

Also, it would be nice if you added some version information (like "[PATCH 2/2 v3]" in the Subject: line, and summarize the changes between versions below the "--" line.

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
Old programmers never die, they just become managers.
#13 lore raw

PATCH v4 2/2 KB9202: Add NAND support

Add NAND support for the KwikByte KB9202

--

Changes:

- moved driver to drivers/mtd/nand/
- use i/o accessors
- don't check for ATL custom board
- removed unnecessary cast
- don't use magic numbers

 drivers/mtd/nand/Makefile                    |    1 +
 drivers/mtd/nand/kb9202_nand.c               |  151 ++++++++++++++++++++++++++
 include/asm-arm/arch-at91rm9200/AT91RM9200.h |    2 +
 include/configs/kb9202.h                     |   11 ++-
 4 files changed, 164 insertions(+), 1 deletions(-)
 create mode 100644 drivers/mtd/nand/kb9202_nand.c
drivers/mtd/nand/Makefile +1 -0
index 471cd6b..d2f3e61 100644
@@ -44,6 +44,7 @@ COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o
 COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.c
 COBJS-$(CONFIG_NAND_S3C64XX) += s3c64xx.o
 COBJS-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o
+COBJS-$(CONFIG_NAND_KB9202) += kb9202_nand.o
 endif
 
 COBJS	:= $(COBJS-y)
drivers/mtd/nand/kb9202_nand.c new file +151 -0

151 lines not on this page · raw message

include/asm-arm/arch-at91rm9200/AT91RM9200.h +2 -0
index 00bae1c..aaab2c2 100644
@@ -737,6 +737,7 @@ typedef struct _AT91S_PDC
 #define AT91C_SMC2_ACSS_STANDARD	((unsigned int) 0x0 << 16) /* (SMC2) Standard, asserted at the beginning of the access and deasserted@the end. */
 #define AT91C_SMC2_DBW_8	((unsigned int) 0x2 << 13) /* (SMC2) 8-bit. */
 #define AT91C_SMC2_WSEN		((unsigned int) 0x1 <<  7) /* (SMC2) Wait State Enable */
+#define AT91C_PIOC_OER		((AT91_REG *)	0xFFFFF810) /* (PIOC) PIO Output Enable Register */
 #define AT91C_PIOC_ASR		((AT91_REG *)	0xFFFFF870) /* (PIOC) Select A Register */
 #define AT91C_PIOC_SODR		((AT91_REG *)	0xFFFFF830) /* (PIOC) Set Output Data Register */
 #define AT91C_PIOC_CODR		((AT91_REG *)	0xFFFFF834) /* (PIOC) Clear Output Data Register */
@@ -780,6 +781,7 @@ typedef struct _AT91S_PDC
 #define AT91C_PIOB_PER		((AT91_REG *)	0xFFFFF600) /* (PIOB) PIO Enable Register */
 #define AT91C_PIOB_ODR		((AT91_REG *)	0xFFFFF614) /* (PIOB) Output Disable Registerr */
 #define AT91C_PIOB_PDSR		((AT91_REG *)	0xFFFFF63C) /* (PIOB) Pin Data Status Register */
+#define AT91C_SMC_CSR3		((AT91_REG *)	0xFFFFFF7C) /* (SMC) Chip Select Register 3 */
 
 #else
 /* flash */
include/configs/kb9202.h +10 -1
index 8651e53..c51845e 100644
@@ -62,6 +62,12 @@
 #ifdef CONFIG_KB9202B
 #define	CONFIG_BOOTARGS	"console=ttyS0,115200 noinitrd root=/dev/mtdblock0 rootfstype=jffs2 mem=64M"
 #define	CONFIG_BOOTCOMMAND	"bootm 0x10000000"
+#define CONFIG_NAND_KB9202
+#define NAND_MAX_CHIPS 1
+#define CONFIG_SYS_MAX_NAND_DEVICE 1
+#define CONFIG_SYS_NAND_BASE 0x40000000
+#define CONFIG_JFFS2_NAND
+#define CONFIG_JFFS2_CMDLINE
 #endif
 
 
@@ -71,7 +77,7 @@
 /*
  * Size of malloc() pool
  */
-#define CONFIG_SYS_MALLOC_LEN	(128*1024)
+#define CONFIG_SYS_MALLOC_LEN (1024*1024)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* size in bytes reserved for initial data */
 
 #define CONFIG_BAUDRATE 115200
@@ -112,6 +118,9 @@
 #define CONFIG_CMD_EEPROM
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DHCP
+#ifdef CONFIG_KB9202B
+#define CONFIG_CMD_NAND
+#endif
 #define CONFIG_CMD_JFFS2
 
 #undef CONFIG_CMD_BDI
Signature · 10 lines
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona

               If sharing a thing in no way diminishes it,
               it is not rightly owned if it is not shared
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
#14 lore raw

PATCH v4 2/2 KB9202: Add NAND support

Quoted 5 lines · Matthias Kaehlcke

Add NAND support for the KwikByte KB9202

--

The git separator is three dashes, not two.

Quoted 8 lines

Changes:

- moved driver to drivers/mtd/nand/
- use i/o accessors
- don't check for ATL custom board
- removed unnecessary cast
- don't use magic numbers

Quoted 4 lines
 drivers/mtd/nand/Makefile                    |    1 +
 drivers/mtd/nand/kb9202_nand.c               |  151 ++++++++++++++++++++++++++
 include/asm-arm/arch-at91rm9200/AT91RM9200.h |    2 +
 include/configs/kb9202.h                     |   11 ++-

I get conflicts in kb9202.h. Is this against an arch tree, or does it need to be respun?

drivers/mtd/nand/Makefile COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o · line 47

Quoted 9 lines
drivers/mtd/nand/Makefile +1 -0
index 471cd6b..d2f3e61 100644
@@ -44,6 +44,7 @@ COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o
 COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.c
 COBJS-$(CONFIG_NAND_S3C64XX) += s3c64xx.o
 COBJS-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o
+COBJS-$(CONFIG_NAND_KB9202) += kb9202_nand.o

Wolfgang likes these things kept in alphabetical order.

drivers/mtd/nand/Makefile COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o

Quoted 6 lines
drivers/mtd/nand/Makefile +6 -0
+int board_nand_init(struct nand_chip *nand)
+{
+	unsigned int value;
+
+	nand->ecc.mode = NAND_ECC_SOFT;
+	nand->options &= ~NAND_BUSWIDTH_16;

Why would you need to clear this? It's the board driver that sets it in the first place (if applicable).

drivers/mtd/nand/Makefile

Quoted 6 lines
drivers/mtd/nand/Makefile +6 -0
+	/* setup nand flash access (allow ample margin) */
+	/* 4 wait states, 1 setup, 1 hold, 1 float for 8-bit device */
+	writel(AT91C_SMC2_WSEN | KB9202_SMC2_NWS | KB9202_SMC2_TDF |
+				 AT91C_SMC2_DBW_8 | KB9202_SMC2_RWSETUP | KB9202_SMC2_RWHOLD,
+				 AT91C_SMC_CSR3);
+

Line length. Did you perhaps use a tab size other than 8?

Otherwise, ACK.

-Scott

#15 lore raw

PATCH v5 2/2 KB9202: Add NAND support

Add NAND support for the KwikByte KB9202

---

El Tue, Jun 23, 2009 at 04:19:40PM -0500 Scott Wood ha dit:

Quoted 2 lines

I get conflicts in kb9202.h. Is this against an arch tree, or does it need to be respun?

The previous patches were against v2009-03, as i had problems building the current git head for the kb9202 when i started working on the patch. Did you apply the first patch of this series when you got the conflict? This patch is based on the current HEAD.

Changes regarding v4:
* put KB9202 entry in the Makefile at the correct position (alphabetical order)
* removed superfluous clear of NAND_BUSWIDTH_16 flag
* fixed line length/broken indentation

 drivers/mtd/nand/Makefile                    |    1 +
 drivers/mtd/nand/kb9202_nand.c               |  150 ++++++++++++++++++++++++++
 include/asm-arm/arch-at91rm9200/AT91RM9200.h |    2 +
 include/configs/kb9202.h                     |   11 ++-
 4 files changed, 163 insertions(+), 1 deletions(-)
 create mode 100644 drivers/mtd/nand/kb9202_nand.c
drivers/mtd/nand/Makefile +1 -0
index 71dd5b9..d2bd558 100644
@@ -40,6 +40,7 @@ COBJS-$(CONFIG_DRIVER_NAND_BFIN) += bfin_nand.o
 COBJS-$(CONFIG_NAND_DAVINCI) += davinci_nand.o
 COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o
 COBJS-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o
+COBJS-$(CONFIG_NAND_KB9202) += kb9202_nand.o
 COBJS-$(CONFIG_NAND_MPC5121_NFC) += mpc5121_nfc.o
 COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o
 COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.c
drivers/mtd/nand/kb9202_nand.c new file +150 -0

150 lines not on this page · raw message

include/asm-arm/arch-at91rm9200/AT91RM9200.h +2 -0
index 00bae1c..aaab2c2 100644
@@ -737,6 +737,7 @@ typedef struct _AT91S_PDC
 #define AT91C_SMC2_ACSS_STANDARD	((unsigned int) 0x0 << 16) /* (SMC2) Standard, asserted at the beginning of the access and deasserted@the end. */
 #define AT91C_SMC2_DBW_8	((unsigned int) 0x2 << 13) /* (SMC2) 8-bit. */
 #define AT91C_SMC2_WSEN		((unsigned int) 0x1 <<  7) /* (SMC2) Wait State Enable */
+#define AT91C_PIOC_OER		((AT91_REG *)	0xFFFFF810) /* (PIOC) PIO Output Enable Register */
 #define AT91C_PIOC_ASR		((AT91_REG *)	0xFFFFF870) /* (PIOC) Select A Register */
 #define AT91C_PIOC_SODR		((AT91_REG *)	0xFFFFF830) /* (PIOC) Set Output Data Register */
 #define AT91C_PIOC_CODR		((AT91_REG *)	0xFFFFF834) /* (PIOC) Clear Output Data Register */
@@ -780,6 +781,7 @@ typedef struct _AT91S_PDC
 #define AT91C_PIOB_PER		((AT91_REG *)	0xFFFFF600) /* (PIOB) PIO Enable Register */
 #define AT91C_PIOB_ODR		((AT91_REG *)	0xFFFFF614) /* (PIOB) Output Disable Registerr */
 #define AT91C_PIOB_PDSR		((AT91_REG *)	0xFFFFF63C) /* (PIOB) Pin Data Status Register */
+#define AT91C_SMC_CSR3		((AT91_REG *)	0xFFFFFF7C) /* (SMC) Chip Select Register 3 */
 
 #else
 /* flash */
include/configs/kb9202.h +10 -1
index 8651e53..c51845e 100644
@@ -62,6 +62,12 @@
 #ifdef CONFIG_KB9202B
 #define	CONFIG_BOOTARGS	"console=ttyS0,115200 noinitrd root=/dev/mtdblock0 rootfstype=jffs2 mem=64M"
 #define	CONFIG_BOOTCOMMAND	"bootm 0x10000000"
+#define CONFIG_NAND_KB9202
+#define NAND_MAX_CHIPS 1
+#define CONFIG_SYS_MAX_NAND_DEVICE 1
+#define CONFIG_SYS_NAND_BASE 0x40000000
+#define CONFIG_JFFS2_NAND
+#define CONFIG_JFFS2_CMDLINE
 #endif
 
 
@@ -71,7 +77,7 @@
 /*
  * Size of malloc() pool
  */
-#define CONFIG_SYS_MALLOC_LEN	(128*1024)
+#define CONFIG_SYS_MALLOC_LEN (1024*1024)
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* size in bytes reserved for initial data */
 
 #define CONFIG_BAUDRATE 115200
@@ -112,6 +118,9 @@
 #define CONFIG_CMD_EEPROM
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DHCP
+#ifdef CONFIG_KB9202B
+#define CONFIG_CMD_NAND
+#endif
 #define CONFIG_CMD_JFFS2
 
 #undef CONFIG_CMD_BDI
Signature · 11 lines
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona


  The salvation of mankind lies only in making everything the concern of all
                         (Alexander Solzhenitsyn)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
#16 lore raw

PATCH v5 2/2 KB9202: Add NAND support

Quoted 8 lines · Matthias Kaehlcke

Add NAND support for the KwikByte KB9202

---

El Tue, Jun 23, 2009 at 04:19:40PM -0500 Scott Wood ha dit:

Quoted 7 lines
Quoted 2 lines

I get conflicts in kb9202.h. Is this against an arch tree, or does it need to be respun?

The previous patches were against v2009-03, as i had problems building the current git head for the kb9202 when i started working on the patch. Did you apply the first patch of this series when you got the conflict? This patch is based on the current HEAD.

No - if it depends on other patches that go through an arch tree, then this patch should go through that tree as well.

-Scott

#17 lore raw

PATCH v5 2/2 KB9202: Add NAND support

Quoted 17 lines · Scott Wood
Quoted 8 lines · Matthias Kaehlcke

Add NAND support for the KwikByte KB9202

---

El Tue, Jun 23, 2009 at 04:19:40PM -0500 Scott Wood ha dit:

Quoted 7 lines
Quoted 2 lines

I get conflicts in kb9202.h. Is this against an arch tree, or does it need to be respun?

The previous patches were against v2009-03, as i had problems building the current git head for the kb9202 when i started working on the patch. Did you apply the first patch of this series when you got the conflict? This patch is based on the current HEAD.

Quoted 4 lines

No - if it depends on other patches that go through an arch tree, then this patch should go through that tree as well.

Scott I've not follow this patch but for the arm part it's looks fine so I'll let you handle

Best Regards,
J.

#18 lore raw

PATCH v5 2/2 KB9202: Add NAND support

Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 17 lines · Scott Wood
Quoted 15 lines · Matthias Kaehlcke

Add NAND support for the KwikByte KB9202

---

El Tue, Jun 23, 2009 at 04:19:40PM -0500 Scott Wood ha dit:

Quoted 2 lines

I get conflicts in kb9202.h. Is this against an arch tree, or does it need to be respun?

The previous patches were against v2009-03, as i had problems building the current git head for the kb9202 when i started working on the patch. Did you apply the first patch of this series when you got the conflict? This patch is based on the current HEAD.

Quoted 6 lines
Quoted 4 lines

No - if it depends on other patches that go through an arch tree, then this patch should go through that tree as well.

Scott I've not follow this patch but for the arm part it's looks fine so I'll let you handle

It still does not apply to the current tree, so I cannot accept it as is.

The NAND tree is not an appropriate route for unrelated changes to a board config file (such as CONFIG_BOOTARGS/CONFIG_BOOTCOMMAND) to go -- and even if it were, I don't have an easily applyable version of patch 1/2 (the mailing list archives mangle things).

Matthias, can you resend a patch that just adds the NAND driver (for me), and a separate patch that just touches the board config (for the arch tree)?

-Scott

#19 lore raw

PATCH v6 2/2 KB9202: Add NAND support

Add KB9202 NAND driver

---

El Thu, Jul 16, 2009 at 01:45:57PM -0500 Scott Wood ha dit:

Quoted 28 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 18 lines · Scott Wood
Quoted 17 lines · Matthias Kaehlcke
Quoted 15 lines

Add NAND support for the KwikByte KB9202

---

El Tue, Jun 23, 2009 at 04:19:40PM -0500 Scott Wood ha dit:

Quoted 2 lines

I get conflicts in kb9202.h. Is this against an arch tree, or does it need to be respun?

The previous patches were against v2009-03, as i had problems building the current git head for the kb9202 when i started working on the patch. Did you apply the first patch of this series when you got the conflict? This patch is based on the current HEAD.

Quoted 6 lines
Quoted 4 lines

No - if it depends on other patches that go through an arch tree, then this patch should go through that tree as well.

Scott I've not follow this patch but for the arm part it's looks fine so I'll let you handle

It still does not apply to the current tree, so I cannot accept it as is.

Quoted 8 lines

The NAND tree is not an appropriate route for unrelated changes to a board config file (such as CONFIG_BOOTARGS/CONFIG_BOOTCOMMAND) to go -- and even if it were, I don't have an easily applyable version of patch 1/2 (the mailing list archives mangle things).

Matthias, can you resend a patch that just adds the NAND driver (for me), and a separate patch that just touches the board config (for the arch tree)?

ok, here is a patch that only adds the NAND driver. i'll prepare a board config patch after my first patch has hit mainline to avoid further confusion :)

changes regarding v5:

* only add the NAND driver, without touching the board configuration

 drivers/mtd/nand/Makefile      |    1 +
 drivers/mtd/nand/kb9202_nand.c |  150 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 151 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/kb9202_nand.c
drivers/mtd/nand/Makefile +1 -0
index a5680e8..aab3b70 100644
@@ -40,6 +40,7 @@ COBJS-$(CONFIG_DRIVER_NAND_BFIN) += bfin_nand.o
 COBJS-$(CONFIG_NAND_DAVINCI) += davinci_nand.o
 COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o
 COBJS-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o
+COBJS-$(CONFIG_NAND_KB9202) += kb9202_nand.o
 COBJS-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o
 COBJS-$(CONFIG_NAND_MPC5121_NFC) += mpc5121_nfc.o
 COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o
drivers/mtd/nand/kb9202_nand.c new file +150 -0

150 lines not on this page · raw message

Signature · 11 lines
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona

  Control over the use of one's ideas really constitutes control over other
  people's lives; and it is usually used to make their lives more difficult.
                          (Richard Stallman)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-