[U-Boot] [PATCH-ARM 1/2] Add support for the Embest SBC2440-II Board

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sat Jun 20 19:36:00 CEST 2009


On 17:42 Fri 19 Jun     , kevin.morfitt at fearnside-systems.co.uk wrote:
> This is the first of two patches that will add support for the Embest 
> SBC2440-II Board. This one adds generic support for the S3C2440 CPU. Tested by 
> running MAKEALL for ARM9 boards - no new warnings or errors were found.
> 
> This patch set assumes that the following patches have already been applied:
> 
> - Clean-up of ARM920T S3C24x0 code, submitted on 5th June
> - Clean-up of ARM920T S3C24x0 drivers code, submitted on 5th June
> - Bug-fix in drivers mtd nand Makefile, submitted on 18th June
> 
> Signed-off-by: Kevin Morfitt <kevin.morfitt at fearnside-systems.co.uk>
> ---
>  common/serial.c                 |    4 +-
>  cpu/arm920t/s3c24x0/speed.c     |   38 ++++++-
>  cpu/arm920t/s3c24x0/timer.c     |    8 +-
>  cpu/arm920t/s3c24x0/usb.c       |    9 +-
>  cpu/arm920t/start.S             |   29 ++++-
>  drivers/i2c/s3c24x0_i2c.c       |   12 +-
>  drivers/mtd/nand/Makefile       |    1 +
>  drivers/mtd/nand/s3c2410_nand.c |    8 +-
>  drivers/mtd/nand/s3c2440_nand.c |  241 +++++++++++++++++++++++++++++++++++++++
>  drivers/rtc/s3c24x0_rtc.c       |    2 +
>  drivers/serial/serial_s3c24x0.c |    2 +
>  include/common.h                |    3 +-
>  include/s3c2440.h               |  232 +++++++++++++++++++++++++++++++++++++
>  include/s3c24x0.h               |  186 +++++++++++++++++++++++++++++-
>  14 files changed, 745 insertions(+), 30 deletions(-)
>  create mode 100644 drivers/mtd/nand/s3c2440_nand.c
>  create mode 100644 include/s3c2440.h
first general comment

Please split this patch as something like this
patch 1 add the s3c24x0 support
patch 2 add the nand
patch 3 your boards
> 
> diff --git a/common/serial.c b/common/serial.c
> index dd80e7c..6548b8b 100644
> --- a/common/serial.c
> +++ b/common/serial.c
> @@ -58,7 +58,7 @@ struct serial_device *__default_serial_console (void)
>  #else
>  		return &serial0_device;
>  #endif
> -#elif defined(CONFIG_S3C2410)
> +#elif defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)
if it's really s3c24x0 please use a correspondig macro IIRC yes
>  #if defined(CONFIG_SERIAL1)
>  	return &s3c24xx_serial0_device;
>  #elif defined(CONFIG_SERIAL2)
> @@ -133,7 +133,7 @@ void serial_initialize (void)
>  #if defined (CONFIG_STUART)
>  	serial_register(&serial_stuart_device);
>  #endif
> -#if defined(CONFIG_S3C2410)
> +#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)
ditto
>  	serial_register(&s3c24xx_serial0_device);
>  	serial_register(&s3c24xx_serial1_device);
>  	serial_register(&s3c24xx_serial2_device);
> diff --git a/cpu/arm920t/s3c24x0/speed.c b/cpu/arm920t/s3c24x0/speed.c
> index 3d7c8cf..b8b183e 100644
> --- a/cpu/arm920t/s3c24x0/speed.c
> +++ b/cpu/arm920t/s3c24x0/speed.c
> @@ -30,7 +30,8 @@
>   */
>  
>  #include <common.h>
> -#if defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined (CONFIG_TRAB)
> +#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || \
> +    defined(CONFIG_S3C2440) || defined(CONFIG_TRAB)
>  
>  #include <asm/io.h>
>  
> @@ -38,6 +39,8 @@
>  #include <s3c2400.h>
>  #elif defined(CONFIG_S3C2410)
>  #include <s3c2410.h>
> +#elif defined(CONFIG_S3C2440)
> +#include <s3c2440.h>
>  #endif
please create a cpu.h file to avoid those ifdef
>  
>  #define MPLL 0
> @@ -69,6 +72,11 @@ static ulong get_PLLCLK(int pllreg)
>  	p = ((r & 0x003F0) >> 4) + 2;
>  	s = r & 0x3;
>  
> +#ifdef CONFIG_S3C2440
> +	if (pllreg == MPLL)
> +		return (2 * CONFIG_SYS_CLK_FREQ * m) / (p << s);
> +	else
> +#endif
>  	return (CONFIG_SYS_CLK_FREQ * m) / (p << s);
>  }
>  
> @@ -83,7 +91,23 @@ ulong get_HCLK(void)
>  {
>  	S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
>  
> +#ifdef CONFIG_S3C2440
> +	switch (clk_power->CLKDIVN & 0x6) {
> +	default:
> +	case 0:
> +		return get_FCLK();
> +	case 2:
> +		return get_FCLK() / 2;
> +	case 4:
> +		return (readl(&clk_power->CAMDIVN) & (1 << 9)) ?
> +			get_FCLK() / 8 : get_FCLK() / 4;
> +	case 6:
> +		return (readl(&clk_power->CAMDIVN) & (1 << 8)) ?
> +			get_FCLK() / 6 : get_FCLK() / 3;
> +	}
> +#else
>  	return (readl(&clk_power->CLKDIVN) & 2) ? get_FCLK() / 2 : get_FCLK();
> +#endif
>  }
>  


> diff --git a/cpu/arm920t/start.S b/cpu/arm920t/start.S
> index 810d402..5f7aa33 100644
> --- a/cpu/arm920t/start.S
> +++ b/cpu/arm920t/start.S
> @@ -132,8 +132,9 @@ copyex:
>  	bne	copyex
>  #endif
>  
> -#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410)
> -	/* turn off the watchdog */
> +#if defined(CONFIG_S3C2400) || \
> +    defined(CONFIG_S3C2410) || \
> +    defined(CONFIG_S3C2440)
>  
please move this code to cpu/arm920t/s3c24x0/

the start.S need to generic but you can call arch code from it
a branch or if not possible a assembly macro

please call it arch_pre_lowlevel_init
tks

>  # if defined(CONFIG_S3C2400)
>  #  define pWTCON	0x15300000
> @@ -146,6 +147,15 @@ copyex:
>  #  define CLKDIVN	0x4C000014	/* clock divisor register */
>  # endif
>  
> +# if defined(CONFIG_S3C2440)
> +#  define INTSMASK  0xffff
> +#  define CLKDIVVAL 0x5
> +#else
> +#  define INTSMASK  0x3ff
> +#  define CLKDIVVAL 0x3
> +# endif
> +
> +	/* turn off the watchdog */
>  	ldr	r0, =pWTCON
>  	mov	r1, #0x0
>  	str	r1, [r0]

> @@ -156,8 +166,8 @@ copyex:
<snip>
> +
> +/* AC97 INTERFACE (see S3C2440 manual chapter 24) */
> +typedef struct {
> +	S3C24X0_REG32 ACGLBCTRL;
> +	S3C24X0_REG32 ACGLBSTAT;
> +	S3C24X0_REG32 AC_CODEC_CMD;
> +	S3C24X0_REG32 AC_CODEC_STAT;
> +	S3C24X0_REG32 AC_PCMADDR;
> +	S3C24X0_REG32 AC_MICADDR;
> +	S3C24X0_REG32 AC_PCMDATA;
> +	S3C24X0_REG32 AC_MICDATA;
> +} /*__attribute__((__packed__))*/ S3C2440_AC97;
if no need please remove

Best Regards,
J.


More information about the U-Boot mailing list