Add support for Mini2440
Hi all,
This is a first patch to introduce the support of the Mini2440. It's a board based on the S3C2440, arm920t. I based the support on the code of BusError (old version of u-boot).
I have a few work to do again, like some clean up in the configuration file. Currently, with this patch, we can boot from NOR and the network is available (tftp, dhcp, ...). Boot from NAND will be the next step (and laters MMC).
Best regards,
PATCH v2 1/1 Add support for Mini2440
A little review of my first patch. As you can see, I removed some unnecessary modifications that I did in arm920t directory ... (I don't really remember why I did it), and some modifications on drivers (nand and i2c) that was unnecessary because I am not currently supporting theses features.
I forget to say in my first mail that is a porting from an old version of u-boot patched by BusError (Michel Pollet).
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v2 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Dear Gabriel Huau,
Quoted 76 lines
---
Changes for v2:
- Coding style cleanup
- Remove unnecessary files modification
- Remove unnecessary board configuration set--- arch/arm/include/asm/arch-s3c24x0/s3c24x0.h | 51 +----- board/friendlyarm/mini2440/Makefile | 45 +++++ board/friendlyarm/mini2440/lowlevel_init.S | 177 +++++++++++++++++ board/friendlyarm/mini2440/mini2440.c | 283 +++++++++++++++++++++++++++ boards.cfg | 1 + include/configs/mini2440.h | 203 +++++++++++++++++++ 6 files changed, 710 insertions(+), 50 deletions(-) create mode 100644 board/friendlyarm/mini2440/Makefile create mode 100644 board/friendlyarm/mini2440/lowlevel_init.S create mode 100644 board/friendlyarm/mini2440/mini2440.c create mode 100644 include/configs/mini2440.h(quoted diff) +0
-0
b/arch/arm/include/asm/arch-s3c24x0/s3c24x0.hindex ca978c9..96e623b 100644arch/arm/include/asm/arch-s3c24x0/s3c24x0.h +1
-40@@ -416,7 +416,7 @@ struct s3c24x0_gpio {u32 misccr;u32 extint;#endif -#ifdef CONFIG_S3C2410 +#if defined(CONFIG_S3C2410 ) || defined(CONFIG_S3C2440 )u32 gpacon;u32 gpadat;u32 res1[2 ];@@ -467,55 +467,6 @@ struct s3c24x0_gpio {u32 gstatus4;#endif #if defined(CONFIG_S3C2440 ) -u32 gpacon; -u32 gpadat; -u32 res1[2 ]; -u32 gpbcon; -u32 gpbdat; -u32 gpbup; -u32 res2; -u32 gpccon; -u32 gpcdat; -u32 gpcup; -u32 res3; -u32 gpdcon; -u32 gpddat; -u32 gpdup; -u32 res4; -u32 gpecon; -u32 gpedat; -u32 gpeup; -u32 res5; -u32 gpfcon; -u32 gpfdat; -u32 gpfup; -u32 res6; -u32 gpgcon; -u32 gpgdat; -u32 gpgup; -u32 res7; -u32 gphcon; -u32 gphdat; -u32 gphup; -u32 res8; - -u32 misccr; -u32 dclkcon; -u32 extint0; -u32 extint1; -u32 extint2; -u32 eintflt0; -u32 eintflt1;
arch/arm/include/asm/arch-s3c24x0/s3c24x0.h struct s3c24x0_gpio { · line 518
Quoted 10 lines
arch/arm/include/asm/arch-s3c24x0/s3c24x0.h +0
-10-u32 eintflt2; -u32 eintflt3; -u32 eintmask; -u32 eintpend; -u32 gstatus0; -u32 gstatus1; -u32 gstatus2; -u32 gstatus3; -u32 gstatus4; -
Why did you drop this? Also, put this in a separate patch please ...
board/friendlyarm/mini2440/Makefile line 2
Quoted 11 lines
arch/arm/include/asm/arch-s3c24x0/s3c24x0.h +0
-0u32 res9;u32 dsc0;u32 dsc1;(quoted diff) +0
-0b/board/friendlyarm/mini2440/Makefile new file mode 100644 index 0000000..065f1db
board/friendlyarm/mini2440/Makefile new file +2
-0@@ -0,0 +1,45 @@ +# +# (C) Copyright 2000-2006
2012 ;-)
Quoted 49 lines
board/friendlyarm/mini2440/Makefile new file +43
-0+# Wolfgang Denk, DENX Software Engineering, wd 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 +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS := mini2440.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) + $(call cmd_link_o_target, $(OBJS) $(SOBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################(quoted diff) +0
-0
b/board/friendlyarm/mini2440/lowlevel_init.Snew file mode 100644 index 0000000..2a057ea
board/friendlyarm/mini2440/lowlevel_init.S line 9
Quoted 9 lines
board/friendlyarm/mini2440/lowlevel_init.S new file +9
-0@@ -0,0 +1,177 @@ +/* + * Memory Setup stuff - taken from blob memsetup.S + * + * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw at its.tudelft.nl) and + * Jan-Derk Bakker (J.D.Bakker at its.tudelft.nl) + * + * Modified for the Samsung SMDK2410 by + * (C) Copyright 2002 + * David Mueller, ELSOFT AG, <[email protected]>
Your name is missing
Quoted 98 lines
board/friendlyarm/mini2440/lowlevel_init.S new file +26
-0+ * + * 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<[email protected]> + */
board/friendlyarm/mini2440/lowlevel_init.S new file +71
-0+ +#define BWSCON 0x48000000 +#define INTMSK 0x4A000008 /* Interupt-Controller base addresses */ +#define INTSUBMSK 0x4A00001C + +/* BWSCON */ +#define DW8 (0x0) +#define DW16 (0x1) +#define DW32 (0x2) +#define WAIT (0x1<<2) +#define UBLB (0x1<<3) + +#define B1_BWSCON (DW32) +#define B2_BWSCON (DW16) +#define B3_BWSCON (DW16 + WAIT + UBLB) +#define B4_BWSCON (DW16 + WAIT + UBLB) +#define B5_BWSCON (DW16) +#define B6_BWSCON (DW32) +#define B7_BWSCON (DW32) + +/* BANK0CON */ +#define B0_Tacs 0x0 /* 0clk */ +#define B0_Tcos 0x0 /* 0clk */ +#define B0_Tacc 0x7 /* 14clk */ +#define B0_Tcoh 0x0 /* 0clk */ +#define B0_Tah 0x0 /* 0clk */ +#define B0_Tacp 0x0 +#define B0_PMC 0x0 /* normal */ + +/* BANK1CON */ +#define B1_Tacs 0x0 /* 0clk */ +#define B1_Tcos 0x0 /* 0clk */ +#define B1_Tacc 0x7 /* 14clk */ +#define B1_Tcoh 0x0 /* 0clk */ +#define B1_Tah 0x0 /* 0clk */ +#define B1_Tacp 0x0 +#define B1_PMC 0x0 + +#define B2_Tacs 0x0 +#define B2_Tcos 0x0 +#define B2_Tacc 0x7 +#define B2_Tcoh 0x0 +#define B2_Tah 0x0 +#define B2_Tacp 0x0 +#define B2_PMC 0x0 + +#define B3_Tacs 0x0 /* 0clk */ +#define B3_Tcos 0x3 /* 4clk */ +#define B3_Tacc 0x7 /* 14clk */ +#define B3_Tcoh 0x1 /* 1clk */ +#define B3_Tah 0x3 /* 4clk */ +#define B3_Tacp 0x0 /* 2clk */ +#define B3_PMC 0x0 /* normal */ + +#define B4_Tacs 0x0 +#define B4_Tcos 0x3 +#define B4_Tacc 0x7 +#define B4_Tcoh 0x1 +#define B4_Tah 0x3 +#define B4_Tacp 0x0 +#define B4_PMC 0x0 + +#define B5_Tacs 0x0 /* 0clk */ +#define B5_Tcos 0x0 /* 0clk */ +#define B5_Tacc 0x7 /* 14clk */ +#define B5_Tcoh 0x0 /* 0clk */ +#define B5_Tah 0x0 /* 0clk */ +#define B5_Tacp 0x0 +#define B5_PMC 0x0 /* normal */ + +#define SDRAM_MT 0x3 /* SDRAM */
board/friendlyarm/mini2440/lowlevel_init.S
Quoted 10 lines
board/friendlyarm/mini2440/lowlevel_init.S new file +10
-0+#define SDRAM_Trcd 0x0 /* 2clk */ +#define SDRAM_SCAN_9 0x1 /* 9bit */ +#define SDRAM_SCAN_10 0x2 /* 10bit */ + +#define SDRAM_128MB ((SDRAM_MT<<15)+(SDRAM_Trcd<<2)+(SDRAM_SCAN_10)) +#define SDRAM_64MB ((SDRAM_MT<<15)+(SDRAM_Trcd<<2)+(SDRAM_SCAN_9)) + +/* REFRESH parameter */ +#define REFEN 0x1 /* Refresh enable */ +#define TREFMD 0x0 /* CBR(CAS before RAS)/Auto
refresh */
board/friendlyarm/mini2440/lowlevel_init.S
Quoted 5 lines
board/friendlyarm/mini2440/lowlevel_init.S new file +5
-0+#define Trp 0x1 /* 3clk */ +#define Trc 0x3 /* 7clk */ +#define Tchr 0x0 /* unused */ + +#define REFCNT 1012 /* period=10.37us, HCLK=100Mhz,
(2048+1-10.37*100)
Either move this to header or make this start.S generic.
board/friendlyarm/mini2440/lowlevel_init.S
Quoted 7 lines
*/ +
board/friendlyarm/mini2440/lowlevel_init.S new file +6
-0+_TEXT_BASE: + .word CONFIG_SYS_TEXT_BASE + +.globl lowlevel_init +lowlevel_init: + // disable all interupts
The gas can crunch such c++ comments?
Quoted 43 lines
board/friendlyarm/mini2440/lowlevel_init.S new file +36
-0+ mov r1, #0xffffffff + ldr r0, =INTMSK + str r1, [r0] + + ldr r1, =0x7fff + ldr r0, =INTSUBMSK + str r1, [r0] + + /* 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 + + /* + * SDRAM configuration for 64MB + */ + ldr r1, =BWSCON+(7*4) + ldr r0, =SDRAM_64MB + str r0, [r1], #4 + str r0, [r1] +return: + /* everything is fine now */ + mov pc, lr + + .ltorg +SMRDATA: + .word(0+(B1_BWSCON<<4)+(B2_BWSCON<<8)+(B3_BWSCON<<12)+(B4_BWSCON<<16)+(B5_BWSCO
N<<20)+(B6_BWSCON<<24)+(B7_BWSCON<<28)) + .word
((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+(B0_Tac
p<<2)+(B0_PMC)) + .word
((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+(B1_Tac
p<<2)+(B1_PMC)) + .word
((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_Tac
Quoted 8 lines
p<<2)+(B2_PMC)) + .word
((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+(B3_Tah<<4)+(B3_Tac
p<<2)+(B3_PMC)) + .word
((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+(B4_Tah<<4)+(B4_Tac
p<<2)+(B4_PMC)) + .word
((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+(B5_Tah<<4)+(B5_Tac
p<<2)+(B5_PMC)) + .wordSDRAM_128MB
+ .wordSDRAM_128MB
SDRAM128? You had SDRAM64 there before ...
Quoted 55 lines
board/friendlyarm/mini2440/lowlevel_init.S new file +4
-0+ .word ((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) + .word 0xb2 /* enable burst */ + .word 0x30 + .word 0x30(quoted diff) +0
-0
b/board/friendlyarm/mini2440/mini2440.cnew file mode 100644 index 0000000..ecfb519board/friendlyarm/mini2440/mini2440.c new file +45
-0@@ -0,0 +1,283 @@ +/* +* (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 2009 +* Michel Pollet <[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 <asm/arch/s3c2440.h> +#include <video_fb.h> + +#ifdef CONFIG_DRIVER_DM9000 +#include <netdev.h> +#endif + +DECLARE_GLOBAL_DATA_PTR ; + +/* FCLK = 405 MHz, HCLK = 101 MHz, PCLK = 50 MHz, UCLK = 48 MHz */ +#define CLKDIVN_VAL 7 +#define M_MDIV 0x7f +#define M_PDIV 0x2 +#define M_SDIV 0x1
board/friendlyarm/mini2440/mini2440.c line 55
Quoted 10 lines
board/friendlyarm/mini2440/mini2440.c new file +10
-0+ +#define U_M_MDIV 0x38 +#define U_M_PDIV 0x2 +#define U_M_SDIV 0x2 + +#define MVAL (0) +#define MVAL_USED (0) //0=each frame 1=rate by MVAL +#define INVVDEN (1) //0=normal 1=inverted +#define BSWP (0) //Byte swap control +#define HWSWP (1) //Half word swap control
C++ comments, move this stuff to separate define too ?
Quoted 15 lines
board/friendlyarm/mini2440/mini2440.c new file +15
-0+ +//TFT 240320 +#define LCD_XSIZE_TFT_240320 (240) +#define LCD_YSIZE_TFT_240320 (320) + +//TFT240320 +#define HOZVAL_TFT_240320 (LCD_XSIZE_TFT_240320-1) +#define LINEVAL_TFT_240320 (LCD_YSIZE_TFT_240320-1) + +//Timing parameter for NEC3.5" +#define VBPD_240320 (3) +#define VFPD_240320 (10) +#define VSPW_240320 (1) + +#define HBPD_240320 (5)
board/friendlyarm/mini2440/mini2440.c line 80
Quoted 10 lines
board/friendlyarm/mini2440/mini2440.c new file +10
-0+#define HFPD_240320 (2) +#define HSPW_240320 (36) + +#define CLKVAL_TFT_240320 (3) + +static inline void delay (unsigned long loops) +{ + __asm__volatile ("1:\n" +"subs %0, %1, #1\n" +"bne 1b" :"=r" (loops):"0" (loops));
Why do you need this?
Quoted 6 lines
board/friendlyarm/mini2440/mini2440.c new file +5
-0+} + +int arch_cpu_init (void ) +{ + struct s3c24x0_clock_power * const clk_power =
s3c24x0_get_base_clock_power(); + int i;
board/friendlyarm/mini2440/mini2440.c
Quoted 9 lines
board/friendlyarm/mini2440/mini2440.c new file +9
-0+ +/* to reduce PLL lock time, adjust the LOCKTIME register */ + clk_power->locktime =0xFFFFFF ; + clk_power->clkdivn =CLKDIVN_VAL ; + +/* configure UPLL */ + clk_power->upllcon = ((U_M_MDIV <<12 ) + (U_M_PDIV <<4 ) +U_M_SDIV ); +/* some delay between MPLL and UPLL */ +for (i =0 ; i <100000 ; i++);
This will be opt-out by GCC under certain conditions, unless you put membarrier here ... which is not what you want to do -- just add simple udelay() here ?
Quoted 47 lines
board/friendlyarm/mini2440/mini2440.c new file +16
-0+ +/* configure MPLL */ + clk_power->mpllcon = ((M_MDIV <<12 ) + (M_PDIV <<4 ) +M_SDIV ); + +/* some delay between MPLL and UPLL */ +for (i =0 ; i <500000 ; i++); + +return 0 ; +} + +/* +* Miscellaneous platform dependent initialisations +*/ +int board_init (void ) +{ + struct s3c24x0_clock_power * const clk_power =
s3c24x0_get_base_clock_power(); + structs3c24x0_gpio* const gpio =s3c24x0_get_base_gpio();board/friendlyarm/mini2440/mini2440.c new file +29
-0+ +/* to reduce PLL lock time, adjust the LOCKTIME register */ + clk_power->locktime =0xFFFFFF ; + clk_power->clkdivn =CLKDIVN_VAL ; + +/* configure UPLL */ + clk_power->upllcon = ((U_M_MDIV <<12 ) + (U_M_PDIV <<4 ) +U_M_SDIV ); +/* some delay between MPLL and UPLL */ +delay (10 ); +/* configure MPLL */ + clk_power->mpllcon = ((M_MDIV <<12 ) + (M_PDIV <<4 ) +M_SDIV ); + +/* some delay between MPLL and UPLL */ +delay (8000 ); + + gpio->gpacon =0x007FFFFF ;/* Port A is all "special" */ +// port B outputs reconfigured + gpio->gpbcon = + (0x1 <<0 ) |// GPB0 OUT TOUT0 PWM Buzzer + (0x2 <<2 ) |// GPB1 OUT TOUT1 LCD Backlight + (0x1 <<4 ) |// GPB2 OUT L3MODE + (0x1 <<6 ) |// GBP3 OUT L3DATA + (0x1 <<8 ) |// GBP4 OUT L3CLOCK + (0x1 <<10 ) |// GBP5 OUT LED1 + (0x1 <<12 ) |// GBP6 OUT LED2 + (0x1 <<14 ) |// GBP7 OUT LED3 + (0x1 <<16 ) |// GBP8 OUT LED4 + (0x2 <<18 ) |// GBP9 --- nXDACK0 CON5 EBI + (0x2 << 20) | // GBP10 --- nXDREQ0 CON5 EBI
board/friendlyarm/mini2440/mini2440.c
Quoted 10 lines
board/friendlyarm/mini2440/mini2440.c new file +10
-0+0 ; + gpio->gpbup = (1 <<10 ) -1 ;// disable pullup on all 10 pins + gpio->gpbdat = + (0 <<5 ) |/* turn LED 1 on */ + (1 <<6 ) |/* turn LED 1 off */ + (1 <<7 ) |/* turn LED 1 off */ + (1 <<8 ) |/* turn LED 1 off */ +0 ; + +// lcd signals on C and D
Did you run this through ./tools/checkpatch.pl ?
Quoted 17 lines
board/friendlyarm/mini2440/mini2440.c new file +17
-0+ gpio->gpccon = (0xAAAAAAAA &/* all default IN but ... */ + ~(0x3 <<10 )) |/* not pin 5 ... */ + (0x1 <<10 );/* that is output (USBD) */ + gpio->gpcup =0xFFFFFFFF ; + gpio->gpcdat =0 ; + + gpio->gpdcon =0xAAAAAAAA ; + gpio->gpdup =0xFFFFFFFF ; +// port E is set for all it's special functions (i2c, spi etc) + gpio->gpecon =0xAAAAAAAA ; + gpio->gpeup =0x0000FFFF ; + + gpio->gpfcon = + (0x1 <<0 ) |// GPG0 EINT0 OUT + (0x1 <<2 ) |// GPG1 EINT1 OUT + (0x1 <<4 ) |// GPG2 EINT2 OUT + (0x1 << 6) | // GPG3 EINT3 OUT
board/friendlyarm/mini2440/mini2440.c
Quoted 10 lines
board/friendlyarm/mini2440/mini2440.c new file +10
-0+ (0x1 <<8 ) |// GPG4 EINT4 OUT + (0x1 <<10 ) |// GPG5 EINT5 OUT + (0x1 <<12 ) |// GPG6 EINT6 OUT + (0x0 <<14 ) |// GPG7 EINT7 IN DM9000 +0 ; + gpio->gpfdat =0 ; + gpio->gpfup = + ((1 <<7 ) -1 )// all disabled + & ~(1 <<7 )// but for the ethernet one, we need it. + ;
Friendship is magic, that's true ... but magic doesn't make good friendship ;-D
Quoted 4 lines
board/friendlyarm/mini2440/mini2440.c new file +4
-0+ gpio->gpgcon = + (0x0 <<0 ) |// GPG0 EINT8 IN Key1 + (0x1 <<2 ) |// GPG1 EINT9 OUT Con5 + (0x1 << 4) | // GPG2 EINT10 OUT
board/friendlyarm/mini2440/mini2440.c
Quoted 10 lines
board/friendlyarm/mini2440/mini2440.c new file +10
-0+ (0x0 <<6 ) |// GPG3 EINT11 IN Key2 + (0x0 <<8 ) |// GPG4 EINT12 IN Smart Screen Interrupt + (0x0 <<10 ) |// GPG5 EINT13 IN Key3 + (0x0 <<12 ) |// GPG6 EINT14 IN Key4 + (0x0 <<14 ) |// GPG7 EINT15 IN Key5 + (0x1 <<16 ) |// GPG8 EINT16 OUT nCD_SD + (0x1 <<18 ) |// GPG9 EINT17 OUT + (0x1 <<20 ) |// GPG10 EINT18 OUT + (0x0 <<22 ) |// GPG11 EINT19 IN Key6 + (0x0 << 24) | // GPG12 EINT18 IN // GPG[12..15] need to
be inputs
Quoted 22 lines
board/friendlyarm/mini2440/mini2440.c new file +22
-0+ (0x0 <<26 ) |// GPG13 EINT18 IN // hard pullups + (0x0 <<28 ) |// GPG14 EINT18 IN + (0x0 <<30 ) |// GPG15 EINT18 IN +0 ; + gpio->gpgup = (1 <<15 ) -1 ;// disable pullups for all pins + + gpio->gphcon = + (0x2 <<0 ) |// GPH0 nCTS0 --- + (0x2 <<2 ) |// GPH1 nRTS0 --- + (0x2 <<4 ) |// GPH2 TXD0 --- + (0x2 <<6 ) |// GPH3 RXD0 --- + (0x2 <<8 ) |// GPH4 TXD1 --- + (0x2 <<10 ) |// GPH5 RXD1 --- + (0x2 <<12 ) |// GPH6 [TXD2] nRTS1 + (0x2 <<14 ) |// GPH7 [RXD2] nCTS1 + (0x1 <<16 ) |// GPH8 UEXTCLK OUT + (0x1 <<18 ) |// GPH9 CLKOUT0 OUT + (0x1 <<20 ) |// GPH10 CLKOUT1 OUT +0 ; + gpio->gphup = (1 <<10 ) -1 ;// disable pullups for all pins + + gpio->extint0=0x22222222 ;
board/friendlyarm/mini2440/mini2440.c
Quoted 10 lines
board/friendlyarm/mini2440/mini2440.c new file +10
-0+ gpio->extint1=0x22222222 ; + gpio->extint2=0x22222222 ; + +/* USB Device Part */ +/* GPC5 is reset for USB Device */ + gpio->gpcdat |= (1 <<5 ) ; +udelay (20000 ); + gpio->gpcdat &= ~(1 <<5 ) ; +udelay (20000 ); + gpio->gpcdat |= (1 <<5 ) ;
Drop the magic bloat, replace with #defined stuff in header files.
board/friendlyarm/mini2440/mini2440.c
Quoted 5 lines
board/friendlyarm/mini2440/mini2440.c new file +5
-0+ +/* arch number from kernel post 2.6.28 */ +#ifndef MACH_TYPE_MINI2440 +#define MACH_TYPE_MINI2440 1999 +#endif
#define MACH_TYPE ... see eg. include/configs/m28evk.h and arch/arm/lib/board.c, you can drop it all.
Quoted 24 lines
board/friendlyarm/mini2440/mini2440.c new file +18
-0+ gd->bd->bi_arch_number =MACH_TYPE_MINI2440 ; + +/* adress of boot parameters */ + gd->bd->bi_boot_params =0x30000100 ; + +return 0 ; +} + +void board_video_init (GraphicDevice *pGD) +{ +struct s3c24x0_lcd *const lcd =s3c24x0_get_base_lcd (); + +/* FIXME: select LCM type by env variable */ +/* Configuration for GTA01 LCM on QT2410 */ + lcd->lcdcon1 =0x00000378 ;/* CLKVAL=4, BPPMODE=16bpp, TFT, ENVID=0 */ + lcd->lcdcon5 =0x00000f09 ; + + lcd->lcdcon2 =(VBPD_240320<<24)|(LINEVAL_TFT_240320<<14)|(VFPD_240320<<6)|(VSPW_240320);
board/friendlyarm/mini2440/mini2440.c new file +5
-0+ lcd->lcdcon3 = (HBPD_240320 <<19 )|(HOZVAL_TFT_240320 <<8 )|(HFPD_240320 ); + lcd->lcdcon4 = (MVAL <<8 )|(HSPW_240320 ); + + lcd->lpcsel =0x00000000 ; +}
board/friendlyarm/mini2440/mini2440.c
Quoted 10 lines
board/friendlyarm/mini2440/mini2440.c new file +10
-0+ +void dram_init_banksize (void ) +{ +struct s3c24x0_memctl *const mem =s3c24x0_get_base_memctl (); + gd->bd->bi_dram[0 ].start =PHYS_SDRAM_1 ; +/* if the early bootloader found 128MB, lets tell the kernel */ +if ((mem->bankcon[6 ] &0x3 ) ==0x2 ) + gd->bd->bi_dram[0 ].size =128 *1024 *1024 ; +else + gd->bd->bi_dram[0 ].size =64 *1024 *1024 ;
Magic bloat, fix.
Quoted 73 lines
board/friendlyarm/mini2440/mini2440.c new file +18
-0+} + +int dram_init (void ) +{ + gd->ram_size =64 *1024 *1024 ; +return 0 ; +} + +int board_eth_init (bd_t *bis) +{ +#ifdef CONFIG_DRIVER_DM9000 +return dm9000_initialize (bis); +#else +return 0 ; +#endif +} + +/* The sum of all part_size[]s must equal to the NAND size, i.e.,
0x4000000*/ +unsigned int dynpart_size[] = {0x40000,0x20000,0x500000,0xffffffff, 0 }; +char *dynpart_names[] = { "u-boot", "u-boot_env", "kernel", "rootfs", NULL }; diff --git a/boards.cfg b/boards.cfg index 3cf75c3..93eeb3c 100644boards.cfg +0
-0@@ -61,6 +61,7 @@ mx1ads arm arm920t - - scb9328 arm arm920t - - imx cm4008 armarm920t - - ks8695 cm41xx
arm arm920t - - ks8695
+mini2440 arm arm920t mini2440
friendlyarm s3c24x0 VCMA9 arm arm920t
vcma9 mpl s3c24x0 smdk2410
arm arm920t - samsung s3c24x0
omap1510inn arm arm925t -
ti diff --gita/include/configs/mini2440.hb/include/configs/mini2440.hnew file mode 100644
index 0000000..8b04a76include/configs/mini2440.h new file +33
-0@@ -0,0 +1,203 @@ +/* +* (C) Copyright 2002 +* Sysgo Real-Time Solutions, GmbH <www.elinos.com> +* Marius Groeger <[email protected]> +* Gary Jennejohn <[email protected]> +* David Mueller <[email protected]> +* +* (C) Copyright 2009-2010 +* Michel Pollet <[email protected]> +* +* (C) Copyright 2012 +* Gabriel Huau <[email protected]> +* +* Configuation settings for the MINI2440 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 +*/
include/configs/mini2440.h line 43
Quoted 10 lines
include/configs/mini2440.h new file +10
-0+ +#ifndef __CONFIG_H +#define __CONFIG_H + +#define CONFIG_SYS_TEXT_BASE 0x0 + +/* +* High Level Configuration Options +*/ +#define CONFIG_ARM920T 1/* This is an ARM920T Core
*/
include/configs/mini2440.h line 44
Quoted 1 line
include/configs/mini2440.h new file +1
-0+#define CONFIG_S3C24X0 1/* in a SAMSUNG S3C2440 SoC
*/
include/configs/mini2440.h line 45
Quoted 1 line
include/configs/mini2440.h new file +1
-0+#define CONFIG_S3C2440 1/* in a SAMSUNG S3C2440 SoC
Indent here is inconsistent!
Quoted 51 lines
*/
include/configs/mini2440.h new file +10
-0+#define CONFIG_MINI2440 1/* on a MIN2440 Board */ + +/* +* It is possible to have u-boot save it's environment in NOR, however, +* reember it is incompatible with booting from NAND as the NOR is not +* available at that point. So use this only if you use nand as storage +* and will never boot from it +*/ +#define CONFIG_MINI2440_NOR_ENV 1 +#define CONFIG_MINI2440_OVERCLOCK 1/* allow use of frequencies over 405Mhz */ +
include/configs/mini2440.h new file +4
-0+/* +* input clock of PLL +*/ +#define CONFIG_SYS_CLK_FREQ 12000000/* MINI2440 has 12.0000MHz input clock */ +#define
CONFIG_ARCH_CPU_INIT1 /* for the initialization of PLL */ +include/configs/mini2440.h new file +8
-0+#define USE_920T_MMU 1 +#define CONFIG_BAUDRATE 115200 + +/* +* Size of malloc() pool +*/ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2048*1024) +#define CONFIG_GBL_DATA_SIZE 128/* size in bytes reserved for initial data */ +
include/configs/mini2440.h new file +24
-0+/* +* Hardware drivers +*/ +#define CONFIG_DRIVER_DM9000 1 +#define CONFIG_DRIVER_DM9000_NO_EEPROM 1 +#define CONFIG_DM9000_BASE 0x20000300 +#define DM9000_IO CONFIG_DM9000_BASE +#define DM9000_DATA (CONFIG_DM9000_BASE+4) + +/* +* select serial console configuration +*/ +#define CONFIG_S3C24X0_SERIAL +#define CONFIG_SERIAL1 1/* we use SERIAL 1 on MINI2440 */ + +/* +* allow to overwrite serial and ethaddr +*/ +#define CONFIG_ENV_OVERWRITE + +/* +* Command definition +*/ +#include <config_cmd_default.h>
include/configs/mini2440.h
Quoted 10 lines
include/configs/mini2440.h new file +10
-0+ +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_PORTIO +#define CONFIG_CMD_REGINFO +#define CONFIG_CMD_SAVES + +/* +* Miscellaneous configurable options +*/ +#define CONFIG_LONGHELP /* undef to save memory
*/
Quoted 1 line
+#define
CONFIG_SYS_PROMPT"MINI2440 # " /* Monitor
Make this "=> "
Quoted 2 lines
Command Prompt */
+#defineCONFIG_SYS_CBSIZE256 /* Console I/O
Buffer Size */
Quoted 1 line
+#define
CONFIG_SYS_PBSIZE
(CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
Quoted 1 line
/* Print Buffer Size */ +#define
CONFIG_SYS_MAXARGS32
/* max number of
Quoted 2 lines
command args */
+#defineCONFIG_SYS_BARGSIZECONFIG_SYS_CBSIZE/* Boot Argument
Buffer
Quoted 2 lines
Size */ +
+#defineCONFIG_SYS_MEMTEST_START0x30000000/* memtest works on
*/
Quoted 1 line
+#define
CONFIG_SYS_MEMTEST_END0x34000000/* 64 MB in DRAM
*/
include/configs/mini2440.h
Quoted 4 lines
include/configs/mini2440.h new file +4
-0+ +#undef CONFIG_CLKS_IN_HZ/* everything, incl board info, in Hz */ + +#define CONFIG_SYS_LOAD_ADDR 0x32000000/* default load
address */
Quoted 27 lines
include/configs/mini2440.h new file +26
-0+ +/* +* the PWM TImer 4 uses a counter of 15625 for 10 ms, so we need +* it to wrap 100 times (total 1562500) to get 1 sec. +*/ +#define CONFIG_SYS_HZ 1562500 + +/* +* valid baudrates +*/ +#define CONFIG_SYS_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 (128*1024)/* regular stack */ +#ifdef CONFIG_USE_IRQ +#define CONFIG_STACKSIZE_IRQ (8*1024)/* IRQ stack */ +#define CONFIG_STACKSIZE_FIQ (4*1024)/* FIQ stack */ +#endif + +/* +* Physical Memory Map +*/ +#define CONFIG_NR_DRAM_BANKS 1/* we have 1 bank of DRAM */ +#define
PHYS_SDRAM_10x30000000/* SDRAM Bank #1 */
include/configs/mini2440.h
Quoted 2 lines
include/configs/mini2440.h new file +2
-0+#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE +
0x100000 - \
Quoted 12 lines
include/configs/mini2440.h new file +5
-0+ GENERATED_GBL_DATA_SIZE) + +/* +* When booting from NAND, it is impossible to access the lowest addresses +* due to the SteppingStone being in the way. Luckily the NOR doesn't really + * care about the highest 16 bits of address, so we set the controlers + * registers to go and poke over there, instead.
+ */include/configs/mini2440.h new file +4
-0+#define PHYS_FLASH_1 0x0 +#define CONFIG_SYS_FLASH_BASE 0x0 + +/*
include/configs/mini2440.h
Quoted 10 lines
include/configs/mini2440.h new file +10
-0+* NOR FLASH organization +* Now uses the standard CFI interface +* FLASH and environment organization +*/ +#define CONFIG_SYS_FLASH_CFI 1 +#define CONFIG_FLASH_CFI_DRIVER 1 +#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT +#define CONFIG_SYS_MONITOR_BASE 0x0 +#define CONFIG_SYS_MAX_FLASH_BANKS 1/* max number of memory banks */ +#define CONFIG_SYS_MAX_FLASH_SECT 512/* 512 * 4096 sectors, or 32 *
64k
Quoted 8 lines
blocks */ +#define
CONFIG_FLASH_SHOW_PROGRESS1include/configs/mini2440.h new file +6
-0+ +/* +* u-boot environmnent +*/ +#define CONFIG_BOOTDELAY 3 +#define CONFIG_BOOTARGS "root=/dev/mtdblock3 rootfstype=jffs2console=ttySAC0,115200" +#define
CONFIG_ETHADDR
08:08:11:18:12:27
include/configs/mini2440.h
Quoted 3 lines
include/configs/mini2440.h new file +3
-0+#define CONFIG_NETMASK 255.255.255.0 +#define CONFIG_IPADDR 192.168.0.2 +#define CONFIG_SERVERIP 192.168.0.1
Remove, NAK.
include/configs/mini2440.h
Quoted 6 lines
include/configs/mini2440.h new file +2
-0+#define CONFIG_DOS_PARTITION 1 +#define CONFIG_BOOTCOMMAND "tftp 0x32000000 uImage;setenv bootargsconsole=ttySAC0,115200 mem=16M noinitrd mini2440=5tb ip=dhcp;bootm" +
include/configs/mini2440.h new file +3
-0+#ifndef CONFIG_MINI2440_NOR_ENV +#define CONFIG_ENV_IS_IN_NAND 1 +#define CONFIG_ENV_OFFSET_OOB 1 // dont define for
CONFIG_ENV_IS_IN_FLASH
Quoted 2 lines
include/configs/mini2440.h new file +1
-0+/* This size must be the size of a common denominator for the NAND erase block */ + #define
CONFIG_ENV_SIZE0x20000/* 128k Total
Size of
include/configs/mini2440.h
Quoted 4 lines
Environment Sector */ +#else
include/configs/mini2440.h new file +3
-0+#define CONFIG_ENV_IS_IN_FLASH 1 +#define CONFIG_MY_ENV_OFFSET 0x40000 +#define CONFIG_ENV_ADDR (PHYS_FLASH_1 + CONFIG_MY_ENV_OFFSET)/*
addr of
Quoted 1 line
environment */ + #define
CONFIG_ENV_SIZE0x4000/* 16k
Total Size of
Quoted 11 lines
Environment Sector */ +#endif
include/configs/mini2440.h new file +10
-0+#define CONFIG_PREBOOT_OVERRIDE 1 + +/* ATAG configuration */ +#define CONFIG_INITRD_TAG 1 +#define CONFIG_SETUP_MEMORY_TAGS 1 +#define CONFIG_CMDLINE_TAG 1 +#define CONFIG_CMDLINE_EDITING 1 +#define CONFIG_AUTO_COMPLETE 1 + +#endif /* __CONFIG_H */
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
In reply to Gabriel Huau---
Changes for v2:
- Coding style cleanup
- Remove unnecessary files modification
- Remove unnecessary board configuration set
Changes for v3:
- Coding style cleanup
- Move some macro definition from lowlevel_init.S to a new header
- Remove some "magic bloat" with I/O board initialization
- Add a pll_delay and replace loop by it
- Somme cleanup in the configuration file
- Cancel modifications on an SoC specific header
- Add my name to copyright
--- board/friendlyarm/mini2440/Makefile | 45 ++++++ board/friendlyarm/mini2440/lowlevel_init.S | 76 ++++++++++ board/friendlyarm/mini2440/mini2440.c | 139 ++++++++++++++++++ board/friendlyarm/mini2440/mini2440.h | 104 ++++++++++++++ boards.cfg | 1 + include/configs/mini2440.h | 215 ++++++++++++++++++++++++++++ 6 files changed, 580 insertions(+) create mode 100644 board/friendlyarm/mini2440/Makefile create mode 100644 board/friendlyarm/mini2440/lowlevel_init.S create mode 100644 board/friendlyarm/mini2440/mini2440.c create mode 100644 board/friendlyarm/mini2440/mini2440.h create mode 100644 include/configs/mini2440.h
board/friendlyarm/mini2440/Makefile new file +45 -0
@@ -0,0 +1,45 @@ +# +# (C) Copyright 2012 +# Wolfgang Denk, DENX Software Engineering, wd 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 +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS := mini2440.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) + $(call cmd_link_o_target, $(OBJS) $(SOBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
board/friendlyarm/mini2440/lowlevel_init.S new file +76 -0
76 lines not on this page · raw message
board/friendlyarm/mini2440/mini2440.c new file +139 -0
139 lines not on this page · raw message
board/friendlyarm/mini2440/mini2440.h new file +104 -0
104 lines not on this page · raw message
boards.cfg +1 -0
@@ -61,6 +61,7 @@ mx1ads arm arm920t - - scb9328 arm arm920t - - imx cm4008 arm arm920t - - ks8695 cm41xx arm arm920t - - ks8695 +mini2440 arm arm920t mini2440 friendlyarm s3c24x0 VCMA9 arm arm920t vcma9 mpl s3c24x0 smdk2410 arm arm920t - samsung s3c24x0 omap1510inn arm arm925t - ti
include/configs/mini2440.h new file +215 -0
215 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Dear Gabriel Huau,
Quoted 163 lines
---
Changes for v2:
- Coding style cleanup
- Remove unnecessary files modification
- Remove unnecessary board configuration setChanges for v3:
- Coding style cleanup
- Move some macro definition fromlowlevel_init.Sto a new header
- Remove some "magic bloat" with I/O board initialization
- Add apll_delayand replace loop by it
- Somme cleanup in the configuration file
- Cancel modifications on an SoC specific header
- Add my name to copyright--- board/friendlyarm/mini2440/Makefile | 45 ++++++ board/friendlyarm/mini2440/lowlevel_init.S | 76 ++++++++++ board/friendlyarm/mini2440/mini2440.c | 139 ++++++++++++++++++ board/friendlyarm/mini2440/mini2440.h | 104 ++++++++++++++ boards.cfg | 1 + include/configs/mini2440.h | 215 ++++++++++++++++++++++++++++ 6 files changed, 580 insertions(+) create mode 100644 board/friendlyarm/mini2440/Makefile create mode 100644 board/friendlyarm/mini2440/lowlevel_init.S create mode 100644 board/friendlyarm/mini2440/mini2440.c create mode 100644 board/friendlyarm/mini2440/mini2440.h create mode 100644 include/configs/mini2440.h(quoted diff) +0
-0b/board/friendlyarm/mini2440/Makefile new file mode 100644 index 0000000..e8d68cb
board/friendlyarm/mini2440/Makefile new file +45
-0@@ -0,0 +1,45 @@ +# +# (C) Copyright 2012 +# Wolfgang Denk, DENX Software Engineering, wd 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 +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS := mini2440.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) + $(call cmd_link_o_target, $(OBJS) $(SOBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################(quoted diff) +0
-0
b/board/friendlyarm/mini2440/lowlevel_init.Snew file mode 100644 index 0000000..f69a08cboard/friendlyarm/mini2440/lowlevel_init.S new file +63
-0@@ -0,0 +1,76 @@ +/* + * Memory Setup stuff - taken from blob memsetup.S + * + * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw at its.tudelft.nl) and + * Jan-Derk Bakker (J.D.Bakker at its.tudelft.nl) + * + * Modified for the Samsung SMDK2410 by + * (C) Copyright 2002 + * David Mueller, ELSOFT AG, <[email protected]> + * + * (C) Copyright 2012 + * Gabriel Huau <[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 <config.h> +#include <version.h> +#include "mini2440.h" + +_TEXT_BASE: + .word CONFIG_SYS_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_BWSCO
N<<20)+(B6_BWSCON<<24)+(B7_BWSCON<<28)) + .word
((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+(B0_Tac
p<<2)+(B0_PMC)) + .word
((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+(B1_Tac
p<<2)+(B1_PMC)) + .word
((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_Tac
p<<2)+(B2_PMC)) + .word
((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+(B3_Tah<<4)+(B3_Tac
p<<2)+(B3_PMC)) + .word
((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+(B4_Tah<<4)+(B4_Tac
p<<2)+(B4_PMC)) + .word
((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+(B5_Tah<<4)+(B5_Tac p<<2)+(B5_PMC)) +
board/friendlyarm/mini2440/lowlevel_init.S line 76
Quoted 6 lines
board/friendlyarm/mini2440/lowlevel_init.S new file +6
-0+ .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 0x32 + .word 0x30 + .word 0x30
What this undocumented stuff?
Quoted 67 lines
(quoted diff) +0
-0
b/board/friendlyarm/mini2440/mini2440.cnew file mode 100644 index 0000000..9ba8d39board/friendlyarm/mini2440/mini2440.c new file +61
-0@@ -0,0 +1,139 @@ +/* +* (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 2009 +* Michel Pollet <[email protected]> +* +* (C) Copyright 2012 +* Gabriel Huau <[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 <asm/arch/s3c2440.h> +#include <asm/io.h> +#include <video_fb.h> +#include "mini2440.h" + +#ifdef CONFIG_DRIVER_DM9000 +#include <netdev.h> +#endif + +DECLARE_GLOBAL_DATA_PTR ; + +static inline void pll_delay (unsigned long loops) +{ + __asm__volatile ("1:\n" +"subs %0, %1, #1\n" +"bne 1b" :"=r" (loops) :"0" (loops)); +} + +int arch_cpu_init (void ) +{ +struct s3c24x0_clock_power *const clk_power = +s3c24x0_get_base_clock_power (); + +/* to reduce PLL lock time, adjust the LOCKTIME register */ + clk_power->locktime =0xFFFFFF ; + clk_power->clkdivn =CLKDIVN_VAL ; +
board/friendlyarm/mini2440/mini2440.c line 71
Quoted 10 lines
board/friendlyarm/mini2440/mini2440.c new file +10
-0+/* configure UPLL */ + clk_power->upllcon = ((U_M_MDIV <<12 ) + (U_M_PDIV <<4 ) +U_M_SDIV ); +/* some delay between MPLL and UPLL */ +pll_delay (100000 ); + +/* configure MPLL */ + clk_power->mpllcon = ((M_MDIV <<12 ) + (M_PDIV <<4 ) +M_SDIV ); + +/* some delay between MPLL and UPLL */ +pll_delay (500000 );
You use udelay() below, do you need pll_delay() at all?
Quoted 232 lines
board/friendlyarm/mini2440/mini2440.c new file +66
-0+ +return 0 ; +} + +/* +* Miscellaneous platform dependent initialisations +*/ +int board_init (void ) +{ +struct s3c24x0_clock_power *const clk_power = +s3c24x0_get_base_clock_power (); +struct s3c24x0_gpio *const gpio =s3c24x0_get_base_gpio (); + +/* to reduce PLL lock time, adjust the LOCKTIME register */ + clk_power->locktime =0xFFFFFF ; + clk_power->clkdivn =CLKDIVN_VAL ; + +/* configure UPLL */ + clk_power->upllcon = ((U_M_MDIV <<12 ) + (U_M_PDIV <<4 ) +U_M_SDIV ); +/* some delay between MPLL and UPLL */ +udelay (10 ); +/* configure MPLL */ + clk_power->mpllcon = ((M_MDIV <<12 ) + (M_PDIV <<4 ) +M_SDIV ); + +/* some delay between MPLL and UPLL */ +udelay (8000 ); + +/* set up the I/O ports */ +writel (0x007FFFFF , &gpio->gpacon); +writel (0x00044555 , &gpio->gpbcon); +writel (0x000007FF , &gpio->gpbup); +writel (0xAAAAAAAA , &gpio->gpccon); +writel (0x0000FFFF , &gpio->gpcup); +writel (0xAAAAAAAA , &gpio->gpdcon); +writel (0x0000FFFF , &gpio->gpdup); +writel (0xAAAAAAAA , &gpio->gpecon); +writel (0x0000FFFF , &gpio->gpeup); +writel (0x000055AA , &gpio->gpfcon); +writel (0x000000FF , &gpio->gpfup); +writel (0xFF95FFBA , &gpio->gpgcon); +writel (0x0000FFFF , &gpio->gpgup); +writel (0x002AFAAA , &gpio->gphcon); +writel (0x000007FF , &gpio->gphup); + +/* adress of boot parameters */ + gd->bd->bi_boot_params =CONFIG_BOOT_PARAM_ADDR ; + +return 0 ; +} + +int dram_init (void ) +{ + gd->ram_size =PHYS_SDRAM_1_SIZE ; +return 0 ; +} + +int board_eth_init (bd_t *bis) +{ +#ifdef CONFIG_DRIVER_DM9000 +return dm9000_initialize (bis); +#else +return 0 ; +#endif +} + +/* The sum of all part_size[]s must equal to the NAND size, i.e.,
0x4000000*/ +unsigned int dynpart_size[] = {0x40000,0x20000,0x500000,0xffffffff, 0 }; +char *dynpart_names[] = { "u-boot", "u-boot_env", "kernel", "rootfs", NULL }; diff --gita/board/friendlyarm/mini2440/mini2440.hb/board/friendlyarm/mini2440/mini2440.hnew file mode 100644 index 0000000..02197c8board/friendlyarm/mini2440/mini2440.h new file +3
-0@@ -0,0 +1,104 @@ +/* +* Taken from linux/arch/arm/boot/compressed/head-s3c2410.S +* Copyright (C) 2002 Samsung Electronics SW.LEE <[email protected]> + */
board/friendlyarm/mini2440/mini2440.h new file +100
-0+ +#ifndef BOARD_LL_MINI2440_H +#define BOARD_LL_MINI2440_H + +/* +* PLL/Clock configuration +*/ +/* FCLK = 405 MHz, HCLK = 101 MHz, PCLK = 50 MHz, UCLK = 48 MHz */ +#define CLKDIVN_VAL 7 +#define M_MDIV 0x7f +#define M_PDIV 0x2 +#define M_SDIV 0x1 + +#define U_M_MDIV 0x38 +#define U_M_PDIV 0x2 +#define U_M_SDIV 0x2 + +/* BWSCON */ +#define BWSCON 0x48000000 +#define DW8 (0x0) +#define DW16 (0x1) +#define DW32 (0x2) +#define WAIT (0x1<<2) +#define UBLB (0x1<<3) + +#define B1_BWSCON (DW32) +#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) + +/* BANK0CON */ +#define B0_Tacs 0x0/* 0clk */ +#define B0_Tcos 0x0/* 0clk */ +#define B0_Tacc 0x7/* 14clk */ +#define B0_Tcoh 0x0/* 0clk */ +#define B0_Tah 0x0/* 0clk */ +#define B0_Tacp 0x0 +#define B0_PMC 0x0/* normal */ + +/* BANK1CON */ +#define B1_Tacs 0x0/* 0clk */ +#define B1_Tcos 0x0/* 0clk */ +#define B1_Tacc 0x7/* 14clk */ +#define B1_Tcoh 0x0/* 0clk */ +#define B1_Tah 0x0/* 0clk */ +#define B1_Tacp 0x0 +#define B1_PMC 0x0 + +#define B2_Tacs 0x0 +#define B2_Tcos 0x0 +#define B2_Tacc 0x7 +#define B2_Tcoh 0x0 +#define B2_Tah 0x0 +#define B2_Tacp 0x0 +#define B2_PMC 0x0 + +#define B3_Tacs 0x0/* 0clk */ +#define B3_Tcos 0x3/* 4clk */ +#define B3_Tacc 0x7/* 14clk */ +#define B3_Tcoh 0x1/* 1clk */ +#define B3_Tah 0x0/* 0clk */ +#define B3_Tacp 0x3/* 6clk */ +#define B3_PMC 0x0/* normal */ + +#define B4_Tacs 0x0/* 0clk */ +#define B4_Tcos 0x0/* 0clk */ +#define B4_Tacc 0x7/* 14clk */ +#define B4_Tcoh 0x0/* 0clk */ +#define B4_Tah 0x0/* 0clk */ +#define B4_Tacp 0x0 +#define B4_PMC 0x0/* normal */ + +#define B5_Tacs 0x0/* 0clk */ +#define B5_Tcos 0x0/* 0clk */ +#define B5_Tacc 0x7/* 14clk */ +#define B5_Tcoh 0x0/* 0clk */ +#define B5_Tah 0x0/* 0clk */ +#define B5_Tacp 0x0 +#define B5_PMC 0x0/* normal */ + +#define B6_MT 0x3/* SDRAM */ +#define B6_Trcd 0x1 +#define B6_SCAN 0x1/* 9bit */ + +#define B7_MT 0x3/* SDRAM */ +#define B7_Trcd 0x1/* 3clk */ +#define B7_SCAN 0x1/* 9bit */ + +/* REFRESH parameter */ +#define REFEN 0x1/* Refresh enable */ +#define TREFMD 0x0/* CBR(CAS before RAS)/Auto refresh */ +#define Trp 0x0/* 2clk */ +#define Trc 0x3/* 7clk */ +#define Tchr 0x2/* 3clk */ +#define REFCNT 1113/* period=15.6us, HCLK=60Mhz */ + +#endif boards.cfg +0
-0@@ -61,6 +61,7 @@ mx1ads arm arm920t - - scb9328 arm arm920t - - imx cm4008 armarm920t - - ks8695 cm41xx
arm arm920t - - ks8695
+mini2440 arm arm920t mini2440
friendlyarm s3c24x0 VCMA9 arm arm920t
vcma9 mpl s3c24x0 smdk2410
arm arm920t - samsung s3c24x0
omap1510inn arm arm925t -
ti diff --gita/include/configs/mini2440.hb/include/configs/mini2440.hnew file mode 100644
index 0000000..a3f06d0include/configs/mini2440.h new file +33
-0@@ -0,0 +1,215 @@ +/* +* (C) Copyright 2002 +* Sysgo Real-Time Solutions, GmbH <www.elinos.com> +* Marius Groeger <[email protected]> +* Gary Jennejohn <[email protected]> +* David Mueller <[email protected]> +* +* (C) Copyright 2009-2010 +* Michel Pollet <[email protected]> +* +* (C) Copyright 2012 +* Gabriel Huau <[email protected]> +* +* Configuation settings for the MINI2440 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 +*/
include/configs/mini2440.h line 43
Quoted 10 lines
include/configs/mini2440.h new file +10
-0+ +#ifndef __CONFIG_H +#define __CONFIG_H + +#define CONFIG_SYS_TEXT_BASE 0x0 + +/* +* High Level Configuration Options +*/ +#define CONFIG_ARM920T 1/* This is an ARM920T Core
*/
Quoted 61 lines
include/configs/mini2440.h new file +61
-0+#define CONFIG_S3C24X0 1/* in a SAMSUNG S3C2440 SoC */ +#define CONFIG_S3C2440 1/* in a SAMSUNG S3C2440 SoC */ +#define CONFIG_MINI2440 1/* on a MIN2440 Board */ + +#define MACH_TYPE_MINI2440 1999 +#define CONFIG_MACH_TYPE MACH_TYPE_MINI2440 + +/* +* It is possible to have u-boot save it's environment in NOR, however, +* reember it is incompatible with booting from NAND as the NOR is not +* available at that point. So use this only if you use nand as storage +* and will never boot from it +*/ +#define CONFIG_MINI2440_NOR_ENV 1 +/* allow use of frequencies over 405Mhz */ +#define CONFIG_MINI2440_OVERCLOCK 1 + +/* +* input clock of PLL +*/ +/* MINI2440 has 12.0000MHz input clock */ +#define CONFIG_SYS_CLK_FREQ 12000000 +#define CONFIG_ARCH_CPU_INIT 1/* for the initialization of PLL */ + +#define USE_920T_MMU 1 +#define CONFIG_BAUDRATE 115200 + +/* +* Size of malloc() pool +*/ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2048*1024) +/* size in bytes reserved for initial data */ +#define CONFIG_GBL_DATA_SIZE 128 + +/* +* Hardware drivers +*/ +#define CONFIG_DRIVER_DM9000 1 +#define CONFIG_DRIVER_DM9000_NO_EEPROM 1 +#define CONFIG_DM9000_BASE 0x20000300 +#define DM9000_IO CONFIG_DM9000_BASE +#define DM9000_DATA (CONFIG_DM9000_BASE+4) + +/* +* select serial console configuration +*/ +#define CONFIG_S3C24X0_SERIAL +#define CONFIG_SERIAL1 1 + +/* +* allow to overwrite serial and ethaddr +*/ +#define CONFIG_ENV_OVERWRITE + +/* +* Command definition +*/ +#include <config_cmd_default.h> + +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_PORTIO
include/configs/mini2440.h
Quoted 10 lines
include/configs/mini2440.h new file +10
-0+#define CONFIG_CMD_REGINFO +#define CONFIG_CMD_SAVES + +/* +* Miscellaneous configurable options +*/ +#define CONFIG_LONGHELP +#define CONFIG_SYS_PROMPT "MINI2440 => " +#define CONFIG_SYS_CBSIZE 256 +#define CONFIG_SYS_PBSIZE
(CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
include/configs/mini2440.h
Quoted 5 lines
include/configs/mini2440.h new file +5
-0+#define CONFIG_SYS_MAXARGS 32 +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE + +#define CONFIG_SYS_MEMTEST_START 0x30000000 +#define CONFIG_SYS_MEMTEST_END 0x34000000/* 64MB in DRAM
*/
Quoted 36 lines
include/configs/mini2440.h new file +35
-0+ +/* everything, incl board info, in Hz */ +#undef CONFIG_CLKS_IN_HZ + +/* default load address */ +#define CONFIG_SYS_LOAD_ADDR 0x32000000 + +/* boot parameters address */ +#define CONFIG_BOOT_PARAM_ADDR 0x30000100 + +/* +* the PWM TImer 4 uses a counter of 15625 for 10 ms, so we need +* it to wrap 100 times (total 1562500) to get 1 sec. +*/ +#define CONFIG_SYS_HZ 1562500 + +/* +* valid baudrates +*/ +#define CONFIG_SYS_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 (128*1024)/* regular stack */ +#ifdef CONFIG_USE_IRQ +#define CONFIG_STACKSIZE_IRQ (8*1024)/* IRQ stack */ +#define CONFIG_STACKSIZE_FIQ (4*1024)/* FIQ stack */ +#endif + +/* +* Physical Memory Map +*/ +#define CONFIG_NR_DRAM_BANKS 1/* we have 1 bank of DRAM */ +#define
PHYS_SDRAM_10x30000000/* SDRAM Bank #1 */
include/configs/mini2440.h
Quoted 3 lines
include/configs/mini2440.h new file +3
-0+#define PHYS_SDRAM_1_SIZE (64*1024*1024)/* 64MB of DRAM */ +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x1000
- \
Quoted 26 lines
include/configs/mini2440.h new file +5
-0+ GENERATED_GBL_DATA_SIZE) + +/* +* When booting from NAND, it is impossible to access the lowest addresses +* due to the SteppingStone being in the way. Luckily the NOR doesn't really + * care about the highest 16 bits of address, so we set the controlers + * registers to go and poke over there, instead.
+ */include/configs/mini2440.h new file +18
-0+#define PHYS_FLASH_1 0x0 +#define CONFIG_SYS_FLASH_BASE 0x0 + +/* +* NOR FLASH organization +* Now uses the standard CFI interface +* FLASH and environment organization +*/ +#define CONFIG_SYS_FLASH_CFI 1 +#define CONFIG_FLASH_CFI_DRIVER 1 +#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT +#define CONFIG_SYS_MONITOR_BASE 0x0 +/* max number of memory banks */ +#define CONFIG_SYS_MAX_FLASH_BANKS 1 +/* 512 * 4096 sectors, or 32 * 64k blocks */ +#define CONFIG_SYS_MAX_FLASH_SECT 512 +#define CONFIG_FLASH_SHOW_PROGRESS 1 +
include/configs/mini2440.h line 194
Quoted 10 lines
include/configs/mini2440.h new file +10
-0+/* +* u-boot environmnent +*/ +#define CONFIG_BOOTDELAY 3 +#define CONFIG_BOOTARGS "root=/dev/sdb1 console=ttySAC0,115200" +#define CONFIG_NETMASK 255.255.255.0 +#define CONFIG_IPADDR 192.168.0.2 +#define CONFIG_SERVERIP 192.168.0.1 +#define CONFIG_DOS_PARTITION 1 +#define CONFIG_BOOTCOMMAND "tftp 0x32000000 uImage;bootm"
DROP THIS!
Quoted 21 lines
include/configs/mini2440.h new file +21
-0+ +/* +* Config for NOR flash +*/ +#define CONFIG_ENV_IS_IN_FLASH 1 +#define CONFIG_MY_ENV_OFFSET 0x40000 +/* addr of environment */ +#define CONFIG_ENV_ADDR (PHYS_FLASH_1 + CONFIG_MY_ENV_OFFSET) +/* 16k Total Size of Environment Sector */ +#define CONFIG_ENV_SIZE 0x4000 + +#define CONFIG_PREBOOT_OVERRIDE 1 + +/* ATAG configuration */ +#define CONFIG_INITRD_TAG 1 +#define CONFIG_SETUP_MEMORY_TAGS 1 +#define CONFIG_CMDLINE_TAG 1 +#define CONFIG_CMDLINE_EDITING 1 +#define CONFIG_AUTO_COMPLETE 1 + +#endif /* __CONFIG_H */
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Quoted 165 lines · Marek Vasut
Dear Gabriel Huau,
Quoted 163 lines
---
Changes for v2:
- Coding style cleanup
- Remove unnecessary files modification
- Remove unnecessary board configuration setChanges for v3:
- Coding style cleanup
- Move some macro definition fromlowlevel_init.Sto a new header
- Remove some "magic bloat" with I/O board initialization
- Add apll_delayand replace loop by it
- Somme cleanup in the configuration file
- Cancel modifications on an SoC specific header
- Add my name to copyright--- board/friendlyarm/mini2440/Makefile | 45 ++++++ board/friendlyarm/mini2440/lowlevel_init.S | 76 ++++++++++ board/friendlyarm/mini2440/mini2440.c | 139 ++++++++++++++++++ board/friendlyarm/mini2440/mini2440.h | 104 ++++++++++++++ boards.cfg | 1 + include/configs/mini2440.h | 215 ++++++++++++++++++++++++++++ 6 files changed, 580 insertions(+) create mode 100644 board/friendlyarm/mini2440/Makefile create mode 100644 board/friendlyarm/mini2440/lowlevel_init.S create mode 100644 board/friendlyarm/mini2440/mini2440.c create mode 100644 board/friendlyarm/mini2440/mini2440.h create mode 100644 include/configs/mini2440.h(quoted diff) +0
-0b/board/friendlyarm/mini2440/Makefile new file mode 100644 index 0000000..e8d68cb
board/friendlyarm/mini2440/Makefile new file +45
-0@@ -0,0 +1,45 @@ +# +# (C) Copyright 2012 +# Wolfgang Denk, DENX Software Engineering, wd 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 +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS := mini2440.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) + $(call cmd_link_o_target, $(OBJS) $(SOBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################(quoted diff) +0
-0
b/board/friendlyarm/mini2440/lowlevel_init.Snew file mode 100644 index 0000000..f69a08cboard/friendlyarm/mini2440/lowlevel_init.S new file +63
-0@@ -0,0 +1,76 @@ +/* + * Memory Setup stuff - taken from blob memsetup.S + * + * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw at its.tudelft.nl) and + * Jan-Derk Bakker (J.D.Bakker at its.tudelft.nl) + * + * Modified for the Samsung SMDK2410 by + * (C) Copyright 2002 + * David Mueller, ELSOFT AG, <[email protected]> + * + * (C) Copyright 2012 + * Gabriel Huau <[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 <config.h> +#include <version.h> +#include "mini2440.h" + +_TEXT_BASE: + .word CONFIG_SYS_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_BWSCO
N<<20)+(B6_BWSCON<<24)+(B7_BWSCON<<28)) + .word
((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+(B0_Tac
p<<2)+(B0_PMC)) + .word
((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+(B1_Tac
p<<2)+(B1_PMC)) + .word
((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_Tac
p<<2)+(B2_PMC)) + .word
((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+(B3_Tah<<4)+(B3_Tac
p<<2)+(B3_PMC)) + .word
((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+(B4_Tah<<4)+(B4_Tac
p<<2)+(B4_PMC)) + .word
((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+(B5_Tah<<4)+(B5_Tac p<<2)+(B5_PMC)) +
Quoted 8 lines
board/friendlyarm/mini2440/lowlevel_init.S line 76
Quoted 6 lines
board/friendlyarm/mini2440/lowlevel_init.S new file +6
-0+ .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 0x32 + .word 0x30 + .word 0x30What this undocumented stuff?
SoC specific, I pasted it from smdk2410, it's for initialize the DRAM.
Quoted 72 lines
Quoted 72 lines
(quoted diff) +0
-0
b/board/friendlyarm/mini2440/mini2440.cnew file mode 100644 index 0000000..9ba8d39board/friendlyarm/mini2440/mini2440.c new file +65
-0@@ -0,0 +1,139 @@ +/* +* (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 2009 +* Michel Pollet <[email protected]> +* +* (C) Copyright 2012 +* Gabriel Huau <[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 <asm/arch/s3c2440.h> +#include <asm/io.h> +#include <video_fb.h> +#include "mini2440.h" + +#ifdef CONFIG_DRIVER_DM9000 +#include <netdev.h> +#endif + +DECLARE_GLOBAL_DATA_PTR ; + +static inline void pll_delay (unsigned long loops) +{ + __asm__volatile ("1:\n" +"subs %0, %1, #1\n" +"bne 1b" :"=r" (loops) :"0" (loops)); +} + +int arch_cpu_init (void ) +{ +struct s3c24x0_clock_power *const clk_power = +s3c24x0_get_base_clock_power (); + +/* to reduce PLL lock time, adjust the LOCKTIME register */ + clk_power->locktime =0xFFFFFF ; + clk_power->clkdivn =CLKDIVN_VAL ; + +/* configure UPLL */ + clk_power->upllcon = ((U_M_MDIV <<12 ) + (U_M_PDIV <<4 ) +U_M_SDIV ); +/* some delay between MPLL and UPLL */ +pll_delay (100000 );
Quoted 8 lines
board/friendlyarm/mini2440/mini2440.c line 71
Quoted 6 lines
board/friendlyarm/mini2440/mini2440.c new file +6
-0+ +/* configure MPLL */ + clk_power->mpllcon = ((M_MDIV <<12 ) + (M_PDIV <<4 ) +M_SDIV ); + +/* some delay between MPLL and UPLL */ +pll_delay (500000 );You use
udelay()below, do you needpll_delay()at all?
Yes, because initialisation of PLL is done before timer_init(), so we can't use udelay().
Quoted 392 lines
Quoted 233 lines
board/friendlyarm/mini2440/mini2440.c new file +66
-0+ +return 0 ; +} + +/* +* Miscellaneous platform dependent initialisations +*/ +int board_init (void ) +{ +struct s3c24x0_clock_power *const clk_power = +s3c24x0_get_base_clock_power (); +struct s3c24x0_gpio *const gpio =s3c24x0_get_base_gpio (); + +/* to reduce PLL lock time, adjust the LOCKTIME register */ + clk_power->locktime =0xFFFFFF ; + clk_power->clkdivn =CLKDIVN_VAL ; + +/* configure UPLL */ + clk_power->upllcon = ((U_M_MDIV <<12 ) + (U_M_PDIV <<4 ) +U_M_SDIV ); +/* some delay between MPLL and UPLL */ +udelay (10 ); +/* configure MPLL */ + clk_power->mpllcon = ((M_MDIV <<12 ) + (M_PDIV <<4 ) +M_SDIV ); + +/* some delay between MPLL and UPLL */ +udelay (8000 ); + +/* set up the I/O ports */ +writel (0x007FFFFF , &gpio->gpacon); +writel (0x00044555 , &gpio->gpbcon); +writel (0x000007FF , &gpio->gpbup); +writel (0xAAAAAAAA , &gpio->gpccon); +writel (0x0000FFFF , &gpio->gpcup); +writel (0xAAAAAAAA , &gpio->gpdcon); +writel (0x0000FFFF , &gpio->gpdup); +writel (0xAAAAAAAA , &gpio->gpecon); +writel (0x0000FFFF , &gpio->gpeup); +writel (0x000055AA , &gpio->gpfcon); +writel (0x000000FF , &gpio->gpfup); +writel (0xFF95FFBA , &gpio->gpgcon); +writel (0x0000FFFF , &gpio->gpgup); +writel (0x002AFAAA , &gpio->gphcon); +writel (0x000007FF , &gpio->gphup); + +/* adress of boot parameters */ + gd->bd->bi_boot_params =CONFIG_BOOT_PARAM_ADDR ; + +return 0 ; +} + +int dram_init (void ) +{ + gd->ram_size =PHYS_SDRAM_1_SIZE ; +return 0 ; +} + +int board_eth_init (bd_t *bis) +{ +#ifdef CONFIG_DRIVER_DM9000 +return dm9000_initialize (bis); +#else +return 0 ; +#endif +} + +/* The sum of all part_size[]s must equal to the NAND size, i.e.,
0x4000000*/ +unsigned int dynpart_size[] = {0x40000,0x20000,0x500000,0xffffffff, 0 }; +char *dynpart_names[] = { "u-boot", "u-boot_env", "kernel", "rootfs", NULL }; diff --gita/board/friendlyarm/mini2440/mini2440.hb/board/friendlyarm/mini2440/mini2440.hnew file mode 100644 index 0000000..02197c8board/friendlyarm/mini2440/mini2440.h new file +3
-0@@ -0,0 +1,104 @@ +/* +* Taken from linux/arch/arm/boot/compressed/head-s3c2410.S +* Copyright (C) 2002 Samsung Electronics SW.LEE <[email protected]> + */
board/friendlyarm/mini2440/mini2440.h new file +100
-0+ +#ifndef BOARD_LL_MINI2440_H +#define BOARD_LL_MINI2440_H + +/* +* PLL/Clock configuration +*/ +/* FCLK = 405 MHz, HCLK = 101 MHz, PCLK = 50 MHz, UCLK = 48 MHz */ +#define CLKDIVN_VAL 7 +#define M_MDIV 0x7f +#define M_PDIV 0x2 +#define M_SDIV 0x1 + +#define U_M_MDIV 0x38 +#define U_M_PDIV 0x2 +#define U_M_SDIV 0x2 + +/* BWSCON */ +#define BWSCON 0x48000000 +#define DW8 (0x0) +#define DW16 (0x1) +#define DW32 (0x2) +#define WAIT (0x1<<2) +#define UBLB (0x1<<3) + +#define B1_BWSCON (DW32) +#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) + +/* BANK0CON */ +#define B0_Tacs 0x0/* 0clk */ +#define B0_Tcos 0x0/* 0clk */ +#define B0_Tacc 0x7/* 14clk */ +#define B0_Tcoh 0x0/* 0clk */ +#define B0_Tah 0x0/* 0clk */ +#define B0_Tacp 0x0 +#define B0_PMC 0x0/* normal */ + +/* BANK1CON */ +#define B1_Tacs 0x0/* 0clk */ +#define B1_Tcos 0x0/* 0clk */ +#define B1_Tacc 0x7/* 14clk */ +#define B1_Tcoh 0x0/* 0clk */ +#define B1_Tah 0x0/* 0clk */ +#define B1_Tacp 0x0 +#define B1_PMC 0x0 + +#define B2_Tacs 0x0 +#define B2_Tcos 0x0 +#define B2_Tacc 0x7 +#define B2_Tcoh 0x0 +#define B2_Tah 0x0 +#define B2_Tacp 0x0 +#define B2_PMC 0x0 + +#define B3_Tacs 0x0/* 0clk */ +#define B3_Tcos 0x3/* 4clk */ +#define B3_Tacc 0x7/* 14clk */ +#define B3_Tcoh 0x1/* 1clk */ +#define B3_Tah 0x0/* 0clk */ +#define B3_Tacp 0x3/* 6clk */ +#define B3_PMC 0x0/* normal */ + +#define B4_Tacs 0x0/* 0clk */ +#define B4_Tcos 0x0/* 0clk */ +#define B4_Tacc 0x7/* 14clk */ +#define B4_Tcoh 0x0/* 0clk */ +#define B4_Tah 0x0/* 0clk */ +#define B4_Tacp 0x0 +#define B4_PMC 0x0/* normal */ + +#define B5_Tacs 0x0/* 0clk */ +#define B5_Tcos 0x0/* 0clk */ +#define B5_Tacc 0x7/* 14clk */ +#define B5_Tcoh 0x0/* 0clk */ +#define B5_Tah 0x0/* 0clk */ +#define B5_Tacp 0x0 +#define B5_PMC 0x0/* normal */ + +#define B6_MT 0x3/* SDRAM */ +#define B6_Trcd 0x1 +#define B6_SCAN 0x1/* 9bit */ + +#define B7_MT 0x3/* SDRAM */ +#define B7_Trcd 0x1/* 3clk */ +#define B7_SCAN 0x1/* 9bit */ + +/* REFRESH parameter */ +#define REFEN 0x1/* Refresh enable */ +#define TREFMD 0x0/* CBR(CAS before RAS)/Auto refresh */ +#define Trp 0x0/* 2clk */ +#define Trc 0x3/* 7clk */ +#define Tchr 0x2/* 3clk */ +#define REFCNT 1113/* period=15.6us, HCLK=60Mhz */ + +#endif boards.cfg +0
-0@@ -61,6 +61,7 @@ mx1ads arm arm920t - - scb9328 arm arm920t - - imx cm4008 armarm920t - - ks8695 cm41xx
arm arm920t - - ks8695
+mini2440 arm arm920t mini2440
friendlyarm s3c24x0 VCMA9 arm arm920t
vcma9 mpl s3c24x0 smdk2410
arm arm920t - samsung s3c24x0
omap1510inn arm arm925t -
ti diff --gita/include/configs/mini2440.hb/include/configs/mini2440.hnew file mode 100644
index 0000000..a3f06d0include/configs/mini2440.h new file +33
-0@@ -0,0 +1,215 @@ +/* +* (C) Copyright 2002 +* Sysgo Real-Time Solutions, GmbH <www.elinos.com> +* Marius Groeger <[email protected]> +* Gary Jennejohn <[email protected]> +* David Mueller <[email protected]> +* +* (C) Copyright 2009-2010 +* Michel Pollet <[email protected]> +* +* (C) Copyright 2012 +* Gabriel Huau <[email protected]> +* +* Configuation settings for the MINI2440 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 +*/ include/configs/mini2440.h line 43
Quoted 10 lines
include/configs/mini2440.h new file +10
-0+ +#ifndef __CONFIG_H +#define __CONFIG_H + +#define CONFIG_SYS_TEXT_BASE 0x0 + +/* +* High Level Configuration Options +*/ +#define CONFIG_ARM920T 1/* This is an ARM920T Core */
Quoted 61 lines
include/configs/mini2440.h new file +61
-0+#define CONFIG_S3C24X0 1/* in a SAMSUNG S3C2440 SoC */ +#define CONFIG_S3C2440 1/* in a SAMSUNG S3C2440 SoC */ +#define CONFIG_MINI2440 1/* on a MIN2440 Board */ + +#define MACH_TYPE_MINI2440 1999 +#define CONFIG_MACH_TYPE MACH_TYPE_MINI2440 + +/* +* It is possible to have u-boot save it's environment in NOR, however, +* reember it is incompatible with booting from NAND as the NOR is not +* available at that point. So use this only if you use nand as storage +* and will never boot from it +*/ +#define CONFIG_MINI2440_NOR_ENV 1 +/* allow use of frequencies over 405Mhz */ +#define CONFIG_MINI2440_OVERCLOCK 1 + +/* +* input clock of PLL +*/ +/* MINI2440 has 12.0000MHz input clock */ +#define CONFIG_SYS_CLK_FREQ 12000000 +#define CONFIG_ARCH_CPU_INIT 1/* for the initialization of PLL */ + +#define USE_920T_MMU 1 +#define CONFIG_BAUDRATE 115200 + +/* +* Size of malloc() pool +*/ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2048*1024) +/* size in bytes reserved for initial data */ +#define CONFIG_GBL_DATA_SIZE 128 + +/* +* Hardware drivers +*/ +#define CONFIG_DRIVER_DM9000 1 +#define CONFIG_DRIVER_DM9000_NO_EEPROM 1 +#define CONFIG_DM9000_BASE 0x20000300 +#define DM9000_IO CONFIG_DM9000_BASE +#define DM9000_DATA (CONFIG_DM9000_BASE+4) + +/* +* select serial console configuration +*/ +#define CONFIG_S3C24X0_SERIAL +#define CONFIG_SERIAL1 1 + +/* +* allow to overwrite serial and ethaddr +*/ +#define CONFIG_ENV_OVERWRITE + +/* +* Command definition +*/ +#include <config_cmd_default.h> + +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_PORTIO include/configs/mini2440.h
Quoted 10 lines
include/configs/mini2440.h new file +10
-0+#define CONFIG_CMD_REGINFO +#define CONFIG_CMD_SAVES + +/* +* Miscellaneous configurable options +*/ +#define CONFIG_LONGHELP +#define CONFIG_SYS_PROMPT "MINI2440 => " +#define CONFIG_SYS_CBSIZE 256 +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
include/configs/mini2440.h
Quoted 5 lines
include/configs/mini2440.h new file +5
-0+#define CONFIG_SYS_MAXARGS 32 +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE + +#define CONFIG_SYS_MEMTEST_START 0x30000000 +#define CONFIG_SYS_MEMTEST_END 0x34000000/* 64MB in DRAM */
Quoted 36 lines
include/configs/mini2440.h new file +35
-0+ +/* everything, incl board info, in Hz */ +#undef CONFIG_CLKS_IN_HZ + +/* default load address */ +#define CONFIG_SYS_LOAD_ADDR 0x32000000 + +/* boot parameters address */ +#define CONFIG_BOOT_PARAM_ADDR 0x30000100 + +/* +* the PWM TImer 4 uses a counter of 15625 for 10 ms, so we need +* it to wrap 100 times (total 1562500) to get 1 sec. +*/ +#define CONFIG_SYS_HZ 1562500 + +/* +* valid baudrates +*/ +#define CONFIG_SYS_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 (128*1024)/* regular stack */ +#ifdef CONFIG_USE_IRQ +#define CONFIG_STACKSIZE_IRQ (8*1024)/* IRQ stack */ +#define CONFIG_STACKSIZE_FIQ (4*1024)/* FIQ stack */ +#endif + +/* +* Physical Memory Map +*/ +#define CONFIG_NR_DRAM_BANKS 1/* we have 1 bank of DRAM */ +#define
PHYS_SDRAM_10x30000000/* SDRAM Bank #1 */include/configs/mini2440.h
Quoted 3 lines
include/configs/mini2440.h new file +3
-0+#define PHYS_SDRAM_1_SIZE (64*1024*1024)/* 64MB of DRAM */ +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x1000- \
Quoted 30 lines
include/configs/mini2440.h new file +5
-0+ GENERATED_GBL_DATA_SIZE) + +/* +* When booting from NAND, it is impossible to access the lowest addresses +* due to the SteppingStone being in the way. Luckily the NOR doesn't really + * care about the highest 16 bits of address, so we set the controlers + * registers to go and poke over there, instead.
+ */include/configs/mini2440.h new file +22
-0+#define PHYS_FLASH_1 0x0 +#define CONFIG_SYS_FLASH_BASE 0x0 + +/* +* NOR FLASH organization +* Now uses the standard CFI interface +* FLASH and environment organization +*/ +#define CONFIG_SYS_FLASH_CFI 1 +#define CONFIG_FLASH_CFI_DRIVER 1 +#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT +#define CONFIG_SYS_MONITOR_BASE 0x0 +/* max number of memory banks */ +#define CONFIG_SYS_MAX_FLASH_BANKS 1 +/* 512 * 4096 sectors, or 32 * 64k blocks */ +#define CONFIG_SYS_MAX_FLASH_SECT 512 +#define CONFIG_FLASH_SHOW_PROGRESS 1 + +/* +* u-boot environmnent +*/ +#define CONFIG_BOOTDELAY 3
Quoted 9 lines
include/configs/mini2440.h line 194
Quoted 6 lines
include/configs/mini2440.h new file +6
-0+#define CONFIG_BOOTARGS "root=/dev/sdb1 console=ttySAC0,115200" +#define CONFIG_NETMASK 255.255.255.0 +#define CONFIG_IPADDR 192.168.0.2 +#define CONFIG_SERVERIP 192.168.0.1 +#define CONFIG_DOS_PARTITION 1 +#define CONFIG_BOOTCOMMAND "tftp 0x32000000 uImage;bootm"DROP THIS!
ok :-)
Quoted 21 lines
Quoted 21 lines
include/configs/mini2440.h new file +21
-0+ +/* +* Config for NOR flash +*/ +#define CONFIG_ENV_IS_IN_FLASH 1 +#define CONFIG_MY_ENV_OFFSET 0x40000 +/* addr of environment */ +#define CONFIG_ENV_ADDR (PHYS_FLASH_1 + CONFIG_MY_ENV_OFFSET) +/* 16k Total Size of Environment Sector */ +#define CONFIG_ENV_SIZE 0x4000 + +#define CONFIG_PREBOOT_OVERRIDE 1 + +/* ATAG configuration */ +#define CONFIG_INITRD_TAG 1 +#define CONFIG_SETUP_MEMORY_TAGS 1 +#define CONFIG_CMDLINE_TAG 1 +#define CONFIG_CMDLINE_EDITING 1 +#define CONFIG_AUTO_COMPLETE 1 + +#endif /* __CONFIG_H */
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Dear Gabriel Huau,
Quoted 181 lines · Marek Vasut
Quoted 171 lines
Dear Gabriel Huau,
Quoted 169 lines
---
Changes for v2:
- Coding style cleanup
- Remove unnecessary files modification
- Remove unnecessary board configuration setChanges for v3:
- Coding style cleanup
- Move some macro definition fromlowlevel_init.Sto a new header
- Remove some "magic bloat" with I/O board initialization
- Add apll_delayand replace loop by it
- Somme cleanup in the configuration file
- Cancel modifications on an SoC specific header
- Add my name to copyright---
board/friendlyarm/mini2440/Makefile | 45 ++++++ board/friendlyarm/mini2440/lowlevel_init.S | 76 ++++++++++ board/friendlyarm/mini2440/mini2440.c | 139 ++++++++++++++++++ board/friendlyarm/mini2440/mini2440.h | 104 ++++++++++++++ boards.cfg | 1 + include/configs/mini2440.h | 215++++++++++++++++++++++++++++ 6 files changed, 580 insertions(+)
create mode 100644 board/friendlyarm/mini2440/Makefile create mode 100644 board/friendlyarm/mini2440/lowlevel_init.S create mode 100644 board/friendlyarm/mini2440/mini2440.c create mode 100644 board/friendlyarm/mini2440/mini2440.h create mode 100644 include/configs/mini2440.h(quoted diff) +0
-0b/board/friendlyarm/mini2440/Makefile new file mode 100644 index 0000000..e8d68cb
board/friendlyarm/mini2440/Makefile new file +38
-0@@ -0,0 +1,45 @@ +# +# (C) Copyright 2012 +# Wolfgang Denk, DENX Software Engineering, wd 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 +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS := mini2440.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) + $(call cmd_link_o_target, $(OBJS) $(SOBJS)) + +######################################################################### +
board/friendlyarm/mini2440/Makefile new file +6
-0+# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git
a/board/friendlyarm/mini2440/lowlevel_init.Sb/board/friendlyarm/mini2440/lowlevel_init.Snew file mode 100644 index 0000000..f69a08cboard/friendlyarm/mini2440/lowlevel_init.S new file +4
-0@@ -0,0 +1,76 @@ +/* + * Memory Setup stuff - taken from blob memsetup.S + * + * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw at its.tudelft.nl)and + * Jan-Derk Bakker
(J.D.Bakker at its.tudelft.nl) + *
+ * Modified for the Samsung SMDK2410 by
+ * (C) Copyright 2002
+ * David Mueller, ELSOFT AG, <[email protected]>
+ *
+ * (C) Copyright 2012
+ * Gabriel Huau <[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
+ */board/friendlyarm/mini2440/lowlevel_init.S new file +32
-0+ +#include <config.h> +#include <version.h> +#include "mini2440.h" + +_TEXT_BASE: + .word CONFIG_SYS_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_BW
SCO N<<20)+(B6_BWSCON<<24)+(B7_BWSCON<<28)) + .word
((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+(B0_
Tac p<<2)+(B0_PMC)) + .word
((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+(B1_
Tac p<<2)+(B1_PMC)) + .word
((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_
Tac p<<2)+(B2_PMC)) + .word
((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+(B3_Tah<<4)+(B3_
Tac p<<2)+(B3_PMC)) + .word
((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+(B4_Tah<<4)+(B4_
Tac p<<2)+(B4_PMC)) + .word
((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+(B5_Tah<<4)+(B5_ Tac p<<2)+(B5_PMC)) +
+ .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN))Quoted 8 lines
board/friendlyarm/mini2440/lowlevel_init.S line 76
Quoted 6 lines
board/friendlyarm/mini2440/lowlevel_init.S new file +2
-0+ .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) + .word((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) + .word
0x32board/friendlyarm/mini2440/lowlevel_init.S new file +2
-0+ .word 0x30 + .word 0x30What this undocumented stuff?
Quoted 1 line
SoC specific, I pasted it from smdk2410, it's for initialize the DRAM.
Can't you init DRAM in some more fitting place? Also document this?
Quoted 80 lines
Quoted 71 lines
Quoted 71 lines
(quoted diff) +0
-0
b/board/friendlyarm/mini2440/mini2440.cnew file mode 100644 index 0000000..9ba8d39board/friendlyarm/mini2440/mini2440.c new file +65
-0@@ -0,0 +1,139 @@ +/* +* (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 2009 +* Michel Pollet <[email protected]> +* +* (C) Copyright 2012 +* Gabriel Huau <[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 <asm/arch/s3c2440.h> +#include <asm/io.h> +#include <video_fb.h> +#include "mini2440.h" + +#ifdef CONFIG_DRIVER_DM9000 +#include <netdev.h> +#endif + +DECLARE_GLOBAL_DATA_PTR ; + +static inline void pll_delay (unsigned long loops) +{ + __asm__volatile ("1:\n" +"subs %0, %1, #1\n" +"bne 1b" :"=r" (loops) :"0" (loops)); +} + +int arch_cpu_init (void ) +{ +struct s3c24x0_clock_power *const clk_power = +s3c24x0_get_base_clock_power (); + +/* to reduce PLL lock time, adjust the LOCKTIME register */ + clk_power->locktime =0xFFFFFF ; + clk_power->clkdivn =CLKDIVN_VAL ; + +/* configure UPLL */ + clk_power->upllcon = ((U_M_MDIV <<12 ) + (U_M_PDIV <<4 ) +U_M_SDIV ); +/* some delay between MPLL and UPLL */ +pll_delay (100000 );Quoted 8 lines
board/friendlyarm/mini2440/mini2440.c line 71
Quoted 6 lines
board/friendlyarm/mini2440/mini2440.c new file +6
-0+ +/* configure MPLL */ + clk_power->mpllcon = ((M_MDIV <<12 ) + (M_PDIV <<4 ) +M_SDIV ); + +/* some delay between MPLL and UPLL */ +pll_delay (500000 );You use
udelay()below, do you needpll_delay()at all?
Quoted 2 lines
Yes, because initialisation of PLL is done before
timer_init(), so we can't useudelay().
Maybe fix the timer driver?
Quoted 347 lines
Quoted 347 lines
Quoted 240 lines
board/friendlyarm/mini2440/mini2440.c new file +66
-0+ +return 0 ; +} + +/* +* Miscellaneous platform dependent initialisations +*/ +int board_init (void ) +{ +struct s3c24x0_clock_power *const clk_power = +s3c24x0_get_base_clock_power (); +struct s3c24x0_gpio *const gpio =s3c24x0_get_base_gpio (); + +/* to reduce PLL lock time, adjust the LOCKTIME register */ + clk_power->locktime =0xFFFFFF ; + clk_power->clkdivn =CLKDIVN_VAL ; + +/* configure UPLL */ + clk_power->upllcon = ((U_M_MDIV <<12 ) + (U_M_PDIV <<4 ) +U_M_SDIV ); +/* some delay between MPLL and UPLL */ +udelay (10 ); +/* configure MPLL */ + clk_power->mpllcon = ((M_MDIV <<12 ) + (M_PDIV <<4 ) +M_SDIV ); + +/* some delay between MPLL and UPLL */ +udelay (8000 ); + +/* set up the I/O ports */ +writel (0x007FFFFF , &gpio->gpacon); +writel (0x00044555 , &gpio->gpbcon); +writel (0x000007FF , &gpio->gpbup); +writel (0xAAAAAAAA , &gpio->gpccon); +writel (0x0000FFFF , &gpio->gpcup); +writel (0xAAAAAAAA , &gpio->gpdcon); +writel (0x0000FFFF , &gpio->gpdup); +writel (0xAAAAAAAA , &gpio->gpecon); +writel (0x0000FFFF , &gpio->gpeup); +writel (0x000055AA , &gpio->gpfcon); +writel (0x000000FF , &gpio->gpfup); +writel (0xFF95FFBA , &gpio->gpgcon); +writel (0x0000FFFF , &gpio->gpgup); +writel (0x002AFAAA , &gpio->gphcon); +writel (0x000007FF , &gpio->gphup); + +/* adress of boot parameters */ + gd->bd->bi_boot_params =CONFIG_BOOT_PARAM_ADDR ; + +return 0 ; +} + +int dram_init (void ) +{ + gd->ram_size =PHYS_SDRAM_1_SIZE ; +return 0 ; +} + +int board_eth_init (bd_t *bis) +{ +#ifdef CONFIG_DRIVER_DM9000 +return dm9000_initialize (bis); +#else +return 0 ; +#endif +} + +/* The sum of all part_size[]s must equal to the NAND size, i.e.,
0x4000000*/ +unsigned int dynpart_size[] = {0x40000,0x20000,0x500000,0xffffffff, 0 }; +char *dynpart_names[] = { "u-boot", "u-boot_env", "kernel", "rootfs", NULL }; diff --gita/board/friendlyarm/mini2440/mini2440.hb/board/friendlyarm/mini2440/mini2440.hnew file mode 100644 index 0000000..02197c8board/friendlyarm/mini2440/mini2440.h new file +3
-0@@ -0,0 +1,104 @@ +/* +* Taken from linux/arch/arm/boot/compressed/head-s3c2410.S +* Copyright (C) 2002 Samsung Electronics SW.LEE <[email protected]> + */
board/friendlyarm/mini2440/mini2440.h new file +100
-0+ +#ifndef BOARD_LL_MINI2440_H +#define BOARD_LL_MINI2440_H + +/* +* PLL/Clock configuration +*/ +/* FCLK = 405 MHz, HCLK = 101 MHz, PCLK = 50 MHz, UCLK = 48 MHz */ +#define CLKDIVN_VAL 7 +#define M_MDIV 0x7f +#define M_PDIV 0x2 +#define M_SDIV 0x1 + +#define U_M_MDIV 0x38 +#define U_M_PDIV 0x2 +#define U_M_SDIV 0x2 + +/* BWSCON */ +#define BWSCON 0x48000000 +#define DW8 (0x0) +#define DW16 (0x1) +#define DW32 (0x2) +#define WAIT (0x1<<2) +#define UBLB (0x1<<3) + +#define B1_BWSCON (DW32) +#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) + +/* BANK0CON */ +#define B0_Tacs 0x0/* 0clk */ +#define B0_Tcos 0x0/* 0clk */ +#define B0_Tacc 0x7/* 14clk */ +#define B0_Tcoh 0x0/* 0clk */ +#define B0_Tah 0x0/* 0clk */ +#define B0_Tacp 0x0 +#define B0_PMC 0x0/* normal */ + +/* BANK1CON */ +#define B1_Tacs 0x0/* 0clk */ +#define B1_Tcos 0x0/* 0clk */ +#define B1_Tacc 0x7/* 14clk */ +#define B1_Tcoh 0x0/* 0clk */ +#define B1_Tah 0x0/* 0clk */ +#define B1_Tacp 0x0 +#define B1_PMC 0x0 + +#define B2_Tacs 0x0 +#define B2_Tcos 0x0 +#define B2_Tacc 0x7 +#define B2_Tcoh 0x0 +#define B2_Tah 0x0 +#define B2_Tacp 0x0 +#define B2_PMC 0x0 + +#define B3_Tacs 0x0/* 0clk */ +#define B3_Tcos 0x3/* 4clk */ +#define B3_Tacc 0x7/* 14clk */ +#define B3_Tcoh 0x1/* 1clk */ +#define B3_Tah 0x0/* 0clk */ +#define B3_Tacp 0x3/* 6clk */ +#define B3_PMC 0x0/* normal */ + +#define B4_Tacs 0x0/* 0clk */ +#define B4_Tcos 0x0/* 0clk */ +#define B4_Tacc 0x7/* 14clk */ +#define B4_Tcoh 0x0/* 0clk */ +#define B4_Tah 0x0/* 0clk */ +#define B4_Tacp 0x0 +#define B4_PMC 0x0/* normal */ + +#define B5_Tacs 0x0/* 0clk */ +#define B5_Tcos 0x0/* 0clk */ +#define B5_Tacc 0x7/* 14clk */ +#define B5_Tcoh 0x0/* 0clk */ +#define B5_Tah 0x0/* 0clk */ +#define B5_Tacp 0x0 +#define B5_PMC 0x0/* normal */ + +#define B6_MT 0x3/* SDRAM */ +#define B6_Trcd 0x1 +#define B6_SCAN 0x1/* 9bit */ + +#define B7_MT 0x3/* SDRAM */ +#define B7_Trcd 0x1/* 3clk */ +#define B7_SCAN 0x1/* 9bit */ + +/* REFRESH parameter */ +#define REFEN 0x1/* Refresh enable */ +#define TREFMD 0x0/* CBR(CAS before RAS)/Auto refresh */ +#define Trp 0x0/* 2clk */ +#define Trc 0x3/* 7clk */ +#define Tchr 0x2/* 3clk */ +#define REFCNT 1113/* period=15.6us, HCLK=60Mhz */ + +#endif boards.cfg +0
-1@@ -61,6 +61,7 @@ mx1ads arm arm920t - - scb9328 arm arm920t - - imx cm4008 armarm920t - - ks8695 cm41xx
arm arm920t - -
ks8695+mini2440 arm arm920t mini2440
friendlyarm s3c24x0 VCMA9 arm arm920tvcma9 mpl s3c24x0 smdk2410
arm arm920t - samsung s3c24x0
omap1510inn arm arm925t -
ti diff --gita/include/configs/mini2440.hb/include/configs/mini2440.hnew file mode 100644
index 0000000..a3f06d0include/configs/mini2440.h new file +33
-0@@ -0,0 +1,215 @@ +/* +* (C) Copyright 2002 +* Sysgo Real-Time Solutions, GmbH <www.elinos.com> +* Marius Groeger <[email protected]> +* Gary Jennejohn <[email protected]> +* David Mueller <[email protected]> +* +* (C) Copyright 2009-2010 +* Michel Pollet <[email protected]> +* +* (C) Copyright 2012 +* Gabriel Huau <[email protected]> +* +* Configuation settings for the MINI2440 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 +*/ include/configs/mini2440.h line 43
Quoted 10 lines
include/configs/mini2440.h new file +10
-0+ +#ifndef __CONFIG_H +#define __CONFIG_H + +#define CONFIG_SYS_TEXT_BASE 0x0 + +/* +* High Level Configuration Options +*/ +#define CONFIG_ARM920T 1/* This is an ARM920T Core */
Quoted 61 lines
include/configs/mini2440.h new file +9
-0+#define CONFIG_S3C24X0 1/* in a SAMSUNG S3C2440 SoC */ +#define CONFIG_S3C2440 1/* in a SAMSUNG S3C2440 SoC */ +#define CONFIG_MINI2440 1/* on a MIN2440 Board */ + +#define MACH_TYPE_MINI2440 1999 +#define CONFIG_MACH_TYPE MACH_TYPE_MINI2440 + +/* +* It is possible to have u-boot save it's environment in NOR, however, + * reember it is incompatible with booting from NAND as the NOR is not + * available at that point. So use this only if you use nand as storage + * and will never boot from it
+ */include/configs/mini2440.h new file +48
-0+#define CONFIG_MINI2440_NOR_ENV 1 +/* allow use of frequencies over 405Mhz */ +#define CONFIG_MINI2440_OVERCLOCK 1 + +/* +* input clock of PLL +*/ +/* MINI2440 has 12.0000MHz input clock */ +#define CONFIG_SYS_CLK_FREQ 12000000 +#define CONFIG_ARCH_CPU_INIT 1/* for the initialization of PLL */ + +#define USE_920T_MMU 1 +#define CONFIG_BAUDRATE 115200 + +/* +* Size of malloc() pool +*/ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2048*1024) +/* size in bytes reserved for initial data */ +#define CONFIG_GBL_DATA_SIZE 128 + +/* +* Hardware drivers +*/ +#define CONFIG_DRIVER_DM9000 1 +#define CONFIG_DRIVER_DM9000_NO_EEPROM 1 +#define CONFIG_DM9000_BASE 0x20000300 +#define DM9000_IO CONFIG_DM9000_BASE +#define DM9000_DATA (CONFIG_DM9000_BASE+4) + +/* +* select serial console configuration +*/ +#define CONFIG_S3C24X0_SERIAL +#define CONFIG_SERIAL1 1 + +/* +* allow to overwrite serial and ethaddr +*/ +#define CONFIG_ENV_OVERWRITE + +/* +* Command definition +*/ +#include <config_cmd_default.h> + +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_PORTIO include/configs/mini2440.h
Quoted 10 lines
include/configs/mini2440.h new file +10
-0+#define CONFIG_CMD_REGINFO +#define CONFIG_CMD_SAVES + +/* +* Miscellaneous configurable options +*/ +#define CONFIG_LONGHELP +#define CONFIG_SYS_PROMPT "MINI2440 => " +#define CONFIG_SYS_CBSIZE 256 +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
include/configs/mini2440.h
Quoted 5 lines
include/configs/mini2440.h new file +5
-0+#define CONFIG_SYS_MAXARGS 32 +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE + +#define CONFIG_SYS_MEMTEST_START 0x30000000 +#define CONFIG_SYS_MEMTEST_END 0x34000000/* 64MB in DRAM */
Quoted 12 lines
include/configs/mini2440.h new file +12
-0+ +/* everything, incl board info, in Hz */ +#undef CONFIG_CLKS_IN_HZ + +/* default load address */ +#define CONFIG_SYS_LOAD_ADDR 0x32000000 + +/* boot parameters address */ +#define CONFIG_BOOT_PARAM_ADDR 0x30000100 + +/* +* the PWM TImer 4 uses a counter of 15625 for 10 ms, so we need
Quoted 8 lines
Quoted 8 lines
include/configs/mini2440.h
Quoted 8 lines
+ * it to wrap 100 times (total 1562500) to get 1 sec.
+ */include/configs/mini2440.h new file +6
-0+#define CONFIG_SYS_HZ 1562500 + +/* +* valid baudrates +*/ +#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600,
115200
Quoted 85 lines
Quoted 53 lines
Quoted 15 lines
} +
include/configs/mini2440.h new file +14
-0+/* +* Stack sizes +* The stack sizes are set up in start.S using the settings below +*/ +#define CONFIG_STACKSIZE (128*1024)/* regular stack */ +#ifdef CONFIG_USE_IRQ +#define CONFIG_STACKSIZE_IRQ (8*1024)/* IRQ stack */ +#define CONFIG_STACKSIZE_FIQ (4*1024)/* FIQ stack */ +#endif + +/* +* Physical Memory Map +*/ +#define CONFIG_NR_DRAM_BANKS 1/* we have 1 bank of Quoted 4 lines
DRAM */ +#define
PHYS_SDRAM_10x30000000/* SDRAM Bank
#1 */ +#definePHYS_SDRAM_1_SIZE(64*1024*1024) /* 64MB of
DRAM */ +#defineCONFIG_SYS_SDRAM_BASEPHYS_SDRAM_1
+#defineCONFIG_SYS_INIT_SP_ADDR(CONFIG_SYS_SDRAM_BASE+0x1000- \
Quoted 31 lines
include/configs/mini2440.h new file +4
-0+ GENERATED_GBL_DATA_SIZE) + +/* +* When booting from NAND, it is impossible to access the lowest addresses + * due to the SteppingStone being in the way. Luckily the NOR doesn't really + * care about the highest 16 bits of address, so we set the controlers + * registers to go and poke over there, instead.
+ */include/configs/mini2440.h new file +22
-0+#define PHYS_FLASH_1 0x0 +#define CONFIG_SYS_FLASH_BASE 0x0 + +/* +* NOR FLASH organization +* Now uses the standard CFI interface +* FLASH and environment organization +*/ +#define CONFIG_SYS_FLASH_CFI 1 +#define CONFIG_FLASH_CFI_DRIVER 1 +#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT +#define CONFIG_SYS_MONITOR_BASE 0x0 +/* max number of memory banks */ +#define CONFIG_SYS_MAX_FLASH_BANKS 1 +/* 512 * 4096 sectors, or 32 * 64k blocks */ +#define CONFIG_SYS_MAX_FLASH_SECT 512 +#define CONFIG_FLASH_SHOW_PROGRESS 1 + +/* +* u-boot environmnent +*/ +#define CONFIG_BOOTDELAY 3Quoted 8 lines
include/configs/mini2440.h line 194
Quoted 6 lines
include/configs/mini2440.h new file +6
-0+#define CONFIG_BOOTARGS "root=/dev/sdb1 console=ttySAC0,115200" +#define CONFIG_NETMASK 255.255.255.0 +#define CONFIG_IPADDR 192.168.0.2 +#define CONFIG_SERVERIP 192.168.0.1 +#define CONFIG_DOS_PARTITION 1 +#define CONFIG_BOOTCOMMAND "tftp 0x32000000 uImage;bootm"DROP THIS!
ok :-)
Quoted 21 lines
Quoted 21 lines
include/configs/mini2440.h new file +21
-0+ +/* +* Config for NOR flash +*/ +#define CONFIG_ENV_IS_IN_FLASH 1 +#define CONFIG_MY_ENV_OFFSET 0x40000 +/* addr of environment */ +#define CONFIG_ENV_ADDR (PHYS_FLASH_1 + CONFIG_MY_ENV_OFFSET) +/* 16k Total Size of Environment Sector */ +#define CONFIG_ENV_SIZE 0x4000 + +#define CONFIG_PREBOOT_OVERRIDE 1 + +/* ATAG configuration */ +#define CONFIG_INITRD_TAG 1 +#define CONFIG_SETUP_MEMORY_TAGS 1 +#define CONFIG_CMDLINE_TAG 1 +#define CONFIG_CMDLINE_EDITING 1 +#define CONFIG_AUTO_COMPLETE 1 + +#endif /* __CONFIG_H */
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Quoted 183 lines · Marek Vasut
Dear Gabriel Huau,
Quoted 181 lines · Marek Vasut
Quoted 179 lines
Dear Gabriel Huau,
Quoted 173 lines
---
Changes for v2:
- Coding style cleanup
- Remove unnecessary files modification
- Remove unnecessary board configuration setChanges for v3:
- Coding style cleanup
- Move some macro definition fromlowlevel_init.Sto a new header
- Remove some "magic bloat" with I/O board initialization
- Add apll_delayand replace loop by it
- Somme cleanup in the configuration file
- Cancel modifications on an SoC specific header
- Add my name to copyright---
board/friendlyarm/mini2440/Makefile | 45 ++++++ board/friendlyarm/mini2440/lowlevel_init.S | 76 ++++++++++ board/friendlyarm/mini2440/mini2440.c | 139 ++++++++++++++++++ board/friendlyarm/mini2440/mini2440.h | 104 ++++++++++++++ boards.cfg | 1 + include/configs/mini2440.h | 215++++++++++++++++++++++++++++ 6 files changed, 580 insertions(+)
create mode 100644 board/friendlyarm/mini2440/Makefile create mode 100644 board/friendlyarm/mini2440/lowlevel_init.S create mode 100644 board/friendlyarm/mini2440/mini2440.c create mode 100644 board/friendlyarm/mini2440/mini2440.h create mode 100644 include/configs/mini2440.h(quoted diff) +0
-0b/board/friendlyarm/mini2440/Makefile new file mode 100644 index 0000000..e8d68cb
board/friendlyarm/mini2440/Makefile new file +38
-0@@ -0,0 +1,45 @@ +# +# (C) Copyright 2012 +# Wolfgang Denk, DENX Software Engineering, wd 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 +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS := mini2440.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) + $(call cmd_link_o_target, $(OBJS) $(SOBJS)) + +######################################################################### +
board/friendlyarm/mini2440/Makefile new file +6
-0+# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git
a/board/friendlyarm/mini2440/lowlevel_init.Sb/board/friendlyarm/mini2440/lowlevel_init.Snew file mode 100644 index 0000000..f69a08cboard/friendlyarm/mini2440/lowlevel_init.S new file +4
-0@@ -0,0 +1,76 @@ +/* + * Memory Setup stuff - taken from blob memsetup.S + * + * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw at its.tudelft.nl)and + * Jan-Derk Bakker
(J.D.Bakker at its.tudelft.nl) + *
+ * Modified for the Samsung SMDK2410 by
+ * (C) Copyright 2002
+ * David Mueller, ELSOFT AG, <[email protected]>
+ *
+ * (C) Copyright 2012
+ * Gabriel Huau <[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
+ */board/friendlyarm/mini2440/lowlevel_init.S new file +32
-0+ +#include <config.h> +#include <version.h> +#include "mini2440.h" + +_TEXT_BASE: + .word CONFIG_SYS_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_BW
SCO N<<20)+(B6_BWSCON<<24)+(B7_BWSCON<<28)) + .word
((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+(B0_
Tac p<<2)+(B0_PMC)) + .word
((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+(B1_
Tac p<<2)+(B1_PMC)) + .word
((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_
Tac p<<2)+(B2_PMC)) + .word
((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+(B3_Tah<<4)+(B3_
Tac p<<2)+(B3_PMC)) + .word
((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+(B4_Tah<<4)+(B4_
Tac p<<2)+(B4_PMC)) + .word
((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+(B5_Tah<<4)+(B5_ Tac p<<2)+(B5_PMC)) +board/friendlyarm/mini2440/lowlevel_init.S new file +3
-0+ .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
0x32board/friendlyarm/mini2440/lowlevel_init.S line 76
Quoted 2 lines
board/friendlyarm/mini2440/lowlevel_init.S new file +2
-0+ .word 0x30 + .word 0x30What this undocumented stuff?
Quoted 4 lines
Quoted 1 line
SoC specific, I pasted it from smdk2410, it's for initialize the DRAM.
Can't you init DRAM in some more fitting place? Also document this?
I don't know, this part is a bit difficult for me, but I'm going to try to document it with the help of the SoC documentation.
For the place, should I move it to mini2440.c in arch_cpu_init() or board_early_init_f() ? I don't really know the difference.
Quoted 80 lines
Quoted 80 lines
Quoted 79 lines
Quoted 67 lines
(quoted diff) +0
-0
b/board/friendlyarm/mini2440/mini2440.cnew file mode 100644 index 0000000..9ba8d39board/friendlyarm/mini2440/mini2440.c new file +61
-0@@ -0,0 +1,139 @@ +/* +* (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 2009 +* Michel Pollet <[email protected]> +* +* (C) Copyright 2012 +* Gabriel Huau <[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 <asm/arch/s3c2440.h> +#include <asm/io.h> +#include <video_fb.h> +#include "mini2440.h" + +#ifdef CONFIG_DRIVER_DM9000 +#include <netdev.h> +#endif + +DECLARE_GLOBAL_DATA_PTR ; + +static inline void pll_delay (unsigned long loops) +{ + __asm__volatile ("1:\n" +"subs %0, %1, #1\n" +"bne 1b" :"=r" (loops) :"0" (loops)); +} + +int arch_cpu_init (void ) +{ +struct s3c24x0_clock_power *const clk_power = +s3c24x0_get_base_clock_power (); + +/* to reduce PLL lock time, adjust the LOCKTIME register */ + clk_power->locktime =0xFFFFFF ; + clk_power->clkdivn =CLKDIVN_VAL ; +board/friendlyarm/mini2440/mini2440.c line 71
Quoted 10 lines
board/friendlyarm/mini2440/mini2440.c new file +10
-0+/* configure UPLL */ + clk_power->upllcon = ((U_M_MDIV <<12 ) + (U_M_PDIV <<4 ) +U_M_SDIV ); +/* some delay between MPLL and UPLL */ +pll_delay (100000 ); + +/* configure MPLL */ + clk_power->mpllcon = ((M_MDIV <<12 ) + (M_PDIV <<4 ) +M_SDIV ); + +/* some delay between MPLL and UPLL */ +pll_delay (500000 );You use
udelay()below, do you needpll_delay()at all?
Quoted 5 lines
Quoted 2 lines
Yes, because initialisation of PLL is done before
timer_init(), so we can't useudelay().Maybe fix the timer driver?
As PLL initialization is SoC specific, should I move it to arch/arch/cpu/arm920t/s3c24x0/timer.c in timer_init() ?
With this modification, I will have to patch all board based on s3c24x0, because they are all using this "hack". Should this modification be part of another patch ? (for me, yes ...)
Quoted 441 lines
Quoted 347 lines
Quoted 347 lines
Quoted 240 lines
board/friendlyarm/mini2440/mini2440.c new file +66
-0+ +return 0 ; +} + +/* +* Miscellaneous platform dependent initialisations +*/ +int board_init (void ) +{ +struct s3c24x0_clock_power *const clk_power = +s3c24x0_get_base_clock_power (); +struct s3c24x0_gpio *const gpio =s3c24x0_get_base_gpio (); + +/* to reduce PLL lock time, adjust the LOCKTIME register */ + clk_power->locktime =0xFFFFFF ; + clk_power->clkdivn =CLKDIVN_VAL ; + +/* configure UPLL */ + clk_power->upllcon = ((U_M_MDIV <<12 ) + (U_M_PDIV <<4 ) +U_M_SDIV ); +/* some delay between MPLL and UPLL */ +udelay (10 ); +/* configure MPLL */ + clk_power->mpllcon = ((M_MDIV <<12 ) + (M_PDIV <<4 ) +M_SDIV ); + +/* some delay between MPLL and UPLL */ +udelay (8000 ); + +/* set up the I/O ports */ +writel (0x007FFFFF , &gpio->gpacon); +writel (0x00044555 , &gpio->gpbcon); +writel (0x000007FF , &gpio->gpbup); +writel (0xAAAAAAAA , &gpio->gpccon); +writel (0x0000FFFF , &gpio->gpcup); +writel (0xAAAAAAAA , &gpio->gpdcon); +writel (0x0000FFFF , &gpio->gpdup); +writel (0xAAAAAAAA , &gpio->gpecon); +writel (0x0000FFFF , &gpio->gpeup); +writel (0x000055AA , &gpio->gpfcon); +writel (0x000000FF , &gpio->gpfup); +writel (0xFF95FFBA , &gpio->gpgcon); +writel (0x0000FFFF , &gpio->gpgup); +writel (0x002AFAAA , &gpio->gphcon); +writel (0x000007FF , &gpio->gphup); + +/* adress of boot parameters */ + gd->bd->bi_boot_params =CONFIG_BOOT_PARAM_ADDR ; + +return 0 ; +} + +int dram_init (void ) +{ + gd->ram_size =PHYS_SDRAM_1_SIZE ; +return 0 ; +} + +int board_eth_init (bd_t *bis) +{ +#ifdef CONFIG_DRIVER_DM9000 +return dm9000_initialize (bis); +#else +return 0 ; +#endif +} + +/* The sum of all part_size[]s must equal to the NAND size, i.e.,
0x4000000*/ +unsigned int dynpart_size[] = {0x40000,0x20000,0x500000,0xffffffff, 0 }; +char *dynpart_names[] = { "u-boot", "u-boot_env", "kernel", "rootfs", NULL }; diff --gita/board/friendlyarm/mini2440/mini2440.hb/board/friendlyarm/mini2440/mini2440.hnew file mode 100644 index 0000000..02197c8board/friendlyarm/mini2440/mini2440.h new file +3
-0@@ -0,0 +1,104 @@ +/* +* Taken from linux/arch/arm/boot/compressed/head-s3c2410.S +* Copyright (C) 2002 Samsung Electronics SW.LEE <[email protected]> + */
board/friendlyarm/mini2440/mini2440.h new file +100
-0+ +#ifndef BOARD_LL_MINI2440_H +#define BOARD_LL_MINI2440_H + +/* +* PLL/Clock configuration +*/ +/* FCLK = 405 MHz, HCLK = 101 MHz, PCLK = 50 MHz, UCLK = 48 MHz */ +#define CLKDIVN_VAL 7 +#define M_MDIV 0x7f +#define M_PDIV 0x2 +#define M_SDIV 0x1 + +#define U_M_MDIV 0x38 +#define U_M_PDIV 0x2 +#define U_M_SDIV 0x2 + +/* BWSCON */ +#define BWSCON 0x48000000 +#define DW8 (0x0) +#define DW16 (0x1) +#define DW32 (0x2) +#define WAIT (0x1<<2) +#define UBLB (0x1<<3) + +#define B1_BWSCON (DW32) +#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) + +/* BANK0CON */ +#define B0_Tacs 0x0/* 0clk */ +#define B0_Tcos 0x0/* 0clk */ +#define B0_Tacc 0x7/* 14clk */ +#define B0_Tcoh 0x0/* 0clk */ +#define B0_Tah 0x0/* 0clk */ +#define B0_Tacp 0x0 +#define B0_PMC 0x0/* normal */ + +/* BANK1CON */ +#define B1_Tacs 0x0/* 0clk */ +#define B1_Tcos 0x0/* 0clk */ +#define B1_Tacc 0x7/* 14clk */ +#define B1_Tcoh 0x0/* 0clk */ +#define B1_Tah 0x0/* 0clk */ +#define B1_Tacp 0x0 +#define B1_PMC 0x0 + +#define B2_Tacs 0x0 +#define B2_Tcos 0x0 +#define B2_Tacc 0x7 +#define B2_Tcoh 0x0 +#define B2_Tah 0x0 +#define B2_Tacp 0x0 +#define B2_PMC 0x0 + +#define B3_Tacs 0x0/* 0clk */ +#define B3_Tcos 0x3/* 4clk */ +#define B3_Tacc 0x7/* 14clk */ +#define B3_Tcoh 0x1/* 1clk */ +#define B3_Tah 0x0/* 0clk */ +#define B3_Tacp 0x3/* 6clk */ +#define B3_PMC 0x0/* normal */ + +#define B4_Tacs 0x0/* 0clk */ +#define B4_Tcos 0x0/* 0clk */ +#define B4_Tacc 0x7/* 14clk */ +#define B4_Tcoh 0x0/* 0clk */ +#define B4_Tah 0x0/* 0clk */ +#define B4_Tacp 0x0 +#define B4_PMC 0x0/* normal */ + +#define B5_Tacs 0x0/* 0clk */ +#define B5_Tcos 0x0/* 0clk */ +#define B5_Tacc 0x7/* 14clk */ +#define B5_Tcoh 0x0/* 0clk */ +#define B5_Tah 0x0/* 0clk */ +#define B5_Tacp 0x0 +#define B5_PMC 0x0/* normal */ + +#define B6_MT 0x3/* SDRAM */ +#define B6_Trcd 0x1 +#define B6_SCAN 0x1/* 9bit */ + +#define B7_MT 0x3/* SDRAM */ +#define B7_Trcd 0x1/* 3clk */ +#define B7_SCAN 0x1/* 9bit */ + +/* REFRESH parameter */ +#define REFEN 0x1/* Refresh enable */ +#define TREFMD 0x0/* CBR(CAS before RAS)/Auto refresh */ +#define Trp 0x0/* 2clk */ +#define Trc 0x3/* 7clk */ +#define Tchr 0x2/* 3clk */ +#define REFCNT 1113/* period=15.6us, HCLK=60Mhz */ + +#endif boards.cfg +0
-1@@ -61,6 +61,7 @@ mx1ads arm arm920t - - scb9328 arm arm920t - - imx cm4008 armarm920t - - ks8695 cm41xx
arm arm920t - -
ks8695+mini2440 arm arm920t mini2440
friendlyarm s3c24x0 VCMA9 arm arm920tvcma9 mpl s3c24x0 smdk2410
arm arm920t - samsung s3c24x0
omap1510inn arm arm925t -
ti diff --gita/include/configs/mini2440.hb/include/configs/mini2440.hnew file mode 100644
index 0000000..a3f06d0include/configs/mini2440.h new file +33
-0@@ -0,0 +1,215 @@ +/* +* (C) Copyright 2002 +* Sysgo Real-Time Solutions, GmbH <www.elinos.com> +* Marius Groeger <[email protected]> +* Gary Jennejohn <[email protected]> +* David Mueller <[email protected]> +* +* (C) Copyright 2009-2010 +* Michel Pollet <[email protected]> +* +* (C) Copyright 2012 +* Gabriel Huau <[email protected]> +* +* Configuation settings for the MINI2440 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 +*/ include/configs/mini2440.h line 43
Quoted 10 lines
include/configs/mini2440.h new file +10
-0+ +#ifndef __CONFIG_H +#define __CONFIG_H + +#define CONFIG_SYS_TEXT_BASE 0x0 + +/* +* High Level Configuration Options +*/ +#define CONFIG_ARM920T 1/* This is an ARM920T Core */
Quoted 61 lines
include/configs/mini2440.h new file +9
-0+#define CONFIG_S3C24X0 1/* in a SAMSUNG S3C2440 SoC */ +#define CONFIG_S3C2440 1/* in a SAMSUNG S3C2440 SoC */ +#define CONFIG_MINI2440 1/* on a MIN2440 Board */ + +#define MACH_TYPE_MINI2440 1999 +#define CONFIG_MACH_TYPE MACH_TYPE_MINI2440 + +/* +* It is possible to have u-boot save it's environment in NOR, however, + * reember it is incompatible with booting from NAND as the NOR is not + * available at that point. So use this only if you use nand as storage + * and will never boot from it
+ */include/configs/mini2440.h new file +48
-0+#define CONFIG_MINI2440_NOR_ENV 1 +/* allow use of frequencies over 405Mhz */ +#define CONFIG_MINI2440_OVERCLOCK 1 + +/* +* input clock of PLL +*/ +/* MINI2440 has 12.0000MHz input clock */ +#define CONFIG_SYS_CLK_FREQ 12000000 +#define CONFIG_ARCH_CPU_INIT 1/* for the initialization of PLL */ + +#define USE_920T_MMU 1 +#define CONFIG_BAUDRATE 115200 + +/* +* Size of malloc() pool +*/ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2048*1024) +/* size in bytes reserved for initial data */ +#define CONFIG_GBL_DATA_SIZE 128 + +/* +* Hardware drivers +*/ +#define CONFIG_DRIVER_DM9000 1 +#define CONFIG_DRIVER_DM9000_NO_EEPROM 1 +#define CONFIG_DM9000_BASE 0x20000300 +#define DM9000_IO CONFIG_DM9000_BASE +#define DM9000_DATA (CONFIG_DM9000_BASE+4) + +/* +* select serial console configuration +*/ +#define CONFIG_S3C24X0_SERIAL +#define CONFIG_SERIAL1 1 + +/* +* allow to overwrite serial and ethaddr +*/ +#define CONFIG_ENV_OVERWRITE + +/* +* Command definition +*/ +#include <config_cmd_default.h> + +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_PORTIO include/configs/mini2440.h
Quoted 10 lines
include/configs/mini2440.h new file +10
-0+#define CONFIG_CMD_REGINFO +#define CONFIG_CMD_SAVES + +/* +* Miscellaneous configurable options +*/ +#define CONFIG_LONGHELP +#define CONFIG_SYS_PROMPT "MINI2440 => " +#define CONFIG_SYS_CBSIZE 256 +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
include/configs/mini2440.h
Quoted 5 lines
include/configs/mini2440.h new file +5
-0+#define CONFIG_SYS_MAXARGS 32 +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE + +#define CONFIG_SYS_MEMTEST_START 0x30000000 +#define CONFIG_SYS_MEMTEST_END 0x34000000/* 64MB in DRAM */
Quoted 12 lines
include/configs/mini2440.h new file +12
-0+ +/* everything, incl board info, in Hz */ +#undef CONFIG_CLKS_IN_HZ + +/* default load address */ +#define CONFIG_SYS_LOAD_ADDR 0x32000000 + +/* boot parameters address */ +#define CONFIG_BOOT_PARAM_ADDR 0x30000100 + +/* +* the PWM TImer 4 uses a counter of 15625 for 10 ms, so we need Quoted 8 lines
Quoted 8 lines
include/configs/mini2440.h
Quoted 8 lines
+ * it to wrap 100 times (total 1562500) to get 1 sec.
+ */include/configs/mini2440.h new file +6
-0+#define CONFIG_SYS_HZ 1562500 + +/* +* valid baudrates +*/ +#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600,115200
Quoted 85 lines
Quoted 53 lines
Quoted 15 lines
} +
include/configs/mini2440.h new file +14
-0+/* +* Stack sizes +* The stack sizes are set up in start.S using the settings below +*/ +#define CONFIG_STACKSIZE (128*1024)/* regular stack */ +#ifdef CONFIG_USE_IRQ +#define CONFIG_STACKSIZE_IRQ (8*1024)/* IRQ stack */ +#define CONFIG_STACKSIZE_FIQ (4*1024)/* FIQ stack */ +#endif + +/* +* Physical Memory Map +*/ +#define CONFIG_NR_DRAM_BANKS 1/* we have 1 bank of Quoted 4 lines
DRAM */ +#define
PHYS_SDRAM_10x30000000/* SDRAM Bank
#1 */ +#definePHYS_SDRAM_1_SIZE(64*1024*1024) /* 64MB of
DRAM */ +#defineCONFIG_SYS_SDRAM_BASEPHYS_SDRAM_1
+#defineCONFIG_SYS_INIT_SP_ADDR(CONFIG_SYS_SDRAM_BASE+0x1000- \
Quoted 31 lines
include/configs/mini2440.h new file +4
-0+ GENERATED_GBL_DATA_SIZE) + +/* +* When booting from NAND, it is impossible to access the lowest addresses + * due to the SteppingStone being in the way. Luckily the NOR doesn't really + * care about the highest 16 bits of address, so we set the controlers + * registers to go and poke over there, instead.
+ */include/configs/mini2440.h new file +22
-0+#define PHYS_FLASH_1 0x0 +#define CONFIG_SYS_FLASH_BASE 0x0 + +/* +* NOR FLASH organization +* Now uses the standard CFI interface +* FLASH and environment organization +*/ +#define CONFIG_SYS_FLASH_CFI 1 +#define CONFIG_FLASH_CFI_DRIVER 1 +#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT +#define CONFIG_SYS_MONITOR_BASE 0x0 +/* max number of memory banks */ +#define CONFIG_SYS_MAX_FLASH_BANKS 1 +/* 512 * 4096 sectors, or 32 * 64k blocks */ +#define CONFIG_SYS_MAX_FLASH_SECT 512 +#define CONFIG_FLASH_SHOW_PROGRESS 1 + +/* +* u-boot environmnent +*/ +#define CONFIG_BOOTDELAY 3Quoted 8 lines
include/configs/mini2440.h line 194
Quoted 6 lines
include/configs/mini2440.h new file +6
-0+#define CONFIG_BOOTARGS "root=/dev/sdb1 console=ttySAC0,115200" +#define CONFIG_NETMASK 255.255.255.0 +#define CONFIG_IPADDR 192.168.0.2 +#define CONFIG_SERVERIP 192.168.0.1 +#define CONFIG_DOS_PARTITION 1 +#define CONFIG_BOOTCOMMAND "tftp 0x32000000 uImage;bootm"DROP THIS!
ok :-)
Quoted 21 lines
Quoted 21 lines
include/configs/mini2440.h new file +21
-0+ +/* +* Config for NOR flash +*/ +#define CONFIG_ENV_IS_IN_FLASH 1 +#define CONFIG_MY_ENV_OFFSET 0x40000 +/* addr of environment */ +#define CONFIG_ENV_ADDR (PHYS_FLASH_1 + CONFIG_MY_ENV_OFFSET) +/* 16k Total Size of Environment Sector */ +#define CONFIG_ENV_SIZE 0x4000 + +#define CONFIG_PREBOOT_OVERRIDE 1 + +/* ATAG configuration */ +#define CONFIG_INITRD_TAG 1 +#define CONFIG_SETUP_MEMORY_TAGS 1 +#define CONFIG_CMDLINE_TAG 1 +#define CONFIG_CMDLINE_EDITING 1 +#define CONFIG_AUTO_COMPLETE 1 + +#endif /* __CONFIG_H */
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Dear Gabriel Huau,
Quoted 188 lines · Marek Vasut
Quoted 187 lines
Dear Gabriel Huau,
Quoted 184 lines · Marek Vasut
Quoted 173 lines
Dear Gabriel Huau,
Quoted 171 lines
---
Changes for v2:
- Coding style cleanup
- Remove unnecessary files modification
- Remove unnecessary board configuration setChanges for v3:
- Coding style cleanup
- Move some macro definition fromlowlevel_init.Sto a new header
- Remove some "magic bloat" with I/O board initialization
- Add apll_delayand replace loop by it
- Somme cleanup in the configuration file
- Cancel modifications on an SoC specific header
- Add my name to copyright---
board/friendlyarm/mini2440/Makefile | 45 ++++++ board/friendlyarm/mini2440/lowlevel_init.S | 76 ++++++++++ board/friendlyarm/mini2440/mini2440.c | 139 ++++++++++++++++++ board/friendlyarm/mini2440/mini2440.h | 104 ++++++++++++++ boards.cfg | 1 + include/configs/mini2440.h | 215++++++++++++++++++++++++++++ 6 files changed, 580 insertions(+)
create mode 100644 board/friendlyarm/mini2440/Makefile create mode 100644 board/friendlyarm/mini2440/lowlevel_init.S create mode 100644 board/friendlyarm/mini2440/mini2440.c create mode 100644 board/friendlyarm/mini2440/mini2440.h create mode 100644 include/configs/mini2440.h(quoted diff) +0
-0b/board/friendlyarm/mini2440/Makefile new file mode 100644 index 0000000..e8d68cb
board/friendlyarm/mini2440/Makefile new file +18
-0@@ -0,0 +1,45 @@ +# +# (C) Copyright 2012 +# Wolfgang Denk, DENX Software Engineering, wd 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 PublicLicense +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
board/friendlyarm/mini2440/Makefile new file +18
-0+# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS := mini2440.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) + $(call cmd_link_o_target, $(OBJS) $(SOBJS)) + +###################################################################### ### +
board/friendlyarm/mini2440/Makefile new file +6
-0+# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +###################################################################### ### diff --git
a/board/friendlyarm/mini2440/lowlevel_init.Sb/board/friendlyarm/mini2440/lowlevel_init.Snew file mode 100644 index 0000000..f69a08cboard/friendlyarm/mini2440/lowlevel_init.S new file +4
-0@@ -0,0 +1,76 @@ +/* + * Memory Setup stuff - taken from blob memsetup.S + * + * Copyright (C) 1999 2000 2001 Erik Mouw(J.A.K.Mouw at its.tudelft.nl) and + * Jan-Derk
Bakker
(J.D.Bakker at its.tudelft.nl) + *
+ * Modified for the Samsung SMDK2410 by
+ * (C) Copyright 2002
+ * David Mueller, ELSOFT AG, <[email protected]>
+ *
+ * (C) Copyright 2012
+ * Gabriel Huau <[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
+ */board/friendlyarm/mini2440/lowlevel_init.S new file +32
-0+ +#include <config.h> +#include <version.h> +#include "mini2440.h" + +_TEXT_BASE: + .word CONFIG_SYS_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)+(B
5_BW SCO N<<20)+(B6_BWSCON<<24)+(B7_BWSCON<<28)) + .word
((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+
(B0_Tac p<<2)+(B0_PMC)) + .word
((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+
(B1_Tac p<<2)+(B1_PMC)) + .word
((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+
(B2_Tac p<<2)+(B2_PMC)) + .word
((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+(B3_Tah<<4)+
(B3_Tac p<<2)+(B3_PMC)) + .word
((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+(B4_Tah<<4)+
(B4_Tac p<<2)+(B4_PMC)) + .word
((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+(B5_Tah<<4)+ (B5_Tac p<<2)+(B5_PMC)) +
+ .word ((B6_MT<<15)+(B6_Trcd<<2)+(B6_SCAN))Quoted 8 lines
board/friendlyarm/mini2440/lowlevel_init.S line 76
Quoted 6 lines
board/friendlyarm/mini2440/lowlevel_init.S new file +2
-0+ .word ((B7_MT<<15)+(B7_Trcd<<2)+(B7_SCAN)) + .word((REFEN<<23)+(TREFMD<<22)+(Trp<<20)+(Trc<<18)+(Tchr<<16)+REFCNT) + .word
0x32board/friendlyarm/mini2440/lowlevel_init.S new file +2
-0+ .word 0x30 + .word 0x30What this undocumented stuff?
SoC specific, I pasted it from smdk2410, it's for initialize the DRAM.
Quoted 7 lines
Quoted 1 line
Can't you init DRAM in some more fitting place? Also document this?
I don't know, this part is a bit difficult for me, but I'm going to try to document it with the help of the SoC documentation.
For the place, should I move it to
mini2440.cinarch_cpu_init()orboard_early_init_f()? I don't really know the difference.
dram_init() maybe ?
Quoted 81 lines
Quoted 81 lines
Quoted 81 lines
Quoted 80 lines
Quoted 71 lines
(quoted diff) +0
-0
b/board/friendlyarm/mini2440/mini2440.cnew file mode 100644 index 0000000..9ba8d39board/friendlyarm/mini2440/mini2440.c new file +28
-0@@ -0,0 +1,139 @@ +/* +* (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 2009 +* Michel Pollet <[email protected]> +* +* (C) Copyright 2012 +* Gabriel Huau <[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
+ */board/friendlyarm/mini2440/mini2440.c new file +31
-0+ +#include <common.h> +#include <asm/arch/s3c2440.h> +#include <asm/io.h> +#include <video_fb.h> +#include "mini2440.h" + +#ifdef CONFIG_DRIVER_DM9000 +#include <netdev.h> +#endif + +DECLARE_GLOBAL_DATA_PTR ; + +static inline void pll_delay (unsigned long loops) +{ + __asm__volatile ("1:\n" +"subs %0, %1, #1\n" +"bne 1b" :"=r" (loops) :"0" (loops)); +} + +int arch_cpu_init (void ) +{ +struct s3c24x0_clock_power *const clk_power = +s3c24x0_get_base_clock_power (); + +/* to reduce PLL lock time, adjust the LOCKTIME register */ + clk_power->locktime =0xFFFFFF ; + clk_power->clkdivn =CLKDIVN_VAL ; + +/* configure UPLL */ + clk_power->upllcon = ((U_M_MDIV << 12) + (U_M_PDIV << 4) +
U_M_SDIV); + /* some delay between MPLL and UPLL */board/friendlyarm/mini2440/mini2440.c line 71
Quoted 7 lines
board/friendlyarm/mini2440/mini2440.c new file +7
-0+pll_delay (100000 ); + +/* configure MPLL */ + clk_power->mpllcon = ((M_MDIV <<12 ) + (M_PDIV <<4 ) +M_SDIV ); + +/* some delay between MPLL and UPLL */ +pll_delay (500000 );You use
udelay()below, do you needpll_delay()at all?
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Yes, because initialisation of PLL is done before
timer_init(), so we can't useudelay().Maybe fix the timer driver?
As PLL initialization is SoC specific, should I move it to
arch/arch/cpu/arm920t/s3c24x0/timer.cintimer_init()?
Yes
Quoted 3 lines
With this modification, I will have to patch all board based on s3c24x0, because they are all using this "hack". Should this modification be part of another patch ? (for me, yes ...)
Yes
...
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
2012/4/20 Marek Vasut <[email protected]>
Quoted 209 lines
Dear Gabriel Huau,
Quoted 52 lines · Marek Vasut
Quoted 51 lines
Dear Gabriel Huau,
Quoted 49 lines · Marek Vasut
Quoted 48 lines
Dear Gabriel Huau,
Quoted 46 lines
---
Changes for v2:
- Coding style cleanup
- Remove unnecessary files modification
- Remove unnecessary board configuration setChanges for v3:
- Coding style cleanup
- Move some macro definition fromlowlevel_init.Sto a new header
- Remove some "magic bloat" with I/O board initialization
- Add apll_delayand replace loop by it
- Somme cleanup in the configuration file
- Cancel modifications on an SoC specific header
- Add my name to copyright---
board/friendlyarm/mini2440/Makefile | 45 ++++++ board/friendlyarm/mini2440/lowlevel_init.S | 76 ++++++++++ board/friendlyarm/mini2440/mini2440.c | 139 ++++++++++++++++++ board/friendlyarm/mini2440/mini2440.h | 104 ++++++++++++++ boards.cfg | 1 + include/configs/mini2440.h | 215++++++++++++++++++++++++++++ 6 files changed, 580 insertions(+)
create mode 100644 board/friendlyarm/mini2440/Makefile create mode 100644 board/friendlyarm/mini2440/lowlevel_init.S create mode 100644 board/friendlyarm/mini2440/mini2440.c create mode 100644 board/friendlyarm/mini2440/mini2440.h create mode 100644 include/configs/mini2440.h(quoted diff) +0
-0b/board/friendlyarm/mini2440/Makefile new file mode 100644 index 0000000..e8d68cb
board/friendlyarm/mini2440/Makefile new file +5
-0@@ -0,0 +1,45 @@ +# +# (C) Copyright 2012 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# See file CREDITS for list of people who contributed to thisQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
board/friendlyarm/mini2440/Makefile
Quoted 8 lines
board/friendlyarm/mini2440/Makefile new file +8
-0+# 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 beuseful,
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
board/friendlyarm/mini2440/Makefile new file +5
-0+# 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 PublicLicense +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
board/friendlyarm/mini2440/Makefile new file +10
-0+# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS := mini2440.o +SOBJS := lowlevel_init.o +Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
board/friendlyarm/mini2440/Makefile line 37
Quoted 8 lines
board/friendlyarm/mini2440/Makefile new file +7
-0+SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) +SOBJS := $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(obj).depend $(OBJS) $(SOBJS) + $(call cmd_link_o_target, $(OBJS) $(SOBJS)) ++##################################################################
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
board/friendlyarm/mini2440/Makefile line 44
Quoted 7 lines
#### ### +
board/friendlyarm/mini2440/Makefile new file +5
-0+# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend ++##################################################################
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
#### ### diff --git
a/board/friendlyarm/mini2440/lowlevel_init.Sb/board/friendlyarm/mini2440/lowlevel_init.Snew file mode 100644 index 0000000..f69a08cboard/friendlyarm/mini2440/lowlevel_init.S new file +4
-0@@ -0,0 +1,76 @@ +/* + * Memory Setup stuff - taken from blob memsetup.S + * + * Copyright (C) 1999 2000 2001 Erik Mouw(J.A.K.Mouw at its.tudelft.nl) and + * Jan-Derk
Bakker
(J.D.Bakker at its.tudelft.nl) + *
+ * Modified for the Samsung SMDK2410 by
+ * (C) Copyright 2002
+ * David Mueller, ELSOFT AG, <[email protected]>
+ *Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
+ * (C) Copyright 2012
+ * Gabriel Huau <[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 Licenseas
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ * published by the Free Software Foundation; either version 2
of
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will beuseful,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ * but WITHOUT ANY WARRANTY; without even the implied warranty
of
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
+ * 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,
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
+ * MA 02111-1307 USA
+ */board/friendlyarm/mini2440/lowlevel_init.S new file +25
-0+ +#include <config.h> +#include <version.h> +#include "mini2440.h" + +_TEXT_BASE: + .word CONFIG_SYS_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 */Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
board/friendlyarm/mini2440/lowlevel_init.S
Quoted 8 lines
board/friendlyarm/mini2440/lowlevel_init.S new file +7
-0+ mov pc, lr + + .ltorg +/* the literal pools origin */ + +SMRDATA: + .word(0+(B1_BWSCON<<4)+(B2_BWSCON<<8)+(B3_BWSCON<<12)+(B4_BWSCON<<16)+(B
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
5_BW SCO N<<20)+(B6_BWSCON<<24)+(B7_BWSCON<<28)) + .word
((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(
B0_Tac p<<2)+(B0_PMC)) + .word((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(
B1_Tac p<<2)+(B1_PMC)) + .word((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(
B2_Tac p<<2)+(B2_PMC)) + .word((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+(B3_Tah<<4)+
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(
B3_Tac p<<2)+(B3_PMC)) + .word((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+(B4_Tah<<4)+
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(
B4_Tac p<<2)+(B4_PMC)) + .word((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+(B5_Tah<<4)+
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
(
B5_Tac p<<2)+(B5_PMC)) +board/friendlyarm/mini2440/lowlevel_init.S new file +3
-0+ .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)
+
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
board/friendlyarm/mini2440/lowlevel_init.S line 76
Quoted 3 lines
.word
0x32board/friendlyarm/mini2440/lowlevel_init.S new file +2
-0+ .word 0x30 + .word 0x30What this undocumented stuff?
SoC specific, I pasted it from smdk2410, it's for initialize the
DRAM.
Quoted 3 lines
Quoted 2 lines
Can't you init DRAM in some more fitting place? Also document this?
Quoted 8 lines
Quoted 5 lines
I don't know, this part is a bit difficult for me, but I'm going to try to document it with the help of the SoC documentation.
For the place, should I move it to
mini2440.cinarch_cpu_init()orboard_early_init_f()? I don't really know the difference.
dram_init()maybe ?
You propose to initialize the SDRAM controller in dram_init ()?
Quoted 111 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
(quoted diff) +0
-0
b/board/friendlyarm/mini2440/mini2440.cnew file mode 100644 index 0000000..9ba8d39board/friendlyarm/mini2440/mini2440.c new file +11
-0@@ -0,0 +1,139 @@ +/* +* (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 2009 +* Michel Pollet <[email protected]> +* Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
board/friendlyarm/mini2440/mini2440.c line 19
Quoted 8 lines
board/friendlyarm/mini2440/mini2440.c new file +8
-0+* (C) Copyright 2012 +* Gabriel Huau <[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
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
board/friendlyarm/mini2440/mini2440.c line 20
Quoted 1 line
board/friendlyarm/mini2440/mini2440.c new file +1
-0+* published by the Free Software Foundation; either version 2 of
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
board/friendlyarm/mini2440/mini2440.c line 23
Quoted 3 lines
board/friendlyarm/mini2440/mini2440.c new file +3
-0+* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
board/friendlyarm/mini2440/mini2440.c line 24
Quoted 1 line
board/friendlyarm/mini2440/mini2440.c new file +1
-0+* but WITHOUT ANY WARRANTY; without even the implied warranty of
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
board/friendlyarm/mini2440/mini2440.c new file +4
-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,
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
+ * MA 02111-1307 USA
+ */board/friendlyarm/mini2440/mini2440.c new file +16
-0+ +#include <common.h> +#include <asm/arch/s3c2440.h> +#include <asm/io.h> +#include <video_fb.h> +#include "mini2440.h" + +#ifdef CONFIG_DRIVER_DM9000 +#include <netdev.h> +#endif + +DECLARE_GLOBAL_DATA_PTR ; + +static inline void pll_delay (unsigned long loops) +{ + __asm__ volatile ("1:\n"Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
board/friendlyarm/mini2440/mini2440.c line 57
Quoted 8 lines
board/friendlyarm/mini2440/mini2440.c new file +8
-0+ "subs %0, %1, #1\n" + "bne 1b" : "=r" (loops) : "0" (loops)); +} + +int arch_cpu_init (void ) +{ + struct s3c24x0_clock_power * const clk_power = +
s3c24x0_get_base_clock_power();Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
board/friendlyarm/mini2440/mini2440.c new file +4
-0+ +/* to reduce PLL lock time, adjust the LOCKTIME register */ + clk_power->locktime =0xFFFFFF ; + clk_power->clkdivn =CLKDIVN_VAL ;Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
board/friendlyarm/mini2440/mini2440.c
Quoted 8 lines
board/friendlyarm/mini2440/mini2440.c new file +3
-0+ +/* configure UPLL */ + clk_power->upllcon = ((U_M_MDIV << 12) + (U_M_PDIV << 4) +
U_M_SDIV); + /* some delay between MPLL and UPLL */board/friendlyarm/mini2440/mini2440.c new file +4
-0+pll_delay (100000 ); + +/* configure MPLL */ + clk_power->mpllcon = ((M_MDIV << 12) + (M_PDIV << 4) +
M_SDIV);Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
board/friendlyarm/mini2440/mini2440.c line 71
Quoted 3 lines
board/friendlyarm/mini2440/mini2440.c new file +3
-0+ +/* some delay between MPLL and UPLL */ +pll_delay (500000 );You use
udelay()below, do you needpll_delay()at all?Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Yes, because initialisation of PLL is done before
timer_init(), so we can't useudelay().Maybe fix the timer driver?
As PLL initialization is SoC specific, should I move it to
arch/arch/cpu/arm920t/s3c24x0/timer.cintimer_init()?Yes
Quoted 3 lines
With this modification, I will have to patch all board based on s3c24x0, because they are all using this "hack". Should this modification be part of another patch ? (for me, yes ...)
Yes
...
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Dear Ilya Averyanov,
[...]
Quoted 15 lines
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Review
Quoted 3 lines
.word
0x32(quoted diff) +2
-0+ .word 0x30 + .word 0x30What this undocumented stuff?
SoC specific, I pasted it from smdk2410, it's for initialize the
DRAM.
Quoted 5 lines
Quoted 1 line
Can't you init DRAM in some more fitting place? Also document this?
I don't know, this part is a bit difficult for me, but I'm going to try to document it with the help of the SoC documentation.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
For the place, should I move it to
mini2440.cinarch_cpu_init()orboard_early_init_f()? I don't really know the difference.
dram_init()maybe ?You propose to initialize the SDRAM controller in
dram_init()?
Well yes, ain't it more fitting ?
Best regards,
Marek Vasut
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
2012/4/20 Marek Vasut <[email protected]>
Quoted 23 lines
Dear Ilya Averyanov,
[...]
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Review
Quoted 3 lines
.word
0x32(quoted diff) +2
-0+ .word 0x30 + .word 0x30What this undocumented stuff?
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
SoC specific, I pasted it from smdk2410, it's for initialize the
DRAM.
Quoted 3 lines
Quoted 1 line
Can't you init DRAM in some more fitting place? Also document this?
I don't know, this part is a bit difficult for me, but I'm going to
try
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
to document it with the help of the SoC documentation.
For the place, should I move it to
mini2440.cinarch_cpu_init()orboard_early_init_f()? I don't really know the difference.
Quoted 9 lines
Quoted 3 lines
Quoted 1 line
dram_init()maybe ?You propose to initialize the SDRAM controller in
dram_init()?Well yes, ain't it more fitting ?
Best regards,
Marek Vasut
No. We have to two reasons why this is not the case.
1) Open u-boot/arch/arm/cpu/arm920t/start.S:328 cpu_init_crit
......
line 346
/*
* before relocating, we have to setup RAM timing
* because memory timing is board-dependend, you will
* find a lowlevel_init.S in your board directory. */
2) NAND controller must be initialized before C code run.
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Dear Ilya Averyanov,
Quoted 38 lines
2012/4/20 Marek Vasut <[email protected]>
Quoted 27 lines
Dear Ilya Averyanov,
[...]
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Review
Quoted 3 lines
.word
0x32(quoted diff) +2
-0+ .word 0x30 + .word 0x30What this undocumented stuff?
SoC specific, I pasted it from smdk2410, it's for initialize the
Quoted 6 lines
Quoted 6 lines
DRAM.
Quoted 4 lines
Quoted 2 lines
Can't you init DRAM in some more fitting place? Also document this?
I don't know, this part is a bit difficult for me, but I'm going to
try
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
to document it with the help of the SoC documentation.
For the place, should I move it to
mini2440.cinarch_cpu_init()orboard_early_init_f()? I don't really know the difference.Quoted 8 lines
Quoted 3 lines
Quoted 1 line
dram_init()maybe ?You propose to initialize the SDRAM controller in
dram_init()?Well yes, ain't it more fitting ?
Best regards,
Marek Vasut
Quoted 10 lines
No. We have to two reasons why this is not the case.
1) Openu-boot/arch/arm/cpu/arm920t/start.S:328cpu_init_crit
......
line 346
/*
* before relocating, we have to setup RAM timing
* because memory timing is board-dependend, you will
* find alowlevel_init.Sin your board directory. */
Well don't setup run in lowlevel_init.S then ?
Quoted 1 line
2) NAND controller must be initialized before C code run.
Why?
Best regards,
Marek Vasut
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
2012/4/20 Marek Vasut <[email protected]>
Quoted 53 lines
Dear Ilya Averyanov,
Quoted 21 lines
2012/4/20 Marek Vasut <[email protected]>
Quoted 19 lines
Dear Ilya Averyanov,
[...]
Quoted 15 lines
Quoted 15 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Review
Quoted 3 lines
.word
0x32(quoted diff) +2
-0+ .word 0x30 + .word 0x30What this undocumented stuff?
SoC specific, I pasted it from smdk2410, it's for initialize the
DRAM.
Quoted 4 lines
Quoted 2 lines
Can't you init DRAM in some more fitting place? Also document this?
I don't know, this part is a bit difficult for me, but I'm going
to
Quoted 6 lines
Quoted 6 lines
try
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
to document it with the help of the SoC documentation.
For the place, should I move it to
mini2440.cinarch_cpu_init()or
Quoted 11 lines
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
board_early_init_f()? I don't really know the difference.
dram_init()maybe ?You propose to initialize the SDRAM controller in
dram_init()?Well yes, ain't it more fitting ?
Best regards,
Marek VasutQuoted 10 lines
No. We have to two reasons why this is not the case.
1) Openu-boot/arch/arm/cpu/arm920t/start.S:328cpu_init_crit
......
line 346
/*
* before relocating, we have to setup RAM timing
* because memory timing is board-dependend, you will
* find alowlevel_init.Sin your board directory. */
Quoted 9 lines
Well don't setup run in
lowlevel_init.Sthen ?Quoted 1 line
2) NAND controller must be initialized before C code run.
Why?
Best regards,
Marek Vasut
mmm...
Because we need a stack.
The stack is in RAM.
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
2012/4/20 Ilya Averyanov <[email protected]>
Quoted 63 lines
2012/4/20 Marek Vasut <[email protected]>
Quoted 59 lines
Dear Ilya Averyanov,
Quoted 21 lines
2012/4/20 Marek Vasut <[email protected]>
Quoted 19 lines
Dear Ilya Averyanov,
[...]
Quoted 15 lines
Quoted 15 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Review
Quoted 3 lines
.word
0x32(quoted diff) +2
-0+ .word 0x30 + .word 0x30What this undocumented stuff?
SoC specific, I pasted it from smdk2410, it's for initialize the
DRAM.
Quoted 4 lines
Quoted 2 lines
Can't you init DRAM in some more fitting place? Also document this?
I don't know, this part is a bit difficult for me, but I'm
going to
Quoted 6 lines
Quoted 6 lines
try
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
to document it with the help of the SoC documentation.
For the place, should I move it to
mini2440.cin
arch_cpu_init()orQuoted 11 lines
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
board_early_init_f()? I don't really know the difference.
dram_init()maybe ?You propose to initialize the SDRAM controller in
dram_init()?Well yes, ain't it more fitting ?
Best regards,
Marek VasutQuoted 10 lines
No. We have to two reasons why this is not the case.
1) Openu-boot/arch/arm/cpu/arm920t/start.S:328cpu_init_crit
......
line 346
/*
* before relocating, we have to setup RAM timing
* because memory timing is board-dependend, you will
* find alowlevel_init.Sin your board directory. */Well don't setup run in
lowlevel_init.Sthen ?Quoted 1 line
2) NAND controller must be initialized before C code run.
Why?
Quoted 8 lines
Quoted 3 lines
Best regards,
Marek Vasutmmm...
Because we need a stack.
The stack is in RAM.2) NAND controller must be initialized before C code run.
Sorry made ??a mistake. SDRAM! Not NAND!
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Dear Ilya Averyanov,
Quoted 71 lines
2012/4/20 Ilya Averyanov <[email protected]>
Quoted 69 lines
2012/4/20 Marek Vasut <[email protected]>
Quoted 66 lines
Dear Ilya Averyanov,
Quoted 21 lines
2012/4/20 Marek Vasut <[email protected]>
Quoted 19 lines
Dear Ilya Averyanov,
[...]
Quoted 15 lines
Quoted 15 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Review
Quoted 3 lines
.word
0x32(quoted diff) +2
-0+ .word 0x30 + .word 0x30What this undocumented stuff?
SoC specific, I pasted it from smdk2410, it's for
initialize theDRAM.
Quoted 4 lines
Quoted 2 lines
Can't you init DRAM in some more fitting place? Also document this?
I don't know, this part is a bit difficult for me, but I'm
going to
Quoted 5 lines
Quoted 5 lines
try
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
to document it with the help of the SoC documentation.
For the place, should I move it to
mini2440.cin
arch_cpu_init()orQuoted 17 lines
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
board_early_init_f()? I don't really know the difference.
dram_init()maybe ?You propose to initialize the SDRAM controller in
dram_init()?Well yes, ain't it more fitting ?
Best regards,
Marek VasutNo. We have to two reasons why this is not the case.
1) Openu-boot/arch/arm/cpu/arm920t/start.S:328cpu_init_crit
......
line 346Quoted 6 lines
/*
* before relocating, we have to setup RAM timing
* because memory timing is board-dependend, you will
* find alowlevel_init.Sin your board directory. */Well don't setup run in
lowlevel_init.Sthen ?Quoted 1 line
2) NAND controller must be initialized before C code run.
Why?
Best regards,
Marek Vasut
Quoted 7 lines
Quoted 5 lines
mmm...
Because we need a stack.
The stack is in RAM.2) NAND controller must be initialized before C code run.
Sorry made ??a mistake. SDRAM! Not NAND!
Which doesn't matter, either way you need stack ... and you can have the stack in cache ;-)
Best regards,
Marek Vasut
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
2012/4/20 Marek Vasut <[email protected]>
Quoted 79 lines
Dear Ilya Averyanov,
Quoted 77 lines
2012/4/20 Ilya Averyanov <[email protected]>
Quoted 74 lines
2012/4/20 Marek Vasut <[email protected]>
Quoted 58 lines
Dear Ilya Averyanov,
Quoted 21 lines
2012/4/20 Marek Vasut <[email protected]>
Quoted 19 lines
Dear Ilya Averyanov,
[...]
Quoted 15 lines
Quoted 15 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
.word 0x32
+ .word 0x30
+ .word 0x30What this undocumented stuff?
SoC specific, I pasted it from smdk2410, it's for
initialize theDRAM.
Quoted 4 lines
Quoted 2 lines
Can't you init DRAM in some more fitting place? Also document this?
I don't know, this part is a bit difficult for me, but I'm
going to
Quoted 5 lines
Quoted 5 lines
try
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
to document it with the help of the SoC documentation.
For the place, should I move it to
mini2440.cin
arch_cpu_init()orQuoted 17 lines
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
board_early_init_f()? I don't really know the difference.
dram_init()maybe ?You propose to initialize the SDRAM controller in
dram_init()?Well yes, ain't it more fitting ?
Best regards,
Marek VasutNo. We have to two reasons why this is not the case.
1) Openu-boot/arch/arm/cpu/arm920t/start.S:328cpu_init_crit
......
line 346Quoted 6 lines
/*
* before relocating, we have to setup RAM timing
* because memory timing is board-dependend, you will
* find alowlevel_init.Sin your board directory. */Quoted 8 lines
Well don't setup run in
lowlevel_init.Sthen ?Quoted 1 line
2) NAND controller must be initialized before C code run.
Why?
Best regards,
Marek Vasutmmm...
Because we need a stack.
The stack is in RAM.2) NAND controller must be initialized before C code run.
Quoted 9 lines
Quoted 1 line
Sorry made a mistake. SDRAM! Not NAND!
Which doesn't matter, either way you need stack ... and you can have the stack
in cache ;-)Best regards,
Marek Vasut
Why do you insist on sdram initialization code in C?
If you simply do as done in the other boards on this architecture?
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Dear Ilya Averyanov,
Quoted 84 lines
2012/4/20 Marek Vasut <[email protected]>
Quoted 82 lines
Dear Ilya Averyanov,
Quoted 79 lines
2012/4/20 Ilya Averyanov <[email protected]>
Quoted 67 lines
2012/4/20 Marek Vasut <[email protected]>
Quoted 65 lines
Dear Ilya Averyanov,
Quoted 21 lines
2012/4/20 Marek Vasut <[email protected]>
Quoted 19 lines
Dear Ilya Averyanov,
[...]
Quoted 15 lines
Quoted 15 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
.word 0x32
+ .word 0x30
+ .word 0x30What this undocumented stuff?
SoC specific, I pasted it from smdk2410, it's for
initialize theDRAM.
Quoted 4 lines
Quoted 2 lines
Can't you init DRAM in some more fitting place? Also document this?
I don't know, this part is a bit difficult for me, but I'm
going to
Quoted 5 lines
Quoted 5 lines
try
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
to document it with the help of the SoC documentation.
For the place, should I move it to
mini2440.cin
arch_cpu_init()orQuoted 18 lines
Quoted 11 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
board_early_init_f()? I don't really know the difference.
dram_init()maybe ?You propose to initialize the SDRAM controller in
dram_init()?Well yes, ain't it more fitting ?
Best regards,
Marek VasutNo. We have to two reasons why this is not the case.
1) Openu-boot/arch/arm/cpu/arm920t/start.S:328cpu_init_crit
......
line 346Quoted 6 lines
/*
* before relocating, we have to setup RAM timing
* because memory timing is board-dependend, you will
* find alowlevel_init.Sin your board directory. */Well don't setup run in
lowlevel_init.Sthen ?Quoted 1 line
2) NAND controller must be initialized before C code run.
Why?
Quoted 8 lines
Quoted 2 lines
Best regards,
Marek Vasutmmm...
Because we need a stack.
The stack is in RAM.2) NAND controller must be initialized before C code run.
Sorry made a mistake. SDRAM! Not NAND!
Quoted 8 lines
Quoted 6 lines
Which doesn't matter, either way you need stack ... and you can have the stack
in cache ;-)Best regards,
Marek VasutWhy do you insist on sdram initialization code in C?
That's how the init sequence was designed.
Quoted 1 line
If you simply do as done in the other boards on this architecture?
Other boards on arm architecture do init DRAM in proper place.
Best regards,
Marek Vasut
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
In reply to Ilya AveryanovDear Ilya Averyanov,
Quoted 3 lines · In message <CABi8O6aBPyYFPbzJETJFyx4fL4y1EHYpWJx8Ew4Ki-AHpLA=Mw@mail.gmail.com>…
Why do you insist on sdram initialization code in C?
If you simply do as done in the other boards on this architecture?
We want to simplify code by usiing the same approach everywhere. And this means that we first set up a system that can run C code, and then use this to insitialize the RAM. This includes using get_ram_size() to auto-detect (and verify) the actual RAM size. And get_ram_size() is a C function as well.
The "other boards" are still old-style and should not be used as examples.
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 How many QA engineers does it take to screw in a lightbulb? 3: 1 to screw it in and 2 to say "I told you so" when it doesn't work.
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
In reply to Marek Vasut2012/4/20 Marek Vasut <[email protected]>:
Quoted 2 lines
Which doesn't matter, either way you need stack ... and you can have the stack in cache ;-)
s3c24xx has 4kb of SRAM (steppingstone), you can use it for stack
Btw, using cache for stack looks like awful hack to me.
Regards
Vasily
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Dear Vasily Khoruzhick,
Quoted 5 lines
2012/4/20 Marek Vasut <[email protected]>:
Quoted 2 lines
Which doesn't matter, either way you need stack ... and you can have the stack in cache ;-)
s3c24xx has 4kb of SRAM (steppingstone), you can use it for stack
Oh, I didn't know that ... so there's no longer any problem.
Quoted 1 line
Btw, using cache for stack looks like awful hack to me.
It's fairy normal.
Quoted 2 lines
Regards
Vasily
Best regards,
Marek Vasut
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
2012/4/21 Marek Vasut <[email protected]>
Quoted 11 lines
Dear Vasily Khoruzhick,
Quoted 2 lines
2012/4/20 Marek Vasut <[email protected]>:
Quoted 1 line
Which doesn't matter, either way you need stack ... and you can have
the
Quoted 3 lines
Quoted 1 line
stack in cache ;-)
s3c24xx has 4kb of SRAM (steppingstone), you can use it for stack
Oh, I didn't know that ... so there's no longer any problem.
No have problem.
Available only if you boot from NOR flash.
If you boot from the NAND 4kb of SRAM (steppingstone) not available.
Quoted 5 lines
Quoted 2 lines
Btw, using cache for stack looks like awful hack to me.
It's fairy normal.
I agree with Vasily Khoruzhick, it looks like a hack
Quoted 7 lines
Quoted 3 lines
Regards
VasilyBest regards,
Marek Vasut
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Dear Ilya Averyanov,
Quoted 11 lines
2012/4/21 Marek Vasut <[email protected]>
Quoted 9 lines
Dear Vasily Khoruzhick,
Quoted 2 lines
2012/4/20 Marek Vasut <[email protected]>:
Quoted 1 line
Which doesn't matter, either way you need stack ... and you can have
the
Quoted 2 lines
Quoted 1 line
stack in cache ;-)
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
s3c24xx has 4kb of SRAM (steppingstone), you can use it for stack
Oh, I didn't know that ... so there's no longer any problem.
No have problem.
Available only if you boot from NOR flash.
If you boot from the NAND 4kb of SRAM (steppingstone) not available.
So you'll have to lock cache lines then. If you dig in the ML archive, you'll find a lot of discussion on this memory matter, esp. /wrt relocation support.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Btw, using cache for stack looks like awful hack to me.
It's fairy normal.
I agree with Vasily Khoruzhick, it looks like a hack
Please, bother to read the CPU manual and also the ARM Architecture reference manual before you start with such a wild accusations.
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Regards
VasilyBest regards,
Marek Vasut
Best regards,
Marek Vasut
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
2012/4/21 Marek Vasut <[email protected]>:
Quoted 4 lines
Quoted 1 line
?I agree with Vasily Khoruzhick, it looks like a hack
Please, bother to read the CPU manual and also the ARM Architecture reference manual before you start with such a wild accusations.
Let me explain my point of view.
Doing SDRAM init very early (even in assembly code) is obvious and simple. Just few simple writes into RAM controller registers.
But to use cache as RAM you need to program and enable MMU (again assembly, right?). And then
one needs to program SDRAM controller (ok, this part is in C code, but I don't see any advantage).
It's not as simple as previous solution, isn't it? And looks overengineered to me. I prefer to keep
such low-level things simple.
Regards
Vasily
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Dear Vasily Khoruzhick,
Quoted 3 lines · In message <CA+E=qVeXE0wUtN4nb6k-zAH7uqVF4J0umd33+GXkQb3yPvTW+A@mail.gmail.com>…
Doing SDRAM init very early (even in assembly code) is obvious and simple. Just few simple writes into RAM controller registers.
This is a misconception.
Experience on this very mailing list has shown that an extremely high number of issues is cause by incomplete and/or incorrect memory initialization. This is why U-Boot (be design!) makes sure we have a full C environment when doing this taks, where we can use printf() and friends for useful output etc.
Quoted 1 line
It's not as simple as previous solution, isn't it? And looks
No, it's not so simple, but far more convenient. And over time, much more time-saving.
Quoted 2 lines
overengineered to me. I prefer to keep
such low-level things simple.
We respect your personal preferences. But in this case we ask you to stick with the U-Boot design andimplement as requested. Thanks.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de 1 1 was a race-horse, 2 2 was 1 2. When 1 1 1 1 race, 2 2 1 1 2.
PATCH v3 1/1 Add support for MINI2440 (s3c2440)
In reply to Ilya AveryanovQuoted 9 lines · Ilya Averyanov
2012/4/21 Marek Vasut <[email protected]>
Quoted 7 lines
Dear Vasily Khoruzhick,
Quoted 2 lines
2012/4/20 Marek Vasut <[email protected]>:
Quoted 1 line
Which doesn't matter, either way you need stack ... and you can have
the
Quoted 2 lines
Quoted 1 line
stack in cache ;-)
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
s3c24xx has 4kb of SRAM (steppingstone), you can use it for stack
Oh, I didn't know that ... so there's no longer any problem.
No have problem.
Available only if you boot from NOR flash.
If you boot from the NAND 4kb of SRAM (steppingstone) not available.
SteppingStone is available ONLY in NAND boot :) and not available in NOR boot.
Quoted 19 lines
Quoted 5 lines
Quoted 2 lines
Btw, using cache for stack looks like awful hack to me.
It's fairy normal.
I agree with Vasily Khoruzhick, it looks like a hack
Quoted 7 lines
Quoted 3 lines
Regards
VasilyBest regards,
Marek Vasut_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH v3 1/1 Add support for MINI2440 (s3c2440)
2012/4/21 Gabriel Huau <[email protected]>
Quoted 46 lines · Ilya Averyanov
Quoted 6 lines
2012/4/21 Marek Vasut <[email protected]>
Quoted 4 lines
Dear Vasily Khoruzhick,
Quoted 2 lines
2012/4/20 Marek Vasut <[email protected]>:
Quoted 1 line
Which doesn't matter, either way you need stack ... and you can
have
Quoted 11 lines
Quoted 7 lines
the
Quoted 3 lines
Quoted 1 line
stack in cache ;-)
s3c24xx has 4kb of SRAM (steppingstone), you can use it for stack
Oh, I didn't know that ... so there's no longer any problem.
No have problem.
Available only if you boot from NOR flash.
If you boot from the NAND 4kb of SRAM (steppingstone) not available.SteppingStone is available ONLY in NAND boot :) and not available in NOR boot.
I meant is available as an internal RAM.
Quoted 19 lines
Quoted 5 lines
Quoted 2 lines
Btw, using cache for stack looks like awful hack to me.
It's fairy normal.
I agree with Vasily Khoruzhick, it looks like a hack
Quoted 7 lines
Quoted 3 lines
Regards
VasilyBest regards,
Marek Vasut_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH v3 1/1 Add support for MINI2440 (s3c2440)
In reply to Gabriel Huau2012/4/21 Gabriel Huau <[email protected]>:
Quoted 2 lines
SteppingStone is available ONLY in NAND boot :) and not available in NOR boot.
It's available at 0x40000000 for NOR boot. Check datasheet ;)
Regards
Vasily
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
In reply to Ilya Averyanov2012/4/21 Ilya Averyanov <[email protected]>:
Quoted 4 lines
No have problem.
Available only if you boot from NOR flash.
If you boot from the NAND 4kb of SRAM (steppingstone) not available.
For NAND boot it's mapped at 0x0
For NOR boot it's mapped at 0x40000000
NAND controller uses it for booting purpose, but anyway for SPL we should fit code into
4k (hardware limitation), so I think using assembly here for SDRAM init is OK.
Regards
Vasily
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Dear Vasily Khoruzhick,
Quoted 5 lines
2012/4/21 Ilya Averyanov <[email protected]>:
Quoted 3 lines
No have problem.
Available only if you boot from NOR flash.
If you boot from the NAND 4kb of SRAM (steppingstone) not available.
Quoted 7 lines
For NAND boot it's mapped at
0x0
For NOR boot it's mapped at0x40000000NAND controller uses it for booting purpose, but anyway for SPL we should fit code into
4k (hardware limitation), so I think using assembly here for SDRAM init is OK.
Now you claim that you can use SRAM for stack in all possible cases damnit. So there is not even a need for locking cache lines. So use the SRAM and be done with it.
Quoted 2 lines
Regards
Vasily
Best regards,
Marek Vasut
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
In reply to Vasily Khoruzhick2012/4/21 Vasily Khoruzhick <[email protected]>
Quoted 9 lines
2012/4/21 Ilya Averyanov <[email protected]>:
Quoted 4 lines
No have problem.
Available only if you boot from NOR flash.
If you boot from the NAND 4kb of SRAM (steppingstone) not available.For NAND boot it's mapped at
0x0
For NOR boot it's mapped at0x40000000
Quoted 6 lines
NAND controller uses it for booting purpose, but anyway for SPL we should fit code into
4k (hardware limitation), so I think using assembly here for SDRAM init is OK.And how will you use the internal SRAM when you boot from NAND, if the SoC
writes in the SDRAM read data from NAND, and your data will be overwritten.
Quoted 3 lines
Regards
Vasily
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Dear Ilya Averyanov,
Quoted 15 lines
2012/4/21 Vasily Khoruzhick <[email protected]>
Quoted 13 lines
2012/4/21 Ilya Averyanov <[email protected]>:
Quoted 3 lines
No have problem.
Available only if you boot from NOR flash.
If you boot from the NAND 4kb of SRAM (steppingstone) not available.For NAND boot it's mapped at
0x0
For NOR boot it's mapped at0x40000000NAND controller uses it for booting purpose, but anyway for SPL we should fit code into
4k (hardware limitation), so I think using assembly here for SDRAM init is OK.
Quoted 4 lines
Quoted 2 lines
And how will you use the internal SRAM when you boot from NAND, if the SoC
writes in the SDRAM read data from NAND, and your data will be overwritten.
Why? You'll load SPL into SRAM, then in SPL you'll copy the rest of uboot from NAND to - then already inited - SDRAM and execute it. We even have ready-to-use NAND SPL.
Quoted 3 lines
Quoted 3 lines
Regards
Vasily
Best regards,
Marek Vasut
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Dear Marek Vasut,
Would you please explain, why do you want to initialize the sdram has been in C code.
If for provide this feature should be written assembly code. And it would sometimes even harder than the initialization code sdram?
2012/4/21 Marek Vasut <[email protected]>
Quoted 36 lines
Dear Ilya Averyanov,
Quoted 15 lines
2012/4/21 Vasily Khoruzhick <[email protected]>
Quoted 13 lines
2012/4/21 Ilya Averyanov <[email protected]>:
Quoted 3 lines
No have problem.
Available only if you boot from NOR flash.
If you boot from the NAND 4kb of SRAM (steppingstone) not available.For NAND boot it's mapped at
0x0
For NOR boot it's mapped at0x40000000NAND controller uses it for booting purpose, but anyway for SPL we should fit code into
4k (hardware limitation), so I think using assembly here for SDRAM init is OK.Quoted 4 lines
Quoted 2 lines
And how will you use the internal SRAM when you boot from NAND, if the SoC
writes in the SDRAM read data from NAND, and your data will be
overwritten.
Why? You'll load SPL into SRAM, then in SPL you'll copy the rest of uboot from
NAND to - then already inited - SDRAM and execute it. We even have ready-to-use
NAND SPL.Quoted 3 lines
Quoted 3 lines
Regards
VasilyBest regards,
Marek Vasut
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Dear Ilya Averyanov,
Quoted 4 lines
Dear Marek Vasut,
Would you please explain, why do you want to initialize the sdram has been in C code.
Ok, no problem:
- You'll be able to call get_ram_size() to scan for ram size as any other board
- SDRAM driver will fit properly into the driver model once it's in place (WIP, wanna volunteer for review process?)
- It's much cleaner
Quoted 2 lines
If for provide this feature should be written assembly code. And it would sometimes even harder than the initialization code sdram?
What do you mean?
Ah yes, just a remark, please don't top-post. Notice how other people don't do it -- I know gmail does it out-of-the-box, but that doesn't mean it's correct.
Quoted 38 lines
2012/4/21 Marek Vasut <[email protected]>
Quoted 36 lines
Dear Ilya Averyanov,
Quoted 16 lines
2012/4/21 Vasily Khoruzhick <[email protected]>
Quoted 14 lines
2012/4/21 Ilya Averyanov <[email protected]>:
Quoted 4 lines
No have problem.
Available only if you boot from NOR flash.
If you boot from the NAND 4kb of SRAM (steppingstone) not available.For NAND boot it's mapped at
0x0
For NOR boot it's mapped at0x40000000NAND controller uses it for booting purpose, but anyway for SPL we should fit code into
4k (hardware limitation), so I think using assembly here for SDRAM init is OK.Quoted 4 lines
Quoted 2 lines
And how will you use the internal SRAM when you boot from NAND, if the SoC
writes in the SDRAM read data from NAND, and your data will be
overwritten.
Why? You'll load SPL into SRAM, then in SPL you'll copy the rest of uboot from
NAND to - then already inited - SDRAM and execute it. We even have ready-to-use
NAND SPL.Quoted 2 lines
Quoted 2 lines
Regards
VasilyBest regards,
Marek Vasut
Best regards,
Marek Vasut
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
2012/4/23 Marek Vasut <[email protected]>
Quoted 16 lines
Dear Ilya Averyanov,
Quoted 3 lines
Dear Marek Vasut,
Would you please explain, why do you want to initialize the sdram has
been
Quoted 1 line
in C code.
Ok, no problem:
- You'll be able to callget_ram_size()to scan for ram size as any other board
- SDRAM driver will fit properly into the driver model once it's in place (WIP,
wanna volunteer for review process?)
- It's much cleaner
Quoted 5 lines
Quoted 2 lines
If for provide this feature should be written assembly code. And it would sometimes even harder than the initialization code sdram?
What do you mean?
If we use 4kb of SRAM (steppingstone), then at least need to editu-boot/arch/arm/cpu/arm920t/start.S, to add a test from there was a boot (NAND or NOR). Edit the address stack. etc ...
Use the MMU cache for the stack, even a little better, but it is more difficult.
Quoted 51 lines
Ah yes, just a remark, please don't top-post. Notice how other people don't do
it -- I know gmail does it out-of-the-box, but that doesn't mean it's correct.Ok.
Quoted 28 lines
2012/4/21 Marek Vasut <[email protected]>
Quoted 26 lines
Dear Ilya Averyanov,
Quoted 16 lines
2012/4/21 Vasily Khoruzhick <[email protected]>
Quoted 14 lines
2012/4/21 Ilya Averyanov <[email protected]>:
Quoted 4 lines
No have problem.
Available only if you boot from NOR flash.
If you boot from the NAND 4kb of SRAM (steppingstone) not available.For NAND boot it's mapped at
0x0
For NOR boot it's mapped at0x40000000NAND controller uses it for booting purpose, but anyway for SPL we should fit code into
4k (hardware limitation), so I think using assembly here for SDRAM init is OK.Quoted 4 lines
Quoted 2 lines
And how will you use the internal SRAM when you boot from NAND, if the SoC
writes in the SDRAM read data from NAND, and your data will be
overwritten.
Why? You'll load SPL into SRAM, then in SPL you'll copy the rest of
uboot
Quoted 10 lines
Quoted 10 lines
from
NAND to - then already inited - SDRAM and execute it. We even have ready-to-use
NAND SPL.Quoted 2 lines
Quoted 2 lines
Regards
VasilyBest regards,
Marek VasutBest regards,
Marek Vasut
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Dear Ilya Averyanov,
Quoted 23 lines
2012/4/23 Marek Vasut <[email protected]>
Quoted 21 lines
Dear Ilya Averyanov,
Quoted 3 lines
Dear Marek Vasut,
Would you please explain, why do you want to initialize the sdram has
been
Quoted 1 line
in C code.
Ok, no problem:
- You'll be able to callget_ram_size()to scan for ram size as any other board
- SDRAM driver will fit properly into the driver model once it's in place (WIP,
wanna volunteer for review process?)
- It's much cleanerQuoted 2 lines
If for provide this feature should be written assembly code. And it would sometimes even harder than the initialization code sdram?
Quoted 7 lines
Quoted 1 line
What do you mean?
If we use 4kb of SRAM (steppingstone), then at least need to edit
u-boot/arch/arm/cpu/arm920t/start.S, to add a test from there was a boot (NAND or NOR). Edit the address stack. etc ...
Use the MMU cache for the stack, even a little better, but it is more difficult.
Just check where you have SRAM and adjust SP accordingly, it's easy :-)
Quoted 44 lines
Quoted 44 lines
Ah yes, just a remark, please don't top-post. Notice how other people don't do
it -- I know gmail does it out-of-the-box, but that doesn't mean it's correct.Ok.
Quoted 28 lines
2012/4/21 Marek Vasut <[email protected]>
Quoted 26 lines
Dear Ilya Averyanov,
Quoted 16 lines
2012/4/21 Vasily Khoruzhick <[email protected]>
Quoted 14 lines
2012/4/21 Ilya Averyanov <[email protected]>:
Quoted 4 lines
No have problem.
Available only if you boot from NOR flash.
If you boot from the NAND 4kb of SRAM (steppingstone) not available.For NAND boot it's mapped at
0x0
For NOR boot it's mapped at0x40000000NAND controller uses it for booting purpose, but anyway for SPL we should fit code into
4k (hardware limitation), so I think using assembly here for SDRAM init is OK.Quoted 4 lines
Quoted 2 lines
And how will you use the internal SRAM when you boot from NAND, if the SoC
writes in the SDRAM read data from NAND, and your data will be
overwritten.
Why? You'll load SPL into SRAM, then in SPL you'll copy the rest of
uboot
Quoted 5 lines
Quoted 5 lines
from
NAND to - then already inited - SDRAM and execute it. We even have ready-to-use
NAND SPL.
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Regards
VasilyBest regards,
Marek VasutBest regards,
Marek Vasut
Best regards,
Marek Vasut
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
In reply to Vasily KhoruzhickDear Vasily Khoruzhick,
Quoted 2 lines · In message <CA+E=qVdyJB3R8vwwFmZsU-0Yh1ah+ZyherrHnN3jx=xTY=tsWg@mail.gmail.com>…
Btw, using cache for stack looks like awful hack to me.
No, why? Cache is pretty fast RAM, so why not use it as such?
Hey, there are people who boot the whole Linux system (kernel + RAM disk) in cache (actully already on the die, before the chip even has seen a casing, far from thinking about a board...
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "One planet is all you get."
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
In reply to Ilya AveryanovDear Ilya Averyanov,
Quoted 66 lines
2012/4/20 Marek Vasut <[email protected]>
Quoted 64 lines
Dear Ilya Averyanov,
Quoted 22 lines
2012/4/20 Marek Vasut <[email protected]>
Quoted 20 lines
Dear Ilya Averyanov,
[...]
Quoted 16 lines
Quoted 16 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Review
Quoted 3 lines
.word
0x32(quoted diff) +2
-0+ .word 0x30 + .word 0x30What this undocumented stuff?
SoC specific, I pasted it from smdk2410, it's for
initialize theDRAM.
Quoted 5 lines
Quoted 2 lines
Can't you init DRAM in some more fitting place? Also document this?
I don't know, this part is a bit difficult for me, but I'm going
to
Quoted 6 lines
Quoted 6 lines
try
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
to document it with the help of the SoC documentation.
For the place, should I move it to
mini2440.cinarch_cpu_init()or
Quoted 17 lines
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
board_early_init_f()? I don't really know the difference.
dram_init()maybe ?You propose to initialize the SDRAM controller in
dram_init()?Well yes, ain't it more fitting ?
Best regards,
Marek VasutNo. We have to two reasons why this is not the case.
1) Openu-boot/arch/arm/cpu/arm920t/start.S:328cpu_init_crit
......
line 346Quoted 6 lines
/*
* before relocating, we have to setup RAM timing
* because memory timing is board-dependend, you will
* find alowlevel_init.Sin your board directory. */Well don't setup run in
lowlevel_init.Sthen ?Quoted 1 line
2) NAND controller must be initialized before C code run.
Quoted 8 lines
Quoted 4 lines
Why?
Best regards,
Marek Vasutmmm...
Because we need a stack.
The stack is in RAM.
mmm...
You can lock cache entries to create space for stack in cache. That's how it's done on PXA, check it.
Best regards,
Marek Vasut
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
In reply to Marek Vasut2012/4/20 Marek Vasut <[email protected]>
Quoted 278 lines
Dear Gabriel Huau,
Quoted 73 lines · Marek Vasut
Quoted 72 lines
Dear Gabriel Huau,
Quoted 70 lines
---
Changes for v2:
- Coding style cleanup
- Remove unnecessary files modification
- Remove unnecessary board configuration setChanges for v3:
- Coding style cleanup
- Move some macro definition fromlowlevel_init.Sto a new header
- Remove some "magic bloat" with I/O board initialization
- Add apll_delayand replace loop by it
- Somme cleanup in the configuration file
- Cancel modifications on an SoC specific header
- Add my name to copyright---
board/friendlyarm/mini2440/Makefile | 45 ++++++ board/friendlyarm/mini2440/lowlevel_init.S | 76 ++++++++++ board/friendlyarm/mini2440/mini2440.c | 139 ++++++++++++++++++ board/friendlyarm/mini2440/mini2440.h | 104 ++++++++++++++ boards.cfg | 1 + include/configs/mini2440.h | 215++++++++++++++++++++++++++++ 6 files changed, 580 insertions(+)
create mode 100644 board/friendlyarm/mini2440/Makefile create mode 100644 board/friendlyarm/mini2440/lowlevel_init.S create mode 100644 board/friendlyarm/mini2440/mini2440.c create mode 100644 board/friendlyarm/mini2440/mini2440.h create mode 100644 include/configs/mini2440.h(quoted diff) +0
-0b/board/friendlyarm/mini2440/Makefile new file mode 100644 index 0000000..e8d68cb
board/friendlyarm/mini2440/Makefile new file +30
-0@@ -0,0 +1,45 @@ +# +# (C) Copyright 2012 +# Wolfgang Denk, DENX Software Engineering, wd 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 +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS := mini2440.o +SOBJS := lowlevel_init.o +Quoted 8 lines
Quoted 8 lines
board/friendlyarm/mini2440/Makefile line 37
Quoted 8 lines
board/friendlyarm/mini2440/Makefile new file +7
-0+SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) +SOBJS := $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(obj).depend $(OBJS) $(SOBJS) + $(call cmd_link_o_target, $(OBJS) $(SOBJS)) ++######################################################################
Quoted 7 lines
Quoted 7 lines
board/friendlyarm/mini2440/Makefile line 44
Quoted 7 lines
### +
board/friendlyarm/mini2440/Makefile new file +5
-0+# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend ++######################################################################
Quoted 10 lines
Quoted 10 lines
board/friendlyarm/mini2440/lowlevel_init.S line 4
Quoted 10 lines
### diff --git
a/board/friendlyarm/mini2440/lowlevel_init.Sb/board/friendlyarm/mini2440/lowlevel_init.Snew file mode 100644 index 0000000..f69a08cboard/friendlyarm/mini2440/lowlevel_init.S new file +4
-0@@ -0,0 +1,76 @@ +/* + * Memory Setup stuff - taken from blob memsetup.S + * + * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw at its.tudelft.nl)
Quoted 52 lines
Quoted 52 lines
Quoted 52 lines
and + * Jan-Derk Bakker
(J.D.Bakker at its.tudelft.nl) + *
+ * Modified for the Samsung SMDK2410 by
+ * (C) Copyright 2002
+ * David Mueller, ELSOFT AG, <[email protected]>
+ *
+ * (C) Copyright 2012
+ * Gabriel Huau <[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
+ */board/friendlyarm/mini2440/lowlevel_init.S new file +25
-0+ +#include <config.h> +#include <version.h> +#include "mini2440.h" + +_TEXT_BASE: + .word CONFIG_SYS_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 */Quoted 8 lines
Quoted 8 lines
board/friendlyarm/mini2440/lowlevel_init.S
Quoted 8 lines
+ mov pc, lr
board/friendlyarm/mini2440/lowlevel_init.S new file +6
-0+ + .ltorg +/* the literal pools origin */ + +SMRDATA: + .word(0+(B1_BWSCON<<4)+(B2_BWSCON<<8)+(B3_BWSCON<<12)+(B4_BWSCON<<16)+(B5_BW
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
SCO N<<20)+(B6_BWSCON<<24)+(B7_BWSCON<<28)) + .word
((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+(B0_
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Tac p<<2)+(B0_PMC)) + .word
((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+(B1_
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Tac p<<2)+(B1_PMC)) + .word
((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Tac p<<2)+(B2_PMC)) + .word
((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+(B3_Tah<<4)+(B3_
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Tac p<<2)+(B3_PMC)) + .word
((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+(B4_Tah<<4)+(B4_
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Tac p<<2)+(B4_PMC)) + .word
((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+(B5_Tah<<4)+(B5_
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Tac p<<2)+(B5_PMC)) +
board/friendlyarm/mini2440/lowlevel_init.S new file +3
-0+ .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
0x32board/friendlyarm/mini2440/lowlevel_init.S new file +2
-0+ .word 0x30 + .word 0x30Quoted 3 lines
Quoted 1 line
What this undocumented stuff?
SoC specific, I pasted it from smdk2410, it's for initialize the DRAM.
Can't you init DRAM in some more fitting place? Also document this?
Quoted 61 lines
Quoted 61 lines
Quoted 61 lines
(quoted diff) +0
-0
b/board/friendlyarm/mini2440/mini2440.cnew file mode 100644 index 0000000..9ba8d39board/friendlyarm/mini2440/mini2440.c new file +55
-0@@ -0,0 +1,139 @@ +/* +* (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 2009 +* Michel Pollet <[email protected]> +* +* (C) Copyright 2012 +* Gabriel Huau <[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 <asm/arch/s3c2440.h> +#include <asm/io.h> +#include <video_fb.h> +#include "mini2440.h" + +#ifdef CONFIG_DRIVER_DM9000 +#include <netdev.h> +#endif + +DECLARE_GLOBAL_DATA_PTR ; + +static inline void pll_delay (unsigned long loops) +{ + __asm__volatile ("1:\n" +"subs %0, %1, #1\n" +"bne 1b" :"=r" (loops) :"0" (loops)); +} + +int arch_cpu_init (void ) +{ + struct s3c24x0_clock_power * const clk_power =Quoted 8 lines
Quoted 8 lines
board/friendlyarm/mini2440/mini2440.c
Quoted 8 lines
board/friendlyarm/mini2440/mini2440.c new file +8
-0+s3c24x0_get_base_clock_power (); + +/* to reduce PLL lock time, adjust the LOCKTIME register */ + clk_power->locktime =0xFFFFFF ; + clk_power->clkdivn =CLKDIVN_VAL ; + +/* configure UPLL */ + clk_power->upllcon = ((U_M_MDIV << 12) + (U_M_PDIV << 4) +
U_M_SDIV);Quoted 11 lines
Quoted 10 lines
board/friendlyarm/mini2440/mini2440.c line 71
Quoted 8 lines
board/friendlyarm/mini2440/mini2440.c new file +8
-0+/* some delay between MPLL and UPLL */ +pll_delay (100000 ); + +/* configure MPLL */ + clk_power->mpllcon = ((M_MDIV <<12 ) + (M_PDIV <<4 ) +M_SDIV ); + +/* some delay between MPLL and UPLL */ +pll_delay (500000 );You use
udelay()below, do you needpll_delay()at all?
Quoted 5 lines
Quoted 2 lines
Yes, because initialisation of PLL is done before
timer_init(), so we can't useudelay().Maybe fix the timer driver?
How fix timer driver if arch_cpu_init(void) call befor timer_init in \arch\arm\lib\board.c:227 init_fnc_t *init_sequence[] = {
Quoted 461 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
board/friendlyarm/mini2440/mini2440.c new file +11
-0+ +return 0 ; +} + +/* +* Miscellaneous platform dependent initialisations +*/ +int board_init (void ) +{ +struct s3c24x0_clock_power *const clk_power = +s3c24x0_get_base_clock_power ();Quoted 8 lines
Quoted 8 lines
board/friendlyarm/mini2440/mini2440.c
Quoted 8 lines
board/friendlyarm/mini2440/mini2440.c new file +8
-0+struct s3c24x0_gpio *const gpio =s3c24x0_get_base_gpio (); + +/* to reduce PLL lock time, adjust the LOCKTIME register */ + clk_power->locktime =0xFFFFFF ; + clk_power->clkdivn =CLKDIVN_VAL ; + +/* configure UPLL */ + clk_power->upllcon = ((U_M_MDIV << 12) + (U_M_PDIV << 4) +
U_M_SDIV);Quoted 146 lines
Quoted 146 lines
Quoted 146 lines
board/friendlyarm/mini2440/mini2440.c new file +47
-0+/* some delay between MPLL and UPLL */ +udelay (10 ); +/* configure MPLL */ + clk_power->mpllcon = ((M_MDIV <<12 ) + (M_PDIV <<4 ) +M_SDIV ); + +/* some delay between MPLL and UPLL */ +udelay (8000 ); + +/* set up the I/O ports */ +writel (0x007FFFFF , &gpio->gpacon); +writel (0x00044555 , &gpio->gpbcon); +writel (0x000007FF , &gpio->gpbup); +writel (0xAAAAAAAA , &gpio->gpccon); +writel (0x0000FFFF , &gpio->gpcup); +writel (0xAAAAAAAA , &gpio->gpdcon); +writel (0x0000FFFF , &gpio->gpdup); +writel (0xAAAAAAAA , &gpio->gpecon); +writel (0x0000FFFF , &gpio->gpeup); +writel (0x000055AA , &gpio->gpfcon); +writel (0x000000FF , &gpio->gpfup); +writel (0xFF95FFBA , &gpio->gpgcon); +writel (0x0000FFFF , &gpio->gpgup); +writel (0x002AFAAA , &gpio->gphcon); +writel (0x000007FF , &gpio->gphup); + +/* adress of boot parameters */ + gd->bd->bi_boot_params =CONFIG_BOOT_PARAM_ADDR ; + +return 0 ; +} + +int dram_init (void ) +{ + gd->ram_size =PHYS_SDRAM_1_SIZE ; +return 0 ; +} + +int board_eth_init (bd_t *bis) +{ +#ifdef CONFIG_DRIVER_DM9000 +return dm9000_initialize (bis); +#else +return 0 ; +#endif +} + +/* The sum of all part_size[]s must equal to the NAND size, i.e.,
0x4000000*/ +unsigned int dynpart_size[] = {0x40000,0x20000,0x500000,0xffffffff, 0 }; +char *dynpart_names[] = { "u-boot", "u-boot_env", "kernel", "rootfs", NULL }; diff --gita/board/friendlyarm/mini2440/mini2440.hb/board/friendlyarm/mini2440/mini2440.hnew file mode 100644 index 0000000..02197c8board/friendlyarm/mini2440/mini2440.h new file +3
-0@@ -0,0 +1,104 @@ +/* +* Taken from linux/arch/arm/boot/compressed/head-s3c2410.S +* Copyright (C) 2002 Samsung Electronics SW.LEE <[email protected]> + */
board/friendlyarm/mini2440/mini2440.h new file +86
-0+ +#ifndef BOARD_LL_MINI2440_H +#define BOARD_LL_MINI2440_H + +/* +* PLL/Clock configuration +*/ +/* FCLK = 405 MHz, HCLK = 101 MHz, PCLK = 50 MHz, UCLK = 48 MHz */ +#define CLKDIVN_VAL 7 +#define M_MDIV 0x7f +#define M_PDIV 0x2 +#define M_SDIV 0x1 + +#define U_M_MDIV 0x38 +#define U_M_PDIV 0x2 +#define U_M_SDIV 0x2 + +/* BWSCON */ +#define BWSCON 0x48000000 +#define DW8 (0x0) +#define DW16 (0x1) +#define DW32 (0x2) +#define WAIT (0x1<<2) +#define UBLB (0x1<<3) + +#define B1_BWSCON (DW32) +#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) + +/* BANK0CON */ +#define B0_Tacs 0x0/* 0clk */ +#define B0_Tcos 0x0/* 0clk */ +#define B0_Tacc 0x7/* 14clk */ +#define B0_Tcoh 0x0/* 0clk */ +#define B0_Tah 0x0/* 0clk */ +#define B0_Tacp 0x0 +#define B0_PMC 0x0/* normal */ + +/* BANK1CON */ +#define B1_Tacs 0x0/* 0clk */ +#define B1_Tcos 0x0/* 0clk */ +#define B1_Tacc 0x7/* 14clk */ +#define B1_Tcoh 0x0/* 0clk */ +#define B1_Tah 0x0/* 0clk */ +#define B1_Tacp 0x0 +#define B1_PMC 0x0 + +#define B2_Tacs 0x0 +#define B2_Tcos 0x0 +#define B2_Tacc 0x7 +#define B2_Tcoh 0x0 +#define B2_Tah 0x0 +#define B2_Tacp 0x0 +#define B2_PMC 0x0 + +#define B3_Tacs 0x0/* 0clk */ +#define B3_Tcos 0x3/* 4clk */ +#define B3_Tacc 0x7/* 14clk */ +#define B3_Tcoh 0x1/* 1clk */ +#define B3_Tah 0x0/* 0clk */ +#define B3_Tacp 0x3/* 6clk */ +#define B3_PMC 0x0/* normal */ + +#define B4_Tacs 0x0/* 0clk */ +#define B4_Tcos 0x0/* 0clk */ +#define B4_Tacc 0x7/* 14clk */ +#define B4_Tcoh 0x0/* 0clk */ +#define B4_Tah 0x0/* 0clk */ +#define B4_Tacp 0x0 +#define B4_PMC 0x0/* normal */ + +#define B5_Tacs 0x0/* 0clk */ +#define B5_Tcos 0x0/* 0clk */ +#define B5_Tacc 0x7/* 14clk */ +#define B5_Tcoh 0x0/* 0clk */ +#define B5_Tah 0x0/* 0clk */ +#define B5_Tacp 0x0 +#define B5_PMC 0x0/* normal */ + +#define B6_MT 0x3/* SDRAM */ +#define B6_Trcd 0x1 +#define B6_SCAN 0x1/* 9bit */ Quoted 8 lines
Quoted 8 lines
board/friendlyarm/mini2440/mini2440.h
Quoted 8 lines
board/friendlyarm/mini2440/mini2440.h new file +8
-0+ +#define B7_MT 0x3/* SDRAM */ +#define B7_Trcd 0x1/* 3clk */ +#define B7_SCAN 0x1/* 9bit */ + +/* REFRESH parameter */ +#define REFEN 0x1/* Refresh enable */ +#define TREFMD 0x0/* CBR(CAS before RAS)/Auto refresh */
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
board/friendlyarm/mini2440/mini2440.h new file +6
-0+#define Trp 0x0/* 2clk */ +#define Trc 0x3/* 7clk */ +#define Tchr 0x2/* 3clk */ +#define REFCNT 1113/* period=15.6us, HCLK=60Mhz */ + +#endif boards.cfg +0
-1@@ -61,6 +61,7 @@ mx1ads arm arm920t -Quoted 1 line
Quoted 1 line
boards.cfg mx1ads arm arm920t · line 62
Quoted 1 line
boards.cfg +0
-0- scb9328 arm arm920t-
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
boards.cfg +0
-0- imx cm4008 armarm920t - - ks8695 cm41xx
arm arm920t - -
ks8695+mini2440 arm arm920t mini2440
friendlyarm s3c24x0 VCMA9 armarm920t
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
vcma9 mpl s3c24x0 smdk2410
arm arm920t - samsung s3c24x0
omap1510inn arm arm925t -
ti diff --gita/include/configs/mini2440.h
b/include/configs/mini2440.hQuoted 51 lines
Quoted 51 lines
Quoted 38 lines
new file mode 100644
index 0000000..a3f06d0include/configs/mini2440.h new file +33
-0@@ -0,0 +1,215 @@ +/* +* (C) Copyright 2002 +* Sysgo Real-Time Solutions, GmbH <www.elinos.com> +* Marius Groeger <[email protected]> +* Gary Jennejohn <[email protected]> +* David Mueller <[email protected]> +* +* (C) Copyright 2009-2010 +* Michel Pollet <[email protected]> +* +* (C) Copyright 2012 +* Gabriel Huau <[email protected]> +* +* Configuation settings for the MINI2440 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 +*/ include/configs/mini2440.h line 43
Quoted 10 lines
include/configs/mini2440.h new file +10
-0+ +#ifndef __CONFIG_H +#define __CONFIG_H + +#define CONFIG_SYS_TEXT_BASE 0x0 + +/* +* High Level Configuration Options +*/ +#define CONFIG_ARM920T 1/* This is an ARM920T Core */
Quoted 1 line
Quoted 1 line
include/configs/mini2440.h line 44
Quoted 1 line
include/configs/mini2440.h new file +1
-0+#define CONFIG_S3C24X0 1/* in a SAMSUNG S3C2440 SoC */
Quoted 1 line
Quoted 1 line
include/configs/mini2440.h line 45
Quoted 1 line
include/configs/mini2440.h new file +1
-0+#define CONFIG_S3C2440 1/* in a SAMSUNG S3C2440 SoC */
Quoted 1 line
Quoted 1 line
include/configs/mini2440.h line 46
Quoted 1 line
include/configs/mini2440.h new file +1
-0+#define CONFIG_MINI2440 1/* on a MIN2440 Board */
Quoted 71 lines
Quoted 71 lines
Quoted 58 lines
include/configs/mini2440.h new file +6
-0+ +#define MACH_TYPE_MINI2440 1999 +#define CONFIG_MACH_TYPE MACH_TYPE_MINI2440 + +/* +* It is possible to have u-boot save it's environment in NOR, however, + * reember it is incompatible with booting from NAND as the NOR is not + * available at that point. So use this only if you use nand as storage + * and will never boot from it
+ */include/configs/mini2440.h new file +48
-0+#define CONFIG_MINI2440_NOR_ENV 1 +/* allow use of frequencies over 405Mhz */ +#define CONFIG_MINI2440_OVERCLOCK 1 + +/* +* input clock of PLL +*/ +/* MINI2440 has 12.0000MHz input clock */ +#define CONFIG_SYS_CLK_FREQ 12000000 +#define CONFIG_ARCH_CPU_INIT 1/* for the initialization of PLL */ + +#define USE_920T_MMU 1 +#define CONFIG_BAUDRATE 115200 + +/* +* Size of malloc() pool +*/ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2048*1024) +/* size in bytes reserved for initial data */ +#define CONFIG_GBL_DATA_SIZE 128 + +/* +* Hardware drivers +*/ +#define CONFIG_DRIVER_DM9000 1 +#define CONFIG_DRIVER_DM9000_NO_EEPROM 1 +#define CONFIG_DM9000_BASE 0x20000300 +#define DM9000_IO CONFIG_DM9000_BASE +#define DM9000_DATA (CONFIG_DM9000_BASE+4) + +/* +* select serial console configuration +*/ +#define CONFIG_S3C24X0_SERIAL +#define CONFIG_SERIAL1 1 + +/* +* allow to overwrite serial and ethaddr +*/ +#define CONFIG_ENV_OVERWRITE + +/* +* Command definition +*/ +#include <config_cmd_default.h> + +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_PORTIO include/configs/mini2440.h
Quoted 10 lines
include/configs/mini2440.h new file +10
-0+#define CONFIG_CMD_REGINFO +#define CONFIG_CMD_SAVES + +/* +* Miscellaneous configurable options +*/ +#define CONFIG_LONGHELP +#define CONFIG_SYS_PROMPT "MINI2440 => " +#define CONFIG_SYS_CBSIZE 256 +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
Quoted 5 lines
Quoted 5 lines
include/configs/mini2440.h
Quoted 5 lines
include/configs/mini2440.h new file +5
-0+#define CONFIG_SYS_MAXARGS 32 +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE + +#define CONFIG_SYS_MEMTEST_START 0x30000000 +#define CONFIG_SYS_MEMTEST_END 0x34000000/* 64MB in DRAM
Quoted 15 lines
Quoted 15 lines
*/
Quoted 12 lines
include/configs/mini2440.h new file +12
-0+ +/* everything, incl board info, in Hz */ +#undef CONFIG_CLKS_IN_HZ + +/* default load address */ +#define CONFIG_SYS_LOAD_ADDR 0x32000000 + +/* boot parameters address */ +#define CONFIG_BOOT_PARAM_ADDR 0x30000100 + +/* +* the PWM TImer 4 uses a counter of 15625 for 10 ms, so we need Quoted 8 lines
Quoted 8 lines
include/configs/mini2440.h
Quoted 8 lines
+ * it to wrap 100 times (total 1562500) to get 1 sec.
+ */include/configs/mini2440.h new file +6
-0+#define CONFIG_SYS_HZ 1562500 + +/* +* valid baudrates +*/ +#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400,57600,
115200Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
} +
include/configs/mini2440.h new file +10
-0+/* +* Stack sizes +* The stack sizes are set up in start.S using the settings below +*/ +#define CONFIG_STACKSIZE (128*1024)/* regular stack */ +#ifdef CONFIG_USE_IRQ +#define CONFIG_STACKSIZE_IRQ (8*1024)/* IRQ stack */ +#define CONFIG_STACKSIZE_FIQ (4*1024)/* FIQ stack */ +#endif +Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
include/configs/mini2440.h new file +4
-0+/* +* Physical Memory Map +*/ +#define CONFIG_NR_DRAM_BANKS 1/* we have 1 bank of DRAM */ +#define
PHYS_SDRAM_10x30000000/* SDRAM Bank
#1 */ +#definePHYS_SDRAM_1_SIZE(64*1024*1024) /* 64MB of
DRAM */ +#defineCONFIG_SYS_SDRAM_BASEPHYS_SDRAM_1
+#defineCONFIG_SYS_INIT_SP_ADDR(CONFIG_SYS_SDRAM_BASE+
0x1000Quoted 4 lines
Quoted 4 lines
- \
Quoted 1 line
+
GENERATED_GBL_DATA_SIZE)Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
include/configs/mini2440.h new file +3
-0+ +/* +* When booting from NAND, it is impossible to access the lowest addresses + * due to the SteppingStone being in the way. Luckily the NOR doesn't really + * care about the highest 16 bits of address, so we set the controlers + * registers to go and poke over there, instead.
+ */include/configs/mini2440.h new file +15
-0+#define PHYS_FLASH_1 0x0 +#define CONFIG_SYS_FLASH_BASE 0x0 + +/* +* NOR FLASH organization +* Now uses the standard CFI interface +* FLASH and environment organization +*/ +#define CONFIG_SYS_FLASH_CFI 1 +#define CONFIG_FLASH_CFI_DRIVER 1 +#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT +#define CONFIG_SYS_MONITOR_BASE 0x0 +/* max number of memory banks */ +#define CONFIG_SYS_MAX_FLASH_BANKS 1 +/* 512 * 4096 sectors, or 32 * 64k blocks */ Quoted 8 lines
Quoted 8 lines
include/configs/mini2440.h
Quoted 8 lines
include/configs/mini2440.h new file +8
-0+#define CONFIG_SYS_MAX_FLASH_SECT 512 +#define CONFIG_FLASH_SHOW_PROGRESS 1 + +/* +* u-boot environmnent +*/ +#define CONFIG_BOOTDELAY 3 +#define CONFIG_BOOTARGS "root=/dev/sdb1console=ttySAC0,115200"
Quoted 10 lines
Quoted 7 lines
include/configs/mini2440.h line 194
Quoted 5 lines
include/configs/mini2440.h new file +5
-0+#define CONFIG_NETMASK 255.255.255.0 +#define CONFIG_IPADDR 192.168.0.2 +#define CONFIG_SERVERIP 192.168.0.1 +#define CONFIG_DOS_PARTITION 1 +#define CONFIG_BOOTCOMMAND "tftp 0x32000000 uImage;bootm"DROP THIS!
ok :-)
Quoted 8 lines
Quoted 8 lines
include/configs/mini2440.h
Quoted 8 lines
include/configs/mini2440.h new file +8
-0+ +/* +* Config for NOR flash +*/ +#define CONFIG_ENV_IS_IN_FLASH 1 +#define CONFIG_MY_ENV_OFFSET 0x40000 +/* addr of environment */ +#define CONFIG_ENV_ADDR (PHYS_FLASH_1 +
CONFIG_MY_ENV_OFFSET)Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
include/configs/mini2440.h new file +5
-0+/* 16k Total Size of Environment Sector */ +#define CONFIG_ENV_SIZE 0x4000 + +#define CONFIG_PREBOOT_OVERRIDE 1 +Quoted 8 lines
Quoted 8 lines
include/configs/mini2440.h line 215
Quoted 8 lines
include/configs/mini2440.h new file +8
-0+/* ATAG configuration */ +#define CONFIG_INITRD_TAG 1 +#define CONFIG_SETUP_MEMORY_TAGS 1 +#define CONFIG_CMDLINE_TAG 1 +#define CONFIG_CMDLINE_EDITING 1 +#define CONFIG_AUTO_COMPLETE 1 + +#endif /* __CONFIG_H */ _______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Dear Ilya Averyanov,
Quoted 294 lines
2012/4/20 Marek Vasut <[email protected]>
Quoted 292 lines
Dear Gabriel Huau,
Quoted 73 lines · Marek Vasut
Quoted 72 lines
Dear Gabriel Huau,
Quoted 70 lines
---
Changes for v2:
- Coding style cleanup
- Remove unnecessary files modification
- Remove unnecessary board configuration setChanges for v3:
- Coding style cleanup
- Move some macro definition fromlowlevel_init.Sto a new header
- Remove some "magic bloat" with I/O board initialization
- Add apll_delayand replace loop by it
- Somme cleanup in the configuration file
- Cancel modifications on an SoC specific header
- Add my name to copyright---
board/friendlyarm/mini2440/Makefile | 45 ++++++ board/friendlyarm/mini2440/lowlevel_init.S | 76 ++++++++++ board/friendlyarm/mini2440/mini2440.c | 139 ++++++++++++++++++ board/friendlyarm/mini2440/mini2440.h | 104 ++++++++++++++ boards.cfg | 1 + include/configs/mini2440.h | 215++++++++++++++++++++++++++++ 6 files changed, 580 insertions(+)
create mode 100644 board/friendlyarm/mini2440/Makefile create mode 100644 board/friendlyarm/mini2440/lowlevel_init.S create mode 100644 board/friendlyarm/mini2440/mini2440.c create mode 100644 board/friendlyarm/mini2440/mini2440.h create mode 100644 include/configs/mini2440.h(quoted diff) +0
-0b/board/friendlyarm/mini2440/Makefile new file mode 100644 index 0000000..e8d68cb
board/friendlyarm/mini2440/Makefile new file +18
-0@@ -0,0 +1,45 @@ +# +# (C) Copyright 2012 +# Wolfgang Denk, DENX Software Engineering, wd 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 PublicLicense +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
board/friendlyarm/mini2440/Makefile new file +9
-0+# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).o + +COBJS := mini2440.o +SOBJS := lowlevel_init.oQuoted 8 lines
Quoted 8 lines
board/friendlyarm/mini2440/Makefile line 37
Quoted 8 lines
board/friendlyarm/mini2440/Makefile new file +8
-0+ +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) +SOBJS := $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(obj).depend $(OBJS) $(SOBJS) + $(call cmd_link_o_target, $(OBJS) $(SOBJS)) ++######################################################################
Quoted 6 lines
Quoted 6 lines
board/friendlyarm/mini2440/Makefile line 44
Quoted 6 lines
### +
board/friendlyarm/mini2440/Makefile new file +5
-0+# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend ++######################################################################
Quoted 10 lines
Quoted 10 lines
board/friendlyarm/mini2440/lowlevel_init.S line 4
Quoted 10 lines
### diff --git
a/board/friendlyarm/mini2440/lowlevel_init.Sb/board/friendlyarm/mini2440/lowlevel_init.Snew file mode 100644 index 0000000..f69a08cboard/friendlyarm/mini2440/lowlevel_init.S new file +4
-0@@ -0,0 +1,76 @@ +/* + * Memory Setup stuff - taken from blob memsetup.S + * + * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw at its.tudelft.nl)
Quoted 51 lines
Quoted 51 lines
Quoted 51 lines
and + * Jan-Derk Bakker
(J.D.Bakker at its.tudelft.nl) + *
+ * Modified for the Samsung SMDK2410 by
+ * (C) Copyright 2002
+ * David Mueller, ELSOFT AG, <[email protected]>
+ *
+ * (C) Copyright 2012
+ * Gabriel Huau <[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
+ */board/friendlyarm/mini2440/lowlevel_init.S new file +24
-0+ +#include <config.h> +#include <version.h> +#include "mini2440.h" + +_TEXT_BASE: + .word CONFIG_SYS_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 +Quoted 8 lines
Quoted 8 lines
board/friendlyarm/mini2440/lowlevel_init.S
Quoted 8 lines
+ /* everything is fine now */
+ mov pc, lrboard/friendlyarm/mini2440/lowlevel_init.S new file +6
-0+ + .ltorg +/* the literal pools origin */ + +SMRDATA: + .word(0+(B1_BWSCON<<4)+(B2_BWSCON<<8)+(B3_BWSCON<<12)+(B4_BWSCON<<16)+(B5_BW
Quoted 1 line
Quoted 1 line
Quoted 1 line
SCO N<<20)+(B6_BWSCON<<24)+(B7_BWSCON<<28)) + .word
((B0_Tacs<<13)+(B0_Tcos<<11)+(B0_Tacc<<8)+(B0_Tcoh<<6)+(B0_Tah<<4)+(B0_
Quoted 1 line
Quoted 1 line
Quoted 1 line
Tac p<<2)+(B0_PMC)) + .word
((B1_Tacs<<13)+(B1_Tcos<<11)+(B1_Tacc<<8)+(B1_Tcoh<<6)+(B1_Tah<<4)+(B1_
Quoted 1 line
Quoted 1 line
Quoted 1 line
Tac p<<2)+(B1_PMC)) + .word
((B2_Tacs<<13)+(B2_Tcos<<11)+(B2_Tacc<<8)+(B2_Tcoh<<6)+(B2_Tah<<4)+(B2_
Quoted 1 line
Quoted 1 line
Quoted 1 line
Tac p<<2)+(B2_PMC)) + .word
((B3_Tacs<<13)+(B3_Tcos<<11)+(B3_Tacc<<8)+(B3_Tcoh<<6)+(B3_Tah<<4)+(B3_
Quoted 1 line
Quoted 1 line
Quoted 1 line
Tac p<<2)+(B3_PMC)) + .word
((B4_Tacs<<13)+(B4_Tcos<<11)+(B4_Tacc<<8)+(B4_Tcoh<<6)+(B4_Tah<<4)+(B4_
Quoted 1 line
Quoted 1 line
Quoted 1 line
Tac p<<2)+(B4_PMC)) + .word
((B5_Tacs<<13)+(B5_Tcos<<11)+(B5_Tacc<<8)+(B5_Tcoh<<6)+(B5_Tah<<4)+(B5_
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Tac p<<2)+(B5_PMC)) +
board/friendlyarm/mini2440/lowlevel_init.S new file +3
-0+ .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
0x32board/friendlyarm/mini2440/lowlevel_init.S new file +2
-0+ .word 0x30 + .word 0x30Quoted 3 lines
Quoted 1 line
What this undocumented stuff?
SoC specific, I pasted it from smdk2410, it's for initialize the DRAM.
Can't you init DRAM in some more fitting place? Also document this?
Quoted 61 lines
Quoted 61 lines
Quoted 61 lines
(quoted diff) +0
-0
b/board/friendlyarm/mini2440/mini2440.cnew file mode 100644 index 0000000..9ba8d39board/friendlyarm/mini2440/mini2440.c new file +28
-0@@ -0,0 +1,139 @@ +/* +* (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 2009 +* Michel Pollet <[email protected]> +* +* (C) Copyright 2012 +* Gabriel Huau <[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
+ */board/friendlyarm/mini2440/mini2440.c new file +23
-0+ +#include <common.h> +#include <asm/arch/s3c2440.h> +#include <asm/io.h> +#include <video_fb.h> +#include "mini2440.h" + +#ifdef CONFIG_DRIVER_DM9000 +#include <netdev.h> +#endif + +DECLARE_GLOBAL_DATA_PTR ; + +static inline void pll_delay (unsigned long loops) +{ + __asm__volatile ("1:\n" +"subs %0, %1, #1\n" +"bne 1b" :"=r" (loops) :"0" (loops)); +} + +int arch_cpu_init (void ) +{ + struct s3c24x0_clock_power * const clk_power =Quoted 8 lines
Quoted 8 lines
board/friendlyarm/mini2440/mini2440.c
Quoted 8 lines
board/friendlyarm/mini2440/mini2440.c new file +8
-0+s3c24x0_get_base_clock_power (); + +/* to reduce PLL lock time, adjust the LOCKTIME register */ + clk_power->locktime =0xFFFFFF ; + clk_power->clkdivn =CLKDIVN_VAL ; + +/* configure UPLL */ + clk_power->upllcon = ((U_M_MDIV << 12) + (U_M_PDIV << 4) +
U_M_SDIV);Quoted 11 lines
Quoted 10 lines
board/friendlyarm/mini2440/mini2440.c line 71
Quoted 8 lines
+ /* some delay between MPLL and UPLL */
+pll_delay(100000);board/friendlyarm/mini2440/mini2440.c new file +6
-0+ +/* configure MPLL */ + clk_power->mpllcon = ((M_MDIV <<12 ) + (M_PDIV <<4 ) +M_SDIV ); + +/* some delay between MPLL and UPLL */ +pll_delay (500000 );You use
udelay()below, do you needpll_delay()at all?
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Yes, because initialisation of PLL is done before
timer_init(), so we can't useudelay().Maybe fix the timer driver?
How fix timer driver if
arch_cpu_init(void)call befortimer_initin \arch\arm\lib\board.c:227init_fnc_t*init_sequence[] = {
Where did you get such a weird path? \arch\arm... ?
btw you can always check some bit, if the timer is enabled, behave one way, otherwise, behave other way.
Quoted 488 lines
Quoted 488 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
board/friendlyarm/mini2440/mini2440.c new file +11
-0+ +return 0 ; +} + +/* +* Miscellaneous platform dependent initialisations +*/ +int board_init (void ) +{ +struct s3c24x0_clock_power *const clk_power = +s3c24x0_get_base_clock_power ();Quoted 8 lines
Quoted 8 lines
board/friendlyarm/mini2440/mini2440.c
Quoted 8 lines
+ struct
s3c24x0_gpio* const gpio =s3c24x0_get_base_gpio();board/friendlyarm/mini2440/mini2440.c new file +7
-0+ +/* to reduce PLL lock time, adjust the LOCKTIME register */ + clk_power->locktime =0xFFFFFF ; + clk_power->clkdivn =CLKDIVN_VAL ; + +/* configure UPLL */ + clk_power->upllcon = ((U_M_MDIV << 12) + (U_M_PDIV << 4) +
U_M_SDIV);Quoted 146 lines
Quoted 146 lines
Quoted 146 lines
+ /* some delay between MPLL and UPLL */
+ udelay(10);
+ /* configure MPLL */
+clk_power->mpllcon= ((M_MDIV<< 12) + (M_PDIV<< 4) +M_SDIV);board/friendlyarm/mini2440/mini2440.c new file +43
-0+ +/* some delay between MPLL and UPLL */ +udelay (8000 ); + +/* set up the I/O ports */ +writel (0x007FFFFF , &gpio->gpacon); +writel (0x00044555 , &gpio->gpbcon); +writel (0x000007FF , &gpio->gpbup); +writel (0xAAAAAAAA , &gpio->gpccon); +writel (0x0000FFFF , &gpio->gpcup); +writel (0xAAAAAAAA , &gpio->gpdcon); +writel (0x0000FFFF , &gpio->gpdup); +writel (0xAAAAAAAA , &gpio->gpecon); +writel (0x0000FFFF , &gpio->gpeup); +writel (0x000055AA , &gpio->gpfcon); +writel (0x000000FF , &gpio->gpfup); +writel (0xFF95FFBA , &gpio->gpgcon); +writel (0x0000FFFF , &gpio->gpgup); +writel (0x002AFAAA , &gpio->gphcon); +writel (0x000007FF , &gpio->gphup); + +/* adress of boot parameters */ + gd->bd->bi_boot_params =CONFIG_BOOT_PARAM_ADDR ; + +return 0 ; +} + +int dram_init (void ) +{ + gd->ram_size =PHYS_SDRAM_1_SIZE ; +return 0 ; +} + +int board_eth_init (bd_t *bis) +{ +#ifdef CONFIG_DRIVER_DM9000 +return dm9000_initialize (bis); +#else +return 0 ; +#endif +} + +/* The sum of all part_size[]s must equal to the NAND size, i.e.,
0x4000000*/ +unsigned int dynpart_size[] = {0x40000,0x20000,0x500000,0xffffffff, 0 }; +char *dynpart_names[] = { "u-boot", "u-boot_env", "kernel", "rootfs", NULL }; diff --gita/board/friendlyarm/mini2440/mini2440.hb/board/friendlyarm/mini2440/mini2440.hnew file mode 100644 index 0000000..02197c8board/friendlyarm/mini2440/mini2440.h new file +3
-0@@ -0,0 +1,104 @@ +/* +* Taken from linux/arch/arm/boot/compressed/head-s3c2410.S +* Copyright (C) 2002 Samsung Electronics SW.LEE <[email protected]> + */
board/friendlyarm/mini2440/mini2440.h new file +86
-0+ +#ifndef BOARD_LL_MINI2440_H +#define BOARD_LL_MINI2440_H + +/* +* PLL/Clock configuration +*/ +/* FCLK = 405 MHz, HCLK = 101 MHz, PCLK = 50 MHz, UCLK = 48 MHz */ +#define CLKDIVN_VAL 7 +#define M_MDIV 0x7f +#define M_PDIV 0x2 +#define M_SDIV 0x1 + +#define U_M_MDIV 0x38 +#define U_M_PDIV 0x2 +#define U_M_SDIV 0x2 + +/* BWSCON */ +#define BWSCON 0x48000000 +#define DW8 (0x0) +#define DW16 (0x1) +#define DW32 (0x2) +#define WAIT (0x1<<2) +#define UBLB (0x1<<3) + +#define B1_BWSCON (DW32) +#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) + +/* BANK0CON */ +#define B0_Tacs 0x0/* 0clk */ +#define B0_Tcos 0x0/* 0clk */ +#define B0_Tacc 0x7/* 14clk */ +#define B0_Tcoh 0x0/* 0clk */ +#define B0_Tah 0x0/* 0clk */ +#define B0_Tacp 0x0 +#define B0_PMC 0x0/* normal */ + +/* BANK1CON */ +#define B1_Tacs 0x0/* 0clk */ +#define B1_Tcos 0x0/* 0clk */ +#define B1_Tacc 0x7/* 14clk */ +#define B1_Tcoh 0x0/* 0clk */ +#define B1_Tah 0x0/* 0clk */ +#define B1_Tacp 0x0 +#define B1_PMC 0x0 + +#define B2_Tacs 0x0 +#define B2_Tcos 0x0 +#define B2_Tacc 0x7 +#define B2_Tcoh 0x0 +#define B2_Tah 0x0 +#define B2_Tacp 0x0 +#define B2_PMC 0x0 + +#define B3_Tacs 0x0/* 0clk */ +#define B3_Tcos 0x3/* 4clk */ +#define B3_Tacc 0x7/* 14clk */ +#define B3_Tcoh 0x1/* 1clk */ +#define B3_Tah 0x0/* 0clk */ +#define B3_Tacp 0x3/* 6clk */ +#define B3_PMC 0x0/* normal */ + +#define B4_Tacs 0x0/* 0clk */ +#define B4_Tcos 0x0/* 0clk */ +#define B4_Tacc 0x7/* 14clk */ +#define B4_Tcoh 0x0/* 0clk */ +#define B4_Tah 0x0/* 0clk */ +#define B4_Tacp 0x0 +#define B4_PMC 0x0/* normal */ + +#define B5_Tacs 0x0/* 0clk */ +#define B5_Tcos 0x0/* 0clk */ +#define B5_Tacc 0x7/* 14clk */ +#define B5_Tcoh 0x0/* 0clk */ +#define B5_Tah 0x0/* 0clk */ +#define B5_Tacp 0x0 +#define B5_PMC 0x0/* normal */ + +#define B6_MT 0x3/* SDRAM */ +#define B6_Trcd 0x1 +#define B6_SCAN 0x1/* 9bit */ Quoted 8 lines
Quoted 8 lines
board/friendlyarm/mini2440/mini2440.h
Quoted 8 lines
board/friendlyarm/mini2440/mini2440.h new file +8
-0+ +#define B7_MT 0x3/* SDRAM */ +#define B7_Trcd 0x1/* 3clk */ +#define B7_SCAN 0x1/* 9bit */ + +/* REFRESH parameter */ +#define REFEN 0x1/* Refresh enable */ +#define TREFMD 0x0/* CBR(CAS before RAS)/Auto refresh */
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
board/friendlyarm/mini2440/mini2440.h new file +6
-0+#define Trp 0x0/* 2clk */ +#define Trc 0x3/* 7clk */ +#define Tchr 0x2/* 3clk */ +#define REFCNT 1113/* period=15.6us, HCLK=60Mhz */ + +#endif boards.cfg +0
-1@@ -61,6 +61,7 @@ mx1ads arm arm920t -Quoted 1 line
Quoted 1 line
boards.cfg mx1ads arm arm920t · line 62
Quoted 1 line
boards.cfg +0
-0- scb9328 arm arm920t-
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
boards.cfg +0
-0- imx cm4008 armarm920t - - ks8695 cm41xx
arm arm920t - -
ks8695+mini2440 arm arm920t mini2440
friendlyarm s3c24x0 VCMA9 armarm920t
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
vcma9 mpl s3c24x0 smdk2410
arm arm920t - samsung s3c24x0
omap1510inn arm arm925t -
ti diff --gita/include/configs/mini2440.h
b/include/configs/mini2440.hQuoted 52 lines
Quoted 52 lines
Quoted 48 lines
new file mode 100644
index 0000000..a3f06d0include/configs/mini2440.h new file +29
-0@@ -0,0 +1,215 @@ +/* +* (C) Copyright 2002 +* Sysgo Real-Time Solutions, GmbH <www.elinos.com> +* Marius Groeger <[email protected]> +* Gary Jennejohn <[email protected]> +* David Mueller <[email protected]> +* +* (C) Copyright 2009-2010 +* Michel Pollet <[email protected]> +* +* (C) Copyright 2012 +* Gabriel Huau <[email protected]> +* +* Configuation settings for the MINI2440 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
+ */include/configs/mini2440.h new file +10
-0+ +#ifndef __CONFIG_H +#define __CONFIG_H + +#define CONFIG_SYS_TEXT_BASE 0x0 + +/* +* High Level Configuration Options +*/ +#define CONFIG_ARM920T 1/* This is an ARM920T Quoted 1 line
Core
*/
Quoted 1 line
Quoted 1 line
Quoted 1 line
+#define
CONFIG_S3C24X01 /* in a SAMSUNG S3C2440SoC */
Quoted 1 line
Quoted 1 line
Quoted 1 line
+#define
CONFIG_S3C24401 /* in a SAMSUNG S3C2440SoC */
Quoted 1 line
Quoted 1 line
Quoted 1 line
+#define
CONFIG_MINI24401 /* on a MIN2440 Board*/
Quoted 71 lines
Quoted 71 lines
Quoted 58 lines
include/configs/mini2440.h new file +6
-0+ +#define MACH_TYPE_MINI2440 1999 +#define CONFIG_MACH_TYPE MACH_TYPE_MINI2440 + +/* +* It is possible to have u-boot save it's environment in NOR, however, + * reember it is incompatible with booting from NAND as the NOR is not + * available at that point. So use this only if you use nand as storage + * and will never boot from it
+ */include/configs/mini2440.h new file +27
-0+#define CONFIG_MINI2440_NOR_ENV 1 +/* allow use of frequencies over 405Mhz */ +#define CONFIG_MINI2440_OVERCLOCK 1 + +/* +* input clock of PLL +*/ +/* MINI2440 has 12.0000MHz input clock */ +#define CONFIG_SYS_CLK_FREQ 12000000 +#define CONFIG_ARCH_CPU_INIT 1/* for the initialization of PLL */ + +#define USE_920T_MMU 1 +#define CONFIG_BAUDRATE 115200 + +/* +* Size of malloc() pool +*/ +#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2048*1024) +/* size in bytes reserved for initial data */ +#define CONFIG_GBL_DATA_SIZE 128 + +/* +* Hardware drivers +*/ +#define CONFIG_DRIVER_DM9000 1 +#define CONFIG_DRIVER_DM9000_NO_EEPROM 1 +#define CONFIG_DM9000_BASE
0x20000300+#defineDM9000_IOCONFIG_DM9000_BASEinclude/configs/mini2440.h new file +20
-0+#define DM9000_DATA (CONFIG_DM9000_BASE+4) + +/* +* select serial console configuration +*/ +#define CONFIG_S3C24X0_SERIAL +#define CONFIG_SERIAL1 1 + +/* +* allow to overwrite serial and ethaddr +*/ +#define CONFIG_ENV_OVERWRITE + +/* +* Command definition +*/ +#include <config_cmd_default.h> + +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_PORTIO include/configs/mini2440.h
Quoted 10 lines
include/configs/mini2440.h new file +10
-0+#define CONFIG_CMD_REGINFO +#define CONFIG_CMD_SAVES + +/* +* Miscellaneous configurable options +*/ +#define CONFIG_LONGHELP +#define CONFIG_SYS_PROMPT "MINI2440 => " +#define CONFIG_SYS_CBSIZE 256 +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
include/configs/mini2440.h new file +5
-0+#define CONFIG_SYS_MAXARGS 32 +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE + +#define CONFIG_SYS_MEMTEST_START 0x30000000 +#define CONFIG_SYS_MEMTEST_END 0x34000000/* 64MB in
DRAM
Quoted 14 lines
Quoted 14 lines
*/
Quoted 12 lines
include/configs/mini2440.h new file +12
-0+ +/* everything, incl board info, in Hz */ +#undef CONFIG_CLKS_IN_HZ + +/* default load address */ +#define CONFIG_SYS_LOAD_ADDR 0x32000000 + +/* boot parameters address */ +#define CONFIG_BOOT_PARAM_ADDR 0x30000100 + +/* +* the PWM TImer 4 uses a counter of 15625 for 10 ms, so we need Quoted 8 lines
Quoted 8 lines
include/configs/mini2440.h
Quoted 8 lines
+ * it to wrap 100 times (total 1562500) to get 1 sec.
+ */include/configs/mini2440.h new file +6
-0+#define CONFIG_SYS_HZ 1562500 + +/* +* valid baudrates +*/ +#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400,57600,
115200Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
} +
include/configs/mini2440.h new file +11
-0+/* +* Stack sizes +* The stack sizes are set up in start.S using the settings below +*/ +#define CONFIG_STACKSIZE (128*1024)/* regular stack */ +#ifdef CONFIG_USE_IRQ +#define CONFIG_STACKSIZE_IRQ (8*1024)/* IRQ stack */ +#define CONFIG_STACKSIZE_FIQ (4*1024)/* FIQ stack */ +#endif + +/* Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
+ * Physical Memory Map
+ */
+#defineCONFIG_NR_DRAM_BANKS1 /* we have 1 bank
of DRAM */ +#definePHYS_SDRAM_10x30000000/*
SDRAM Bank #1 */ +#definePHYS_SDRAM_1_SIZE(64*1024*1024) /* 64MB of DRAM */ +#defineCONFIG_SYS_SDRAM_BASE
PHYS_SDRAM_1
+#defineCONFIG_SYS_INIT_SP_ADDR(CONFIG_SYS_SDRAM_BASE+
0x1000Quoted 3 lines
Quoted 3 lines
- \
Quoted 1 line
+
GENERATED_GBL_DATA_SIZE)Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
include/configs/mini2440.h new file +3
-0+ +/* +* When booting from NAND, it is impossible to access the lowest addresses + * due to the SteppingStone being in the way. Luckily the NOR doesn't really + * care about the highest 16 bits of address, so we set the controlers + * registers to go and poke over there, instead.
+ */include/configs/mini2440.h new file +15
-0+#define PHYS_FLASH_1 0x0 +#define CONFIG_SYS_FLASH_BASE 0x0 + +/* +* NOR FLASH organization +* Now uses the standard CFI interface +* FLASH and environment organization +*/ +#define CONFIG_SYS_FLASH_CFI 1 +#define CONFIG_FLASH_CFI_DRIVER 1 +#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT +#define CONFIG_SYS_MONITOR_BASE 0x0 +/* max number of memory banks */ +#define CONFIG_SYS_MAX_FLASH_BANKS 1 +/* 512 * 4096 sectors, or 32 * 64k blocks */ Quoted 8 lines
Quoted 8 lines
include/configs/mini2440.h
Quoted 8 lines
include/configs/mini2440.h new file +8
-0+#define CONFIG_SYS_MAX_FLASH_SECT 512 +#define CONFIG_FLASH_SHOW_PROGRESS 1 + +/* +* u-boot environmnent +*/ +#define CONFIG_BOOTDELAY 3 +#define CONFIG_BOOTARGS "root=/dev/sdb1console=ttySAC0,115200"
Quoted 10 lines
Quoted 7 lines
include/configs/mini2440.h line 194
Quoted 5 lines
include/configs/mini2440.h new file +5
-0+#define CONFIG_NETMASK 255.255.255.0 +#define CONFIG_IPADDR 192.168.0.2 +#define CONFIG_SERVERIP 192.168.0.1 +#define CONFIG_DOS_PARTITION 1 +#define CONFIG_BOOTCOMMAND "tftp 0x32000000 uImage;bootm"DROP THIS!
ok :-)
Quoted 8 lines
Quoted 8 lines
include/configs/mini2440.h
Quoted 8 lines
include/configs/mini2440.h new file +8
-0+ +/* +* Config for NOR flash +*/ +#define CONFIG_ENV_IS_IN_FLASH 1 +#define CONFIG_MY_ENV_OFFSET 0x40000 +/* addr of environment */ +#define CONFIG_ENV_ADDR (PHYS_FLASH_1 +
CONFIG_MY_ENV_OFFSET)Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
include/configs/mini2440.h new file +5
-0+/* 16k Total Size of Environment Sector */ +#define CONFIG_ENV_SIZE 0x4000 + +#define CONFIG_PREBOOT_OVERRIDE 1 +Quoted 8 lines
Quoted 8 lines
include/configs/mini2440.h line 215
Quoted 8 lines
include/configs/mini2440.h new file +8
-0+/* ATAG configuration */ +#define CONFIG_INITRD_TAG 1 +#define CONFIG_SETUP_MEMORY_TAGS 1 +#define CONFIG_CMDLINE_TAG 1 +#define CONFIG_CMDLINE_EDITING 1 +#define CONFIG_AUTO_COMPLETE 1 + +#endif /* __CONFIG_H */ _______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
Hi Marek,
Quoted 22 lines · Marek Vasut
Dear Ilya Averyanov,
Quoted 20 lines
2012/4/20 Marek Vasut <[email protected]>
Quoted 17 lines
Dear Gabriel Huau,
Quoted 6 lines · Marek Vasut
Quoted 4 lines
Dear Gabriel Huau,
Quoted 2 lines
---
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
+ /* some delay between MPLL and UPLL */
+pll_delay(500000);You use
udelay()below, do you needpll_delay()at all?Yes, because initialisation of PLL is done before
timer_init(), so we can't useudelay().Maybe fix the timer driver?
Quoted 7 lines
Quoted 2 lines
How fix timer driver if
arch_cpu_init(void)call befortimer_initin \arch\arm\lib\board.c:227init_fnc_t*init_sequence[] = {Where did you get such a weird path? \arch\arm... ?
btw you can always check some bit, if the timer is enabled, behave one way, otherwise, behave other way.
There is plenty of room in gd->flags - Pick a bit in the high-order 16-bits
It will be clear at startup and when you initialise the timer, you can set the bit. udelay() can do a simple test on the bit and call the appropriate function
Regards,
Graeme
PATCH v3 1/1 Add support for MINI2440 (s3c2440). Documentation about the product can be found on: http://www.friendlyarm.net/products/mini2440
In reply to Gabriel HuauGabriel,
Can you please trim the subject by removing the 'Documentation about ...' bit. This information belongs in the source code files or, better yet, in doc/README.MINI2440
Regards,
Graeme