Skip to contentSkip to conversation

SMDK6400 support

PATCH Superseded Guennadi Liakhovetski 7 participants 35 messages Aug 6, 2008 – Aug 11, 2008

Subsystems (6)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover SMDK6400 support

Version 6: this time, based on the updated nand-testing branch with the latest patch from Scott Wood - thanks again, run-tested. Updates since version 5: restored original bad-block detection in nand_spl/nand_boot.c with only necessary changes to support non block-aligned images, use the chipselect and compile on ARM. Patch 1/7 is gone, as Stefan accepted version 5 (he's had enough of these cc's probably:-))

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

#1 lore raw

PATCH v6 2/7 nand_spl: Support page-aligned read in nand_load, use chipselect

Supporting page-aligned reads doesn't incure any sinificant overhead, just a small change in the algorithm. Also replace in_8 with readb, since there is no in_8 on ARM.

---
 nand_spl/nand_boot.c |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)
nand_spl/nand_boot.c +17 -5
index 81b4dfc..02ccfa8 100644
@@ -131,7 +131,7 @@ static int nand_is_bad_block(struct mtd_info *mtd, int block)
 	/*
 	 * Read one byte
 	 */
-	if (in_8(this->IO_ADDR_R) != 0xff)
+	if (readb(this->IO_ADDR_R) != 0xff)
 		return 1;
 
 	return 0;
@@ -186,24 +186,30 @@ static int nand_read_page(struct mtd_info *mtd, int block, int page, uchar *dst)
 
 static int nand_load(struct mtd_info *mtd, int offs, int uboot_size, uchar *dst)
 {
-	int block;
+	int block, blocks;
 	int blockcopy_count;
 	int page;
+	unsigned int read = 0;
 
 	/*
-	 * offs has to be aligned to a block address!
+	 * offs has to be aligned to a page address!
 	 */
 	block = offs / CFG_NAND_BLOCK_SIZE;
+	blocks = (uboot_size + offs - ((block - 1) * CFG_NAND_BLOCK_SIZE) - 1) /
+		CFG_NAND_BLOCK_SIZE;
 	blockcopy_count = 0;
 
-	while (blockcopy_count < (uboot_size / CFG_NAND_BLOCK_SIZE)) {
+	while (blockcopy_count < blocks) {
 		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;
+				/* Overwrite skipped pages */
+				if (read >= offs)
+					dst += CFG_NAND_PAGE_SIZE;
+				read += CFG_NAND_PAGE_SIZE;
 			}
 
 			blockcopy_count++;
@@ -235,12 +241,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
#2 lore raw

PATCH v6 2/7 nand_spl: Support page-aligned read in nand_load, use chipselect

Quoted 8 lines · Guennadi Liakhovetski
nand_spl/nand_boot.c +3 -1
 	block = offs / CFG_NAND_BLOCK_SIZE;
+	blocks = (uboot_size + offs - ((block - 1) * CFG_NAND_BLOCK_SIZE) - 1) /
+		CFG_NAND_BLOCK_SIZE;
 	blockcopy_count = 0;
 
-	while (blockcopy_count < (uboot_size / CFG_NAND_BLOCK_SIZE)) {
+	while (blockcopy_count < blocks) {
 		if (!nand_is_bad_block(mtd, block)) {

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

Quoted 10 lines
nand_spl/nand_boot.c +4 -1
 			/*
 			 * Skip bad blocks
 			 */
 			for (page = 0; page < CFG_NAND_PAGE_COUNT; page++) {
 				nand_read_page(mtd, block, page, dst);
-				dst += CFG_NAND_PAGE_SIZE;
+				/* Overwrite skipped pages */
+				if (read >= offs)
+					dst += CFG_NAND_PAGE_SIZE;
+				read += CFG_NAND_PAGE_SIZE;

This looks wrong if offs isn't within the first block.

I've pushed a fixed and simplified version to nand-flash/testing -- can you test it?

-Scott

#3 lore raw

PATCH v6 2/7 nand_spl: Support page-aligned read in nand_load, use chipselect

Quoted 6 lines · Scott Wood
Quoted 5 lines · Guennadi Liakhovetski
nand_spl/nand_boot.c +2 -0
 	block = offs / CFG_NAND_BLOCK_SIZE;
+	blocks = (uboot_size + offs - ((block - 1) * CFG_NAND_BLOCK_SIZE) - 1) /
+		CFG_NAND_BLOCK_SIZE;
 	blockcopy_count = 0;
Quoted 15 lines

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

Quoted 13 lines
nand_spl/nand_boot.c +5 -2
-	while (blockcopy_count < (uboot_size / CFG_NAND_BLOCK_SIZE)) {
+	while (blockcopy_count < blocks) {
 		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;
+				/* Overwrite skipped pages */
+				if (read >= offs)
+					dst += CFG_NAND_PAGE_SIZE;
+				read += CFG_NAND_PAGE_SIZE;

This looks wrong if offs isn't within the first block.

Arrrgh, during the merge the following two lines went missing from the patch:

+ /* Recalculate offs as an offset inside a block */
+ offs -= CFG_NAND_BLOCK_SIZE * block;

which were there, for example, in v5.

Quoted 2 lines

I've pushed a fixed and simplified version to nand-flash/testing -- can you test it?

Yes, it works. Your version is also better, since it skips unneeded pages instead of reading them in and overwriting, as mine did.

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

#4 lore raw

PATCH v6 3/7 ARM: Add arm1176 core with S3C6400 SoC

In reply to Guennadi Liakhovetski

Based on the original S3C64XX port by Samsung for 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 06ed278..ba87322 100644
@@ -491,7 +491,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
#5 lore raw

PATCH v6 3/7 ARM: Add arm1176 core with S3C6400 SoC

cpu/arm1176/s3c64xx/interrupts.c

Quoted 6 lines
cpu/arm1176/s3c64xx/interrupts.c new file +0 -0
new file mode 100644
index 0000000..4233e8c

You can remove anything from enable_interrupts() to do_irq() here. It's already in lib_arm/interrupts.c.

Andreas

#6 lore raw

PATCH v6 3/7 ARM: Add arm1176 core with S3C6400 SoC

Quoted 9 lines · Andreas Engel

cpu/arm1176/s3c64xx/interrupts.c

Quoted 6 lines
cpu/arm1176/s3c64xx/interrupts.c new file +0 -0
new file mode 100644
index 0000000..4233e8c

You can remove anything from enable_interrupts() to do_irq() here. It's already in lib_arm/interrupts.c.

It must be the library-linking procedure, that prevented the linker from complaining about duplicate symbols... Yes, will remove them, thanks. Just let's wait a bit if there are more comments.

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

#7 lore raw

PATCH v6 3/7 ARM: Add arm1176 core with S3C6400 SoC

In reply to Guennadi Liakhovetski
Quoted 17 lines · Guennadi Liakhovetski

Based on the original S3C64XX port by Samsung for 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 ++++

Is it intended to put the CPU specific header files directly into the include directory (s3c6400.h and s3c64x0.h)?

Kind regards,
Jens

#8 lore raw

PATCH v6 3/7 ARM: Add arm1176 core with S3C6400 SoC

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

Is it intended to put the CPU specific header files directly into the include directory (s3c6400.h and s3c64x0.h)?

That's what we've been doing so far:

	-> ls -l include/s3c*
	-rw-rw-r-- 1 wd wd 21763 Dec  9  2007 include/s3c2400.h
	-rw-rw-r-- 1 wd wd  7629 Dec  9  2007 include/s3c2410.h
	-rw-rw-r-- 1 wd wd 38129 Oct 13  2007 include/s3c24x0.h

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
We are all agreed that your  theory  is  crazy.  The  question  which
divides  us  is  whether it is crazy enough to have a chance of being
correct. My own feeling is that it is not crazy enough.  - Niels Bohr
#9 lore raw

PATCH v6 3/7 ARM: Add arm1176 core with S3C6400 SoC

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

Is it intended to put the CPU specific header files directly into the include directory (s3c6400.h and s3c64x0.h)?

That's what we've been doing so far:

	-> ls -l include/s3c*
	-rw-rw-r-- 1 wd wd 21763 Dec  9  2007 include/s3c2400.h
	-rw-rw-r-- 1 wd wd  7629 Dec  9  2007 include/s3c2410.h
	-rw-rw-r-- 1 wd wd 38129 Oct 13  2007 include/s3c24x0.h

Sorry, don't understand. So is it okay, that these files reside in the include directory or not?

Signature · 2 lines
Kind regards,
Jens
#10 lore raw

PATCH v6 3/7 ARM: Add arm1176 core with S3C6400 SoC

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

That's what we've been doing so far:

	-> ls -l include/s3c*
	-rw-rw-r-- 1 wd wd 21763 Dec  9  2007 include/s3c2400.h
	-rw-rw-r-- 1 wd wd  7629 Dec  9  2007 include/s3c2410.h
	-rw-rw-r-- 1 wd wd 38129 Oct 13  2007 include/s3c24x0.h

Sorry, don't understand. So is it okay, that these files reside in the include directory or not?

Unless you want to submit a clenaup patch for many existing processors, yes.

What is your suggestion instead?

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
"Data is a lot like humans: It is  born.  Matures.  Gets  married  to
other  data, divorced. Gets old. One thing that it doesn't do is die.
It has to be killed."                                 - Arthur Miller
#11 lore raw

PATCH v6 3/7 ARM: Add arm1176 core with S3C6400 SoC

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

That's what we've been doing so far:

	-> ls -l include/s3c*
	-rw-rw-r-- 1 wd wd 21763 Dec  9  2007 include/s3c2400.h
	-rw-rw-r-- 1 wd wd  7629 Dec  9  2007 include/s3c2410.h
	-rw-rw-r-- 1 wd wd 38129 Oct 13  2007 include/s3c24x0.h
Quoted 7 lines
Quoted 2 lines

Sorry, don't understand. So is it okay, that these files reside in the include directory or not?

Unless you want to submit a clenaup patch for many existing processors, yes.

What is your suggestion instead?

It was just a question to read your opinion. Personally, I can live with it. I thought, CPU specific header files had to go to the include/asm-<arch>/arch-<cpu> directory.

Sorry for the noise.

Kind regards,
Jens

#12 lore raw

PATCH v6 3/7 ARM: Add arm1176 core with S3C6400 SoC

Quoted 11 lines · Jens Gehrlein
Quoted 10 lines · Wolfgang Denk
Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 6 lines

That's what we've been doing so far:

	-> ls -l include/s3c*
	-rw-rw-r-- 1 wd wd 21763 Dec  9  2007 include/s3c2400.h
	-rw-rw-r-- 1 wd wd  7629 Dec  9  2007 include/s3c2410.h
	-rw-rw-r-- 1 wd wd 38129 Oct 13  2007 include/s3c24x0.h

Sorry, don't understand. So is it okay, that these files reside in the include directory or not?

Quoted 8 lines
Quoted 4 lines

Unless you want to submit a clenaup patch for many existing processors, yes.

What is your suggestion instead?

It was just a question to read your opinion. Personally, I can live with it. I thought, CPU specific header files had to go to the include/asm-<arch>/arch-<cpu> directory.

Currently the kernel start move to move it to
include/arch/asm

I'll prefer to use this

Best Regards,
J.

#13 lore raw

PATCH v6 3/7 ARM: Add arm1176 core with S3C6400 SoC

In reply to Guennadi Liakhovetski

Hi Guennadi,

Quoted 1 line · Guennadi Liakhovetski
cpu/arm1176/s3c64xx/interrupts.c +0 -0

[snip]

cpu/arm1176/s3c64xx/interrupts.c line 280

Quoted 11 lines
cpu/arm1176/s3c64xx/interrupts.c +11 -0
+void udelay(unsigned long usec)
+{
+	unsigned long long tmp;
+	ulong tmo;
+
+	tmo = (usec + 9) / 10;
+	tmp = get_ticks() + tmo;	/* get current timestamp */
+
+	while (get_ticks() < tmp)/* loop till event */
+		 /*NOP*/;
+}

I tried to follow the interrupt init function, but it's difficult. What is the least possible delay with the udelay function?
I remember that i.mx31 udelay cannot currently be below 30 microsseconds due to the low input clock. If someone uses udelay(1) in polling loops with timeout, the actual duration is much more longer than assumed.

Kind regards,
Jens

#14 lore raw

PATCH v6 3/7 ARM: Add arm1176 core with S3C6400 SoC

Quoted 16 lines · Jens Gehrlein

Hi Guennadi,

Quoted 2 lines · Guennadi Liakhovetski
cpu/arm1176/s3c64xx/interrupts.c +0 -0

[snip]

Quoted 9 lines
cpu/arm1176/s3c64xx/interrupts.c +9 -0
+void udelay(unsigned long usec)
+{
+	unsigned long long tmp;
+	ulong tmo;
+
+	tmo = (usec + 9) / 10;
+	tmp = get_ticks() + tmo;	/* get current timestamp */
+
+	while (get_ticks() < tmp)/* loop till event */
Quoted 8 lines

cpu/arm1176/s3c64xx/interrupts.c line 280

Quoted 2 lines
cpu/arm1176/s3c64xx/interrupts.c +2 -0
+		 /*NOP*/;
+}

I tried to follow the interrupt init function, but it's difficult. What is the least possible delay with the udelay function?
I remember that i.mx31 udelay cannot currently be below 30 microsseconds due to the low input clock. If someone uses udelay(1) in polling loops with timeout, the actual duration is much more longer than assumed.

Actually, the "/ 10" and this comment

/*
* We use the following scheme for the timer:
* Prescaler is hard fixed at 167, divider at 1/4.
* This gives at PCLK frequency 66MHz approx. 10us ticks
* The timer is set to wrap after 100s, at 66MHz this obviously
* happens after 10,000,000 ticks. A long variable can thus
* keep values up to 40,000s, i.e., 11 hours. This should be
* enough for most uses:-) Possible optimizations: select a
* binary-friendly frequency, e.g., 1ms / 128. Also calculate
* the prescaler automatically for other PCLK frequencies. */

shall make it clear, that the timer resolution is configured to 10us, which is also the minimum udelay. The timer could also do better, but then we get other disadvantages, e.g., shorter wrap-around time.

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 v6 3/7 ARM: Add arm1176 core with S3C6400 SoC

Hi Guennadi,

Quoted 40 lines · Guennadi Liakhovetski
Quoted 7 lines · Jens Gehrlein

Hi Guennadi,

Quoted 2 lines · Guennadi Liakhovetski
cpu/arm1176/s3c64xx/interrupts.c +0 -0

[snip]

Quoted 16 lines

cpu/arm1176/s3c64xx/interrupts.c line 280

Quoted 11 lines
cpu/arm1176/s3c64xx/interrupts.c +11 -0
+void udelay(unsigned long usec)
+{
+	unsigned long long tmp;
+	ulong tmo;
+
+	tmo = (usec + 9) / 10;
+	tmp = get_ticks() + tmo;	/* get current timestamp */
+
+	while (get_ticks() < tmp)/* loop till event */
+		 /*NOP*/;
+}

I tried to follow the interrupt init function, but it's difficult. What is the least possible delay with the udelay function?
I remember that i.mx31 udelay cannot currently be below 30 microsseconds due to the low input clock. If someone uses udelay(1) in polling loops with timeout, the actual duration is much more longer than assumed.

Actually, the "/ 10" and this comment

/*
* We use the following scheme for the timer:
* Prescaler is hard fixed at 167, divider at 1/4.
* This gives at PCLK frequency 66MHz approx. 10us ticks
* The timer is set to wrap after 100s, at 66MHz this obviously
* happens after 10,000,000 ticks. A long variable can thus
* keep values up to 40,000s, i.e., 11 hours. This should be
* enough for most uses:-) Possible optimizations: select a
* binary-friendly frequency, e.g., 1ms / 128. Also calculate
* the prescaler automatically for other PCLK frequencies. */

Quoted 3 lines

shall make it clear, that the timer resolution is configured to 10us, which is also the minimum udelay. The timer could also do better, but then we get other disadvantages, e.g., shorter wrap-around time.

Okay. Thank you.
I think, it's very useful for a developer to know the limits of high resolution timers and to see it immediately, so he can consider it in his code.

Kind regards,
Jens

#16 lore raw

PATCH v6 3/7 ARM: Add arm1176 core with S3C6400 SoC

In reply to Guennadi Liakhovetski

cpu/arm1176/cpu.c line 174

Quoted 9 lines
cpu/arm1176/cpu.c new file +9 -0
+
+void dcache_disable (void)
+{
+	ulong reg;
+
+	reg = read_p15_c1 ();
+	cp_delay ();
+	reg &= ~C1_DC;
+	write_p15_c1 (reg);

why not as the other implementation?

Quoted 22 lines
(quoted diff) +22 -0
+	write_p15_c1 (reg & ~C1_DC);
+}
+
+int dcache_status (void)
+{
+	return (read_p15_c1 () & C1_DC) != 0;
+}
+
+/* flush I/D-cache */
+static void cache_flush (void)
+{
+	/* invalidate both caches and flush btb */
+	asm ("mcr p15, 0, %0, c7, c7, 0": :"r" (0));
+	/* mem barrier to sync things */
+	asm ("mcr p15, 0, %0, c7, c10, 4": :"r" (0));
+}
+	 * The timer is set to wrap after 100s, at 66MHz this obviously
+	 * happens after 10,000,000 ticks. A long variable can thus
+	 * keep values up to 40,000s, i.e., 11 hours. This should be
+	 * enough for most uses:-) Possible optimizations: select a
+	 * binary-friendly frequency, e.g., 1ms / 128. Also calculate
+	 * the prescaler automatically for other PCLK frequencies.

Review

Quoted 10 lines
(quoted diff) +10 -0
+	 */
+	/* Set timer frequency to 500KHz, at 66MHz we get prescaler=132 < 255 */
+	timers->TCFG0 = PRESCALER << 8;
+	if (timer_load_val == 0) {
+		/*
+		 * for 10 ms clock period @ PCLK with 4 bit divider = 1/2 and
+		 * prescaler = 16. Should be 10390 @33.25MHz and 15625 @ 50 MHz
+		 */
+		timer_load_val = get_PCLK() / PRESCALER * (100 / 4); /* 100s */
+		/*printf("Calculated %lu timer_load_val\n", timer_load_val);*/

please remove if not need

cpu/arm1176/s3c64xx/interrupts.c line 196

Quoted 3 lines
cpu/arm1176/s3c64xx/interrupts.c new file +3 -0
+		timers->TCFG1 = (timers->TCFG1 & ~0xf0000) | 0x20000;
+	}
+

please add some empty line to be more readable

Quoted 31 lines
cpu/arm1176/s3c64xx/interrupts.c new file +31 -0
+	/* load value for 10 ms timeout */
+	lastdec = timers->TCNTB4 = timer_load_val;
+	/* auto load, manual update of Timer 4 */
+	timers->TCON = (timers->TCON & ~0x00700000) | TCON_4_AUTO |
+		TCON_4_UPDATE;
+	/* auto load, start Timer 4 */
+	timers->TCON = (timers->TCON & ~0x00700000) | TCON_4_AUTO | COUNT_4_ON;
+	timestamp = 0;
+
+	return 0;
+}
+
+/*
+ * timer without interrupts
+ */
+
+/*
+ * This function is derived from PowerPC code (read timebase as long long).
+ * On ARM it just returns the timer value.
+ */
+unsigned long long get_ticks(void)
+{
+	ulong now = read_timer();
+
+	if (lastdec >= now) {
+		/* normal mode */
+#define MPLL 1
+#define EPLL 2
+
+/* ------------------------------------------------------------------------- */
+/*

cpu/arm1176/s3c64xx/interrupts.c

Quoted 10 lines
cpu/arm1176/s3c64xx/interrupts.c new file +10 -0
+ * NOTE: This describes the proper use of this file.
+ *
+ * CONFIG_SYS_CLK_FREQ should be defined as the input frequency of the PLL.
+ *
+ * get_FCLK(), get_HCLK(), get_PCLK() and get_UCLK() return the clock of
+ * the specified bus in HZ.
+ */
+/* ------------------------------------------------------------------------- */
+
+static ulong get_PLLCLK(int pllreg)

please not uppercase

cpu/arm1176/s3c64xx/speed.c line 62

Quoted 11 lines
cpu/arm1176/s3c64xx/speed.c new file +11 -0
+{
+	ulong r, m, p, s;
+
+	if (pllreg == APLL)
+		r = APLL_CON_REG;
+	else if (pllreg == MPLL)
+		r = MPLL_CON_REG;
+	else if (pllreg == EPLL)
+		r = EPLL_CON0_REG;
+	else
+		hang();

please move to switch implementation

cpu/arm1176/s3c64xx/speed.c line 72

Quoted 10 lines
cpu/arm1176/s3c64xx/speed.c new file +10 -0
+
+	m = (r >> 16) & 0x3ff;
+	p = (r >> 8) & 0x3f;
+	s = r & 0x7;
+
+	return m * (CONFIG_SYS_CLK_FREQ / (p * (1 << s)));
+}
+
+/* return ARMCORE frequency */
+ulong get_ARMCLK(void)

please not uppercase

cpu/arm1176/s3c64xx/speed.c line 82

Quoted 10 lines
cpu/arm1176/s3c64xx/speed.c new file +10 -0
+{
+	ulong div;
+
+	div = CLK_DIV0_REG;
+
+	return get_PLLCLK(APLL) / ((div & 0x7) + 1);
+}
+
+/* return FCLK frequency */
+ulong get_FCLK(void)

please not uppercase

cpu/arm1176/s3c64xx/speed.c line 88

Quoted 6 lines
cpu/arm1176/s3c64xx/speed.c new file +6 -0
+{
+	return get_PLLCLK(APLL);
+}
+
+/* return HCLK frequency */
+ulong get_HCLK(void)

please not uppercase

Quoted 10 lines
cpu/arm1176/s3c64xx/speed.c new file +10 -0
+{
+	ulong fclk;
+
+	uint hclkx2_div = ((CLK_DIV0_REG >> 9) & 0x7) + 1;
+	uint hclk_div = ((CLK_DIV0_REG >> 8) & 0x1) + 1;
+
+	/*
+	 * Bit 7 exists on s3c6410, and not on s3c6400, it is reserved on
+	 * s3c6400 and is always 0, and it is indeed running in ASYNC mode
+	 */

cpu/arm1176/s3c64xx/speed.c line 108

Quoted 10 lines
cpu/arm1176/s3c64xx/speed.c new file +10 -0
+	if (OTHERS_REG & 0x80)
+		fclk = get_FCLK();		/* SYNC Mode	*/
+	else
+		fclk = get_PLLCLK(MPLL);	/* ASYNC Mode	*/
+
+	return fclk / (hclk_div * hclkx2_div);
+}
+
+/* return PCLK frequency */
+ulong get_PCLK(void)

please not uppercase

Quoted 5 lines
cpu/arm1176/s3c64xx/speed.c new file +5 -0
+{
+	ulong fclk;
+	uint hclkx2_div = ((CLK_DIV0_REG >> 9) & 0x7) + 1;
+	uint pre_div = ((CLK_DIV0_REG >> 12) & 0xf) + 1;
+

cpu/arm1176/s3c64xx/speed.c line 123

Quoted 10 lines
cpu/arm1176/s3c64xx/speed.c new file +10 -0
+	if (OTHERS_REG & 0x80)
+		fclk = get_FCLK();		/* SYNC Mode	*/
+	else
+		fclk = get_PLLCLK(MPLL);	/* ASYNC Mode	*/
+
+	return fclk / (hclkx2_div * pre_div);
+}
+
+/* return UCLK frequency */
+ulong get_UCLK(void)

please not uppercase

cpu/arm1176/s3c64xx/speed.c line 133

Quoted 10 lines
cpu/arm1176/s3c64xx/speed.c new file +10 -0
+{
+	return get_PLLCLK(EPLL);
+}
+
+int print_cpuinfo(void)
+{
+	printf("\nCPU:     S3C6400@%luMHz\n", get_ARMCLK() / 1000000);
+	printf("         Fclk = %luMHz, Hclk = %luMHz, Pclk = %luMHz ",
+	       get_FCLK() / 1000000, get_HCLK() / 1000000,
+	       get_PCLK() / 1000000);

maybe a macro like HZ_TO_MHZ(x) could be helpfull to avoid typo

Quoted 69 lines
cpu/arm1176/s3c64xx/speed.c new file +7 -0
+
+	if (OTHERS_REG & 0x80)
+		printf("(SYNC Mode) \n");
+	else
+		printf("(ASYNC Mode) \n");
+	return 0;
+}
cpu/arm1176/start.S new file +56 -0
new file mode 100644
index 0000000..00cc186
@@ -0,0 +1,469 @@
+/*
+ *  armboot - Startup Code for S3C6400/ARM1176 CPU-core
+ *
+ * Copyright (c) 2007	Samsung Electronics
+ *
+ * Copyright (C) 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
+ *
+ * 2007-09-21 - Restructured codes by jsgood (jsgood.yang at samsung.com)
+ * 2007-09-21 - Added MoviNAND and OneNAND boot codes by
+ * jsgood (jsgood.yang at samsung.com)
+ * Base codes by scsuh (sc.suh)
+ */
+
+#include <config.h>
+#include <version.h>
+#ifdef CONFIG_ENABLE_MMU
+#include <asm/proc/domain.h>
+#endif
+#include <s3c6400.h>
+
+#if !defined(CONFIG_ENABLE_MMU) && !defined(CFG_PHY_UBOOT_BASE)
+#define CFG_PHY_UBOOT_BASE	CFG_UBOOT_BASE
+#endif
+
+.globl _armboot_start
+_armboot_start:
+	.word _start
+
+/*
+ * These are defined in the board-specific linker script.
+ */
+.globl _bss_start
+_bss_start:
+	.word __bss_start
+
+.globl _bss_end
+_bss_end:

cpu/arm1176/start.S line 66

Quoted 10 lines
cpu/arm1176/start.S new file +10 -0
+	.word _end
+
+/*
+ * the actual reset code
+ */
+
+reset:
+	/*
+	 * set the cpu to SVC32 mode
+	 */

please add space between parameter

Quoted 24 lines
cpu/arm1176/start.S new file +19 -0
+	mrs	r0,cpsr
+	bic	r0,r0,#0x3f
+	orr	r0,r0,#0xd3
+	msr	cpsr,r0
+
+/*
+ *************************************************************************
+ *
+ * CPU_init_critical registers
+ *
+ * setup important registers
+ * setup memory timing
+ *
+ *************************************************************************
+ */
+	/*
+	 * we do sys-critical inits only at reboot,
+	 * not when booting from ram!
+	 */
include/common.h +0 -0
index 06ed278..ba87322 100644

include/common.h int prt_mpc8220_clks (void); · line 495

Quoted 6 lines
include/common.h +2 -1
@@ -491,7 +491,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)

Is it possible to have a better and simpler ifdef?

include/s3c6400.h line 572

Quoted 12 lines
include/common.h +0 -0
 void	s3c2410_irq(void);
 #define ARM920_IRQ_CALLBACK s3c2410_irq
 ulong	get_FCLK (void);
include/s3c6400.h new file +4 -1
new file mode 100644
index 0000000..8814747
--- /dev/null
 
+#define NFCONF			(ELFIN_NAND_BASE+NFCONF_OFFSET)
+#define NFCONT			(ELFIN_NAND_BASE+NFCONT_OFFSET)
+#define NFCMMD			(ELFIN_NAND_BASE+NFCMMD_OFFSET)
+#define NFADDR           	(ELFIN_NAND_BASE+NFADDR_OFFSET)
                 ^^^^^^^^^^^

please remove whitesapce

Quoted 1 line

+#define NFDATA (ELFIN_NAND_BASE+NFDATA_OFFSET)

Ditto

Quoted 1 line

+#define NFMECCDATA0 (ELFIN_NAND_BASE+NFMECCDATA0_OFFSET)

Ditto

Quoted 1 line

+#define NFMECCDATA1 (ELFIN_NAND_BASE+NFMECCDATA1_OFFSET)

Ditto

Quoted 1 line

+#define NFSECCDATA0 (ELFIN_NAND_BASE+NFSECCDATA0_OFFSET)

Ditto

Quoted 1 line

+#define NFSBLK (ELFIN_NAND_BASE+NFSBLK_OFFSET)

Ditto

Quoted 1 line

+#define NFEBLK (ELFIN_NAND_BASE+NFEBLK_OFFSET)

Ditto

Quoted 1 line

+#define NFSTAT (ELFIN_NAND_BASE+NFSTAT_OFFSET)

Ditto

Quoted 1 line

+#define NFESTAT0 (ELFIN_NAND_BASE+NFESTAT0_OFFSET)

Ditto

Quoted 1 line

+#define NFESTAT1 (ELFIN_NAND_BASE+NFESTAT1_OFFSET)

Ditto

Quoted 1 line

+#define NFMECC0 (ELFIN_NAND_BASE+NFMECC0_OFFSET)

Ditto

Quoted 1 line

+#define NFMECC1 (ELFIN_NAND_BASE+NFMECC1_OFFSET)

Ditto

Quoted 1 line

+#define NFSECC (ELFIN_NAND_BASE+NFSECC_OFFSET)

Ditto

Quoted 1 line

+#define NFMLCBITPT (ELFIN_NAND_BASE+NFMLCBITPT_OFFSET)

Ditto

include/s3c6400.h line 590

Quoted 5 lines
include/s3c6400.h new file +5 -0
+
+#define NFCONF_REG		__REG(ELFIN_NAND_BASE+NFCONF_OFFSET)
+#define NFCONT_REG		__REG(ELFIN_NAND_BASE+NFCONT_OFFSET)
+#define NFCMD_REG		__REG(ELFIN_NAND_BASE+NFCMMD_OFFSET)
+#define NFADDR_REG           	__REG(ELFIN_NAND_BASE+NFADDR_OFFSET)

Ditto

Quoted 1 line

+#define NFDATA_REG __REG(ELFIN_NAND_BASE+NFDATA_OFFSET)

Ditto

Quoted 1 line

+#define NFDATA8_REG __REGb(ELFIN_NAND_BASE+NFDATA_OFFSET)

Ditto

Quoted 1 line

+#define NFMECCDATA0_REG __REG(ELFIN_NAND_BASE+NFMECCDATA0_OFFSET)

Ditto

Quoted 1 line

+#define NFMECCDATA1_REG __REG(ELFIN_NAND_BASE+NFMECCDATA1_OFFSET)

Ditto

Quoted 1 line

+#define NFSECCDATA0_REG __REG(ELFIN_NAND_BASE+NFSECCDATA0_OFFSET)

Ditto

Quoted 1 line

+#define NFSBLK_REG __REG(ELFIN_NAND_BASE+NFSBLK_OFFSET)

Ditto

Quoted 1 line

+#define NFEBLK_REG __REG(ELFIN_NAND_BASE+NFEBLK_OFFSET)

Ditto

Quoted 1 line

+#define NFSTAT_REG __REG(ELFIN_NAND_BASE+NFSTAT_OFFSET)

Ditto

Quoted 1 line

+#define NFESTAT0_REG __REG(ELFIN_NAND_BASE+NFESTAT0_OFFSET)

Ditto

Quoted 1 line

+#define NFESTAT1_REG __REG(ELFIN_NAND_BASE+NFESTAT1_OFFSET)

Ditto

Quoted 1 line

+#define NFMECC0_REG __REG(ELFIN_NAND_BASE+NFMECC0_OFFSET)

Ditto

Quoted 1 line

+#define NFMECC1_REG __REG(ELFIN_NAND_BASE+NFMECC1_OFFSET)

Ditto

Quoted 1 line

+#define NFSECC_REG __REG(ELFIN_NAND_BASE+NFSECC_OFFSET)

Ditto

Quoted 1 line

+#define NFMLCBITPT_REG __REG(ELFIN_NAND_BASE+NFMLCBITPT_OFFSET)

Ditto

Quoted 1 line

+

btw on all macro please add space beetwen operator like

Quoted 1 line

+#define NFCONF_REG __REG(ELFIN_NAND_BASE+NFCONF_OFFSET)

to
#define NFCONF_REG __REG(ELFIN_NAND_BASE + NFCONF_OFFSET)

include/s3c6400.h line 758

Quoted 8 lines
include/s3c6400.h new file +8 -0
+#define TIMER3_MANUP           (TCON_3_MAN*1)
+#define TIMER3_NOP             (FClrBit(TCON, TCON_3_MAN))
+#define TCON_3_ONOFF           (1 << 16)  /* 0: Stop, 1: start Timer 3 */
+#define TIMER3_ON              (TCON_3_ONOFF * 1)
+#define TIMER3_OFF             (FClrBit(TCON, TCON_3_ONOFF))
+
+#if defined(CONFIG_CLK_400_100_50)
+#define Startup_AMDIV		400

for macro I'll prefer upercase

include/s3c6400.h line 815

Quoted 13 lines
include/s3c6400.h new file +12 -0
+#define Startup_MDIV		400
+#define Startup_PDIV		6
+#define Startup_SDIV		1
 
+
+
+/*-----------------------------------------------------------------------
+ * Physical Memory Map
+ */
+#define DMC1_MEM_CFG	0x80010012	/* Chip1, Burst4, Row/Column bit */
+#define DMC1_MEM_CFG2	0xB45
+#define DMC1_CHIP0_CFG	0x150F8		/* 0x4000_0000 ~ 0x43ff_ffff (64MB) */
+#define DMC_DDR_32_CFG	0x0 		/* 32bit, DDR */
                                   ^

whitespace please remove

include/s3c6400.h line 821

Quoted 6 lines
include/s3c6400.h new file +6 -0
+
+/* Memory Parameters */
+/* DDR Parameters */
+#define DDR_tREFRESH		7800	/* ns */
+#define DDR_tRAS		45	/* ns (min: 45ns)*/
+#define DDR_tRC 		68	/* ns (min: 67.5ns)*/
                  ^

whitespace please remove

include/s3c6400.h line 824

Quoted 3 lines
include/s3c6400.h new file +3 -0
+#define DDR_tRCD		23	/* ns (min: 22.5ns)*/
+#define DDR_tRFC		80	/* ns (min: 80ns)*/
+#define DDR_tRP 		23	/* ns (min: 22.5ns)*/
                  ^

whitespace please remove

include/s3c6400.h line 826

Quoted 2 lines
include/s3c6400.h new file +2 -0
+#define DDR_tRRD		15	/* ns (min: 15ns)*/
+#define DDR_tWR 		15	/* ns (min: 15ns)*/
                  ^

whitespace please remove

include/s3c6400.h line 833

Quoted 7 lines
include/s3c6400.h new file +7 -0
+#define DDR_tXSR		120	/* ns (min: 120ns)*/
+#define DDR_CASL		3	/* CAS Latency 3 */
+
+/*
+ * mDDR memory configuration
+ */
+#define DMC_DDR_BA_EMRS 	2
                          ^

whitespace please remove

Quoted 40 lines
include/s3c6400.h new file +4 -0
+#define DMC_DDR_MEM_CASLAT	3
+/* 6   Set Cas Latency to 3 */
+#define DMC_DDR_CAS_LATENCY	(DDR_CASL << 1)
+/* Min 0.75 ~ 1.25 */
include/s3c64x0.h new file +33 -0
@@ -0,0 +1,92 @@
+/*
+ * (C) Copyright 2003
+ * David M??ller ELSOFT AG Switzerland. d.mueller at elsoft.ch
+ *
+ * (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
+ */
+
+/************************************************
+ * NAME	    : S3C64XX.h
+ * Version  : 31.3.2003
+ *
+ * common stuff for SAMSUNG S3C64XX SoC
+ ************************************************/
+

include/s3c64x0.h line 43

Quoted 10 lines
include/s3c64x0.h new file +10 -0
+#ifndef __S3C64XX_H__
+#define __S3C64XX_H__
+
+#if defined(CONFIG_SYNC_MODE) && defined(CONFIG_S3C6400)
+#error CONFIG_SYNC_MODE unavailable on S3C6400, please, fix your configuration!
+#endif
+
+typedef vu_char		S3C64XX_REG8;
+typedef vu_short	S3C64XX_REG16;
+typedef vu_long		S3C64XX_REG32;

I'll prefer you use the type directly

Quoted 21 lines
include/s3c64x0.h new file +21 -0
+
+/* UART (see manual chapter 11) */
+typedef struct {
+	S3C64XX_REG32	ULCON;
+	S3C64XX_REG32	UCON;
+	S3C64XX_REG32	UFCON;
+	S3C64XX_REG32	UMCON;
+	S3C64XX_REG32	UTRSTAT;
+	S3C64XX_REG32	UERSTAT;
+	S3C64XX_REG32	UFSTAT;
+	S3C64XX_REG32	UMSTAT;
+#ifdef __BIG_ENDIAN
+	S3C64XX_REG8	res1[3];
+	S3C64XX_REG8	UTXH;
+	S3C64XX_REG8	res2[3];
+	S3C64XX_REG8	URXH;
+#else /* Little Endian */
+	S3C64XX_REG8	UTXH;
+	S3C64XX_REG8	res1[3];
+	S3C64XX_REG8	URXH;
+	S3C64XX_REG8	res2[3];

include/s3c64x0.h line 74

Quoted 10 lines
include/s3c64x0.h new file +10 -0
+#endif
+	S3C64XX_REG32	UBRDIV;
+#ifdef __BIG_ENDIAN
+	S3C64XX_REG8	res3[2];
+	S3C64XX_REG16	UDIVSLOT;
+#else
+	S3C64XX_REG16	UDIVSLOT;
+	S3C64XX_REG8	res3[2];
+#endif
+} /*__attribute__((__packed__))*/ s3c64xx_uart;

why do you remove the packed attribute?

include/s3c64x0.h line 81

Quoted 7 lines
include/s3c64x0.h new file +7 -0
+
+/* PWM TIMER (see manual chapter 10) */
+typedef struct {
+	S3C64XX_REG32	TCNTB;
+	S3C64XX_REG32	TCMPB;
+	S3C64XX_REG32	TCNTO;
+} /*__attribute__((__packed__))*/ s3c64xx_timer;

Ditto

include/s3c64x0.h line 90

Quoted 9 lines
include/s3c64x0.h new file +9 -0
+
+typedef struct {
+	S3C64XX_REG32	TCFG0;
+	S3C64XX_REG32	TCFG1;
+	S3C64XX_REG32	TCON;
+	s3c64xx_timer	ch[4];
+	S3C64XX_REG32	TCNTB4;
+	S3C64XX_REG32	TCNTO4;
+} /*__attribute__((__packed__))*/ s3c64xx_timers;

Ditto

include/s3c64x0.h line 92

Quoted 2 lines
include/s3c64x0.h new file +2 -0
+
+#endif /*__S3C64XX_H__*/

Best Regards,
J.

#17 lore raw

PATCH v6 3/7 ARM: Add arm1176 core with S3C6400 SoC

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

cpu/arm1176/s3c64xx/interrupts.c line 193

Quoted 7 lines
cpu/arm1176/s3c64xx/interrupts.c new file +6 -0
+		/*
+		 * for 10 ms clock period @ PCLK with 4 bit divider = 1/2 and
+		 * prescaler = 16. Should be 10390 @33.25MHz and 15625 @ 50 MHz
+		 */
+		timer_load_val = get_PCLK() / PRESCALER * (100 / 4); /* 100s */
+		/*printf("Calculated %lu timer_load_val\n", timer_load_val);*/

please remove if not need

Or even better convert it into a debug() call so it can be enabled again for debugging purposes.

Quoted 4 lines

cpu/arm1176/s3c64xx/interrupts.c line 196

Quoted 3 lines
cpu/arm1176/s3c64xx/interrupts.c new file +3 -0
+		timers->TCFG1 = (timers->TCFG1 & ~0xf0000) | 0x20000;
+	}
+

please add some empty line to be more readable

No. One empty line os enough here.

Quoted 3 lines
Quoted 1 line

+#define NFADDR (ELFIN_NAND_BASE+NFADDR_OFFSET)

                 ^^^^^^^^^^^

please remove whitesapce

Not remove, but use TABs vor vertical alignment.

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
We fight only when there is no other choice. We prefer  the  ways  of
peaceful contact.
	-- Kirk, "Spectre of the Gun", stardate 4385.3
#18 lore raw

PATCH v6 3/7 ARM: Add arm1176 core with S3C6400 SoC

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

cpu/arm1176/s3c64xx/interrupts.c line 193

Quoted 7 lines
cpu/arm1176/s3c64xx/interrupts.c new file +6 -0
+		/*
+		 * for 10 ms clock period @ PCLK with 4 bit divider = 1/2 and
+		 * prescaler = 16. Should be 10390 @33.25MHz and 15625 @ 50 MHz
+		 */
+		timer_load_val = get_PCLK() / PRESCALER * (100 / 4); /* 100s */
+		/*printf("Calculated %lu timer_load_val\n", timer_load_val);*/

please remove if not need

Or even better convert it into a debug() call so it can be enabled again for debugging purposes.

Quoted 6 lines
Quoted 4 lines

cpu/arm1176/s3c64xx/interrupts.c line 196

Quoted 3 lines
cpu/arm1176/s3c64xx/interrupts.c new file +3 -0
+		timers->TCFG1 = (timers->TCFG1 & ~0xf0000) | 0x20000;
+	}
+

please add some empty line to be more readable

No. One empty line os enough here.

please add some empty line to be more readable for the following blocks

Quoted 8 lines
cpu/arm1176/s3c64xx/interrupts.c new file +8 -0
+     /* load value for 10 ms timeout */
+     lastdec = timers->TCNTB4 = timer_load_val;
+     /* auto load, manual update of Timer 4 */
+     timers->TCON = (timers->TCON & ~0x00700000) | TCON_4_AUTO |
+             TCON_4_UPDATE;
+     /* auto load, start Timer 4 */
+     timers->TCON = (timers->TCON & ~0x00700000) | TCON_4_AUTO | COUNT_4_ON;
+     timestamp = 0;

[snip]

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

+#define NFADDR (ELFIN_NAND_BASE+NFADDR_OFFSET)

                 ^^^^^^^^^^^

please remove whitesapce

Not remove, but use TABs vor vertical alignment.

That's my idea

Best Regards,
J.

#19 lore raw

PATCH v6 3/7 ARM: Add arm1176 core with S3C6400 SoC

In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD

cpu/arm1176/cpu.c line 174

Quoted 9 lines
cpu/arm1176/cpu.c new file +9 -0
+
+void dcache_disable (void)
+{
+	ulong reg;
+
+	reg = read_p15_c1 ();
+	cp_delay ();
+	reg &= ~C1_DC;
+	write_p15_c1 (reg);

why not as the other implementation?

ok

Quoted 2 lines

cpu/arm1176/s3c64xx/interrupts.c line 193

Quoted 1 line
cpu/arm1176/s3c64xx/interrupts.c new file +1 -0
+		/*printf("Calculated %lu timer_load_val\n", timer_load_val);*/

please remove if not need

ok

Quoted 9 lines

please add some empty line to be more readable

cpu/arm1176/s3c64xx/interrupts.c line 204

Quoted 8 lines
cpu/arm1176/s3c64xx/interrupts.c new file +8 -0
+	/* load value for 10 ms timeout */
+	lastdec = timers->TCNTB4 = timer_load_val;
+	/* auto load, manual update of Timer 4 */
+	timers->TCON = (timers->TCON & ~0x00700000) | TCON_4_AUTO |
+		TCON_4_UPDATE;
+	/* auto load, start Timer 4 */
+	timers->TCON = (timers->TCON & ~0x00700000) | TCON_4_AUTO | COUNT_4_ON;
+	timestamp = 0;

ok

Quoted 2 lines
Quoted 1 line

+static ulong get_PLLCLK(int pllreg)

please not uppercase

These are s3c* common functions declared in include/common.h, chenging their declarations is outside of the scope of this patchset (see below)

Quoted 9 lines

cpu/arm1176/s3c64xx/speed.c line 62

Quoted 8 lines
cpu/arm1176/s3c64xx/speed.c new file +8 -0
+	if (pllreg == APLL)
+		r = APLL_CON_REG;
+	else if (pllreg == MPLL)
+		r = MPLL_CON_REG;
+	else if (pllreg == EPLL)
+		r = EPLL_CON0_REG;
+	else
+		hang();

please move to switch implementation

ok

Quoted 5 lines

cpu/arm1176/s3c64xx/speed.c line 133

Quoted 4 lines
cpu/arm1176/s3c64xx/speed.c new file +4 -0
+	printf("\nCPU:     S3C6400@%luMHz\n", get_ARMCLK() / 1000000);
+	printf("         Fclk = %luMHz, Hclk = %luMHz, Pclk = %luMHz ",
+	       get_FCLK() / 1000000, get_HCLK() / 1000000,
+	       get_PCLK() / 1000000);

maybe a macro like HZ_TO_MHZ(x) could be helpfull to avoid typo

Don't think such metric conversions deserve a macro.

Quoted 5 lines

please add space between parameter

cpu/arm1176/start.S line 136

Quoted 4 lines
cpu/arm1176/start.S new file +4 -0
+	mrs	r0,cpsr
+	bic	r0,r0,#0x3f
+	orr	r0,r0,#0xd3
+	msr	cpsr,r0

ok

Quoted 4 lines
Quoted 4 lines
include/common.h +0 -0
index 06ed278..ba87322 100644
Quoted 8 lines

include/common.h int prt_mpc8220_clks (void); · line 495

Quoted 7 lines
include/common.h +2 -1
@@ -491,7 +491,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)

Is it possible to have a better and simpler ifdef?

It is possible and desirable to remove these declarations

Quoted 3 lines

include/common.h int prt_mpc8220_clks (void); · line 498

Quoted 3 lines
include/common.h +0 -0
 void	s3c2410_irq(void);
 #define ARM920_IRQ_CALLBACK s3c2410_irq
 ulong	get_FCLK (void);

from this header completely. Don't understand what they are doing in include/common.h. However, this is outside of the scope of this patchset. Please, if you will be fixing this, do this after this patchset.

Quoted 3 lines
Quoted 1 line

+#define NFADDR (ELFIN_NAND_BASE+NFADDR_OFFSET)

                 ^^^^^^^^^^^

please remove whitesapce

ok

Quoted 4 lines

btw on all macro please add space beetwen operator like

Quoted 1 line

+#define NFCONF_REG __REG(ELFIN_NAND_BASE+NFCONF_OFFSET)

to
#define NFCONF_REG __REG(ELFIN_NAND_BASE + NFCONF_OFFSET)

ok

Quoted 5 lines
Quoted 1 line

+#define Startup_AMDIV 400

for macro I'll prefer upercase

include/common.h

Quoted 3 lines
include/common.h +3 -0
+#define Startup_MDIV		400
+#define Startup_PDIV		6
+#define Startup_SDIV		1

ok

Quoted 4 lines

include/common.h

Quoted 3 lines
include/common.h +3 -0
+typedef vu_char		S3C64XX_REG8;
+typedef vu_short	S3C64XX_REG16;
+typedef vu_long		S3C64XX_REG32;

I'll prefer you use the type directly

ok

Quoted 2 lines
Quoted 1 line

+} /*__attribute__((__packed__))*/ s3c64xx_uart;

why do you remove the packed attribute?

put it back. Makes no _practical_ difference in this case.

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

#20 lore raw

PATCH v6 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
#21 lore raw

PATCH v6 4/7 USB: Add support for OHCI controller on S3C6400

Quoted 5 lines · 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.

I can't apply this to the USB custodian repository without the rest of the patchset being applied. I'm also fine if the ARM custodian picks this one up.

Best regards

Markus

--
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

#22 lore raw

PATCH v6 4/7 USB: Add support for OHCI controller on S3C6400

Quoted 6 lines · Markus Klotzb?cher
Quoted 4 lines · 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.

Quoted 6 lines
Quoted 1 line

I can't apply this to the USB custodian repository without the rest of the patchset being applied. I'm also fine if the ARM custodian picks this one up.

I'll do.

Thanks for the Ack

Best Regards,
J.

#23 lore raw

PATCH v6 4/7 USB: Add support for OHCI controller on S3C6400

Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 3 lines · Markus Klotzb?cher

I can't apply this to the USB custodian repository without the rest of the patchset being applied. I'm also fine if the ARM custodian picks this one up.

I'll do.

Thanks!

Best regards

Markus Klotzb?cher

--
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

#24 lore raw

PATCH v6 5/7 serial: add S3C64XX serial driver

In reply to Guennadi Liakhovetski

Based on the original S3C64XX UART driver by Samsung for U-Boot 1.1.6.

---
 drivers/serial/Makefile  |    1 +
 drivers/serial/s3c64xx.c |  197 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 198 insertions(+), 0 deletions(-)
 create mode 100644 drivers/serial/s3c64xx.c
drivers/serial/Makefile +1 -0
index de6fbab..b1458f2 100644
@@ -30,6 +30,7 @@ COBJS-$(CONFIG_MCFUART) += mcfuart.o
 COBJS-y += ns9750_serial.o
 COBJS-y += ns16550.o
 COBJS-$(CONFIG_DRIVER_S3C4510_UART) += s3c4510b_uart.o
+COBJS-$(CONFIG_S3C64XX) += s3c64xx.o
 COBJS-y += serial.o
 COBJS-$(CONFIG_MAX3100_SERIAL) += serial_max3100.o
 COBJS-y += serial_pl010.o
drivers/serial/s3c64xx.c new file +197 -0

197 lines not on this page · raw message

Signature · 1 line
1.5.4
#25 lore raw

PATCH v6 5/7 serial: add S3C64XX serial driver

drivers/serial/s3c64xx.c line 76

Quoted 4 lines
drivers/serial/s3c64xx.c new file +4 -0
+	u32 reg;
+	u32 pclk_ratio = get_PCLK() / gd->baudrate;
+	int i;
+

IMHO it's still obscur

drivers/serial/s3c64xx.c line 87

Quoted 11 lines
drivers/serial/s3c64xx.c new file +11 -0
+	/* PCLK / (16 * baudrate) - 1 */
+	reg = pclk_ratio / 16 - 1;
+	/* i = pclk_ratio % 16 */
+	i = pclk_ratio - (reg + 1) * 16;
+
+	uart->UBRDIV = reg;
+	uart->UDIVSLOT = udivslot[i];
+
+	for (i = 0; i < 100; i++)
+		barrier();
+}

Best Regards,
J.

#26 lore raw

PATCH v6 5/7 serial: add S3C64XX serial driver

Quoted 9 lines · Jean-Christophe PLAGNIOL-VILLARD

drivers/serial/s3c64xx.c line 76

Quoted 4 lines
drivers/serial/s3c64xx.c new file +4 -0
+	u32 reg;
+	u32 pclk_ratio = get_PCLK() / gd->baudrate;
+	int i;
+

IMHO it's still obscur

drivers/serial/s3c64xx.c line 80

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

Sorry, I don't understand how this can be made clearer yet. If you have any specific ideas, please let me know now, before v7 appears, because I would really like to make it final.

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 v6 5/7 serial: add S3C64XX serial driver

Dear Guennadi Liakhovetski,

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

drivers/serial/s3c64xx.c line 76

Quoted 5 lines
drivers/serial/s3c64xx.c new file +4 -0
+	u32 reg;
+	u32 pclk_ratio = get_PCLK() / gd->baudrate;
+	int i;
+

IMHO it's still obscur

drivers/serial/s3c64xx.c line 78

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

I don't see any baudrate in this calculation. From the comment I would expect to see

	reg = pclk_ratio / (16 * gd->baudrate) - 1;

or similar. For the reader the comment is misleading as it is difficult to figure out that "PCLK" and "pclk_ratio" are not the same thing.

Quoted 2 lines
Quoted 2 lines

drivers/serial/s3c64xx.c line 80

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

I don't see any % operation in this calculation. From the comment I would expect to see

	i = pclk_ratio % 16;

or similar. Either the comment or the code or both are wrong.

Quoted 3 lines

Sorry, I don't understand how this can be made clearer yet. If you have any specific ideas, please let me know now, before v7 appears, because I would really like to make it final.

Well, maybe the code and the comments should be in sync. Actually, if the comment just says the same as the code, it is redundant and should be omitted. If the comment tries to describe what the code implements in a different way that should be made clear, too.

Probably it doesn't make much sense to try to factor out common expressions when it makes thew code more difficult to read - the compiler is pretty clever about such things, too.

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
"Though a program be but three lines long,
someday it will have to be maintained."
- The Tao of Programming
#28 lore raw

PATCH v6 5/7 serial: add S3C64XX serial driver

Quoted 15 lines · Wolfgang Denk

Dear Guennadi Liakhovetski,

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

drivers/serial/s3c64xx.c line 76

Quoted 5 lines
drivers/serial/s3c64xx.c new file +4 -0
+	u32 reg;
+	u32 pclk_ratio = get_PCLK() / gd->baudrate;
+	int i;
+

IMHO it's still obscur

drivers/serial/s3c64xx.c line 78

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

I don't see any baudrate in this calculation. From the comment I would expect to see

Quoted 5 lines
	reg = pclk_ratio / (16 * gd->baudrate) - 1;

or similar. For the reader the comment is misleading as it is difficult to figure out that "PCLK" and "pclk_ratio" are not the same thing.

Ok, pclk_ratio is, probably, not the best name for this.

Quoted 9 lines
Quoted 2 lines
Quoted 2 lines

drivers/serial/s3c64xx.c line 80

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

I don't see any % operation in this calculation. From the comment I would expect to see

	i = pclk_ratio % 16;

or similar. Either the comment or the code or both are wrong.

I think, they are both correct by the way pclk_ration is calculated.

Quoted 4 lines
Quoted 3 lines

Sorry, I don't understand how this can be made clearer yet. If you have any specific ideas, please let me know now, before v7 appears, because I would really like to make it final.

Quoted 8 lines

Well, maybe the code and the comments should be in sync. Actually, if the comment just says the same as the code, it is redundant and should be omitted. If the comment tries to describe what the code implements in a different way that should be made clear, too.

Probably it doesn't make much sense to try to factor out common expressions when it makes thew code more difficult to read - the compiler is pretty clever about such things, too.

Ok, would this be better

	u32 reg;
	u32 pclk = get_PCLK();
	u32 baudrate = gd->baudrate;
	int i;

	reg = pclk / baudrate / 16 - 1;
	i = (pclk / baudrate) % 16;

This way the compiler does optimize it to only one division, and the operations say what they do, and there doesn't seem to be any need for comment left. Still, the code produced by this is 1 asm instruction longer than my original code:-)

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

#29 lore raw

PATCH v6 5/7 serial: add S3C64XX serial driver

Dear Guennadi,

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

Ok, would this be better

	u32 reg;
	u32 pclk = get_PCLK();
	u32 baudrate = gd->baudrate;
	int i;

	reg = pclk / baudrate / 16 - 1;
	i = (pclk / baudrate) % 16;

Is "reg" still used anywhere else?

Quoted 4 lines

This way the compiler does optimize it to only one division, and the operations say what they do, and there doesn't seem to be any need for comment left. Still, the code produced by this is 1 asm instruction longer than my original code:-)

Is the generated code equivalent? This smells like a subtle bug...

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
The games have always  strengthened  us.  Death  becomes  a  familiar
pattern. We don't fear it as you do.
	-- Proconsul Marcus Claudius, "Bread and Circuses",
	   stardate 4041.2
#30 lore raw

PATCH v6 5/7 serial: add S3C64XX serial driver

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

Ok, would this be better

	u32 reg;
	u32 pclk = get_PCLK();
	u32 baudrate = gd->baudrate;
	int i;
Quoted 4 lines
Quoted 2 lines
	reg = pclk / baudrate / 16 - 1;
	i = (pclk / baudrate) % 16;

Is "reg" still used anywhere else?

No, I'll remove it.

Quoted 6 lines
Quoted 4 lines

This way the compiler does optimize it to only one division, and the operations say what they do, and there doesn't seem to be any need for comment left. Still, the code produced by this is 1 asm instruction longer than my original code:-)

Is the generated code equivalent? This smells like a subtle bug...

Don't see a bug there, both look correct. The C-code is different too - one uses "%", another one multiplication and subtraction, don't think it should be alarming that the resulting asm-code is different too.

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

#31 lore raw

PATCH v6 6/7 NAND: add NAND driver for S3C64XX

In reply to Guennadi Liakhovetski

Based on the original S3C64XX NAND driver by Samsung for U-Boot 1.1.6.

---

Changes since v5: now it actually works with nand-testing

 drivers/mtd/nand/Makefile  |    1 +
 drivers/mtd/nand/s3c64xx.c |  309 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 310 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/nand/s3c64xx.c
drivers/mtd/nand/Makefile +1 -0
index ffb3169..268a758 100644
@@ -34,6 +34,7 @@ COBJS-y += nand_util.o
 
 COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.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 +309 -0

309 lines not on this page · raw message

Signature · 1 line
1.5.4
#32 lore raw

PATCH v6 6/7 NAND: add NAND driver for S3C64XX

drivers/mtd/nand/s3c64xx.c line 124

Quoted 11 lines · Guennadi Liakhovetski
drivers/mtd/nand/s3c64xx.c new file +11 -0
+	if (ctrl & NAND_CTRL_CHANGE) {
+		if (ctrl & NAND_CLE)
+			this->IO_ADDR_W = (void __iomem *)NFCMMD;
+		else if (ctrl & NAND_ALE)
+			this->IO_ADDR_W = (void __iomem *)NFADDR;
+		else
+			this->IO_ADDR_W = (void __iomem *)NFDATA;
+		if (ctrl & NAND_NCE)
+			s3c_nand_select_chip(mtd, 0);
+		else
+			s3c_nand_select_chip(mtd, -1);

What if select_chip(mtd, 1) had been called?

drivers/mtd/nand/s3c64xx.c line 139

Quoted 9 lines
drivers/mtd/nand/s3c64xx.c new file +9 -0
+/*
+ * Function for checking device ready pin
+ * Written by jsgood
+ */
+static int s3c_nand_device_ready(struct mtd_info *mtdinfo)
+{
+	while (!(readl(NFSTAT) & NFSTAT_RnB)) {}
+	return 1;
+}

Might want a timeout here.

drivers/mtd/nand/s3c64xx.c line 211

Quoted 1 line
drivers/mtd/nand/s3c64xx.c new file +1 -0
+	u_char err_type, repared;

repaired

-Scott

#33 lore raw

PATCH v6 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. Based on the original sources by Samsung for U-Boot 1.1.6.

---

Changes since v5: adjust the configuration to more precisely desribe NAND ECC layout.

 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                 |  306 +++++++++++++++++++++++++++
 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, 1123 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 cb8c0f5..898b3f6 100644
@@ -2686,6 +2686,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 +306 -0

306 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 v6 7/7 ARM: Add support for S3C6400 based SMDK6400 board

Quoted 5 lines · 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. Based on the original sources by Samsung for U-Boot 1.1.6.

Quoted 8 lines

---

Changes since v5: adjust the configuration to more precisely desribe NAND ECC layout.

 MAKEALL                                    |    1 +
 Makefile                                   |   17 ++

please add your entry in MAINTAINERS

Quoted 30 lines
 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                 |  306 +++++++++++++++++++++++++++
 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, 1123 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
board/samsung/smdk6400/Makefile new file +10 -0
+# 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

board/samsung/smdk6400/Makefile line 37

Quoted 10 lines
board/samsung/smdk6400/Makefile new file +10 -0
+
+LIB	= $(obj)lib$(BOARD).a
+
+COBJS	:= smdk6400.o
+SOBJS	:= lowlevel_init.o
+OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
+
+$(LIB):	$(obj).depend $(OBJS)
+	$(AR) crv $@ $(OBJS)
+

please keep this Makefile as other new style

ex from atmel board

include $(TOPDIR)/config.mk

LIB = $(obj)lib$(BOARD).a

COBJS-y += at91cap9adk.o
COBJS-y += led.o
COBJS-y += partition.o
COBJS-$(CONFIG_CMD_NAND) += nand.o

SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS-y))
SOBJS := $(addprefix $(obj),$(SOBJS))

$(LIB): $(obj).depend $(OBJS) $(SOBJS)

	$(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)

clean:

	rm -f $(SOBJS) $(OBJS)

distclean: clean

	rm -f $(LIB) core *.bak $(obj).depend

#########################################################################

# defines $(obj).depend target
include $(SRCTREE)/rules.mk

sinclude $(obj).depend

#########################################################################

Quoted 33 lines
board/samsung/smdk6400/config.mk new file +27 -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)

board/samsung/smdk6400/config.mk

Quoted 10 lines
board/samsung/smdk6400/config.mk new file +10 -0
+else
+TEXT_BASE = 0
+endif
+check_syncack:
+	ldr	r1, [r0, #OTHERS_OFFSET]
+	ldr	r2, =0xf00
+	and	r1, r1, r2
+	cmp	r1, #0xf00
+	bne	check_syncack
+#else	/* ASYNC Mode */

please use .rept

board/samsung/smdk6400/config.mk

Quoted 6 lines
board/samsung/smdk6400/config.mk new file +6 -0
+	nop
+	nop
+	nop
+	nop
+	nop
+

and please be carefull with whitespaces

Quoted 22 lines

index 0000000..77fd2c8

board/samsung/smdk6400/smdk6400.c new file +18 -0
@@ -0,0 +1,130 @@
+/*
+static inline void delay(unsigned long loops)
+{
+	__asm__ volatile ("1:\n" "subs %0, %1, #1\n"
+			  "bne 1b"
+			  : "=r" (loops) : "0" (loops));
+}
+
+/*
+ * Miscellaneous platform dependent initialisations
+ */
+
+{
+	nand_probe(CFG_NAND_BASE);
+	if (nand_dev_desc[0].ChipID != NAND_ChipID_UNKNOWN)
+		print_size(nand_dev_desc[0].totlen, "\n");
+}
+#endif

board/samsung/smdk6400/smdk6400.c line 28

Quoted 10 lines
board/samsung/smdk6400/smdk6400.c new file +10 -0
+
+ulong board_flash_get_legacy (ulong base, int banknum, flash_info_t *info)
+{
+	if (banknum == 0) {	/* non-CFI boot flash */
+		info->portwidth = FLASH_CFI_16BIT;
+		info->chipwidth = FLASH_CFI_BY16;
+		info->interface = FLASH_CFI_X16;
+		return 1;
+	} else
+		return 0;

please replace with

	} else {
		return 0;
	}

or

	}

	return 0;
Quoted 19 lines
board/samsung/smdk6400/smdk6400.c new file +1 -0
+}
include/configs/smdk6400.h new file +12 -0
new file mode 100644
index 0000000..1bc8996
@@ -0,0 +1,306 @@
+/*
+#define CONFIG_SMDK6400		1	/* on a SAMSUNG SMDK6400 Board  */
+
+#define CFG_SDRAM_BASE	0x50000000
+
+/* input clock of PLL: SMDK6400 has 12MHz input clock */
+#define CONFIG_SYS_CLK_FREQ	12000000
+
+#if !defined(CONFIG_NAND_SPL) && (TEXT_BASE >= 0xc0000000)
+#define CONFIG_ENABLE_MMU
+#endif
+

include/configs/smdk6400.h line 22

Quoted 10 lines
include/configs/smdk6400.h new file +10 -0
+#define CONFIG_MEMORY_UPPER_CODE
+
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_INITRD_TAG
+
+/*
+ * Architecture magic and machine type
+ */
+#define MACH_TYPE		1270

please use mach type from the hearder

Quoted 7 lines
include/configs/smdk6400.h new file +7 -0
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#undef CONFIG_SKIP_RELOCATE_UBOOT
+
+/*

include/configs/smdk6400.h line 78

Quoted 10 lines
include/configs/smdk6400.h new file +10 -0
+ * Size of malloc() pool
+ */
+#define CFG_MALLOC_LEN		(CFG_ENV_SIZE + 1024 * 1024)
+#define CFG_GBL_DATA_SIZE	128	/* size in bytes for initial data */
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_DRIVER_CS8900	1	/* we have a CS8900 on-board	*/
+#define CS8900_BASE	  	0x18800300

please remove the whitespace

include/configs/smdk6400.h line 79

Quoted 1 line
include/configs/smdk6400.h new file +1 -0
+#define CS8900_BUS16		1 	/* follow the Linux driver	*/

please remove the whitespace

include/configs/smdk6400.h line 87

Quoted 8 lines
include/configs/smdk6400.h new file +8 -0
+
+/*
+ * select serial console configuration
+ */
+#define CONFIG_SERIAL1          1	/* we use SERIAL 1 on SMDK6400	*/
+
+#define CFG_HUSH_PARSER			/* use "hush" command parser	*/
+#ifdef CFG_HUSH_PARSER

do you really want the idef?

Quoted 22 lines
include/configs/smdk6400.h new file +22 -0
+#define CFG_PROMPT_HUSH_PS2	"> "
+#endif
+
+#define CONFIG_CMDLINE_EDITING
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+
+#define CONFIG_BAUDRATE		115200
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_CACHE
+#define CONFIG_CMD_REGINFO
+#define CONFIG_CMD_LOADS
+#define CONFIG_CMD_LOADB
+#define CONFIG_CMD_ENV
+#define CONFIG_CMD_NAND
+#if defined(CONFIG_BOOT_ONENAND)

include/configs/smdk6400.h line 119

Quoted 10 lines
include/configs/smdk6400.h new file +10 -0
+#define CONFIG_CMD_ONENAND
+#endif
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_ELF
+
+#define CONFIG_BOOTDELAY	3
+
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+
+#if (CONFIG_COMMANDS & CONFIG_CMD_KGDB)

replace with
#ifdef CONFIG_CMD_KGDB

Quoted 33 lines
include/configs/smdk6400.h new file +33 -0
+#define CONFIG_KGDB_BAUDRATE	115200	/* speed to run kgdb serial port */
+#define CONFIG_KGDB_SER_INDEX	1	/* which serial port to use	 */
+#endif
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CFG_LONGHELP				/* undef to save memory	      */
+#define CFG_PROMPT		"SMDK6400 # "	/* Monitor Command Prompt     */
+#define CFG_CBSIZE		256		/* Console I/O Buffer Size    */
+#define CFG_PBSIZE		384		/* Print Buffer Size          */
+#define CFG_MAXARGS		16		/* max number of command args */
+#define CFG_BARGSIZE		CFG_CBSIZE	/* Boot Argument Buffer Size  */
+
+#define CFG_MEMTEST_START	CFG_SDRAM_BASE	/* memtest works on	      */
+#define CFG_MEMTEST_END		(CFG_SDRAM_BASE + 0x7e00000) /* 126MB in DRAM */
+
+#define CFG_LOAD_ADDR		CFG_SDRAM_BASE	/* default load address	*/
+
+#define CFG_HZ			1000
+
+/* valid baudrates */
+#define CFG_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }
+
+/*-----------------------------------------------------------------------
+ * Stack sizes
+ *
+ * The stack sizes are set up in start.S using the settings below
+ */
+#define CONFIG_STACKSIZE	0x40000		/* regular stack 256KB */
+
+/**********************************
+ Support Clock Settings

include/configs/smdk6400.h line 162

Quoted 10 lines
include/configs/smdk6400.h new file +10 -0
+ **********************************
+ Setting	SYNC	ASYNC
+ ----------------------------------
+ 667_133_66	 X	  O
+ 533_133_66	 O	  O
+ 400_133_66	 X	  O
+ 400_100_50	 O	  O
+ **********************************/
+
+/*#define CONFIG_CLK_667_133_66*/

please remove if not need or use idef

include/configs/smdk6400.h line 168

Quoted 6 lines
include/configs/smdk6400.h new file +6 -0
+#define CONFIG_CLK_533_133_66
+/*
+#define CONFIG_CLK_400_100_50
+#define CONFIG_CLK_400_133_66
+#define CONFIG_SYNC_MODE
+*/

Ditto

Quoted 64 lines
include/configs/smdk6400.h new file +8 -0
+
+/* SMDK6400 has 2 banks of DRAM, but we use only one in U-Boot */
+#define CONFIG_NR_DRAM_BANKS	1
+#define PHYS_SDRAM_1		CFG_SDRAM_BASE	/* SDRAM Bank #1	*/
+#define CONFIG_BOOT_MOVINAND
+#define CONFIG_BOOT_ONENAND
+*/
+
nand_spl/board/samsung/smdk6400/Makefile new file +50 -0
new file mode 100644
index 0000000..ae9eb2a
@@ -0,0 +1,106 @@
+#
+# (C) Copyright 2006-2007
+# Stefan Roese, DENX Software Engineering, sr 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
+#
+
+CONFIG_NAND_SPL	= y
+
+include $(TOPDIR)/config.mk
+include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
+
+LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
+LDFLAGS	= -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
+AFLAGS	+= -DCONFIG_NAND_SPL
+CFLAGS	+= -DCONFIG_NAND_SPL
+
+SOBJS	= start.o cpu_init.o lowlevel_init.o
+COBJS	= nand_boot.o nand_ecc.o s3c64xx.o
+
+SRCS	:= $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
+OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
+__OBJS	:= $(SOBJS) $(COBJS)
+LNDIR	:= $(OBJTREE)/nand_spl/board/$(BOARDDIR)
+
+nandobj	:= $(OBJTREE)/nand_spl/
+
+ALL	= $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
+
+all:	$(obj).depend $(ALL)
+

nand_spl/board/samsung/smdk6400/Makefile line 60

Quoted 10 lines
nand_spl/board/samsung/smdk6400/Makefile new file +10 -0
+$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
+	$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
+
+$(nandobj)u-boot-spl.bin:	$(nandobj)u-boot-spl
+	$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
+
+$(nandobj)u-boot-spl:	$(OBJS)
+	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \
+		-Map $(nandobj)u-boot-spl.map \
+		-o $(nandobj)u-boot-spl

please replace with
$(nandobj)u-boot-spl: $(OBJS)

	cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) \
		-Map [email protected] -o $@

Best Regards,
J.