Re: [U-Boot] boot linux data aboot for S3C2440A

2009-09-04 Thread kevin.morf...@fearnside-systems.co.uk
Hi fluke56512

I was the last one to work on an s3c2440 port - I ran out of time but I hope to 
submit my changes for the next release. In the meantime, you can use my patches 
as a starting point (see the series of patches in ref 1) or if you contact me 
directly I can send you a single patch for the u-boot-2009.08 release that 
works but isn't suitable for submission to this mailing list yet.

Regards
Kevin

abdoulaye Walsimou Gaye wrote:
> fluke56512 a écrit :
>> what is wrong with me.
>>
>> [u-b...@s3c2440a]# nand read 0x30008000 0x0004 0x0020
>> NAND read: device 0 offset 0x4, size 0x20
>>  2097152 bytes read: OK
>>   
> 
> Hello fluke56512,
> IIRC board with S3C2440A does not exist in the official versions of u-boot.
> Few attempts have been made[1], but without going futher. Or may be you 
> are working on it? I planed to work on it
> with the cheap mini2440 board, but I am too busy for now.
> 
> cheers,
> 
> [1] http://lists.denx.de/pipermail/u-boot/2009-June/054887.html
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH-ARM] CONFIG_SYS_HZ fix for ARM902T S3C24X0 Boards

2009-09-05 Thread kevin.morf...@fearnside-systems.co.uk
This sets CONFIG_SYS_HZ to 1000 for all boards that use the s3c2400 and
s3c2410 cpu's which fixes various problems such as the timeouts in tftp being
too short.

Tested on an Embest SBC2440-II Board with local u-boot patches as I don't
have any s3c2400 or s3c2410 boards but need this patch applying before I can
submit patches for the SBC2440-II Board. Also, ran MAKEALL for all ARM9 targets
and no new warnings or errors were found.

It was originally submitted on 21/06/2009 but didn't get into the 2009.08
release, and Jean-Pierre made one comment on the original patch (see
http://lists.denx.de/pipermail/u-boot/2009-July/055470.html). I've made two
changes to the original patch:
- it's been re-based to the current release
- I've re-named get_timer_raw() to get_ticks() in response to Jean-Pierre's 
comment

This affects the sbc2410, smdk2400, smdk2410 and trab boards. I've copied it
directly to the maintainers of all except the sbc2410 which doesn't have an
entry in MAINTAINERS.

Signed-off-by: Kevin Morfitt 
---
 cpu/arm920t/s3c24x0/timer.c |   36 
 include/configs/sbc2410x.h  |4 +---
 include/configs/smdk2400.h  |4 +---
 include/configs/smdk2410.h  |4 +---
 include/configs/trab.h  |   12 +---
 5 files changed, 24 insertions(+), 36 deletions(-)

diff --git a/cpu/arm920t/s3c24x0/timer.c b/cpu/arm920t/s3c24x0/timer.c
index c8c7cdb..db472bf 100644
--- a/cpu/arm920t/s3c24x0/timer.c
+++ b/cpu/arm920t/s3c24x0/timer.c
@@ -39,6 +39,7 @@
 #endif

 int timer_load_val = 0;
+static ulong timer_clk;

 /* macro to read the 16 bit timer */
 static inline ulong READ_TIMER(void)
@@ -66,6 +67,7 @@ int timer_init (void)
 * @33.25MHz and 15625 @ 50 MHz
 */
timer_load_val = get_PCLK()/(2 * 16 * 100);
+   timer_clk = get_PCLK() / (2 * 16);
}
/* load value for 10 ms timeout */
lastdec = timers->TCNTB4 = timer_load_val;
@@ -100,13 +102,13 @@ void set_timer (ulong t)
 void udelay (unsigned long usec)
 {
ulong tmo;
-   ulong start = get_timer(0);
+   ulong start = get_ticks();

tmo = usec / 1000;
tmo *= (timer_load_val * 100);
tmo /= 1000;

-   while ((ulong)(get_timer_masked () - start) < tmo)
+   while ((ulong) (get_ticks() - start) < tmo)
/*NOP*/;
 }

@@ -119,18 +121,9 @@ void reset_timer_masked (void)

 ulong get_timer_masked (void)
 {
-   ulong now = READ_TIMER();
-
-   if (lastdec >= now) {
-   /* normal mode */
-   timestamp += lastdec - now;
-   } else {
-   /* we have an overflow ... */
-   timestamp += lastdec + timer_load_val - now;
-   }
-   lastdec = now;
+   ulong tmr = get_ticks();

-   return timestamp;
+   return tmr / (timer_clk / CONFIG_SYS_HZ);
 }

 void udelay_masked (unsigned long usec)
@@ -148,10 +141,10 @@ void udelay_masked (unsigned long usec)
tmo /= (1000*1000);
}

-   endtime = get_timer_masked () + tmo;
+   endtime = get_ticks() + tmo;

do {
-   ulong now = get_timer_masked ();
+   ulong now = get_ticks();
diff = endtime - now;
} while (diff >= 0);
 }
@@ -162,7 +155,18 @@ void udelay_masked (unsigned long usec)
  */
 unsigned long long get_ticks(void)
 {
-   return get_timer(0);
+   ulong now = READ_TIMER();
+
+   if (lastdec >= now) {
+   /* normal mode */
+   timestamp += lastdec - now;
+   } else {
+   /* we have an overflow ... */
+   timestamp += lastdec + timer_load_val - now;
+   }
+   lastdec = now;
+
+   return timestamp;
 }

 /*
diff --git a/include/configs/sbc2410x.h b/include/configs/sbc2410x.h
index f2ea926..e6886cf 100644
--- a/include/configs/sbc2410x.h
+++ b/include/configs/sbc2410x.h
@@ -139,9 +139,7 @@

 #defineCONFIG_SYS_LOAD_ADDR0x3300  /* default load 
address */

-/* 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. */
-#defineCONFIG_SYS_HZ   1562500
+#defineCONFIG_SYS_HZ   1000

 /* valid baudrates */
 #define CONFIG_SYS_BAUDRATE_TABLE  { 9600, 19200, 38400, 57600, 115200 }
diff --git a/include/configs/smdk2400.h b/include/configs/smdk2400.h
index c234177..a1beb65 100644
--- a/include/configs/smdk2400.h
+++ b/include/configs/smdk2400.h
@@ -141,9 +141,7 @@

 #defineCONFIG_SYS_LOAD_ADDR0x0cf0  /* default load 
address */

-/* 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. */
-#defineCONFIG_SYS_HZ   1562500
+#defineCONFIG_SYS_HZ   1000

 /* valid baudrates */
 #define CONFIG_SYS_BAUDRATE_TABLE  { 9600, 19200, 38400, 57600, 115200 }
diff --git a/

[U-Boot] s3c24x0 code changes

2009-09-05 Thread kevin.morf...@fearnside-systems.co.uk
I submitted patches in the last merge window to add support for the Embest  
SBC2440-II Board but ran out of time to deal with all of the comments on
the  
patches. Because it was a series of 7 patches comments on the early
patches in  
the series meant I had to re-work all other patches.
 
I'd like to try again in this merge window but do it in stages, waiting
until
the patches of each stage get accepted before starting the next stage. The  
stages would be:
 
1. re-format the existing s3c24x0 code to meet the u-boot code style
guidelines
2. add support for the s3c2440 cpu
3. add support for the Embest SBC2440-II Board
 
I'm aware that other changes are required to the s3c24x0 code such as
moving all  
driver code to the drivers directory, using a shared start.S for all
s3c24x0  
cpu's, and cleaning up the #ifdef's that check which s3c24x0 cpu we're
building  
for, and I could do these and/or other changes before step 3 if anyone
would  
prefer. I guess that when a dedicated Samsung SoC custodian starts work
they
may have other ideas as well. I'm more concerned to make it manageable
than to  
get the SBC2440-II supported quickly.
 
Anyway, the code style changes in the original patch generated a few
comments so  
I thought I'd describe what I intend to do in case anyone has any comments  
before I submit the patches. My plan is to make the following changes:
 
- run "Lindent -kr -i8 -l80" on all s3c24x0 code then manually clean up
the  
  resulting files
- change the existing S3C24X0 register struct's to use lower case names
instead  
  of upper case names
- make the code use the readx/writex access functions
- submit the s3c24x0 NAND driver changes as a separate patch
 
Is there anything else anyone would like to see done in the code style
changes?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH-ARM 4/4] Clean-up of s3c24x0 nand driver

2009-09-06 Thread kevin.morf...@fearnside-systems.co.uk
This patch re-formats the arm920t s3c24x0 nand driver in preparation for changes
to add support for the Embest SBC2440-II Board.

The changes are as follows:
- re-indent the code using Lindent
- make sure register layouts are defined using a C struct
- replace the upper-case typedef'ed C struct names with lower case
non-typedef'ed ones
- make sure registers are accessed using the proper accessor functions
- run checkpatch.pl and fix any error reports

It assumes the following patch has been applied first:
- [U-Boot][PATCH-ARM] CONFIG_SYS_HZ fix for ARM902T S3C24X0 Boards, 05/09/2009
 - patches 1/4, 2/4 and 3/4 of this series

Tested on an Embest SBC2440-II Board with local u-boot patches as I don't have
any s3c2400 or s3c2410 boards but need this patch applying before I can submit
patches for the SBC2440-II Board. Also, temporarily modified sbc2410x, smdk2400,
smdk2410 and trab configs to use the mtd nand driver (which isn't used by any
board at the moment), ran MAKEALL for all ARM9 targets and no new warnings or
errors were found.

Signed-off-by: Kevin Morfitt 
---
 drivers/mtd/nand/s3c2410_nand.c |   62 +++---
 1 files changed, 25 insertions(+), 37 deletions(-)

diff --git a/drivers/mtd/nand/s3c2410_nand.c b/drivers/mtd/nand/s3c2410_nand.c
index d27a625..f2f3e72 100644
--- a/drivers/mtd/nand/s3c2410_nand.c
+++ b/drivers/mtd/nand/s3c2410_nand.c
@@ -20,29 +20,10 @@

 #include 

-#if 0
-#define DEBUGN printf
-#else
-#define DEBUGN(x, args ...) {}
-#endif
-
 #include 
 #include 
 #include 

-#define __REGb(x)  (*(volatile unsigned char *)(x))
-#define __REGi(x)  (*(volatile unsigned int *)(x))
-
-#defineNF_BASE 0x4e00
-#defineNFCONF  __REGi(NF_BASE + 0x0)
-#defineNFCMD   __REGb(NF_BASE + 0x4)
-#defineNFADDR  __REGb(NF_BASE + 0x8)
-#defineNFDATA  __REGb(NF_BASE + 0xc)
-#defineNFSTAT  __REGb(NF_BASE + 0x10)
-#define NFECC0 __REGb(NF_BASE + 0x14)
-#define NFECC1 __REGb(NF_BASE + 0x15)
-#define NFECC2 __REGb(NF_BASE + 0x16)
-
 #define S3C2410_NFCONF_EN  (1<<15)
 #define S3C2410_NFCONF_512BYTE (1<<14)
 #define S3C2410_NFCONF_4STEP   (1<<13)
@@ -58,11 +39,12 @@
 static void s3c2410_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
 {
struct nand_chip *chip = mtd->priv;
+   struct s3c2410_nand *nand = s3c2410_get_base_nand();

-   DEBUGN("hwcontrol(): 0x%02x 0x%02x\n", cmd, ctrl);
+   debugX(1, "hwcontrol(): 0x%02x 0x%02x\n", cmd, ctrl);

if (ctrl & NAND_CTRL_CHANGE) {
-   ulong IO_ADDR_W = NF_BASE;
+   ulong IO_ADDR_W = (ulong)nand;

if (!(ctrl & NAND_CLE))
IO_ADDR_W |= S3C2410_ADDR_NCLE;
@@ -72,9 +54,11 @@ static void s3c2410_hwcontrol(struct mtd_info *mtd, int cmd,
unsigned int ctrl)
chip->IO_ADDR_W = (void *)IO_ADDR_W;

if (ctrl & NAND_NCE)
-   NFCONF &= ~S3C2410_NFCONF_nFCE;
+   writel(readl(&nand->NFCONF) & ~S3C2410_NFCONF_nFCE,
+  &nand->NFCONF);
else
-   NFCONF |= S3C2410_NFCONF_nFCE;
+   writel(readl(&nand->NFCONF) | S3C2410_NFCONF_nFCE,
+  &nand->NFCONF);
}

if (cmd != NAND_CMD_NONE)
@@ -83,15 +67,17 @@ static void s3c2410_hwcontrol(struct mtd_info *mtd, int cmd,
unsigned int ctrl)

 static int s3c2410_dev_ready(struct mtd_info *mtd)
 {
-   DEBUGN("dev_ready\n");
-   return (NFSTAT & 0x01);
+   struct s3c2410_nand *nand = s3c2410_get_base_nand();
+   debugX(1, "dev_ready\n");
+   return readl(&nand->NFSTAT) & 0x01;
 }

 #ifdef CONFIG_S3C2410_NAND_HWECC
 void s3c2410_nand_enable_hwecc(struct mtd_info *mtd, int mode)
 {
-   DEBUGN("s3c2410_nand_enable_hwecc(%p, %d)\n", mtd, mode);
-   NFCONF |= S3C2410_NFCONF_INITECC;
+   struct s3c2410_nand *nand = s3c2410_get_base_nand();
+   debugX(1, "s3c2410_nand_enable_hwecc(%p, %d)\n", mtd, mode);
+   writel(readl(&nand->NFCONF) | S3C2410_NFCONF_INITECC, &nand->NFCONF);
 }

 static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
@@ -100,8 +86,8 @@ static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd,
const u_char *dat,
ecc_code[0] = NFECC0;
ecc_code[1] = NFECC1;
ecc_code[2] = NFECC2;
-   DEBUGN("s3c2410_nand_calculate_hwecc(%p,): 0x%02x 0x%02x 0x%02x\n",
-   mtd , ecc_code[0], ecc_code[1], ecc_code[2]);
+   debugX(1, "s3c2410_nand_calculate_hwecc(%p,): 0x%02x 0x%02x 0x%02x\n",
+  mtd , ecc_code[0], ecc_code[1], ecc_code[2]);

return 0;
 }
@@ -123,24 +109,26 @@ int board_nand_init(struct nand_chip *nand)
 {
u_int32_t cfg;
u_int8_t tacls, twrph0, twrph1;
-   S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
+   struct s3

Re: [U-Boot] [PATCH ARM] Add a unified s3c24x0 header file

2009-11-13 Thread kevin.morf...@fearnside-systems.co.uk
Hi Minky


Minkyu Kang wrote:
> Dear Kevin Morfitt
> 
> 2009/11/10 kevin.morf...@fearnside-systems.co.uk
> :
>> This patch adds a unified s3c24x0 cpu header file that selects the header
>> file for the specific s3c24x0 cpu from the SOC and CPU configs defined in
>> board config file. This removes the current chain of s3c24-type #ifdef's
>> from the s3c24x0 code.
>>
>> Signed-off-by: Kevin Morfitt 
>> ---
>>  board/mpl/vcma9/vcma9.c|2 +-
>>  board/mpl/vcma9/vcma9.h|2 +-
>>  board/samsung/smdk2400/smdk2400.c  |2 +-
>>  board/samsung/smdk2410/smdk2410.c  |2 +-
>>  board/sbc2410x/sbc2410x.c  |2 +-
>>  board/trab/cmd_trab.c  |2 +-
>>  board/trab/rs485.c |2 +-
>>  board/trab/rs485.h |2 +-
>>  board/trab/trab.c  |2 +-
>>  board/trab/trab_fkt.c  |2 +-
>>  board/trab/tsc2000.c   |2 +-
>>  board/trab/vfd.c   |2 +-
>>  cpu/arm920t/s3c24x0/interrupts.c   |6 +-
>>  cpu/arm920t/s3c24x0/speed.c|   13 +++--
>>  cpu/arm920t/s3c24x0/timer.c|   15 +++
>>  cpu/arm920t/s3c24x0/usb.c  |   17 +++--
>>  cpu/arm920t/s3c24x0/usb_ohci.c |   11 +++
>>  cpu/arm920t/start.S|4 ++--
>>  drivers/i2c/s3c24x0_i2c.c  |6 +-
>>  drivers/mtd/nand/s3c2410_nand.c|2 +-
>>  drivers/rtc/s3c24x0_rtc.c  |6 +-
>>  drivers/serial/serial_s3c24x0.c|6 +-
>>  drivers/usb/host/ohci-hcd.c|3 +--
>>  include/asm-arm/arch-s3c24x0/s3c24x0_cpu.h |   27 
>> +++
>>  include/common.h   |5 +++--
>>  include/configs/VCMA9.h|7 ---
>>  include/configs/sbc2410x.h |7 ---
>>  include/configs/smdk2400.h |7 ---
>>  include/configs/smdk2410.h |7 ---
>>  include/configs/trab.h |9 +
>>  30 files changed, 87 insertions(+), 95 deletions(-)
>>  create mode 100644 include/asm-arm/arch-s3c24x0/s3c24x0_cpu.h
>>
>> diff --git a/board/mpl/vcma9/vcma9.c b/board/mpl/vcma9/vcma9.c
>> index f3bd288..1835677 100644
>> --- a/board/mpl/vcma9/vcma9.c
>> +++ b/board/mpl/vcma9/vcma9.c
>> @@ -27,7 +27,7 @@
>>
>>  #include 
>>  #include 
>> -#include 
>> +#include 
>>  #include 
>>  #include 
>>
>> diff --git a/board/mpl/vcma9/vcma9.h b/board/mpl/vcma9/vcma9.h
>> index 2c4305c..94fd2fa 100644
>> --- a/board/mpl/vcma9/vcma9.h
>> +++ b/board/mpl/vcma9/vcma9.h
>> @@ -25,7 +25,7 @@
>>  * Global routines used for VCMA9
>>  
>> */
>>
>> -#include 
>> +#include 
>>
>>  extern int  mem_test(unsigned long start, unsigned long ramsize,int mode);
>>
>> diff --git a/board/samsung/smdk2400/smdk2400.c 
>> b/board/samsung/smdk2400/smdk2400.c
>> index be0c70a..1294d3f 100644
>> --- a/board/samsung/smdk2400/smdk2400.c
>> +++ b/board/samsung/smdk2400/smdk2400.c
>> @@ -27,7 +27,7 @@
>>
>>  #include 
>>  #include 
>> -#include 
>> +#include 
>>
>>  DECLARE_GLOBAL_DATA_PTR;
>>
>> diff --git a/board/samsung/smdk2410/smdk2410.c 
>> b/board/samsung/smdk2410/smdk2410.c
>> index a8cf287..5d1a8bb 100644
>> --- a/board/samsung/smdk2410/smdk2410.c
>> +++ b/board/samsung/smdk2410/smdk2410.c
>> @@ -27,7 +27,7 @@
>>
>>  #include 
>>  #include 
>> -#include 
>> +#include 
>>
>>  DECLARE_GLOBAL_DATA_PTR;
>>
>> diff --git a/board/sbc2410x/sbc2410x.c b/board/sbc2410x/sbc2410x.c
>> index 6768c02..3a93677 100644
>> --- a/board/sbc2410x/sbc2410x.c
>> +++ b/board/sbc2410x/sbc2410x.c
>> @@ -30,7 +30,7 @@
>>
>>  #include 
>>  #include 
>> -#include 
>> +#include 
>>
>>  #if defined(CONFIG_CMD_NAND)
>>  #include 
>> diff --git a/board/trab/cmd_trab.c b/board/trab/cmd_trab.c
>> index a01ffcc..472d7d8 100644
>> --- a/board/trab/cmd_trab.c
>> +++ b/board/trab/cmd_trab.c
>> @@ -25,7 +25,7 @@
>>
>>  #include 
>>  #include 
>> -#include 
>> +#include 
>&

Re: [U-Boot] [PATCH ARM] Add a unified s3c24x0 header file

2009-11-13 Thread kevin.morf...@fearnside-systems.co.uk


Minkyu Kang wrote:
> Dear Kevin Morifitt,
> 
> 2009/11/13 kevin.morf...@fearnside-systems.co.uk
> :
>> Hi Minky
>>
>>
>> Minkyu Kang wrote:
>>> Dear Kevin Morfitt
>>>
>>> 2009/11/10 kevin.morf...@fearnside-systems.co.uk
>>> :
>>>> This patch adds a unified s3c24x0 cpu header file that selects the header
>>>> file for the specific s3c24x0 cpu from the SOC and CPU configs defined in
>>>> board config file. This removes the current chain of s3c24-type #ifdef's
>>>> from the s3c24x0 code.
>>>>
>>>> Signed-off-by: Kevin Morfitt 
>>>>

>>>>
>>>>  #include 
>>>>  #include 
>>>> -#include 
>>>> +#include 
>>>>  #include 
>>> patch failed at s3c2410_nand.c
>>>
>>> patching file drivers/mtd/nand/s3c2410_nand.c
>>> Hunk #1 FAILED at 26.
>>> 1 out of 1 hunk FAILED -- saving rejects to file
>>> drivers/mtd/nand/s3c2410_nand.c.rej
>>>
>>> please check it
>> This patch assumes that my previous patch,
>> [U-Boot] [PATCH ARM] Update the s3c2410 nand driver from linux-2.6.31.5 had
>> already been applied.
>>
>> Would you like me to re-base this one to the current u-boot-samsung, or wait
>> until you've looked at [U-Boot] [PATCH ARM] Update the s3c2410 nand driver
>> from linux-2.6.31.5?
> 
> applied where?
> I couldn't find :(

It's not been accepted yet, I submitted it on 5th November, see 
http://lists.denx.de/pipermail/u-boot/2009-November/063866.html.

> 
>> Kevin
>>
>>>>  #if defined(CONFIG_S3C2410_NAND_HWECC) && 
>>>> defined(CONFIG_SYS_NAND_LARGEPAGE)
>>>> diff --git a/drivers/rtc/s3c24x0_rtc.c b/drivers/rtc/s3c24x0_rtc.c
>>>> index 2d78f93..04de5ca 100644
>>>> --- a/drivers/rtc/s3c24x0_rtc.c
>>>> +++ b/drivers/rtc/s3c24x0_rtc.c
>>>> @@ -30,11 +30,7 @@

> 
> 
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH ARM v2] Add a unified s3c24x0 header file

2009-11-17 Thread kevin.morf...@fearnside-systems.co.uk
This patch adds a unified s3c24x0 cpu header file that selects the header
file for the specific s3c24x0 cpu from the SOC and CPU configs defined in
board config file. This removes the current chain of s3c24-type #ifdef's 
from the s3c24x0 code.

Signed-off-by: Kevin Morfitt 
---
v2 changes: re-based to current u-boot-samsung.

 board/mpl/vcma9/vcma9.c|2 +-
 board/mpl/vcma9/vcma9.h|2 +-
 board/samsung/smdk2400/smdk2400.c  |2 +-
 board/samsung/smdk2410/smdk2410.c  |2 +-
 board/sbc2410x/sbc2410x.c  |2 +-
 board/trab/cmd_trab.c  |2 +-
 board/trab/rs485.c |2 +-
 board/trab/rs485.h |2 +-
 board/trab/trab.c  |2 +-
 board/trab/trab_fkt.c  |2 +-
 board/trab/tsc2000.c   |2 +-
 board/trab/vfd.c   |2 +-
 cpu/arm920t/s3c24x0/interrupts.c   |6 +-
 cpu/arm920t/s3c24x0/speed.c|   13 +++--
 cpu/arm920t/s3c24x0/timer.c|   15 +++
 cpu/arm920t/s3c24x0/usb.c  |   17 +++--
 cpu/arm920t/s3c24x0/usb_ohci.c |   11 +++
 cpu/arm920t/start.S|4 ++--
 drivers/i2c/s3c24x0_i2c.c  |6 +-
 drivers/mtd/nand/s3c2410_nand.c|2 +-
 drivers/rtc/s3c24x0_rtc.c  |6 +-
 drivers/serial/serial_s3c24x0.c|6 +-
 drivers/usb/host/ohci-hcd.c|3 +--
 include/asm-arm/arch-s3c24x0/s3c24x0_cpu.h |   27 +++
 include/common.h   |5 +++--
 include/configs/VCMA9.h|7 ---
 include/configs/sbc2410x.h |7 ---
 include/configs/smdk2400.h |7 ---
 include/configs/smdk2410.h |7 ---
 include/configs/trab.h |9 +
 30 files changed, 87 insertions(+), 95 deletions(-)
 create mode 100644 include/asm-arm/arch-s3c24x0/s3c24x0_cpu.h

diff --git a/board/mpl/vcma9/vcma9.c b/board/mpl/vcma9/vcma9.c
index f3bd288..1835677 100644
--- a/board/mpl/vcma9/vcma9.c
+++ b/board/mpl/vcma9/vcma9.c
@@ -27,7 +27,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
diff --git a/board/mpl/vcma9/vcma9.h b/board/mpl/vcma9/vcma9.h
index 2c4305c..94fd2fa 100644
--- a/board/mpl/vcma9/vcma9.h
+++ b/board/mpl/vcma9/vcma9.h
@@ -25,7 +25,7 @@
  * Global routines used for VCMA9
  */
 
-#include 
+#include 
 
 extern int  mem_test(unsigned long start, unsigned long ramsize,int mode);
 
diff --git a/board/samsung/smdk2400/smdk2400.c 
b/board/samsung/smdk2400/smdk2400.c
index be0c70a..1294d3f 100644
--- a/board/samsung/smdk2400/smdk2400.c
+++ b/board/samsung/smdk2400/smdk2400.c
@@ -27,7 +27,7 @@
 
 #include 
 #include 
-#include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/samsung/smdk2410/smdk2410.c 
b/board/samsung/smdk2410/smdk2410.c
index a8cf287..5d1a8bb 100644
--- a/board/samsung/smdk2410/smdk2410.c
+++ b/board/samsung/smdk2410/smdk2410.c
@@ -27,7 +27,7 @@
 
 #include 
 #include 
-#include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/sbc2410x/sbc2410x.c b/board/sbc2410x/sbc2410x.c
index 6768c02..3a93677 100644
--- a/board/sbc2410x/sbc2410x.c
+++ b/board/sbc2410x/sbc2410x.c
@@ -30,7 +30,7 @@
 
 #include 
 #include 
-#include 
+#include 
 
 #if defined(CONFIG_CMD_NAND)
 #include 
diff --git a/board/trab/cmd_trab.c b/board/trab/cmd_trab.c
index a01ffcc..472d7d8 100644
--- a/board/trab/cmd_trab.c
+++ b/board/trab/cmd_trab.c
@@ -25,7 +25,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 /*
diff --git a/board/trab/rs485.c b/board/trab/rs485.c
index f402c59..ad0c136 100644
--- a/board/trab/rs485.c
+++ b/board/trab/rs485.c
@@ -22,7 +22,7 @@
  */
 
 #include 
-#include 
+#include 
 #include "rs485.h"
 
 static void rs485_setbrg (void);
diff --git a/board/trab/rs485.h b/board/trab/rs485.h
index 4a2d83f..16d69bb 100644
--- a/board/trab/rs485.h
+++ b/board/trab/rs485.h
@@ -24,7 +24,7 @@
 #ifndef _RS485_H_
 #define _RS485_H_
 
-#include 
+#include 
 
 int rs485_init (void);
 int rs485_getc (void);
diff --git a/board/trab/trab.c b/board/trab/trab.c
index f8836ff..71fd22c 100644
--- a/board/trab/trab.c
+++ b/board/trab/trab.c
@@ -26,7 +26,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/trab/trab_fkt.c b/board/trab/trab_fkt.c
index 940e12f..2df9a04 100644
--- a/board/trab/trab_fkt.c
+++ b/board/trab/trab_fkt.c
@@ -26,7 +26,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include "tsc2000.h"
 #include "rs485.h"
 
diff --git a/board/trab/tsc2000.c b/board/trab/tsc2000.c
index f757202..5890624 100644
--- a/boa

Re: [U-Boot] Clean-up of s3c24x0 header files

2009-12-04 Thread kevin.morf...@fearnside-systems.co.uk
Hi Wolfgang

On 02/12/2009 22:09, Wolfgang Denk wrote:
> Hi Kevin,
> 
> looking at the code resulting from commit 9ebfdc20 again, I see  that
> you  keep a LOT of uppercase variable names, which are not allowed as
> per coding style. DO you intend to convert these to proper lower-case
> names any time soon?

I can't see any variables with upper case names in the generic s3c24x0
code. The other arm920t code probably still has some but the s3c24x0
headers I patched only uses upper case names for constants and members of
structs that map onto the CPU registers. For example:

#define S3C24X0_MEMCTL_BASE 0x1400

 struct s3c24x0_memctl {
-   S3C24X0_REG32   BWSCON;
-   S3C24X0_REG32   BANKCON[8];
-   S3C24X0_REG32   REFRESH;
-   S3C24X0_REG32   BANKSIZE;
-   S3C24X0_REG32   MRSRB6;
-   S3C24X0_REG32   MRSRB7;
+   u32 BWSCON;
+   u32 BANKCON[8];
+   u32 REFRESH;
+   u32 BANKSIZE;
+   u32 MRSRB6;
+   u32 MRSRB7;
 };

Best Regards
Kevin
> 
> Best regards,
> 
> Wolfgang Denk
> 

-- 

Kevin Morfitt
Fearnside Systems Ltd
25 Holbeck Road
Nottingham
NG8 3PB

t: 0115 9136703
m: 07939 126277
e: kevin.morf...@fearnside-systems.co.uk


__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4661 (20091204) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] ARM: Add support for edb93xx boards

2009-12-08 Thread kevin.morf...@fearnside-systems.co.uk


Matthias Kaehlcke wrote:
> Hello Wolfgang,
> 
> El Tue, Dec 08, 2009 at 12:51:47AM +0100 Wolfgang Denk ha dit:
> 
 U-Boot uses assembler only when ther eis no reasonable way to
 implement the code in C, and I don't see any such justification here.
 Please rewrite all this in C.
>>> i'm just starting to get my feet wet with low level initialization and
>>> supposed sdram setup is always done in assembler.
>> There is no reason for assembly. We almost always do this in C.
> 
> i am starting to look at this issue and it seems i need some more guidance:
> 
> before relocating U-Boot to RAM for ARM920T processors a jump to the
> label *lowlevel_init* is performed, where RAM timings are supposed to
> be set up. in the patch i sent these operations are performed in
> assembly and you asked me to rewrite them in C.
> 
> i'm relativly new to low-level setup, so i apologize if the following
> question sounds plain stupid to you: is C really available at this
> point? if my interpretation of the code in cpu/arm920t/start.S is
> correct, C code starts at start_armboot, after relocation of
> U-Boot. and after that point i'd think it's to late to change RAM
> timings as U-Boot is running from RAM.
> 
> could you please give some advice to clear my confusion and maybe
> provide a pointer to a board/cpu which handles low-level setup in
> the intended way?
> 
> thanks
> 

I would've thought that you need a working stack before you can run 
'C' code so you'd need the RAM timing set up before you could run
C code hence you'd need to set the RAM timings up in assembler. 
Between start-up and the point the RAM timing gets configured it's 
running with the default values of the RAM timing registers which
probably aren't ideal for the particular RAM chips on the board.

At the moment the RAM timings for a specific board are set in the 
board-specific lowlevel_init assembler code. Any change would 
affect all s3c24x0 boards as well as the new edb93xx board.

Kevin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH ARM 1/3] s3c24x0 code style changes

2009-12-13 Thread kevin.morf...@fearnside-systems.co.uk
Cleans up the s3c24x0 header files by changing the upper case members
of the s3c24x0 register structures to lower case and changing all code
that uses these register structures.

Signed-off-by: Kevin Morfitt 
---

The patches are based on the u-boot-samsung repository.

checkpatch reports no errors. 'MAKEALL ARM9' reports no new build 
errors or warnings.

 cpu/arm920t/s3c24x0/interrupts.c   |2 +-
 cpu/arm920t/s3c24x0/speed.c|8 +-
 cpu/arm920t/s3c24x0/timer.c|   24 +-
 cpu/arm920t/s3c24x0/usb.c  |   16 +-
 cpu/arm920t/s3c24x0/usb_ohci.c |  112 +++---
 cpu/arm920t/s3c24x0/usb_ohci.h |   16 +-
 drivers/i2c/s3c24x0_i2c.c  |  166 +-
 drivers/mtd/nand/s3c2410_nand.c|   18 +-
 drivers/rtc/s3c24x0_rtc.c  |   62 ++--
 drivers/serial/serial_s3c24x0.c|   26 +-
 include/asm-arm/arch-s3c24x0/s3c24x0.h |  624 
 11 files changed, 538 insertions(+), 536 deletions(-)

diff --git a/cpu/arm920t/s3c24x0/interrupts.c b/cpu/arm920t/s3c24x0/interrupts.c
index 879fda6..9556a5f 100644
--- a/cpu/arm920t/s3c24x0/interrupts.c
+++ b/cpu/arm920t/s3c24x0/interrupts.c
@@ -37,6 +37,6 @@
 void do_irq (struct pt_regs *pt_regs)
 {
struct s3c24x0_interrupt *irq = s3c24x0_get_base_interrupt();
-   u_int32_t intpnd = readl(&irq->INTPND);
+   u_int32_t intpnd = readl(&irq->intpnd);
 
 }
diff --git a/cpu/arm920t/s3c24x0/speed.c b/cpu/arm920t/s3c24x0/speed.c
index b13283a..58e8865 100644
--- a/cpu/arm920t/s3c24x0/speed.c
+++ b/cpu/arm920t/s3c24x0/speed.c
@@ -54,9 +54,9 @@ static ulong get_PLLCLK(int pllreg)
ulong r, m, p, s;
 
if (pllreg == MPLL)
-   r = readl(&clk_power->MPLLCON);
+   r = readl(&clk_power->mpllcon);
else if (pllreg == UPLL)
-   r = readl(&clk_power->UPLLCON);
+   r = readl(&clk_power->upllcon);
else
hang();
 
@@ -78,7 +78,7 @@ ulong get_HCLK(void)
 {
struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
 
-   return (readl(&clk_power->CLKDIVN) & 2) ? get_FCLK() / 2 : get_FCLK();
+   return (readl(&clk_power->clkdivn) & 2) ? get_FCLK() / 2 : get_FCLK();
 }
 
 /* return PCLK frequency */
@@ -86,7 +86,7 @@ ulong get_PCLK(void)
 {
struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
 
-   return (readl(&clk_power->CLKDIVN) & 1) ? get_HCLK() / 2 : get_HCLK();
+   return (readl(&clk_power->clkdivn) & 1) ? get_HCLK() / 2 : get_HCLK();
 }
 
 /* return UCLK frequency */
diff --git a/cpu/arm920t/s3c24x0/timer.c b/cpu/arm920t/s3c24x0/timer.c
index cd06f6b..a0e2a38 100644
--- a/cpu/arm920t/s3c24x0/timer.c
+++ b/cpu/arm920t/s3c24x0/timer.c
@@ -39,11 +39,11 @@ int timer_load_val = 0;
 static ulong timer_clk;
 
 /* macro to read the 16 bit timer */
-static inline ulong READ_TIMER(void)
+static inline ulong read_timer(void)
 {
struct s3c24x0_timers *timers = s3c24x0_get_base_timers();
 
-   return readl(&timers->TCNTO4) & 0x;
+   return readl(&timers->tcnto4) & 0x;
 }
 
 static ulong timestamp;
@@ -56,7 +56,7 @@ int timer_init(void)
 
/* use PWM Timer 4 because it has no output */
/* prescaler for Timer 4 is 16 */
-   writel(0x0f00, &timers->TCFG0);
+   writel(0x0f00, &timers->tcfg0);
if (timer_load_val == 0) {
/*
 * for 10 ms clock period @ PCLK with 4 bit divider = 1/2
@@ -68,13 +68,13 @@ int timer_init(void)
}
/* load value for 10 ms timeout */
lastdec = timer_load_val;
-   writel(timer_load_val, &timers->TCNTB4);
+   writel(timer_load_val, &timers->tcntb4);
/* auto load, manual update of Timer 4 */
-   tmr = (readl(&timers->TCON) & ~0x070) | 0x060;
-   writel(tmr, &timers->TCON);
+   tmr = (readl(&timers->tcon) & ~0x070) | 0x060;
+   writel(tmr, &timers->tcon);
/* auto load, start Timer 4 */
tmr = (tmr & ~0x070) | 0x050;
-   writel(tmr, &timers->TCON);
+   writel(tmr, &timers->tcon);
timestamp = 0;
 
return (0);
@@ -115,7 +115,7 @@ void udelay(unsigned long usec)
 void reset_timer_masked(void)
 {
/* reset time */
-   lastdec = READ_TIMER();
+   lastdec = read_timer();
timestamp = 0;
 }
 
@@ -155,7 +155,7 @@ void udelay_masked(unsigned long usec)
  */
 unsigned long long get_ticks(void)
 {
-   ulong now = READ_TIMER();
+   ulong now = read_timer();
 
if (lastdec >= now) {
/* normal mode */
@@ -204,13 +204,13 @@ void reset_cpu(ulong ignored)
watchdog = s3c24x0_get_base_watchdog();
 
/* Disable watchdog */
-   writel(0x, &watchdog->WTCON);
+   writel(0x, &watchdog->wtcon);
 
/* Initialize watchdog timer count register */
-   writel(0x0001, &watchdog->WTCNT);
+   writel(0x0001, &watchdog->wtcnt);
 
/* Enable wat

Re: [U-Boot] [PATCH ARM 3/3] s3c24x0 code style changes

2009-12-15 Thread kevin.morf...@fearnside-systems.co.uk


Wolfgang Denk wrote:
> Dear "kevin.morf...@fearnside-systems.co.uk",
> 
> In message <4b2548ff.6040...@fearnside-systems.co.uk> you wrote:
>> Cleans up the s3c24x0 header files by changing the upper case members
>> of the s3c24x0 register structures to lower case and changing all code
>> that uses these register structures.
> 
> The commit message should also mention that you convert the code into
> using accessor functions.
> 
> You also perform a white space cleanup here. this may be a good thing
> (opinions differ), but in any case it is an unrelated change that must
> be performed in a separate commit.
> 

All I really wanted to do was change the sc324x0 register struct members 
to lower case, but if I do that without cleaning up the white space I
get checkpatch.pl errors, and if I don't change the code to use the
accessor functions the patch will get NAK-ed anyway...and all I really
want to do is get the code into a state where I can add support for the 
Embest SBC244-II Board!

I think I'll split the patches into a white-space change followed by an
accessor function/s3c24x0 register change patch.

> Note that the same applies to the other two patches.
> 
> Please also re-check the resulting code. I think there are some way
> too long lines, etc.

checkpatch.pl didn't report any line length errors before I emailed the 
patches. I'll check it again.

> 
> Best regards,
> 
> Wolfgang Denk
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH ARM] Update the s3c2410 nand driver from linux-2.6.31.5

2010-01-19 Thread kevin.morf...@fearnside-systems.co.uk


Scott Wood wrote:
> On Thu, Nov 05, 2009 at 08:53:36AM +, 
> kevin.morf...@fearnside-systems.co.uk wrote:
>> This patch updates the s3c2410 nand driver from that of linux 2.6.31.5, 
>> modified to make it work in the u-boot mtd nand architecture and to allow
>> setting the flash timing parameters from a board config file instead of
>> being hard coded. Note that this modified driver supports s3c2410 and 
>> s3c2440.
>>
>> Signed-off-by: Kevin Morfitt 
>> ---
>>
>> checkpatch.pl shows no errors or warnings, and MAKEALL ARM9 shows no new
>> errors or warnings.
>>
>> Tested on an Embest SBC2440-II Board with local s3c2440 patches as I don't
>> have an s3c2410 board.
>>
>>  drivers/mtd/nand/s3c2410_nand.c|  134 
>> +--
>>  include/asm-arm/arch-s3c24x0/s3c2410.h |   25 ++
>>  2 files changed, 98 insertions(+), 61 deletions(-)
> 
> It looks like this got missed, probably because it either depended on
> something in (or destined for) the ARM tree, or I just assumed that because
> of the "PATCH ARM".
> 
> Unfortunately, it doesn't apply cleanly anymore.  Could you resend, if it's
> still needed?

It was part of adding s3c2440 support which I've had to re-work quite a lot 
and is currently waiting for comments on a set of re-worked patches. I think
it would be simpler if I dropped this one and submitted a replacement later
on. I think the s3c2410 nand driver code is different in the u-boot main, 
Samsung SOC, and NAND repositories though so I'm not sure what I should base
a future patch on given that Wolfgang asked me to always base patches on 
u-boot master.

> 
> -Scott
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH ARM 4/4] Change s3c24x0 register struct members to lower case

2010-02-06 Thread kevin.morf...@fearnside-systems.co.uk
Hi Minkyu

On 06/02/2010 12:18, Minkyu Kang wrote:
> Dear kevin.morfitt
>
> 2009/12/29 kevin.morf...@fearnside-systems.co.uk
> :
>> Changes the names of the s3c24x0 register struct members from upper-case
>> to lower-case.
>>
>> Signed-off-by: Kevin Morfitt
>> ---
>>
>> checkpatch.pl reports no errors. MAKEALL ARM9 reports no new warnings
>> or errors.
>>
>> Note that this is based on the u-boot-master repository. The
>> versions of s3c24x0_nand.c file are different in the u-boot-samsung,
>> u-boot-nand-flash and u-boot-master repositories.
>>
>>   board/mpl/vcma9/vcma9.c|   42 ++--
>>   board/mpl/vcma9/vcma9.h|   20 +-
>>   board/samsung/smdk2400/smdk2400.c  |   29 +-
>>   board/samsung/smdk2410/smdk2410.c  |   38 ++-
>>   board/sbc2410x/sbc2410x.c  |   46 ++--
>>   board/trab/auto_update.c   |1 +
>>   board/trab/cmd_trab.c  |   36 ++-
>>   board/trab/rs485.c |   44 ++-
>>   board/trab/trab.c  |   71 ++--
>>   board/trab/trab_fkt.c  |  159 +
>>   board/trab/tsc2000.c   |   38 +-
>>   board/trab/tsc2000.h   |  112 ---
>>   board/trab/vfd.c   |   89 +++---
>>   cpu/arm920t/s3c24x0/interrupts.c   |3 +-
>>   cpu/arm920t/s3c24x0/speed.c|8 +-
>>   cpu/arm920t/s3c24x0/timer.c|   18 +-
>>   cpu/arm920t/s3c24x0/usb.c  |   11 +-
>>   cpu/arm920t/s3c24x0/usb_ohci.c |   15 +-
>>   drivers/i2c/s3c24x0_i2c.c  |  102 +++---
>>   drivers/mtd/nand/s3c2410_nand.c|   24 +-
>>   drivers/rtc/s3c24x0_rtc.c  |   52 ++--
>>   drivers/serial/serial_s3c24x0.c|   26 +-
>>   include/asm-arm/arch-s3c24x0/s3c24x0.h |  578 
>> 
>>   23 files changed, 819 insertions(+), 743 deletions(-)
>>
>
> Sorry for late reply.

No problem - thanks for looking at them.

> I tried to review your patch series,
> but your patch is too confusion, because of files are scattered in
> every patches.
> If possible, could you please remake patches?
> Please make to one file's modification by one patch.
>

The patches are split so that each patch makes only one type of change,
so there's only one thing that needs to be checked in each patch.

- patches 1 and 2 only make white-space changes (the change was too big
so I had to split it into 2 patches)
- patch 3 only makes code style changes such as moving external
function prototypes to header files, removing unused code, making line
lengths less than 81 characters, brackets around if/then/else/when/do
blocks, generally anything that checkpatch.pl warns about
- patch 4 changes the s3c24x0 register struct members to lower case
(which is the main aim of the patches)

I can modify the patches to do all changes at the same time but when
I've done this before I've always been told that each patch should have
only one type of change in it, and I'm not sure if it would get NACK'ed
by someone else.

What do you think - do you still want me to change the patch series?

Regards
Kevin


> Thanks to effort for your cleaning works.
> Minkyu Kang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH ARM 4/4] Change s3c24x0 register struct members to lower case

2010-02-06 Thread kevin.morf...@fearnside-systems.co.uk
Hi Wolfgang

On 06/02/2010 14:26, Wolfgang Denk wrote:
> Dear "kevin.morf...@fearnside-systems.co.uk",
>
> In message<4b6d687f.2060...@fearnside-systems.co.uk>  you wrote:
>>
>> The patches are split so that each patch makes only one type of change,
>> so there's only one thing that needs to be checked in each patch.
>>
>> - patches 1 and 2 only make white-space changes (the change was too big
>> so I had to split it into 2 patches)
>
> I think this should be merged into a single patch.

OK. It'll be about 140K though so I'llput it on a web site.

>
>> - patch 3 only makes code style changes such as moving external
>> function prototypes to header files, removing unused code, making line
>> lengths less than 81 characters, brackets around if/then/else/when/do
>> blocks, generally anything that checkpatch.pl warns about
>> - patch 4 changes the s3c24x0 register struct members to lower case
>> (which is the main aim of the patches)
>>
>> I can modify the patches to do all changes at the same time but when
>> I've done this before I've always been told that each patch should have
>> only one type of change in it, and I'm not sure if it would get NACK'ed
>> by someone else.
>
> Correct. Please keep the split as is.
>
>> What do you think - do you still want me to change the patch series?
>
> No, please leave as is.
>

OK, it's quite old now though so I might need to rebase it
to the current master.

Regards
Kevin

> Best regards,
>
> Wolfgang Denk
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH ARM 4/4] Change s3c24x0 register struct members to lower case

2010-02-06 Thread kevin.morf...@fearnside-systems.co.uk


On 06/02/2010 15:14, Tom wrote:
> kevin.morf...@fearnside-systems.co.uk wrote:
>> Hi Wolfgang
>>
>> On 06/02/2010 14:26, Wolfgang Denk wrote:
>>> Dear "kevin.morf...@fearnside-systems.co.uk",
>>>
>>> In message<4b6d687f.2060...@fearnside-systems.co.uk>   you wrote:
>>>> The patches are split so that each patch makes only one type of change,
>>>> so there's only one thing that needs to be checked in each patch.
>>>>
>>>> - patches 1 and 2 only make white-space changes (the change was too big
>>>> so I had to split it into 2 patches)
>>> I think this should be merged into a single patch.
>>
>> OK. It'll be about 140K though so I'llput it on a web site.
>>
> IMO So it could be posted to the mailing list, it would be better to split.
>
> Was the whitespace changes done by hand or automatically with something
> like indent as mentioned http://www.denx.de/wiki/U-Boot/CodingStyle?

It was done automatically using Lindent but I had to do some manual
tidying up because Lindent doesn't always get things right.

Kevin

>
> Tom
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH ARM 4/4] Change s3c24x0 register struct members to lower case

2010-02-06 Thread kevin.morf...@fearnside-systems.co.uk


On 06/02/2010 16:35, Tom wrote:
> kevin.morf...@fearnside-systems.co.uk wrote:
>>
>>
>> On 06/02/2010 15:14, Tom wrote:
>>> kevin.morf...@fearnside-systems.co.uk wrote:
>>>> Hi Wolfgang
>>>>
>>>> On 06/02/2010 14:26, Wolfgang Denk wrote:
>>>>> Dear "kevin.morf...@fearnside-systems.co.uk",
>>>>>
>>>>> In message<4b6d687f.2060...@fearnside-systems.co.uk>you wrote:
>>>>>> The patches are split so that each patch makes only one type of
>>>>>> change,
>>>>>> so there's only one thing that needs to be checked in each patch.
>>>>>>
>>>>>> - patches 1 and 2 only make white-space changes (the change was too
>>>>>> big
>>>>>> so I had to split it into 2 patches)
>>>>> I think this should be merged into a single patch.
>>>>
>>>> OK. It'll be about 140K though so I'llput it on a web site.
>>>>
>>> IMO So it could be posted to the mailing list, it would be better to
>>> split.
>>>
>>> Was the whitespace changes done by hand or automatically with something
>>> like indent as mentioned http://www.denx.de/wiki/U-Boot/CodingStyle?
>>
>> It was done automatically using Lindent but I had to do some manual
>> tidying up because Lindent doesn't always get things right.
>
> Maybe a good way to spit the patch is
> 1. Lindent
> 2. Manual
> So reviewer could spend more attention on the much smaller #2.
> Would this be easy to do?

Thanks for the suggestion but I think it might make it harder to check.
The Lindent changes would still be > 100K so it would end up split into
3 patches, and the last patch would be changing code that was already
changed in patches 1 and 2.

I'd prefer to leave it split into two patches and submit it inline
really. Each of the two patches is independent - they change different
files.

Kevin
> Tom
>>
>> Kevin
>>
>>>
>>> Tom
>>>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH ARM 4/4] Change s3c24x0 register struct members to lower case

2010-02-07 Thread kevin.morf...@fearnside-systems.co.uk


On 07/02/2010 13:38, Minkyu Kang wrote:
> Dear Wolfgang and kevin,
>
> On 6 February 2010 23:24, Wolfgang Denk  wrote:
>> Dear Minkyu Kang,
>>
>> In message<1f3430fb1002060418ydd28583sb6051dd1517fa...@mail.gmail.com>  you 
>> wrote:
>>>
 Changes the names of the s3c24x0 register struct members from upper-case
 to lower-case.
>> ...
>>> Sorry for late reply.
>>> I tried to review your patch series,
>>> but your patch is too confusion, because of files are scattered in
>>> every patches.
>>
>> Well, but that's only natural, as the use of these names is scattered
>> all over the place.
>>
>>> If possible, could you please remake patches?
>>> Please make to one file's modification by one patch.
>>
>> This request makes no sense at all. If you change a variable name, you
>> *must* change all places where it hgets used within the same commit.
>
> Agreed,
> but I didn't mention about patch 4. (It's my mistake that I replied at
> this mail)
>
> I think patch1, 2 and 3 are same type of change (about code style).
> So, I want to merge these patches,
> can be see one file's modification by one patch.

Patches 1 and 2 contain only white-space changes and patch 3 contains
only code style changes (moving external function prototypes to header
files, removing unused code, making line lengths less than 81 characters,
brackets around if/then/else/when/do blocks, generally anything that
checkpatch.pl warns about). I can merge these together as long as
nobody objects to having white-space and code style changes in a
single patch?

Kevin

>
>>
>> The splitting you suggest would make things worse.
>>
>> Best regards,
>>
>> Wolfgang Denk
>>
>
> btw, I understood about kevin's concept.
> please rebase and resend the patch.
>
> Thanks.
> Minkyu Kang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH ARM 2/3 v2] s3c24x0 code style changes

2010-02-11 Thread kevin.morf...@fearnside-systems.co.uk
Hi Minkyu

Thanks for your comments...

On 11/02/2010 08:37, Minkyu Kang wrote:
> Dear Kevin Morfitt,
>
> On 11 February 2010 00:20, Kevin Morfitt
>   wrote:
>> Changes the s3c24x0 files to meet the code style requirements.
>>
>> Signed-off-by: Kevin Morfitt
>> ---
>>
>> v2 changes:
>> - re-number to be 2/3
>>
>> checkpatch.pl reports no errors.
>>
>>   board/MAI/AmigaOneG3SE/video.c|1 -
>>   board/mpl/common/common_util.h|1 +
>>   board/mpl/common/flash.c  |1 -
>>   board/mpl/vcma9/cmd_vcma9.c   |9 -
>>   board/mpl/vcma9/vcma9.c   |   27 ++--
>>   board/mpl/vcma9/vcma9.h   |6 +-
>>   board/samsung/smdk2400/smdk2400.c |   12 +-
>>   board/sbc2410x/sbc2410x.c |6 +-
>>   board/trab/auto_update.c  |   30 +---
>>   board/trab/cmd_trab.c |  213 +++-
>>   board/trab/rs485.c|   16 +-
>>   board/trab/trab.c |   43 ++---
>>   board/trab/trab.h |   38 +
>>   board/trab/trab_fkt.c |  331 
>> -
>>   board/trab/tsc2000.c  |   12 +-
>>   board/trab/tsc2000.h  |1 +
>>   board/trab/vfd.c  |   70 
>>   common/cmd_version.c  |2 -
>>   common/cmd_vfd.c  |2 -
>>   common/main.c |5 +-
>>   drivers/i2c/s3c24x0_i2c.c |   71 -
>>   drivers/video/cfb_console.c   |1 -
>>   include/common.h  |   14 ++
>>   lib_generic/display_options.c |2 -
>>   24 files changed, 418 insertions(+), 496 deletions(-)
>>   create mode 100644 board/trab/trab.h
>>

>>
>> -extern void print_vcma9_info(void);
>> -extern int vcma9_cantest(int);
>> -extern int vcma9_nandtest(void);
>> -extern int vcma9_nanderase(void);
>> -extern int vcma9_nandread(ulong);
>> -extern int vcma9_nandwrite(ulong);
>> -extern int vcma9_dactest(int);
>> -extern int do_mplcommon(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
>> -
>>   /* 
>> - */
>>
>
> removing extern functions and values are ok.
> but I wonder if it occur compile warnings.
> Did you test it?

I added a new file, trab.h, with the function prototypes for the
external functions. There were no new build warnings.

>
>>   int do_vcma9(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
>> diff --git a/board/mpl/vcma9/vcma9.c b/board/mpl/vcma9/vcma9.c
>> index 9a7c0fa..5401664 100644
>> --- a/board/mpl/vcma9/vcma9.c
>> +++ b/board/mpl/vcma9/vcma9.c
>> @@ -137,22 +137,19 @@ int board_init(void)
>>   * NAND flash initialization.
>>   */
>>   #if defined(CONFIG_CMD_NAND)
>> -extern ulong
>> -nand_probe(ulong physadr);
>> -
>> -
>>   static inline void NF_Reset(void)
>>   {
>> int i;
>>
>> NF_SetCE(NFCE_LOW);
>> -   NF_Cmd(0xFF);   /* reset command */
>> -   for (i = 0; i<  10; i++);   /* tWB = 100ns. */
>> -   NF_WaitRB();/* wait 200~500us; */
>> +   NF_Cmd(0xFF);   /* reset command */
>> +   /* tWB = 100ns. */
>> +   for (i = 0; i<  10; i++)
>> +   /* delay */;
>> +   NF_WaitRB();/* wait 200~500us; */
>> NF_SetCE(NFCE_HIGH);
>>   }
>>

>>   static u8 Get_PLD_Revision(void)
>>   {
>> -   return (Get_PLD_ID()&  0x0F);
>> +   return Get_PLD_ID()&  0x0F;
>>   }
>>
>>   static uchar Get_Board_PCB(void)
>>   {
>> -   return (((Get_PLD_BOARD()>>  4)&  0x03) + 'A');
>> +   return ((Get_PLD_BOARD()>>  4)&  0x03) + 'A';
>>   }
>>
>>   static u8 Get_SDRAM_ChipNr(void)
>
> Do you have plan for clean up such upper case function names?

I didn't notice those, probably because checkpatch doesn't warn about
them. I'll change it.

>
>> @@ -307,7 +304,7 @@ int checkboard(void)
>> s[5] = 0;
>> Show_VCMA9_Info(s,&s[6]);
>> }
>> -   return (0);
>> +   return 0;
>>   }
>>
>>   int last_stage_init(void)
>> diff --git a/board/mpl/vcma9/vcma9.h b/board/mpl/vcma9/vcma9.h
>> index e1ec1fe..adc7673 100644
>> --- a/board/mpl/vcma9/vcma9.h
>> +++ b/board/mpl/vcma9/vcma9.h
>> @@ -27,7 +27,8 @@
>>
>>   #include
>>
>> -extern int mem_test(unsigned long start, unsigned long ramsize, int mode);
>> +int mem_test(unsigned long start, unsigned long ramsize, int mode);
>> +int vcma9_cantest(int);
>>   void print_vcma9_info(void);
>>
>>   #if defined(CONFIG_CMD_NAND)
>> @@ -81,7 +82,8 @@ static inline void NF_WaitRB(void)
>>   {
>> struct s3c2410_nand * const nand = s3c2410_get_base_nand();
>>
>> -   while (!(nand->NFSTAT&  (1<<  0)));
>> +   while (!(nand->NFSTAT&  (1<<  0)))
>> +   /* Wait */;
>>   }
>>
>>   static inline void NF_Write(u8 data)
>> diff --git a/board/samsung/smdk2400/smdk2400.c 
>> b/board/samsung/smdk2400/smdk2400.c
>> index 5825ce9..a1b0e0c 100644
>> --- a/board/samsung/smdk2400/smdk2400.c

Re: [U-Boot] [PATCH-ARM] CONFIG_SYS_HZ fix for ARM902T S3C24X0 Boards

2009-09-07 Thread kevin.morf...@fearnside-systems.co.uk


On 07/09/2009 22:47, Wolfgang Denk wrote:
> Dear "kevin.morf...@fearnside-systems.co.uk",
> 
> In message <4aa284b9.8030...@fearnside-systems.co.uk> you wrote:
>> This sets CONFIG_SYS_HZ to 1000 for all boards that use the s3c2400 and
>> s3c2410 cpu's which fixes various problems such as the timeouts in tftp being
>> too short.
> 
> I still wonder if this is really an issue. Some s3c2400 based boards
> have been in production use for several years, with volumes of many
> thousands of devices per year. Yet no TFTP timeout issues have been
> reported ever.
> 
>> This affects the sbc2410, smdk2400, smdk2410 and trab boards. I've copied it
>> directly to the maintainers of all except the sbc2410 which doesn't have an
>> entry in MAINTAINERS.
> 
> I tested it on trab, and I don't see any changes - both U-Boot and
> Linux still work as they always used to work.
> 
> Tested-by: Wolfgang Denk 
> 
> Best regards,
> 
> Wolfgang Denk
> 

I think there were no problems because CONFIG_SYS_HZ was set to values that
worked for each of the s3c24x0 boards. I only submitted the patch because my
first attempt at a patch for the Embest SBC2440-II was NAK-ed because I'd set
CONFIG_SYS_HZ to the original sbc2410x setting of 1562500 (which worked) - there
was a global change going through to set CONFIG_SYS_HZ to 1000 for all boards
though I'm not sure what the reason was.

I'm happy to withdraw the patch if it's OK to set CONFIG_SYS_HZ to a different
value than 1000?


__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4403 (20090907) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH-ARM] CONFIG_SYS_HZ fix for ARM902T S3C24X0 Boards

2009-09-07 Thread kevin.morf...@fearnside-systems.co.uk


On 07/09/2009 23:18, Wolfgang Denk wrote:
> Dear "kevin.morf...@fearnside-systems.co.uk",
> 
> In message <4aa583ac.3050...@fearnside-systems.co.uk> you wrote:
>>> In message <4aa284b9.8030...@fearnside-systems.co.uk> you wrote:
>>>> This sets CONFIG_SYS_HZ to 1000 for all boards that use the s3c2400 and
>>>> s3c2410 cpu's which fixes various problems such as the timeouts in tftp 
>>>> being
>>>> too short.
>>> I still wonder if this is really an issue. Some s3c2400 based boards
>>> have been in production use for several years, with volumes of many
>>> thousands of devices per year. Yet no TFTP timeout issues have been
>>> reported ever.
> ...
>> I think there were no problems because CONFIG_SYS_HZ was set to values that
>> worked for each of the s3c24x0 boards. I only submitted the patch because my
> 
> I'm confused - above you write "various problems such as the timeouts
> in tftp being too short", now you write: "there were no problems".
> 
> Which one is correct?
> 

When I ported the SBC2440-II Board based on the existing sbc2410x code without
applying this patch the tftp timeouts were too short. When I apply this patch as
part of the SBC2440-II port the tftp timeouts are OK.

I haven't got any other s3c24x0 boards so I don't know whether they do have tftp
timeout problems or not, I only know that I saw them on my SBC2440-II port. My
comment "there were no problems" was based on you saying "Yet no TFTP timeout
issues have been reported ever".

Best Regards
Kevin Morfitt

>> I'm happy to withdraw the patch if it's OK to set CONFIG_SYS_HZ to a 
>> different
>> value than 1000?
> 
> CONFIG_SYS_HZ is a constant with the value 1000. Board that use
> different values shall be fixed.
> 
> Best regards,
> 
> Wolfgang Denk
> 



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4403 (20090907) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] lowlevel_init.s for ARM920t/S3C2410

2009-09-17 Thread kevin.morf...@fearnside-systems.co.uk


J.Hwan.Kim wrote:
> Hi, everyone
> 
> I'm running u-boot (2009.03) in S3C2410 board now.
> But I have a problem.
> 
> It seems that "bl lowlevel_init" routine in ARM920t/start.s is not working.
> The label, lowlevel_init, is  defined as global label in 
> /board/samsung/s3c2410/lowlevel_init.s
> and is seen system.map file.
> 
> I think the code does not jump to lowlevel_init in 
> /board/samsung/s3c2410/lowlevel_init.S from start.S
> When I copy lowlevel_init subroutine into ARM920t/start.S instead of "bl 
> lowlevel_init",
> it does work.
> 
> Why does the "bl lowlevel_init" not work?
> 
> How can  I solve this problem ?
> 
> Thanks in advance.
> 
> Regards,
> J.Hwan Kim
> 
> 
> 
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
> 

Hi

I wonder if your board is booting from NAND flash? If it is, then at start-up
the s3c2410's Steppingstone feature will read a 4Kb block of data from the base
of NAND flash to the base of RAM bank 0 then jump to the base of that RAM bank.
The idea is that the first 4Kb of the code in NAND flash should contain a small
code loader that initialises the NAND flash controller, reads the rest of the
code from NAND flash into RAM, and then executes it. This will only work if the
whole of this code loader is forced into the first 4Kb at link time.

Unfortunately u-boot for s3c2410 doesn't support this at the moment, it only
really supports booting from NOR flash. I've just done a build for the s3c2410x
board and looking at the link map the start.S code is located at the linker base
address of 0x33f8, but lowlevel_init.S is linked at 0x33f91610, so
lowlevel_init.S isn't in the first 4Kb of the u-boot image and it won't get
loaded into RAM at start-up. When the Steppingstone function loads the first
4Kb of NAND flash into RAM at start-up it will have loaded start.S but not
lowlevel_init.S, so when start.S branches to the RAM address where lowlevel_init
should be lowlevel_init won't be there and it will crash.

When you copied lowlevel_init into start.S the "bl lowlevel_init" worked because
this forced it to be linked into the bottom 4Kb of code, but I'm guessing that
u-boot still didn't work because u-boot for s3c2410 doesn't contain any code
that reads the rest of u-boot from NAND flash to RAM

The simplest way around this would be to load u-boot into NOR flash and
configure the board jumpers to boot from NOR flash, not NAND flash. Then u-boot
would just copy itself from NOR flash to RAM at start-up and would boot 
normally.

Alternatively, I have seen some unofficial u-boot ports for s3c24x0 cpu's that
do support u-boot booting from NAND flash but I don't have the source code for 
them.

Regards
Kevin Morfitt


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] nand_scan() in ARM9 S3C2410

2009-09-21 Thread kevin.morf...@fearnside-systems.co.uk


Minkyu Kang wrote:
> Dear J.Hwan.Kim
> 
> 2009/9/20 J.Hwan.Kim :
>> Hi, everyone
>>
>> I'm using u-boot for ARM9 S3C2410.
>> My tool chain is ELDK4.2.
>>
>> I defined configuration "CONFIG_NAND_CMD,
>> CONFIG_SYS_MAX_NAND_DEVICE1,
>> and CONFIG_SYS_NAND_BASE 0x4E0C" for nand_init().
>>
>> It works well until the routine reaches nand_scan() which is in nand_base.c
>> When nand_scan() is called, the system hangs.
>>
>> For test, When I written dummy function is nand_base.c and
>> called the dummy function from nand.c, the system is down.
>>
>> My u-boot is using relocation to SDRAM from NAND.
>> The address of nand_scan() is 0x31F85894.
>> (TEXT_BASE is 0x31F8  and SDRAM start from 0x3000)
>> I'm sured that the binary data of u-boot.bin (address 0x5894) is same
>> with SDRAM data in 0x31F85894.
>> I think the relocation is  OK.
>>
>> When I attached the routines of nand_base.c to nand.c,
>> the nand_scan() function passed.
>>
>> Is there any hint for this problem?
>>
>> Thanks in advnace.
>>
>> Regards,
>> J.Hwan Kim
>>
>>
>>
>>
>>
>>
>> ___
>> U-Boot mailing list
>> U-Boot@lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
>>
> 
> Did you check the kevin's mail?
> He said "u-boot for s3c2410 doesn't support".
> http://lists.denx.de/pipermail/u-boot/2009-September/060855.html
> 
u-boot for s3c2410 doesn't support booting from NAND flash, but assuming you
boot from NOR flash and have NAND enabled properly in the board config file it
does support the use of NAND flash.

In the NAND config you show in your email, it's probably a typo but it should be
CONFIG_CMD_NAND not CONFIG_NAND_CMD.

If that's not the problem - I'm not sure what board you're using. If you're
using an existing config file post the name of it, or if you're using one you've
created post the board config file itself.

Regards
Kevin Morfitt

> And I think.. you can trace nand_scan() step by step.
> please try it and do more detailed question.
> 
> Thanks
> Minkyu Kang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH-ARM 4/4, v2] Clean-up of s3c24x0 nand driver]

2009-09-26 Thread kevin.morf...@fearnside-systems.co.uk
Changes since v1:
- re-formatted patch to remove line wrapping

Note that patch 2/4 of this series has not changed.

This patch re-formats the arm920t s3c24x0 nand driver in preparation for changes
to add support for the Embest SBC2440-II Board.

The changes are as follows:
- re-indent the code using Lindent
- make sure register layouts are defined using a C struct
- replace the upper-case typedef'ed C struct names with lower case
non-typedef'ed ones
- make sure registers are accessed using the proper accessor functions
- run checkpatch.pl and fix any error reports

It assumes the following patch has been applied first:
- [U-Boot][PATCH-ARM] CONFIG_SYS_HZ fix for ARM902T S3C24X0 Boards, 05/09/2009
 - patches 1/4, 2/4 and 3/4 of this series

Tested on an Embest SBC2440-II Board with local u-boot patches as I don't have
any s3c2400 or s3c2410 boards but need this patch applying before I can submit
patches for the SBC2440-II Board. Also, temporarily modified sbc2410x, smdk2400,
smdk2410 and trab configs to use the mtd nand driver (which isn't used by any
board at the moment), ran MAKEALL for all ARM9 targets and no new warnings or
errors were found.

Signed-off-by: Kevin Morfitt 
---
 drivers/mtd/nand/s3c2410_nand.c |   62 +++---
 1 files changed, 25 insertions(+), 37 deletions(-)

diff --git a/drivers/mtd/nand/s3c2410_nand.c b/drivers/mtd/nand/s3c2410_nand.c
index d27a625..f2f3e72 100644
--- a/drivers/mtd/nand/s3c2410_nand.c
+++ b/drivers/mtd/nand/s3c2410_nand.c
@@ -20,29 +20,10 @@
 
 #include 
 
-#if 0
-#define DEBUGN printf
-#else
-#define DEBUGN(x, args ...) {}
-#endif
-
 #include 
 #include 
 #include 
 
-#define __REGb(x)  (*(volatile unsigned char *)(x))
-#define __REGi(x)  (*(volatile unsigned int *)(x))
-
-#defineNF_BASE 0x4e00
-#defineNFCONF  __REGi(NF_BASE + 0x0)
-#defineNFCMD   __REGb(NF_BASE + 0x4)
-#defineNFADDR  __REGb(NF_BASE + 0x8)
-#defineNFDATA  __REGb(NF_BASE + 0xc)
-#defineNFSTAT  __REGb(NF_BASE + 0x10)
-#define NFECC0 __REGb(NF_BASE + 0x14)
-#define NFECC1 __REGb(NF_BASE + 0x15)
-#define NFECC2 __REGb(NF_BASE + 0x16)
-
 #define S3C2410_NFCONF_EN  (1<<15)
 #define S3C2410_NFCONF_512BYTE (1<<14)
 #define S3C2410_NFCONF_4STEP   (1<<13)
@@ -58,11 +39,12 @@
 static void s3c2410_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
 {
struct nand_chip *chip = mtd->priv;
+   struct s3c2410_nand *nand = s3c2410_get_base_nand();
 
-   DEBUGN("hwcontrol(): 0x%02x 0x%02x\n", cmd, ctrl);
+   debugX(1, "hwcontrol(): 0x%02x 0x%02x\n", cmd, ctrl);
 
if (ctrl & NAND_CTRL_CHANGE) {
-   ulong IO_ADDR_W = NF_BASE;
+   ulong IO_ADDR_W = (ulong)nand;
 
if (!(ctrl & NAND_CLE))
IO_ADDR_W |= S3C2410_ADDR_NCLE;
@@ -72,9 +54,11 @@ static void s3c2410_hwcontrol(struct mtd_info *mtd, int cmd, 
unsigned int ctrl)
chip->IO_ADDR_W = (void *)IO_ADDR_W;
 
if (ctrl & NAND_NCE)
-   NFCONF &= ~S3C2410_NFCONF_nFCE;
+   writel(readl(&nand->NFCONF) & ~S3C2410_NFCONF_nFCE,
+  &nand->NFCONF);
else
-   NFCONF |= S3C2410_NFCONF_nFCE;
+   writel(readl(&nand->NFCONF) | S3C2410_NFCONF_nFCE,
+  &nand->NFCONF);
}
 
if (cmd != NAND_CMD_NONE)
@@ -83,15 +67,17 @@ static void s3c2410_hwcontrol(struct mtd_info *mtd, int 
cmd, unsigned int ctrl)
 
 static int s3c2410_dev_ready(struct mtd_info *mtd)
 {
-   DEBUGN("dev_ready\n");
-   return (NFSTAT & 0x01);
+   struct s3c2410_nand *nand = s3c2410_get_base_nand();
+   debugX(1, "dev_ready\n");
+   return readl(&nand->NFSTAT) & 0x01;
 }
 
 #ifdef CONFIG_S3C2410_NAND_HWECC
 void s3c2410_nand_enable_hwecc(struct mtd_info *mtd, int mode)
 {
-   DEBUGN("s3c2410_nand_enable_hwecc(%p, %d)\n", mtd, mode);
-   NFCONF |= S3C2410_NFCONF_INITECC;
+   struct s3c2410_nand *nand = s3c2410_get_base_nand();
+   debugX(1, "s3c2410_nand_enable_hwecc(%p, %d)\n", mtd, mode);
+   writel(readl(&nand->NFCONF) | S3C2410_NFCONF_INITECC, &nand->NFCONF);
 }
 
 static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
@@ -100,8 +86,8 @@ static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, 
const u_char *dat,
ecc_code[0] = NFECC0;
ecc_code[1] = NFECC1;
ecc_code[2] = NFECC2;
-   DEBUGN("s3c2410_nand_calculate_hwecc(%p,): 0x%02x 0x%02x 0x%02x\n",
-   mtd , ecc_code[0], ecc_code[1], ecc_code[2]);
+   debugX(1, "s3c2410_nand_calculate_hwecc(%p,): 0x%02x 0x%02x 0x%02x\n",
+  mtd , ecc_code[0], ecc_code[1], ecc_code[2]);
 
return 0;
 }
@@ -123,24 +109,26 @@ int board_nand_init(struct nand_chip *nand)
 {
u_int32_t cfg;

[U-Boot] [PATCH-ARM 3/4, v2] Clean-up of s3c24x0 drivers excluding nand driver

2009-09-26 Thread kevin.morf...@fearnside-systems.co.uk
Changes since v1:
- re-formatted patch to remove line wrapping

Note that patch 2/4 of this series has not changed.

This patch re-formats the arm920t s3c24x0 driver files, excluding the nand
driver, in preparation for changes to add support for the Embest SBC2440-II 
Board.

The changes are as follows:
- re-indent the code using Lindent
- make sure register layouts are defined using a C struct
- replace the upper-case typedef'ed C struct names with lower case
  non-typedef'ed ones
- make sure registers are accessed using the proper accessor functions
- run checkpatch.pl and fix any error reports

It assumes the following patch has been applied first:
- [U-Boot][PATCH-ARM] CONFIG_SYS_HZ fix for ARM902T S3C24X0 Boards, 05/09/2009
- patches 1/4 and 2/4 of this series

Tested on an Embest SBC2440-II Board with local u-boot patches as I don't have
any s3c2400 or s3c2410 boards but need this patch applying before I can submit
patches for the SBC2440-II Board. Also, temporarily modified sbc2410x, smdk2400,
smdk2410 and trab configs to use the mtd nand driver (which isn't used by any
board at the moment), ran MAKEALL for all ARM9 targets and no new warnings or
errors were found.

Signed-off-by: Kevin Morfitt 
---
 board/mpl/vcma9/vcma9.c   |   13 +-
 board/mpl/vcma9/vcma9.h   |   20 ++--
 board/samsung/smdk2400/smdk2400.c |5 +-
 board/samsung/smdk2410/smdk2410.c |5 +-
 board/sbc2410x/sbc2410x.c |7 +-
 board/trab/cmd_trab.c |   12 +-
 board/trab/rs485.c|   12 +-
 board/trab/trab.c |   17 ++-
 board/trab/trab_fkt.c |   26 ++--
 board/trab/tsc2000.c  |   17 ++-
 board/trab/tsc2000.h  |4 +-
 board/trab/vfd.c  |   12 +-
 drivers/i2c/s3c24x0_i2c.c |  273 +++--
 drivers/rtc/s3c24x0_rtc.c |  130 +-
 drivers/serial/serial_s3c24x0.c   |  160 --
 15 files changed, 374 insertions(+), 339 deletions(-)

diff --git a/board/mpl/vcma9/vcma9.c b/board/mpl/vcma9/vcma9.c
index 3216d63..ed4df17 100644
--- a/board/mpl/vcma9/vcma9.c
+++ b/board/mpl/vcma9/vcma9.c
@@ -73,8 +73,9 @@ static inline void delay(unsigned long loops)
 
 int board_init(void)
 {
-   S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
-   S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
+   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 = 0xFF;
@@ -174,7 +175,7 @@ static inline void NF_Init(void)
 void
 nand_init(void)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = s3c2410_get_base_nand();
 
NF_Init();
 #ifdef DEBUG
@@ -190,21 +191,21 @@ nand_init(void)
 
 static u8 Get_PLD_ID(void)
 {
-   VCMA9_PLD * const pld = VCMA9_GetBase_PLD();
+   VCMA9_PLD * const pld = VCMA9_get_base_PLD();
 
return(pld->ID);
 }
 
 static u8 Get_PLD_BOARD(void)
 {
-   VCMA9_PLD * const pld = VCMA9_GetBase_PLD();
+   VCMA9_PLD * const pld = VCMA9_get_base_PLD();
 
return(pld->BOARD);
 }
 
 static u8 Get_PLD_SDRAM(void)
 {
-   VCMA9_PLD * const pld = VCMA9_GetBase_PLD();
+   VCMA9_PLD * const pld = VCMA9_get_base_PLD();
 
return(pld->SDRAM);
 }
diff --git a/board/mpl/vcma9/vcma9.h b/board/mpl/vcma9/vcma9.h
index 220b705..566448f 100644
--- a/board/mpl/vcma9/vcma9.h
+++ b/board/mpl/vcma9/vcma9.h
@@ -39,14 +39,14 @@ typedef enum {
 
 static inline void NF_Conf(u16 conf)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = s3c2410_get_base_nand();
 
nand->NFCONF = conf;
 }
 
 static inline void NF_Cmd(u8 cmd)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = s3c2410_get_base_nand();
 
nand->NFCMD = cmd;
 }
@@ -59,14 +59,14 @@ static inline void NF_CmdW(u8 cmd)
 
 static inline void NF_Addr(u8 addr)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = s3c2410_get_base_nand();
 
nand->NFADDR = addr;
 }
 
 static inline void NF_SetCE(NFCE_STATE s)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = s3c2410_get_base_nand();
 
switch (s) {
case NFCE_LOW:
@@ -81,35 +81,35 @@ static inline void NF_SetCE(NFCE_STATE s)
 
 static inline void NF_WaitRB(void)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = s3c2410_get_base_nand();
 
while (!(nand->NFSTAT & (1<<0)));
 }
 
 static inline void NF_Write(u8 data)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   stru

Re: [U-Boot] [PATCH-ARM 1/4, v2] Clean-up of cpu_arm920t and cpu_arm920t_s3c24x0 code

2009-10-02 Thread kevin.morf...@fearnside-systems.co.uk


Minkyu Kang wrote:
> Dear kevin Morfitt
> 
> sorry for blank message
> 
> 2009/9/30 Minkyu Kang :
>> Dear Kevin Morfitt
>>
>> 2009/9/26 kevin.morf...@fearnside-systems.co.uk
>> :
>>> Changes since v1:
>>> - re-formatted patch to remove line wrapping
>>>
>>> Note that patch 2/4 of this series has not changed.
>>>
>>> This patch re-formats the code in cpu/arm920t and cpu/arm920t/23c24x0 in
>>> preparation for changes to add support for the Embest SBC2440-II Board.
>>>
>>> The changes are as follows:
>>> - re-indent the code using Lindent
>>> - make sure register layouts are defined using a C struct
>>> - replace the upper-case typedef'ed C struct names with lower case
>>>  non-typedef'ed ones
>>> - make sure registers are accessed using the proper accessor functions
>>> - run checkpatch.pl and fix any error reports
>>>
>>> Note that usb_ohci.c still has two lines that exceed 80 characters. This is
>>> because the statements on those lines lose readability when wrapped - the 
>>> Linux
>>> coding style guidelines allow for this.
>>>
>>> It assumes the following patch has been applied first:
>>> - [U-Boot][PATCH-ARM] CONFIG_SYS_HZ fix for ARM902T S3C24X0 Boards, 
>>> 05/09/2009
>>>
>>> Tested on an Embest SBC2440-II Board with local u-boot patches as I don't 
>>> have
>>> any s3c2400 or s3c2410 boards but need this patch applying before I can 
>>> submit
>>> patches for the SBC2440-II Board. Also, ran MAKEALL for all ARM9 targets 
>>> and no
>>> new warnings or errors were found.
>>>
>>> Signed-off-by: Kevin Morfitt 
>>> ---
>>>  cpu/arm920t/s3c24x0/interrupts.c |2 +-
>>>  cpu/arm920t/s3c24x0/speed.c  |   42 +-
>>>  cpu/arm920t/s3c24x0/timer.c  |   74 ++-
>>>  cpu/arm920t/s3c24x0/usb.c|   30 +-
>>>  cpu/arm920t/s3c24x0/usb_ohci.c   | 1268 
>>> --
>>>  cpu/arm920t/s3c24x0/usb_ohci.h   |  187 +++---
>>>  cpu/arm920t/start.S  |   63 +-
>>>  7 files changed, 873 insertions(+), 793 deletions(-)
>>>
> 
> I didn't see all of your patch.

Here are links to the patches and notes on their states:
- [U-boot] [PATCH-ARM] CONFIG_SYS_HZ change for cpu/arm920t/s3c24x0 boards:
  http://lists.denx.de/pipermail/u-boot/2009-September/thread.html, 
  JP said it looked OK but needed testing, then it was tested by Wolfgang
- [U-Boot] [PATCH-ARM 1/4, v2] Clean-up of cpu/arm920t and 
  cpu/arm920t/s3c24x0 code (this patch): one comment so far (your own)
- [U-Boot] [PATCH-ARM 2/4] Clean-up of s3c24x0 header files:
  http://lists.denx.de/pipermail/u-boot/2009-September/060111.html, 
  no comments as yet
- [U-Boot] [PATCH-ARM 3/4, v2] Clean-up of s3c24x0 drivers excluding nand 
  driver, http://lists.denx.de/pipermail/u-boot/2009-September/061583.html,
  one comment by Gaye Abdoulaye Walsimou, fixed in v2
- [U-Boot] [PATCH-ARM 4/4, v2] Clean-up of s3c24x0 nand driver,
  http://lists.denx.de/pipermail/u-boot/2009-September/061584.html,
  v1 was Acked by Scott here - 
  http://lists.denx.de/pipermail/u-boot/2009-September/060580.html

> But there are remained more works for cleaning

My aim is to clean up just the s3c24x0 common code so I can later add support 
for the Embest SBC2440-II Board. I can see that the rest of the arm920t code 
also needs cleaning but this would be a much bigger job and could be done 
later - I'd rather limit these patches to s3c24x0 code. 

> please use lower case name at C structure's members and functions

I think I have changed all structure names to lower case in the s3c24x0 code.
I also think I've changed all function names to lower case except where
the change would affect too many other areas - for example, if I change 
get_HCLK() to get_hclk() in cpu/arm920t/s3c24x0/speed.c I'd also need to 
change the same in include/common.h, cpu/lh7a40x, arm920t/imx and 
arm1176/s3c64xx and all functions that call get_HCLK() throughout u-boot. 
Again, this does need doing but could be done later.

Regards
Kevin

> 
> Thanks
> Minkyu Kang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH-ARM 1/4, v2] Clean-up of cpu_arm920t and cpu_arm920t_s3c24x0 code

2009-10-06 Thread kevin.morf...@fearnside-systems.co.uk


Abdoulaye Walsimou Gaye wrote:
> kevin.morf...@fearnside-systems.co.uk a écrit :
>> Here are links to the patches and notes on their states:
>> - [U-boot] [PATCH-ARM] CONFIG_SYS_HZ change for cpu/arm920t/s3c24x0 boards:
>>   http://lists.denx.de/pipermail/u-boot/2009-September/thread.html, 
>>   JP said it looked OK but needed testing, then it was tested by Wolfgang
>> - [U-Boot] [PATCH-ARM 1/4, v2] Clean-up of cpu/arm920t and 
>>   cpu/arm920t/s3c24x0 code (this patch): one comment so far (your own)
>> - [U-Boot] [PATCH-ARM 2/4] Clean-up of s3c24x0 header files:
>>   http://lists.denx.de/pipermail/u-boot/2009-September/060111.html, 
>>   no comments as yet
>> - [U-Boot] [PATCH-ARM 3/4, v2] Clean-up of s3c24x0 drivers excluding nand 
>>   driver, http://lists.denx.de/pipermail/u-boot/2009-September/061583.html,
>>   one comment by Gaye Abdoulaye Walsimou, fixed in v2
>> - [U-Boot] [PATCH-ARM 4/4, v2] Clean-up of s3c24x0 nand driver,
>>   http://lists.denx.de/pipermail/u-boot/2009-September/061584.html,
>>   v1 was Acked by Scott here - 
>>   http://lists.denx.de/pipermail/u-boot/2009-September/060580.html
>>
>>   
>>> But there are remained more works for cleaning
>>> 
>> My aim is to clean up just the s3c24x0 common code so I can later add 
>> support 
>> for the Embest SBC2440-II Board. I can see that the rest of the arm920t code 
>> also needs cleaning but this would be a much bigger job and could be done 
>> later - I'd rather limit these patches to s3c24x0 code. 
>>
>>   
>>> please use lower case name at C structure's members and functions
>>> 
>> I think I have changed all structure names to lower case in the s3c24x0 code.
>> I also think I've changed all function names to lower case except where
>> the change would affect too many other areas - for example, if I change 
>> get_HCLK() to get_hclk() in cpu/arm920t/s3c24x0/speed.c I'd also need to 
>> change the same in include/common.h, cpu/lh7a40x, arm920t/imx and 
>> arm1176/s3c64xx and all functions that call get_HCLK() throughout u-boot. 
>> Again, this does need doing but could be done later.
>>   
> Kevin,
> As nobody seems to have an objection about your changes, I think you can 
> just go ahead and make available
> changes to support s3c2440 and your board.
> 
I've missed the merge window for this u-boot release so I may as well 
submit the s3c2440 and sbc2440-ii board patches after this release.

So far only 1 of the 5 existing patches has been Ack-ed and 1 tested so
I need to get them all accepted by the Samsung ARM custodian for this 
release.

> Cheers,
> 
> 
> 

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH-ARM 3/4, v3] Clean-up of s3c24x0 drivers excluding nand driver

2009-10-09 Thread kevin.morf...@fearnside-systems.co.uk
This patch re-formats the arm920t s3c24x0 driver files, excluding the nand
driver, in preparation for changes to add support for the Embest SBC2440-II 
Board.

The changes are as follows:
- re-indent the code using Lindent
- make sure register layouts are defined using a C struct
- replace the upper-case typedef'ed C struct names with lower case
  non-typedef'ed ones
- make sure registers are accessed using the proper accessor functions
- run checkpatch.pl and fix any error reports

It assumes the following patch has been applied first:
- [U-Boot][PATCH-ARM] CONFIG_SYS_HZ fix for ARM902T S3C24X0 Boards, 05/09/2009
- patches 1/4 and 2/4 of this series

Tested on an Embest SBC2440-II Board with local u-boot patches as I don't have
any s3c2400 or s3c2410 boards but need this patch applying before I can submit
patches for the SBC2440-II Board. Also, temporarily modified sbc2410x, smdk2400,
smdk2410 and trab configs to use the mtd nand driver (which isn't used by any
board at the moment), ran MAKEALL for all ARM9 targets and no new warnings or
errors were found.

Signed-off-by: Kevin Morfitt 
---

Changes in v2: re-formatted patch to remove line wrapping
Changes in v3: removed checkpatch.pl errors
   moved change log

 board/mpl/vcma9/vcma9.c   |   13 +-
 board/mpl/vcma9/vcma9.h   |   20 ++--
 board/samsung/smdk2400/smdk2400.c |5 +-
 board/samsung/smdk2410/smdk2410.c |5 +-
 board/sbc2410x/sbc2410x.c |7 +-
 board/trab/cmd_trab.c |   12 +-
 board/trab/rs485.c|   12 +-
 board/trab/trab.c |   17 ++-
 board/trab/trab_fkt.c |   26 ++--
 board/trab/tsc2000.c  |   17 ++-
 board/trab/tsc2000.h  |4 +-
 board/trab/vfd.c  |   12 +-
 drivers/i2c/s3c24x0_i2c.c |  273 +++--
 drivers/rtc/s3c24x0_rtc.c |  130 +-
 drivers/serial/serial_s3c24x0.c   |  160 --
 15 files changed, 374 insertions(+), 339 deletions(-)

diff --git a/board/mpl/vcma9/vcma9.c b/board/mpl/vcma9/vcma9.c
index 3216d63..ed4df17 100644
--- a/board/mpl/vcma9/vcma9.c
+++ b/board/mpl/vcma9/vcma9.c
@@ -73,8 +73,9 @@ static inline void delay(unsigned long loops)
 
 int board_init(void)
 {
-   S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
-   S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
+   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 = 0xFF;
@@ -174,7 +175,7 @@ static inline void NF_Init(void)
 void
 nand_init(void)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = s3c2410_get_base_nand();
 
NF_Init();
 #ifdef DEBUG
@@ -190,21 +191,21 @@ nand_init(void)
 
 static u8 Get_PLD_ID(void)
 {
-   VCMA9_PLD * const pld = VCMA9_GetBase_PLD();
+   VCMA9_PLD * const pld = VCMA9_get_base_PLD();
 
return(pld->ID);
 }
 
 static u8 Get_PLD_BOARD(void)
 {
-   VCMA9_PLD * const pld = VCMA9_GetBase_PLD();
+   VCMA9_PLD * const pld = VCMA9_get_base_PLD();
 
return(pld->BOARD);
 }
 
 static u8 Get_PLD_SDRAM(void)
 {
-   VCMA9_PLD * const pld = VCMA9_GetBase_PLD();
+   VCMA9_PLD * const pld = VCMA9_get_base_PLD();
 
return(pld->SDRAM);
 }
diff --git a/board/mpl/vcma9/vcma9.h b/board/mpl/vcma9/vcma9.h
index 220b705..566448f 100644
--- a/board/mpl/vcma9/vcma9.h
+++ b/board/mpl/vcma9/vcma9.h
@@ -39,14 +39,14 @@ typedef enum {
 
 static inline void NF_Conf(u16 conf)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = s3c2410_get_base_nand();
 
nand->NFCONF = conf;
 }
 
 static inline void NF_Cmd(u8 cmd)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = s3c2410_get_base_nand();
 
nand->NFCMD = cmd;
 }
@@ -59,14 +59,14 @@ static inline void NF_CmdW(u8 cmd)
 
 static inline void NF_Addr(u8 addr)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = s3c2410_get_base_nand();
 
nand->NFADDR = addr;
 }
 
 static inline void NF_SetCE(NFCE_STATE s)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = s3c2410_get_base_nand();
 
switch (s) {
case NFCE_LOW:
@@ -81,35 +81,35 @@ static inline void NF_SetCE(NFCE_STATE s)
 
 static inline void NF_WaitRB(void)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = s3c2410_get_base_nand();
 
while (!(nand->NFSTAT & (1<<0)));
 }
 
 static inline void NF_Write(u8 data)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_N

[U-Boot] [PATCH-ARM 4/4, v3] Clean-up of s3c24x0 nand driver]

2009-10-09 Thread kevin.morf...@fearnside-systems.co.uk
This patch re-formats the arm920t s3c24x0 nand driver in preparation for changes
to add support for the Embest SBC2440-II Board.

The changes are as follows:
- re-indent the code using Lindent
- make sure register layouts are defined using a C struct
- replace the upper-case typedef'ed C struct names with lower case
non-typedef'ed ones
- make sure registers are accessed using the proper accessor functions
- run checkpatch.pl and fix any error reports

It assumes the following patch has been applied first:
- [U-Boot][PATCH-ARM] CONFIG_SYS_HZ fix for ARM902T S3C24X0 Boards, 05/09/2009
 - patches 1/4, 2/4 and 3/4 of this series

Tested on an Embest SBC2440-II Board with local u-boot patches as I don't have
any s3c2400 or s3c2410 boards but need this patch applying before I can submit
patches for the SBC2440-II Board. Also, temporarily modified sbc2410x, smdk2400,
smdk2410 and trab configs to use the mtd nand driver (which isn't used by any
board at the moment), ran MAKEALL for all ARM9 targets and no new warnings or
errors were found.

Signed-off-by: Kevin Morfitt 
---

Changes in v2: re-formatted patch to remove line wrapping
Changes in v3: removed checkpatch.pl errors
   moved change log

 drivers/mtd/nand/s3c2410_nand.c |   62 +++---
 1 files changed, 25 insertions(+), 37 deletions(-)

diff --git a/drivers/mtd/nand/s3c2410_nand.c b/drivers/mtd/nand/s3c2410_nand.c
index d27a625..f2f3e72 100644
--- a/drivers/mtd/nand/s3c2410_nand.c
+++ b/drivers/mtd/nand/s3c2410_nand.c
@@ -20,29 +20,10 @@
 
 #include 
 
-#if 0
-#define DEBUGN printf
-#else
-#define DEBUGN(x, args ...) {}
-#endif
-
 #include 
 #include 
 #include 
 
-#define __REGb(x)  (*(volatile unsigned char *)(x))
-#define __REGi(x)  (*(volatile unsigned int *)(x))
-
-#defineNF_BASE 0x4e00
-#defineNFCONF  __REGi(NF_BASE + 0x0)
-#defineNFCMD   __REGb(NF_BASE + 0x4)
-#defineNFADDR  __REGb(NF_BASE + 0x8)
-#defineNFDATA  __REGb(NF_BASE + 0xc)
-#defineNFSTAT  __REGb(NF_BASE + 0x10)
-#define NFECC0 __REGb(NF_BASE + 0x14)
-#define NFECC1 __REGb(NF_BASE + 0x15)
-#define NFECC2 __REGb(NF_BASE + 0x16)
-
 #define S3C2410_NFCONF_EN  (1<<15)
 #define S3C2410_NFCONF_512BYTE (1<<14)
 #define S3C2410_NFCONF_4STEP   (1<<13)
@@ -58,11 +39,12 @@
 static void s3c2410_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
 {
struct nand_chip *chip = mtd->priv;
+   struct s3c2410_nand *nand = s3c2410_get_base_nand();
 
-   DEBUGN("hwcontrol(): 0x%02x 0x%02x\n", cmd, ctrl);
+   debugX(1, "hwcontrol(): 0x%02x 0x%02x\n", cmd, ctrl);
 
if (ctrl & NAND_CTRL_CHANGE) {
-   ulong IO_ADDR_W = NF_BASE;
+   ulong IO_ADDR_W = (ulong)nand;
 
if (!(ctrl & NAND_CLE))
IO_ADDR_W |= S3C2410_ADDR_NCLE;
@@ -72,9 +54,11 @@ static void s3c2410_hwcontrol(struct mtd_info *mtd, int cmd, 
unsigned int ctrl)
chip->IO_ADDR_W = (void *)IO_ADDR_W;
 
if (ctrl & NAND_NCE)
-   NFCONF &= ~S3C2410_NFCONF_nFCE;
+   writel(readl(&nand->NFCONF) & ~S3C2410_NFCONF_nFCE,
+  &nand->NFCONF);
else
-   NFCONF |= S3C2410_NFCONF_nFCE;
+   writel(readl(&nand->NFCONF) | S3C2410_NFCONF_nFCE,
+  &nand->NFCONF);
}
 
if (cmd != NAND_CMD_NONE)
@@ -83,15 +67,17 @@ static void s3c2410_hwcontrol(struct mtd_info *mtd, int 
cmd, unsigned int ctrl)
 
 static int s3c2410_dev_ready(struct mtd_info *mtd)
 {
-   DEBUGN("dev_ready\n");
-   return (NFSTAT & 0x01);
+   struct s3c2410_nand *nand = s3c2410_get_base_nand();
+   debugX(1, "dev_ready\n");
+   return readl(&nand->NFSTAT) & 0x01;
 }
 
 #ifdef CONFIG_S3C2410_NAND_HWECC
 void s3c2410_nand_enable_hwecc(struct mtd_info *mtd, int mode)
 {
-   DEBUGN("s3c2410_nand_enable_hwecc(%p, %d)\n", mtd, mode);
-   NFCONF |= S3C2410_NFCONF_INITECC;
+   struct s3c2410_nand *nand = s3c2410_get_base_nand();
+   debugX(1, "s3c2410_nand_enable_hwecc(%p, %d)\n", mtd, mode);
+   writel(readl(&nand->NFCONF) | S3C2410_NFCONF_INITECC, &nand->NFCONF);
 }
 
 static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
@@ -100,8 +86,8 @@ static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, 
const u_char *dat,
ecc_code[0] = NFECC0;
ecc_code[1] = NFECC1;
ecc_code[2] = NFECC2;
-   DEBUGN("s3c2410_nand_calculate_hwecc(%p,): 0x%02x 0x%02x 0x%02x\n",
-   mtd , ecc_code[0], ecc_code[1], ecc_code[2]);
+   debugX(1, "s3c2410_nand_calculate_hwecc(%p,): 0x%02x 0x%02x 0x%02x\n",
+  mtd , ecc_code[0], ecc_code[1], ecc_code[2]);
 
return 0;
 }
@@ -123,24 +109,26 @@ int board_nand_init(struct nand_chip *nand)
 {

Re: [U-Boot] lowlevel_init.s for ARM920t/S3C2410 [Spam][99.0%]

2009-10-24 Thread kevin.morf...@fearnside-systems.co.uk


On 24/10/2009 12:53, Gaye Abdoulaye Walsimou wrote:
>> Alternatively, I have seen some unofficial u-boot ports for s3c24x0 cpu's 
>> that
>> do support u-boot booting from NAND flash but I don't have the source code 
>> for them.
>>   
> Kevin,
> I think this[1] is the code you are talking about. I just give it a try
> and it works like a charm when booting from NAND flash.
> They have a nand_read.c under cpu/arm920t/s3c24xx, which its object file
> is included just under start.o in the linker script.
> They also have a slightly different start.S in which they determinate if
> we're booting from NAND or NOR flash.

I hadn't seen that but, yes, it's similar to another I've seen.

It seems to be based on a version of u-boot from March 2008 but I guess
it wouldn't be too difficult to add something similar into the latest
u-boot.

> 
> cheers,
> 
> [1] http://repo.or.cz/w/u-boot-openmoko/mini2440.git
> 
> __ Information from ESET NOD32 Antivirus, version of virus signature 
> database 4537 (20091023) __
> 
> The message was checked by ESET NOD32 Antivirus.
> 
> http://www.eset.com
> 
> 
> 
> 



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4537 (20091023) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] why there is no code boot from nand flash?

2009-10-26 Thread kevin.morf...@fearnside-systems.co.uk


On 26/10/2009 09:41, Jello huang wrote:
> Dear list,
> why is there no code boot from nand flash and nor flash  in / cpu / arm920t
> / start.S?
> I am puzzle. anybody can show me some reason?

I guess because people who use arm920t boards with 'standard' u-boot don't boot
from NAND, or if they do, they haven't submitted their patches to add NAND boot
support into u-boot. I've only used the Embest SBC2440-II Board (I haven't got
all the patches accepted so it's not supported yet) and I boot from NOR flash.

Kevin

> Thanks a lot!
> 
> 
> 
> 
> 
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
> 



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4543 (20091026) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH-ARM 1/3] Add support for the s3c2440 cpu excluding nand driver

2009-11-01 Thread kevin.morf...@fearnside-systems.co.uk
This patch adds support for the s3c2440 cpu, excluding the nand driver.

Tested on an Embest SBC2440-II Board with local u-boot patches as I don't have
any s3c2400 or s3c2410 boards but need this patch applying before I can submit
patches for the SBC2440-II Board. Also, ran MAKEALL for all ARM9 targets and no
new warnings or errors were found.

Note that checkpatch.pl shows one error:

ERROR: Invalid UTF-8, patch and commit message should be encoded in UTF-8
#656: FILE: include/s3c2440.h:3:
+ * David M�ller ELSOFT AG Switzerland. d.muel...@elsoft.ch
   ^
As David's name correctly contains a non-UTF-8 character I've ignored this 
error.

Signed-off-by: Kevin Morfitt 
---
 common/serial.c  |4 +-
 cpu/arm920t/s3c24x0/Makefile |6 +-
 cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S |   81 +
 cpu/arm920t/s3c24x0/speed.c  |   41 +--
 cpu/arm920t/s3c24x0/timer.c  |   19 +---
 cpu/arm920t/s3c24x0/usb.c|   17 +--
 cpu/arm920t/s3c24x0/usb_ohci.c   |   11 +--
 cpu/arm920t/start.S  |   39 +--
 drivers/i2c/s3c24x0_i2c.c|   18 ++--
 drivers/mtd/nand/s3c2410_nand.c  |2 +-
 drivers/rtc/s3c24x0_rtc.c|7 +-
 drivers/serial/serial_s3c24x0.c  |6 +-
 drivers/usb/host/ohci-hcd.c  |3 +-
 include/common.h |5 +-
 include/configs/VCMA9.h  |4 +-
 include/configs/sbc2410x.h   |4 +-
 include/configs/smdk2400.h   |4 +-
 include/configs/smdk2410.h   |4 +-
 include/configs/trab.h   |4 +-
 include/s3c2410.h|   25 
 include/s3c2440.h|  163 ++
 include/s3c24x0.h|   94 ++-
 include/s3c24x0_cpu.h|   29 +
 23 files changed, 471 insertions(+), 119 deletions(-)
 create mode 100644 cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S
 create mode 100644 include/s3c2440.h
 create mode 100644 include/s3c24x0_cpu.h

diff --git a/common/serial.c b/common/serial.c
index 5f9ffd7..52b3055 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -59,7 +59,7 @@ struct serial_device *__default_serial_console (void)
 #else
return &serial0_device;
 #endif
-#elif defined(CONFIG_S3C2410)
+#elif defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)
 #if defined(CONFIG_SERIAL1)
return &s3c24xx_serial0_device;
 #elif defined(CONFIG_SERIAL2)
@@ -148,7 +148,7 @@ void serial_initialize (void)
 #if defined (CONFIG_STUART)
serial_register(&serial_stuart_device);
 #endif
-#if defined(CONFIG_S3C2410)
+#if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)
serial_register(&s3c24xx_serial0_device);
serial_register(&s3c24xx_serial1_device);
serial_register(&s3c24xx_serial2_device);
diff --git a/cpu/arm920t/s3c24x0/Makefile b/cpu/arm920t/s3c24x0/Makefile
index 7e8d6ed..406f881 100644
--- a/cpu/arm920t/s3c24x0/Makefile
+++ b/cpu/arm920t/s3c24x0/Makefile
@@ -25,6 +25,8 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(SOC).a
 
+SOBJS-$(CONFIG_DO_ARCH_PRE_LOWLEVEL_INIT) += arch_pre_lowlevel_init.o
+
 COBJS-$(CONFIG_USE_IRQ) += interrupts.o
 COBJS-y+= speed.o
 COBJS-y+= timer.o
@@ -32,8 +34,8 @@ COBJS-y   += usb.o
 COBJS-y+= usb_ohci.o
 
 
-SRCS   := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
-OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS-y))
+SRCS   := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
 
 all:   $(obj).depend $(LIB)
 
diff --git a/cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S 
b/cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S
new file mode 100644
index 000..13467cf
--- /dev/null
+++ b/cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S
@@ -0,0 +1,81 @@
+/*
+ * (C) Copyright 2009
+ * Kevin Morfitt, Fearnside Systems Ltd, 

+ *
+ * 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 
+
+#ifdef CONFIG_S3C24X0
+
+/* Register addresses. */
+# ifdef CONFIG_S3C2400
+   #define pWTCON  0x1530
+   #define INTMSK  0x1448
+   #de

[U-Boot] [PATCH-ARM 2/3] Add sc32440 support to the s3c2410 nand driver

2009-11-01 Thread kevin.morf...@fearnside-systems.co.uk
This patch adds support for the s3c2440 cpu to the nand driver. It does 
this by replacing the existing driver with that from linux 2.6.31.5, 
modified to make it work in the u-boot mtd nand architecture. Note that
the linux s3c2410 nand driver supports s3c2410 and s3c2440, though I haven't
been able to test this on an s3c2410 board, only an s3c2440 board.

Tested on an Embest SBC2440-II Board with local u-boot patches as I don't have
any s3c2400 or s3c2410 boards but need this patch applying before I can submit
patches for the SBC2440-II Board. Also, ran MAKEALL for all ARM9 targets and no
new warnings or errors were found.

Signed-off-by: Kevin Morfitt 
 drivers/mtd/nand/s3c2410_nand.c |  134 +--
 1 files changed, 73 insertions(+), 61 deletions(-)

diff --git a/drivers/mtd/nand/s3c2410_nand.c b/drivers/mtd/nand/s3c2410_nand.c
index 87d0bf6..b8ea581 100644
--- a/drivers/mtd/nand/s3c2410_nand.c
+++ b/drivers/mtd/nand/s3c2410_nand.c
@@ -2,6 +2,10 @@
  * (C) Copyright 2006 OpenMoko, Inc.
  * Author: Harald Welte 
  *
+ * Modified to add S3C2440 support by
+ * (C) Copyright 2009
+ * Kevin Morfitt, Fearnside Systems Ltd, 

+ *
  * 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
@@ -21,48 +25,53 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
-#define S3C2410_NFCONF_EN  (1<<15)
-#define S3C2410_NFCONF_512BYTE (1<<14)
-#define S3C2410_NFCONF_4STEP   (1<<13)
-#define S3C2410_NFCONF_INITECC (1<<12)
-#define S3C2410_NFCONF_nFCE(1<<11)
-#define S3C2410_NFCONF_TACLS(x)((x)<<8)
-#define S3C2410_NFCONF_TWRPH0(x)   ((x)<<4)
-#define S3C2410_NFCONF_TWRPH1(x)   ((x)<<0)
+#if defined(CONFIG_S3C2410_NAND_HWECC) && defined(CONFIG_SYS_NAND_LARGEPAGE)
+/* new oob placement block for use with hardware ecc generation
+ */
+static struct nand_ecclayout nand_hw_eccoob = {
+   .eccbytes = 3,
+   .eccpos = {0, 1, 2},
+   .oobfree = { {8, 8} }
+};
+#endif
 
-#define S3C2410_ADDR_NALE 4
-#define S3C2410_ADDR_NCLE 8
+static void s3c2410_nand_select_chip(struct mtd_info *mtd, int chip)
+{
+   struct s3c2410_nand *nand = s3c2410_get_base_nand();
+   unsigned long reg = readl(&nand->S3C24X0_NAND_CTRL_REG);
+
+   if (chip == -1) {
+   debugX(1, "Negating nFCE\n");
+   reg |= S3C24X0_NAND_nFCE_BIT;
+   } else {
+   debugX(1, "Asserting nFCE\n");
+   reg &= ~S3C24X0_NAND_nFCE_BIT;
+   }
+   writel(reg, &nand->S3C24X0_NAND_CTRL_REG);
+}
 
 static void s3c2410_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
 {
-   struct nand_chip *chip = mtd->priv;
struct s3c2410_nand *nand = s3c2410_get_base_nand();
 
debugX(1, "hwcontrol(): 0x%02x 0x%02x\n", cmd, ctrl);
 
-   if (ctrl & NAND_CTRL_CHANGE) {
-   ulong IO_ADDR_W = (ulong)nand;
-
-   if (!(ctrl & NAND_CLE))
-   IO_ADDR_W |= S3C2410_ADDR_NCLE;
-   if (!(ctrl & NAND_ALE))
-   IO_ADDR_W |= S3C2410_ADDR_NALE;
-
-   chip->IO_ADDR_W = (void *)IO_ADDR_W;
+   if (cmd == NAND_CMD_NONE)
+   return;
 
-   if (ctrl & NAND_NCE)
-   writel(readl(&nand->NFCONF) & ~S3C2410_NFCONF_nFCE,
-  &nand->NFCONF);
-   else
-   writel(readl(&nand->NFCONF) | S3C2410_NFCONF_nFCE,
-  &nand->NFCONF);
+   if (ctrl & NAND_CLE) {
+   debugX(1, "NFCMD = 0x%08X\n", cmd);
+   writel(cmd, &nand->NFCMD);
}
 
-   if (cmd != NAND_CMD_NONE)
-   writeb(cmd, chip->IO_ADDR_W);
+   if (ctrl & NAND_ALE) {
+   debugX(1, "NFADDR = 0x%08X\n", cmd);
+   writel(cmd, &nand->NFADDR);
+   }
 }
 
 static int s3c2410_dev_ready(struct mtd_info *mtd)
@@ -76,39 +85,32 @@ static int s3c2410_dev_ready(struct mtd_info *mtd)
 void s3c2410_nand_enable_hwecc(struct mtd_info *mtd, int mode)
 {
struct s3c2410_nand *nand = s3c2410_get_base_nand();
+   unsigned long reg = readl(&nand->S3C24X0_NAND_CTRL_REG);
+
debugX(1, "s3c2410_nand_enable_hwecc(%p, %d)\n", mtd, mode);
-   writel(readl(&nand->NFCONF) | S3C2410_NFCONF_INITECC, &nand->NFCONF);
+   reg |= S3C24X0_NAND_INITECC_BIT;
+   writel(reg, &nand->S3C24X0_NAND_CTRL_REG);
 }
 
 static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
  u_char *ecc_code)
 {
-   ecc_code[0] = NFECC0;
-   ecc_code[1] = NFECC1;
-   ecc_code[2] = NFECC2;
+   struct s3c2410_nand *nand = s3c2410_get_base_nand();
+   unsigned long ecc = readl(&nand->S3C24X0_NAND_ECC_REG);
+
+   ecc_code[0] = ecc;
+   ecc_code[1] = ecc >> 8;
+   ecc_code[2] = ecc >> 16;
debugX(1,

[U-Boot] [PATCH-ARM 3/3] Add Support for the SBC2440-II Board

2009-11-01 Thread kevin.morf...@fearnside-systems.co.uk
This patch adds support for the Embest SBC2440-II Board.

Tested on an Embest SBC2440-II Board with local u-boot patches as I don't have
any s3c2400 or s3c2410 boards but need this patch applying before I can submit
patches for the SBC2440-II Board. Also, ran MAKEALL for all ARM9 targets and no
new warnings or errors were found.

Signed-off-by: Kevin Morfitt 
---
 MAINTAINERS|4 +
 MAKEALL|1 +
 Makefile   |3 +
 board/embest/sbc2440ii/Makefile|   55 +++
 board/embest/sbc2440ii/config.mk   |   25 +++
 board/embest/sbc2440ii/lowlevel_init.S |  219 +++
 board/embest/sbc2440ii/sbc2440ii.c |  122 +++
 cpu/arm920t/s3c24x0/timer.c|1 +
 include/configs/sbc2440ii.h|  254 
 9 files changed, 684 insertions(+), 0 deletions(-)
 create mode 100644 board/embest/sbc2440ii/Makefile
 create mode 100644 board/embest/sbc2440ii/config.mk
 create mode 100644 board/embest/sbc2440ii/lowlevel_init.S
 create mode 100644 board/embest/sbc2440ii/sbc2440ii.c
 create mode 100644 include/configs/sbc2440ii.h

diff --git a/MAINTAINERS b/MAINTAINERS
index d70a9d2..65f8dfe 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -638,6 +638,10 @@ Nishanth Menon 
omap3_sdp3430   ARM CORTEX-A8 (OMAP3xx SoC)
omap3_zoom1 ARM CORTEX-A8 (OMAP3xx SoC)
 
+Kevin Morfitt 
+
+   sbc2440ii   ARM920T
+
 David Müller 
 
smdk2410ARM920T
diff --git a/MAKEALL b/MAKEALL
index 5492d8f..c84b23e 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -552,6 +552,7 @@ LIST_ARM9=" \
openrd_base \
rd6281a \
sbc2410x\
+   sbc2440ii   \
scb9328 \
sheevaplug  \
smdk2400\
diff --git a/Makefile b/Makefile
index b91b1c0..a6619e5 100644
--- a/Makefile
+++ b/Makefile
@@ -3020,6 +3020,9 @@ rd6281a_config: unconfig
 sbc2410x_config: unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t sbc2410x NULL s3c24x0
 
+sbc2440ii_config: unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm920t sbc2440ii embest s3c24x0
+
 scb9328_config :   unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t scb9328 NULL imx
 
diff --git a/board/embest/sbc2440ii/Makefile b/board/embest/sbc2440ii/Makefile
new file mode 100644
index 000..26237a2
--- /dev/null
+++ b/board/embest/sbc2440ii/Makefile
@@ -0,0 +1,55 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# Modified for EMBEST SBC2440-II board with S3C2440 (ARM920T) cpu by:
+# (C) Copyright 2009
+# Kevin Morfitt, Fearnside Systems Ltd, 
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB  = $(obj)lib$(BOARD).a
+
+COBJS   := sbc2440ii.o
+SOBJS   := lowlevel_init.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB): $(obj).depend $(OBJS) $(SOBJS)
+   $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak $(obj).depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/embest/sbc2440ii/config.mk b/board/embest/sbc2440ii/config.mk
new file mode 100644
index 000..def11d8
--- /dev/null
+++ b/board/embest/sbc2440ii/config.mk
@@ -0,0 +1,25 @@
+#
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, 
+# David Mueller, ELSOFT AG, 
+#
+# SAMSUNG SMDK2410 board with S3C2410X (ARM920T) cpu
+#
+# see http://www.samsung.com/ for more information on SAMSUNG
+#
+# Modified for EMBEST SBC2440-II board with S3C2440 (ARM920T) cpu by:
+# (C) Copyright 2009
+# Kevin Morfitt, Fearnside Systems Ltd, 
+
+#
+# SBC2440-II has 1 bank of 64 MB DRAM
+#
+# 3000' to 3800'
+#
+# Linux-Kernel is expected to be at 3000'8000, entry 3000'8000
+#
+# we load ourself to 33F8'
+#

Re: [U-Boot] [PATCH-ARM 1/3] Add support for the s3c2440 cpu excluding nand driver

2009-11-02 Thread kevin.morf...@fearnside-systems.co.uk


Tom wrote:
> kevin.morf...@fearnside-systems.co.uk wrote:
>> This patch adds support for the s3c2440 cpu, excluding the nand driver.
>>
>> Tested on an Embest SBC2440-II Board with local u-boot patches as I don't 
>> have
>> any s3c2400 or s3c2410 boards but need this patch applying before I can 
>> submit
>> patches for the SBC2440-II Board. Also, ran MAKEALL for all ARM9 targets and 
>> no
>> new warnings or errors were found.
>>
>> Note that checkpatch.pl shows one error:
> 
> Thank you for using checkpatch.
> 
>> ERROR: Invalid UTF-8, patch and commit message should be encoded in UTF-8
>> #656: FILE: include/s3c2440.h:3:
>> + * David M�ller ELSOFT AG Switzerland. d.muel...@elsoft.ch
>>^
>> As David's name correctly contains a non-UTF-8 character I've ignored this 
>> error.
>>
>> Signed-off-by: Kevin Morfitt 
>> ---
>>  common/serial.c  |4 +-
>>  cpu/arm920t/s3c24x0/Makefile |6 +-
>>  cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S |   81 +
> 
> Why not just lowlevel_init.S ?
> It looks like this is a common lowlevel_init but this looks like
> a mistake since the other s3c34x0 boards have not used it up to to this
> point.  Since it looks like this option is being enabled in the
> other boards, this change must be broken out at its own patch.
> 

There already is a lowlevel_init.S that's used in the s3c24x0 board 
directories to configure the SDRAM controller specific to the board.
arch_pre_lowlevel_init.S is intended to run first at start-up to let
a board configure the PLL's in a board specific way so I should really
have put arch_pre_lowlevel_init.S in the board directories and enabled
or disabled it in the board config files.
As you suggested, I'll break it out into its own patch.

> 
>>  cpu/arm920t/s3c24x0/speed.c  |   41 +--
>>  cpu/arm920t/s3c24x0/timer.c  |   19 +---
>>  cpu/arm920t/s3c24x0/usb.c|   17 +--
>>  cpu/arm920t/s3c24x0/usb_ohci.c   |   11 +--
>>  cpu/arm920t/start.S  |   39 +--
>>  drivers/i2c/s3c24x0_i2c.c|   18 ++--
>>  drivers/mtd/nand/s3c2410_nand.c  |2 +-
>>  drivers/rtc/s3c24x0_rtc.c|7 +-
>>  drivers/serial/serial_s3c24x0.c  |6 +-
>>  drivers/usb/host/ohci-hcd.c  |3 +-
>>  include/common.h |5 +-
> 
>>  include/configs/VCMA9.h  |4 +-
>>  include/configs/sbc2410x.h   |4 +-
>>  include/configs/smdk2400.h   |4 +-
>>  include/configs/smdk2410.h   |4 +-
>>  include/configs/trab.h   |4 +-
> 
> This is typical of what you are doing with the config files.
>> +#define CONFIG_S3C24X0  1   /* in a SAMSUNG S3C24x0-type 
>> SoC */
>> +#define CONFIG_S3C2410  1   /* specifically a SAMSUNG 
>> S3C2410 SoC */
> It is good that you are trying to generalize the boards, but
> this separate change and must be split.  This new patch should come first.

OK - I'll do that in a separate patch.

> 
>>  include/s3c2410.h|   25 
>>  include/s3c2440.h|  163 
>> ++
>>  include/s3c24x0.h|   94 ++-
>>  include/s3c24x0_cpu.h|   29 +
> 
> These 4 files belong in include/asm-arch/arch-s3c24x0 or
> where Minkyu thinks is appropriate.

I'll move these in a separate patch.

> 
> On your include file s3c2440.h
> 
> For your #defines, the whitespace between the identifier and the value
> must be tabs.  You have spaces.
> 
> The static inline functions need space beween one function definition
> and the next.  They also need to use tabs
> 
>>  23 files changed, 471 insertions(+), 119 deletions(-)
>>  create mode 100644 cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S
>>  create mode 100644 include/s3c2440.h
>>  create mode 100644 include/s3c24x0_cpu.h
>>
> 
> Tom
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH ARM] Clean-up of s3c24x0 header files

2009-11-03 Thread kevin.morf...@fearnside-systems.co.uk
Cleans up the s3c24x0 header files:

s4c24x0.h: removes the use of 'volatile' from the S3C24X0_REG8, 
S3C24X0_REG16 and S3C24X0_REG32 register typedef's. Registers are always 
accessed using the IO accessor functions which cast the register address
as 'volatile' anyway so it isn't required here.

s3c2400.h and s3c2410.h: insert a blank line between the static inline
functions.

Signed-off-by: Kevin Morfitt 
---
 include/asm-arm/arch-s3c24x0/s3c2400.h |   16 
 include/asm-arm/arch-s3c24x0/s3c2410.h |   17 +
 include/asm-arm/arch-s3c24x0/s3c24x0.h |6 +++---
 3 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/include/asm-arm/arch-s3c24x0/s3c2400.h 
b/include/asm-arm/arch-s3c24x0/s3c2400.h
index 26bd4e4..2678be1 100644
--- a/include/asm-arm/arch-s3c24x0/s3c2400.h
+++ b/include/asm-arm/arch-s3c24x0/s3c2400.h
@@ -67,67 +67,83 @@ static inline struct s3c24x0_memctl 
*s3c24x0_get_base_memctl(void)
 {
return (struct s3c24x0_memctl *)S3C24X0_MEMCTL_BASE;
 }
+
 static inline struct s3c24x0_usb_host *s3c24x0_get_base_usb_host(void)
 {
return (struct s3c24x0_usb_host *)S3C24X0_USB_HOST_BASE;
 }
+
 static inline struct s3c24x0_interrupt *s3c24x0_get_base_interrupt(void)
 {
return (struct s3c24x0_interrupt *)S3C24X0_INTERRUPT_BASE;
 }
+
 static inline struct s3c24x0_dmas *s3c24x0_get_base_dmas(void)
 {
return (struct s3c24x0_dmas *)S3C24X0_DMA_BASE;
 }
+
 static inline struct s3c24x0_clock_power *s3c24x0_get_base_clock_power(void)
 {
return (struct s3c24x0_clock_power *)S3C24X0_CLOCK_POWER_BASE;
 }
+
 static inline struct s3c24x0_lcd *s3c24x0_get_base_lcd(void)
 {
return (struct s3c24x0_lcd *)S3C24X0_LCD_BASE;
 }
+
 static inline struct s3c24x0_uart
*s3c24x0_get_base_uart(enum s3c24x0_uarts_nr n)
 {
return (struct s3c24x0_uart *)(S3C24X0_UART_BASE + (n * 0x4000));
 }
+
 static inline struct s3c24x0_timers *s3c24x0_get_base_timers(void)
 {
return (struct s3c24x0_timers *)S3C24X0_TIMER_BASE;
 }
+
 static inline struct s3c24x0_usb_device *s3c24x0_get_base_usb_device(void)
 {
return (struct s3c24x0_usb_device *)S3C24X0_USB_DEVICE_BASE;
 }
+
 static inline struct s3c24x0_watchdog *s3c24x0_get_base_watchdog(void)
 {
return (struct s3c24x0_watchdog *)S3C24X0_WATCHDOG_BASE;
 }
+
 static inline struct s3c24x0_i2c *s3c24x0_get_base_i2c(void)
 {
return (struct s3c24x0_i2c *)S3C24X0_I2C_BASE;
 }
+
 static inline struct s3c24x0_i2s *s3c24x0_get_base_i2s(void)
 {
return (struct s3c24x0_i2s *)S3C24X0_I2S_BASE;
 }
+
 static inline struct s3c24x0_gpio *s3c24x0_get_base_gpio(void)
 {
return (struct s3c24x0_gpio *)S3C24X0_GPIO_BASE;
 }
+
 static inline struct s3c24x0_rtc *s3c24x0_get_base_rtc(void)
 {
return (struct s3c24x0_rtc *)S3C24X0_RTC_BASE;
 }
+
 static inline struct s3c2400_adc *s3c2400_get_base_adc(void)
 {
return (struct s3c2400_adc *)S3C24X0_ADC_BASE;
 }
+
 static inline struct s3c24x0_spi *s3c24x0_get_base_spi(void)
 {
return (struct s3c24x0_spi *)S3C24X0_SPI_BASE;
 }
+
 static inline struct s3c2400_mmc *s3c2400_get_base_mmc(void)
 {
return (struct s3c2400_mmc *)S3C2400_MMC_BASE;
diff --git a/include/asm-arm/arch-s3c24x0/s3c2410.h 
b/include/asm-arm/arch-s3c24x0/s3c2410.h
index be2e76e..0543fe1 100644
--- a/include/asm-arm/arch-s3c24x0/s3c2410.h
+++ b/include/asm-arm/arch-s3c24x0/s3c2410.h
@@ -73,71 +73,88 @@ static inline struct s3c24x0_memctl 
*s3c24x0_get_base_memctl(void)
 {
return (struct s3c24x0_memctl *)S3C24X0_MEMCTL_BASE;
 }
+
 static inline struct s3c24x0_usb_host *s3c24x0_get_base_usb_host(void)
 {
return (struct s3c24x0_usb_host *)S3C24X0_USB_HOST_BASE;
 }
+
 static inline struct s3c24x0_interrupt *s3c24x0_get_base_interrupt(void)
 {
return (struct s3c24x0_interrupt *)S3C24X0_INTERRUPT_BASE;
 }
+
 static inline struct s3c24x0_dmas *s3c24x0_get_base_dmas(void)
 {
return (struct s3c24x0_dmas *)S3C24X0_DMA_BASE;
 }
+
 static inline struct s3c24x0_clock_power *s3c24x0_get_base_clock_power(void)
 {
return (struct s3c24x0_clock_power *)S3C24X0_CLOCK_POWER_BASE;
 }
+
 static inline struct s3c24x0_lcd *s3c24x0_get_base_lcd(void)
 {
return (struct s3c24x0_lcd *)S3C24X0_LCD_BASE;
 }
+
 static inline struct s3c2410_nand *s3c2410_get_base_nand(void)
 {
return (struct s3c2410_nand *)S3C2410_NAND_BASE;
 }
+
 static inline struct s3c24x0_uart
*s3c24x0_get_base_uart(enum s3c24x0_uarts_nr n)
 {
return (struct s3c24x0_uart *)(S3C24X0_UART_BASE + (n * 0x4000));
 }
+
 static inline struct s3c24x0_timers *s3c24x0_get_base_timers(void)
 {
return (struct s3c24x0_timers *)S3C24X0_TIMER_BASE;
 }
+
 static inline struct s3c24x0_usb_device *s3c24x0_get_base_usb_device(void)
 {
return (struct s3c24x0_usb_device *)S3C24X0_USB_DEVICE_BASE;
 }
+
 static inline struct s3c24x0_watchdog *s3c24x0_get_base_watchdog(void)
 {
return (struct s3c24x0_watchdog *)S3C24X0_WA

Re: [U-Boot] [PATCH ARM] Clean-up of s3c24x0 header files

2009-11-03 Thread kevin.morf...@fearnside-systems.co.uk


Minkyu Kang wrote:
> Dear Kevin Morfitt
> 
> 2009/11/3 kevin.morf...@fearnside-systems.co.uk
> :
>> Cleans up the s3c24x0 header files:
> 
> Thank you for patch
> 
>> s4c24x0.h: removes the use of 'volatile' from the S3C24X0_REG8,
>> S3C24X0_REG16 and S3C24X0_REG32 register typedef's. Registers are always
>> accessed using the IO accessor functions which cast the register address
>> as 'volatile' anyway so it isn't required here.
>>
>> s3c2400.h and s3c2410.h: insert a blank line between the static inline
>> functions.
>>
>> Signed-off-by: Kevin Morfitt 
>> ---
>>  include/asm-arm/arch-s3c24x0/s3c2400.h |   16 
>>  include/asm-arm/arch-s3c24x0/s3c2410.h |   17 +
>>  include/asm-arm/arch-s3c24x0/s3c24x0.h |6 +++---
>>  3 files changed, 36 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/asm-arm/arch-s3c24x0/s3c2400.h 
>> b/include/asm-arm/arch-s3c24x0/s3c2400.h
>> index 26bd4e4..2678be1 100644
>> --- a/include/asm-arm/arch-s3c24x0/s3c2400.h
>> +++ b/include/asm-arm/arch-s3c24x0/s3c2400.h
>> @@ -67,67 +67,83 @@ static inline struct s3c24x0_memctl 
>> *s3c24x0_get_base_memctl(void)
>>  {
>>return (struct s3c24x0_memctl *)S3C24X0_MEMCTL_BASE;
>>  }
>> +
>>  static inline struct s3c24x0_usb_host *s3c24x0_get_base_usb_host(void)
>>  {
>>return (struct s3c24x0_usb_host *)S3C24X0_USB_HOST_BASE;
>>  }
>> +
>>  static inline struct s3c24x0_interrupt *s3c24x0_get_base_interrupt(void)
>>  {
>>return (struct s3c24x0_interrupt *)S3C24X0_INTERRUPT_BASE;
>>  }
>> +
>>  static inline struct s3c24x0_dmas *s3c24x0_get_base_dmas(void)
>>  {
>>return (struct s3c24x0_dmas *)S3C24X0_DMA_BASE;
>>  }
>> +
>>  static inline struct s3c24x0_clock_power *s3c24x0_get_base_clock_power(void)
>>  {
>>return (struct s3c24x0_clock_power *)S3C24X0_CLOCK_POWER_BASE;
>>  }
>> +
>>  static inline struct s3c24x0_lcd *s3c24x0_get_base_lcd(void)
>>  {
>>return (struct s3c24x0_lcd *)S3C24X0_LCD_BASE;
>>  }
>> +
>>  static inline struct s3c24x0_uart
>>*s3c24x0_get_base_uart(enum s3c24x0_uarts_nr n)
>>  {
>>return (struct s3c24x0_uart *)(S3C24X0_UART_BASE + (n * 0x4000));
>>  }
>> +
>>  static inline struct s3c24x0_timers *s3c24x0_get_base_timers(void)
>>  {
>>return (struct s3c24x0_timers *)S3C24X0_TIMER_BASE;
>>  }
>> +
>>  static inline struct s3c24x0_usb_device *s3c24x0_get_base_usb_device(void)
>>  {
>>return (struct s3c24x0_usb_device *)S3C24X0_USB_DEVICE_BASE;
>>  }
>> +
>>  static inline struct s3c24x0_watchdog *s3c24x0_get_base_watchdog(void)
>>  {
>>return (struct s3c24x0_watchdog *)S3C24X0_WATCHDOG_BASE;
>>  }
>> +
>>  static inline struct s3c24x0_i2c *s3c24x0_get_base_i2c(void)
>>  {
>>return (struct s3c24x0_i2c *)S3C24X0_I2C_BASE;
>>  }
>> +
>>  static inline struct s3c24x0_i2s *s3c24x0_get_base_i2s(void)
>>  {
>>return (struct s3c24x0_i2s *)S3C24X0_I2S_BASE;
>>  }
>> +
>>  static inline struct s3c24x0_gpio *s3c24x0_get_base_gpio(void)
>>  {
>>return (struct s3c24x0_gpio *)S3C24X0_GPIO_BASE;
>>  }
>> +
>>  static inline struct s3c24x0_rtc *s3c24x0_get_base_rtc(void)
>>  {
>>return (struct s3c24x0_rtc *)S3C24X0_RTC_BASE;
>>  }
>> +
>>  static inline struct s3c2400_adc *s3c2400_get_base_adc(void)
>>  {
>>return (struct s3c2400_adc *)S3C24X0_ADC_BASE;
>>  }
>> +
>>  static inline struct s3c24x0_spi *s3c24x0_get_base_spi(void)
>>  {
>>return (struct s3c24x0_spi *)S3C24X0_SPI_BASE;
>>  }
>> +
>>  static inline struct s3c2400_mmc *s3c2400_get_base_mmc(void)
>>  {
>>return (struct s3c2400_mmc *)S3C2400_MMC_BASE;
>> diff --git a/include/asm-arm/arch-s3c24x0/s3c2410.h 
>> b/include/asm-arm/arch-s3c24x0/s3c2410.h
>> index be2e76e..0543fe1 100644
>> --- a/include/asm-arm/arch-s3c24x0/s3c2410.h
>> +++ b/include/asm-arm/arch-s3c24x0/s3c2410.h
>> @@ -73,71 +73,88 @@ static inline struct s3c24x0_memctl 
>> *s3c24x0_get_base_memctl(void)
>>  {
>>return (struct s3c24x0_memctl *)S3C24X0_MEMCTL_BASE;
>>  }
>> +
>>  static inline struct s3c24x0_usb_host *s3c24x0_get_base_usb_host(void)
>>  {
>>return (struct s3c24x0_usb_host *)S3C24X0_USB_HOST_BASE;
>>  }
>> +
>>  st

[U-Boot] [PATCH ARM v2] Clean-up of s3c24x0 header files

2009-11-04 Thread kevin.morf...@fearnside-systems.co.uk
Cleans up the s3c24x0 header files:

s4c24x0.h: removes the use of 'volatile' from the S3C24X0_REG8, 
S3C24X0_REG16 and S3C24X0_REG32 register typedef's. Registers are always 
accessed using the IO accessor functions which cast the register address
as 'volatile' anyway so it isn't required here.

s3c2400.h and s3c2410.h: insert a blank line between the static inline
functions

Signed-off-by: Kevin Morfitt 
---
 v2 changes: remove the S3C24X0_REG8, S3C24X0_REG16 and S3C24X0_REG32 
 register typedef's from s3c24x0.h, s3c2400.h, s3c2410.h and vcma9.h

 board/mpl/vcma9/vcma9.h|   14 +-
 include/asm-arm/arch-s3c24x0/s3c2400.h |   16 +
 include/asm-arm/arch-s3c24x0/s3c2410.h |   17 +
 include/asm-arm/arch-s3c24x0/s3c24x0.h |  904 
 4 files changed, 490 insertions(+), 461 deletions(-)

diff --git a/board/mpl/vcma9/vcma9.h b/board/mpl/vcma9/vcma9.h
index 9f32808..2c4305c 100644
--- a/board/mpl/vcma9/vcma9.h
+++ b/board/mpl/vcma9/vcma9.h
@@ -118,13 +118,13 @@ static inline u32 NF_Read_ECC(void)
 
 /* VCMA9 PLD regsiters */
 typedef struct {
-   S3C24X0_REG8ID;
-   S3C24X0_REG8NIC;
-   S3C24X0_REG8CAN;
-   S3C24X0_REG8MISC;
-   S3C24X0_REG8GPCD;
-   S3C24X0_REG8BOARD;
-   S3C24X0_REG8SDRAM;
+   u8  ID;
+   u8  NIC;
+   u8  CAN;
+   u8  MISC;
+   u8  GPCD;
+   u8  BOARD;
+   u8  SDRAM;
 } /*__attribute__((__packed__))*/ VCMA9_PLD;
 
 #define VCMA9_PLD_BASE 0x2C000100
diff --git a/include/asm-arm/arch-s3c24x0/s3c2400.h 
b/include/asm-arm/arch-s3c24x0/s3c2400.h
index 26bd4e4..2678be1 100644
--- a/include/asm-arm/arch-s3c24x0/s3c2400.h
+++ b/include/asm-arm/arch-s3c24x0/s3c2400.h
@@ -67,67 +67,83 @@ static inline struct s3c24x0_memctl 
*s3c24x0_get_base_memctl(void)
 {
return (struct s3c24x0_memctl *)S3C24X0_MEMCTL_BASE;
 }
+
 static inline struct s3c24x0_usb_host *s3c24x0_get_base_usb_host(void)
 {
return (struct s3c24x0_usb_host *)S3C24X0_USB_HOST_BASE;
 }
+
 static inline struct s3c24x0_interrupt *s3c24x0_get_base_interrupt(void)
 {
return (struct s3c24x0_interrupt *)S3C24X0_INTERRUPT_BASE;
 }
+
 static inline struct s3c24x0_dmas *s3c24x0_get_base_dmas(void)
 {
return (struct s3c24x0_dmas *)S3C24X0_DMA_BASE;
 }
+
 static inline struct s3c24x0_clock_power *s3c24x0_get_base_clock_power(void)
 {
return (struct s3c24x0_clock_power *)S3C24X0_CLOCK_POWER_BASE;
 }
+
 static inline struct s3c24x0_lcd *s3c24x0_get_base_lcd(void)
 {
return (struct s3c24x0_lcd *)S3C24X0_LCD_BASE;
 }
+
 static inline struct s3c24x0_uart
*s3c24x0_get_base_uart(enum s3c24x0_uarts_nr n)
 {
return (struct s3c24x0_uart *)(S3C24X0_UART_BASE + (n * 0x4000));
 }
+
 static inline struct s3c24x0_timers *s3c24x0_get_base_timers(void)
 {
return (struct s3c24x0_timers *)S3C24X0_TIMER_BASE;
 }
+
 static inline struct s3c24x0_usb_device *s3c24x0_get_base_usb_device(void)
 {
return (struct s3c24x0_usb_device *)S3C24X0_USB_DEVICE_BASE;
 }
+
 static inline struct s3c24x0_watchdog *s3c24x0_get_base_watchdog(void)
 {
return (struct s3c24x0_watchdog *)S3C24X0_WATCHDOG_BASE;
 }
+
 static inline struct s3c24x0_i2c *s3c24x0_get_base_i2c(void)
 {
return (struct s3c24x0_i2c *)S3C24X0_I2C_BASE;
 }
+
 static inline struct s3c24x0_i2s *s3c24x0_get_base_i2s(void)
 {
return (struct s3c24x0_i2s *)S3C24X0_I2S_BASE;
 }
+
 static inline struct s3c24x0_gpio *s3c24x0_get_base_gpio(void)
 {
return (struct s3c24x0_gpio *)S3C24X0_GPIO_BASE;
 }
+
 static inline struct s3c24x0_rtc *s3c24x0_get_base_rtc(void)
 {
return (struct s3c24x0_rtc *)S3C24X0_RTC_BASE;
 }
+
 static inline struct s3c2400_adc *s3c2400_get_base_adc(void)
 {
return (struct s3c2400_adc *)S3C24X0_ADC_BASE;
 }
+
 static inline struct s3c24x0_spi *s3c24x0_get_base_spi(void)
 {
return (struct s3c24x0_spi *)S3C24X0_SPI_BASE;
 }
+
 static inline struct s3c2400_mmc *s3c2400_get_base_mmc(void)
 {
return (struct s3c2400_mmc *)S3C2400_MMC_BASE;
diff --git a/include/asm-arm/arch-s3c24x0/s3c2410.h 
b/include/asm-arm/arch-s3c24x0/s3c2410.h
index be2e76e..0543fe1 100644
--- a/include/asm-arm/arch-s3c24x0/s3c2410.h
+++ b/include/asm-arm/arch-s3c24x0/s3c2410.h
@@ -73,71 +73,88 @@ static inline struct s3c24x0_memctl 
*s3c24x0_get_base_memctl(void)
 {
return (struct s3c24x0_memctl *)S3C24X0_MEMCTL_BASE;
 }
+
 static inline struct s3c24x0_usb_host *s3c24x0_get_base_usb_host(void)
 {
return (struct s3c24x0_usb_host *)S3C24X0_USB_HOST_BASE;
 }
+
 static inline struct s3c24x0_interrupt *s3c24x0_get_base_interrupt(void)
 {
return (struct s3c24x0_interrupt *)S3C24X0_INTERRUPT_BASE;
 }
+
 static inline struct s3c24x0_dmas *s3c24x0_get_base_dmas(void)
 {
return (struct s3c24x0_dmas *)S3C24X0_DMA_BASE;
 }
+
 static inline struct s3c24x0_clock_power *s3c24x0_get_base_clock_power(void)
 {
return (struct s3c24x0

[U-Boot] [PATCH ARM] Add a unified s3c24x0 header file

2009-11-10 Thread kevin.morf...@fearnside-systems.co.uk
This patch adds a unified s3c24x0 cpu header file that selects the header
file for the specific s3c24x0 cpu from the SOC and CPU configs defined in
board config file. This removes the current chain of s3c24-type #ifdef's 
from the s3c24x0 code.

Signed-off-by: Kevin Morfitt 
---
 board/mpl/vcma9/vcma9.c|2 +-
 board/mpl/vcma9/vcma9.h|2 +-
 board/samsung/smdk2400/smdk2400.c  |2 +-
 board/samsung/smdk2410/smdk2410.c  |2 +-
 board/sbc2410x/sbc2410x.c  |2 +-
 board/trab/cmd_trab.c  |2 +-
 board/trab/rs485.c |2 +-
 board/trab/rs485.h |2 +-
 board/trab/trab.c  |2 +-
 board/trab/trab_fkt.c  |2 +-
 board/trab/tsc2000.c   |2 +-
 board/trab/vfd.c   |2 +-
 cpu/arm920t/s3c24x0/interrupts.c   |6 +-
 cpu/arm920t/s3c24x0/speed.c|   13 +++--
 cpu/arm920t/s3c24x0/timer.c|   15 +++
 cpu/arm920t/s3c24x0/usb.c  |   17 +++--
 cpu/arm920t/s3c24x0/usb_ohci.c |   11 +++
 cpu/arm920t/start.S|4 ++--
 drivers/i2c/s3c24x0_i2c.c  |6 +-
 drivers/mtd/nand/s3c2410_nand.c|2 +-
 drivers/rtc/s3c24x0_rtc.c  |6 +-
 drivers/serial/serial_s3c24x0.c|6 +-
 drivers/usb/host/ohci-hcd.c|3 +--
 include/asm-arm/arch-s3c24x0/s3c24x0_cpu.h |   27 +++
 include/common.h   |5 +++--
 include/configs/VCMA9.h|7 ---
 include/configs/sbc2410x.h |7 ---
 include/configs/smdk2400.h |7 ---
 include/configs/smdk2410.h |7 ---
 include/configs/trab.h |9 +
 30 files changed, 87 insertions(+), 95 deletions(-)
 create mode 100644 include/asm-arm/arch-s3c24x0/s3c24x0_cpu.h

diff --git a/board/mpl/vcma9/vcma9.c b/board/mpl/vcma9/vcma9.c
index f3bd288..1835677 100644
--- a/board/mpl/vcma9/vcma9.c
+++ b/board/mpl/vcma9/vcma9.c
@@ -27,7 +27,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
diff --git a/board/mpl/vcma9/vcma9.h b/board/mpl/vcma9/vcma9.h
index 2c4305c..94fd2fa 100644
--- a/board/mpl/vcma9/vcma9.h
+++ b/board/mpl/vcma9/vcma9.h
@@ -25,7 +25,7 @@
  * Global routines used for VCMA9
  */
 
-#include 
+#include 
 
 extern int  mem_test(unsigned long start, unsigned long ramsize,int mode);
 
diff --git a/board/samsung/smdk2400/smdk2400.c 
b/board/samsung/smdk2400/smdk2400.c
index be0c70a..1294d3f 100644
--- a/board/samsung/smdk2400/smdk2400.c
+++ b/board/samsung/smdk2400/smdk2400.c
@@ -27,7 +27,7 @@
 
 #include 
 #include 
-#include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/samsung/smdk2410/smdk2410.c 
b/board/samsung/smdk2410/smdk2410.c
index a8cf287..5d1a8bb 100644
--- a/board/samsung/smdk2410/smdk2410.c
+++ b/board/samsung/smdk2410/smdk2410.c
@@ -27,7 +27,7 @@
 
 #include 
 #include 
-#include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/sbc2410x/sbc2410x.c b/board/sbc2410x/sbc2410x.c
index 6768c02..3a93677 100644
--- a/board/sbc2410x/sbc2410x.c
+++ b/board/sbc2410x/sbc2410x.c
@@ -30,7 +30,7 @@
 
 #include 
 #include 
-#include 
+#include 
 
 #if defined(CONFIG_CMD_NAND)
 #include 
diff --git a/board/trab/cmd_trab.c b/board/trab/cmd_trab.c
index a01ffcc..472d7d8 100644
--- a/board/trab/cmd_trab.c
+++ b/board/trab/cmd_trab.c
@@ -25,7 +25,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 /*
diff --git a/board/trab/rs485.c b/board/trab/rs485.c
index f402c59..ad0c136 100644
--- a/board/trab/rs485.c
+++ b/board/trab/rs485.c
@@ -22,7 +22,7 @@
  */
 
 #include 
-#include 
+#include 
 #include "rs485.h"
 
 static void rs485_setbrg (void);
diff --git a/board/trab/rs485.h b/board/trab/rs485.h
index 4a2d83f..16d69bb 100644
--- a/board/trab/rs485.h
+++ b/board/trab/rs485.h
@@ -24,7 +24,7 @@
 #ifndef _RS485_H_
 #define _RS485_H_
 
-#include 
+#include 
 
 int rs485_init (void);
 int rs485_getc (void);
diff --git a/board/trab/trab.c b/board/trab/trab.c
index f8836ff..71fd22c 100644
--- a/board/trab/trab.c
+++ b/board/trab/trab.c
@@ -26,7 +26,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/trab/trab_fkt.c b/board/trab/trab_fkt.c
index 940e12f..2df9a04 100644
--- a/board/trab/trab_fkt.c
+++ b/board/trab/trab_fkt.c
@@ -26,7 +26,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include "tsc2000.h"
 #include "rs485.h"
 
diff --git a/board/trab/tsc2000.c b/board/trab/tsc2000.c
index f757202..5890624 100644
--- a/board/trab/tsc2000.c
+++ b/board/trab/tsc2000.c
@@ -

Re: [U-Boot] [PATCH ARM 3/3 v3] change s3c24x0 register struct members to lower case

2010-02-11 Thread kevin.morf...@fearnside-systems.co.uk


On 11/02/2010 19:04, Tom wrote:
> Kevin Morfitt wrote:
>> Changes the names of the s3c24x0 register struct members from upper-case
>> to lower-case.
>>
>> Signed-off-by: Kevin Morfitt
>> ---
>>
>> v2 changes - re-number to be 3/3
>> v3 changes - re-based to modified patch 2/3
>>
>> checkpatch.pl reports no errors. MAKEALL ARM9 reports no new warnings
>> or errors.
>>
>
> I had problem applying v2 patch 1 to u-boot-arm and u-boot-samsung
> Can you check if this patchset is correctly rebased.

It's based against Monday's u-boot-master which hasn't changed since
then. v1 was against u-boot-samsung but Wolfgang asked me to do it
against u-boot-master:

"Please adhere to posting guidelines. Patches posted ere MUST be based
either on the "master" or on the "next" trees."

http://lists.denx.de/pipermail/u-boot/2009-December/065420.html

> Please also include the whole patchset when submitting so I can test it.
> Thanks
> Tom
>
>
>
> __ Information from ESET NOD32 Antivirus, version of virus signature 
> database 4859 (20100211) __
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] Added a tftp command

2009-03-31 Thread kevin.morf...@fearnside-systems.co.uk
Adds a "tftp" command that gets a specified file from a TFTP Server and 
stores it in RAM at a specified RAM address. Most of the code already 
exists in board-specific form (eg in board/hymod) but this patch 
extracts it and makes it available as a standard u-boot command.

Signed-off-by: Kevin Morfitt 
---
 common/cmd_tftp.c|   59 
++
 doc/README.tftp  |   29 
 include/config_cmd_all.h |1 +
 include/config_cmd_default.h |1 +
 4 files changed, 90 insertions(+), 0 deletions(-)
 create mode 100755 common/cmd_tftp.c
 create mode 100755 doc/README.tftp

diff --git a/common/cmd_tftp.c b/common/cmd_tftp.c
new file mode 100755
index 000..7aa5d0a
--- /dev/null
+++ b/common/cmd_tftp.c
@@ -0,0 +1,59 @@
+/*
+ * (C) Copyright 2009
+ * Kevin Morfitt, Fearnside Systems Ltd, 

+ *
+ * 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 
+#include 
+
+static int get_file_tftp(struct cmd_tbl_s *cmftp, int flag, int argc,
+char *argv[]);
+
+U_BOOT_CMD(
+tftp, 3, 0, get_file_tftp,
+"tftp\t- Upload a file via TFTP",
+"  - Upload  to  via TFTP"
+);
+
+static int get_file_tftp(struct cmd_tbl_s *cmftp, int flag,
+int argc, char *argv[])
+{
+load_addr = simple_strtoul(argv[1], NULL, 16);
+copy_filename(BootFile, argv[2], sizeof (BootFile));
+NetBootFileXferSize = 0;
+
+debug("TFTP: Filename: %s Address: 0x%08X\n", BootFile,
+(unsigned int)load_addr);
+
+if (NetLoop (TFTP) <= 0) {
+printf("ERROR: tftp transfer failed\n");
+return -1;
+}
+
+if (NetBootFileXferSize == 0) {
+printf("ERROR: Can't determine file size\n");
+return -1;
+}
+
+printf("File transfer succeeded - file size %lu bytes\n",
+NetBootFileXferSize);
+return 0;
+}
diff --git a/doc/README.tftp b/doc/README.tftp
new file mode 100755
index 000..d13603a
--- /dev/null
+++ b/doc/README.tftp
@@ -0,0 +1,29 @@
+Get a file from a TFTP server
+=
+
+Overview
+
+
+The "tftp" command allows a user retrieve a file from a TFTP server and 
store
+it in RAM. The RAM load address and the filename are passed via the 
command
+line and the TFTP server address is that defined by the "serverip" 
environment
+variable.
+
+Enabling the command
+
+
+The command is enabled in the build by the CONFIG_CMD_TFTP macro:
+
+#define CONFIG_CMD_TFTP1
+
+Using the command
+-
+
+The format of the command is:
+
+tftp  
+
+where:
+
+ is the address of the RAM buffer used to receive the file
+ is the name of the file to be retrieved via tftp
diff --git a/include/config_cmd_all.h b/include/config_cmd_all.h
index db1f55c..a7129d4 100644
--- a/include/config_cmd_all.h
+++ b/include/config_cmd_all.h
@@ -78,6 +78,7 @@
 #define CONFIG_CMD_SNTP/* SNTP support*/
 #define CONFIG_CMD_SPI/* SPI utility*/
 #define CONFIG_CMD_TERMINAL/* built-in Serial Terminal*/
+#define CONFIG_CMD_TFTP/* Get file via TFTP*/
 #define CONFIG_CMD_UNIVERSE/* Tundra Universe Support*/
 #define CONFIG_CMD_UNZIP/* unzip from memory to memory*/
 #define CONFIG_CMD_USB/* USB Support*/
diff --git a/include/config_cmd_default.h b/include/config_cmd_default.h
index 3667602..cee6a1c 100644
--- a/include/config_cmd_default.h
+++ b/include/config_cmd_default.h
@@ -37,6 +37,7 @@
 #define CONFIG_CMD_NFS/* NFS support*/
 #define CONFIG_CMD_RUN/* run command in env variable*/
 #define CONFIG_CMD_SETGETDCR/* DCR support on 4xx*/
+#define CONFIG_CMD_TFTP/* Get file via TFTP*/
 #define CONFIG_CMD_XIMG/* Load part of Multi Image*/
 
 #endif/* _CONFIG_CMD_DEFAULT_H */
-- 
1.6.0.6


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] Added a tftp command

2009-03-31 Thread kevin.morf...@fearnside-systems.co.uk
Mike Frysinger wrote:
> On Tuesday 31 March 2009 18:44:21 kevin.morf...@fearnside-systems.co.uk wrote:
>   
>> Adds a "tftp" command that gets a specified file from a TFTP Server and
>> stores it in RAM at a specified RAM address. Most of the code already
>> exists in board-specific form (eg in board/hymod) but this patch
>> extracts it and makes it available as a standard u-boot command.
>> 
>
> your patch is horribly word wrapped.  ignoring that, how is this any 
> different 
> from the "tftpboot" command ?  i use "t  " to load arbitrary 
> files 
> via tftp to arbitrary addresses all the time.
> -mike
>   
"tftpboot" loads the file then if "autostart" is "yes" it automatically 
boots from the load address. The patch just loads the file then stops. 
When programming a board I use it to copy images across before I program 
them into flash. In effect, it does the same thing as setting 
"autostart" to "off" then using "tftpboot".

I'm new to creating patches which I think explains the horrible word 
wrapping.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] Added a tftp command

2009-03-31 Thread kevin.morf...@fearnside-systems.co.uk
Kumar Gala wrote:
>
> On Mar 31, 2009, at 5:44 PM, kevin.morf...@fearnside-systems.co.uk wrote:
>
>> Adds a "tftp" command that gets a specified file from a TFTP Server and
>> stores it in RAM at a specified RAM address. Most of the code already
>> exists in board-specific form (eg in board/hymod) but this patch
>> extracts it and makes it available as a standard u-boot command.
>>
>> Signed-off-by: Kevin Morfitt 
>> ---
>> common/cmd_tftp.c|   59
>> ++
>> doc/README.tftp  |   29 
>> include/config_cmd_all.h |1 +
>> include/config_cmd_default.h |1 +
>> 4 files changed, 90 insertions(+), 0 deletions(-)
>> create mode 100755 common/cmd_tftp.c
>> create mode 100755 doc/README.tftp
>
> I'm quite confused.  We already have support for this.  I'm pretty 
> sure I use it almost daily.
>
> - k
So do I but I'm working with a u-boot my customer has modified to add it 
as a board-specific command. When I tried to use it on a new board with 
the latest u-boot  I found it wasn't a standard u-boot command. It's 
almost identical to "tftpboot" except that if "autostart" is set to 
"yes" "tftpboot" automatically boots from the file after it's downloaded 
it but "tftp" doesn't. I use it to copy images across then manually 
program them into flash.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH-ARM] Add support for Embest SBC2440-II Board

2009-05-22 Thread kevin.morf...@fearnside-systems.co.uk

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

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

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

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

diff --git a/MAKEALL b/MAKEALL
index c98d03a..e7235e4 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -515,6 +515,7 @@ LIST_ARM9=" \
omap5912osk \
omap730p2   \
sbc2410x\
+   sbc2440ii   \
scb9328 \
smdk2400\
smdk2410\
diff --git a/Makefile b/Makefile
index 81a5cd0..38f79c2 100644
--- a/Makefile
+++ b/Makefile
@@ -2876,6 +2876,9 @@ omap730p2_cs3boot_config :unconfig
 sbc2410x_config: unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t sbc2410x NULL s3c24x0
 
+sbc2440ii_config: unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm920t sbc2440ii embest s3c24x0
+
 scb9328_config :   unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t scb9328 NULL imx
 
diff --git a/board/embest/sbc2440ii/Makefile b/board/embest/sbc2440ii/Makefile
new file mode 100644
index 000..85a56fa
--- /dev/null
+++ b/board/embest/sbc2440ii/Makefile
@@ -0,0 +1,55 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# Modified for EMBEST SBC2440-II board with S3C2440 (ARM920T) cpu by:
+# (C) Copyright 2009
+# Kevin Morfitt, Fearnside Systems Ltd, 
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).a
+
+COBJS  := sbc2440ii.o
+SOBJS  := lowlevel_init.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak $(obj).depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/embest/sbc2440ii/config.mk b/board/embest/sbc2440ii/config.mk
new file mode 100644
index 000..def11d8
--- /dev/null
+++ b/board/embest/sbc2440ii/config.mk
@@ -0,0 +1,25 @@
+#
+# (C) Co

[U-Boot] [PATCH-ARM v2] Add support for Embest SBC2440-II Board

2009-05-26 Thread kevin.morf...@fearnside-systems.co.uk
Implementation based on the existing u-boot support for S3C2410-based boards. 
u-boot programmed into NOR flash.

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

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

Changes since v1:
- removed all network-related parameters from board config file as requested by 
Ben Warren

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

diff --git a/MAKEALL b/MAKEALL
index c98d03a..e7235e4 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -515,6 +515,7 @@ LIST_ARM9=" \
omap5912osk \
omap730p2   \
sbc2410x\
+   sbc2440ii   \
scb9328 \
smdk2400\
smdk2410\
diff --git a/Makefile b/Makefile
index 81a5cd0..38f79c2 100644
--- a/Makefile
+++ b/Makefile
@@ -2876,6 +2876,9 @@ omap730p2_cs3boot_config :unconfig
 sbc2410x_config: unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t sbc2410x NULL s3c24x0
 
+sbc2440ii_config: unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm920t sbc2440ii embest s3c24x0
+
 scb9328_config :   unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t scb9328 NULL imx
 
diff --git a/board/embest/sbc2440ii/Makefile b/board/embest/sbc2440ii/Makefile
new file mode 100644
index 000..85a56fa
--- /dev/null
+++ b/board/embest/sbc2440ii/Makefile
@@ -0,0 +1,55 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# Modified for EMBEST SBC2440-II board with S3C2440 (ARM920T) cpu by:
+# (C) Copyright 2009
+# Kevin Morfitt, Fearnside Systems Ltd, 
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).a
+
+COBJS  := sbc2440ii.o
+SOBJS  := lowlevel_init.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak $(obj).depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/embest/sbc2440ii/config.mk b/board/embest/sbc2440ii/config.mk
new file mo

Re: [U-Boot] [PATCH-ARM] Add support for Embest SBC2440-II Board

2009-06-03 Thread kevin.morf...@fearnside-systems.co.uk
Hi Jean-Christophe

Comments below...

On 03/06/2009 00:35, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 03:24 Sat 23 May , kevin.morf...@fearnside-systems.co.uk wrote:
>   
>> Implementation based on the existing u-boot support for S3C2410-based 
>> boards. u-boot programmed into NOR flash.
>>
>> Tested on an SBC2440-II Board using tftp to copy the files from a server and 
>> programming them into NAND flash.
>>
>> MAKEALL used to build all LIST_ARM9 targets only - no other architectures 
>> built as the changes only affect ARM9-based boards.
>>
>> Signed-off-by: Kevin Morfitt 
>> 
> please limit your comments to 80 chars per line
> could you split this patch in multiple subset as adding the 2440 support,
> addind the nand drivers and then adding the board.
>
> This will really simplify the review
>   
>> ---
>>  MAKEALL|1 +
>> 
> please add MAINTAINERS entry
>   
>> 
> 
>   
>> diff --git a/MAKEALL b/MAKEALL
>> index c98d03a..e7235e4 100755
>> + */
>> +
>> +#include 
>> +#include 
>> +
>> +/*
>> + * Taken from linux/arch/arm/boot/compressed/head-s3c2410.S
>> + *
>> + * Copyright (C) 2002 Samsung Electronics SW.LEE  
>> + */
>> +
>> +#define BWSCON  0x4800
>> +
>> +#define DW8 (0x0)
>> +#define DW16(0x1)
>> +#define DW32(0x2)
>> +#define WAIT(0x1 << 2)
>> +#define UBLB(0x1 << 3)
>> 
> what is all theses macro? for what use?
>   
They make setting the fields of the memory controller registers more
readable. For example BSWCON is
the Bus Width and Wait Control Register, DW32 sets a Data Width value
bit-field in BWSCON to 8-bit
etc. They're used later in the patch to configure the memory controller
registers. The names are the same
as those used in the S3C2440 data sheet.

>> +
>> +#define B1_BWSCON   (DW16)
>> +#define B2_BWSCON   (DW16)
>> +#define B3_BWSCON   (DW16 + WAIT + UBLB)
>> +#define B4_BWSCON   (DW16)
>> +#define B5_BWSCON   (DW16)
>> +#define B6_BWSCON   (DW32)
>> +#define B7_BWSCON   (DW32)
>> 
>
>   
>> diff --git a/board/embest/sbc2440ii/sbc2440ii.c 
>> b/board/embest/sbc2440ii/sbc2440ii.c
>> new file mode 100644
>> index 000..e0599dd
>> --- /dev/null
>> +++ b/board/embest/sbc2440ii/sbc2440ii.c
>> @@ -0,0 +1,127 @@
>> +/*
>> + * (C) Copyright 2002
>> + * Sysgo Real-Time Solutions, GmbH 
>> + * Marius Groeger 
>> + *
>> + * (C) Copyright 2002
>> + * David Mueller, ELSOFT AG, 
>> + *
>> + * (C) Copyright 2005
>> + * JinHua Luo, GuangDong Linux Center, 
>> + *
>> + * Modified for the Embest SBC2440-II by
>> + * (C) Copyright 2009
>> + * Kevin Morfitt, Fearnside Systems Ltd, 
>> 
>> + *
>> + * 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 
>> +#include 
>> +
>> +DECLARE_GLOBAL_DATA_PTR;
>> +
>> +/* Configure the PLLs for MPLL = 400MHz, UPLL = 48MHz
>> +The clock frequency ratios are set to 1:4:8 ie:
>> +PCLK = 50MHz
>> +HCLK = 100MHz
>> +FCLK = 400MHz
>> + */
>> +/* The MPLL values. */
>> +#define M_MDIV  0x5C
>> +#define M_PDIV  1
>> +#define M_SDIV  1
>> +
>> +/* The UPLL values. */
>> +#define U_MDIV  0x38
>> +#define U_PDIV  2
>> +#define U_SDIV  2
>> 
> this need to be in the config.h as CONFIS_SYS_x
>   
>> +
>> +/*
>> + * Miscellaneous platform dependent initialisations
>> + */
>> +
>> +static inline vo

Re: [U-Boot] [PATCH-ARM] Add support for Embest SBC2440-II Board

2009-06-03 Thread kevin.morf...@fearnside-systems.co.uk
Dear Wolfgang/Jean-Christophe

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

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

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

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

Regards
Kevin Morfitt

03/06/2009 11:05, Wolfgang Denk wrote:
> Dear "kevin.morf...@fearnside-systems.co.uk",
>
> In message <4a263923.2030...@fearnside-systems.co.uk> you wrote:
>   
>>>> +#define BWSCON0x4800
>>>> +
>>>> +#define DW8   (0x0)
>>>> +#define DW16  (0x1)
>>>> +#define DW32  (0x2)
>>>> +#define WAIT  (0x1 << 2)
>>>> +#define UBLB  (0x1 << 3)
>>>> 
>>>> 
>>> what is all theses macro? for what use?
>>>   
>>>   
>> They make setting the fields of the memory controller registers more
>> readable. For example BSWCON is
>> the Bus Width and Wait Control Register, DW32 sets a Data Width value
>> bit-field in BWSCON to 8-bit
>> etc. They're used later in the patch to configure the memory controller
>> registers. The names are the same
>> as those used in the S3C2440 data sheet.
>> 
>
> Please make sure to use C structs to descrive device register layout,
> and use proper I/O accessor functions for the actual access.
>
>   
>>>> +  gpio->GPBCON = 0x0005;
>>>> +  gpio->GPBUP  = 0x07FF;
>>>> +  gpio->GPBDAT = 0x01C0;  /* Switch on LED1. */
>>>> +  gpio->GPCCON = 0xAAAA;
>>>> +  gpio->GPCUP  = 0x;
>>>> +  gpio->GPDCON = 0x;
>>>> 
>
> Such code will not be accepted. Please use C structs and I/O accessor
> functions.
>
>
> Best regards,
>
> Wolfgang Denk
>
>   

-- 

Kevin Morfitt
Fearnside Systems Ltd
25 Holbeck Road
Nottingham
NG8 3PB

t: 0115 9136703
m: 07939 126277
e: kevin.morf...@fearnside-systems.co.uk



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

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] U-Boot][PATCH] ARM Clean-up of ARM920T S3C24x0 drivers code

2009-06-05 Thread kevin.morf...@fearnside-systems.co.uk
This re-formats the S3C24x0 drivers code to meet the coding style requirements 
and to make it always use the proper I/O accessor functions when accessing 
registers. It was done using 'Lindent -kr -i8 -l80' followed by manual 
inspection of the output. checkpatch.pl reports no problems with the patch
and I've run MAKEALL for all ARM9 boards with no problems.

This has been done to create a good starting point for me to add support for
a new board, the Embest SBC2440-II. Another patch does the same for the 
ARM920 S3C24x0 CPU and headers code.

Signed-off-by: Kevin Morfitt 
---
 drivers/i2c/s3c24x0_i2c.c   |  269 ---
 drivers/mtd/nand/s3c2410_nand.c |   97 +++
 drivers/rtc/s3c24x0_rtc.c   |  126 +-
 drivers/serial/serial_s3c24x0.c |  143 -
 4 files changed, 324 insertions(+), 311 deletions(-)

diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c
index f0c1aa3..33cd3d4 100644
--- a/drivers/i2c/s3c24x0_i2c.c
+++ b/drivers/i2c/s3c24x0_i2c.c
@@ -32,6 +32,8 @@
 #elif defined(CONFIG_S3C2410)
 #include 
 #endif
+
+#include 
 #include 
 
 #ifdef CONFIG_HARD_I2C
@@ -42,36 +44,35 @@
 #define I2C_OK 0
 #define I2C_NOK1
 #define I2C_NACK   2
-#define I2C_NOK_LA 3   /* Lost arbitration */
-#define I2C_NOK_TOUT   4   /* time out */
-
-#define I2CSTAT_BSY0x20/* Busy bit */
-#define I2CSTAT_NACK   0x01/* Nack bit */
-#define I2CCON_IRPND   0x10/* Interrupt pending bit */
-#define I2C_MODE_MT0xC0/* Master Transmit Mode */
-#define I2C_MODE_MR0x80/* Master Receive Mode */
-#define I2C_START_STOP 0x20/* START / STOP */
-#define I2C_TXRX_ENA   0x10/* I2C Tx/Rx enable */
+#define I2C_NOK_LA 3   /* Lost arbitration */
+#define I2C_NOK_TOUT   4   /* time out */
 
-#define I2C_TIMEOUT 1  /* 1 second */
+#define I2CSTAT_BSY0x20/* Busy bit */
+#define I2CSTAT_NACK   0x01/* Nack bit */
+#define I2CCON_IRPND   0x10/* Interrupt pending bit */
+#define I2C_MODE_MT0xC0/* Master Transmit Mode */
+#define I2C_MODE_MR0x80/* Master Receive Mode */
+#define I2C_START_STOP 0x20/* START / STOP */
+#define I2C_TXRX_ENA   0x10/* I2C Tx/Rx enable */
 
+#define I2C_TIMEOUT 1  /* 1 second */
 
 static int GetI2CSDA(void)
 {
S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
 
 #ifdef CONFIG_S3C2410
-   return (gpio->GPEDAT & 0x8000) >> 15;
+   return (readl(&gpio->GPEDAT) & 0x8000) >> 15;
 #endif
 #ifdef CONFIG_S3C2400
-   return (gpio->PGDAT & 0x0020) >> 5;
+   return (readl(&gpio->PGDAT) & 0x0020) >> 5;
 #endif
 }
 
 #if 0
 static void SetI2CSDA(int x)
 {
-   rGPEDAT = (rGPEDAT & ~0x8000) | (x&1) << 15;
+   rGPEDAT = (rGPEDAT & ~0x8000) | (x & 1) << 15;
 }
 #endif
 
@@ -80,104 +81,102 @@ static void SetI2CSCL(int x)
S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
 
 #ifdef CONFIG_S3C2410
-   gpio->GPEDAT = (gpio->GPEDAT & ~0x4000) | (x&1) << 14;
+   writel((readl(&gpio->GPEDAT) & ~0x4000) | (x & 1) << 14, &gpio->GPEDAT);
 #endif
 #ifdef CONFIG_S3C2400
-   gpio->PGDAT = (gpio->PGDAT & ~0x0040) | (x&1) << 6;
+   writel((readl(&gpio->PGDAT) & ~0x0040) | (x & 1) << 6, &gpio->PGDAT);
 #endif
 }
 
-
-static int WaitForXfer (void)
+static int WaitForXfer(void)
 {
-   S3C24X0_I2C *const i2c = S3C24X0_GetBase_I2C ();
-   int i, status;
+   S3C24X0_I2C * const i2c = S3C24X0_GetBase_I2C();
+   int i;
 
i = I2C_TIMEOUT * 1;
-   status = i2c->IICCON;
-   while ((i > 0) && !(status & I2CCON_IRPND)) {
-   udelay (100);
-   status = i2c->IICCON;
+   while (!(readl(&i2c->IICCON) & I2CCON_IRPND) && (i > 0)) {
+   udelay(100);
i--;
}
 
-   return (status & I2CCON_IRPND) ? I2C_OK : I2C_NOK_TOUT;
+   return (readl(&i2c->IICCON) & I2CCON_IRPND) ? I2C_OK : I2C_NOK_TOUT;
 }
 
-static int IsACK (void)
+static int IsACK(void)
 {
-   S3C24X0_I2C *const i2c = S3C24X0_GetBase_I2C ();
+   S3C24X0_I2C * const i2c = S3C24X0_GetBase_I2C();
 
-   return (!(i2c->IICSTAT & I2CSTAT_NACK));
+   return !(readl(&i2c->IICSTAT) & I2CSTAT_NACK);
 }
 
-static void ReadWriteByte (void)
+static void ReadWriteByte(void)
 {
-   S3C24X0_I2C *const i2c = S3C24X0_GetBase_I2C ();
+   S3C24X0_I2C * const i2c = S3C24X0_GetBase_I2C();
 
-   i2c->IICCON &= ~I2CCON_IRPND;
+   writel(readl(&i2c->IICCON) & ~I2CCON_IRPND, &i2c->IICCON);
 }
 
-void i2c_init (int speed, int slaveadd)
+void i2c_init(int speed, int slaveadd)
 {
-   S3C24X0_I2C *const i2c = S3C24X0_GetBase_I2C ();
-   S3C24X0_GPIO *const gpio = S3C24X0_GetBase_GPIO ();
+   S3C24X0_I2C * const i2c = S3C24X0_GetBase_I2C();
+   S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
ulong freq, pres = 

[U-Boot] [PATCH-ARM] Bug-fix in drivers mtd nand Makefile

2009-06-18 Thread kevin.morf...@fearnside-systems.co.uk
The S3C2410 NAND driver source file is included in the makefile instead of 
the object file.

Signed-off-by: Kevin Morfitt 
---
 drivers/mtd/nand/Makefile |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index 71dd5b9..7dfbeb5 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -42,7 +42,7 @@ COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o
 COBJS-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o
 COBJS-$(CONFIG_NAND_MPC5121_NFC) += mpc5121_nfc.o
 COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o
-COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.c
+COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.o
 COBJS-$(CONFIG_NAND_S3C64XX) += s3c64xx.o
 COBJS-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o
 endif
-- 1.6.0.6 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2009-06-19 Thread kevin.morf...@fearnside-systems.co.uk
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 
---
 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

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 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)
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 
-#if defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined 
(CONFIG_TRAB)
+#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || \
+defined(CONFIG_S3C2440) || defined(CONFIG_TRAB)
 
 #include 
 
@@ -38,6 +39,8 @@
 #include 
 #elif defined(CONFIG_S3C2410)
 #include 
+#elif defined(CONFIG_S3C2440)
+#include 
 #endif
 
 #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
 }
 
 /* return PCLK frequency */
@@ -97,9 +121,17 @@ ulong get_PCLK(void)
 /* return UCLK frequency */
 ulong get_UCLK(void)
 {
+#ifdef CONFIG_S3C2440
+   S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
+
+   return (readl(&clk_power->CLKDIVN) & (1 << 3)) ?
+   get_PLLCLK(UPLL) / 2 : get_PLLCLK(UPLL);
+#else
return get_PLLCLK(UPLL);
+#endif
 }
 
 #endif /* defined(CONFIG_S3C2400) ||
- defined (CONFIG_S3C2410) ||
- defined (CONFIG_TRAB) */
+ defined (CONFIG_S3C2410) ||
+ defined (CONFIG_S3C2440) ||
+ defined (CONFIG_TRAB) */
diff --git a/cpu/arm920t/s3c24x0/timer.c b/cpu/arm920t/s3c24x0/timer.c
index a5a784c..0f6b580 100644
--- a/cpu/arm920t/s3c24x0/timer.c
+++ b/cpu/arm920t/s3c24x0/timer.c
@@ -32,6 +32,7 @@
 #include 
 #if defined(CONFIG_S3C2400)  || \
 defined(CONFIG_S3C2410)  || \
+defined(CONFIG_S3C2440)  || \
 defined(CONFIG_TRAB)
 
 #include 
@@ -40,6 +41,8 @@
 #include 
 #elif defined(CONFIG_S3C2410)
 #include 
+#elif defined(CONFIG_S3C2440)
+#include 
 #endif
 
 int timer_load_val = 0;
@@ -230,5 +233,6 @@ void s3c2410_irq(void)
 #endif /* USE_IRQ */
 
 #endif /* defined(CONFIG_S3C2400)  ||
-

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

2009-06-19 Thread kevin.morf...@fearnside-systems.co.uk
This is the second of two patches that will add support for the Embest 
SBC2440-II Board. This one adds the new code for the Embest SBC2440-II Board. 
Tested on an Embest SBC2440-II Board with u-boot in NOR flash, using tftp to 
copy kernel and root file system images from a tftp server, programming them 
into NAND flash and ensuring the kernel boots correctly at re-start. Also, 
MAKEALL was run for all ARM9 boards and no new warnings or errors were found.

Signed-off-by: Kevin Morfitt 
---
 MAINTAINERS|4 +
 MAKEALL|1 +
 Makefile   |3 +
 board/embest/sbc2440ii/Makefile|   55 ++
 board/embest/sbc2440ii/config.mk   |   25 +++
 board/embest/sbc2440ii/lowlevel_init.S |  219 +++
 board/embest/sbc2440ii/sbc2440ii.c |  109 
 cpu/arm920t/s3c24x0/timer.c|1 +
 drivers/mtd/nand/s3c2440_nand.c|9 +-
 include/configs/sbc2440ii.h|  299 
 10 files changed, 722 insertions(+), 3 deletions(-)
 create mode 100644 board/embest/sbc2440ii/Makefile
 create mode 100644 board/embest/sbc2440ii/config.mk
 create mode 100644 board/embest/sbc2440ii/lowlevel_init.S
 create mode 100644 board/embest/sbc2440ii/sbc2440ii.c
 create mode 100644 include/configs/sbc2440ii.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 9379c7e..39c938e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -578,6 +578,10 @@ Nishanth Menon 
 
omap3_zoom1 ARM CORTEX-A8 (OMAP3xx SoC)
 
+Kevin Morfitt 
+
+   sbc2440ii   ARM920T
+
 David Müller 
 
smdk2410ARM920T
diff --git a/MAKEALL b/MAKEALL
index f4599d6..ae95ffa 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -519,6 +519,7 @@ LIST_ARM9=" \
omap5912osk \
omap730p2   \
sbc2410x\
+   sbc2440ii   \
scb9328 \
smdk2400\
smdk2410\
diff --git a/Makefile b/Makefile
index acec1a0..ddcb1cc 100644
--- a/Makefile
+++ b/Makefile
@@ -2900,6 +2900,9 @@ omap730p2_cs3boot_config :unconfig
 sbc2410x_config: unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t sbc2410x NULL s3c24x0
 
+sbc2440ii_config: unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm920t sbc2440ii embest s3c24x0
+
 scb9328_config :   unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t scb9328 NULL imx
 
diff --git a/board/embest/sbc2440ii/Makefile b/board/embest/sbc2440ii/Makefile
new file mode 100644
index 000..f791f39
--- /dev/null
+++ b/board/embest/sbc2440ii/Makefile
@@ -0,0 +1,55 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# Modified for EMBEST SBC2440-II board with S3C2440 (ARM920T) cpu by:
+# (C) Copyright 2009
+# Kevin Morfitt, Fearnside Systems Ltd, 
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB  = $(obj)lib$(BOARD).a
+
+COBJS   := sbc2440ii.o
+SOBJS   := lowlevel_init.o
+
+SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS := $(addprefix $(obj),$(COBJS))
+SOBJS   := $(addprefix $(obj),$(SOBJS))
+
+$(LIB): $(obj).depend $(OBJS) $(SOBJS)
+   $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak $(obj).depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/embest/sbc2440ii/config.mk b/board/embest/sbc2440ii/config.mk
new file mode 100644
index 000..def11d8
--- /dev/null
+++ b/board/embest/sbc2440ii/config.mk
@@ -0,0 +1,25 @@
+#
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, 
+# David Mueller, ELSOFT AG, 
+#
+# SAMSUNG SMDK2410 board with S3C2410X (ARM920T) cpu
+#
+# see http://www.samsung.com/ for more information on SAMSUNG
+#
+# Modified for EMBEST SBC2440-II board with S3C2440 (ARM920T) cpu by:
+# (C) Copyright 2009
+# Kevin Morfitt, Fearnside Systems Ltd, 
+
+#
+# SBC2440-II has 1 bank of 64 MB D

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

2009-06-20 Thread kevin.morf...@fearnside-systems.co.uk
Hi Jean-Christophe, comments below:

Also, see note at the end regarding re-structuring of the existing
s3c24x0 and
Embest SBC2440-II Board patches.

On 20/06/2009 18:36, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 17:42 Fri 19 Jun , kevin.morf...@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 
>> ---
>>  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
>   
s3c24x0 refers to the Samsung s3c type of cpu's - s3c2400, s3c2410 and
s3c2440.
Support for the s3c2400 and s3c2410 cpu's already exists in the current
u-boot
code base in cpu/arm920t/s3c24x0 but there is currently no support for the
s3c2440 cpu.

However, the format of the current s3c24x0 code doesn't meet the u-boot
coding
style so I've already submitted 2 patches to clean up the current
s3c24x0 code
- see reference at the top of this patch to the patches "Clean-up of
ARM920T
S3C24x0 code, submitted on 5th June" and "Clean-up of ARM920T S3C24x0
drivers
code, submitted on 5th June".

This patch, 1/2, just adds support for the s3c2440 cpu (including the new
s3c2440 NAND driver) to the current s3c24x0 code - it doesn't actually
add the
Embest SBC2440-II Board support. Patch 2/2 is the one that adds the
support for
the Embest SBC2440-II Board itself.

So, the patches are already structured as you requested.

It's getting a bit complicated because I initially sent a patch to add
all of
the Embest SBC2440-II Board changes in one go. Wolfgang and yourself
asked me
to create patches to clean up the existing code base first and to add the
s3c2440 support separately to the Embest SBC2440-II Board so I now have 4
patches all dependent on one another and it's not too clear how they fit
together.
>> 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
>   
Could you explain a bit more about how the macro would work please?
>>  #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 
>>

[U-Boot] [PATCH-ARM] CONFIG_SYS_HZ fix for ARM920T S3C24X0 Boards

2009-06-20 Thread kevin.morf...@fearnside-systems.co.uk
This sets CONFIG_SYS_HZ to 1000 for all boards that use the s3c2400 and 
s3c2410 cpu's.

Tested on an Embest SBC2440-II Board with local u-boot patches as I don't 
have any s3c2400 or s3c2410 boards but need this patch applying before I can 
submit patches for thge SBC2440-II Board.

Also, ran MAKEALL for all ARM9 targets and no new warnings or errors were found.

Note that the existing code modified by this patch does not meet the u-boot 
coding style but I'd like to handle this separately and submit patches to fix 
this later.

Signed-off-by: Kevin Morfitt 
---
 cpu/arm920t/s3c24x0/timer.c |   42 ++
 include/configs/sbc2410x.h  |4 +---
 include/configs/smdk2400.h  |4 +---
 include/configs/smdk2410.h  |4 +---
 include/configs/trab.h  |   12 +---
 5 files changed, 30 insertions(+), 36 deletions(-)
 mode change 100644 => 100755 cpu/arm920t/s3c24x0/timer.c
 mode change 100644 => 100755 include/configs/sbc2410x.h
 mode change 100644 => 100755 include/configs/smdk2400.h
 mode change 100644 => 100755 include/configs/smdk2410.h
 mode change 100644 => 100755 include/configs/trab.h

diff --git a/cpu/arm920t/s3c24x0/timer.c b/cpu/arm920t/s3c24x0/timer.c
old mode 100644
new mode 100755
index f0a09cd..8ea2e4b
--- a/cpu/arm920t/s3c24x0/timer.c
+++ b/cpu/arm920t/s3c24x0/timer.c
@@ -38,7 +38,9 @@
 #include 
 #endif
 
+static unsigned long get_timer_raw(void);
 int timer_load_val = 0;
+static ulong timer_clk;
 
 /* macro to read the 16 bit timer */
 static inline ulong READ_TIMER(void)
@@ -66,6 +68,7 @@ int timer_init (void)
 * @33.25MHz and 15625 @ 50 MHz
 */
timer_load_val = get_PCLK()/(2 * 16 * 100);
+   timer_clk = get_PCLK() / (2 * 16);
}
/* load value for 10 ms timeout */
lastdec = timers->TCNTB4 = timer_load_val;
@@ -100,13 +103,13 @@ void set_timer (ulong t)
 void udelay (unsigned long usec)
 {
ulong tmo;
-   ulong start = get_timer(0);
+   ulong start = get_timer_raw();
 
tmo = usec / 1000;
tmo *= (timer_load_val * 100);
tmo /= 1000;
 
-   while ((ulong)(get_timer_masked () - start) < tmo)
+   while ((ulong) (get_timer_raw() - start) < tmo)
/*NOP*/;
 }
 
@@ -119,18 +122,9 @@ void reset_timer_masked (void)
 
 ulong get_timer_masked (void)
 {
-   ulong now = READ_TIMER();
+   ulong tmr = get_timer_raw();
 
-   if (lastdec >= now) {
-   /* normal mode */
-   timestamp += lastdec - now;
-   } else {
-   /* we have an overflow ... */
-   timestamp += lastdec + timer_load_val - now;
-   }
-   lastdec = now;
-
-   return timestamp;
+   return tmr / (timer_clk / CONFIG_SYS_HZ);
 }
 
 void udelay_masked (unsigned long usec)
@@ -148,21 +142,37 @@ void udelay_masked (unsigned long usec)
tmo /= (1000*1000);
}
 
-   endtime = get_timer_masked () + tmo;
+   endtime = get_timer_raw() + tmo;
 
do {
-   ulong now = get_timer_masked ();
+   ulong now = get_timer_raw();
diff = endtime - now;
} while (diff >= 0);
 }
 
+static unsigned long get_timer_raw(void)
+{
+   ulong now = READ_TIMER();
+
+   if (lastdec >= now) {
+   /* normal mode */
+   timestamp += lastdec - now;
+   } else {
+   /* we have an overflow ... */
+   timestamp += lastdec + timer_load_val - now;
+   }
+   lastdec = now;
+
+   return timestamp;
+}
+
 /*
  * This function is derived from PowerPC code (read timebase as long long).
  * On ARM it just returns the timer value.
  */
 unsigned long long get_ticks(void)
 {
-   return get_timer(0);
+   return get_timer_raw();
 }
 
 /*
diff --git a/include/configs/sbc2410x.h b/include/configs/sbc2410x.h
old mode 100644
new mode 100755
index eab9629..e8afa50
--- a/include/configs/sbc2410x.h
+++ b/include/configs/sbc2410x.h
@@ -138,9 +138,7 @@
 
 #defineCONFIG_SYS_LOAD_ADDR0x3300  /* default load 
address */
 
-/* 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. */
-#defineCONFIG_SYS_HZ   1562500
+#defineCONFIG_SYS_HZ   1000
 
 /* valid baudrates */
 #define CONFIG_SYS_BAUDRATE_TABLE  { 9600, 19200, 38400, 57600, 115200 }
diff --git a/include/configs/smdk2400.h b/include/configs/smdk2400.h
old mode 100644
new mode 100755
index b712db4..22b88ae
--- a/include/configs/smdk2400.h
+++ b/include/configs/smdk2400.h
@@ -140,9 +140,7 @@
 
 #defineCONFIG_SYS_LOAD_ADDR0x0cf0  /* default load 
address */
 
-/* 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. */
-#defineCONFIG_SYS_HZ   1562500
+#defineCONFIG_

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

2009-06-21 Thread kevin.morf...@fearnside-systems.co.uk

On 21/06/2009 10:46, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 00:56 Sun 21 Jun , kevin.morf...@fearnside-systems.co.uk wrote:
>> Hi Jean-Christophe, comments below:
>>
>> Also, see note at the end regarding re-structuring of the existing
>> s3c24x0 and
>> Embest SBC2440-II Board patches.
>>

>> Wolfgang has also asked me to make the CONFIG_SYS_HZ change in the current
>> s3c2400 and s3c2410 boards before I add support for the s3c2440. I've
>> already
>> submitted 5 patches as part of the s3c24x0 clean up and Embest
>> SBC2440-II Board
>> so this would make a 6th and it's getting difficult to track them all.
> no just thread all of them

when you say 'thread all of them' do you mean send them separately but 
numbered in the Subject field like 1/5, 2/5 etc?

>> If you agree, I'd like to withdraw the following patches for now as they
>> all
>> need changes:
>>
>> - [U-Boot] [PATCH-ARM] Clean-up of ARM920T S3C24x0 code, submitted on
>> 5th June
>> - [U-Boot] [PATCH-ARM] Clean-up of ARM920T S3C24x0 drivers code,
>> submitted on
>>   5th June

The patch above does a code style clean-up of the s3c24x0 drivers code. 
This includes the mtd nand s3c2410 driver. Do I need to put the mtd nand 
s3c2410 driver clean-up in a separate patch or can I leave it in the 
same patch but just include something like PATCH-ARM,MTD-NAND in the 
Subject field?

> patch 3
>   move the start.S code
>> - [U-Boot] [PATCH-ARM 1/2] Add support for the Embest SBC2440-II Board
>> (ie this
>>   patch)
> patch 5
>   add the nand
>> - [U-Boot] [PATCH-ARM 2/2] Add support for the Embest SBC2440-II Board,
>>   submitted on 19th June
>>
>> I'll create the new CONFIG_SYS_HZ patch and submit it, then make the
>> required
>> changes to the 4 patches above, then re-submit these 4 together, probably
>> marked 1/4, 2/4, 3/4 and 4/4, all version 2.
>>
>> However, the following patch doesn't need any changes so I'd like to
>> leave it
>> out for comment:
>>
>> - [U-Boot] [PATCH-ARM] Bug-fix in drivers mtd nand Makefile, submitted
>> on 18th
>   This will be handle by Scott with the nand patch
> 
> Best Regards,
> J.
> 
> __ Information from ESET NOD32 Antivirus, version of virus signature 
> database 4174 (20090620) __
> 
> The message was checked by ESET NOD32 Antivirus.
> 
> http://www.eset.com
> 



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4174 (20090620) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2009-06-22 Thread kevin.morf...@fearnside-systems.co.uk


On 22/06/2009 20:04, Scott Wood wrote:
> Jean-Christophe PLAGNIOL-VILLARD wrote:
>> no as you add the nand in this patch
>> the nand need to be add in a seperate patch,
>> this one need to only add the s3c2440 support
>> and the nand will be handle by Scott the nand Maintainer
> 
> If a NAND patch is sandwiched in the middle of other patches that need 
> to go via an arch tree, and depends on some of those patches, I'd rather 
> ack the NAND bits to go through the arch tree rather than try to merge 
> everything separately while still maintaining dependencies.  In that 
> case, keeping the NAND bits in a separate patch is nice, but not 
> mandatory IMHO.
> 

Thanks, leaving the NAND changes in the arch-specific patch would be simpler 
for me. I have to make some changes to the SBC2440 patch anyway so I'll make 
sure I cc you when I re-send it.

> I'll look at that patch soon.
> 
> -Scott
> 



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4179 (20090622) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2009-06-22 Thread kevin.morf...@fearnside-systems.co.uk

On 22/06/2009 20:26, Scott Wood wrote:
> Keven Morfitt wrote:
>> diff --git a/drivers/mtd/nand/s3c2410_nand.c 
>> b/drivers/mtd/nand/s3c2410_nand.c
>> index 60bfd10..b93787c 100644
>> --- a/drivers/mtd/nand/s3c2410_nand.c
>> +++ b/drivers/mtd/nand/s3c2410_nand.c
>> @@ -36,7 +36,7 @@
>>  static void s3c2410_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int 
>> ctrl)
>>  {
>>  struct nand_chip *chip = mtd->priv;
>> -S3C24X0_NAND * const nand = S3C24X0_GetBase_NAND();
>> +S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
> 
> This isn't new to this patch, but please don't make type names look like
> preprocessor macros (i.e. not ALL CAPS).  Also, no space after * when
> it means pointer and not multiply.
> 
> Is there any particular reason to declare the pointer itself as const? 
> It's just a local variable.
> 

These type names (and the 'const') are in the existing s3c24x0 code so I 
just made my new code follow the same style and Lindent and checkpatch 
didn't complain. The u-boot coding style guidelines say we should use the 
Linux coding style and this says that 'mixed case names are frowned upon' 
and 'It's a _mistake_ to use typedef for structures' so it doesn't meet 
the coding style, at least for the use of typedef if not for the upper 
case names. I'll change it throughout the s3c24x0 code.

>> +#ifdef CONFIG_S3C2440_NAND_HWECC
>> +/* new oob placement block for use with hardware ecc generation
>> + */
>> +static struct nand_ecclayout nand_hw_eccoob = {
>> +.eccbytes = 3,
>> +.eccpos = {0, 1, 2},
>> +.oobfree = { {8, 8} }
>> +};
> 
> Any reason why bytes 3, 4, 6, and 7 aren't free?
> 

I ported this from the Linux s3c2410 NAND driver (which covers s3c2440
as well as s3c2410). It worked when I tested it (after I enabled hardware
ECC and fixed the problem below), but I don't know enough about how mtd
hardware ecc works to understand why it was done this way in the Linux 
kernel. A comment in the kernel code says that nand_ecclayout is 
'Exported to userspace for diagnosis and to allow creation of raw 
images' so it's likely I haven't tested this bit as all I did was check 
that NAND read/write worked. I'll have a look at it in more detail.

>> +static int s3c2440_dev_ready(struct mtd_info *mtd)
>> +{
>> +S3C2440_NAND * const nand = S3C2440_GetBase_NAND();
>> +
>> +debugX(1, "dev_ready\n");
>> +return readl(&nand->NFSTAT) & 0x01;
>> +}
>> +
>> +#ifdef CONFIG_S3C2440_NAND_HWECC
>> +void s3c2440_nand_enable_hwecc(struct mtd_info *mtd, int mode)
>> +{
>> +S3C2440_UART * const nand = S3C2440_GetBase_NAND();
> 
> UART?
> 

Thanks, I should obviously be more careful with cut and paste! I also 
forgot to test the patch with hardware ECC enabled.

>> +static int s3c2440_nand_correct_data(struct mtd_info *mtd, u_char *dat,
>> + u_char *read_ecc, u_char *calc_ecc)
>> +{
>> +unsigned int diff0, diff1, diff2;
>> +unsigned int bit, byte;
>> +
>> +debugX(2, "s3c2440_nand_correct_data:\n");
>> +
>> +diff0 = read_ecc[0] ^ calc_ecc[0];
>> +diff1 = read_ecc[1] ^ calc_ecc[1];
>> +diff2 = read_ecc[2] ^ calc_ecc[2];
>> +
>> +debugX(3, "rd %02x%02x%02x calc %02x%02x%02x diff %02x%02x%02x\n",
>> +read_ecc[0], read_ecc[1], read_ecc[2],
>> +calc_ecc[0], calc_ecc[1], calc_ecc[2],
>> +diff0, diff1, diff2);
>> +
>> +if (diff0 == 0 && diff1 == 0 && diff2 == 0)
>> +return 0;   /* ECC is ok */
>> +
>> +/* Can we correct this ECC (ie, one row and column change).
>> + * Note, this is similar to the 256 error code on smartmedia */
>> +
>> +if (((diff0 ^ (diff0 >> 1)) & 0x55) == 0x55 &&
>> +((diff1 ^ (diff1 >> 1)) & 0x55) == 0x55 &&
>> +((diff2 ^ (diff2 >> 1)) & 0x55) == 0x55) {
>> +/* calculate the bit position of the error */
>> +bit  = ((diff2 >> 3) & 1) |
>> +   ((diff2 >> 4) & 2) |
>> +   ((diff2 >> 5) & 4);
>> +
>> +/* calculate the byte position of the error */
>> +byte = ((diff2 << 7) & 0x100) |
>> +   ((diff1 << 0) & 0x80)  |
>> +   ((diff1 << 1) & 0x40)  |
>> +   ((diff1 << 2) & 0x20)  |
>> +   ((diff1 << 3) & 0x10)  |
>> +   ((diff0 >> 4) & 0x08)  |
>> +   ((diff0 >> 3) & 0x04)  |
>> +   ((diff0 >> 2) & 0x02)  |
>> +   ((diff0 >> 1) & 0x01);
>> +
>> +debugX(2, "correcting error bit %d, byte %d\n", bit, byte);
>> +
>> +dat[byte] ^= (1 << bit);
>> +return 1;
>> +}
>> +
>> +debugX(2, "Failed to correct ECC error\n");
>> +return -1;
>> +}
> 
> Hmm, this looks very similar to the generic correct_data, except that it
> uses a 512-byte block (and is missing the final countbits check -- not
> sure what that's for, perhaps a single bit error in the ECC itself?). 
> 
> Perhaps it should be factore

Re: [U-Boot] [PATCH-ARM] Bug-fix in drivers mtd nand Makefile

2009-06-22 Thread kevin.morf...@fearnside-systems.co.uk
Scott - sorry, I forgot to cc you on this one.

On 18/06/2009 18:41, kevin.morf...@fearnside-systems.co.uk wrote:
> The S3C2410 NAND driver source file is included in the makefile instead of 
> the object file.
> 
> Signed-off-by: Kevin Morfitt 
> ---
>  drivers/mtd/nand/Makefile |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
> index 71dd5b9..7dfbeb5 100644
> --- a/drivers/mtd/nand/Makefile
> +++ b/drivers/mtd/nand/Makefile
> @@ -42,7 +42,7 @@ COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o
>  COBJS-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o
>  COBJS-$(CONFIG_NAND_MPC5121_NFC) += mpc5121_nfc.o
>  COBJS-$(CONFIG_NAND_NOMADIK) += nomadik.o
> -COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.c
> +COBJS-$(CONFIG_NAND_S3C2410) += s3c2410_nand.o
>  COBJS-$(CONFIG_NAND_S3C64XX) += s3c64xx.o
>  COBJS-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o
>  endif
> -- 1.6.0.6 
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
> 



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4179 (20090622) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM920T SMDK2440 support

2009-06-24 Thread kevin.morf...@fearnside-systems.co.uk
I'm hoping to submit patches to add support for the Embest SBC2440-II 
Board later today. It uses an s3c2440 CPU so my patches would make a 
good starting point for the SMDK2440 board.

- Kevin

On 24/06/2009 09:42, J.Hwan.Kim wrote:
> Hi, everyone
> 
> Is U-Boot not support ARM920T SMDK2440 board?
> 
> Regards,
> J.H.Kim
> 
> 
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
> 
> __ Information from ESET NOD32 Antivirus, version of virus signature 
> database 4181 (20090623) __
> 
> The message was checked by ESET NOD32 Antivirus.
> 
> http://www.eset.com
> 
> 
> 
> 



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4184 (20090624) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH-ARM] Add support for Embest SBC2440-II Board 3/7

2009-06-24 Thread kevin.morf...@fearnside-systems.co.uk

This patch re-formats the s3c24x0 driver code, excluding the MTD NAND 
driver which is in patch 4, in preparation for changes to make the 
NAND driver support both s3c2410 and s3c2440 CPU's, ready for the 
addition of the Embest SBC2440-II Board.

The changes are as follows:

- re-indent the code using Lindent
- mak sure register layouts are defined using a C struct, from a 
  comment by Wolfgang on 03/06/2009
- replace the upper-case typedef'ed C struct names with lower case 
  non-typedef'ed ones, from a comment by Scott on 22/06/2009
- make sure registers are accessed using the proper accessor 
  functions, from a comment by Wolfgang on 03/06/2009
- run checkpatch.pl and fix any error reports

Signed-off-by: Kevin Morfitt 
---
 board/mpl/vcma9/vcma9.c   |7 +-
 board/mpl/vcma9/vcma9.h   |   18 ++--
 board/samsung/smdk2400/smdk2400.c |5 +-
 board/samsung/smdk2410/smdk2410.c |5 +-
 board/sbc2410x/sbc2410x.c |7 +-
 board/trab/cmd_trab.c |8 +-
 board/trab/rs485.c|   12 +-
 board/trab/trab.c |   17 ++-
 board/trab/trab_fkt.c |   22 ++--
 board/trab/tsc2000.c  |   17 ++-
 board/trab/tsc2000.h  |4 +-
 board/trab/vfd.c  |   12 +-
 drivers/i2c/s3c24x0_i2c.c |  273 +++--
 drivers/rtc/s3c24x0_rtc.c |  134 +-
 drivers/serial/serial_s3c24x0.c   |  160 --
 15 files changed, 368 insertions(+), 333 deletions(-)

diff --git a/board/mpl/vcma9/vcma9.c b/board/mpl/vcma9/vcma9.c
index a4c463a..3d0947d 100644
--- a/board/mpl/vcma9/vcma9.c
+++ b/board/mpl/vcma9/vcma9.c
@@ -71,8 +71,9 @@ static inline void delay(unsigned long loops)
 
 int board_init(void)
 {
-   S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
-   S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
+   struct s3c24x0_clock_power * const clk_power =
+   S3C24X0_GetBase_CLOCK_POWER();
+   struct s3c24x0_gpio * const gpio = S3C24X0_GetBase_GPIO();
 
/* to reduce PLL lock time, adjust the LOCKTIME register */
clk_power->LOCKTIME = 0xFF;
@@ -172,7 +173,7 @@ static inline void NF_Init(void)
 void
 nand_init(void)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = S3C2410_GetBase_NAND();
 
NF_Init();
 #ifdef DEBUG
diff --git a/board/mpl/vcma9/vcma9.h b/board/mpl/vcma9/vcma9.h
index 220b705..8f98e9e 100644
--- a/board/mpl/vcma9/vcma9.h
+++ b/board/mpl/vcma9/vcma9.h
@@ -39,14 +39,14 @@ typedef enum {
 
 static inline void NF_Conf(u16 conf)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = S3C2410_GetBase_NAND();
 
nand->NFCONF = conf;
 }
 
 static inline void NF_Cmd(u8 cmd)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = S3C2410_GetBase_NAND();
 
nand->NFCMD = cmd;
 }
@@ -59,14 +59,14 @@ static inline void NF_CmdW(u8 cmd)
 
 static inline void NF_Addr(u8 addr)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = S3C2410_GetBase_NAND();
 
nand->NFADDR = addr;
 }
 
 static inline void NF_SetCE(NFCE_STATE s)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = S3C2410_GetBase_NAND();
 
switch (s) {
case NFCE_LOW:
@@ -81,35 +81,35 @@ static inline void NF_SetCE(NFCE_STATE s)
 
 static inline void NF_WaitRB(void)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = S3C2410_GetBase_NAND();
 
while (!(nand->NFSTAT & (1<<0)));
 }
 
 static inline void NF_Write(u8 data)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = S3C2410_GetBase_NAND();
 
nand->NFDATA = data;
 }
 
 static inline u8 NF_Read(void)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = S3C2410_GetBase_NAND();
 
return(nand->NFDATA);
 }
 
 static inline void NF_Init_ECC(void)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = S3C2410_GetBase_NAND();
 
nand->NFCONF |= (1<<12);
 }
 
 static inline u32 NF_Read_ECC(void)
 {
-   S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
+   struct s3c2410_nand * const nand = S3C2410_GetBase_NAND();
 
return(nand->NFECC);
 }
diff --git a/board/samsung/smdk2400/smdk2400.c 
b/board/samsung/smdk2400/smdk2400.c
index 0b82070..9f75d01 100644
--- a/board/samsung/smdk2400/smdk2400.c
+++ b/board/samsung/smdk2400/smdk2400.c
@@ -45,8 +45,9 @@ extern int do_mdm_init; /* defined in common/main.c */
 
 int board_init (void)
 {
-   S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_Get

[U-Boot] [PATCH-ARM, MTD] Add support for Embest SBC2440-II Board 4/7

2009-06-24 Thread kevin.morf...@fearnside-systems.co.uk

This patch re-formats the s3c24x0 NAND driver code in preparation for 
changes to make the NAND driver support both s3c2410 and s3c2440 CPU's, 
ready for the addition of the Embest SBC2440-II Board.

The changes are as follows:

- re-indent the code using Lindent
- make sure register layouts are defined using a C struct, from a 
  comment by Wolfgang on 03/06/2009
- replace the upper-case typedef'ed C struct names with lower case 
  non-typedef'ed ones, from a comment by Scott on 22/06/2009
- make sure registers are accessed using the proper accessor 
  functions, from a comment by Wolfgang on 03/06/2009
- run checkpatch.pl and fix any error reports

The patches were tested after applying patches 1-4. Testing was done 
by running MAKEALL for all ARM9 targets and checking that no new 
warnings or errors were introduced.

Signed-off-by: Kevin Morfitt 
---
 drivers/mtd/nand/s3c2410_nand.c |   62 +++---
 1 files changed, 25 insertions(+), 37 deletions(-)

diff --git a/drivers/mtd/nand/s3c2410_nand.c b/drivers/mtd/nand/s3c2410_nand.c
index d27a625..1dfe59e 100644
--- a/drivers/mtd/nand/s3c2410_nand.c
+++ b/drivers/mtd/nand/s3c2410_nand.c
@@ -20,29 +20,10 @@
 
 #include 
 
-#if 0
-#define DEBUGN printf
-#else
-#define DEBUGN(x, args ...) {}
-#endif
-
 #include 
 #include 
 #include 
 
-#define __REGb(x)  (*(volatile unsigned char *)(x))
-#define __REGi(x)  (*(volatile unsigned int *)(x))
-
-#defineNF_BASE 0x4e00
-#defineNFCONF  __REGi(NF_BASE + 0x0)
-#defineNFCMD   __REGb(NF_BASE + 0x4)
-#defineNFADDR  __REGb(NF_BASE + 0x8)
-#defineNFDATA  __REGb(NF_BASE + 0xc)
-#defineNFSTAT  __REGb(NF_BASE + 0x10)
-#define NFECC0 __REGb(NF_BASE + 0x14)
-#define NFECC1 __REGb(NF_BASE + 0x15)
-#define NFECC2 __REGb(NF_BASE + 0x16)
-
 #define S3C2410_NFCONF_EN  (1<<15)
 #define S3C2410_NFCONF_512BYTE (1<<14)
 #define S3C2410_NFCONF_4STEP   (1<<13)
@@ -58,11 +39,12 @@
 static void s3c2410_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
 {
struct nand_chip *chip = mtd->priv;
+   struct s3c2410_nand *nand = S3C2410_GetBase_NAND();
 
-   DEBUGN("hwcontrol(): 0x%02x 0x%02x\n", cmd, ctrl);
+   debugX(1, "hwcontrol(): 0x%02x 0x%02x\n", cmd, ctrl);
 
if (ctrl & NAND_CTRL_CHANGE) {
-   ulong IO_ADDR_W = NF_BASE;
+   ulong IO_ADDR_W = (ulong)nand;
 
if (!(ctrl & NAND_CLE))
IO_ADDR_W |= S3C2410_ADDR_NCLE;
@@ -72,9 +54,11 @@ static void s3c2410_hwcontrol(struct mtd_info *mtd, int cmd, 
unsigned int ctrl)
chip->IO_ADDR_W = (void *)IO_ADDR_W;
 
if (ctrl & NAND_NCE)
-   NFCONF &= ~S3C2410_NFCONF_nFCE;
+   writel(readl(&nand->NFCONF) & ~S3C2410_NFCONF_nFCE,
+  &nand->NFCONF);
else
-   NFCONF |= S3C2410_NFCONF_nFCE;
+   writel(readl(&nand->NFCONF) | S3C2410_NFCONF_nFCE,
+  &nand->NFCONF);
}
 
if (cmd != NAND_CMD_NONE)
@@ -83,15 +67,17 @@ static void s3c2410_hwcontrol(struct mtd_info *mtd, int 
cmd, unsigned int ctrl)
 
 static int s3c2410_dev_ready(struct mtd_info *mtd)
 {
-   DEBUGN("dev_ready\n");
-   return (NFSTAT & 0x01);
+   struct s3c2410_nand *nand = S3C2410_GetBase_NAND();
+   debugX(1, "dev_ready\n");
+   return readl(&nand->NFSTAT) & 0x01;
 }
 
 #ifdef CONFIG_S3C2410_NAND_HWECC
 void s3c2410_nand_enable_hwecc(struct mtd_info *mtd, int mode)
 {
-   DEBUGN("s3c2410_nand_enable_hwecc(%p, %d)\n", mtd, mode);
-   NFCONF |= S3C2410_NFCONF_INITECC;
+   struct s3c2410_nand *nand = S3C2410_GetBase_NAND();
+   debugX(1, "s3c2410_nand_enable_hwecc(%p, %d)\n", mtd, mode);
+   writel(readl(&nand->NFCONF) | S3C2410_NFCONF_INITECC, &nand->NFCONF);
 }
 
 static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
@@ -100,8 +86,8 @@ static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, 
const u_char *dat,
ecc_code[0] = NFECC0;
ecc_code[1] = NFECC1;
ecc_code[2] = NFECC2;
-   DEBUGN("s3c2410_nand_calculate_hwecc(%p,): 0x%02x 0x%02x 0x%02x\n",
-   mtd , ecc_code[0], ecc_code[1], ecc_code[2]);
+   debugX(1, "s3c2410_nand_calculate_hwecc(%p,): 0x%02x 0x%02x 0x%02x\n",
+  mtd , ecc_code[0], ecc_code[1], ecc_code[2]);
 
return 0;
 }
@@ -123,24 +109,26 @@ int board_nand_init(struct nand_chip *nand)
 {
u_int32_t cfg;
u_int8_t tacls, twrph0, twrph1;
-   S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
+   struct s3c24x0_clock_power *clk_power = S3C24X0_GetBase_CLOCK_POWER();
+   struct s3c2410_nand *nand_reg = S3C2410_GetBase_NAND();
 
-   DEBUGN("board_nand_init()\n");
+   debugX(1, "board_nand_init()\

[U-Boot] [PATCH-ARM] Add support for Embest SBC2440-II Board 5/7

2009-06-24 Thread kevin.morf...@fearnside-systems.co.uk

Patches 5 to 7, replace "[PATCH-ARM 2/2] Add support for 
the Embest SBC2440-II Board 2/2" submitted on 19/06/2009.

This patch adds support for the s3c2440 cpu, excluding the NAND driver 
which is in patch 6/7.

This patch assume the following patches have already been applied:

- [PATCH-ARM] Bug-fix in drivers mtd nand Makefile, sent 18/06/2009
- [PATCH-ARM] CONFIG_SYS_HZ fix for ARM920T S3C24X0 Boards, sent 
  21/06/2009

The patch was tested by running MAKEALL for all ARM9 targets and 
checking that no new warnings or errors were introduced.

Signed-off-by: Kevin Morfitt 
---
 common/serial.c  |4 +-
 cpu/arm920t/s3c24x0/Makefile |2 +
 cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S |   81 +
 cpu/arm920t/s3c24x0/speed.c  |   41 +--
 cpu/arm920t/s3c24x0/timer.c  |   20 +---
 cpu/arm920t/s3c24x0/usb.c|   17 +--
 cpu/arm920t/s3c24x0/usb_ohci.c   |   11 +--
 cpu/arm920t/start.S  |   39 +--
 drivers/i2c/s3c24x0_i2c.c|   18 ++--
 drivers/mtd/nand/s3c2410_nand.c  |2 +-
 drivers/rtc/s3c24x0_rtc.c|7 +-
 drivers/serial/serial_s3c24x0.c  |6 +-
 drivers/usb/host/ohci-hcd.c  |3 +-
 include/common.h |5 +-
 include/configs/VCMA9.h  |4 +-
 include/configs/sbc2410x.h   |4 +-
 include/configs/smdk2400.h   |4 +-
 include/configs/smdk2410.h   |4 +-
 include/configs/trab.h   |4 +-
 include/s3c2410.h|   25 
 include/s3c2440.h|  162 ++
 include/s3c24x0.h|   94 ++-
 include/s3c24x0_cpu.h|   29 +
 23 files changed, 468 insertions(+), 118 deletions(-)
 create mode 100644 cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S
 create mode 100644 include/s3c2440.h
 create mode 100644 include/s3c24x0_cpu.h

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 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)
serial_register(&s3c24xx_serial0_device);
serial_register(&s3c24xx_serial1_device);
serial_register(&s3c24xx_serial2_device);
diff --git a/cpu/arm920t/s3c24x0/Makefile b/cpu/arm920t/s3c24x0/Makefile
index 5d2be2c..f030515 100644
--- a/cpu/arm920t/s3c24x0/Makefile
+++ b/cpu/arm920t/s3c24x0/Makefile
@@ -25,6 +25,8 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(SOC).a
 
+SOBJS  += arch_pre_lowlevel_init.o
+
 COBJS  += speed.o
 COBJS  += timer.o
 COBJS  += usb.o
diff --git a/cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S 
b/cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S
new file mode 100644
index 000..13467cf
--- /dev/null
+++ b/cpu/arm920t/s3c24x0/arch_pre_lowlevel_init.S
@@ -0,0 +1,81 @@
+/*
+ * (C) Copyright 2009
+ * Kevin Morfitt, Fearnside Systems Ltd, 

+ *
+ * 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 
+
+#ifdef CONFIG_S3C24X0
+
+/* Register addresses. */
+# ifdef CONFIG_S3C2400
+   #define pWTCON  0x1530
+   #define INTMSK  0x1448
+   #define CLKDIVN 0x14800014
+#else
+   #define pWTCON  0x5300
+   #define INTMSK  0x4A08
+   #define INTSUBMSK   0x4A1C
+   #define CLKDIVN 0x4C14
+#endif
+
+/* Configuration values. */
+#ifdef CONFIG_S3C2440
+   #define INTSMASK0x
+   #define CLKDIVVAL   0x5
+#else
+   #define INTSMASK0x3ff
+   #define CLKDIVVAL   0x3
+#endif
+
+.globl arch_pre_lowlevel_init
+arch

[U-Boot] [PATCH-ARM, MTD] Add support for Embest SBC2440-II Board 6/7

2009-06-24 Thread kevin.morf...@fearnside-systems.co.uk

This patch adds support for the s3c2440 cpu to the MTD NAND driver. The
changes were based heavily on the Linux-2.6.30 s3c2410 MTD NAND driver
which also supports the s3c2440 cpu. I've tested these changes on an
s3c2440 cpu (on the Embest SBC2440-II Board) but not on an s3c2410 cpu 
as none of the u-boot s3c2410 boards use the MTD NAND driver and anyway, 
I don't have an s3c2410 board. I have, however, checked that it builds 
OK for an s3c2410 cpu.

This patch assume the following patches have already been applied:

- [PATCH-ARM] Bug-fix in drivers mtd nand Makefile, sent 18/06/2009
- [PATCH-ARM] CONFIG_SYS_HZ fix for ARM920T S3C24X0 Boards, sent 
  21/06/2009

The patch was tested by running MAKEALL for all ARM9 targets and 
checking that no new warnings or errors were introduced.

Signed-off-by: Kevin Morfitt 
---
 drivers/mtd/nand/s3c2410_nand.c |  134 +--
 1 files changed, 73 insertions(+), 61 deletions(-)

diff --git a/drivers/mtd/nand/s3c2410_nand.c b/drivers/mtd/nand/s3c2410_nand.c
index 5157941..991064a 100644
--- a/drivers/mtd/nand/s3c2410_nand.c
+++ b/drivers/mtd/nand/s3c2410_nand.c
@@ -2,6 +2,10 @@
  * (C) Copyright 2006 OpenMoko, Inc.
  * Author: Harald Welte 
  *
+ * Modified to add S3C2440 support by
+ * (C) Copyright 2009
+ * Kevin Morfitt, Fearnside Systems Ltd, 

+ *
  * 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
@@ -21,48 +25,53 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
-#define S3C2410_NFCONF_EN  (1<<15)
-#define S3C2410_NFCONF_512BYTE (1<<14)
-#define S3C2410_NFCONF_4STEP   (1<<13)
-#define S3C2410_NFCONF_INITECC (1<<12)
-#define S3C2410_NFCONF_nFCE(1<<11)
-#define S3C2410_NFCONF_TACLS(x)((x)<<8)
-#define S3C2410_NFCONF_TWRPH0(x)   ((x)<<4)
-#define S3C2410_NFCONF_TWRPH1(x)   ((x)<<0)
+#if defined(CONFIG_S3C2410_NAND_HWECC) && defined(CONFIG_SYS_NAND_LARGEPAGE)
+/* new oob placement block for use with hardware ecc generation
+ */
+static struct nand_ecclayout nand_hw_eccoob = {
+   .eccbytes = 3,
+   .eccpos = {0, 1, 2},
+   .oobfree = { {8, 8} }
+};
+#endif
 
-#define S3C2410_ADDR_NALE 4
-#define S3C2410_ADDR_NCLE 8
+static void s3c2410_nand_select_chip(struct mtd_info *mtd, int chip)
+{
+   struct s3c2410_nand *nand = S3C2410_GetBase_NAND();
+   unsigned long reg = readl(&nand->S3C24X0_NAND_CTRL_REG);
+
+   if (chip == -1) {
+   debugX(1, "Negating nFCE\n");
+   reg |= S3C24X0_NAND_nFCE_BIT;
+   } else {
+   debugX(1, "Asserting nFCE\n");
+   reg &= ~S3C24X0_NAND_nFCE_BIT;
+   }
+   writel(reg, &nand->S3C24X0_NAND_CTRL_REG);
+}
 
 static void s3c2410_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
 {
-   struct nand_chip *chip = mtd->priv;
struct s3c2410_nand *nand = S3C2410_GetBase_NAND();
 
debugX(1, "hwcontrol(): 0x%02x 0x%02x\n", cmd, ctrl);
 
-   if (ctrl & NAND_CTRL_CHANGE) {
-   ulong IO_ADDR_W = (ulong)nand;
-
-   if (!(ctrl & NAND_CLE))
-   IO_ADDR_W |= S3C2410_ADDR_NCLE;
-   if (!(ctrl & NAND_ALE))
-   IO_ADDR_W |= S3C2410_ADDR_NALE;
-
-   chip->IO_ADDR_W = (void *)IO_ADDR_W;
+   if (cmd == NAND_CMD_NONE)
+   return;
 
-   if (ctrl & NAND_NCE)
-   writel(readl(&nand->NFCONF) & ~S3C2410_NFCONF_nFCE,
-  &nand->NFCONF);
-   else
-   writel(readl(&nand->NFCONF) | S3C2410_NFCONF_nFCE,
-  &nand->NFCONF);
+   if (ctrl & NAND_CLE) {
+   debugX(1, "NFCMD = 0x%08X\n", cmd);
+   writel(cmd, &nand->NFCMD);
}
 
-   if (cmd != NAND_CMD_NONE)
-   writeb(cmd, chip->IO_ADDR_W);
+   if (ctrl & NAND_ALE) {
+   debugX(1, "NFADDR = 0x%08X\n", cmd);
+   writel(cmd, &nand->NFADDR);
+   }
 }
 
 static int s3c2410_dev_ready(struct mtd_info *mtd)
@@ -76,39 +85,32 @@ static int s3c2410_dev_ready(struct mtd_info *mtd)
 void s3c2410_nand_enable_hwecc(struct mtd_info *mtd, int mode)
 {
struct s3c2410_nand *nand = S3C2410_GetBase_NAND();
+   unsigned long reg = readl(&nand->S3C24X0_NAND_CTRL_REG);
+
debugX(1, "s3c2410_nand_enable_hwecc(%p, %d)\n", mtd, mode);
-   writel(readl(&nand->NFCONF) | S3C2410_NFCONF_INITECC, &nand->NFCONF);
+   reg |= S3C24X0_NAND_INITECC_BIT;
+   writel(reg, &nand->S3C24X0_NAND_CTRL_REG);
 }
 
 static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
  u_char *ecc_code)
 {
-   ecc_code[0] = NFECC0;
-   ecc_code[1] = NFECC1;
-   ecc_code[2] = NFECC2;
+   struct s3c2410_nand *nand = S3C2410_GetBase_NAND();
+   unsign

[U-Boot] [PATCH-ARM] Add support for Embest SBC2440-II Board 7/7

2009-06-24 Thread kevin.morf...@fearnside-systems.co.uk

This patch adds support for the Embest SBC2440-II Board.

The patch was tested by:

- running MAKEALL for all ARM9 targets and checking that no new warnings 
  or errors were introduced
- programming it into NOR flash of an Embest SBC2440-II Board, loading
  kernel and root file system images via ftp, programming them into
  NAND flash and checking that u-boot successfully starts the kernel at 
  re-boot

Signed-off-by: Kevin Morfitt 
---
 MAINTAINERS|4 +
 MAKEALL|1 +
 Makefile   |3 +
 board/embest/sbc2440ii/Makefile|   55 +++
 board/embest/sbc2440ii/config.mk   |   25 
 board/embest/sbc2440ii/lowlevel_init.S |  219 
 board/embest/sbc2440ii/sbc2440ii.c |  109 ++
 cpu/arm920t/s3c24x0/timer.c|1 +
 include/configs/sbc2440ii.h|  247 
 9 files changed, 664 insertions(+), 0 deletions(-)
 create mode 100644 board/embest/sbc2440ii/Makefile
 create mode 100644 board/embest/sbc2440ii/config.mk
 create mode 100644 board/embest/sbc2440ii/lowlevel_init.S
 create mode 100644 board/embest/sbc2440ii/sbc2440ii.c
 create mode 100644 include/configs/sbc2440ii.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 9379c7e..39c938e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -578,6 +578,10 @@ Nishanth Menon 
 
omap3_zoom1 ARM CORTEX-A8 (OMAP3xx SoC)
 
+Kevin Morfitt 
+
+   sbc2440ii   ARM920T
+
 David Müller 
 
smdk2410ARM920T
diff --git a/MAKEALL b/MAKEALL
index f4599d6..ae95ffa 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -519,6 +519,7 @@ LIST_ARM9=" \
omap5912osk \
omap730p2   \
sbc2410x\
+   sbc2440ii   \
scb9328 \
smdk2400\
smdk2410\
diff --git a/Makefile b/Makefile
index bcc81c9..e8cdbe3 100644
--- a/Makefile
+++ b/Makefile
@@ -2898,6 +2898,9 @@ omap730p2_cs3boot_config :unconfig
 sbc2410x_config: unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t sbc2410x NULL s3c24x0
 
+sbc2440ii_config: unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm920t sbc2440ii embest s3c24x0
+
 scb9328_config :   unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t scb9328 NULL imx
 
diff --git a/board/embest/sbc2440ii/Makefile b/board/embest/sbc2440ii/Makefile
new file mode 100644
index 000..26237a2
--- /dev/null
+++ b/board/embest/sbc2440ii/Makefile
@@ -0,0 +1,55 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# Modified for EMBEST SBC2440-II board with S3C2440 (ARM920T) cpu by:
+# (C) Copyright 2009
+# Kevin Morfitt, Fearnside Systems Ltd, 
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB  = $(obj)lib$(BOARD).a
+
+COBJS   := sbc2440ii.o
+SOBJS   := lowlevel_init.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB): $(obj).depend $(OBJS) $(SOBJS)
+   $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak $(obj).depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/embest/sbc2440ii/config.mk b/board/embest/sbc2440ii/config.mk
new file mode 100644
index 000..def11d8
--- /dev/null
+++ b/board/embest/sbc2440ii/config.mk
@@ -0,0 +1,25 @@
+#
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, 
+# David Mueller, ELSOFT AG, 
+#
+# SAMSUNG SMDK2410 board with S3C2410X (ARM920T) cpu
+#
+# see http://www.samsung.com/ for more information on SAMSUNG
+#
+# Modified for EMBEST SBC2440-II board with S3C2440 (ARM920T) cpu by:
+# (C) Copyright 2009
+# Kevin Morfitt, Fearnside Systems Ltd, 
+
+#
+# SBC2440-II has 1 bank of 64 MB DRAM
+#
+# 3000' to 3800'
+#
+# Linux-Kernel is expected to be at 3000'8000, entry 3

Re: [U-Boot] U-Boot][PATCH] ARM Clean-up of ARM920T S3C24x0 drivers code

2009-07-04 Thread kevin.morf...@fearnside-systems.co.uk
Hi Jean-Christophe

On 04/07/2009 11:27, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 20:02 Fri 05 Jun , kevin.morf...@fearnside-systems.co.uk wrote:
>> This re-formats the S3C24x0 drivers code to meet the coding style 
>> requirements 
>> and to make it always use the proper I/O accessor functions when accessing 
>> registers. It was done using 'Lindent -kr -i8 -l80' followed by manual 
>> inspection of the output. checkpatch.pl reports no problems with the patch
>> and I've run MAKEALL for all ARM9 boards with no problems.
>>
>> This has been done to create a good starting point for me to add support for
>> a new board, the Embest SBC2440-II. Another patch does the same for the 
>> ARM920 S3C24x0 CPU and headers code.
>>
>> Signed-off-by: Kevin Morfitt 
>> ---
>>  drivers/i2c/s3c24x0_i2c.c   |  269 
>> ---
>>  drivers/mtd/nand/s3c2410_nand.c |   97 +++
>>  drivers/rtc/s3c24x0_rtc.c   |  126 +-
>>  drivers/serial/serial_s3c24x0.c |  143 -
>>  4 files changed, 324 insertions(+), 311 deletions(-)
>>
>> diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c
>> index f0c1aa3..33cd3d4 100644
>> --- a/drivers/i2c/s3c24x0_i2c.c
>> +++ b/drivers/i2c/s3c24x0_i2c.c
>> @@ -32,6 +32,8 @@
>>  #elif defined(CONFIG_S3C2410)
>>  #include 
>>  #endif
>> +
>> +#include 
>>  #include 
>>  
>>  #ifdef CONFIG_HARD_I2C
>> @@ -42,36 +44,35 @@
>>  #define I2C_OK  0
>>  #define I2C_NOK 1
>>  #define I2C_NACK2
>> -#define I2C_NOK_LA  3   /* Lost arbitration */
>> -#define I2C_NOK_TOUT4   /* time out */
>> -
>> -#define I2CSTAT_BSY 0x20/* Busy bit */
>> -#define I2CSTAT_NACK0x01/* Nack bit */
>> -#define I2CCON_IRPND0x10/* Interrupt pending bit */
>> -#define I2C_MODE_MT 0xC0/* Master Transmit Mode */
>> -#define I2C_MODE_MR 0x80/* Master Receive Mode */
>> -#define I2C_START_STOP  0x20/* START / STOP */
>> -#define I2C_TXRX_ENA0x10/* I2C Tx/Rx enable */
>> +#define I2C_NOK_LA  3   /* Lost arbitration */
>> +#define I2C_NOK_TOUT4   /* time out */
>>  
>> -#define I2C_TIMEOUT 1   /* 1 second */
>> +#define I2CSTAT_BSY 0x20/* Busy bit */
>> +#define I2CSTAT_NACK0x01/* Nack bit */
>> +#define I2CCON_IRPND0x10/* Interrupt pending bit */
>> +#define I2C_MODE_MT 0xC0/* Master Transmit Mode */
>> +#define I2C_MODE_MR 0x80/* Master Receive Mode */
>> +#define I2C_START_STOP  0x20/* START / STOP */
>> +#define I2C_TXRX_ENA0x10/* I2C Tx/Rx enable */
>>  
>> +#define I2C_TIMEOUT 1   /* 1 second */
>>  
>>  static int GetI2CSDA(void)
>>  {
>>  S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
> const make not so much sense here
> please replace by
> type *name
> 
> when you are at cleaning it please use lowercase for type and function and
> var name
> and replace typedef struct by struct
> as
> struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio();
This patch, and the others associated with adding the SBC2440-II Board, 
have been replaced by the series of patches "Add support for Embest 
SBC2440-II Board" 1 to 7. Patches 1 to 3 use lower case for var and type 
name, and replace typedef struct by struct, but they still have the 
function name as S3C24X0_GetBase_GPIO() instead of s3c24x0_getbase_gpio().

I'm happy to make the function name lower case and re-issue the "Add 
support for Embest SBC2440-II Board" patches 1 to 7 but it might be better 
if I waited for you to review them first in case you have any other 
comments.

Also, these patches rely on one other patch that hasn't been reviewed yet -
"[U-Boot] [PATCH-ARM] CONFIG_SYS_HZ fix for ARM920T S3C24X0 Boards".

Best Regards
Kevin
> 
> Best Regards,
> J.
> 



__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4216 (20090704) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH-ARM] Add support for Embest SBC2440-II Board 1/7

2009-07-09 Thread kevin.morf...@fearnside-systems.co.uk
Hi Remy

Remy Bohmer wrote:
> Hello Kevin,
> 
> 2009/6/25 kevin.morf...@fearnside-systems.co.uk
> :
>> Patches 1 to 4 replace "[PATCH-ARM 1/2] Add support for
>> the Embest SBC2440-II Board 1/2" submitted on 19/06/2009.
>>
>> This patch re-formats the code in cpu/arm920t and cpu/arm920t/23c24x0 in
>> preparation for changes to add support for the Embest SBC2440-II Board.
>>
>> The changes are as follows:
>>
>> - re-indent the code using Lindent
>> - make sure register layouts are defined using a C struct, from a
>>  comment by Wolfgang on 03/06/2009
>> - replace the upper-case typedef'ed C struct names with lower case
>>  non-typedef'ed ones, from a comment by Scott on 22/06/2009
>> - make sure registers are accessed using the proper accessor
>>  functions, from a comment by Wolfgang on 03/06/2009
>> - run checkpatch.pl and fix any error reports
>>
>> Note that usb_ohci.c still has two lines that exceed 80 characters.
>> This is because the statements on those lines lose readability when
>> wrapped - the Linux coding style guidleines allows for this.
>>
>> This complete series of patches assumes the following patches have
>> already been applied:
>>
>> - [PATCH-ARM] Bug-fix in drivers mtd nand Makefile, sent 18/06/2009
>> - [PATCH-ARM] CONFIG_SYS_HZ fix for ARM920T S3C24X0 Boards, sent
>>  21/06/2009
>>
>> Signed-off-by: Kevin Morfitt 
>> ---
>>  cpu/arm920t/s3c24x0/usb_ohci.c | 1268 
>> +---
> 
> Why are these files put in the cpu section, and not in the drivers/usb
> section where it belongs.

This code has always been in the cpu section - this used to contain all
s3c24x0 drivers but all except the usb driver were moved to the drivers 
directories in the last release. I'm not sure why the usb driver wasn't 
moved at the same time though. It could be moved to the drivers directory
though it would need renaming to make it clear it specific to the s3c24x0
processors. 

> Could it be merged into the existing ohci code, especially if it
> contains improvements compared to the existing code?
> I do not think it is okay to copy similar code to different places in u-boot.

The changes in this patch are only to make the code style meet the u-boot
format more closely - they don't implement any changes in functionality, 
and the code is also specific to the s3c24x0 processors. The code does 
control a standard OHCI host controller though so it might be possible to 
develop a more generic version that could be used to support other 
processors but I guess we'd need to look at how the USB host drivers of 
other processors work before we could decide if it's feasible. At the 
moment, I just want to make the minimum changes necessary to be able to
add support for the Embest SBC2440-II Board.

Regards
Kevin
> 
> Kind regards,
> 
> Remy
> 

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH-ARM] Add support for Embest SBC2440-II Board 5/7

2009-07-09 Thread kevin.morf...@fearnside-systems.co.uk
Hi Jean-Christophe

Jean-Christophe PLAGNIOL-VILLARD wrote:
>> +
>> +#include 
>> +
>> +#ifdef CONFIG_S3C24X0
>> +
>> +/* Register addresses. */
>> +# ifdef CONFIG_S3C2400
>> +#define pWTCON  0x1530
>> +#define INTMSK  0x1448
>> +#define CLKDIVN 0x14800014
>> +#else
>> +#define pWTCON  0x5300
>> +#define INTMSK  0x4A08
>> +#define INTSUBMSK   0x4A1C
>> +#define CLKDIVN 0x4C14
>> +#endif
> pplease move this to soc header
>> +
>> +/* Configuration values. */
>> +#ifdef CONFIG_S3C2440
>> +#define INTSMASK0x
>> +#define CLKDIVVAL   0x5
>> +#else
>> +#define INTSMASK0x3ff
>> +#define CLKDIVVAL   0x3
>> +#endif
> ditto
>> +
>> +.globl arch_pre_lowlevel_init
>> +arch_pre_lowlevel_init:
>> +
>> +/* turn off the watchdog */
>> +ldr r0, =pWTCON
>> +mov r1, #0x0
>> +str r1, [r0]
>> +
>> +/*
>> + * mask all IRQs by setting all bits in the INTMR - default
>> + */
>> +mov r1, #0x
>> +ldr r0, =INTMSK
>> +str r1, [r0]
>> +# if defined(CONFIG_S3C2410) || defined(CONFIG_S3C2440)
>> +ldr r1, =INTSMASK
>> +ldr r0, =INTSUBMSK
>> +str r1, [r0]
>> +# endif
>> +
>> +/* FCLK:HCLK:PCLK = 1:2:4 */
>> +/* default FCLK is 120 MHz ! */
>> +ldr r0, =CLKDIVN
>> +mov r1, #CLKDIVVAL
>> +str r1, [r0]
>> +
>> +#ifdef CONFIG_S3C2440
>> +/* Set asynchronous bus mode */
>> +mrc p15, 0, r1, c1, c0, 0   /* read ctrl register */
> whitespace please fix
>> +orr r1, r1, #0xc000 /* Asynchronous */
> whitespace please fix
>> +mcr p15, 0, r1, c1, c0, 0   /* write ctrl register */
> whitespace please fix
>> +#endif  /* CONFIG_S3C2440 */
> whitespace please fix

I'm not sure what the problem is - should the comments be indented with
a tab?

By the way, I'm on vacation for the next 2 weeks so I won't be able to
make the changes before the merge window closes. Do I need to wait until
v2009.08 is released and re-base my changes to that?

>> +
>> +mov pc, lr
>> +
>> +#endif  /* CONFIG_S3C24X0 */
> whitespace please fix
>> diff --git a/cpu/arm920t/s3c24x0/speed.c b/cpu/arm920t/s3c24x0/speed.c
>> index bb86335..95c4407 100644
>> --- a/cpu/arm920t/s3c24x0/speed.c
>> +++ b/cpu/arm920t/s3c24x0/speed.c
>> @@ -30,15 +30,10 @@
>>   */
>>  
>>  #include 
>> -#if defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || defined 
>> (CONFIG_TRAB)
>> +#ifdef CONFIG_S3C24X0
>>  
>>  #include 
>> -
>> -#if defined(CONFIG_S3C2400)
>> -#include 
>> -#elif defined(CONFIG_S3C2410)
>> -#include 
>> -#endif
>> +#include 
>>  
>>  #define MPLL 0
>>  #define UPLL 1
>> @@ -69,6 +64,11 @@ static ulong get_PLLCLK(int pllreg)
> please rename it as get_pll_clk_rate
>>  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 +83,23 @@ ulong get_HCLK(void)
> please use this style get_xxx_clk_rate
> 
> Best Regards,
> J.
> 

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot