
On 00:14 Thu 26 Mar , kevin.morfitt@fearnside-systems.co.uk wrote:
Adds support for the Embest SBC2440-II Board (see http://www.embedinfo.com/english/product/sbc2440-II.asp) with u-boot programmed in NOR flash.
Implementation is based on the existing u-boot support for s3C2410-based boards. Where I've copied and modified existing files I've left the style of the original code as it was, including any non-conformance with the u-boot coding style. Where I've added new code I've aimed to use the u-boot coding style. I've run MAKEALL with the LIST_ARM9 targets only as the changes don't affect any other architectures.
Signed-off-by: Kevin Morfitt kevin.morfitt@fearnside-systems.co.uk
diff -uprN u-boot-2009.03/MAKEALL u-boot-2009.03-PATCHED/MAKEALL --- u-boot-2009.03/MAKEALL 2009-03-21 21:04:41.000000000 +0000 +++ u-boot-2009.03-PATCHED/MAKEALL 2009-03-25 21:48:14.171875000 +0000 @@ -512,6 +512,7 @@ LIST_ARM9=" \ omap5912osk \ omap730p2 \ sbc2410x \
- sbc2440ii \ scb9328 \ smdk2400 \ smdk2410 \
diff -uprN u-boot-2009.03/Makefile u-boot-2009.03-PATCHED/Makefile --- u-boot-2009.03/Makefile 2009-03-21 21:04:41.000000000 +0000 +++ u-boot-2009.03-PATCHED/Makefile 2009-03-22 09:42:11.078125000 +0000 @@ -2821,6 +2821,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
diff -uprN u-boot-2009.03/board/embest/sbc2440ii/Makefile u-boot-2009.03-PATCHED/board/embest/sbc2440ii/Makefile --- u-boot-2009.03/board/embest/sbc2440ii/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ u-boot-2009.03-PATCHED/board/embest/sbc2440ii/Makefile 2009-03-22 09:44:24.640625000 +0000 @@ -0,0 +1,51 @@ +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, wd@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 +#
+include $(TOPDIR)/config.mk
+LIB = $(obj)lib$(BOARD).a
+COBJS := sbc2440ii.o flash.o sbc2440ii_cmd.o +SOBJS := lowlevel_init.o
+SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) +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
+######################################################################### diff -uprN u-boot-2009.03/board/embest/sbc2440ii/config.mk u-boot-2009.03-PATCHED/board/embest/sbc2440ii/config.mk --- u-boot-2009.03/board/embest/sbc2440ii/config.mk 1970-01-01 00:00:00.000000000 +0000 +++ u-boot-2009.03-PATCHED/board/embest/sbc2440ii/config.mk 2009-03-25 21:05:21.281250000 +0000 @@ -0,0 +1,25 @@ +# +# (C) Copyright 2002 +# Gary Jennejohn, DENX Software Engineering, gj@denx.de +# David Mueller, ELSOFT AG, d.mueller@elsoft.ch +# +# 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, kevin.morfitt@fearnside-systems.co.uk
please fix
+# +# 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 diff -uprN u-boot-2009.03/board/embest/sbc2440ii/flash.c u-boot-2009.03-PATCHED/board/embest/sbc2440ii/flash.c
please use cfi driver
--- u-boot-2009.03/board/embest/sbc2440ii/flash.c 1970-01-01 00:00:00.000000000 +0000 +++ u-boot-2009.03-PATCHED/board/embest/sbc2440ii/flash.c 2009-03-22 21:43:19.765625000 +0000 @@ -0,0 +1,437 @@ +/*
- (C) Copyright 2002
- Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- Alex Zuepke azu@sysgo.de
- See file CREDITS for list of people who contributed to this
- project.
diff -uprN u-boot-2009.03/board/embest/sbc2440ii/lowlevel_init.S u-boot-2009.03-PATCHED/board/embest/sbc2440ii/lowlevel_init.S --- u-boot-2009.03/board/embest/sbc2440ii/lowlevel_init.S 1970-01-01 00:00:00.000000000 +0000 +++ u-boot-2009.03-PATCHED/board/embest/sbc2440ii/lowlevel_init.S 2009-03-25 21:04:56.656250000 +0000 @@ -0,0 +1,188 @@ +/*
- Memory Setup stuff - taken from blob memsetup.S
- Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) and
Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl)
- Modified for the Samsung SMDK2410 by
- (C) Copyright 2002
- David Mueller, ELSOFT AG, d.mueller@elsoft.ch
- Modified for the friendly-arm SBC-2410X by
- (C) Copyright 2005
- JinHua Luo, GuangDong Linux Center, luo.jinhua@gd-linux.com
- Modified for the Embest SBC2440-II by
- (C) Copyright 2009
- Kevin Morfitt, Fearnside Systems Ltd,
please fix
- 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 <config.h> +#include <version.h>
+/*
- Taken from linux/arch/arm/boot/compressed/head-s3c2410.S
- Copyright (C) 2002 Samsung Electronics SW.LEE
please fix please move define to a header and please use tab for indentation please check your patch with checkpatch.pl please use CAPITAL in macro name
- */
+#define BWSCON 0x48000000
+/* BWSCON */ +#define DW8 (0x0) +#define DW16 (0x1) +#define DW32 (0x2) +#define WAIT (0x1<<2) +#define UBLB (0x1<<3)
+#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)
+#define B0_Tacs 0x0 +#define B0_Tcos 0x0 +#define B0_Tacc 0x7 +#define B0_Tcoh 0x0 +#define B0_Tah 0x0 +#define B0_Tacp 0x0
<snip>
+/**************************************/
+_TEXT_BASE:
- .word TEXT_BASE
+.globl lowlevel_init +lowlevel_init:
- /* memory control configuration */
- /* make r0 relative the current location so that it */
- /* reads SMRDATA out of FLASH rather than memory ! */
- ldr r0, =SMRDATA
- ldr r1, _TEXT_BASE
- sub r0, r0, r1
- ldr r1, =BWSCON /* Bus Width Status Controller */
- add r2, r0, #13*4
+0:
- ldr r3, [r0], #4
- str r3, [r1], #4
- cmp r2, r0
- bne 0b
- /* everything is fine now */
- mov pc, lr
- .ltorg
+/* the literal pools origin */
+SMRDATA:
- .word
(0+(B1_BWSCON<<4)+(B2_BWSCON<<8)+(B3_BWSCON<<12)+(B4_BWSCON<<16)+(B5_BWSCON<<20)+(B6_BWSCON<<24)+(B7_BWSCON<<28))
- .word
((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+(B0_Tacp<<2)+(B0_PMC))
- .word
((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+(B1_Tacp<<2)+(B1_PMC))
- .word
((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_Tacp<<2)+(B2_PMC))
- .word
((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+(B3_Tah<<4)+(B3_Tacp<<2)+(B3_PMC))
- .word
((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+(B4_Tah<<4)+(B4_Tacp<<2)+(B4_PMC))
- .word
((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+(B5_Tah<<4)+(B5_Tacp<<2)+(B5_PMC))
- .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN))
- .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN))
- .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT)
- .word ((BURST_EN<<7)+(SCKE_EN<<5)+(SCLK_EN<<4)+(BK67MAP))
- .word ((WBL6<<9)+(TM6<<7)+(CL6<<4)+(BT6<<3)+(BL6))
- .word ((WBL7<<9)+(TM7<<7)+(CL7<<4)+(BT7<<3)+(BL7))
please add space before and after '<<' and '+' please becarefull of the line limit 80 chars
diff -uprN u-boot-2009.03/board/embest/sbc2440ii/sbc2440ii.c u-boot-2009.03-PATCHED/board/embest/sbc2440ii/sbc2440ii.c --- u-boot-2009.03/board/embest/sbc2440ii/sbc2440ii.c 1970-01-01 00:00:00.000000000 +0000 +++ u-boot-2009.03-PATCHED/board/embest/sbc2440ii/sbc2440ii.c 2009-03-25 21:05:14.171875000 +0000 @@ -0,0 +1,127 @@ +/*
- (C) Copyright 2002
- Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- Marius Groeger mgroeger@sysgo.de
- (C) Copyright 2002
- David Mueller, ELSOFT AG, d.mueller@elsoft.ch
- (C) Copyright 2005
- JinHua Luo, GuangDong Linux Center, luo.jinhua@gd-linux.com
- Modified for the Embest SBC2440-II by
- (C) Copyright 2009
- Kevin Morfitt, Fearnside Systems Ltd,
kevin.morfitt@fearnside-systems.co.uk
- 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;
+static inline void delay (unsigned long loops) +{
- __asm__ volatile ("1:\n"
"subs %0, %1, #1\n"
"bne 1b":"=r" (loops):"0" (loops));
+}
please do this in the timer
+/* 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
- */
+/* 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
+/*
- Miscellaneous platform dependent initialisations
- */
+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;
please use proper accessor readx/writex
- /* configure UPLL */
- clk_power->UPLLCON = ((U_MDIV << 12) + (U_PDIV << 4) + U_SDIV);
- /* some delay between UPLL and MPLL */
- delay (8000);
- /* configure MPLL */
- clk_power->MPLLCON = ((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV);
- /* configure the GPIO */
- gpio->GPACON = 0x007FFFFF;
- gpio->GPBCON = 0x00055555;
- gpio->GPBUP = 0x000007FF;
- gpio->GPBDAT = 0x000001C0; /* Switch on LED1. */
- gpio->GPCCON = 0xAAAAAAAA;
- gpio->GPCUP = 0x0000FFFF;
- gpio->GPDCON = 0xAAAAAAAA;
- gpio->GPDUP = 0x0000FFFF;
- gpio->GPECON = 0xAAAAA800;
- gpio->GPEUP = 0x00001FFF;
- gpio->GPFCON = 0x000055AA;
- gpio->GPFUP = 0x000000FF;
- gpio->GPGCON = 0xFD95FFBA;
- gpio->GPGUP = 0x0000FFFF;
- gpio->GPHCON = 0x0002FAAA;
- gpio->GPHUP = 0x000007FF;
- gpio->GPJCON = 0x02FAAAAA;
- gpio->GPJUP = 0x00001FFF;
- gpio->EXTINT0 = 0x22222222;
- gpio->EXTINT1 = 0x22222222;
- gpio->EXTINT2 = 0x22222222;
- gpio->EINTMASK = 0x00FFFFF0;
- /* arch number of SBC2440-II Board */
- gd->bd->bi_arch_number = MACH_TYPE_SBC2440II;
- /* adress of boot parameters */
- gd->bd->bi_boot_params = 0x30000100;
- icache_enable();
- dcache_enable();
- 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;
+} diff -uprN u-boot-2009.03/board/embest/sbc2440ii/sbc2440ii_cmd.c u-boot-2009.03-PATCHED/board/embest/sbc2440ii/sbc2440ii_cmd.c --- u-boot-2009.03/board/embest/sbc2440ii/sbc2440ii_cmd.c 1970-01-01 00:00:00.000000000 +0000 +++ u-boot-2009.03-PATCHED/board/embest/sbc2440ii/sbc2440ii_cmd.c 2009-03-25 21:05:37.984375000 +0000 @@ -0,0 +1,61 @@ +/*
- (C) Copyright 2009
- Kevin Morfitt, Fearnside Systems Ltd,
kevin.morfitt@fearnside-systems.co.uk
- 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 <net.h>
+#if 0
- #define DEBUGN printf
+#else
- #define DEBUGN(x, args ...) {}
+#endif
please remove add use debug()
+static int get_file_tftp(struct cmd_tbl_s *cmftp, int flag, int argc, char *argv[]);
+U_BOOT_CMD(
- tftp, 3, 0, get_file_tftp,
- "tftp\t- Upload a file via TFTP",
- "<address> <file name> - Upload <file name> to <address> via TFTP"
+);
please move this file to common add add a REAMDE
+static int get_file_tftp(struct cmd_tbl_s *cmftp, int flag, int argc, char *argv[]) +{
- load_addr = simple_strtoul(argv[1], NULL, 16);
- copy_filename(BootFile, argv[2], sizeof (BootFile));
- NetBootFileXferSize = 0;
- DEBUGN("TFTP: Filename: %s Address: 0x%08X\n", BootFile, (unsigned
int)load_addr);
- if (NetLoop (TFTP) <= 0) {
printf("ERROR: tftp transfer failed\n");
return -1;
- }
- if (NetBootFileXferSize == 0) {
printf("ERROR: Can't determine file size\n");
return -1;
- }
- printf("File transfer succeeded - file size %lu bytes\n",
NetBootFileXferSize);
- return 0;
+} diff -uprN u-boot-2009.03/board/embest/sbc2440ii/u-boot.lds u-boot-2009.03-PATCHED/board/embest/sbc2440ii/u-boot.lds --- u-boot-2009.03/board/embest/sbc2440ii/u-boot.lds 1970-01-01 00:00:00.000000000 +0000 diff -uprN u-boot-2009.03/cpu/arm920t/s3c24x0/i2c.c
<snip>
please fix coding style first for a full review and please use git to generate the patch
Best Regards, J.