Skip to contentSkip to conversation

Add support for Embest SBC2440-II Board

U-Boot kevin.morfitt at fearnside-systems.co.uk 4 participants 7 messages May 23, 2009 – Jun 3, 2009

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

Implementation based on the existing u-boot support for S3C2410-based boards. u-boot programmed into NOR flash.

Tested on an SBC2440-II Board using tftp to copy the files from a server and programming them into NAND flash.

MAKEALL used to build all LIST_ARM9 targets only - no other architectures built as the changes only affect ARM9-based boards.

---
 MAKEALL                                |    1 +
 Makefile                               |    3 +
 board/embest/sbc2440ii/Makefile        |   55 +++++++
 board/embest/sbc2440ii/config.mk       |   25 +++
 board/embest/sbc2440ii/lowlevel_init.S |  219 +++++++++++++++++++++++++++
 board/embest/sbc2440ii/sbc2440ii.c     |  127 ++++++++++++++++
 board/embest/sbc2440ii/u-boot.lds      |   56 +++++++
 common/serial.c                        |    4 +-
 cpu/arm920t/s3c24x0/speed.c            |   83 ++++++++---
 cpu/arm920t/s3c24x0/timer.c            |    6 +-
 cpu/arm920t/s3c24x0/usb.c              |    6 +-
 cpu/arm920t/s3c24x0/usb_ohci.c         |    2 +
 cpu/arm920t/start.S                    |   35 ++++-
 drivers/i2c/s3c24x0_i2c.c              |   18 +++
 drivers/mtd/nand/Makefile              |    2 +-
 drivers/mtd/nand/s3c2410_nand.c        |  223 +++++++++++++++++++++++-----
 drivers/rtc/s3c24x0_rtc.c              |    2 +
 drivers/serial/serial_s3c24x0.c        |    2 +
 include/common.h                       |    3 +-
 include/configs/sbc2440ii.h            |  252 ++++++++++++++++++++++++++++++++
 include/s3c2440.h                      |  231 +++++++++++++++++++++++++++++
 include/s3c24x0.h                      |   83 +++++++++++
 22 files changed, 1362 insertions(+), 76 deletions(-)
 create mode 100644 board/embest/sbc2440ii/Makefile
 create mode 100644 board/embest/sbc2440ii/config.mk
 create mode 100644 board/embest/sbc2440ii/lowlevel_init.S
 create mode 100644 board/embest/sbc2440ii/sbc2440ii.c
 create mode 100644 board/embest/sbc2440ii/u-boot.lds
 create mode 100644 include/configs/sbc2440ii.h
 create mode 100644 include/s3c2440.h
MAKEALL +1 -0
index c98d03a..e7235e4 100755
@@ -515,6 +515,7 @@ LIST_ARM9="			\
 	omap5912osk		\
 	omap730p2		\
 	sbc2410x		\
+	sbc2440ii		\
 	scb9328			\
 	smdk2400		\
 	smdk2410		\
Makefile +3 -0
index 81a5cd0..38f79c2 100644
@@ -2876,6 +2876,9 @@ omap730p2_cs3boot_config :	unconfig
 sbc2410x_config: unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm920t sbc2410x NULL s3c24x0
 
+sbc2440ii_config: unconfig
+	@$(MKCONFIG) $(@:_config=) arm arm920t sbc2440ii embest s3c24x0
+
 scb9328_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm920t scb9328 NULL imx
 
board/embest/sbc2440ii/Makefile new file +55 -0

55 lines not on this page · raw message

board/embest/sbc2440ii/config.mk new file +25 -0
new file mode 100644
index 0000000..def11d8
@@ -0,0 +1,25 @@
+#
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, <[email protected]>
+# David Mueller, ELSOFT AG, <[email protected]>
+#
+# SAMSUNG SMDK2410 board with S3C2410X (ARM920T) cpu
+#
+# see http://www.samsung.com/ for more information on SAMSUNG
+#
+# Modified for EMBEST SBC2440-II board with S3C2440 (ARM920T) cpu by:
+# (C) Copyright 2009
+# Kevin Morfitt, Fearnside Systems Ltd, <[email protected]>
+
+#
+# SBC2440-II has 1 bank of 64 MB DRAM
+#
+# 3000'0000 to 3800'0000
+#
+# Linux-Kernel is expected to be at 3000'8000, entry 3000'8000
+#
+# we load ourself to 33F8'0000
+#
+# download area is 3000'0000
+
+TEXT_BASE = 0x33F80000
board/embest/sbc2440ii/lowlevel_init.S new file +219 -0

219 lines not on this page · raw message

board/embest/sbc2440ii/sbc2440ii.c new file +127 -0

127 lines not on this page · raw message

board/embest/sbc2440ii/u-boot.lds new file +56 -0

56 lines not on this page · raw message

common/serial.c +2 -2
index 09385d0..fe8799c 100644
@@ -58,7 +58,7 @@ struct serial_device *__default_serial_console (void)
 #else
 		return &serial0_device;
 #endif
-#elif defined(CONFIG_S3C2410)
+#elif defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)
 #if defined(CONFIG_SERIAL1)
 	return &s3c24xx_serial0_device;
 #elif defined(CONFIG_SERIAL2)
@@ -131,7 +131,7 @@ void serial_initialize (void)
 #if defined (CONFIG_STUART)
 	serial_register(&serial_stuart_device);
 #endif
-#if defined(CONFIG_S3C2410)
+#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)
 	serial_register(&s3c24xx_serial0_device);
 	serial_register(&s3c24xx_serial1_device);
 	serial_register(&s3c24xx_serial2_device);
cpu/arm920t/s3c24x0/speed.c +59 -24

120 lines not on this page · raw message

cpu/arm920t/s3c24x0/timer.c +5 -1
index f0a09cd..134d644 100644
@@ -30,12 +30,15 @@
  */
 
 #include <common.h>
-#if defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB)
+#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || \
+    defined(CONFIG_S3C2440) || defined(CONFIG_TRAB)
 
 #if defined(CONFIG_S3C2400)
 #include <s3c2400.h>
 #elif defined(CONFIG_S3C2410)
 #include <s3c2410.h>
+#elif defined(CONFIG_S3C2440)
+#include <s3c2440.h>
 #endif
 
 int timer_load_val = 0;
@@ -177,6 +180,7 @@ ulong get_tbclk (void)
 	tbclk = timer_load_val * 100;
 #elif defined(CONFIG_SBC2410X) || \
       defined(CONFIG_SMDK2410) || \
+      defined(CONFIG_SBC2440II) || \
       defined(CONFIG_VCMA9)
 	tbclk = CONFIG_SYS_HZ;
 #else
cpu/arm920t/s3c24x0/usb.c +5 -1
index 9ccf575..962ef0d 100644
@@ -24,12 +24,16 @@
 #include <common.h>
 
 #if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT)
-# if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410)
+# if defined(CONFIG_S3C2400) || \
+     defined(CONFIG_S3C2410) || \
+     defined(CONFIG_S3C2440)
 
 #if defined(CONFIG_S3C2400)
 # include <s3c2400.h>
 #elif defined(CONFIG_S3C2410)
 # include <s3c2410.h>
+#elif defined(CONFIG_S3C2440)
+#include <s3c2440.h>
 #endif
 
 int usb_cpu_init (void)
cpu/arm920t/s3c24x0/usb_ohci.c +2 -0
index 7838014..6a46eed 100644
@@ -42,6 +42,8 @@
 #include <s3c2400.h>
 #elif defined(CONFIG_S3C2410)
 #include <s3c2410.h>
+#elif defined(CONFIG_S3C2440)
+#include <s3c2440.h>
 #endif
 
 #include <malloc.h>
cpu/arm920t/start.S +26 -9
index 475cdaf..7e9e6f8 100644
@@ -132,20 +132,30 @@ copyex:
 	bne	copyex
 #endif
 
-#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410)
+#if defined(CONFIG_S3C2400) || \
+    defined(CONFIG_S3C2410) || \
+    defined(CONFIG_S3C2440)
 	/* turn off the watchdog */
 
 # if defined(CONFIG_S3C2400)
-#  define pWTCON		0x15300000
-#  define INTMSK		0x14400008	/* Interupt-Controller base addresses */
+#  define pWTCON	0x15300000
+#  define INTMSK	0x14400008	/* Interupt-Controller base addresses */
 #  define CLKDIVN	0x14800014	/* clock divisor register */
 #else
-#  define pWTCON		0x53000000
-#  define INTMSK		0x4A000008	/* Interupt-Controller base addresses */
+#  define pWTCON	0x53000000
+#  define INTMSK	0x4A000008	/* Interupt-Controller base addresses */
 #  define INTSUBMSK	0x4A00001C
 #  define CLKDIVN	0x4C000014	/* clock divisor register */
 # endif
 
+# if defined(CONFIG_S3C2440)
+#  define INTSMASK	0xffff
+#  define CLKDIVVAL	0x5
+#else
+#  define INTSMASK	0x3ff
+#  define CLKDIVVAL	0x3
+# endif
+
 	ldr     r0, =pWTCON
 	mov     r1, #0x0
 	str     r1, [r0]
@@ -156,8 +166,8 @@ copyex:
 	mov	r1, #0xffffffff
 	ldr	r0, =INTMSK
 	str	r1, [r0]
-# if defined(CONFIG_S3C2410)
-	ldr	r1, =0x3ff
+# if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)
+	ldr	r1, =INTSMASK
 	ldr	r0, =INTSUBMSK
 	str	r1, [r0]
 # endif
@@ -165,9 +175,16 @@ copyex:
 	/* FCLK:HCLK:PCLK = 1:2:4 */
 	/* default FCLK is 120 MHz ! */
 	ldr	r0, =CLKDIVN
-	mov	r1, #3
+	mov	r1, #CLKDIVVAL
 	str	r1, [r0]
-#endif	/* CONFIG_S3C2400 || CONFIG_S3C2410 */
+
+#ifdef CONFIG_S3C2440
+	/* Set asynchronous bus mode */
+	mrc	p15, 0, r1, c1, c0, 0	/* read ctrl register */
+	orr	r1, r1, #0xc0000000		/* Asynchronous */
+	mcr	p15, 0, r1, c1, c0, 0	/* write ctrl register */
+#endif	/* CONFIG_S3C2440 */
+#endif	/* CONFIG_S3C2400 || CONFIG_S3C2410 || CONFIG_S3C2440 */
 
 	/*
 	 * we do sys-critical inits only at reboot,
drivers/i2c/s3c24x0_i2c.c +18 -0
index f0c1aa3..28bf314 100644
@@ -31,6 +31,8 @@
 #include <s3c2400.h>
 #elif defined(CONFIG_S3C2410)
 #include <s3c2410.h>
+#elif defined(CONFIG_S3C2440)
+#include <s3c2440.h>
 #endif
 #include <i2c.h>
 
@@ -66,6 +68,9 @@ static int GetI2CSDA(void)
 #ifdef CONFIG_S3C2400
 	return (gpio->PGDAT & 0x0020) >> 5;
 #endif
+#ifdef CONFIG_S3C2440
+	return (gpio->GPEDAT & 0x8000) >> 15;
+#endif
 }
 
 #if 0
@@ -85,6 +90,9 @@ static void SetI2CSCL(int x)
 #ifdef CONFIG_S3C2400
 	gpio->PGDAT = (gpio->PGDAT & ~0x0040) | (x&1) << 6;
 #endif
+#ifdef CONFIG_S3C2440
+	gpio->GPEDAT = (gpio->GPEDAT & ~0x4000) | (x&1) << 14;
+#endif
 }
 
 
@@ -142,6 +150,9 @@ void i2c_init (int speed, int slaveadd)
 #ifdef CONFIG_S3C2400
 		ulong old_gpecon = gpio->PGCON;
 #endif
+#ifdef CONFIG_S3C2440
+		ulong old_gpecon = gpio->GPECON;
+#endif
 		/* bus still busy probably by (most) previously interrupted transfer */
 
 #ifdef CONFIG_S3C2410
@@ -152,6 +163,10 @@ void i2c_init (int speed, int slaveadd)
 		/* set I2CSDA and I2CSCL (PG5, PG6) to GPIO */
 		gpio->PGCON = (gpio->PGCON & ~0x00003c00) | 0x00001000;
 #endif
+#ifdef CONFIG_S3C2440
+		/* set I2CSDA and I2CSCL (GPE15, GPE14) to GPIO */
+		gpio->GPECON = (gpio->GPECON & ~0xF0000000) | 0x10000000;
+#endif
 
 		/* toggle I2CSCL until bus idle */
 		SetI2CSCL (0);
@@ -174,6 +189,9 @@ void i2c_init (int speed, int slaveadd)
 #ifdef CONFIG_S3C2400
 		gpio->PGCON = old_gpecon;
 #endif
+#ifdef CONFIG_S3C2440
+		gpio->GPECON = old_gpecon;
+#endif
 	}
 
 	/* calculate prescaler and divisor values */
drivers/mtd/nand/Makefile +1 -1
index 471cd6b..190abeb 100644
@@ -41,7 +41,7 @@ COBJS-$(CONFIG_NAND_DAVINCI) += davinci_nand.o
 COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o
 COBJS-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o
 COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o
-COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.c
+COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.o
 COBJS-$(CONFIG_NAND_S3C64XX) += s3c64xx.o
 COBJS-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o
 endif
drivers/mtd/nand/s3c2410_nand.c +186 -37

309 lines not on this page · raw message

drivers/rtc/s3c24x0_rtc.c +2 -0
index 0d3372f..8f7559b 100644
@@ -34,6 +34,8 @@
 #include <s3c2400.h>
 #elif defined(CONFIG_S3C2410)
 #include <s3c2410.h>
+#elif defined(CONFIG_S3C2440)
+#include <s3c2440.h>
 #endif
 
 #include <rtc.h>
drivers/serial/serial_s3c24x0.c +2 -0
index 6d69c43..52d5895 100644
@@ -23,6 +23,8 @@
 #include <s3c2400.h>
 #elif defined(CONFIG_S3C2410)
 #include <s3c2410.h>
+#elif defined(CONFIG_S3C2440)
+#include <s3c2440.h>
 #endif
 
 DECLARE_GLOBAL_DATA_PTR;
include/common.h +2 -1
index 30fff7d..161277f 100644
@@ -490,7 +490,8 @@ ulong	get_OPB_freq (void);
 ulong	get_PCI_freq (void);
 #endif
 #if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || \
-	defined(CONFIG_LH7A40X) || defined(CONFIG_S3C6400)
+    defined(CONFIG_LH7A40X) || defined(CONFIG_S3C6400) || \
+    defined(CONFIG_S3C2440)
 void	s3c2410_irq(void);
 #define ARM920_IRQ_CALLBACK s3c2410_irq
 ulong	get_FCLK (void);
include/configs/sbc2440ii.h new file +252 -0

252 lines not on this page · raw message

include/s3c2440.h new file +231 -0

231 lines not on this page · raw message

include/s3c24x0.h +83 -0

107 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#1 lore raw

Hi Kevin,

Quoted 8 lines · kevin.morfitt at fearnside-systems.co.uk

Implementation based on the existing u-boot support for S3C2410-based boards. u-boot programmed into NOR flash.

Tested on an SBC2440-II Board using tftp to copy the files from a server and programming them into NAND flash.

MAKEALL used to build all LIST_ARM9 targets only - no other architectures built as the changes only affect ARM9-based boards.

<snip>

Quoted 131 lines
include/configs/sbc2440ii.h new file +127 -0
@@ -0,0 +1,252 @@
+/*
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Marius Groeger <[email protected]>
+ * Gary Jennejohn <[email protected]>
+ * David Mueller <[email protected]>
+ *
+ * Modified for the friendly-arm SBC-2410X by
+ * (C) Copyright 2005
+ * JinHua Luo, GuangDong Linux Center, <[email protected]>
+ *
+ * Modified for the Embest SBC2440-II by
+ * (C) Copyright 2009
+ * Kevin Morfitt, Fearnside Systems Ltd, <[email protected]>
+ *
+ * Configuation settings for the friendly-arm SBC-2410X board.
+ *
+ * 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
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+
+#define CONFIG_IDENT_STRING	" for Embest SBC2440-II"
+
+/*
+ * If we are developing, we might want to start armboot from ram
+ * so we MUST NOT initialize critical regs like mem-timing ...
+ */
+#undef CONFIG_SKIP_LOWLEVEL_INIT	/* undef for developing */
+
+/*
+ * High Level Configuration Options
+ * (easy to change)
+ */
+#define CONFIG_ARM920T		1	/* This is an ARM920T Core	*/
+#define CONFIG_S3C2440		1	/* in a SAMSUNG S3C2440 SoC     */
+#define CONFIG_SBC2440II	1	/* on an Embest SBC-2440-II Board  */
+
+/*
+ * input clock of PLL - the SBC2440-II has 12MHz input clock
+ */
+#define CONFIG_SYS_CLK_FREQ	12000000
+
+
+#define USE_920T_MMU		1
+#undef CONFIG_USE_IRQ			/* we don't need IRQ/FIQ stuff */
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 128*1024)
+/*
+ * size in bytes reserved for initial data
+ */
+#define CONFIG_SYS_GBL_DATA_SIZE	128
+
+/*
+ * Hardware drivers
+ */
+#define CONFIG_DRIVER_CS8900	1	/* we have a CS8900 on-board */
+#define CS8900_BASE		0x19000300
+#define CS8900_BUS16		1 /* the Linux driver does accesses as shorts */
+
+/*
+ * select serial console configuration
+ */
+#define CONFIG_S3C24X0_SERIAL
+#define CONFIG_SERIAL1          1	/* we use SERIAL 1 on SBC2440-II */
+
+/************************************************************
+ * RTC
+ ************************************************************/
+#define CONFIG_RTC_S3C24X0	1
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+
+#define CONFIG_BAUDRATE		115200
+
+
+/*
+ * BOOTP options
+ */
+#define CONFIG_BOOTP_BOOTFILESIZE
+#define CONFIG_BOOTP_BOOTPATH
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_HOSTNAME
+
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_ASKENV
+#define CONFIG_CMD_CACHE
+#define CONFIG_CMD_DATE
+#define CONFIG_CMD_ELF
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_NAND
+#define CONFIG_JFFS2_NAND
+#define CONFIG_CMD_MTDPARTS
+#define CONFIG_CMD_JFFS2
+#define CONFIG_JFFS2_CMDLINE
+#define MTDIDS_DEFAULT		"nand0=sbc2440-II-nand"
+#define MTDPARTS_DEFAULT \
+	"mtdparts=sbc2440-II-nand:2m(kernel),62m(rootfs)"

include/configs/sbc2440ii.h line 137

Quoted 10 lines
include/configs/sbc2440ii.h new file +10 -0
+#define CONFIG_EXTRA_ENV_SETTINGS	"autostart=yes"
+
+#define CONFIG_BOOTDELAY		3
+#define CONFIG_BOOTARGS \
+"noinitrd root=/dev/mtdblock1 rootfstype=jffs2 init=/linuxrc console=ttySAC0"
+#define CONFIG_ETHADDR			08:00:3e:26:0a:5b
+#define CONFIG_NETMASK			255.255.255.0
+#define CONFIG_IPADDR			192.168.0.69
+#define CONFIG_GATEWAYIP		192.168.0.1
+#define CONFIG_SERVERIP			192.168.0.70

Please remove all of these network-related parameters.
<snip>

regards,
Ben

#2 lore raw
In reply to kevin.morfitt at fearnside-systems.co.uk
Quoted 8 lines · kevin.morfitt at fearnside-systems.co.uk

Implementation based on the existing u-boot support for S3C2410-based boards. u-boot programmed into NOR flash.

Tested on an SBC2440-II Board using tftp to copy the files from a server and programming them into NAND flash.

MAKEALL used to build all LIST_ARM9 targets only - no other architectures built as the changes only affect ARM9-based boards.

please limit your comments to 80 chars per line
could you split this patch in multiple subset as adding the 2440 support, addind the nand drivers and then adding the board.

This will really simplify the review

Quoted 2 lines
---
 MAKEALL                                |    1 +

please add MAINTAINERS entry

Quoted 30 lines
 Makefile                               |    3 +
 board/embest/sbc2440ii/Makefile        |   55 +++++++
 board/embest/sbc2440ii/config.mk       |   25 +++
 board/embest/sbc2440ii/lowlevel_init.S |  219 +++++++++++++++++++++++++++
 board/embest/sbc2440ii/sbc2440ii.c     |  127 ++++++++++++++++
 board/embest/sbc2440ii/u-boot.lds      |   56 +++++++
 common/serial.c                        |    4 +-
 cpu/arm920t/s3c24x0/speed.c            |   83 ++++++++---
 cpu/arm920t/s3c24x0/timer.c            |    6 +-
 cpu/arm920t/s3c24x0/usb.c              |    6 +-
 cpu/arm920t/s3c24x0/usb_ohci.c         |    2 +
 cpu/arm920t/start.S                    |   35 ++++-
 drivers/i2c/s3c24x0_i2c.c              |   18 +++
 drivers/mtd/nand/Makefile              |    2 +-
 drivers/mtd/nand/s3c2410_nand.c        |  223 +++++++++++++++++++++++-----
 drivers/rtc/s3c24x0_rtc.c              |    2 +
 drivers/serial/serial_s3c24x0.c        |    2 +
 include/common.h                       |    3 +-
 include/configs/sbc2440ii.h            |  252 ++++++++++++++++++++++++++++++++
 include/s3c2440.h                      |  231 +++++++++++++++++++++++++++++
 include/s3c24x0.h                      |   83 +++++++++++
 22 files changed, 1362 insertions(+), 76 deletions(-)
 create mode 100644 board/embest/sbc2440ii/Makefile
 create mode 100644 board/embest/sbc2440ii/config.mk
 create mode 100644 board/embest/sbc2440ii/lowlevel_init.S
 create mode 100644 board/embest/sbc2440ii/sbc2440ii.c
 create mode 100644 board/embest/sbc2440ii/u-boot.lds
 create mode 100644 include/configs/sbc2440ii.h
 create mode 100644 include/s3c2440.h

<snip>

Quoted 10 lines
MAKEALL +8 -0
index c98d03a..e7235e4 100755
+ */
+
+#include <config.h>
+#include <version.h>
+
+/*
+ * Taken from linux/arch/arm/boot/compressed/head-s3c2410.S
+ *

MAKEALL

Quoted 10 lines
MAKEALL +10 -0
+ * Copyright (C) 2002 Samsung Electronics SW.LEE  <[email protected]>
+ */
+
+#define BWSCON		0x48000000
+
+#define DW8		(0x0)
+#define DW16		(0x1)
+#define DW32		(0x2)
+#define WAIT		(0x1 << 2)
+#define UBLB		(0x1 << 3)

what is all theses macro? for what use?

Quoted 59 lines
MAKEALL +8 -0
+
+#define B1_BWSCON	(DW16)
+#define B2_BWSCON	(DW16)
+#define B3_BWSCON	(DW16 + WAIT + UBLB)
+#define B4_BWSCON	(DW16)
+#define B5_BWSCON	(DW16)
+#define B6_BWSCON	(DW32)
+#define B7_BWSCON	(DW32)
board/embest/sbc2440ii/sbc2440ii.c new file +44 -0
new file mode 100644
index 0000000..e0599dd
@@ -0,0 +1,127 @@
+/*
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Marius Groeger <[email protected]>
+ *
+ * (C) Copyright 2002
+ * David Mueller, ELSOFT AG, <[email protected]>
+ *
+ * (C) Copyright 2005
+ * JinHua Luo, GuangDong Linux Center, <[email protected]>
+ *
+ * Modified for the Embest SBC2440-II by
+ * (C) Copyright 2009
+ * Kevin Morfitt, Fearnside Systems Ltd, <[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 <common.h>
+#include <s3c2440.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Configure the PLLs for MPLL = 400MHz, UPLL = 48MHz
+	The clock frequency ratios are set to 1:4:8 ie:
+		PCLK = 50MHz
+		HCLK = 100MHz
+		FCLK = 400MHz

board/embest/sbc2440ii/sbc2440ii.c line 54

Quoted 10 lines
board/embest/sbc2440ii/sbc2440ii.c new file +10 -0
+ */
+/* The MPLL values. */
+#define M_MDIV	0x5C
+#define M_PDIV	1
+#define M_SDIV	1
+
+/* The UPLL values. */
+#define U_MDIV	0x38
+#define U_PDIV	2
+#define U_SDIV	2

this need to be in the config.h as CONFIS_SYS_xxxxx

Quoted 21 lines
board/embest/sbc2440ii/sbc2440ii.c new file +21 -0
+
+/*
+ * Miscellaneous platform dependent initialisations
+ */
+
+static inline void pll_settle_delay(unsigned long loops)
+{
+	__asm__ volatile ("1:\n"
+			  "subs %0, %1, #1\n"
+			  "bne 1b" : "=r" (loops) : "0" (loops));
+}
+
+int board_init(void)
+{
+	S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
+	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
+
+	/* to reduce PLL lock time, adjust the LOCKTIME register */
+	clk_power->LOCKTIME = 0xFFFFFFFF;
+
+	/* configure UPLL */

board/embest/sbc2440ii/sbc2440ii.c line 85

Quoted 10 lines
board/embest/sbc2440ii/sbc2440ii.c new file +10 -0
+	clk_power->UPLLCON = ((U_MDIV << 12) + (U_PDIV << 4) + U_SDIV);
+
+	/* some delay between UPLL and MPLL */
+	pll_settle_delay(8000);
+
+	/* configure MPLL */
+	clk_power->MPLLCON = ((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV);
+
+	/* configure the GPIO */
+	gpio->GPACON = 0x007FFFFF;

what means all these hardcoded values?

board/embest/sbc2440ii/sbc2440ii.c line 91

Quoted 6 lines
board/embest/sbc2440ii/sbc2440ii.c new file +6 -0
+	gpio->GPBCON = 0x00055555;
+	gpio->GPBUP  = 0x000007FF;
+	gpio->GPBDAT = 0x000001C0;		/* Switch on LED1. */
+	gpio->GPCCON = 0xAAAAAAAA;
+	gpio->GPCUP  = 0x0000FFFF;
+	gpio->GPDCON = 0xAAAAAAAA;

<snip>
+

board/embest/sbc2440ii/sbc2440ii.c line 110

Quoted 2 lines
board/embest/sbc2440ii/sbc2440ii.c new file +2 -0
+	/* arch number of SBC2440-II Board */
+   gd->bd->bi_arch_number = MACH_TYPE_SBC2440II;

please use tab for indent

board/embest/sbc2440ii/sbc2440ii.c line 113

Quoted 3 lines
board/embest/sbc2440ii/sbc2440ii.c new file +3 -0
+
+	/* adress of boot parameters */
+	gd->bd->bi_boot_params = 0x30000100;

please use this style RAM_BASE + 0x100

board/embest/sbc2440ii/sbc2440ii.c line 116

Quoted 3 lines
board/embest/sbc2440ii/sbc2440ii.c new file +3 -0
+
+	icache_enable();
+	dcache_enable();

do you support mmu? if not enable the dcache will have no effect

board/embest/sbc2440ii/u-boot.lds

Quoted 12 lines
board/embest/sbc2440ii/sbc2440ii.c new file +11 -0
+
+	return 0;
+}
+
+int dram_init(void)
+{
+	gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+	gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+
+	return 0;
+}
board/embest/sbc2440ii/u-boot.lds +0 -0

please remove no more need

Quoted 2 lines

new file mode 100644
index 0000000..3b79776

<snip>

Quoted 29 lines
cpu/arm920t/s3c24x0/speed.c +4 -7
@@ -30,12 +30,15 @@
  */
 
 #include <common.h>
-#if defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB)
+#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || \
+    defined(CONFIG_S3C2440) || defined(CONFIG_TRAB)
 
 #if defined(CONFIG_S3C2400)
 #include <s3c2400.h>
 #elif defined(CONFIG_S3C2410)
 #include <s3c2410.h>
+#elif defined(CONFIG_S3C2440)
+#include <s3c2440.h>
 #endif
 
 #define MPLL 0
@@ -53,49 +56,81 @@
 
 static ulong get_PLLCLK(int pllreg)
 {
-    S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
-    ulong r, m, p, s;
-
-    if (pllreg == MPLL)
-	r = clk_power->MPLLCON;
-    else if (pllreg == UPLL)

cpu/arm920t/s3c24x0/speed.c line 59

Quoted 10 lines
cpu/arm920t/s3c24x0/speed.c +1 -9
-	r = clk_power->UPLLCON;
-    else
-	hang();
-
-    m = ((r & 0xFF000) >> 12) + 8;
-    p = ((r & 0x003F0) >> 4) + 2;
-    s = r & 0x3;
-
-    return((CONFIG_SYS_CLK_FREQ * m) / (p << s));
+	S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();

please do not mix codind style fix and new code in the same patch

Quoted 7 lines
cpu/arm920t/s3c24x0/speed.c +7 -0
+	ulong r, m, p, s;
+
+	if (pllreg == MPLL)
+		r = clk_power->MPLLCON;
+	else if (pllreg == UPLL)
+		r = clk_power->UPLLCON;
+	else

cpu/arm920t/s3c24x0/speed.c line 76

Quoted 10 lines
cpu/arm920t/s3c24x0/speed.c +10 -0
+		hang();
+
+	m = ((r & 0xFF000) >> 12) + 8;
+	p = ((r & 0x003F0) >> 4) + 2;
+	s = r & 0x3;
+
+#ifdef CONFIG_S3C2440
+	if (pllreg == MPLL)
+		return (2 * CONFIG_SYS_CLK_FREQ * m) / (p << s);
+	else

please add the #else here

Quoted 4 lines
cpu/arm920t/s3c24x0/speed.c +4 -0
+		return (CONFIG_SYS_CLK_FREQ * m) / (p << s);
+#else
+	return (CONFIG_SYS_CLK_FREQ * m) / (p << s);
+#endif

cpu/arm920t/s3c24x0/speed.c line 89

Quoted 10 lines
cpu/arm920t/s3c24x0/speed.c +1 -1
 }
 
 /* return FCLK frequency */
 ulong get_FCLK(void)
 {
-    return(get_PLLCLK(MPLL));
+	return get_PLLCLK(MPLL);
 }
 
 /* return HCLK frequency */

please send a new version before continuing the review as you mix codind style fix and new code in the same patch it's really hard to review

Best Regards,
J.

#3 lore raw

Hi Jean-Christophe

Comments below...

Quoted 38 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines · kevin.morfitt at fearnside-systems.co.uk

Implementation based on the existing u-boot support for S3C2410-based boards. u-boot programmed into NOR flash.

Tested on an SBC2440-II Board using tftp to copy the files from a server and programming them into NAND flash.

MAKEALL used to build all LIST_ARM9 targets only - no other architectures built as the changes only affect ARM9-based boards.

please limit your comments to 80 chars per line
could you split this patch in multiple subset as adding the 2440 support, addind the nand drivers and then adding the board.

This will really simplify the review

Quoted 3 lines
---
 MAKEALL                                |    1 +

please add MAINTAINERS entry

Quoted 1 line

<snip>

Quoted 14 lines
MAKEALL +12 -0
index c98d03a..e7235e4 100755
+ */
+
+#include <config.h>
+#include <version.h>
+
+/*
+ * Taken from linux/arch/arm/boot/compressed/head-s3c2410.S
+ *
+ * Copyright (C) 2002 Samsung Electronics SW.LEE  <[email protected]>
+ */
+
+#define BWSCON		0x48000000
Quoted 9 lines

MAKEALL

Quoted 7 lines
MAKEALL +6 -0
+
+#define DW8		(0x0)
+#define DW16		(0x1)
+#define DW32		(0x2)
+#define WAIT		(0x1 << 2)
+#define UBLB		(0x1 << 3)

what is all theses macro? for what use?

They make setting the fields of the memory controller registers more readable. For example BSWCON is
the Bus Width and Wait Control Register, DW32 sets a Data Width value bit-field in BWSCON to 8-bit
etc. They're used later in the patch to configure the memory controller registers. The names are the same
as those used in the S3C2440 data sheet.

Quoted 99 lines
Quoted 62 lines
MAKEALL +8 -0
+
+#define B1_BWSCON	(DW16)
+#define B2_BWSCON	(DW16)
+#define B3_BWSCON	(DW16 + WAIT + UBLB)
+#define B4_BWSCON	(DW16)
+#define B5_BWSCON	(DW16)
+#define B6_BWSCON	(DW32)
+#define B7_BWSCON	(DW32)
board/embest/sbc2440ii/sbc2440ii.c new file +44 -0
new file mode 100644
index 0000000..e0599dd
@@ -0,0 +1,127 @@
+/*
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Marius Groeger <[email protected]>
+ *
+ * (C) Copyright 2002
+ * David Mueller, ELSOFT AG, <[email protected]>
+ *
+ * (C) Copyright 2005
+ * JinHua Luo, GuangDong Linux Center, <[email protected]>
+ *
+ * Modified for the Embest SBC2440-II by
+ * (C) Copyright 2009
+ * Kevin Morfitt, Fearnside Systems Ltd, <[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 <common.h>
+#include <s3c2440.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Configure the PLLs for MPLL = 400MHz, UPLL = 48MHz
+	The clock frequency ratios are set to 1:4:8 ie:
+		PCLK = 50MHz
+		HCLK = 100MHz
+		FCLK = 400MHz

board/embest/sbc2440ii/sbc2440ii.c line 54

Quoted 10 lines
board/embest/sbc2440ii/sbc2440ii.c new file +10 -0
+ */
+/* The MPLL values. */
+#define M_MDIV	0x5C
+#define M_PDIV	1
+#define M_SDIV	1
+
+/* The UPLL values. */
+#define U_MDIV	0x38
+#define U_PDIV	2
+#define U_SDIV	2

this need to be in the config.h as CONFIS_SYS_xxxxx

Quoted 25 lines
board/embest/sbc2440ii/sbc2440ii.c new file +25 -0
+
+/*
+ * Miscellaneous platform dependent initialisations
+ */
+
+static inline void pll_settle_delay(unsigned long loops)
+{
+	__asm__ volatile ("1:\n"
+			  "subs %0, %1, #1\n"
+			  "bne 1b" : "=r" (loops) : "0" (loops));
+}
+
+int board_init(void)
+{
+	S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
+	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
+
+	/* to reduce PLL lock time, adjust the LOCKTIME register */
+	clk_power->LOCKTIME = 0xFFFFFFFF;
+
+	/* configure UPLL */
+	clk_power->UPLLCON = ((U_MDIV << 12) + (U_PDIV << 4) + U_SDIV);
+
+	/* some delay between UPLL and MPLL */
+	pll_settle_delay(8000);
Quoted 9 lines

board/embest/sbc2440ii/sbc2440ii.c line 85

Quoted 7 lines
board/embest/sbc2440ii/sbc2440ii.c new file +6 -0
+
+	/* configure MPLL */
+	clk_power->MPLLCON = ((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV);
+
+	/* configure the GPIO */
+	gpio->GPACON = 0x007FFFFF;

what means all these hardcoded values?

All they really do is set the GPIO's to default states and switch on an LED. I'll change it to use #defines
to make them more readable.

Quoted 21 lines

board/embest/sbc2440ii/sbc2440ii.c line 91

Quoted 7 lines
board/embest/sbc2440ii/sbc2440ii.c new file +6 -0
+	gpio->GPBCON = 0x00055555;
+	gpio->GPBUP  = 0x000007FF;
+	gpio->GPBDAT = 0x000001C0;		/* Switch on LED1. */
+	gpio->GPCCON = 0xAAAAAAAA;
+	gpio->GPCUP  = 0x0000FFFF;
+	gpio->GPDCON = 0xAAAAAAAA;

<snip>
+

board/embest/sbc2440ii/sbc2440ii.c line 110

Quoted 3 lines
board/embest/sbc2440ii/sbc2440ii.c new file +2 -0
+	/* arch number of SBC2440-II Board */
+   gd->bd->bi_arch_number = MACH_TYPE_SBC2440II;

please use tab for indent

board/embest/sbc2440ii/sbc2440ii.c line 113

Quoted 4 lines
board/embest/sbc2440ii/sbc2440ii.c new file +3 -0
+
+	/* adress of boot parameters */
+	gd->bd->bi_boot_params = 0x30000100;

please use this style RAM_BASE + 0x100

Quoted 6 lines

board/embest/sbc2440ii/sbc2440ii.c line 116

Quoted 4 lines
board/embest/sbc2440ii/sbc2440ii.c new file +3 -0
+
+	icache_enable();
+	dcache_enable();

do you support mmu? if not enable the dcache will have no effect

No mmu - I'll remove these lines.

Quoted 95 lines

board/embest/sbc2440ii/u-boot.lds

Quoted 13 lines
board/embest/sbc2440ii/sbc2440ii.c new file +11 -0
+
+	return 0;
+}
+
+int dram_init(void)
+{
+	gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+	gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+
+	return 0;
+}
board/embest/sbc2440ii/u-boot.lds +0 -0

please remove no more need

Quoted 3 lines

new file mode 100644
index 0000000..3b79776

<snip>

Quoted 30 lines
cpu/arm920t/s3c24x0/speed.c +4 -8
@@ -30,12 +30,15 @@
  */
 
 #include <common.h>
-#if defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB)
+#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || \
+    defined(CONFIG_S3C2440) || defined(CONFIG_TRAB)
 
 #if defined(CONFIG_S3C2400)
 #include <s3c2400.h>
 #elif defined(CONFIG_S3C2410)
 #include <s3c2410.h>
+#elif defined(CONFIG_S3C2440)
+#include <s3c2440.h>
 #endif
 
 #define MPLL 0
@@ -53,49 +56,81 @@
 
 static ulong get_PLLCLK(int pllreg)
 {
-    S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
-    ulong r, m, p, s;
-
-    if (pllreg == MPLL)
-	r = clk_power->MPLLCON;
-    else if (pllreg == UPLL)
-	r = clk_power->UPLLCON;

cpu/arm920t/s3c24x0/speed.c line 60

Quoted 10 lines
cpu/arm920t/s3c24x0/speed.c +1 -8
-    else
-	hang();
-
-    m = ((r & 0xFF000) >> 12) + 8;
-    p = ((r & 0x003F0) >> 4) + 2;
-    s = r & 0x3;
-
-    return((CONFIG_SYS_CLK_FREQ * m) / (p << s));
+	S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
 

please do not mix codind style fix and new code in the same patch

Quoted 8 lines
cpu/arm920t/s3c24x0/speed.c +8 -0
+	ulong r, m, p, s;
+
+	if (pllreg == MPLL)
+		r = clk_power->MPLLCON;
+	else if (pllreg == UPLL)
+		r = clk_power->UPLLCON;
+	else
+		hang();

cpu/arm920t/s3c24x0/speed.c line 82

Quoted 10 lines
cpu/arm920t/s3c24x0/speed.c +9 -0
+
+	m = ((r & 0xFF000) >> 12) + 8;
+	p = ((r & 0x003F0) >> 4) + 2;
+	s = r & 0x3;
+
+#ifdef CONFIG_S3C2440
+	if (pllreg == MPLL)
+		return (2 * CONFIG_SYS_CLK_FREQ * m) / (p << s);
+	else
 

please add the #else here

Quoted 13 lines
cpu/arm920t/s3c24x0/speed.c +5 -1
+		return (CONFIG_SYS_CLK_FREQ * m) / (p << s);
+#else
+	return (CONFIG_SYS_CLK_FREQ * m) / (p << s);
+#endif
 }
 
 /* return FCLK frequency */
 ulong get_FCLK(void)
 {
-    return(get_PLLCLK(MPLL));
+	return get_PLLCLK(MPLL);
 }
 
Quoted 7 lines

cpu/arm920t/s3c24x0/speed.c line 113

Quoted 2 lines
cpu/arm920t/s3c24x0/speed.c +0 -0
 /* return HCLK frequency */
 

please send a new version before continuing the review as you mix codind style fix and new code in the same patch it's really hard to review

OK - I'll make the changes and split it into multiple patches as you suggested then re-send.

Regards

Quoted 13 lines

Best Regards,
J.

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4125 (20090603) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

Signature · 17 lines
Kevin Morfitt
Fearnside Systems Ltd
25 Holbeck Road
Nottingham
NG8 3PB

t: 0115 9136703
m: 07939 126277
e: kevin.morfitt at fearnside-systems.co.uk



__________ Information from ESET NOD32 Antivirus, version of virus signature database 4126 (20090603) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
#4 lore raw

Dear "kevin.morfitt at fearnside-systems.co.uk",

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

board/embest/sbc2440ii/lowlevel_init.S line 53

Quoted 9 lines
board/embest/sbc2440ii/lowlevel_init.S new file +7 -0
+#define BWSCON		0x48000000
+
+#define DW8		(0x0)
+#define DW16		(0x1)
+#define DW32		(0x2)
+#define WAIT		(0x1 << 2)
+#define UBLB		(0x1 << 3)

what is all theses macro? for what use?

Quoted 7 lines

They make setting the fields of the memory controller registers more readable. For example BSWCON is
the Bus Width and Wait Control Register, DW32 sets a Data Width value bit-field in BWSCON to 8-bit
etc. They're used later in the patch to configure the memory controller registers. The names are the same
as those used in the S3C2440 data sheet.

Please make sure to use C structs to descrive device register layout, and use proper I/O accessor functions for the actual access.

Quoted 6 lines
Quoted 6 lines

board/embest/sbc2440ii/sbc2440ii.c line 91

Quoted 6 lines
board/embest/sbc2440ii/sbc2440ii.c new file +6 -0
+	gpio->GPBCON = 0x00055555;
+	gpio->GPBUP  = 0x000007FF;
+	gpio->GPBDAT = 0x000001C0;		/* Switch on LED1. */
+	gpio->GPCCON = 0xAAAAAAAA;
+	gpio->GPCUP  = 0x0000FFFF;
+	gpio->GPDCON = 0xAAAAAAAA;

Such code will not be accepted. Please use C structs and I/O accessor functions.

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
"Consistency requires you to be as ignorant today as you were a  year
ago."                                              - Bernard Berenson
#5 lore raw

Dear Wolfgang/Jean-Christophe

I'd be grateful if you could give me some advice on this please as I haven't been working with u-boot for very long.

Although the code you've both commented on is new it uses a lot of the existing Samsung S3C common code in cpu/arm920t/s3c24x0 and various s3c24x0 drivers code. This common code also has the problems you commented on and additionally it doesn't meet the coding style requirements. It would probably be better for me to re-work the existing common code first and submit a patch, then submit a new SBC2440-II Board patch based on the code after the re-work patch has been applied. I'm happy to do this but I just have a few questions:

- if I re-work the existing common S3C2410 code I can check the existing Samsung S3C boards still build but how do I make sure they still work (I can't test them as I only have an SBC2440-II Board)?
- once I've re-worked the existing common S3C2410 code a new patch for the SBC2440-II Board would only really make sense if it was based on the code after the common code re-work patch was applied. Is it OK to submit an SBC2440 Board patch that assumes the re-work patch has been applied first?

I'm sure this has come up before but I can't find any mention of it in the mail archives.

Regards
Kevin Morfitt

Quoted 46 lines · Wolfgang Denk

Dear "kevin.morfitt at fearnside-systems.co.uk",

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

board/embest/sbc2440ii/lowlevel_init.S line 53

Quoted 9 lines
board/embest/sbc2440ii/lowlevel_init.S new file +7 -0
+#define BWSCON		0x48000000
+
+#define DW8		(0x0)
+#define DW16		(0x1)
+#define DW32		(0x2)
+#define WAIT		(0x1 << 2)
+#define UBLB		(0x1 << 3)

what is all theses macro? for what use?

Quoted 8 lines

They make setting the fields of the memory controller registers more readable. For example BSWCON is
the Bus Width and Wait Control Register, DW32 sets a Data Width value bit-field in BWSCON to 8-bit
etc. They're used later in the patch to configure the memory controller registers. The names are the same
as those used in the S3C2440 data sheet.

Please make sure to use C structs to descrive device register layout, and use proper I/O accessor functions for the actual access.

Quoted 7 lines
Quoted 7 lines

board/embest/sbc2440ii/sbc2440ii.c line 91

Quoted 7 lines
board/embest/sbc2440ii/sbc2440ii.c new file +6 -0
+	gpio->GPBCON = 0x00055555;
+	gpio->GPBUP  = 0x000007FF;
+	gpio->GPBDAT = 0x000001C0;		/* Switch on LED1. */
+	gpio->GPCCON = 0xAAAAAAAA;
+	gpio->GPCUP  = 0x0000FFFF;
+	gpio->GPDCON = 0xAAAAAAAA;

Such code will not be accepted. Please use C structs and I/O accessor functions.

Best regards,

Wolfgang Denk

Signature · 17 lines
Kevin Morfitt
Fearnside Systems Ltd
25 Holbeck Road
Nottingham
NG8 3PB

t: 0115 9136703
m: 07939 126277
e: kevin.morfitt at fearnside-systems.co.uk



__________ Information from ESET NOD32 Antivirus, version of virus signature database 4126 (20090603) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
#6 lore raw

Dear Kevin,

Quoted 5 lines · in message <[email protected]> you wrote:

Although the code you've both commented on is new it uses a lot of the existing Samsung S3C common code in cpu/arm920t/s3c24x0 and various s3c24x0 drivers code. This common code also has the problems you commented on and additionally it doesn't meet the coding style

Yes, unfortunately we have not always been that strict in the past.

Quoted 4 lines

requirements. It would probably be better for me to re-work the existing common code first and submit a patch, then submit a new SBC2440-II Board patch based on the code after the re-work patch has been applied. I'm happy to do this but I just have a few questions:

Thanks a lot in advance.

Quoted 3 lines

- if I re-work the existing common S3C2410 code I can check the existing Samsung S3C boards still build but how do I make sure they still work (I can't test them as I only have an SBC2440-II Board)?

Such testing is supposed to be done by the respective board maintainers.

Quoted 5 lines

- once I've re-worked the existing common S3C2410 code a new patch for the SBC2440-II Board would only really make sense if it was based on the code after the common code re-work patch was applied. Is it OK to submit an SBC2440 Board patch that assumes the re-work patch has been applied first?

Yes, this is OK.

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
Men don't talk peace unless they're ready to back it up with war.
	-- Col. Green, "The Savage Curtain", stardate 5906.4