Skip to contentSkip to conversation

NAND: add NAND driver for s3c64xx

PATCH Superseded Guennadi Liakhovetski 4 participants 36 messages Jul 31, 2008 – Aug 5, 2008

Subsystems (6)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 6/7 NAND: add NAND driver for s3c64xx

Ported from u-boot-1.1.6 driver by Samsung.

---
 drivers/mtd/nand/Makefile  |    1 +
 drivers/mtd/nand/s3c64xx.c |  373 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 374 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/s3c64xx.c
drivers/mtd/nand/Makefile +1 -0
index 7bd22a0..236cf03 100644
@@ -33,6 +33,7 @@ COBJS-y += nand_bbt.o
 COBJS-y += nand_util.o
 
 COBJS-y += fsl_upm.o
+COBJS-$(CONFIG_NAND_S3C64XX) += s3c64xx.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/mtd/nand/s3c64xx.c new file +315 -0

315 lines not on this page · raw message

Signature · 1 line
1.5.4
#1 lore raw

PATCH v2 6/7 NAND: add NAND driver for s3c64xx

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

Ported from u-boot-1.1.6 driver by Samsung.

...

drivers/mtd/nand/s3c64xx.c line 2

Quoted 5 lines
drivers/mtd/nand/s3c64xx.c new file +2 -0
@@ -0,0 +1,315 @@
+/*
+ * (C) Copyright 2006 DENX Software Engineering

Please add your name here.

drivers/mtd/nand/s3c64xx.c line 41

Quoted 3 lines
drivers/mtd/nand/s3c64xx.c new file +3 -0
+/*
+ * Function to print out oob buffer for debugging
+ * Written by jsgood

Then jsgood should be mentioned in the (C) lines?

drivers/mtd/nand/s3c64xx.c line 234

Quoted 7 lines
drivers/mtd/nand/s3c64xx.c new file +7 -0
+	case 1: /* 1 bit error (Correctable)
+		   (nfestat0 >> 7) & 0x7ff	:error byte number
+		   (nfestat0 >> 4) & 0x7	:error bit number */
+		printf("S3C NAND: 1 bit error detected at byte %ld. Correcting from "
+		       "0x%02x ", (nfestat0 >> 7) & 0x7ff, dat[(nfestat0 >> 7) & 0x7ff]);
+		dat[(nfestat0 >> 7) & 0x7ff] ^= (1 << ((nfestat0 >> 4) & 0x7));
+		printf("to 0x%02x...OK\n", dat[(nfestat0 >> 7) & 0x7ff]);

I guess there should be a way to write this code so it is actually readable? This is U-Boot, not the IOCCC (yes, there *is* some difference, still).

Quoted 23 lines
drivers/mtd/nand/s3c64xx.c new file +23 -0
+int board_nand_init(struct nand_chip *nand)
+{
+	NFCONT_REG 		= (NFCONT_REG & ~NFCONT_WP) | NFCONT_ENABLE | 0x6;
+
+	nand->IO_ADDR_R		= (void __iomem *)NFDATA;
+	nand->IO_ADDR_W		= (void __iomem *)NFDATA;
+	nand->hwcontrol		= s3c_nand_hwcontrol;
+	nand->dev_ready		= s3c_nand_device_ready;
+	nand->select_chip	= s3c_nand_select_chip;
+	nand->options		= 0;
+#ifdef CONFIG_NAND_SPL
+	nand->read_byte		= nand_read_byte;
+	nand->write_byte	= nand_write_byte;
+	nand->read_buf		= nand_read_buf;
+#endif
+
+	do {
+		struct mtd_info m;
+		int cellinfo;
+
+		m.priv = nand;
+
+		s3c_nand_select_chip(&m, 0);

drivers/mtd/nand/s3c64xx.c line 300

Quoted 10 lines
drivers/mtd/nand/s3c64xx.c new file +10 -0
+		s3c_nand_hwcontrol(&m, NAND_CTL_SETCLE);
+		writeb(NAND_CMD_READID, nand->IO_ADDR_W);
+		s3c_nand_hwcontrol(&m, NAND_CTL_CLRCLE);
+		s3c_nand_device_ready(&m);
+		cellinfo = readb(nand->IO_ADDR_R);
+		cellinfo += readb(nand->IO_ADDR_R);
+		cellinfo += readb(nand->IO_ADDR_R);
+		s3c_nand_select_chip(&m, -1);
+		nand->eccmode = cellinfo;
+	} while (0);

Please get rid of the do...while here - or does it serve any purpose?

drivers/mtd/nand/s3c64xx.c line 308

Quoted 2 lines
drivers/mtd/nand/s3c64xx.c new file +2 -0
+	/* A shot in the dark, I don't know how to use this smart ECC-mode
+	 * selection with the current driver */

Incorrect multiline comment style.

Please check other files for that, too.

Best regards,

Wolfgang Denk

Signature · 7 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
Once upon a time, "PC" meant "personal computer".  Now  it  seems  to
only  mean  "Prisoner  of Bill". Alas! All my PCs run Unix, and those
include Intel, Sparc, and other processors.
          -- Tom "Bring back the non-PC meaning of `PC'" Christiansen
#2 lore raw

PATCH v2 6/7 NAND: add NAND driver for s3c64xx

Quoted 7 lines · Wolfgang Denk

drivers/mtd/nand/s3c64xx.c line 2

Quoted 5 lines
drivers/mtd/nand/s3c64xx.c new file +2 -0
@@ -0,0 +1,315 @@
+/*
+ * (C) Copyright 2006 DENX Software Engineering

Please add your name here.

I will add my copyright in a couple of files, but I would rather not add it to Makefiles. Below I quote an earlier post on this list (funnily, I wasn't able to get it in sourceforge's archive...), which addresses Copyrights in Makefiles. To me it sounds reasonable, because in my example I really added very little "IP" to it, almost exclusively copy-paste from other Makefiles. What I learned, is one may never delete copyrights from files, ones they are there, that's why I preserved yours - that's how this file was in Samsung's version. But I don't think my Copyright there will serve any good purpose.

Quoted 5 lines

drivers/mtd/nand/s3c64xx.c line 41

Quoted 3 lines
drivers/mtd/nand/s3c64xx.c new file +3 -0
+/*
+ * Function to print out oob buffer for debugging
+ * Written by jsgood

Then jsgood should be mentioned in the (C) lines?

Is it allowed to add other peaople's copyright without their consent?

I am working on the rest comments... cleaning up others' mess.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

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

###################################
########### QUOTED MAIL ###########
###################################

#3 lore raw

PATCH v2 6/7 NAND: add NAND driver for s3c64xx

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

+ * (C) Copyright 2006 DENX Software Engineering

Please add your name here.

I will add my copyright in a couple of files, but I would rather not add it to Makefiles. Below I quote an earlier post on this list (funnily, I

Note that in the case you quoted my request was that you add *your* name, not only that of our company. This is Free Software, and I consider you the copyright owner. I am aware that in many other companies you have to sign contracts that all such rights belong exclusively to the company, but DENX doesn't do that.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

+ * Function to print out oob buffer for debugging
+ * Written by jsgood

Then jsgood should be mentioned in the (C) lines?

Is it allowed to add other peaople's copyright without their consent?

No, you cannot do that without asking him. Maybe you find his address somewhere?

Quoted 1 line

I am working on the rest comments... cleaning up others' mess.

That was your job in that project, wasn't it? ;-)

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
Every program has at least one bug and can be shortened by  at  least
one instruction - from which, by induction, one can deduce that every
program can be reduced to one instruction which doesn't work.
#4 lore raw

[U-Boot-Users] several messages

Quoted 6 lines · Wolfgang Denk
Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 4 lines
Quoted 2 lines

+ * (C) Copyright 2006 DENX Software Engineering

Please add your name here.

Quoted 8 lines
Quoted 2 lines

I will add my copyright in a couple of files, but I would rather not add it to Makefiles. Below I quote an earlier post on this list (funnily, I

Note that in the case you quoted my request was that you add *your* name, not only that of our company. This is Free Software, and I consider you the copyright owner. I am aware that in many other companies you have to sign contracts that all such rights belong exclusively to the company, but DENX doesn't do that.

You mean insert my name in that line? But I haven't had anything to do with this file in 2006:-) This is an old line from Samsung sources. I thought your request above was the same as this one:

Quoted 11 lines · Wolfgang Denk

board/samsung/smdk6400/Makefile line 3

Quoted 9 lines
board/samsung/smdk6400/Makefile new file +3 -0
new file mode 100644
index 0000000..1200e45
@@ -0,0 +1,51 @@
+#
+# (C) Copyright 2000, 2001, 2002
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.

Who contributed more to this Makefile - you or me?

and you wanted me to _add_ my copyright to existing ones. And that is what I wasn't specifically keen on in case of Makefiles:-)

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

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

#5 lore raw

v2 cover SMDK6400 support

In reply to Wolfgang Denk

Hi,

this is version 2 of the smdk6400 patch series. I hope, I took care of all comments, apart of these ones:

Quoted 5 lines · Jean-Christophe PLAGNIOL-VILLARD

drivers/mtd/nand/s3c64xx.c line 60

Quoted 4 lines
drivers/mtd/nand/s3c64xx.c new file +4 -0
+#ifdef CONFIG_NAND_SPL
+static u_char nand_read_byte(struct mtd_info *mtd)
+{
+   struct nand_chip *this = mtd->priv;

add an empty line

Quoted 9 lines

drivers/mtd/nand/s3c64xx.c line 66

Quoted 6 lines
drivers/mtd/nand/s3c64xx.c new file +6 -0
+   return readb(this->IO_ADDR_R);
+}
+
+static void nand_write_byte(struct mtd_info *mtd, u_char byte)
+{
+   struct nand_chip *this = mtd->priv;

add an empty line

Quoted 2 lines
(quoted diff) +2 -0
+   writeb(byte, this->IO_ADDR_W);
+}

Sorry, looks like a matter of taste to me. There are also very few lines over 80 characters left, but fixing them would look too awkward...

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

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

#6 lore raw

PATCH v2 1/7 Add definition for the AM29LV800BB AMD NOR-flash

---
 drivers/mtd/jedec_flash.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
drivers/mtd/jedec_flash.c +17 -0
index 9845e93..020647a 100644
@@ -234,6 +234,23 @@ static const struct amd_flash_info jedec_table[] = {
 			ERASEINFO(0x10000,7),
 		}
 	},
+	{
+		.mfr_id		= MANUFACTURER_AMD,
+		.dev_id		= AM29LV800BB,
+		.name		= "AMD AM29LV800BB",
+		.uaddr		= {
+			[1] = MTD_UADDR_0x0555_0x02AA /* x16 */
+		},
+		.DevSize	= SIZE_1MiB,
+		.CmdSet		= CFI_CMDSET_AMD_LEGACY,
+		.NumEraseRegions= 4,
+		.regions	= {
+			ERASEINFO(0x04000, 1),
+			ERASEINFO(0x02000, 2),
+			ERASEINFO(0x08000, 1),
+			ERASEINFO(0x10000, 15),
+		}
+	},
 #endif
 };
 
Signature · 1 line
1.5.4
#7 lore raw

PATCH v2 2/7 NAND_CMD_READOOB is not supported by all chips, read OOB with the page instead

In reply to Guennadi Liakhovetski

I _think_ this should work with all NAND chips. Otherwise we might have to introduce a configuration variable.

---
 nand_spl/nand_boot.c |   61 +++++++++++++++++++++++++------------------------
 1 files changed, 31 insertions(+), 30 deletions(-)
nand_spl/nand_boot.c +31 -30
index 563a80b..78eaf75 100644
@@ -128,21 +128,6 @@ static int nand_command(struct mtd_info *mtd, int block, int page, int offs, u8
 }
 #endif
 
-static int nand_is_bad_block(struct mtd_info *mtd, int block)
-{
-	struct nand_chip *this = mtd->priv;
-
-	nand_command(mtd, block, 0, CFG_NAND_BAD_BLOCK_POS, NAND_CMD_READOOB);
-
-	/*
-	 * Read one byte
-	 */
-	if (this->read_byte(mtd) != 0xff)
-		return 1;
-
-	return 0;
-}
-
 static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst)
 {
 	struct nand_chip *this = mtd->priv;
@@ -150,8 +135,6 @@ static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst)
 	u_char *ecc_code;
 	u_char *oob_data;
 	int i;
-	int eccsize = CFG_NAND_ECCSIZE;
-	int eccbytes = CFG_NAND_ECCBYTES;
 	int eccsteps = CFG_NAND_ECCSTEPS;
 	uint8_t *p = dst;
 	int stat;
@@ -163,11 +146,11 @@ static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst)
 	 */
 	ecc_calc = (u_char *)(CFG_SDRAM_BASE + 0x10000);
 	ecc_code = ecc_calc + 0x100;
-	oob_data = ecc_calc + 0x200;
+	oob_data = p + CFG_NAND_PAGE_SIZE; /* Append OOB to the page data */
 
-	for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
+	for (i = 0; eccsteps; eccsteps--, i += CFG_NAND_ECCBYTES, p += CFG_NAND_ECCSIZE) {
 		this->enable_hwecc(mtd, NAND_ECC_READ);
-		this->read_buf(mtd, p, eccsize);
+		this->read_buf(mtd, p, CFG_NAND_ECCSIZE);
 		this->calculate_ecc(mtd, p, &ecc_calc[i]);
 	}
 	this->read_buf(mtd, oob_data, CFG_NAND_OOBSIZE);
@@ -179,7 +162,7 @@ static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst)
 	eccsteps = CFG_NAND_ECCSTEPS;
 	p = dst;
 
-	for (i = 0 ; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
+	for (i = 0; eccsteps; eccsteps--, i += CFG_NAND_ECCBYTES, p += CFG_NAND_ECCSIZE) {
 		/* No chance to do something with the possible error message
 		 * from correct_data(). We just hope that all possible errors
 		 * are corrected by this routine.
@@ -195,6 +178,7 @@ static int nand_load(struct mtd_info *mtd, int offs, int uboot_size, uchar *dst)
 	int block;
 	int blockcopy_count;
 	int page;
+	unsigned read = 0;
 
 	/*
 	 * offs has to be aligned to a block address!
@@ -202,18 +186,29 @@ static int nand_load(struct mtd_info *mtd, int offs, int uboot_size, uchar *dst)
 	block = offs / CFG_NAND_BLOCK_SIZE;
 	blockcopy_count = 0;
 
-	while (blockcopy_count < (uboot_size / CFG_NAND_BLOCK_SIZE)) {
-		if (!nand_is_bad_block(mtd, block)) {
-			/*
-			 * Skip bad blocks
-			 */
-			for (page = 0; page < CFG_NAND_PAGE_COUNT; page++) {
-				nand_read_page(mtd, block, page, dst);
-				dst += CFG_NAND_PAGE_SIZE;
+	while (blockcopy_count < ((uboot_size + CFG_NAND_BLOCK_SIZE - 1) / CFG_NAND_BLOCK_SIZE)) {
+		/*
+		 * Skip bad blocks
+		 */
+		int badblock = 0;
+		for (page = 0; page < CFG_NAND_PAGE_COUNT; page++) {
+			nand_read_page(mtd, block, page, dst);
+			if ((!page
+#ifdef CFG_NAND_BBT_2NDPAGE
+			     || page == 1
+#endif
+				    ) && dst[CFG_NAND_PAGE_SIZE] != 0xff) {
+				badblock = 1;
+				break;
 			}
+			/* Overwrite skipped pages */
+			if (read >= offs)
+				dst += CFG_NAND_PAGE_SIZE;
+			read += CFG_NAND_PAGE_SIZE;
+		}
 
+		if (!badblock)
 			blockcopy_count++;
-		}
 
 		block++;
 	}
@@ -241,12 +236,18 @@ void nand_boot(void)
 	nand_chip.dev_ready = NULL;	/* preset to NULL */
 	board_nand_init(&nand_chip);
 
+	if (nand_chip.select_chip)
+		nand_chip.select_chip(&nand_info, 0);
+
 	/*
 	 * Load U-Boot image from NAND into RAM
 	 */
 	ret = nand_load(&nand_info, CFG_NAND_U_BOOT_OFFS, CFG_NAND_U_BOOT_SIZE,
 			(uchar *)CFG_NAND_U_BOOT_DST);
 
+	if (nand_chip.select_chip)
+		nand_chip.select_chip(&nand_info, -1);
+
 	/*
 	 * Jump to U-Boot image
 	 */
Signature · 1 line
1.5.4
#8 lore raw

PATCH v2 3/7 ARM: Add arm1176 core with s3c6400 SoC

In reply to Guennadi Liakhovetski

This is a port of s3c6400 sources by Samsung from u-boot-1.1.6.

---
 cpu/arm1176/Makefile                    |   50 ++
 cpu/arm1176/config.mk                   |   35 ++
 cpu/arm1176/cpu.c                       |  189 +++++++
 cpu/arm1176/s3c64xx/Makefile            |   48 ++
 cpu/arm1176/s3c64xx/config.mk           |   34 ++
 cpu/arm1176/s3c64xx/cpu_init.S          |  142 +++++
 cpu/arm1176/s3c64xx/interrupts.c        |  278 ++++++++++
 cpu/arm1176/s3c64xx/speed.c             |  140 +++++
 cpu/arm1176/start.S                     |  469 +++++++++++++++++
 include/asm-arm/arch-s3c64xx/hardware.h |   63 +++
 include/common.h                        |    3 +-
 include/s3c6400.h                       |  866 +++++++++++++++++++++++++++++++
 include/s3c64x0.h                       |   92 ++++
 13 files changed, 2408 insertions(+), 1 deletions(-)
 create mode 100644 cpu/arm1176/Makefile
 create mode 100644 cpu/arm1176/config.mk
 create mode 100644 cpu/arm1176/cpu.c
 create mode 100644 cpu/arm1176/s3c64xx/Makefile
 create mode 100644 cpu/arm1176/s3c64xx/config.mk
 create mode 100644 cpu/arm1176/s3c64xx/cpu_init.S
 create mode 100644 cpu/arm1176/s3c64xx/interrupts.c
 create mode 100644 cpu/arm1176/s3c64xx/speed.c
 create mode 100644 cpu/arm1176/start.S
 create mode 100644 include/asm-arm/arch-s3c64xx/hardware.h
 create mode 100644 include/s3c6400.h
 create mode 100644 include/s3c64x0.h
cpu/arm1176/Makefile new file +50 -0
new file mode 100644
index 0000000..1ca9199
@@ -0,0 +1,50 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2008
+# Guennadi Liakhovetki, DENX Software Engineering, <[email protected]>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(CPU).a
+
+START	= start.o
+COBJS	= cpu.o
+
+SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
+START	:= $(addprefix $(obj),$(START))
+
+all:	$(obj).depend $(START) $(LIB)
+
+$(LIB):	$(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
cpu/arm1176/config.mk new file +35 -0
new file mode 100644
index 0000000..5083594
@@ -0,0 +1,35 @@
+#
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, <[email protected]>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
+	-msoft-float
+
+# Make ARMv5 to allow more compilers to work, even though its v6.
+PLATFORM_CPPFLAGS += -march=armv5t
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
cpu/arm1176/cpu.c new file +189 -0

189 lines not on this page · raw message

cpu/arm1176/s3c64xx/Makefile new file +48 -0

48 lines not on this page · raw message

cpu/arm1176/s3c64xx/config.mk new file +34 -0
new file mode 100644
index 0000000..204e880
@@ -0,0 +1,34 @@
+#
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, <[email protected]>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
+	-msoft-float
+
+# Make ARMv5 to allow more compilers to work, even though its v6.
+PLATFORM_CPPFLAGS += -march=armv5t
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+#PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
cpu/arm1176/s3c64xx/cpu_init.S new file +142 -0

142 lines not on this page · raw message

cpu/arm1176/s3c64xx/interrupts.c new file +278 -0

278 lines not on this page · raw message

cpu/arm1176/s3c64xx/speed.c new file +140 -0

140 lines not on this page · raw message

cpu/arm1176/start.S new file +469 -0

469 lines not on this page · raw message

include/asm-arm/arch-s3c64xx/hardware.h new file +63 -0

63 lines not on this page · raw message

include/common.h +2 -1
index 2fcb1fd..10d56e0 100644
@@ -489,7 +489,8 @@ int	prt_mpc8220_clks (void);
 ulong	get_OPB_freq (void);
 ulong	get_PCI_freq (void);
 #endif
-#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || defined(CONFIG_LH7A40X)
+#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || \
+	defined(CONFIG_LH7A40X) || defined(CONFIG_S3C6400)
 void	s3c2410_irq(void);
 #define ARM920_IRQ_CALLBACK s3c2410_irq
 ulong	get_FCLK (void);
include/s3c6400.h new file +866 -0

866 lines not on this page · raw message

include/s3c64x0.h new file +92 -0

92 lines not on this page · raw message

Signature · 1 line
1.5.4
#9 lore raw

PATCH v2 4/7 USB: Add support for OHCI controller on s3c6400

In reply to Guennadi Liakhovetski

Notice: USB on s3c6400 currently works _only_ with switched off MMU. One could try to enable the MMU, but map addresses 1-to-1, and disable data cache, then it should work too and we could still profit from instruction cache.

---
 cpu/arm1176/s3c64xx/Makefile |    1 +
 cpu/arm1176/s3c64xx/usb.c    |   45 ++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/usb_ohci.c       |    1 +
 3 files changed, 47 insertions(+), 0 deletions(-)
 create mode 100644 cpu/arm1176/s3c64xx/usb.c
cpu/arm1176/s3c64xx/Makefile +1 -0
index 66ac4aa..8cee691 100644
@@ -27,6 +27,7 @@ LIB	= $(obj)lib$(SOC).a
 
 COBJS-y	= interrupts.o
 COBJS-$(CONFIG_S3C6400)	+= cpu_init.o speed.o
+COBJS-$(CONFIG_USB_OHCI_NEW) += usb.o
 
 OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS-y))
 
cpu/arm1176/s3c64xx/usb.c new file +45 -0

45 lines not on this page · raw message

drivers/usb/usb_ohci.c +1 -0
index fd60edb..0bfa4d7 100644
@@ -69,6 +69,7 @@
 #if defined(CONFIG_ARM920T) || \
     defined(CONFIG_S3C2400) || \
     defined(CONFIG_S3C2410) || \
+    defined(CONFIG_S3C6400) || \
     defined(CONFIG_440EP) || \
     defined(CONFIG_PCI_OHCI) || \
     defined(CONFIG_MPC5200) || \
Signature · 1 line
1.5.4
#10 lore raw

PATCH v2 5/7 serial: add s3c64xx serial driver

In reply to Guennadi Liakhovetski

Ported from u-boot-1.1.6 driver by Samsung.

---
 drivers/serial/Makefile  |    1 +
 drivers/serial/s3c64xx.c |  186 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 187 insertions(+), 0 deletions(-)
 create mode 100644 drivers/serial/s3c64xx.c
drivers/serial/Makefile +1 -0
index c9e797e..2a11ae5 100644
@@ -30,6 +30,7 @@ COBJS-y += mcfuart.o
 COBJS-y += ns9750_serial.o
 COBJS-y += ns16550.o
 COBJS-y += s3c4510b_uart.o
+COBJS-$(CONFIG_S3C64XX) += s3c64xx.o
 COBJS-y += serial.o
 COBJS-y += serial_max3100.o
 COBJS-y += serial_pl010.o
drivers/serial/s3c64xx.c new file +186 -0

186 lines not on this page · raw message

Signature · 1 line
1.5.4
#11 lore raw

PATCH v2 6/7 NAND: add NAND driver for s3c64xx

In reply to Guennadi Liakhovetski

Ported from u-boot-1.1.6 driver by Samsung.

---
 drivers/mtd/nand/Makefile  |    1 +
 drivers/mtd/nand/s3c64xx.c |  307 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 308 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/s3c64xx.c
drivers/mtd/nand/Makefile +1 -0
index 7bd22a0..236cf03 100644
@@ -33,6 +33,7 @@ COBJS-y += nand_bbt.o
 COBJS-y += nand_util.o
 
 COBJS-y += fsl_upm.o
+COBJS-$(CONFIG_NAND_S3C64XX) += s3c64xx.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/mtd/nand/s3c64xx.c new file +307 -0

307 lines not on this page · raw message

Signature · 1 line
1.5.4
#12 lore raw

PATCH v2 7/7 ARM: Add support for S3C6400 based SMDK6400 board

In reply to Guennadi Liakhovetski

SMDK6400 can only boot U-Boot from NAND-flash. This patch adds a nand_spl driver for it too. The board can also boot from the NOR flash, but due to hardware limitations it can only address 64KiB on it, which is not enough for U-Boot. Ported from u-boot-1.1.6 version by Samsung.

---
 MAKEALL                                    |    1 +
 Makefile                                   |   17 ++
 board/samsung/smdk6400/Makefile            |   54 +++++
 board/samsung/smdk6400/config.mk           |   30 +++
 board/samsung/smdk6400/lowlevel_init.S     |  316 ++++++++++++++++++++++++++++
 board/samsung/smdk6400/smdk6400.c          |  130 ++++++++++++
 board/samsung/smdk6400/u-boot-nand.lds     |   62 ++++++
 include/configs/smdk6400.h                 |  304 ++++++++++++++++++++++++++
 nand_spl/board/samsung/smdk6400/Makefile   |  106 ++++++++++
 nand_spl/board/samsung/smdk6400/config.mk  |   40 ++++
 nand_spl/board/samsung/smdk6400/u-boot.lds |   61 ++++++
 11 files changed, 1121 insertions(+), 0 deletions(-)
 create mode 100644 board/samsung/smdk6400/Makefile
 create mode 100644 board/samsung/smdk6400/config.mk
 create mode 100644 board/samsung/smdk6400/lowlevel_init.S
 create mode 100644 board/samsung/smdk6400/smdk6400.c
 create mode 100644 board/samsung/smdk6400/u-boot-nand.lds
 create mode 100644 include/configs/smdk6400.h
 create mode 100644 nand_spl/board/samsung/smdk6400/Makefile
 create mode 100644 nand_spl/board/samsung/smdk6400/config.mk
 create mode 100644 nand_spl/board/samsung/smdk6400/u-boot.lds
MAKEALL +1 -0
index ee83cca..a3ed47d 100755
@@ -515,6 +515,7 @@ LIST_ARM11="		\
 	imx31_litekit	\
 	imx31_phycore	\
 	mx31ads		\
+	smdk6400	\
 "
 
 #########################################################################
Makefile +17 -0
index b104617..0c5b8a6 100644
@@ -2677,6 +2677,23 @@ mx31ads_config		: unconfig
 omap2420h4_config	: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 omap2420h4 NULL omap24xx
 
+#########################################################################
+## ARM1176 Systems
+#########################################################################
+smdk6400_noUSB_config	\
+smdk6400_config	:	unconfig
+	@mkdir -p $(obj)include $(obj)board/samsung/smdk6400
+	@mkdir -p $(obj)nand_spl/board/samsung/smdk6400
+	@echo "#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h
+	@if [ -z "$(findstring smdk6400_noUSB_config,$@)" ]; then			\
+		echo "RAM_TEXT = 0x57e00000" >> $(obj)board/samsung/smdk6400/config.tmp;\
+		$(MKCONFIG) $(@:_config=) arm arm1176 smdk6400 samsung s3c64xx;		\
+	else										\
+		echo "RAM_TEXT = 0xc7e00000" >> $(obj)board/samsung/smdk6400/config.tmp;\
+		$(MKCONFIG) $(@:_noUSB_config=) arm arm1176 smdk6400 samsung s3c64xx;	\
+	fi
+	@echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
+
 #========================================================================
 # i386
 #========================================================================
board/samsung/smdk6400/Makefile new file +54 -0

54 lines not on this page · raw message

board/samsung/smdk6400/config.mk new file +30 -0
new file mode 100644
index 0000000..298d387
@@ -0,0 +1,30 @@
+#
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, <[email protected]>
+# David Mueller, ELSOFT AG, <[email protected]>
+#
+# (C) Copyright 2008
+# Guennadi Liakhovetki, DENX Software Engineering, <[email protected]>
+#
+# SAMSUNG SMDK6400 board with mDirac3 (ARM1176) cpu
+#
+# see http://www.samsung.com/ for more information on SAMSUNG
+
+# On SMDK6400 we use the 64 MB SDRAM bank at
+#
+# 0x50000000 to 0x58000000
+#
+# Linux-Kernel is expected to be at 0x50008000, entry 0x50008000
+#
+# we load ourselves to 0x57e00000 without MMU
+# with MMU, load address is changed to 0xc7e00000
+#
+# download area is 0x5000c000
+
+sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
+
+ifndef CONFIG_NAND_SPL
+TEXT_BASE = $(RAM_TEXT)
+else
+TEXT_BASE = 0
+endif
board/samsung/smdk6400/lowlevel_init.S new file +316 -0

316 lines not on this page · raw message

board/samsung/smdk6400/smdk6400.c new file +130 -0

130 lines not on this page · raw message

board/samsung/smdk6400/u-boot-nand.lds new file +62 -0

62 lines not on this page · raw message

include/configs/smdk6400.h new file +304 -0

304 lines not on this page · raw message

nand_spl/board/samsung/smdk6400/Makefile new file +106 -0

106 lines not on this page · raw message

nand_spl/board/samsung/smdk6400/config.mk new file +40 -0
new file mode 100644
index 0000000..4b16230
@@ -0,0 +1,40 @@
+#
+# (C) Copyright 2006
+# Stefan Roese, DENX Software Engineering, sr at denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Samsung S3C64xx Reference Platform (smdk6400) board
+
+# TEXT_BASE for SPL:
+#
+# On S3C64xx platforms the SPL is located in SRAM@0.
+#
+# TEXT_BASE = 0
+
+include $(TOPDIR)/board/$(BOARDDIR)/config.mk
+
+# PAD_TO used to generate a 4kByte binary needed for the combined image
+# -> PAD_TO = TEXT_BASE + 4096
+PAD_TO	:= $(shell expr $$[$(TEXT_BASE) + 4096])
+
+ifeq ($(debug),1)
+PLATFORM_CPPFLAGS += -DDEBUG
+endif
nand_spl/board/samsung/smdk6400/u-boot.lds new file +61 -0

61 lines not on this page · raw message

Signature · 1 line
1.5.4
#13 lore raw

v2 cover SMDK6400 support

In reply to Guennadi Liakhovetski
Quoted 3 lines · In message <[email protected]> you wrote:

Sorry, looks like a matter of taste to me. There are also very few lines over 80 characters left, but fixing them would look too awkward...

This is not a matter of taste. Please fix these, too!

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
It is the quality rather than the quantity that matters.
- Lucius Annaeus Seneca (4 B.C. - A.D. 65)
#14 lore raw

v3 cover SMDK6400 support

In reply to Guennadi Liakhovetski

Version 3: now all lines over 80 characters are gone. And a couple more checkpatch warnings with them.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

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

#15 lore raw

PATCH v3 1/7 Add definition for the AM29LV800BB AMD NOR-flash

---
 drivers/mtd/jedec_flash.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
drivers/mtd/jedec_flash.c +17 -0
index 9845e93..020647a 100644
@@ -234,6 +234,23 @@ static const struct amd_flash_info jedec_table[] = {
 			ERASEINFO(0x10000,7),
 		}
 	},
+	{
+		.mfr_id		= MANUFACTURER_AMD,
+		.dev_id		= AM29LV800BB,
+		.name		= "AMD AM29LV800BB",
+		.uaddr		= {
+			[1] = MTD_UADDR_0x0555_0x02AA /* x16 */
+		},
+		.DevSize	= SIZE_1MiB,
+		.CmdSet		= CFI_CMDSET_AMD_LEGACY,
+		.NumEraseRegions= 4,
+		.regions	= {
+			ERASEINFO(0x04000, 1),
+			ERASEINFO(0x02000, 2),
+			ERASEINFO(0x08000, 1),
+			ERASEINFO(0x10000, 15),
+		}
+	},
 #endif
 };
 
Signature · 1 line
1.5.4
#16 lore raw

PATCH v3 2/7 NAND_CMD_READOOB is not supported by all chips, read OOB with the page instead

In reply to Guennadi Liakhovetski

I _think_ this should work with all NAND chips. Otherwise we might have to introduce a configuration variable.

---
 nand_spl/nand_boot.c |   64 ++++++++++++++++++++++++++-----------------------
 1 files changed, 34 insertions(+), 30 deletions(-)
nand_spl/nand_boot.c +34 -30
index 563a80b..0de4c4b 100644
@@ -128,21 +128,6 @@ static int nand_command(struct mtd_info *mtd, int block, int page, int offs, u8
 }
 #endif
 
-static int nand_is_bad_block(struct mtd_info *mtd, int block)
-{
-	struct nand_chip *this = mtd->priv;
-
-	nand_command(mtd, block, 0, CFG_NAND_BAD_BLOCK_POS, NAND_CMD_READOOB);
-
-	/*
-	 * Read one byte
-	 */
-	if (this->read_byte(mtd) != 0xff)
-		return 1;
-
-	return 0;
-}
-
 static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst)
 {
 	struct nand_chip *this = mtd->priv;
@@ -150,8 +135,6 @@ static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst)
 	u_char *ecc_code;
 	u_char *oob_data;
 	int i;
-	int eccsize = CFG_NAND_ECCSIZE;
-	int eccbytes = CFG_NAND_ECCBYTES;
 	int eccsteps = CFG_NAND_ECCSTEPS;
 	uint8_t *p = dst;
 	int stat;
@@ -163,11 +146,12 @@ static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst)
 	 */
 	ecc_calc = (u_char *)(CFG_SDRAM_BASE + 0x10000);
 	ecc_code = ecc_calc + 0x100;
-	oob_data = ecc_calc + 0x200;
+	oob_data = p + CFG_NAND_PAGE_SIZE; /* Append OOB to the page data */
 
-	for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
+	for (i = 0; eccsteps;
+	     eccsteps--, i += CFG_NAND_ECCBYTES, p += CFG_NAND_ECCSIZE) {
 		this->enable_hwecc(mtd, NAND_ECC_READ);
-		this->read_buf(mtd, p, eccsize);
+		this->read_buf(mtd, p, CFG_NAND_ECCSIZE);
 		this->calculate_ecc(mtd, p, &ecc_calc[i]);
 	}
 	this->read_buf(mtd, oob_data, CFG_NAND_OOBSIZE);
@@ -179,7 +163,8 @@ static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst)
 	eccsteps = CFG_NAND_ECCSTEPS;
 	p = dst;
 
-	for (i = 0 ; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
+	for (i = 0; eccsteps;
+	     eccsteps--, i += CFG_NAND_ECCBYTES, p += CFG_NAND_ECCSIZE) {
 		/* No chance to do something with the possible error message
 		 * from correct_data(). We just hope that all possible errors
 		 * are corrected by this routine.
@@ -195,6 +180,7 @@ static int nand_load(struct mtd_info *mtd, int offs, int uboot_size, uchar *dst)
 	int block;
 	int blockcopy_count;
 	int page;
+	unsigned read = 0;
 
 	/*
 	 * offs has to be aligned to a block address!
@@ -202,18 +188,30 @@ static int nand_load(struct mtd_info *mtd, int offs, int uboot_size, uchar *dst)
 	block = offs / CFG_NAND_BLOCK_SIZE;
 	blockcopy_count = 0;
 
-	while (blockcopy_count < (uboot_size / CFG_NAND_BLOCK_SIZE)) {
-		if (!nand_is_bad_block(mtd, block)) {
-			/*
-			 * Skip bad blocks
-			 */
-			for (page = 0; page < CFG_NAND_PAGE_COUNT; page++) {
-				nand_read_page(mtd, block, page, dst);
-				dst += CFG_NAND_PAGE_SIZE;
+	while (blockcopy_count < ((uboot_size + CFG_NAND_BLOCK_SIZE - 1) /
+				  CFG_NAND_BLOCK_SIZE)) {
+		/*
+		 * Skip bad blocks
+		 */
+		int badblock = 0;
+		for (page = 0; page < CFG_NAND_PAGE_COUNT; page++) {
+			nand_read_page(mtd, block, page, dst);
+			if ((!page
+#ifdef CFG_NAND_BBT_2NDPAGE
+			     || page == 1
+#endif
+				    ) && dst[CFG_NAND_PAGE_SIZE] != 0xff) {
+				badblock = 1;
+				break;
 			}
+			/* Overwrite skipped pages */
+			if (read >= offs)
+				dst += CFG_NAND_PAGE_SIZE;
+			read += CFG_NAND_PAGE_SIZE;
+		}
 
+		if (!badblock)
 			blockcopy_count++;
-		}
 
 		block++;
 	}
@@ -241,12 +239,18 @@ void nand_boot(void)
 	nand_chip.dev_ready = NULL;	/* preset to NULL */
 	board_nand_init(&nand_chip);
 
+	if (nand_chip.select_chip)
+		nand_chip.select_chip(&nand_info, 0);
+
 	/*
 	 * Load U-Boot image from NAND into RAM
 	 */
 	ret = nand_load(&nand_info, CFG_NAND_U_BOOT_OFFS, CFG_NAND_U_BOOT_SIZE,
 			(uchar *)CFG_NAND_U_BOOT_DST);
 
+	if (nand_chip.select_chip)
+		nand_chip.select_chip(&nand_info, -1);
+
 	/*
 	 * Jump to U-Boot image
 	 */
Signature · 1 line
1.5.4
#17 lore raw

PATCH v3 2/7 NAND_CMD_READOOB is not supported by all chips, read OOB with the page instead

Quoted 2 lines · Guennadi Liakhovetski

I _think_ this should work with all NAND chips. Otherwise we might have to introduce a configuration variable.

Which small-page NAND chips can't handle READOOB? On large page devices, nand_command changes it to READ0.

That said, doing it all at once could result in smaller, faster, and simpler code.

nand_spl/nand_boot.c static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst) · line 154

Quoted 6 lines
nand_spl/nand_boot.c +0 -2
@@ -150,8 +135,6 @@ static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst)
 	u_char *ecc_code;
 	u_char *oob_data;
 	int i;
-	int eccsize = CFG_NAND_ECCSIZE;
-	int eccbytes = CFG_NAND_ECCBYTES;

Any particular reason for this change? It's more readable as is, IMHO.

nand_spl/nand_boot.c static int nand_load(struct mtd_info *mtd, int offs, int uboot_size, uchar *dst) · line 183

Quoted 5 lines
nand_spl/nand_boot.c +1 -0
@@ -195,6 +180,7 @@ static int nand_load(struct mtd_info *mtd, int offs, int uboot_size, uchar *dst)
 	int block;
 	int blockcopy_count;
 	int page;
+	unsigned read = 0;

"unsigned int", please.

nand_spl/nand_boot.c static int nand_load(struct mtd_info *mtd, int offs, int uboot_size, uchar *dst) · line 202

Quoted 7 lines
nand_spl/nand_boot.c +7 -0
+		int badblock = 0;
+		for (page = 0; page < CFG_NAND_PAGE_COUNT; page++) {
+			nand_read_page(mtd, block, page, dst);
+			if ((!page
+#ifdef CFG_NAND_BBT_2NDPAGE
+			     || page == 1
+#endif

Please use page == 0 rather than !page when checking for an actual value of zero as opposed to a zero that means "not valid" or similar.

nand_spl/nand_boot.c static int nand_load(struct mtd_info *mtd, int offs, int uboot_size, uchar *dst) · line 211

Quoted 9 lines
nand_spl/nand_boot.c +8 -0
+				    ) && dst[CFG_NAND_PAGE_SIZE] != 0xff) {
+				badblock = 1;
+				break;
 			}
+			/* Overwrite skipped pages */
+			if (read >= offs)
+				dst += CFG_NAND_PAGE_SIZE;
+			read += CFG_NAND_PAGE_SIZE;
+		}

I don't follow the logic here -- you're discarding a number of good blocks equal to the offset? That might make sense if we were starting at block zero, and defining the offset as not including any bad blocks before the image -- but the first block we read is at the start of the image, not the start of flash.

Quoted 6 lines
nand_spl/nand_boot.c +2 -0
@@ -241,12 +239,18 @@ void nand_boot(void)
 	nand_chip.dev_ready = NULL;	/* preset to NULL */
 	board_nand_init(&nand_chip);
 
+	if (nand_chip.select_chip)
+		nand_chip.select_chip(&nand_info, 0);

nand_spl/nand_boot.c void nand_boot(void) · line 253

Quoted 10 lines
nand_spl/nand_boot.c +4 -0
+
 	/*
 	 * Load U-Boot image from NAND into RAM
 	 */
 	ret = nand_load(&nand_info, CFG_NAND_U_BOOT_OFFS, CFG_NAND_U_BOOT_SIZE,
 			(uchar *)CFG_NAND_U_BOOT_DST);
 
+	if (nand_chip.select_chip)
+		nand_chip.select_chip(&nand_info, -1);
+

This seems like an unrelated change, that wasn't described in the changelog.

-Scott

#18 lore raw

PATCH v3 2/7 NAND_CMD_READOOB is not supported by all chips, read OOB with the page instead

Quoted 6 lines · Scott Wood
Quoted 2 lines · Guennadi Liakhovetski

I _think_ this should work with all NAND chips. Otherwise we might have to introduce a configuration variable.

Which small-page NAND chips can't handle READOOB? On large page devices, nand_command changes it to READ0.

It's a large-page device. And, as far as I understand the datasheet, to read data at arbitrary offset in a page, you first have to issue a READ PAGE (READ0) for _the_ _whole_ page, then you can use RANDOM DATA READ to read arbitrary data within this page. Whereas, the driver attempts to use READ0 to read the bad-block marker directly, which doesn't work with this chip. At least this is my understanding.

Quoted 11 lines

That said, doing it all at once could result in smaller, faster, and simpler code.

nand_spl/nand_boot.c static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst) · line 154

Quoted 6 lines
nand_spl/nand_boot.c +0 -2
@@ -150,8 +135,6 @@ static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst)
 	u_char *ecc_code;
 	u_char *oob_data;
 	int i;
-	int eccsize = CFG_NAND_ECCSIZE;
-	int eccbytes = CFG_NAND_ECCBYTES;

Any particular reason for this change? It's more readable as is, IMHO.

Acually, it was to improve readability:-) First, this way you can easier grep. Secondly, when I see an assignment to a _variable_, I expect, that this variable's value can indeed _vary_. So, it makes extra work looking through the code and verifying what other values this variable takes. Thus, at the very least I would add "const" to the definition. And, I do think using constants directly makes it clearer...

Quoted 7 lines

nand_spl/nand_boot.c static int nand_load(struct mtd_info *mtd, int offs, int uboot_size, uchar *dst) · line 183

Quoted 5 lines
nand_spl/nand_boot.c +1 -0
@@ -195,6 +180,7 @@ static int nand_load(struct mtd_info *mtd, int offs, int uboot_size, uchar *dst)
 	int block;
 	int blockcopy_count;
 	int page;
+	unsigned read = 0;

"unsigned int", please.

Ok...

Quoted 10 lines

nand_spl/nand_boot.c static int nand_load(struct mtd_info *mtd, int offs, int uboot_size, uchar *dst) · line 202

Quoted 7 lines
nand_spl/nand_boot.c +7 -0
+		int badblock = 0;
+		for (page = 0; page < CFG_NAND_PAGE_COUNT; page++) {
+			nand_read_page(mtd, block, page, dst);
+			if ((!page
+#ifdef CFG_NAND_BBT_2NDPAGE
+			     || page == 1
+#endif

Please use page == 0 rather than !page when checking for an actual value of zero as opposed to a zero that means "not valid" or similar.

Ok...

Quoted 7 lines
Quoted 7 lines
nand_spl/nand_boot.c +6 -0
+				    ) && dst[CFG_NAND_PAGE_SIZE] != 0xff) {
+				badblock = 1;
+				break;
 			}
+			/* Overwrite skipped pages */
+			if (read >= offs)
+				dst += CFG_NAND_PAGE_SIZE;
Quoted 8 lines

nand_spl/nand_boot.c static int nand_load(struct mtd_info *mtd, int offs, int uboot_size, uchar *dst) · line 211

Quoted 2 lines
nand_spl/nand_boot.c +2 -0
+			read += CFG_NAND_PAGE_SIZE;
+		}

I don't follow the logic here -- you're discarding a number of good blocks equal to the offset? That might make sense if we were starting at block zero, and defining the offset as not including any bad blocks before the image -- but the first block we read is at the start of the image, not the start of flash.

Right, that's a bug. Hope, it's fixed now.

Quoted 13 lines
Quoted 13 lines
nand_spl/nand_boot.c +3 -0
@@ -241,12 +239,18 @@ void nand_boot(void)
 	nand_chip.dev_ready = NULL;	/* preset to NULL */
 	board_nand_init(&nand_chip);
 
+	if (nand_chip.select_chip)
+		nand_chip.select_chip(&nand_info, 0);
+
 	/*
 	 * Load U-Boot image from NAND into RAM
 	 */
 	ret = nand_load(&nand_info, CFG_NAND_U_BOOT_OFFS, CFG_NAND_U_BOOT_SIZE,
 			(uchar *)CFG_NAND_U_BOOT_DST);
 
Quoted 6 lines

nand_spl/nand_boot.c void nand_boot(void) · line 253

Quoted 3 lines
nand_spl/nand_boot.c +3 -0
+	if (nand_chip.select_chip)
+		nand_chip.select_chip(&nand_info, -1);
+

This seems like an unrelated change, that wasn't described in the changelog.

Ok, will describe in the changelog.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

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

#19 lore raw

PATCH v3 2/7 NAND_CMD_READOOB is not supported by all chips, read OOB with the page instead

Quoted 6 lines · Guennadi Liakhovetski

It's a large-page device. And, as far as I understand the datasheet, to read data at arbitrary offset in a page, you first have to issue a READ PAGE (READ0) for _the_ _whole_ page, then you can use RANDOM DATA READ to read arbitrary data within this page. Whereas, the driver attempts to use READ0 to read the bad-block marker directly, which doesn't work with this chip. At least this is my understanding.

Are you saying that your NAND chip can't read the OOB by issuing READ0 with the appropriate column address? Which chip is this, and where can I find a manual?

Quoted 11 lines
Quoted 8 lines

nand_spl/nand_boot.c static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst) · line 154

Quoted 6 lines
nand_spl/nand_boot.c +0 -2
@@ -150,8 +135,6 @@ static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst)
 	u_char *ecc_code;
 	u_char *oob_data;
 	int i;
-	int eccsize = CFG_NAND_ECCSIZE;
-	int eccbytes = CFG_NAND_ECCBYTES;

Any particular reason for this change? It's more readable as is, IMHO.

Acually, it was to improve readability:-) First, this way you can easier grep.

Grep will find the initialization.

Quoted 5 lines

Secondly, when I see an assignment to a _variable_, I expect, that this variable's value can indeed _vary_. So, it makes extra work looking through the code and verifying what other values this variable takes. Thus, at the very least I would add "const" to the definition. And, I do think using constants directly makes it clearer...

It replaces a short lower-case name with a longer all-caps name that forces line breaks. I'm fine with adding "const".

-Scott

#20 lore raw

PATCH v3 2/7 NAND_CMD_READOOB is not supported by all chips, read OOB with the page instead

Quoted 11 lines · Scott Wood
Quoted 6 lines · Guennadi Liakhovetski

It's a large-page device. And, as far as I understand the datasheet, to read data at arbitrary offset in a page, you first have to issue a READ PAGE (READ0) for _the_ _whole_ page, then you can use RANDOM DATA READ to read arbitrary data within this page. Whereas, the driver attempts to use READ0 to read the bad-block marker directly, which doesn't work with this chip. At least this is my understanding.

Are you saying that your NAND chip can't read the OOB by issuing READ0 with the appropriate column address? Which chip is this, and where can I find a manual?

At least, this is how I understood it, I might be wrong though:

http://download.micron.com/pdf/datasheets/flash/nand/2_4_8gb_nand_m49a.pdf

pages 21, 22.

Quoted 14 lines
Quoted 11 lines
Quoted 8 lines

nand_spl/nand_boot.c static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst) · line 154

Quoted 6 lines
nand_spl/nand_boot.c +0 -2
@@ -150,8 +135,6 @@ static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst)
 	u_char *ecc_code;
 	u_char *oob_data;
 	int i;
-	int eccsize = CFG_NAND_ECCSIZE;
-	int eccbytes = CFG_NAND_ECCBYTES;

Any particular reason for this change? It's more readable as is, IMHO.

Acually, it was to improve readability:-) First, this way you can easier grep.

Grep will find the initialization.

Quoted 8 lines
Quoted 5 lines

Secondly, when I see an assignment to a _variable_, I expect, that this variable's value can indeed _vary_. So, it makes extra work looking through the code and verifying what other values this variable takes. Thus, at the very least I would add "const" to the definition. And, I do think using constants directly makes it clearer...

It replaces a short lower-case name with a longer all-caps name that forces line breaks. I'm fine with adding "const".

Ok...

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

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

#21 lore raw

PATCH v3 2/7 NAND_CMD_READOOB is not supported by all chips, read OOB with the page instead

Quoted 10 lines · Guennadi Liakhovetski
Quoted 3 lines · Scott Wood

Are you saying that your NAND chip can't read the OOB by issuing READ0 with the appropriate column address? Which chip is this, and where can I find a manual?

At least, this is how I understood it, I might be wrong though:

http://download.micron.com/pdf/datasheets/flash/nand/2_4_8gb_nand_m49a.pdf

pages 21, 22.

The READ0 command says, "Starting from the initial column address and going to the end of the page, read the data by repeatedly pulsing RE# at the maximum tRC rate (see Figure 14)." That looks normal... have you tried it?

IIUC, the "complete page of data" refers to the transfer from the NAND storage to the chip's page buffer, not to the transfer from the buffer to the CPU.

-Scott

#22 lore raw

PATCH v3 3/7 ARM: Add arm1176 core with s3c6400 SoC

In reply to Guennadi Liakhovetski

This is a port of s3c6400 sources by Samsung from u-boot-1.1.6.

---
 cpu/arm1176/Makefile                    |   50 ++
 cpu/arm1176/config.mk                   |   35 ++
 cpu/arm1176/cpu.c                       |  189 +++++++
 cpu/arm1176/s3c64xx/Makefile            |   48 ++
 cpu/arm1176/s3c64xx/config.mk           |   34 ++
 cpu/arm1176/s3c64xx/cpu_init.S          |  142 +++++
 cpu/arm1176/s3c64xx/interrupts.c        |  280 ++++++++++
 cpu/arm1176/s3c64xx/speed.c             |  140 +++++
 cpu/arm1176/start.S                     |  469 ++++++++++++++++
 include/asm-arm/arch-s3c64xx/hardware.h |   63 +++
 include/common.h                        |    3 +-
 include/s3c6400.h                       |  884 +++++++++++++++++++++++++++++++
 include/s3c64x0.h                       |   92 ++++
 13 files changed, 2428 insertions(+), 1 deletions(-)
 create mode 100644 cpu/arm1176/Makefile
 create mode 100644 cpu/arm1176/config.mk
 create mode 100644 cpu/arm1176/cpu.c
 create mode 100644 cpu/arm1176/s3c64xx/Makefile
 create mode 100644 cpu/arm1176/s3c64xx/config.mk
 create mode 100644 cpu/arm1176/s3c64xx/cpu_init.S
 create mode 100644 cpu/arm1176/s3c64xx/interrupts.c
 create mode 100644 cpu/arm1176/s3c64xx/speed.c
 create mode 100644 cpu/arm1176/start.S
 create mode 100644 include/asm-arm/arch-s3c64xx/hardware.h
 create mode 100644 include/s3c6400.h
 create mode 100644 include/s3c64x0.h
cpu/arm1176/Makefile new file +50 -0
new file mode 100644
index 0000000..1ca9199
@@ -0,0 +1,50 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2008
+# Guennadi Liakhovetki, DENX Software Engineering, <[email protected]>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(CPU).a
+
+START	= start.o
+COBJS	= cpu.o
+
+SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
+START	:= $(addprefix $(obj),$(START))
+
+all:	$(obj).depend $(START) $(LIB)
+
+$(LIB):	$(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
cpu/arm1176/config.mk new file +35 -0
new file mode 100644
index 0000000..5083594
@@ -0,0 +1,35 @@
+#
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, <[email protected]>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
+	-msoft-float
+
+# Make ARMv5 to allow more compilers to work, even though its v6.
+PLATFORM_CPPFLAGS += -march=armv5t
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
cpu/arm1176/cpu.c new file +189 -0

189 lines not on this page · raw message

cpu/arm1176/s3c64xx/Makefile new file +48 -0

48 lines not on this page · raw message

cpu/arm1176/s3c64xx/config.mk new file +34 -0
new file mode 100644
index 0000000..204e880
@@ -0,0 +1,34 @@
+#
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, <[email protected]>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
+	-msoft-float
+
+# Make ARMv5 to allow more compilers to work, even though its v6.
+PLATFORM_CPPFLAGS += -march=armv5t
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+#PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
cpu/arm1176/s3c64xx/cpu_init.S new file +142 -0

142 lines not on this page · raw message

cpu/arm1176/s3c64xx/interrupts.c new file +280 -0

280 lines not on this page · raw message

cpu/arm1176/s3c64xx/speed.c new file +140 -0

140 lines not on this page · raw message

cpu/arm1176/start.S new file +469 -0

469 lines not on this page · raw message

include/asm-arm/arch-s3c64xx/hardware.h new file +63 -0

63 lines not on this page · raw message

include/common.h +2 -1
index 2fcb1fd..10d56e0 100644
@@ -489,7 +489,8 @@ int	prt_mpc8220_clks (void);
 ulong	get_OPB_freq (void);
 ulong	get_PCI_freq (void);
 #endif
-#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || defined(CONFIG_LH7A40X)
+#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || \
+	defined(CONFIG_LH7A40X) || defined(CONFIG_S3C6400)
 void	s3c2410_irq(void);
 #define ARM920_IRQ_CALLBACK s3c2410_irq
 ulong	get_FCLK (void);
include/s3c6400.h new file +884 -0

884 lines not on this page · raw message

include/s3c64x0.h new file +92 -0

92 lines not on this page · raw message

Signature · 1 line
1.5.4
#23 lore raw

PATCH v4 3/7 ARM: Add arm1176 core with s3c6400 SoC

This is a port of s3c6400 sources by Samsung from u-boot-1.1.6.

---

Sorry, there has been a stupid mistake in v3, please, take this one instead.

 cpu/arm1176/Makefile                    |   50 ++
 cpu/arm1176/config.mk                   |   35 ++
 cpu/arm1176/cpu.c                       |  189 +++++++
 cpu/arm1176/s3c64xx/Makefile            |   48 ++
 cpu/arm1176/s3c64xx/config.mk           |   34 ++
 cpu/arm1176/s3c64xx/cpu_init.S          |  142 +++++
 cpu/arm1176/s3c64xx/interrupts.c        |  280 ++++++++++
 cpu/arm1176/s3c64xx/speed.c             |  140 +++++
 cpu/arm1176/start.S                     |  469 ++++++++++++++++
 include/asm-arm/arch-s3c64xx/hardware.h |   63 +++
 include/common.h                        |    3 +-
 include/s3c6400.h                       |  884 +++++++++++++++++++++++++++++++
 include/s3c64x0.h                       |   92 ++++
 13 files changed, 2428 insertions(+), 1 deletions(-)
 create mode 100644 cpu/arm1176/Makefile
 create mode 100644 cpu/arm1176/config.mk
 create mode 100644 cpu/arm1176/cpu.c
 create mode 100644 cpu/arm1176/s3c64xx/Makefile
 create mode 100644 cpu/arm1176/s3c64xx/config.mk
 create mode 100644 cpu/arm1176/s3c64xx/cpu_init.S
 create mode 100644 cpu/arm1176/s3c64xx/interrupts.c
 create mode 100644 cpu/arm1176/s3c64xx/speed.c
 create mode 100644 cpu/arm1176/start.S
 create mode 100644 include/asm-arm/arch-s3c64xx/hardware.h
 create mode 100644 include/s3c6400.h
 create mode 100644 include/s3c64x0.h
cpu/arm1176/Makefile new file +50 -0
new file mode 100644
index 0000000..1ca9199
@@ -0,0 +1,50 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2008
+# Guennadi Liakhovetki, DENX Software Engineering, <[email protected]>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(CPU).a
+
+START	= start.o
+COBJS	= cpu.o
+
+SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
+START	:= $(addprefix $(obj),$(START))
+
+all:	$(obj).depend $(START) $(LIB)
+
+$(LIB):	$(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
cpu/arm1176/config.mk new file +35 -0
new file mode 100644
index 0000000..5083594
@@ -0,0 +1,35 @@
+#
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, <[email protected]>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
+	-msoft-float
+
+# Make ARMv5 to allow more compilers to work, even though its v6.
+PLATFORM_CPPFLAGS += -march=armv5t
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
cpu/arm1176/cpu.c new file +189 -0

189 lines not on this page · raw message

cpu/arm1176/s3c64xx/Makefile new file +48 -0

48 lines not on this page · raw message

cpu/arm1176/s3c64xx/config.mk new file +34 -0
new file mode 100644
index 0000000..204e880
@@ -0,0 +1,34 @@
+#
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, <[email protected]>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 \
+	-msoft-float
+
+# Make ARMv5 to allow more compilers to work, even though its v6.
+PLATFORM_CPPFLAGS += -march=armv5t
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+#PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
cpu/arm1176/s3c64xx/cpu_init.S new file +142 -0

142 lines not on this page · raw message

cpu/arm1176/s3c64xx/interrupts.c new file +280 -0

280 lines not on this page · raw message

cpu/arm1176/s3c64xx/speed.c new file +140 -0

140 lines not on this page · raw message

cpu/arm1176/start.S new file +469 -0

469 lines not on this page · raw message

include/asm-arm/arch-s3c64xx/hardware.h new file +63 -0

63 lines not on this page · raw message

include/common.h +2 -1
index 2fcb1fd..10d56e0 100644
@@ -489,7 +489,8 @@ int	prt_mpc8220_clks (void);
 ulong	get_OPB_freq (void);
 ulong	get_PCI_freq (void);
 #endif
-#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || defined(CONFIG_LH7A40X)
+#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || \
+	defined(CONFIG_LH7A40X) || defined(CONFIG_S3C6400)
 void	s3c2410_irq(void);
 #define ARM920_IRQ_CALLBACK s3c2410_irq
 ulong	get_FCLK (void);
include/s3c6400.h new file +884 -0

884 lines not on this page · raw message

include/s3c64x0.h new file +92 -0

92 lines not on this page · raw message

Signature · 1 line
1.5.4
#24 lore raw

PATCH v3 4/7 USB: Add support for OHCI controller on s3c6400

In reply to Guennadi Liakhovetski

Notice: USB on s3c6400 currently works _only_ with switched off MMU. One could try to enable the MMU, but map addresses 1-to-1, and disable data cache, then it should work too and we could still profit from instruction cache.

---
 cpu/arm1176/s3c64xx/Makefile |    1 +
 cpu/arm1176/s3c64xx/usb.c    |   45 ++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/usb_ohci.c       |    1 +
 3 files changed, 47 insertions(+), 0 deletions(-)
 create mode 100644 cpu/arm1176/s3c64xx/usb.c
cpu/arm1176/s3c64xx/Makefile +1 -0
index fa4ee3f..4ab1811 100644
@@ -30,6 +30,7 @@ LIB	= $(obj)lib$(SOC).a
 
 COBJS-y	= interrupts.o
 COBJS-$(CONFIG_S3C6400)	+= cpu_init.o speed.o
+COBJS-$(CONFIG_USB_OHCI_NEW) += usb.o
 
 OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS-y))
 
cpu/arm1176/s3c64xx/usb.c new file +45 -0

45 lines not on this page · raw message

drivers/usb/usb_ohci.c +1 -0
index fd60edb..0bfa4d7 100644
@@ -69,6 +69,7 @@
 #if defined(CONFIG_ARM920T) || \
     defined(CONFIG_S3C2400) || \
     defined(CONFIG_S3C2410) || \
+    defined(CONFIG_S3C6400) || \
     defined(CONFIG_440EP) || \
     defined(CONFIG_PCI_OHCI) || \
     defined(CONFIG_MPC5200) || \
Signature · 1 line
1.5.4
#25 lore raw

PATCH v3 4/7 USB: Add support for OHCI controller on s3c6400

diff --git a/drivers/usb/usb_ohci.c b/drivers/usb/usb_ohci.c

drivers/usb/usb_ohci.c line 75

Quoted 11 lines

index fd60edb..0bfa4d7 100644

drivers/usb/usb_ohci.c +1 -0
@@ -69,6 +69,7 @@
 #if defined(CONFIG_ARM920T) || \
     defined(CONFIG_S3C2400) || \
     defined(CONFIG_S3C2410) || \
+    defined(CONFIG_S3C6400) || \
     defined(CONFIG_440EP) || \
     defined(CONFIG_PCI_OHCI) || \
     defined(CONFIG_MPC5200) || \

Can we start to avoid 10km if defined in the code?

Maybe we can find an other way do it?

Best Regards,
J.

#26 lore raw

PATCH v3 4/7 USB: Add support for OHCI controller on s3c6400

Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD

diff --git a/drivers/usb/usb_ohci.c b/drivers/usb/usb_ohci.c

drivers/usb/usb_ohci.c line 75

Quoted 11 lines

index fd60edb..0bfa4d7 100644

drivers/usb/usb_ohci.c +1 -0
@@ -69,6 +69,7 @@
 #if defined(CONFIG_ARM920T) || \
     defined(CONFIG_S3C2400) || \
     defined(CONFIG_S3C2410) || \
+    defined(CONFIG_S3C6400) || \
     defined(CONFIG_440EP) || \
     defined(CONFIG_PCI_OHCI) || \
     defined(CONFIG_MPC5200) || \

Can we start to avoid 10km if defined in the code?

Quoted 1 line

Maybe we can find an other way do it?

Sure, I think, the USB-custodian will be glad to see patches.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

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

#27 lore raw

PATCH v3 5/7 serial: add s3c64xx serial driver

In reply to Guennadi Liakhovetski

Ported from u-boot-1.1.6 driver by Samsung.

---

Also added my copyright to the driver.

 drivers/serial/Makefile  |    1 +
 drivers/serial/s3c64xx.c |  189 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 190 insertions(+), 0 deletions(-)
 create mode 100644 drivers/serial/s3c64xx.c
drivers/serial/Makefile +1 -0
index c9e797e..2a11ae5 100644
@@ -30,6 +30,7 @@ COBJS-y += mcfuart.o
 COBJS-y += ns9750_serial.o
 COBJS-y += ns16550.o
 COBJS-y += s3c4510b_uart.o
+COBJS-$(CONFIG_S3C64XX) += s3c64xx.o
 COBJS-y += serial.o
 COBJS-y += serial_max3100.o
 COBJS-y += serial_pl010.o
drivers/serial/s3c64xx.c new file +189 -0

189 lines not on this page · raw message

Signature · 1 line
1.5.4
#28 lore raw

PATCH v3 5/7 serial: add s3c64xx serial driver

Quoted 17 lines · Guennadi Liakhovetski

Ported from u-boot-1.1.6 driver by Samsung.

---

Also added my copyright to the driver.

 drivers/serial/Makefile  |    1 +
 drivers/serial/s3c64xx.c |  189 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 190 insertions(+), 0 deletions(-)
 create mode 100644 drivers/serial/s3c64xx.c
drivers/serial/Makefile +0 -0
index c9e797e..2a11ae5 100644

drivers/serial/Makefile COBJS-y += mcfuart.o · line 36

Quoted 7 lines
drivers/serial/Makefile +1 -0
@@ -30,6 +30,7 @@ COBJS-y += mcfuart.o
 COBJS-y += ns9750_serial.o
 COBJS-y += ns16550.o
 COBJS-y += s3c4510b_uart.o
+COBJS-$(CONFIG_S3C64XX) += s3c64xx.o
 COBJS-y += serial.o
 COBJS-y += serial_max3100.o
 COBJS-y += serial_pl010.o

I've send a patch that break it.

Could you rebase it on the current Wolfgang tree HEAD?

Quoted 57 lines
drivers/serial/s3c64xx.c new file +51 -0
new file mode 100644
index 0000000..9580909
@@ -0,0 +1,189 @@
+/*
+ * (C) Copyright 2002
+ * Gary Jennejohn, DENX Software Engineering, <[email protected]>
+ *
+ * (C) Copyright 2008
+ * Guennadi Liakhovetki, DENX Software Engineering, <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include <common.h>
+
+#include <s3c6400.h>
+
+#ifdef CONFIG_SERIAL1
+#define UART_NR	S3C64XX_UART0
+
+#elif defined(CONFIG_SERIAL2)
+#define UART_NR	S3C64XX_UART1
+
+#elif defined(CONFIG_SERIAL3)
+#define UART_NR	S3C64XX_UART2
+
+#else
+#error "Bad: you didn't configure serial ..."
+#endif
+
+#define barrier() asm volatile("" ::: "memory")
+
+/* See table in 31.6.11 */
+static const int udivslot[] = {
+	0,
+	0x0080,
+	0x0808,
+	0x0888,
+	0x2222,
+	0x4924,
+	0x4a52,

drivers/serial/s3c64xx.c line 61

Quoted 10 lines
drivers/serial/s3c64xx.c new file +10 -0
+	0x54aa,
+	0x5555,
+	0xd555,
+	0xd5d5,
+	0xddd5,
+	0xdddd,
+	0xdfdd,
+	0xdfdf,
+	0xffdf,
+};

Can we have something more readable?

drivers/serial/s3c64xx.c line 67

Quoted 6 lines
drivers/serial/s3c64xx.c new file +6 -0
+
+void serial_setbrg(void)
+{
+	DECLARE_GLOBAL_DATA_PTR;
+	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR);
+	u32 reg, pclk_ratio = get_PCLK() / gd->baudrate;

why not

	u32 reg;
	u32 pclk_ratio = get_PCLK() / gd->baudrate;

drivers/serial/s3c64xx.c line 72

Quoted 5 lines
drivers/serial/s3c64xx.c new file +5 -0
+	int i;
+
+	/* PCLK / (16 * baudrate) - 1 */
+	reg = pclk_ratio / 16 - 1;
+	i = pclk_ratio - (reg + 1) * 16;

=>

	i = pclk_ratio - (pclk_ratio / 16 - 1 + 1) * 16;
=>
	i = pclk_ratio - (pclk_ratio / 16 ) * 16;
=>
	i = pclk_ratio - pclk_ratio;
=>
	i = 0;

drivers/serial/s3c64xx.c line 75

Quoted 3 lines
drivers/serial/s3c64xx.c new file +3 -0
+
+	uart->UBRDIV = reg;
+	uart->UDIVSLOT = udivslot[i];

base on the cose

	uart->UDIVSLOT = udivslot[0];

drivers/serial/s3c64xx.c line 119

Quoted 7 lines
drivers/serial/s3c64xx.c new file +7 -0
+
+	for (i = 0; i < 100; i++)
+		barrier();
+}
+
+#ifdef CONFIG_HWFLOW
+static int hwflow;		/* turned off by default */

why not?
static int hwflow = 0; /* turned off by default */

Quoted 6 lines
drivers/serial/s3c64xx.c new file +6 -0
+int hwflow_onoff(int on)
+{
+	switch (on) {
+	case 1:
+		hwflow = 1;	/* turn on */
+		break;

drivers/serial/s3c64xx.c line 135

Quoted 10 lines
drivers/serial/s3c64xx.c new file +10 -0
+	case -1:
+		hwflow = 0;	/* turn off */
+		break;
+	}
+	return hwflow;
+}
+#endif
+
+#ifdef CONFIG_MODEM_SUPPORT
+static int be_quiet;

why not?
static int be_quiet = 0;

drivers/serial/s3c64xx.c line 146

Quoted 11 lines
drivers/serial/s3c64xx.c new file +11 -0
+void disable_putc(void)
+{
+	be_quiet = 1;
+}
+
+void enable_putc(void)
+{
+	be_quiet = 0;
+}
+#endif
+

Best Regards,

J.

#29 lore raw

PATCH v3 5/7 serial: add s3c64xx serial driver

Quoted 27 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 17 lines · Guennadi Liakhovetski

Ported from u-boot-1.1.6 driver by Samsung.

---

Also added my copyright to the driver.

 drivers/serial/Makefile  |    1 +
 drivers/serial/s3c64xx.c |  189 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 190 insertions(+), 0 deletions(-)
 create mode 100644 drivers/serial/s3c64xx.c
drivers/serial/Makefile +0 -0
index c9e797e..2a11ae5 100644

drivers/serial/Makefile COBJS-y += mcfuart.o · line 36

Quoted 7 lines
drivers/serial/Makefile +1 -0
@@ -30,6 +30,7 @@ COBJS-y += mcfuart.o
 COBJS-y += ns9750_serial.o
 COBJS-y += ns16550.o
 COBJS-y += s3c4510b_uart.o
+COBJS-$(CONFIG_S3C64XX) += s3c64xx.o
 COBJS-y += serial.o
 COBJS-y += serial_max3100.o
 COBJS-y += serial_pl010.o

I've send a patch that break it.

Quoted 1 line

Could you rebase it on the current Wolfgang tree HEAD?

Ok, will have a look.

Quoted 12 lines
Quoted 12 lines
drivers/serial/Makefile +12 -0
+/* See table in 31.6.11 */
+static const int udivslot[] = {
+	0,
+	0x0080,
+	0x0808,
+	0x0888,
+	0x2222,
+	0x4924,
+	0x4a52,
+	0x54aa,
+	0x5555,
+	0xd555,
Quoted 8 lines

drivers/serial/Makefile

Quoted 7 lines
drivers/serial/Makefile +7 -0
+	0xd5d5,
+	0xddd5,
+	0xdddd,
+	0xdfdd,
+	0xdfdf,
+	0xffdf,
+};

Can we have something more readable?

No. This are "recommended values" as mentioned in the comment to the table referenced above.

Quoted 8 lines

drivers/serial/Makefile

Quoted 5 lines
drivers/serial/Makefile +5 -0
+void serial_setbrg(void)
+{
+	DECLARE_GLOBAL_DATA_PTR;
+	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR);
+	u32 reg, pclk_ratio = get_PCLK() / gd->baudrate;

why not

	u32 reg;
	u32 pclk_ratio = get_PCLK() / gd->baudrate;

There is more than one way to do it.

Quoted 6 lines

drivers/serial/Makefile

Quoted 5 lines
drivers/serial/Makefile +5 -0
+	int i;
+
+	/* PCLK / (16 * baudrate) - 1 */
+	reg = pclk_ratio / 16 - 1;
+	i = pclk_ratio - (reg + 1) * 16;

=>

Quoted 7 lines
	i = pclk_ratio - (pclk_ratio / 16 - 1 + 1) * 16;
=>
	i = pclk_ratio - (pclk_ratio / 16 ) * 16;
=>
	i = pclk_ratio - pclk_ratio;
=>
	i = 0;

Please, think again. This is integer arithmetics, not analysis.

Quoted 5 lines

drivers/serial/Makefile

Quoted 3 lines
drivers/serial/Makefile +3 -0
+
+	uart->UBRDIV = reg;
+	uart->UDIVSLOT = udivslot[i];

base on the cose

	uart->UDIVSLOT = udivslot[0];

See above.

Quoted 3 lines
Quoted 1 line

+static int hwflow; /* turned off by default */

why not?
static int hwflow = 0; /* turned off by default */

Because static are always initialised to 0, and, in fact, checkpatch.pl produces warnings on these, and rightfully so.

Quoted 3 lines
Quoted 1 line

+static int be_quiet;

why not?
static int be_quiet = 0;

See above.

Thanks for your comments
Guennadi
---
Guennadi Liakhovetski, Ph.D.

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

#30 lore raw

PATCH v3 5/7 serial: add s3c64xx serial driver

Quoted 22 lines · In message <[email protected]> you wrote:
Quoted 13 lines
Quoted 13 lines
drivers/serial/s3c64xx.c new file +12 -0
+/* See table in 31.6.11 */
+static const int udivslot[] = {
+	0,
+	0x0080,
+	0x0808,
+	0x0888,
+	0x2222,
+	0x4924,
+	0x4a52,
+	0x54aa,
+	0x5555,
+	0xd555,
Quoted 8 lines

drivers/serial/s3c64xx.c line 61

Quoted 7 lines
drivers/serial/s3c64xx.c new file +7 -0
+	0xd5d5,
+	0xddd5,
+	0xdddd,
+	0xdfdd,
+	0xdfdf,
+	0xffdf,
+};

Can we have something more readable?

Quoted 2 lines

No. This are "recommended values" as mentioned in the comment to the table referenced above.

Bout perhaps you could add some documentation what all these magic numbers mean? Of course we can all download the documetnation, study it for hours and finally uinderstand this, too - but it would be nicer if you could save us this effort.

Quoted 6 lines
Quoted 4 lines

drivers/serial/s3c64xx.c line 67

Quoted 1 line
drivers/serial/s3c64xx.c new file +1 -0
+	u32 reg, pclk_ratio = get_PCLK() / gd->baudrate;

why not

	u32 reg;
	u32 pclk_ratio = get_PCLK() / gd->baudrate;

There is more than one way to do it.

Indeed. But the one that is better readable is preferred.

Quoted 12 lines
Quoted 11 lines

drivers/serial/s3c64xx.c line 72

Quoted 3 lines
drivers/serial/s3c64xx.c new file +3 -0
+	/* PCLK / (16 * baudrate) - 1 */
+	reg = pclk_ratio / 16 - 1;
+	i = pclk_ratio - (reg + 1) * 16;

=>

	i = pclk_ratio - (pclk_ratio / 16 - 1 + 1) * 16;
=>
	i = pclk_ratio - (pclk_ratio / 16 ) * 16;
=>
	i = pclk_ratio - pclk_ratio;
=>
	i = 0;
Quoted 1 line

Please, think again. This is integer arithmetics, not analysis.

So perhaps you want to elucidate your code in a comment?

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
grep me no patterns and I'll tell you no lines.
#31 lore raw

PATCH v3 6/7 NAND: add NAND driver for s3c64xx

In reply to Guennadi Liakhovetski

Ported from u-boot-1.1.6 driver by Samsung.

---
 drivers/mtd/nand/Makefile  |    1 +
 drivers/mtd/nand/s3c64xx.c |  307 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 308 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/s3c64xx.c
drivers/mtd/nand/Makefile +1 -0
index 7bd22a0..236cf03 100644
@@ -33,6 +33,7 @@ COBJS-y += nand_bbt.o
 COBJS-y += nand_util.o
 
 COBJS-y += fsl_upm.o
+COBJS-$(CONFIG_NAND_S3C64XX) += s3c64xx.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/mtd/nand/s3c64xx.c new file +307 -0

307 lines not on this page · raw message

Signature · 1 line
1.5.4
#32 lore raw

PATCH v3 6/7 NAND: add NAND driver for s3c64xx

Quoted 12 lines · Guennadi Liakhovetski
drivers/mtd/nand/s3c64xx.c new file +12 -0
+#ifdef CONFIG_NAND_SPL
+static u_char nand_read_byte(struct mtd_info *mtd)
+{
+	struct nand_chip *this = mtd->priv;
+	return readb(this->IO_ADDR_R);
+}
+
+static void nand_write_byte(struct mtd_info *mtd, u_char byte)
+{
+	struct nand_chip *this = mtd->priv;
+	writeb(byte, this->IO_ADDR_W);
+}

drivers/mtd/nand/s3c64xx.c line 80

Quoted 10 lines
drivers/mtd/nand/s3c64xx.c new file +10 -0
+
+static void nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
+{
+	int i;
+	struct nand_chip *this = mtd->priv;
+
+	for (i = 0; i < len; i++)
+		buf[i] = readb(this->IO_ADDR_R);
+}
+#endif

We should probably move this under nand_spl/, and let boards select it if they need it.

Quoted 19 lines
drivers/mtd/nand/s3c64xx.c new file +19 -0
+/*
+ * Hardware specific access to control-lines function
+ * Written by jsgood
+ */
+static void s3c_nand_hwcontrol(struct mtd_info *mtd, int cmd)
+{
+	struct nand_chip *this = mtd->priv;
+
+	switch (cmd) {
+	case NAND_CTL_SETCLE:
+		this->IO_ADDR_W = (void __iomem *)NFCMMD;
+		break;
+	case NAND_CTL_CLRCLE:
+		this->IO_ADDR_W = (void __iomem *)NFDATA;
+		break;
+	case NAND_CTL_SETALE:
+		this->IO_ADDR_W = (void __iomem *)NFADDR;
+		break;
+	case NAND_CTL_CLRALE:

drivers/mtd/nand/s3c64xx.c line 131

Quoted 10 lines
drivers/mtd/nand/s3c64xx.c new file +10 -0
+		this->IO_ADDR_W = (void __iomem *)NFDATA;
+		break;
+	case NAND_CTL_SETNCE:
+		s3c_nand_select_chip(mtd, 0);
+		break;
+	case NAND_CTL_CLRNCE:
+		s3c_nand_select_chip(mtd, -1);
+		break;
+	}
+}

This interface has changed in u-boot-nand-flash/testing. Can you rebase against it?

-Scott

#33 lore raw

PATCH v3 7/7 ARM: Add support for S3C6400 based SMDK6400 board

In reply to Guennadi Liakhovetski

SMDK6400 can only boot U-Boot from NAND-flash. This patch adds a nand_spl driver for it too. The board can also boot from the NOR flash, but due to hardware limitations it can only address 64KiB on it, which is not enough for U-Boot. Ported from u-boot-1.1.6 version by Samsung.

---
 MAKEALL                                    |    1 +
 Makefile                                   |   17 ++
 board/samsung/smdk6400/Makefile            |   54 +++++
 board/samsung/smdk6400/config.mk           |   30 +++
 board/samsung/smdk6400/lowlevel_init.S     |  316 ++++++++++++++++++++++++++++
 board/samsung/smdk6400/smdk6400.c          |  130 ++++++++++++
 board/samsung/smdk6400/u-boot-nand.lds     |   62 ++++++
 include/configs/smdk6400.h                 |  304 ++++++++++++++++++++++++++
 nand_spl/board/samsung/smdk6400/Makefile   |  106 ++++++++++
 nand_spl/board/samsung/smdk6400/config.mk  |   40 ++++
 nand_spl/board/samsung/smdk6400/u-boot.lds |   61 ++++++
 11 files changed, 1121 insertions(+), 0 deletions(-)
 create mode 100644 board/samsung/smdk6400/Makefile
 create mode 100644 board/samsung/smdk6400/config.mk
 create mode 100644 board/samsung/smdk6400/lowlevel_init.S
 create mode 100644 board/samsung/smdk6400/smdk6400.c
 create mode 100644 board/samsung/smdk6400/u-boot-nand.lds
 create mode 100644 include/configs/smdk6400.h
 create mode 100644 nand_spl/board/samsung/smdk6400/Makefile
 create mode 100644 nand_spl/board/samsung/smdk6400/config.mk
 create mode 100644 nand_spl/board/samsung/smdk6400/u-boot.lds
MAKEALL +1 -0
index ee83cca..a3ed47d 100755
@@ -515,6 +515,7 @@ LIST_ARM11="		\
 	imx31_litekit	\
 	imx31_phycore	\
 	mx31ads		\
+	smdk6400	\
 "
 
 #########################################################################
Makefile +17 -0
index b104617..0c5b8a6 100644
@@ -2677,6 +2677,23 @@ mx31ads_config		: unconfig
 omap2420h4_config	: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm1136 omap2420h4 NULL omap24xx
 
+#########################################################################
+## ARM1176 Systems
+#########################################################################
+smdk6400_noUSB_config	\
+smdk6400_config	:	unconfig
+	@mkdir -p $(obj)include $(obj)board/samsung/smdk6400
+	@mkdir -p $(obj)nand_spl/board/samsung/smdk6400
+	@echo "#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h
+	@if [ -z "$(findstring smdk6400_noUSB_config,$@)" ]; then			\
+		echo "RAM_TEXT = 0x57e00000" >> $(obj)board/samsung/smdk6400/config.tmp;\
+		$(MKCONFIG) $(@:_config=) arm arm1176 smdk6400 samsung s3c64xx;		\
+	else										\
+		echo "RAM_TEXT = 0xc7e00000" >> $(obj)board/samsung/smdk6400/config.tmp;\
+		$(MKCONFIG) $(@:_noUSB_config=) arm arm1176 smdk6400 samsung s3c64xx;	\
+	fi
+	@echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
+
 #========================================================================
 # i386
 #========================================================================
board/samsung/smdk6400/Makefile new file +54 -0

54 lines not on this page · raw message

board/samsung/smdk6400/config.mk new file +30 -0
new file mode 100644
index 0000000..298d387
@@ -0,0 +1,30 @@
+#
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, <[email protected]>
+# David Mueller, ELSOFT AG, <[email protected]>
+#
+# (C) Copyright 2008
+# Guennadi Liakhovetki, DENX Software Engineering, <[email protected]>
+#
+# SAMSUNG SMDK6400 board with mDirac3 (ARM1176) cpu
+#
+# see http://www.samsung.com/ for more information on SAMSUNG
+
+# On SMDK6400 we use the 64 MB SDRAM bank at
+#
+# 0x50000000 to 0x58000000
+#
+# Linux-Kernel is expected to be at 0x50008000, entry 0x50008000
+#
+# we load ourselves to 0x57e00000 without MMU
+# with MMU, load address is changed to 0xc7e00000
+#
+# download area is 0x5000c000
+
+sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
+
+ifndef CONFIG_NAND_SPL
+TEXT_BASE = $(RAM_TEXT)
+else
+TEXT_BASE = 0
+endif
board/samsung/smdk6400/lowlevel_init.S new file +316 -0

316 lines not on this page · raw message

board/samsung/smdk6400/smdk6400.c new file +130 -0

130 lines not on this page · raw message

board/samsung/smdk6400/u-boot-nand.lds new file +62 -0

62 lines not on this page · raw message

include/configs/smdk6400.h new file +304 -0

304 lines not on this page · raw message

nand_spl/board/samsung/smdk6400/Makefile new file +106 -0

106 lines not on this page · raw message

nand_spl/board/samsung/smdk6400/config.mk new file +40 -0
new file mode 100644
index 0000000..4b16230
@@ -0,0 +1,40 @@
+#
+# (C) Copyright 2006
+# Stefan Roese, DENX Software Engineering, sr at denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Samsung S3C64xx Reference Platform (smdk6400) board
+
+# TEXT_BASE for SPL:
+#
+# On S3C64xx platforms the SPL is located in SRAM@0.
+#
+# TEXT_BASE = 0
+
+include $(TOPDIR)/board/$(BOARDDIR)/config.mk
+
+# PAD_TO used to generate a 4kByte binary needed for the combined image
+# -> PAD_TO = TEXT_BASE + 4096
+PAD_TO	:= $(shell expr $$[$(TEXT_BASE) + 4096])
+
+ifeq ($(debug),1)
+PLATFORM_CPPFLAGS += -DDEBUG
+endif
nand_spl/board/samsung/smdk6400/u-boot.lds new file +61 -0

61 lines not on this page · raw message

Signature · 1 line
1.5.4
#34 lore raw

PATCH v3 7/7 ARM: Add support for S3C6400 based SMDK6400 board

This is just to apologise for not CC-ing the ARM-maintainer in the original post. I did forward him the patch afterwards, sorry.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.

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

#35 lore raw

PATCH 6/7 NAND: add NAND driver for s3c64xx

In reply to Guennadi Liakhovetski
Quoted 25 lines
drivers/mtd/nand/s3c64xx.c new file +25 -0
+/*
+ * (C) Copyright 2006 DENX Software Engineering
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+
+#include <nand.h>

drivers/mtd/nand/s3c64xx.c line 35

Quoted 10 lines
drivers/mtd/nand/s3c64xx.c new file +10 -0
+#include <s3c6400.h>
+
+#include <asm/io.h>
+
+#ifdef CONFIG_NAND_SPL
+#define printf(arg...) do {} while (0)
+#endif
+
+/* Nand flash definition values by jsgood */
+#define S3C_NAND_CFG_HWECC

Please move to config file

Quoted 1 line

+#undef S3C_NAND_DEBUG

please remove

Quoted 14 lines
drivers/mtd/nand/s3c64xx.c new file +14 -0
+
+#ifdef S3C_NAND_DEBUG
+/*
+ * Function to print out oob buffer for debugging
+ * Written by jsgood
+ */
+static void print_oob(const char *header, struct mtd_info *mtd)
+{
+	int i;
+	struct nand_chip *chip = mtd->priv;
+
+	printf("%s:\t", header);
+
+	for(i = 0; i < 64; i++)

drivers/mtd/nand/s3c64xx.c line 60

Quoted 10 lines
drivers/mtd/nand/s3c64xx.c new file +10 -0
+		printf("%02x ", chip->oob_poi[i]);
+
+	printf("\n");
+}
+#endif /* S3C_NAND_DEBUG */
+
+#ifdef CONFIG_NAND_SPL
+static u_char nand_read_byte(struct mtd_info *mtd)
+{
+	struct nand_chip *this = mtd->priv;

add an empty line

drivers/mtd/nand/s3c64xx.c line 66

Quoted 6 lines
drivers/mtd/nand/s3c64xx.c new file +6 -0
+	return readb(this->IO_ADDR_R);
+}
+
+static void nand_write_byte(struct mtd_info *mtd, u_char byte)
+{
+	struct nand_chip *this = mtd->priv;

add an empty line

Quoted 41 lines
(quoted diff) +41 -0
+	writeb(byte, this->IO_ADDR_W);
+}
+
+static void nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
+{
+	int i;
+	struct nand_chip *this = mtd->priv;
+
+	for (i = 0; i < len; i++)
+		buf[i] = readb(this->IO_ADDR_R);
+}
+#endif
+
+/*
+ * This function determines whether read data is good or not.
+ * If SLC, must write ecc codes to controller before reading status bit.
+ * If MLC, status bit is already set, so only reading is needed.
+ * If status bit is good, return 0.
+ * If correctable errors occured, do that.
+ * If uncorrectable errors occured, return -1.
+ * Written by jsgood
+ */
+static int s3c_nand_correct_data(struct mtd_info *mtd, u_char *dat,
+				 u_char *read_ecc, u_char *calc_ecc)
+{
+	int ret = -1;
+	u_long nfestat0, nfmeccdata0, nfmeccdata1;
+	u_char err_type;
+
+	/* SLC: Write ecc to compare */
+	nfmeccdata0 = (calc_ecc[1] << 16) | calc_ecc[0];
+	nfmeccdata1 = (calc_ecc[3] << 16) | calc_ecc[2];
+	writel(nfmeccdata0, NFMECCDATA0);
+	writel(nfmeccdata1, NFMECCDATA1);
+
+	/* Read ecc status */
+	nfestat0 = readl(NFESTAT0);
+	err_type = nfestat0 & 0x3;
+
+	switch (err_type) {
+	case 0: /* No error */

Review

Quoted 10 lines
(quoted diff) +10 -0
+		ret = 0;
+		break;
+
+	case 1: /* 1 bit error (Correctable)
+		   (nfestat0 >> 7) & 0x7ff	:error byte number
+		   (nfestat0 >> 4) & 0x7	:error bit number */
+		printf("S3C NAND: 1 bit error detected at byte %ld. Correcting from "
+		       "0x%02x ", (nfestat0 >> 7) & 0x7ff, dat[(nfestat0 >> 7) & 0x7ff]);
+		dat[(nfestat0 >> 7) & 0x7ff] ^= (1 << ((nfestat0 >> 4) & 0x7));
+		printf("to 0x%02x...OK\n", dat[(nfestat0 >> 7) & 0x7ff]);

could use inline or macro to be more readable

Quoted 23 lines
drivers/mtd/nand/s3c64xx.c new file +23 -0
+		ret = 1;
+		break;
+
+	case 2: /* Multiple error */
+	case 3: /* ECC area error */
+		printf("S3C NAND: ECC uncorrectable error detected. Not correctable.\n");
+		ret = -1;
+		break;
+	}
+
+	return ret;
+}
+#endif /* S3C_NAND_CFG_HWECC */
+
+/*
+ * Board-specific NAND initialization. The following members of the
+ * argument are board-specific (per include/linux/mtd/nand.h):
+ * - IO_ADDR_R?: address to read the 8 I/O lines of the flash device
+ * - IO_ADDR_W?: address to write the 8 I/O lines of the flash device
+ * - hwcontrol: hardwarespecific function for accesing control-lines
+ * - dev_ready: hardwarespecific function for  accesing device ready/busy line
+ * - enable_hwecc?: function to enable (reset)  hardware ecc generator. Must
+ *   only be provided if a hardware ECC is available

drivers/mtd/nand/s3c64xx.c line 267

Quoted 10 lines
drivers/mtd/nand/s3c64xx.c new file +10 -0
+ * - eccmode: mode of ecc, see defines
+ * - chip_delay: chip dependent delay for transfering data from array to
+ *   read regs (tR)
+ * - options: various chip options. They can partly be set to inform
+ *   nand_scan about special functionality. See the defines for further
+ *   explanation
+ * Members with a "?" were not set in the merged testing-NAND branch,
+ * so they are not set here either.
+ */
+#include <linux/mtd/mtd.h>

move to the top

drivers/mtd/nand/s3c64xx.c line 277

Quoted 10 lines
drivers/mtd/nand/s3c64xx.c new file +10 -0
+int board_nand_init(struct nand_chip *nand)
+{
+	NFCONT_REG 		= (NFCONT_REG & ~NFCONT_WP) | NFCONT_ENABLE | 0x6;
+
+	nand->IO_ADDR_R		= (void __iomem *)NFDATA;
+	nand->IO_ADDR_W		= (void __iomem *)NFDATA;
+	nand->hwcontrol		= s3c_nand_hwcontrol;
+	nand->dev_ready		= s3c_nand_device_ready;
+	nand->select_chip	= s3c_nand_select_chip;
+	nand->options		= 0;

Best Regards,
J.