Re: [U-Boot] [PATCH 1/9] ARM: a320evb: re-add MACH_TYPE_FARADAY

2011-11-21 Thread Po-Yu Chuang
Dear Anatolij,

On Tue, Nov 22, 2011 at 11:18 AM, Po-Yu Chuang  wrote:
> Dear Anatolij,
>
> On Tue, Nov 22, 2011 at 2:46 AM, Anatolij Gustschin  wrote:
>> Dear Po-Yu Chuang,
>>
>> On Sat, 19 Nov 2011 12:59:08 +0100
>> Anatolij Gustschin  wrote:
>>
>>> MACH_TYPE_FARADAY was removed from mach-types.h.
>>> Add it to the board config file.
>>
>> Could you please look at this patch and send your
>> Acked-by if the patch is okay.
>>
>> Thanks,
>> Anatolij
>>
>>>
>>> Signed-off-by: Anatolij Gustschin 

[snip]

>
> Thanks for your patch and sorry I did not notice it.
>
> Acked-by: Po-Yu Chuang 
>
> Best regards,
> Po-Yu Chuang
>

Andrew told me that he had submitted a very same patch two weeks ago:

http://www.mail-archive.com/u-boot@lists.denx.de/msg68553.html

I think his patch should be applied instead.

BTW, I have leaved my job. Andrew is currently the maintainer of a320evb.

Best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/9] ARM: a320evb: re-add MACH_TYPE_FARADAY

2011-11-21 Thread Po-Yu Chuang
Dear Anatolij,

On Tue, Nov 22, 2011 at 2:46 AM, Anatolij Gustschin  wrote:
> Dear Po-Yu Chuang,
>
> On Sat, 19 Nov 2011 12:59:08 +0100
> Anatolij Gustschin  wrote:
>
>> MACH_TYPE_FARADAY was removed from mach-types.h.
>> Add it to the board config file.
>
> Could you please look at this patch and send your
> Acked-by if the patch is okay.
>
> Thanks,
> Anatolij
>
>>
>> Signed-off-by: Anatolij Gustschin 
>> ---
>>  board/faraday/a320evb/a320evb.c |    1 -
>>  include/configs/a320evb.h       |    3 +++
>>  2 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/board/faraday/a320evb/a320evb.c 
>> b/board/faraday/a320evb/a320evb.c
>> index 2578be4..dfd186b 100644
>> --- a/board/faraday/a320evb/a320evb.c
>> +++ b/board/faraday/a320evb/a320evb.c
>> @@ -31,7 +31,6 @@ DECLARE_GLOBAL_DATA_PTR;
>>
>>  int board_init(void)
>>  {
>> -     gd->bd->bi_arch_number = MACH_TYPE_FARADAY;
>>       gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
>>
>>       ftsmc020_init();        /* initialize Flash */
>> diff --git a/include/configs/a320evb.h b/include/configs/a320evb.h
>> index 45a7c53..2904e2e 100644
>> --- a/include/configs/a320evb.h
>> +++ b/include/configs/a320evb.h
>> @@ -37,6 +37,9 @@
>>
>>  #undef CONFIG_SKIP_LOWLEVEL_INIT
>>
>> +#define MACH_TYPE_FARADAY    758
>> +#define CONFIG_MACH_TYPE     MACH_TYPE_FARADAY
>> +
>>  /*
>>   * Power Management Unit
>>   */

Thanks for your patch and sorry I did not notice it.

Acked-by: Po-Yu Chuang 

Best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] arm: a320: fix broken timer

2011-10-17 Thread Po-Yu Chuang
Dear Albert

On Tue, Aug 30, 2011 at 2:01 PM, 馬克泡  wrote:
> Hi Albert and Po-Yu,
>
> 2011/8/11 Po-Yu Chuang 
>>
>> From: Po-Yu Chuang 
>>
>> timer.c used static data and are called before relocation.
>> Move all static variables into global_data structure. Also cleanup
>> timer.c from unused stubs and make it truly use 64 bit tick values.
>
> This patch has been tested by Macpaul on AG101 and AG101P boards.
>
> Tested-by: Macpaul Lin 

This patch was posted 2 months ago and is still not in mainline.
Is there any problem?

Best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] arm: a320: fix broken timer

2011-08-10 Thread Po-Yu Chuang
From: Po-Yu Chuang 

timer.c used static data and are called before relocation.
Move all static variables into global_data structure. Also cleanup
timer.c from unused stubs and make it truly use 64 bit tick values.

Remove reset_timer_masked() get_timer_masked()

reference: arch/arm/cpu/arm926ejs/at91/timer.c

Based on Reinhard Meyer 's patches
5dca710a3d7703e41da0e9894f2d71f9e25bea6b
cfff263f41e32c7ba2ee9162a8cc6423eb5a8390

Signed-off-by: Po-Yu Chuang 
---
 arch/arm/cpu/arm920t/a320/timer.c |  134 ++---
 1 files changed, 50 insertions(+), 84 deletions(-)

diff --git a/arch/arm/cpu/arm920t/a320/timer.c 
b/arch/arm/cpu/arm920t/a320/timer.c
index 443d31d..4bfcef2 100644
--- a/arch/arm/cpu/arm920t/a320/timer.c
+++ b/arch/arm/cpu/arm920t/a320/timer.c
@@ -18,20 +18,35 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
 
-static ulong timestamp;
-static ulong lastdec;
-
-static struct fttmr010 *tmr = (struct fttmr010 *)CONFIG_FTTMR010_BASE;
+DECLARE_GLOBAL_DATA_PTR;
 
 #define TIMER_CLOCK32768
 #define TIMER_LOAD_VAL 0x
 
+static inline unsigned long long tick_to_time(unsigned long long tick)
+{
+   tick *= CONFIG_SYS_HZ;
+   do_div(tick, gd->timer_rate_hz);
+
+   return tick;
+}
+
+static inline unsigned long long usec_to_tick(unsigned long long usec)
+{
+   usec *= gd->timer_rate_hz;
+   do_div(usec, 100);
+
+   return usec;
+}
+
 int timer_init(void)
 {
+   struct fttmr010 *tmr = (struct fttmr010 *)CONFIG_FTTMR010_BASE;
unsigned int cr;
 
debug("%s()\n", __func__);
@@ -59,106 +74,57 @@ int timer_init(void)
cr |= FTTMR010_TM3_ENABLE;
writel(cr, &tmr->cr);
 
-   /* init the timestamp and lastdec value */
-   reset_timer_masked();
+   gd->timer_rate_hz = TIMER_CLOCK;
+   gd->tbu = gd->tbl = 0;
 
return 0;
 }
 
 /*
- * timer without interrupts
- */
-
-/*
- * reset time
- */
-void reset_timer_masked(void)
-{
-   /* capure current decrementer value time */
-   lastdec = readl(&tmr->timer3_counter) / (TIMER_CLOCK / CONFIG_SYS_HZ);
-   timestamp = 0;  /* start "advancing" time stamp from 0 */
-
-   debug("%s(): lastdec = %lx\n", __func__, lastdec);
-}
-
-/*
- * return timer ticks
- */
-ulong get_timer_masked(void)
-{
-   /* current tick value */
-   ulong now = readl(&tmr->timer3_counter) / (TIMER_CLOCK / CONFIG_SYS_HZ);
-
-   debug("%s(): now = %lx, lastdec = %lx\n", __func__, now, lastdec);
-
-   if (lastdec >= now) {
-   /*
-* normal mode (non roll)
-* move stamp fordward with absoulte diff ticks
-*/
-   timestamp += lastdec - now;
-   } else {
-   /*
-* we have overflow of the count down timer
-*
-* nts = ts + ld + (TLV - now)
-* ts=old stamp, ld=time that passed before passing through -1
-* (TLV-now) amount of time after passing though -1
-* nts = new "advancing time stamp"...it could also roll and
-* cause problems.
-*/
-   timestamp += lastdec + TIMER_LOAD_VAL - now;
-   }
-
-   lastdec = now;
-
-   debug("%s() returns %lx\n", __func__, timestamp);
-
-   return timestamp;
-}
-
-/*
- * return difference between timer ticks and base
+ * Get the current 64 bit timer tick count
  */
-ulong get_timer(ulong base)
+unsigned long long get_ticks(void)
 {
-   debug("%s(%lx)\n", __func__, base);
-   return get_timer_masked() - base;
+   struct fttmr010 *tmr = (struct fttmr010 *)CONFIG_FTTMR010_BASE;
+   ulong now = TIMER_LOAD_VAL - readl(&tmr->timer3_counter);
+
+   /* increment tbu if tbl has rolled over */
+   if (now < gd->tbl)
+   gd->tbu++;
+   gd->tbl = now;
+   return (((unsigned long long)gd->tbu) << 32) | gd->tbl;
 }
 
-/* delay x useconds AND preserve advance timestamp value */
 void __udelay(unsigned long usec)
 {
-   long tmo = usec * (TIMER_CLOCK / 1000) / 1000;
-   unsigned long now, last = readl(&tmr->timer3_counter);
-
-   debug("%s(%lu)\n", __func__, usec);
-   while (tmo > 0) {
-   now = readl(&tmr->timer3_counter);
-   if (now > last) /* count down timer overflow */
-   tmo -= TIMER_LOAD_VAL + last - now;
-   else
-   tmo -= last - now;
-   last = now;
-   }
+   unsigned long long start;
+   ulong tmo;
+
+   start = get_ticks();/* get current timestamp */
+   tmo = usec_to_tick(usec);   /* convert usecs to ticks */
+   while ((get_ticks() - start) < tmo)
+   ;   /* loop till time has pa

Re: [U-Boot] [PATCH v3 2/2] arm: a320: enable tagged list support

2011-08-04 Thread Po-Yu Chuang
Dear Albert,

On Thu, Aug 4, 2011 at 5:32 PM, Albert ARIBAUD
 wrote:
> Hi Po Yu Chuang,
>
> On 19/07/2011 04:56, Po-Yu Chuang wrote:
>>
>> From: Po-Yu Chuang
>>
>>
>> Signed-off-by: Po-Yu Chuang
>> ---
>> v2:
>> add a preceding patch to fix multiline comment style
>>
>> v3:
>> rebase
>>
>>  include/configs/a320evb.h |    6 ++
>>  1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/include/configs/a320evb.h b/include/configs/a320evb.h
>> index f832d52..62913b5 100644
>> --- a/include/configs/a320evb.h
>> +++ b/include/configs/a320evb.h
>> @@ -25,6 +25,12 @@
>>  #include
>>
>>  /*
>> + * Linux kernel tagged list
>> + */
>> +#define CONFIG_CMDLINE_TAG
>> +#define CONFIG_SETUP_MEMORY_TAGS
>> +
>> +/*
>>   * CPU and Board Configuration Options
>>   */
>>  #undef CONFIG_USE_IRQ         /* we don't need IRQ/FIQ stuff */
>
> Applied to u-boot-arm (after local fix to context lines -- my fault
> entirely, waited too long before applying it), thanks!

Just to remind you.

There is a preceding patch "arm: a320: fix multiline comment style"
according to Wolfgang's request.

http://patchwork.ozlabs.org/patch/105374/

I guess that's why you need local fix.

Best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 2/2] arm: a320: enable tagged list support

2011-07-18 Thread Po-Yu Chuang
From: Po-Yu Chuang 


Signed-off-by: Po-Yu Chuang 
---
v2:
add a preceding patch to fix multiline comment style

v3:
rebase

 include/configs/a320evb.h |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/configs/a320evb.h b/include/configs/a320evb.h
index f832d52..62913b5 100644
--- a/include/configs/a320evb.h
+++ b/include/configs/a320evb.h
@@ -25,6 +25,12 @@
 #include 
 
 /*
+ * Linux kernel tagged list
+ */
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+
+/*
  * CPU and Board Configuration Options
  */
 #undef CONFIG_USE_IRQ  /* we don't need IRQ/FIQ stuff */
-- 
1.7.4.1

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


[U-Boot] [PATCH v3 1/2] arm: a320: fix multiline comment style

2011-07-18 Thread Po-Yu Chuang
From: Po-Yu Chuang 


Signed-off-by: Po-Yu Chuang 
---
v2:
(new) fix multiline comment style

v3:
rebase

 include/configs/a320evb.h |   28 ++--
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/include/configs/a320evb.h b/include/configs/a320evb.h
index dfab0f4..f832d52 100644
--- a/include/configs/a320evb.h
+++ b/include/configs/a320evb.h
@@ -24,29 +24,29 @@
 
 #include 
 
-/*---
+/*
  * CPU and Board Configuration Options
  */
 #undef CONFIG_USE_IRQ  /* we don't need IRQ/FIQ stuff */
 
 #undef CONFIG_SKIP_LOWLEVEL_INIT
 
-/*---
+/*
  * Power Management Unit
  */
 #define CONFIG_FTPMU010_POWER
 
-/*---
+/*
  * Timer
  */
 #define CONFIG_SYS_HZ  1000/* timer ticks per second */
 
-/*---
+/*
  * Real Time Clock
  */
 #define CONFIG_RTC_FTRTC010
 
-/*---
+/*
  * Serial console configuration
  */
 
@@ -62,7 +62,7 @@
 /* valid baudrates */
 #define CONFIG_SYS_BAUDRATE_TABLE  { 9600, 19200, 38400, 57600, 115200 }
 
-/*---
+/*
  * Ethernet
  */
 #define CONFIG_NET_MULTI
@@ -70,7 +70,7 @@
 
 #define CONFIG_BOOTDELAY   3
 
-/*---
+/*
  * Command line configuration.
  */
 #include 
@@ -79,7 +79,7 @@
 #define CONFIG_CMD_DATE
 #define CONFIG_CMD_PING
 
-/*---
+/*
  * Miscellaneous configurable options
  */
 #define CONFIG_SYS_LONGHELP/* undef to save memory */
@@ -96,7 +96,7 @@
 /* Boot Argument Buffer Size */
 #define CONFIG_SYS_BARGSIZECONFIG_SYS_CBSIZE
 
-/*---
+/*
  * Stack sizes
  *
  * The stack sizes are set up in start.S using the settings below
@@ -107,12 +107,12 @@
 #define CONFIG_STACKSIZE_FIQ   (4 * 1024)  /* FIQ stack */
 #endif
 
-/*---
+/*
  * Size of malloc() pool
  */
 #define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 128 * 1024)
 
-/*---
+/*
  * SDRAM controller configuration
  */
 #define CONFIG_SYS_FTSDMC020_TP0   (FTSDMC020_TP0_TRAS(2) |\
@@ -132,7 +132,7 @@
 FTSDMC020_BANK_MBW_32   |  \
 FTSDMC020_BANK_SIZE_64M)
 
-/*---
+/*
  * Physical Memory Map
  */
 #define CONFIG_NR_DRAM_BANKS   1   /* we have 1 bank of DRAM */
@@ -155,7 +155,7 @@
 
 #define CONFIG_SYS_TEXT_BASE   0
 
-/*---
+/*
  * Static memory controller configuration
  */
 
@@ -194,7 +194,7 @@
{ FTSMC020_BANK1_CONFIG, FTSMC020_BANK1_TIMING, },  \
 }
 
-/*---
+/*
  * FLASH and environment organization
  */
 
-- 
1.7.4.1

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


Re: [U-Boot] [PATCH v2 2/2] arm: a320: enable tagged list support

2011-06-08 Thread Po-Yu Chuang
Dear Albert,

On Thu, Jun 9, 2011 at 2:35 PM, Po-Yu Chuang  wrote:
> Dear Albert,
>
> On Tue, May 17, 2011 at 11:11 AM, Po-Yu Chuang  
> wrote:
>> From: Po-Yu Chuang 
>>
>>
>> Signed-off-by: Po-Yu Chuang 
>> ---
>>  include/configs/a320evb.h |    6 ++
>>  1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/include/configs/a320evb.h b/include/configs/a320evb.h
>> index f832d52..62913b5 100644
>> --- a/include/configs/a320evb.h
>> +++ b/include/configs/a320evb.h
>> @@ -25,6 +25,12 @@
>>  #include 
>>
>>  /*
>> + * Linux kernel tagged list
>> + */
>> +#define CONFIG_CMDLINE_TAG
>> +#define CONFIG_SETUP_MEMORY_TAGS
>> +
>> +/*
>>  * CPU and Board Configuration Options
>>  */
>>  #undef CONFIG_USE_IRQ          /* we don't need IRQ/FIQ stuff */
>> --
>> 1.6.3.3
>>
>>
>
> Is it possible to accept this patch series in v2011.06?
>
> [U-Boot,v2,1/2] arm: a320: fix multiline comment style
> http://patchwork.ozlabs.org/patch/95847/
>
> [U-Boot,v2,2/2] arm: a320: enable tagged list support
> http://patchwork.ozlabs.org/patch/95848/

Just now I noticed that your mail address has changed.
So resend this mail.

Best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 2/2] arm: a320: enable tagged list support

2011-06-08 Thread Po-Yu Chuang
Dear Albert,

On Tue, May 17, 2011 at 11:11 AM, Po-Yu Chuang  wrote:
> From: Po-Yu Chuang 
>
>
> Signed-off-by: Po-Yu Chuang 
> ---
>  include/configs/a320evb.h |    6 ++
>  1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/include/configs/a320evb.h b/include/configs/a320evb.h
> index f832d52..62913b5 100644
> --- a/include/configs/a320evb.h
> +++ b/include/configs/a320evb.h
> @@ -25,6 +25,12 @@
>  #include 
>
>  /*
> + * Linux kernel tagged list
> + */
> +#define CONFIG_CMDLINE_TAG
> +#define CONFIG_SETUP_MEMORY_TAGS
> +
> +/*
>  * CPU and Board Configuration Options
>  */
>  #undef CONFIG_USE_IRQ          /* we don't need IRQ/FIQ stuff */
> --
> 1.6.3.3
>
>

Is it possible to accept this patch series in v2011.06?

[U-Boot,v2,1/2] arm: a320: fix multiline comment style
http://patchwork.ozlabs.org/patch/95847/

[U-Boot,v2,2/2] arm: a320: enable tagged list support
http://patchwork.ozlabs.org/patch/95848/

Best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 2/2] arm: a320: enable tagged list support

2011-05-16 Thread Po-Yu Chuang
From: Po-Yu Chuang 


Signed-off-by: Po-Yu Chuang 
---
 include/configs/a320evb.h |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/configs/a320evb.h b/include/configs/a320evb.h
index f832d52..62913b5 100644
--- a/include/configs/a320evb.h
+++ b/include/configs/a320evb.h
@@ -25,6 +25,12 @@
 #include 
 
 /*
+ * Linux kernel tagged list
+ */
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+
+/*
  * CPU and Board Configuration Options
  */
 #undef CONFIG_USE_IRQ  /* we don't need IRQ/FIQ stuff */
-- 
1.6.3.3

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


[U-Boot] [PATCH v2 1/2] arm: a320: fix multiline comment style

2011-05-16 Thread Po-Yu Chuang
From: Po-Yu Chuang 


Signed-off-by: Po-Yu Chuang 
---
 include/configs/a320evb.h |   32 ++--
 1 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/include/configs/a320evb.h b/include/configs/a320evb.h
index 0527822..f832d52 100644
--- a/include/configs/a320evb.h
+++ b/include/configs/a320evb.h
@@ -24,29 +24,29 @@
 
 #include 
 
-/*---
+/*
  * CPU and Board Configuration Options
  */
 #undef CONFIG_USE_IRQ  /* we don't need IRQ/FIQ stuff */
 
 #undef CONFIG_SKIP_LOWLEVEL_INIT
 
-/*---
+/*
  * Power Management Unit
  */
 #define CONFIG_FTPMU010_POWER
 
-/*---
+/*
  * Timer
  */
 #define CONFIG_SYS_HZ  1000/* timer ticks per second */
 
-/*---
+/*
  * Real Time Clock
  */
 #define CONFIG_RTC_FTRTC010
 
-/*---
+/*
  * Serial console configuration
  */
 
@@ -62,7 +62,7 @@
 /* valid baudrates */
 #define CONFIG_SYS_BAUDRATE_TABLE  { 9600, 19200, 38400, 57600, 115200 }
 
-/*---
+/*
  * Ethernet
  */
 #define CONFIG_NET_MULTI
@@ -70,7 +70,7 @@
 
 #define CONFIG_BOOTDELAY   3
 
-/*---
+/*
  * Command line configuration.
  */
 #include 
@@ -79,7 +79,7 @@
 #define CONFIG_CMD_DATE
 #define CONFIG_CMD_PING
 
-/*---
+/*
  * Miscellaneous configurable options
  */
 #define CONFIG_SYS_LONGHELP/* undef to save memory */
@@ -96,7 +96,7 @@
 /* Boot Argument Buffer Size */
 #define CONFIG_SYS_BARGSIZECONFIG_SYS_CBSIZE
 
-/*---
+/*
  * Stack sizes
  *
  * The stack sizes are set up in start.S using the settings below
@@ -107,16 +107,12 @@
 #define CONFIG_STACKSIZE_FIQ   (4 * 1024)  /* FIQ stack */
 #endif
 
-/*---
+/*
  * Size of malloc() pool
  */
 #define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 128 * 1024)
 
-/*---
- * size in bytes reserved for initial data
-*/
-
-/*---
+/*
  * SDRAM controller configuration
  */
 #define CONFIG_SYS_FTSDMC020_TP0   (FTSDMC020_TP0_TRAS(2) |\
@@ -136,7 +132,7 @@
 FTSDMC020_BANK_MBW_32   |  \
 FTSDMC020_BANK_SIZE_64M)
 
-/*---
+/*
  * Physical Memory Map
  */
 #define CONFIG_NR_DRAM_BANKS   1   /* we have 1 bank of DRAM */
@@ -159,7 +155,7 @@
 
 #define CONFIG_SYS_TEXT_BASE   0
 
-/*---
+/*
  * Static memory controller configuration
  */
 
@@ -198,7 +194,7 @@
{ FTSMC020_BANK1_CONFIG, FTSMC020_BANK1_TIMING, },  \
 }
 
-/*---
+/*
  * FLASH and environment organization
  */
 
-- 
1.6.3.3

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


Re: [U-Boot] [PATCH] arm: a320: enable tagged list support

2011-05-16 Thread Po-Yu Chuang
Dear Wolfgang,

On Mon, May 16, 2011 at 7:42 PM, Wolfgang Denk  wrote:
> Dear Po-Yu Chuang,
>
> In message <1305531660-1595-1-git-send-email-ratbert.chu...@gmail.com> you 
> wrote:
>> From: Po-Yu Chuang 
>>
>>
>> Signed-off-by: Po-Yu Chuang 
>> ---
>>  include/configs/a320evb.h |    6 ++
>>  1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/include/configs/a320evb.h b/include/configs/a320evb.h
>> index 0527822..f12977b 100644
>> --- a/include/configs/a320evb.h
>> +++ b/include/configs/a320evb.h
>> @@ -25,6 +25,12 @@
>>  #include 
>>
>>  /*---
>> + * Linux kernel tagged list
>> + */
>> +#define CONFIG_CMDLINE_TAG
>> +#define CONFIG_SETUP_MEMORY_TAGS
>> +
>> +/*---
>
> Please also fix the incorrect multiline comment style while modifying
> this code. Thanks.

OK, I will resubmit this patch with a preceding clean patch.

Best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] arm: a320: enable tagged list support

2011-05-16 Thread Po-Yu Chuang
From: Po-Yu Chuang 


Signed-off-by: Po-Yu Chuang 
---
 include/configs/a320evb.h |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/configs/a320evb.h b/include/configs/a320evb.h
index 0527822..f12977b 100644
--- a/include/configs/a320evb.h
+++ b/include/configs/a320evb.h
@@ -25,6 +25,12 @@
 #include 
 
 /*---
+ * Linux kernel tagged list
+ */
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS
+
+/*---
  * CPU and Board Configuration Options
  */
 #undef CONFIG_USE_IRQ  /* we don't need IRQ/FIQ stuff */
-- 
1.6.3.3

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


[U-Boot] [PATCH] arm: a320: fix compile error caused by commit 00d10eb

2011-04-28 Thread Po-Yu Chuang
From: Po-Yu Chuang 


Signed-off-by: Po-Yu Chuang 
---
 include/configs/a320evb.h |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/include/configs/a320evb.h b/include/configs/a320evb.h
index f5a005a..8a222c0 100644
--- a/include/configs/a320evb.h
+++ b/include/configs/a320evb.h
@@ -205,7 +205,6 @@
{ FTSMC020_BANK0_CONFIG, FTSMC020_BANK0_TIMING, },  \
{ FTSMC020_BANK1_CONFIG, FTSMC020_BANK1_TIMING, },  \
 }
-#endif /* CONFIG_FTSMC020 */
 
 /*---
  * FLASH and environment organization
-- 
1.6.3.3

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


Re: [U-Boot] [PATCH v3 4/4] ftsmc020: move ftsmc020 static mem controller to driver/mtd

2011-04-28 Thread Po-Yu Chuang
Hi Macpaul,

On Thu, Apr 28, 2011 at 3:33 PM, Macpaul Lin  wrote:
> Hi Po-Yu,
>
> 2011/4/28 Po-Yu Chuang :
>> Hi Macpaul,
>>
>>> -#include 
>>> +#define CONFIG_FTSMC020

This is for drivers/mtd/Makefile.

>>> +#include 
>>>
>>>  #define FTSMC020_BANK0_CONFIG  (FTSMC020_BANK_ENABLE             |     \
>>>                                 FTSMC020_BANK_BASE(PHYS_FLASH_1) |     \
>>> @@ -196,6 +197,7 @@
>>>        { FTSMC020_BANK0_CONFIG, FTSMC020_BANK0_TIMING, },      \
>>>        { FTSMC020_BANK1_CONFIG, FTSMC020_BANK1_TIMING, },      \
>>>  }
>>> +#endif /* CONFIG_FTSMC020 */
>>
>> Looks like this #endif is unnecessary?
>
> At the time the patch has been generated, I could bulid a320evb.
> I'm not in the office in these 2 days.
> Could I check it and reply to you later?
>
> According to your reply, I guess I was meant to support
> #define CONFIG_FTSMC020 in board's config file.
>
> I'll check it later after 10:00 in Taiwan time. Sorry.

After removed the #endif line, it builds again.
I will submit a simple patch. Please check it later.

Thanks, :-)
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 4/4] ftsmc020: move ftsmc020 static mem controller to driver/mtd

2011-04-27 Thread Po-Yu Chuang
Hi Macpaul,

On Sat, Apr 16, 2011 at 3:37 PM, Macpaul Lin  wrote:
> Move the header file and definitions of ftsmc020
> static memory control unit from a320 SoC folder to
> "drivers/mtd" folder.
>
> This change will let other SoC which also use ftsmc020
> could share the same header file.
>
> Signed-off-by: Macpaul Lin 

This patch makes a320evb failed to build.

> diff --git a/include/configs/a320evb.h b/include/configs/a320evb.h
> index 5373bcb..4b297f0 100644
> --- a/include/configs/a320evb.h
> +++ b/include/configs/a320evb.h
> @@ -163,7 +163,8 @@
>  * Static memory controller configuration
>  */
>
> -#include 
> +#define CONFIG_FTSMC020
> +#include 
>
>  #define FTSMC020_BANK0_CONFIG  (FTSMC020_BANK_ENABLE             |     \
>                                 FTSMC020_BANK_BASE(PHYS_FLASH_1) |     \
> @@ -196,6 +197,7 @@
>        { FTSMC020_BANK0_CONFIG, FTSMC020_BANK0_TIMING, },      \
>        { FTSMC020_BANK1_CONFIG, FTSMC020_BANK1_TIMING, },      \
>  }
> +#endif /* CONFIG_FTSMC020 */

Looks like this #endif is unnecessary?

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH RFC v2] Fix build problems caused by "_end" -> "__bss_end__" rename

2011-03-29 Thread Po-Yu Chuang
Hi Wolfgang,

On Wed, Mar 30, 2011 at 3:51 AM, Wolfgang Denk  wrote:
> Dear Po-Yu Chuang,
>
> In message <1301402371-8697-1-git-send-email...@denx.de> I wrote:
>> Commit 44c6e65 "rename _end to __bss_end__ broke building of a large
>> number of systems (at least all PowerPC?):
>>
>> libstubs.o: In function `app_startup':
>> examples/standalone/stubs.c:197: undefined reference to `__bss_end__'
>>
>> The rename should not be done for the files in the
>> examples/standalone/ directory, as these are not using the code from
>> start.S, but do their own BSS clearing, and either use their own
>> linker scripts or the ones provided by the compilers.
>>
>> Signed-off-by: Wolfgang Denk 
>> ---
>> V2:   Instead of messing with linker defines, revert the patch in
>>       question for the files in examples/standalone/ as suggested by
>>       Albert Aribaud. (Thanks!)
>
> Only now I realize that you submitted the very same patch before.
> Stupid me.
>
> Does that mean that we have an agreement that this hould be the fix
> then?  If yes, I would like to pull this in (Po-Yu Chuang's patch,
> that is).
>
> Do you agree?

Your commit message is better. Please just use your v2 as is. :-)

Thanks,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH RFC] Fix build problems caused by "_end" -> "__bss_end__" rename

2011-03-28 Thread Po-Yu Chuang
Hi Wolfgang,

On Mon, Mar 28, 2011 at 4:54 PM, Wolfgang Denk  wrote:
> Dear Po-Yu Chuang,
>
> In message  you 
> wrote:
>>
>> > What I really do not understand is why we don't see the same type of
>> > undefined reference errors on ARM? =C2=A0ALso, on ARM we see __bss_end__
>> > and _bss_end__, and __bss_start und __bss_start__ - where are the
>> > other names coming from? [On PPC we see only __bss_start and
>> > __bss_end__].
>>
>> Do you mean _end here? If there is __bss_end__ on PPC, then there is
>> no problem, right?
>
> No, I mean exactly what I wrote. On PPC I do not see any _end (with
> your previous patch), only the symbols defined in the linker script.

All those symbols come from default linker script in one of
${toolchain}/arm-none-linux-gnueabi/lib/ldscripts/armelfb_linux_eabi.*.

It defines __bss_start, __bss_start__, _bss_end__ and __bss_end__.
Is ARM the only platform doing this?

Best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH RFC] Fix build problems caused by "_end" -> "__bss_end__" rename

2011-03-28 Thread Po-Yu Chuang
Hi Wolfgang,

On Mon, Mar 28, 2011 at 4:40 PM, Wolfgang Denk  wrote:
> Commit 44c6e65 "rename _end to __bss_end__ broke building of a large
> number of systems (at least all PowerPC?):
>
> libstubs.o: In function `app_startup':
> examples/standalone/stubs.c:197: undefined reference to `__bss_end__'
>
> As a workaround (instead of introducing linker scripts) we can
> add a --defsym=__bss_end__=_end
>
> Signed-off-by: Wolfgang Denk 
> Cc: Po-Yu Chuang 
> Cc: Albert Aribaud 
> ---
>
>
> What I really do not understand is why we don't see the same type of
> undefined reference errors on ARM?  ALso, on ARM we see __bss_end__
> and _bss_end__, and __bss_start und __bss_start__ - where are the
> other names coming from? [On PPC we see only __bss_start and
> __bss_end__].

Do you mean _end here? If there is __bss_end__ on PPC, then there is
no problem, right?

>  examples/standalone/Makefile |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
> index c1dfdce..06cf14f 100644
> --- a/examples/standalone/Makefile
> +++ b/examples/standalone/Makefile
> @@ -96,6 +96,7 @@ $(LIB):       $(obj).depend $(LIBOBJS)
>  $(ELF):
>  $(obj)%:       $(obj)%.o $(LIB)
>                $(LD) -g -Ttext $(STANDALONE_LOAD_ADDR) \
> +                       --defsym=__bss_end__=_end \
>                        -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
>                        -L$(gcclibdir) -lgcc
>
> --
> 1.7.4
>
> ___
> 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] [RFC PATCH] rename __bss_end__ back to _end for standalone programs

2011-03-28 Thread Po-Yu Chuang
From: Po-Yu Chuang 

It seems __bss_end__ is not a true convention for all toolchains,
at least not for PPC. Using  _end for standalone programs might be
the simplest way to fix this problem.

One of the other choices may be writing a linker script to provide
__bss_end__ for PPC.

Signed-off-by: Po-Yu Chuang 
---
Hi all,

Not sure if this is the best solution, but I think this
could fix Heiko's problem.

 examples/standalone/mips.lds  |2 +-
 examples/standalone/sparc.lds |2 +-
 examples/standalone/stubs.c   |4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/standalone/mips.lds b/examples/standalone/mips.lds
index 68ae217..63a1c92 100644
--- a/examples/standalone/mips.lds
+++ b/examples/standalone/mips.lds
@@ -55,5 +55,5 @@ SECTIONS
.sbss (NOLOAD) : { *(.sbss) }
.bss (NOLOAD)  : { *(.bss) . = ALIGN(4); }
 
-   __bss_end__ = .;
+   _end = .;
 }
diff --git a/examples/standalone/sparc.lds b/examples/standalone/sparc.lds
index 7f060b6..9733daa 100644
--- a/examples/standalone/sparc.lds
+++ b/examples/standalone/sparc.lds
@@ -57,5 +57,5 @@ SECTIONS
}
. = ALIGN(4);
__bss_end = .;
-   __bss_end__ = .;
+   _end = .;
 }
diff --git a/examples/standalone/stubs.c b/examples/standalone/stubs.c
index 1379df7..2d2e709 100644
--- a/examples/standalone/stubs.c
+++ b/examples/standalone/stubs.c
@@ -187,14 +187,14 @@ void __attribute__((unused)) dummy(void)
 #include <_exports.h>
 }
 
-extern unsigned long __bss_start, __bss_end__;
+extern unsigned long __bss_start, _end;
 
 void app_startup(char * const *argv)
 {
unsigned char * cp = (unsigned char *) &__bss_start;
 
/* Zero out BSS */
-   while (cp < (unsigned char *)&__bss_end__) {
+   while (cp < (unsigned char *)&_end) {
*cp++ = 0;
}
 
-- 
1.6.3.3

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


Re: [U-Boot] current head don;t compile for mpc52xx based boards

2011-03-28 Thread Po-Yu Chuang
Hi Heiko and Wolfgang,

On Mon, Mar 28, 2011 at 2:33 PM, Wolfgang Denk  wrote:
> In message <4d90289f.2000...@denx.de> you wrote:
> >
> > actual head doesn;t longer compile for the mpc52xx based
> > digsy_mtc_rev5 board (and a fast check, it seems it is
> > for mp52xx, 8xx, ppc4xx based boards):

Could you use objdump to check what is the symbol name for end of BSS
defined by ppc toolchain? I don't have the environment now.

> I think ALL PowerPC boards are affecte.
>
> Po-Yu Chuang, can you please look into this, it's urgent?

It seems that we need to find a symbol name globally accepted by
all toolchains of all platform. If we rename it to another name careless,
we might get the same problem on another platform. Or maybe we can
just rename the one used in standalone examples back to _end?

Any suggestion?

Best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/2] power: ftpmu010: move drivers/power/ftpmu010.h to include/faraday

2011-03-17 Thread Po-Yu Chuang
Hi Macpaul,

On Fri, Mar 18, 2011 at 1:57 PM, Macpaul Lin  wrote:
> 2011/2/18 Po-Yu Chuang 
>> move include/ftpmu010.h to include/faraday/ftpmu010.h
>>
>>  drivers/power/ftpmu010.c   |    2 +-
>>  drivers/power/ftpmu010.h   |  146 --
>>  include/faraday/ftpmu010.h |  150 
>> 
>>  3 files changed, 151 insertions(+), 147 deletions(-)
>>  delete mode 100644 drivers/power/ftpmu010.h
>>  create mode 100644 include/faraday/ftpmu010.h
>
> Sorry I didn't notice that there are API declaration before in ftpmu010.h.
>
>> +void ftpmu010_32768osc_enable(void);

This is used by a320evb.

>> +void ftpmu010_dlldis_disable(void);
>> +void ftpmu010_sdram_clk_disable(unsigned int cr0);

These are not.

> Po-Yu, does these three function declaration is a necessity in a320evb?
>
> I'm using gcc 4.4 without these 3 function declaration seems okay.

Either adp-ag101 does not use any of them or you put the declarations
somewhere in board-specific code which is wrong.

> Because I'm going to refine another enhancement patch for using
> ftpmu010 in lowlevel_init.S.
> Hence I need to use #ifndef __ASSEMBLY__ to protect these three APIs.

No problem here. Please use __ASSEMBLY__.

> However, to compile adp-ag101 board (NDS32) doesn't require
> these 3 functions to be declared here. I need your opinion to clarify this.

Does your board use ftpmu010_dlldis_disable() or
ftpmu010_sdram_clk_disable() ?

Best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 06/22] arm: new labels in the linker script file

2011-03-08 Thread Po-Yu Chuang
Hi Aneesh,

On Mon, Feb 28, 2011 at 7:46 PM, Aneesh V  wrote:
> _bss_start_ofs is used in start.S to indicate end of copied
> image. This may not be correct when we have a discontiguous
> memory map. For instance, .bss may be placed in SDRAM for
> some SPLS while rest of the image is placed in SRAM.
>
> Define a new label in linker script to indicate the end of the
> image copied during relocation and use it appropriately in
> start.S.
>
> Also, add a new label to indicate the end of flash image.
> This will be useful in identifying the size of flash image
>
> Signed-off-by: Aneesh V 
> ---
>  arch/arm/cpu/armv7/start.S    |    6 +-
>  arch/arm/cpu/armv7/u-boot.lds |    4 
>  2 files changed, 9 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
> index 3618190..8215d26 100644
> --- a/arch/arm/cpu/armv7/start.S
> +++ b/arch/arm/cpu/armv7/start.S
> @@ -77,6 +77,10 @@ _TEXT_BASE:
>  _bss_start_ofs:
>        .word __bss_start - _start
>
> +.global        _image_copy_end_ofs
> +_image_copy_end_ofs:
> +       .word   __image_copy_end - _start
> +
>  .globl _bss_end_ofs
>  _bss_end_ofs:
>        .word _end - _start
> @@ -172,7 +176,7 @@ stack_setup:
>        beq     clear_bss               /* skip relocation */
>  #endif
>        mov     r1, r6                  /* r1 <- scratch for copy_loop */
> -       ldr     r3, _bss_start_ofs
> +       ldr     r3, _image_copy_end_ofs
>        add     r2, r0, r3              /* r2 <- source end address         */
>
>  copy_loop:
> diff --git a/arch/arm/cpu/armv7/u-boot.lds b/arch/arm/cpu/armv7/u-boot.lds
> index 5725c30..c3ad587 100644
> --- a/arch/arm/cpu/armv7/u-boot.lds
> +++ b/arch/arm/cpu/armv7/u-boot.lds
> @@ -55,6 +55,8 @@ SECTIONS
>
>        . = ALIGN(4);
>
> +       __image_copy_end = .;
> +
>        .rel.dyn : {
>                __rel_dyn_start = .;
>                *(.rel*)
> @@ -66,6 +68,8 @@ SECTIONS
>                *(.dynsym)
>        }
>
> +       __flash_image_end = .;
> +
>        .bss __rel_dyn_start (OVERLAY) : {
>                __bss_start = .;
>                *(.bss)

There is a patch series which makes _end as end of image and
has been applied to arm branch.

[U-Boot] [PATCH 1/2 v2] rename _end to __bss_end__
http://lists.denx.de/pipermail/u-boot/2011-March/088166.html

[U-Boot] [PATCH 2/2 v2] arm: fix incorrect monitor protection   region in FLASH
http://lists.denx.de/pipermail/u-boot/2011-March/088139.html

You can use the newly added symbol _end_ofs to replace your
__flash_image_end here.

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] rename _end to __bss_end__

2011-03-02 Thread Po-Yu Chuang
Hi Albert,

On Wed, Mar 2, 2011 at 2:59 PM, Albert ARIBAUD  wrote:
> Hi Po-Yu Chuang,
>
> Le 02/03/2011 06:53, Po-Yu Chuang a écrit :
>>
>> From: Po-Yu Chuang
>
> This line appears in the body of your mail; it should not. Did you use git
> send-email to post these patches?

Yes, I use git send-email.
I guess git put this line to the body because I use a different sender address
(ratbert.chu...@gmail.com) from the one in git config
(ratb...@faraday-tech.com).

I don't know how to fix it, but nobody complained my patches about this.
So I guess this doesn't matter when using git am?

>> This is done by the following command:
>> $ for f in `find * -type f`; do sed -i 's/\<_end\>/__bss_end__/g' $f; done
>
> This part about sed does not really matter for the U-Boot code base as such.
> You can put it below the "---" line, as a comment to the patch rather than
> as a part of the commit message.

OK, I will fix it.

regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/2 v2] arm: fix incorrect monitor protection region in FLASH

2011-03-02 Thread Po-Yu Chuang
From: Po-Yu Chuang 

Monitor protection region in FLASH did not cover .rel.dyn
and .dynsym sections, because it uses __bss_start to compute
monitor_flash_len. Use _end instead.

Add _end to linker scripts for end of u-boot image
Add _end_ofs to all the start.S.

Signed-off-by: Po-Yu Chuang 
---
v2:
merge patch 2 and patch 3 of v1

 arch/arm/cpu/arm1136/start.S   |4 
 arch/arm/cpu/arm1136/u-boot.lds|2 ++
 arch/arm/cpu/arm1176/start.S   |4 
 arch/arm/cpu/arm1176/u-boot.lds|2 ++
 arch/arm/cpu/arm720t/start.S   |4 
 arch/arm/cpu/arm720t/u-boot.lds|2 ++
 arch/arm/cpu/arm920t/ep93xx/u-boot.lds |2 ++
 arch/arm/cpu/arm920t/start.S   |4 
 arch/arm/cpu/arm920t/u-boot.lds|2 ++
 arch/arm/cpu/arm925t/start.S   |4 
 arch/arm/cpu/arm925t/u-boot.lds|2 ++
 arch/arm/cpu/arm926ejs/start.S |4 
 arch/arm/cpu/arm926ejs/u-boot.lds  |2 ++
 arch/arm/cpu/arm946es/start.S  |4 
 arch/arm/cpu/arm946es/u-boot.lds   |2 ++
 arch/arm/cpu/arm_intcm/start.S |4 
 arch/arm/cpu/arm_intcm/u-boot.lds  |2 ++
 arch/arm/cpu/armv7/start.S |4 
 arch/arm/cpu/armv7/u-boot.lds  |2 ++
 arch/arm/cpu/ixp/start.S   |4 
 arch/arm/cpu/ixp/u-boot.lds|2 ++
 arch/arm/cpu/lh7a40x/start.S   |4 
 arch/arm/cpu/lh7a40x/u-boot.lds|2 ++
 arch/arm/cpu/pxa/start.S   |4 
 arch/arm/cpu/pxa/u-boot.lds|2 ++
 arch/arm/cpu/s3c44b0/start.S   |4 
 arch/arm/cpu/s3c44b0/u-boot.lds|2 ++
 arch/arm/cpu/sa1100/start.S|4 
 arch/arm/cpu/sa1100/u-boot.lds |2 ++
 arch/arm/include/asm/u-boot-arm.h  |1 +
 arch/arm/lib/board.c   |2 +-
 31 files changed, 88 insertions(+), 1 deletions(-)

diff --git a/arch/arm/cpu/arm1136/start.S b/arch/arm/cpu/arm1136/start.S
index 64426fa..3c5f3ef 100644
--- a/arch/arm/cpu/arm1136/start.S
+++ b/arch/arm/cpu/arm1136/start.S
@@ -104,6 +104,10 @@ _bss_start_ofs:
 _bss_end_ofs:
.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+   .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/arm1136/u-boot.lds b/arch/arm/cpu/arm1136/u-boot.lds
index 1e0e90b..d1e2851 100644
--- a/arch/arm/cpu/arm1136/u-boot.lds
+++ b/arch/arm/cpu/arm1136/u-boot.lds
@@ -72,6 +72,8 @@ SECTIONS
*(.dynsym)
}
 
+   _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/arm1176/start.S b/arch/arm/cpu/arm1176/start.S
index c1302df..6ae118a 100644
--- a/arch/arm/cpu/arm1176/start.S
+++ b/arch/arm/cpu/arm1176/start.S
@@ -123,6 +123,10 @@ _bss_start_ofs:
 _bss_end_ofs:
.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+   .word _end - _start
+
 /* IRQ stack memory (calculated at run-time) + 8 bytes */
 .globl IRQ_STACK_START_IN
 IRQ_STACK_START_IN:
diff --git a/arch/arm/cpu/arm1176/u-boot.lds b/arch/arm/cpu/arm1176/u-boot.lds
index 170e516..27d6638 100644
--- a/arch/arm/cpu/arm1176/u-boot.lds
+++ b/arch/arm/cpu/arm1176/u-boot.lds
@@ -61,6 +61,8 @@ SECTIONS
*(.dynsym)
}
 
+   _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/arm720t/start.S b/arch/arm/cpu/arm720t/start.S
index c521753..e774c3f 100644
--- a/arch/arm/cpu/arm720t/start.S
+++ b/arch/arm/cpu/arm720t/start.S
@@ -93,6 +93,10 @@ _bss_start_ofs:
 _bss_end_ofs:
.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+   .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/arm720t/u-boot.lds b/arch/arm/cpu/arm720t/u-boot.lds
index deda9fb..9370fad 100644
--- a/arch/arm/cpu/arm720t/u-boot.lds
+++ b/arch/arm/cpu/arm720t/u-boot.lds
@@ -62,6 +62,8 @@ SECTIONS
*(.dynsym)
}
 
+   _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/arm920t/ep93xx/u-boot.lds 
b/arch/arm/cpu/arm920t/ep93xx/u-boot.lds
index 4cc82a5..dc6ba34 100644
--- a/arch/arm/cpu/arm920t/ep93xx/u-boot.lds
+++ b/arch/arm/cpu/arm920t/ep93xx/u-boot.lds
@@ -56,4 +56,6 @@ SECTIONS
__bss_start = .;
.bss : { *(.bss) }
__bss_end__ = .;
+
+   _end = .;
 }
diff --git a/arch/arm/cpu/arm920t/start.S b/arch/arm/cpu/arm920t/start.S
index 6db61c2..a7476b0 100644
--- a/arch/arm/cpu/arm920t/start.S
+++ b/arch/arm/cpu/arm920t/start.S
@@ -89,6 +89,10 @@ _bss_start_ofs:
 _bss_end_ofs:
.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+   .word _end - _start

Re: [U-Boot] [PATCH 3/3] arm: fix incorrect monitor protection region in FLASH

2011-03-01 Thread Po-Yu Chuang
Hi Albert,

On Wed, Mar 2, 2011 at 3:03 PM, Albert ARIBAUD  wrote:
> Hi Po-Yu Chuang,
>
> Le 02/03/2011 07:02, Po-Yu Chuang a écrit :
>>
>> From: Po-Yu Chuang
>>
>> Monitor protection region in FLASH did not cover .rel.dyn section
>> and .dynsym sections, because it uses __bss_start to compute
>> monitor_flash_len. Use _end instead.
>>
>> Add _end_ofs to all the start.S.
>>
>> Signed-off-by: Po-Yu Chuang
>> ---
>
> Open question: why not group patches 2 and 3 as a single functional patch?
> Patch 2 seems purposeless to me as a standalone patch.

I thought that patches 2 and 3 are separate steps, but I am fine with both
ways. :-)

If no other comment, I will resend them as a single patch.

regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/3] arm: fix incorrect monitor protection region in FLASH

2011-03-01 Thread Po-Yu Chuang
From: Po-Yu Chuang 

Monitor protection region in FLASH did not cover .rel.dyn section
and .dynsym sections, because it uses __bss_start to compute
monitor_flash_len. Use _end instead.

Add _end_ofs to all the start.S.

Signed-off-by: Po-Yu Chuang 
---
 arch/arm/cpu/arm1136/start.S  |4 
 arch/arm/cpu/arm1176/start.S  |4 
 arch/arm/cpu/arm720t/start.S  |4 
 arch/arm/cpu/arm920t/start.S  |4 
 arch/arm/cpu/arm925t/start.S  |4 
 arch/arm/cpu/arm926ejs/start.S|4 
 arch/arm/cpu/arm946es/start.S |4 
 arch/arm/cpu/arm_intcm/start.S|4 
 arch/arm/cpu/armv7/start.S|4 
 arch/arm/cpu/ixp/start.S  |4 
 arch/arm/cpu/lh7a40x/start.S  |4 
 arch/arm/cpu/pxa/start.S  |4 
 arch/arm/cpu/s3c44b0/start.S  |4 
 arch/arm/cpu/sa1100/start.S   |4 
 arch/arm/include/asm/u-boot-arm.h |1 +
 arch/arm/lib/board.c  |2 +-
 16 files changed, 58 insertions(+), 1 deletions(-)

diff --git a/arch/arm/cpu/arm1136/start.S b/arch/arm/cpu/arm1136/start.S
index 64426fa..3c5f3ef 100644
--- a/arch/arm/cpu/arm1136/start.S
+++ b/arch/arm/cpu/arm1136/start.S
@@ -104,6 +104,10 @@ _bss_start_ofs:
 _bss_end_ofs:
.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+   .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/arm1176/start.S b/arch/arm/cpu/arm1176/start.S
index c1302df..6ae118a 100644
--- a/arch/arm/cpu/arm1176/start.S
+++ b/arch/arm/cpu/arm1176/start.S
@@ -123,6 +123,10 @@ _bss_start_ofs:
 _bss_end_ofs:
.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+   .word _end - _start
+
 /* IRQ stack memory (calculated at run-time) + 8 bytes */
 .globl IRQ_STACK_START_IN
 IRQ_STACK_START_IN:
diff --git a/arch/arm/cpu/arm720t/start.S b/arch/arm/cpu/arm720t/start.S
index c521753..e774c3f 100644
--- a/arch/arm/cpu/arm720t/start.S
+++ b/arch/arm/cpu/arm720t/start.S
@@ -93,6 +93,10 @@ _bss_start_ofs:
 _bss_end_ofs:
.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+   .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/arm920t/start.S b/arch/arm/cpu/arm920t/start.S
index 6db61c2..a7476b0 100644
--- a/arch/arm/cpu/arm920t/start.S
+++ b/arch/arm/cpu/arm920t/start.S
@@ -89,6 +89,10 @@ _bss_start_ofs:
 _bss_end_ofs:
.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+   .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/arm925t/start.S b/arch/arm/cpu/arm925t/start.S
index b89cf4a..39f2e99 100644
--- a/arch/arm/cpu/arm925t/start.S
+++ b/arch/arm/cpu/arm925t/start.S
@@ -99,6 +99,10 @@ _bss_start_ofs:
 _bss_end_ofs:
.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+   .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/arm926ejs/start.S b/arch/arm/cpu/arm926ejs/start.S
index 7798ef8..fefcfa2 100644
--- a/arch/arm/cpu/arm926ejs/start.S
+++ b/arch/arm/cpu/arm926ejs/start.S
@@ -133,6 +133,10 @@ _bss_start_ofs:
 _bss_end_ofs:
.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+   .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/arm946es/start.S b/arch/arm/cpu/arm946es/start.S
index 1b6b188..00914f4 100644
--- a/arch/arm/cpu/arm946es/start.S
+++ b/arch/arm/cpu/arm946es/start.S
@@ -105,6 +105,10 @@ _bss_start_ofs:
 _bss_end_ofs:
.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+   .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/arm_intcm/start.S b/arch/arm/cpu/arm_intcm/start.S
index da2c265..2fd3b9a 100644
--- a/arch/arm/cpu/arm_intcm/start.S
+++ b/arch/arm/cpu/arm_intcm/start.S
@@ -101,6 +101,10 @@ _bss_start_ofs:
 _bss_end_ofs:
.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+   .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
index bc7bae8..d83d501 100644
--- a/arch/arm/cpu/armv7/start.S
+++ b/arch/arm/cpu/armv7/start.S
@@ -81,6 +81,10 @@ _bss_start_ofs:
 _bss_end_ofs:
.word __bss_end__ - _start
 
+.globl _end_ofs
+_end_ofs:
+   .word _end - _start
+
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
 .globl IRQ_STACK_START
diff --git a/arch/arm/cpu/ixp/start.S b/arch/arm/cpu/ixp/start.S
index f8bfed7..561c1f4 100644
--- a/arch/arm/cpu/ixp/start.S
+++ b/arch/arm/cpu/ixp/start.S
@@ -112,6 +112,10

[U-Boot] [PATCH 2/3] arm: add _end to linker scripts for end of u-boot image

2011-03-01 Thread Po-Yu Chuang
From: Po-Yu Chuang 


Signed-off-by: Po-Yu Chuang 
---
 arch/arm/cpu/arm1136/u-boot.lds|2 ++
 arch/arm/cpu/arm1176/u-boot.lds|2 ++
 arch/arm/cpu/arm720t/u-boot.lds|2 ++
 arch/arm/cpu/arm920t/ep93xx/u-boot.lds |2 ++
 arch/arm/cpu/arm920t/u-boot.lds|2 ++
 arch/arm/cpu/arm925t/u-boot.lds|2 ++
 arch/arm/cpu/arm926ejs/u-boot.lds  |2 ++
 arch/arm/cpu/arm946es/u-boot.lds   |2 ++
 arch/arm/cpu/arm_intcm/u-boot.lds  |2 ++
 arch/arm/cpu/armv7/u-boot.lds  |2 ++
 arch/arm/cpu/ixp/u-boot.lds|2 ++
 arch/arm/cpu/lh7a40x/u-boot.lds|2 ++
 arch/arm/cpu/pxa/u-boot.lds|2 ++
 arch/arm/cpu/s3c44b0/u-boot.lds|2 ++
 arch/arm/cpu/sa1100/u-boot.lds |2 ++
 15 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/arm1136/u-boot.lds b/arch/arm/cpu/arm1136/u-boot.lds
index 1e0e90b..d1e2851 100644
--- a/arch/arm/cpu/arm1136/u-boot.lds
+++ b/arch/arm/cpu/arm1136/u-boot.lds
@@ -72,6 +72,8 @@ SECTIONS
*(.dynsym)
}
 
+   _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/arm1176/u-boot.lds b/arch/arm/cpu/arm1176/u-boot.lds
index 170e516..27d6638 100644
--- a/arch/arm/cpu/arm1176/u-boot.lds
+++ b/arch/arm/cpu/arm1176/u-boot.lds
@@ -61,6 +61,8 @@ SECTIONS
*(.dynsym)
}
 
+   _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/arm720t/u-boot.lds b/arch/arm/cpu/arm720t/u-boot.lds
index deda9fb..9370fad 100644
--- a/arch/arm/cpu/arm720t/u-boot.lds
+++ b/arch/arm/cpu/arm720t/u-boot.lds
@@ -62,6 +62,8 @@ SECTIONS
*(.dynsym)
}
 
+   _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/arm920t/ep93xx/u-boot.lds 
b/arch/arm/cpu/arm920t/ep93xx/u-boot.lds
index 4cc82a5..dc6ba34 100644
--- a/arch/arm/cpu/arm920t/ep93xx/u-boot.lds
+++ b/arch/arm/cpu/arm920t/ep93xx/u-boot.lds
@@ -56,4 +56,6 @@ SECTIONS
__bss_start = .;
.bss : { *(.bss) }
__bss_end__ = .;
+
+   _end = .;
 }
diff --git a/arch/arm/cpu/arm920t/u-boot.lds b/arch/arm/cpu/arm920t/u-boot.lds
index d6dc21c..17ba604 100644
--- a/arch/arm/cpu/arm920t/u-boot.lds
+++ b/arch/arm/cpu/arm920t/u-boot.lds
@@ -71,6 +71,8 @@ SECTIONS
*(.dynsym)
}
 
+   _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/arm925t/u-boot.lds b/arch/arm/cpu/arm925t/u-boot.lds
index 4ad1f8e..64e76f5 100644
--- a/arch/arm/cpu/arm925t/u-boot.lds
+++ b/arch/arm/cpu/arm925t/u-boot.lds
@@ -66,6 +66,8 @@ SECTIONS
*(.dynsym)
}
 
+   _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/arm926ejs/u-boot.lds 
b/arch/arm/cpu/arm926ejs/u-boot.lds
index b7a5b9e..1480e0c 100644
--- a/arch/arm/cpu/arm926ejs/u-boot.lds
+++ b/arch/arm/cpu/arm926ejs/u-boot.lds
@@ -63,6 +63,8 @@ SECTIONS
*(.dynsym)
}
 
+   _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/arm946es/u-boot.lds b/arch/arm/cpu/arm946es/u-boot.lds
index fe4a646..ff938e4 100644
--- a/arch/arm/cpu/arm946es/u-boot.lds
+++ b/arch/arm/cpu/arm946es/u-boot.lds
@@ -63,6 +63,8 @@ SECTIONS
*(.dynsym)
}
 
+   _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/arm_intcm/u-boot.lds 
b/arch/arm/cpu/arm_intcm/u-boot.lds
index 899fab0..f4a146c 100644
--- a/arch/arm/cpu/arm_intcm/u-boot.lds
+++ b/arch/arm/cpu/arm_intcm/u-boot.lds
@@ -63,6 +63,8 @@ SECTIONS
*(.dynsym)
}
 
+   _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/armv7/u-boot.lds b/arch/arm/cpu/armv7/u-boot.lds
index de80244..dbae54d 100644
--- a/arch/arm/cpu/armv7/u-boot.lds
+++ b/arch/arm/cpu/armv7/u-boot.lds
@@ -66,6 +66,8 @@ SECTIONS
*(.dynsym)
}
 
+   _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/ixp/u-boot.lds b/arch/arm/cpu/ixp/u-boot.lds
index 7029c6c..3587f8a 100644
--- a/arch/arm/cpu/ixp/u-boot.lds
+++ b/arch/arm/cpu/ixp/u-boot.lds
@@ -63,6 +63,8 @@ SECTIONS
*(.dynsym)
}
 
+   _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/lh7a40x/u-boot.lds b/arch/arm/cpu/lh7a40x/u-boot.lds
index

Re: [U-Boot] ARM: Incorrect ROM protection range?

2011-03-01 Thread Po-Yu Chuang
Dear Albert,

On Tue, Mar 1, 2011 at 8:22 PM, Albert ARIBAUD  wrote:
> Le 01/03/2011 09:31, Po-Yu Chuang a écrit :
>> On Fri, Feb 25, 2011 at 4:00 PM, Po-Yu Chuang
>>  wrote:
>>
>> I tried the following command and it seems work:
>>
>> for f in `find * -type f`; do sed -i 's/\<_end\>/__bss_end/g' $f; done
>>
>>
>> but when I tried to build, I got some error in standalone example:
>>
>>
[snip]
>> libstubs.o: In function `app_startup':
>> /home/ratbert/linux/u-boot/examples/standalone/stubs.c:206: undefined
>> reference to `__bss_end'
>> make[1]: *** [hello_world] Error 1
>> make[1]: Leaving directory
>> `/home/ratbert/linux/u-boot/examples/standalone'
>> make: *** [examples/standalone] Error 2
>>
>>
>> It looks like that _end as end of BSS section is a convention to GNU
>> toolchain.
>> Should I simply fix it by hand, or should we reconsider the whole naming
>> thing?
>
> Indeed, since the link command line does not mention a linker file, then the
> default toolchain linker file was invoked. You can see the linker script
> using ld --verbose (be sure to use the toolchain's ld, not your host's).
> Mine (ELDK4.2 and CodeSourcery 2010q1) define __bss_start and __bss_start__
> before the BSS section, and _bss_end__ and __bss_end__ after it, then
> __end__ and _end after that. No surprise that __bss_end did not work.
>
> But examples (ang more generally, standalone applications) are not supposed
> to use symbols from U-Boot linker files; so there is no reason to replace
> __bss_end in these.
>
> Still, we *could* align on the ELDK/CS linkers' output and use _bss_end__
> and/or __bss_end__ rather than __bss_end for U-Boot, unless some other
> toolchain has radically different default linker scripts. Comments anyone?

I prefer the __bss_end__ solution. Not only because it doesn't require manual
fixes after sed replacement command, but it also makes the semantics of
app_startup() of the standalone example program clearer.
If there is no other comment, I will submit patches using __bss_end__ later.

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM: Incorrect ROM protection range?

2011-03-01 Thread Po-Yu Chuang
Dear Wolfgang,

On Fri, Feb 25, 2011 at 4:00 PM, Po-Yu Chuang  wrote:
> Dear Wolfgang and Albert,
>
> On Fri, Feb 25, 2011 at 3:15 PM, Wolfgang Denk  wrote:
>> Dear Albert ARIBAUD,
>>
>> In message <4d674d85.40...@free.fr> you wrote:
>>>
>>> All this, of course, if Wolfgang agrees to this suggestion.
>>
>> I fully agree.
>
> All right, but please give me some time.
> I need to study how to use sed to do this. :-p

I tried the following command and it seems work:

for f in `find * -type f`; do sed -i 's/\<_end\>/__bss_end/g' $f; done


but when I tried to build, I got some error in standalone example:


make[1]: Entering directory `/home/ratbert/linux/u-boot/examples/standalone'
arm-none-linux-gnueabi-gcc  -g  -Os   -fno-common -ffixed-r8
-msoft-float  -D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0
-I/home/ratbert/linux/u-boot/include -fno-builtin -ffreestanding
-nostdinc -isystem
/home/ratbert/linux/arm-none-linux-gnueabi-4.4.0_ARMv4/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.0/include
-pipe  -DCONFIG_ARM -D__ARM__ -marm  -mabi=aapcs-linux
-mno-thumb-interwork -march=armv4 -Wall -Wstrict-prototypes
-fno-stack-protector -fno-toplevel-reorder   -o hello_world.o
hello_world.c -c
arm-none-linux-gnueabi-gcc  -g  -Os   -fno-common -ffixed-r8
-msoft-float  -D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0
-I/home/ratbert/linux/u-boot/include -fno-builtin -ffreestanding
-nostdinc -isystem
/home/ratbert/linux/arm-none-linux-gnueabi-4.4.0_ARMv4/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.0/include
-pipe  -DCONFIG_ARM -D__ARM__ -marm  -mabi=aapcs-linux
-mno-thumb-interwork -march=armv4 -Wall -Wstrict-prototypes
-fno-stack-protector -fno-toplevel-reorder   -o stubs.o stubs.c -c
arm-none-linux-gnueabi-ld  -r -o libstubs.o  stubs.o
arm-none-linux-gnueabi-ld -g -Ttext 0xc10 \
-o hello_world -e hello_world hello_world.o libstubs.o \

-L/home/ratbert/linux/arm-none-linux-gnueabi-4.4.0_ARMv4/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.0/fa526
-lgcc
libstubs.o: In function `app_startup':
/home/ratbert/linux/u-boot/examples/standalone/stubs.c:206: undefined
reference to `__bss_end'
make[1]: *** [hello_world] Error 1
make[1]: Leaving directory `/home/ratbert/linux/u-boot/examples/standalone'
make: *** [examples/standalone] Error 2


It looks like that _end as end of BSS section is a convention to GNU toolchain.
Should I simply fix it by hand, or should we reconsider the whole naming thing?

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM: Incorrect ROM protection range?

2011-02-25 Thread Po-Yu Chuang
Dear Wolfgang and Albert,

On Fri, Feb 25, 2011 at 3:15 PM, Wolfgang Denk  wrote:
> Dear Albert ARIBAUD,
>
> In message <4d674d85.40...@free.fr> you wrote:
>>
>> All this, of course, if Wolfgang agrees to this suggestion.
>
> I fully agree.

All right, but please give me some time.
I need to study how to use sed to do this. :-p

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM: Incorrect ROM protection range?

2011-02-24 Thread Po-Yu Chuang
Dear Wolfgang and Albert,

On Fri, Feb 25, 2011 at 4:17 AM, Wolfgang Denk  wrote:
> Dear Albert ARIBAUD,
>
> In message <4d66a7cd.9020...@free.fr> you wrote:
>>
>> > As far as I can tell, arch/powerpc/lib/board.c ,
>> > arch/avr32/lib/board.c and examples/standalone/stubs.c actually all
>> > mean __bss_end, as well as all the start.S files, so this seems to be
>> > consistently used at least.
>>
>> I'd come to the same conclusion on my side. However you don't say how
>> you would like the change to be done. Would a single commit for renaming
>> _end into _bss_end and then creating _end after .dynsym be ok for you?
>
> Ah, sorry.
>
> Well, these are two logically separate things: the first is just a
> renamer that should basicly result in the very same images built on
> all systems (which can easily be verified semi-automatically).  The
> second step would be adding _end at the end of the used data area (end
> of .dynsym) on ARM only.

I don't have the environment to build other platforms, so... does any
of you please
to provide such patches?

regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM: Incorrect ROM protection range?

2011-02-24 Thread Po-Yu Chuang
Hi Albert,

On Thu, Feb 24, 2011 at 7:58 PM, Albert ARIBAUD  wrote:
> Le 24/02/2011 10:39, Wolfgang Denk a écrit :
>>
>> Dear Albert ARIBAUD,
>>
>> In message<4d6611a7.5050...@free.fr>  you wrote:
>>>
>>>>>> In the U-Boot image itself, knowing the image size could be achieved
>>>>>> in
>>>>>> ARM by using a general _end symbol that would be set after the last
>>>>>> image output section, so _end-_start would equal the image size.
>>>>>
>>>>> we have such a "_end" in u-boot.lds files.
>>>
>>> I *knew* this name did not pop up in my mind without a reason. :)
>>>
>>> Apologies for not having checked.
>>>
>>>> I guess we need a __dynsym_end in all u-boot.lds files.
>>>
>>> I'd rather go for "_end", which does not tie the solution to dynsym
>>> being the last section in the image -- imagine for some reason we move
>>> dynsym inside the image rather than at the end, end the image size will
>>> be wrong again. With _end, and a suitable comment in the LD file... this
>>> will be averted where-ever dynsym ends up.
>>>
>>> After all, the bug you uncovered was due to using the wrong symbol, a
>>> BSS related one rather than an image-related one, in the first place; so
>>> let's try and learn from past mistakes.
>>
>> I think the location of _end in the linker scripts needs to be changed
>> - so far it covers the maximum of dynsym and bss, but it should refer
>> to the end of dynsym only.
>
> Po-Yu Chuang, can you verify Wolfgang's suggestion (and make sure no other
> place depends on _end) and submit a patch? As this is a fix, a quick patch
> could still be pulled in for the upcoming release.

I think there is a problem in Wolfgang's suggestion.

Those start.S files assume that BSS section is from __bss_start to _end.
If we change _end to the end of .dynsym, then we will not clear BSS correctly.

I agree with your comment about _end is a better choice than __dynsym_end,
but if we changed _end, maybe we need __bss_end? Either way, we need to
modify all the u-boot.lds and/or start.S.

I still don't know what is the best solution.

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM: Incorrect ROM protection range?

2011-02-23 Thread Po-Yu Chuang
Hi Heiko,

On Thu, Feb 24, 2011 at 3:33 PM, Heiko Schocher  wrote:
> Albert ARIBAUD wrote:
> The bin length is calculated in arch/arm/lib/board.c, but it seems
> to me not correct ... :-(
>
> in board_init_f():
>
> gd->mon_len = _bss_end_ofs;
>
> that seems correct to me, but later in board_init_r()
>
> monitor_flash_len = _bss_start_ofs;
>
> which is used for example in ./drivers/mtd/cfi_flash.c for protecting
> the flash sectors ... so this should be fixed.
>
>> In the U-Boot image itself, knowing the image size could be achieved in
>> ARM by using a general _end symbol that would be set after the last
>> image output section, so _end-_start would equal the image size.
>
> we have such a "_end" in u-boot.lds files.

I guess we need a __dynsym_end in all u-boot.lds files.

>> For code other than the U-Boot image itself (loaders, utilities), a 'du
>> -b u-boot.bin | cut -f 1' should be ok, provided the image is built
>> first, which I think is already the case.

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ARM: Incorrect ROM protection range?

2011-02-23 Thread Po-Yu Chuang
Hi Albert,

On Thu, Feb 24, 2011 at 2:52 PM, Albert ARIBAUD  wrote:
> Hi Po-Yu Chuang,
>
> Le 24/02/2011 07:06, Po-Yu Chuang a écrit :
>> That is quite strange.
>> According to arch/arm/cpu/arm920t/u-boot.lds,
>> .rel.dyn and .dynsym sections should be placed before __bss_start.
>> However, objdump shows that they are not at where they should be.
>>
>> Do I understand correctly?
>
> Not quite. Actually, relocation sections should start from the same
> location as BSS -- they are overlaid at the same location, and this is
> voluntary.
>
> The relocation sections are only needed and useful before relocation, where
> BSS should not be used anyway.
>
> BSS only exists after relocation, where relocation tables are no more
> useful.
>
> Thus, to minimize RAM and FLASH footprints, the two are overlaid at the same
> location.

I got it. Thanks for your explanation.

>> Does anybody have similar situation?
>
> Just about all people who use ARM U-Boot since the overlay was introduced.
> :)
>
>> 0001bf1c g       .bss    __bss_start
>
>> 0001bf1c g       .rel.dyn        __rel_dyn_start
>
>> 0001f73c g       .dynsym         __dynsym_start
>> 0001f73c g       .rel.dyn        __rel_dyn_end
>
> This is normal as far as layout is concerned: BSS and .rel.dyn start at the
> same offset, and .dynsym follows .rel.dyn.
>
> You're right that U-Boot protection should cover the whole of U-Boot,
> including the relocation tables. I *think* protection uses a monitor length
> define for this. Can you verify this point, and check what your "monitor
> length" define amounts to? Maybe it does not cover the relocation tables any
> more.

The monitor length is not defined by macro. It is calculated.

In drivers/mtd/cfi_flash.c:

/* Monitor protection ON by default */
#if (CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE) && \
(!defined(CONFIG_MONITOR_IS_IN_RAM))
flash_protect (FLAG_PROTECT_SET,
   CONFIG_SYS_MONITOR_BASE,
   CONFIG_SYS_MONITOR_BASE + monitor_flash_len  - 1,
   flash_get_info(CONFIG_SYS_MONITOR_BASE));
#endif

monitor_flash_len is defined in arch/arm/lib/board.c and is calculated
by board_init_r():

monitor_flash_len = _bss_start_ofs;

Which is in arch/arm/cpu/arm920t/start.S in my case:

.globl _bss_start_ofs
_bss_start_ofs:
.word __bss_start - _start


So I guess we should use another way to calculate monitor_flash_len.

>
> BTW,
>
> Would it not be better to compute the actual image size rather than rely on
> a define?
>
> In the U-Boot image itself, knowing the image size could be achieved in ARM
> by using a general _end symbol that would be set after the last image output
> section, so _end-_start would equal the image size.

But _end means end of bss section, right?
I think _end is not the right choice.

> For code other than the U-Boot image itself (loaders, utilities), a 'du -b
> u-boot.bin | cut -f 1' should be ok, provided the image is built first,
> which I think is already the case.

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] ARM: Incorrect ROM protection range?

2011-02-23 Thread Po-Yu Chuang
Hi all,

I am using relocation fixed a320evb (arm) u-boot.

I noticed something weird about the output of
command flinfo.

The size of u-boot.bin is 129156 (0x1F884), but the
protected range is only 0 ~ 0x1bfff.

I guess that it is because u-boot protects _start ~ __bss_start,
but there are some other things in u-boot.bin after __bss_start,
e.g. .rel.dyn section and .dynsym section

That is quite strange.
According to arch/arm/cpu/arm920t/u-boot.lds,
.rel.dyn and .dynsym sections should be placed before __bss_start.
However, objdump shows that they are not at where they should be.

Do I understand correctly?
Does anybody have similar situation?

BTW, the toolchain I am using is
arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2010q1-202) 4.4.1.


0001be8c g O .u_boot_cmd0018 __u_boot_cmd_printenv
0001bea4 g O .u_boot_cmd0018 __u_boot_cmd_setenv
0001bebc g O .u_boot_cmd0018 __u_boot_cmd_run
0001bed4 g O .u_boot_cmd0018 __u_boot_cmd_source
0001beec g O .u_boot_cmd0018 __u_boot_cmd_version
0001bf04 g O .u_boot_cmd0018 __u_boot_cmd_imxtract
0001bf1c g   *ABS*   __u_boot_cmd_end
0001bf1c g   .bss    __bss_start
0001bf1c g O .bss   0004 monitor_flash_len
0001bf1c g   .rel.dyn    __rel_dyn_start
0001bf1c ld  .bss    .bss
0001bf1c ld  .rel.dyn    .rel.dyn
0001bf20 l O .bss   012c images
0001c04c l O .bss   0004 os_data_state
0001c050 l O .bss   0004 os_data_addr
0001c054 l O .bss   0004 bin_start_address
0001c058 l O .bss   0004 k_data_escape
0001c05c g O .bss   0004 os_data_init
0001c060 l O .bss   0004 k_data_escape_saved
0001c064 l O .bss   0004 os_data_state_saved
[snip]
0001dcac l O .bss   0004 NetRestarted
0001dcb0 g O .bss   0004 NetRestartWrap
0001dcb4 l O .bss   0004 NetDevExists
0001dcb8 g O .bss   1e20 PktBuf
0001f73c g   .dynsym __dynsym_start
0001f73c g   .rel.dyn    __rel_dyn_end
0001f73c ld  .dynsym .dynsym
0001fad8 g O .bss   0010 NetRxPackets
0001fae8 g O .bss   0620 NetArpWaitPacketBuf
00020108 l O .bss   0004 env_changed_id.3244



U-Boot 2011.03-rc1-00134-ga898a11 (Feb 23 2011 - 16:53:13)

DRAM:  64 MiB
Flash: 32.5 MiB
In:serial
Out:   serial
Err:   serial
Net:   FTMAC100
Hit any key to stop autoboot:  0
A320 # fli 1

Bank # 1: SST 39LF040 flash (8 x 8)  Size: 512 kB in 128 Sectors
  AMD Legacy command set, Manufacturer ID: 0xBF, Device ID: 0xD7
  Erase timeout: 3 ms, write timeout: 100 ms

  Sector Start Addresses:
     RO   1000   RO   2000   RO   3000   RO   4000   RO
  5000   RO   6000   RO   7000   RO   8000   RO   9000   RO
  A000   RO   B000   RO   C000   RO   D000   RO   E000   RO
  F000   RO   0001   RO   00011000   RO   00012000   RO   00013000   RO
  00014000   RO   00015000   RO   00016000   RO   00017000   RO   00018000   RO
  00019000   RO   0001A000   RO   0001B000   RO   0001C0000001D000
  0001E0000001F00000020002100000022000
  0002300000024000000250000002600000027000
  00028000000290000002A0000002B0000002C000
  0002D0000002E0000002F000000300031000
  0003200000033000000340000003500000036000
  0003700000038000000390000003A0000003B000
  0003C0000003D0000003E0000003F0000004
  0004100000042000000430000004400000045000
  000460000004700000048000000490000004A000
  0004B0000004C0000004D0000004E0000004F000
  000500051000000520000005300000054000
  0005500000056000000570000005800000059000
  0005A0000005B0000005C0000005D0000005E000
  0005F0000006   RO   00061000   RO   00062000   RO   00063000   RO
  00064000   RO   00065000   RO   00066000   RO   00067000   RO   00068000   RO
  00069000   RO   0006A000   RO   0006B000   RO   0006C000   RO   0006D000   RO
  0006E000   RO   0006F000   RO   0007   RO   00071000   RO   00072000   RO
  00073000   RO   00074000   RO   00075000   RO   00076000   RO   00077000   RO
  00078000   RO   00079000   RO   0007A000   RO   0007B000   RO   0007C000   RO
  0007D000   RO   0007E000   RO   0007F000   RO

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2] arm: get_sp() should always be compiled

2011-02-17 Thread Po-Yu Chuang
Hi Albert,

On Fri, Feb 18, 2011 at 1:23 AM, Albert ARIBAUD  wrote:
> Le 17/02/2011 13:54, Macpaul Lin a écrit :
>> 2011/2/17 Albert ARIBAUD:
>>> Le 16/02/2011 09:54, Po-Yu Chuang a écrit :
>>>> From: Po-Yu Chuang
>>>>
>>>> get_sp() was incorrectly excluded if none of
>>>>    CONFIG_SETUP_MEMORY_TAGS
>>>>    CONFIG_CMDLINE_TAG
>>>>    CONFIG_INITRD_TAG
>>>>    CONFIG_SERIAL_TAG
>>>>    CONFIG_REVISION_TAG
>>>> were defined.
>>>
>>> Which board exactly requires this patch?
>>
>> I think it is a320evb.
>
> Ok. This patch indeed removes the 'get_sp' error on this board's build, but
> as an FYI, it does not build anyway.

The following patches fix all the build errors of a320evb:
(Although it still won't work, its timer still need some fix.)

[PATCH v2 1/2] power: ftpmu010: move drivers/power/ftpmu010.h to include/faraday
[PATCH v2 2/2] arm: a320: use new ftpmu010 API

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 2/2] arm: a320: use new ftpmu010 API

2011-02-17 Thread Po-Yu Chuang
From: Po-Yu Chuang 

ftpmu010 related code has been moved to drivers/power/.

Signed-off-by: Po-Yu Chuang 
---
v2:
remove unused local variable oscc
include/ftpmu010.h -> include/faraday/ftpmu010.h

 arch/arm/cpu/arm920t/a320/timer.c |   23 +++
 include/configs/a320evb.h |5 +
 2 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/arch/arm/cpu/arm920t/a320/timer.c 
b/arch/arm/cpu/arm920t/a320/timer.c
index d2e316f..7785036 100644
--- a/arch/arm/cpu/arm920t/a320/timer.c
+++ b/arch/arm/cpu/arm920t/a320/timer.c
@@ -19,21 +19,19 @@
 
 #include 
 #include 
-#include 
 #include 
+#include 
 
 static ulong timestamp;
 static ulong lastdec;
 
 static struct fttmr010 *tmr = (struct fttmr010 *)CONFIG_FTTMR010_BASE;
-static struct ftpmu010 *pmu = (struct ftpmu010 *)CONFIG_FTPMU010_BASE;
 
 #define TIMER_CLOCK32768
 #define TIMER_LOAD_VAL 0x
 
 int timer_init(void)
 {
-   unsigned int oscc;
unsigned int cr;
 
debug("%s()\n", __func__);
@@ -41,23 +39,8 @@ int timer_init(void)
/* disable timers */
writel(0, &tmr->cr);
 
-   /*
-* use 32768Hz oscillator for RTC, WDT, TIMER
-*/
-
-   /* enable the 32768Hz oscillator */
-   oscc = readl(&pmu->OSCC);
-   oscc &= ~(FTPMU010_OSCC_OSCL_OFF | FTPMU010_OSCC_OSCL_TRI);
-   writel(oscc, &pmu->OSCC);
-
-   /* wait until ready */
-   while (!(readl(&pmu->OSCC) & FTPMU010_OSCC_OSCL_STABLE))
-   ;
-
-   /* select 32768Hz oscillator */
-   oscc = readl(&pmu->OSCC);
-   oscc |= FTPMU010_OSCC_OSCL_RTCLSEL;
-   writel(oscc, &pmu->OSCC);
+   /* use 32768Hz oscillator for RTC, WDT, TIMER */
+   ftpmu010_32768osc_enable();
 
/* setup timer */
writel(TIMER_LOAD_VAL, &tmr->timer3_load);
diff --git a/include/configs/a320evb.h b/include/configs/a320evb.h
index 27f137f..5373bcb 100644
--- a/include/configs/a320evb.h
+++ b/include/configs/a320evb.h
@@ -32,6 +32,11 @@
 #undef CONFIG_SKIP_LOWLEVEL_INIT
 
 /*---
+ * Power Management Unit
+ */
+#define CONFIG_FTPMU010_POWER
+
+/*---
  * Timer
  */
 #define CONFIG_SYS_HZ  1000/* timer ticks per second */
-- 
1.6.3.3

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


[U-Boot] [PATCH v2 1/2] power: ftpmu010: move drivers/power/ftpmu010.h to include/faraday

2011-02-17 Thread Po-Yu Chuang
From: Po-Yu Chuang 

Also add API declarations.

Signed-off-by: Po-Yu Chuang 
---
v2:
move include/ftpmu010.h to include/faraday/ftpmu010.h

 drivers/power/ftpmu010.c   |2 +-
 drivers/power/ftpmu010.h   |  146 --
 include/faraday/ftpmu010.h |  150 
 3 files changed, 151 insertions(+), 147 deletions(-)
 delete mode 100644 drivers/power/ftpmu010.h
 create mode 100644 include/faraday/ftpmu010.h

diff --git a/drivers/power/ftpmu010.c b/drivers/power/ftpmu010.c
index 7924ac1..c6a8cda 100644
--- a/drivers/power/ftpmu010.c
+++ b/drivers/power/ftpmu010.c
@@ -23,7 +23,7 @@
 
 #include 
 #include 
-#include "ftpmu010.h"
+#include 
 
 static struct ftpmu010 *pmu = (struct ftpmu010 *)CONFIG_FTPMU010_BASE;
 
diff --git a/drivers/power/ftpmu010.h b/drivers/power/ftpmu010.h
deleted file mode 100644
index 8ef7a37..000
--- a/drivers/power/ftpmu010.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * (C) Copyright 2009 Faraday Technology
- * Po-Yu Chuang 
- *
- * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/*
- * Power Management Unit
- */
-#ifndef __FTPMU010_H
-#define __FTPMU010_H
-
-struct ftpmu010 {
-   unsigned intIDNMBR0;/* 0x00 */
-   unsigned intreserved0;  /* 0x04 */
-   unsigned intOSCC;   /* 0x08 */
-   unsigned intPMODE;  /* 0x0C */
-   unsigned intPMCR;   /* 0x10 */
-   unsigned intPED;/* 0x14 */
-   unsigned intPEDSR;  /* 0x18 */
-   unsigned intreserved1;  /* 0x1C */
-   unsigned intPMSR;   /* 0x20 */
-   unsigned intPGSR;   /* 0x24 */
-   unsigned intMFPSR;  /* 0x28 */
-   unsigned intMISC;   /* 0x2C */
-   unsigned intPDLLCR0;/* 0x30 */
-   unsigned intPDLLCR1;/* 0x34 */
-   unsigned intAHBMCLKOFF; /* 0x38 */
-   unsigned intAPBMCLKOFF; /* 0x3C */
-   unsigned intDCSRCR0;/* 0x40 */
-   unsigned intDCSRCR1;/* 0x44 */
-   unsigned intDCSRCR2;/* 0x48 */
-   unsigned intSDRAMHTC;   /* 0x4C */
-   unsigned intPSPR0;  /* 0x50 */
-   unsigned intPSPR1;  /* 0x54 */
-   unsigned intPSPR2;  /* 0x58 */
-   unsigned intPSPR3;  /* 0x5C */
-   unsigned intPSPR4;  /* 0x60 */
-   unsigned intPSPR5;  /* 0x64 */
-   unsigned intPSPR6;  /* 0x68 */
-   unsigned intPSPR7;  /* 0x6C */
-   unsigned intPSPR8;  /* 0x70 */
-   unsigned intPSPR9;  /* 0x74 */
-   unsigned intPSPR10; /* 0x78 */
-   unsigned intPSPR11; /* 0x7C */
-   unsigned intPSPR12; /* 0x80 */
-   unsigned intPSPR13; /* 0x84 */
-   unsigned intPSPR14; /* 0x88 */
-   unsigned intPSPR15; /* 0x8C */
-   unsigned intAHBDMA_RACCS;   /* 0x90 */
-   unsigned intreserved2;  /* 0x94 */
-   unsigned intreserved3;  /* 0x98 */
-   unsigned intJSS;/* 0x9C */
-   unsigned intCFC_RACC;   /* 0xA0 */
-   unsigned intSSP1_RACC;  /* 0xA4 */
-   unsigned intUART1TX_RACC;   /* 0xA8 */
-   unsigned intUART1RX_RACC;   /* 0xAC */
-   unsigned intUART2TX_RACC;   /* 0xB0 */
-   unsigned intUART2RX_RACC;   /* 0xB4 */
-   unsigned intSDC_RACC;   /* 0xB8 */
-   unsigned intI2SAC97_RACC;   /* 0xBC */
-   unsigned intIRDATX_RACC;/* 0xC0 */
-   unsigned intreserved4;  /* 0xC4 */
-   unsigned intUSBD_RACC;  /* 0xC8 */
-   unsigned intIRDARX_RACC;/* 0xCC */
-   unsigned intIRDA_RACC;  /* 0xD0 */
-   unsigned intED0_RACC;   /* 0xD4 */
-   unsigned intED1_RACC;   /* 0xD8 */
-};
-
-/*
- * ID Number 0 Register
- */
-#define FTPMU010_ID_A320A  0x0320
-#define FTPMU010_ID_A320C  0x03200010
-#define FTPMU010_ID_A320D  0x03200030
-
-/*
- * OSC Control Register
- */
-#define FTPMU010_OSCC_OSCH_TRI (1 << 11)
-#define FTPMU010_OSCC_OSCH_STABLE  (1 << 9)
-#define 

Re: [U-Boot] [PATCH 1/2] power: ftpmu010: move drivers/power/ftpmu010.h to include/

2011-02-16 Thread Po-Yu Chuang
Hi Macpaul,

On Wed, Feb 16, 2011 at 5:23 PM, Macpaul Lin  wrote:
> Hi Po-Yu,
>
> 2011/2/16 Po-Yu Chuang :
>> From: Po-Yu Chuang 
>>
>> Also add API declarations.
>>
>> Signed-off-by: Po-Yu Chuang 
>> ---
>>  drivers/power/ftpmu010.c |    2 +-
>>  drivers/power/ftpmu010.h |  146 
>>  include/ftpmu010.h       |  150 
>> ++
>>  3 files changed, 151 insertions(+), 147 deletions(-)
>>  delete mode 100644 drivers/power/ftpmu010.h
>>  create mode 100644 include/ftpmu010.h
>
> Just one comment which has been replied earlier in the previous discuss.
> Put ftpmu010.h into "include/faraday" instead of "include".

Agree. It will be nicer.

Wolfgang, do you have any comment?

regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/2] arm: a320: use new ftpmu010 API

2011-02-16 Thread Po-Yu Chuang
From: Po-Yu Chuang 

ftpmu010 related code has been moved to drivers/power/.

Signed-off-by: Po-Yu Chuang 
---
 arch/arm/cpu/arm920t/a320/timer.c |   22 +++---
 include/configs/a320evb.h |5 +
 2 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/arch/arm/cpu/arm920t/a320/timer.c 
b/arch/arm/cpu/arm920t/a320/timer.c
index d2e316f..e261a49 100644
--- a/arch/arm/cpu/arm920t/a320/timer.c
+++ b/arch/arm/cpu/arm920t/a320/timer.c
@@ -19,14 +19,13 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 static ulong timestamp;
 static ulong lastdec;
 
 static struct fttmr010 *tmr = (struct fttmr010 *)CONFIG_FTTMR010_BASE;
-static struct ftpmu010 *pmu = (struct ftpmu010 *)CONFIG_FTPMU010_BASE;
 
 #define TIMER_CLOCK32768
 #define TIMER_LOAD_VAL 0x
@@ -41,23 +40,8 @@ int timer_init(void)
/* disable timers */
writel(0, &tmr->cr);
 
-   /*
-* use 32768Hz oscillator for RTC, WDT, TIMER
-*/
-
-   /* enable the 32768Hz oscillator */
-   oscc = readl(&pmu->OSCC);
-   oscc &= ~(FTPMU010_OSCC_OSCL_OFF | FTPMU010_OSCC_OSCL_TRI);
-   writel(oscc, &pmu->OSCC);
-
-   /* wait until ready */
-   while (!(readl(&pmu->OSCC) & FTPMU010_OSCC_OSCL_STABLE))
-   ;
-
-   /* select 32768Hz oscillator */
-   oscc = readl(&pmu->OSCC);
-   oscc |= FTPMU010_OSCC_OSCL_RTCLSEL;
-   writel(oscc, &pmu->OSCC);
+   /* use 32768Hz oscillator for RTC, WDT, TIMER */
+   ftpmu010_32768osc_enable();
 
/* setup timer */
writel(TIMER_LOAD_VAL, &tmr->timer3_load);
diff --git a/include/configs/a320evb.h b/include/configs/a320evb.h
index 27f137f..5373bcb 100644
--- a/include/configs/a320evb.h
+++ b/include/configs/a320evb.h
@@ -32,6 +32,11 @@
 #undef CONFIG_SKIP_LOWLEVEL_INIT
 
 /*---
+ * Power Management Unit
+ */
+#define CONFIG_FTPMU010_POWER
+
+/*---
  * Timer
  */
 #define CONFIG_SYS_HZ  1000/* timer ticks per second */
-- 
1.6.3.3

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


[U-Boot] [PATCH 1/2] power: ftpmu010: move drivers/power/ftpmu010.h to include/

2011-02-16 Thread Po-Yu Chuang
From: Po-Yu Chuang 

Also add API declarations.

Signed-off-by: Po-Yu Chuang 
---
 drivers/power/ftpmu010.c |2 +-
 drivers/power/ftpmu010.h |  146 
 include/ftpmu010.h   |  150 ++
 3 files changed, 151 insertions(+), 147 deletions(-)
 delete mode 100644 drivers/power/ftpmu010.h
 create mode 100644 include/ftpmu010.h

diff --git a/drivers/power/ftpmu010.c b/drivers/power/ftpmu010.c
index 7924ac1..dc4ca5d 100644
--- a/drivers/power/ftpmu010.c
+++ b/drivers/power/ftpmu010.c
@@ -23,7 +23,7 @@
 
 #include 
 #include 
-#include "ftpmu010.h"
+#include 
 
 static struct ftpmu010 *pmu = (struct ftpmu010 *)CONFIG_FTPMU010_BASE;
 
diff --git a/drivers/power/ftpmu010.h b/drivers/power/ftpmu010.h
deleted file mode 100644
index 8ef7a37..000
--- a/drivers/power/ftpmu010.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * (C) Copyright 2009 Faraday Technology
- * Po-Yu Chuang 
- *
- * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/*
- * Power Management Unit
- */
-#ifndef __FTPMU010_H
-#define __FTPMU010_H
-
-struct ftpmu010 {
-   unsigned intIDNMBR0;/* 0x00 */
-   unsigned intreserved0;  /* 0x04 */
-   unsigned intOSCC;   /* 0x08 */
-   unsigned intPMODE;  /* 0x0C */
-   unsigned intPMCR;   /* 0x10 */
-   unsigned intPED;/* 0x14 */
-   unsigned intPEDSR;  /* 0x18 */
-   unsigned intreserved1;  /* 0x1C */
-   unsigned intPMSR;   /* 0x20 */
-   unsigned intPGSR;   /* 0x24 */
-   unsigned intMFPSR;  /* 0x28 */
-   unsigned intMISC;   /* 0x2C */
-   unsigned intPDLLCR0;/* 0x30 */
-   unsigned intPDLLCR1;/* 0x34 */
-   unsigned intAHBMCLKOFF; /* 0x38 */
-   unsigned intAPBMCLKOFF; /* 0x3C */
-   unsigned intDCSRCR0;/* 0x40 */
-   unsigned intDCSRCR1;/* 0x44 */
-   unsigned intDCSRCR2;/* 0x48 */
-   unsigned intSDRAMHTC;   /* 0x4C */
-   unsigned intPSPR0;  /* 0x50 */
-   unsigned intPSPR1;  /* 0x54 */
-   unsigned intPSPR2;  /* 0x58 */
-   unsigned intPSPR3;  /* 0x5C */
-   unsigned intPSPR4;  /* 0x60 */
-   unsigned intPSPR5;  /* 0x64 */
-   unsigned intPSPR6;  /* 0x68 */
-   unsigned intPSPR7;  /* 0x6C */
-   unsigned intPSPR8;  /* 0x70 */
-   unsigned intPSPR9;  /* 0x74 */
-   unsigned intPSPR10; /* 0x78 */
-   unsigned intPSPR11; /* 0x7C */
-   unsigned intPSPR12; /* 0x80 */
-   unsigned intPSPR13; /* 0x84 */
-   unsigned intPSPR14; /* 0x88 */
-   unsigned intPSPR15; /* 0x8C */
-   unsigned intAHBDMA_RACCS;   /* 0x90 */
-   unsigned intreserved2;  /* 0x94 */
-   unsigned intreserved3;  /* 0x98 */
-   unsigned intJSS;/* 0x9C */
-   unsigned intCFC_RACC;   /* 0xA0 */
-   unsigned intSSP1_RACC;  /* 0xA4 */
-   unsigned intUART1TX_RACC;   /* 0xA8 */
-   unsigned intUART1RX_RACC;   /* 0xAC */
-   unsigned intUART2TX_RACC;   /* 0xB0 */
-   unsigned intUART2RX_RACC;   /* 0xB4 */
-   unsigned intSDC_RACC;   /* 0xB8 */
-   unsigned intI2SAC97_RACC;   /* 0xBC */
-   unsigned intIRDATX_RACC;/* 0xC0 */
-   unsigned intreserved4;  /* 0xC4 */
-   unsigned intUSBD_RACC;  /* 0xC8 */
-   unsigned intIRDARX_RACC;/* 0xCC */
-   unsigned intIRDA_RACC;  /* 0xD0 */
-   unsigned intED0_RACC;   /* 0xD4 */
-   unsigned intED1_RACC;   /* 0xD8 */
-};
-
-/*
- * ID Number 0 Register
- */
-#define FTPMU010_ID_A320A  0x0320
-#define FTPMU010_ID_A320C  0x03200010
-#define FTPMU010_ID_A320D  0x03200030
-
-/*
- * OSC Control Register
- */
-#define FTPMU010_OSCC_OSCH_TRI (1 << 11)
-#define FTPMU010_OSCC_OSCH_STABLE  (1 << 9)
-#define FTPMU010_OSCC_OSCH_OFF (1 << 8)
-
-#define FTPMU010_O

Re: [U-Boot] [PATCH v2 1/2] ftpmu010: support faraday ftpmu010 driver

2011-02-16 Thread Po-Yu Chuang
Hi Macpaul,

On Wed, Feb 16, 2011 at 3:58 PM, Macpaul Lin  wrote:
>
> As you can see, the include of PMU header has been replaced to a correct path.
> [U-Boot,2/3] fttmr010: move fttmr010 controller to drivers/timer folder
> http://patchwork.ozlabs.org/patch/71952/
>
> However, I cannot found the part of previous patch [U-Boot,1/3]
> You can find that I have replace a correct path to the file
> "arch/arm/cpu/arm920t/a320/timer.c" which haven't been applied.
> http://www.mail-archive.com/u-boot@lists.denx.de/msg41320.html
>
> Wolfgang, could you please check if something have been missing in the
> last git apply?
> It looks like that we have something missed in the current tree while
> this patch have been already applied
> "http://www.mail-archive.com/u-boot@lists.denx.de/msg41320.html";.
>
> The missing part is the following patch.
> diff --git a/arch/arm/cpu/arm920t/a320/timer.c
> b/arch/arm/cpu/arm920t/a320/timer.c
> index d2e316f..4718ae6 100644
> --- a/arch/arm/cpu/arm920t/a320/timer.c
> +++ b/arch/arm/cpu/arm920t/a320/timer.c
> @@ -19,7 +19,7 @@
>
>  #include 
>  #include 
> -#include 
> +#include "../../../../../drivers/power/ftpmu010.h"
>  #include 
>
>  static ulong timestamp;

If I remember correctly, this patch was not applied
because Wolfgang does not like the include "../../../..".

> Po-Yu,
> Yes, there are also another patches waiting to be review and be applied.
> ftpmu010: fix relocation and enhance features
> http://patchwork.ozlabs.org/patch/77704/

This patch doesn't seem to affect a320.

Since I have a patch to fix the current (compilation) problem,
I'll send it to RFC.

regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2] arm: get_sp() should always be compiled

2011-02-16 Thread Po-Yu Chuang
From: Po-Yu Chuang 

get_sp() was incorrectly excluded if none of
  CONFIG_SETUP_MEMORY_TAGS
  CONFIG_CMDLINE_TAG
  CONFIG_INITRD_TAG
  CONFIG_SERIAL_TAG
  CONFIG_REVISION_TAG
were defined.

Signed-off-by: Po-Yu Chuang 
---
v2:
rebase

 arch/arm/lib/bootm.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index a1649ee..7734953 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -327,12 +327,12 @@ void setup_revision_tag(struct tag **in_params)
 }
 #endif  /* CONFIG_REVISION_TAG */
 
-
 static void setup_end_tag (bd_t *bd)
 {
params->hdr.tag = ATAG_NONE;
params->hdr.size = 0;
 }
+#endif /* CONFIG_SETUP_MEMORY_TAGS || CONFIG_CMDLINE_TAG || CONFIG_INITRD_TAG 
*/
 
 static ulong get_sp(void)
 {
@@ -341,5 +341,3 @@ static ulong get_sp(void)
asm("mov %0, sp" : "=r"(ret) : );
return ret;
 }
-
-#endif /* CONFIG_SETUP_MEMORY_TAGS || CONFIG_CMDLINE_TAG || CONFIG_INITRD_TAG 
*/
-- 
1.6.3.3

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


Re: [U-Boot] [PATCH v2 1/2] ftpmu010: support faraday ftpmu010 driver

2011-02-15 Thread Po-Yu Chuang
Hi Macpaul,

On Wed, Feb 16, 2011 at 3:07 PM, Macpaul Lin  wrote:
> 2011/2/16 Po-Yu Chuang 
>> On Wed, Jan 26, 2011 at 5:19 AM, Wolfgang Denk  wrote:
>> >
>> >> Faraday's ftpmu010 is a power managemnet unit which support cpu
>
> Ah, we are all waiting for the timer fix for arm then the related timer and
> pmu patch could be reorganized.

Do you mean there is another pmu patch to be reviewed?

Yes, I am waiting for the arm timer fix too, but I just want it at
least to be able to compile.

>> Sorry for not following this thread.
>> I notice this today because it breaks a320.
>
> Could you please describe how does it breaks a320?

No big deal. Just because the original a320 timer code uses the
register definitions
like your new driver. Since the header is moved from
arch/arm/include/asm/arch-a320/,
it fails to compile (of course).

>> I think maybe it will be better to move driver/power/ftpmu010.h
>> to include/ftpmu010.h and add the API declaration in it?
>
> Does
> /*
>  * PMU
>  */
> #define CONFIG_FTPMU010_POWER
> Couldn't help on fix the compile problem?
> Or if the problem occurs in runtime?

No, I already added that.
What I need is the declaration of ftpmu010_32768osc_enable().
I want to use it to replace the original pmu register access code in
timer_init().

Actually, I am done with the fix (move ftpmu010.h to include/ and add
declarations).
I can submit the patch. Just want to know if you think it is appropriate.

>> I am trying to fix arch/arm/cpu/arm920t/a320/timer.c, but I cannot
>> access the new API now.

regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/2] ftpmu010: support faraday ftpmu010 driver

2011-02-15 Thread Po-Yu Chuang
Hi Macpaul,

On Wed, Jan 26, 2011 at 5:19 AM, Wolfgang Denk  wrote:
>
> In message <1294218744-2535-1-git-send-email-macp...@andestech.com> you wrote:
>> Faraday's ftpmu010 is a power managemnet unit which support cpu
>> sleep and frequency scaling. It has been integrated into many SoC.
>>
>> This patch also move ftpmu010 to a proper place for later enhancement.
>>
>> Signed-off-by: Macpaul Lin 
>
> Applied, thanks.

Sorry for not following this thread.
I notice this today because it breaks a320.

I think maybe it will be better to move driver/power/ftpmu010.h
to include/ftpmu010.h and add the API declaration in it?

I am trying to fix arch/arm/cpu/arm920t/a320/timer.c, but I cannot
access the new API now.

regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 2/2] net: ftmac100: update get_timer() usages

2011-01-20 Thread Po-Yu Chuang
From: Po-Yu Chuang 

Use get_timer() the same way as drivers/net/ftgmac100.c

Signed-off-by: Po-Yu Chuang 
---
v2:
this patch is splitted from "net: ftmac100: remove unncessary volatiles"

 drivers/net/ftmac100.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
index 27381a3..94dc6d9 100644
--- a/drivers/net/ftmac100.c
+++ b/drivers/net/ftmac100.c
@@ -195,8 +195,8 @@ ftmac100_send (struct eth_device *dev, volatile void 
*packet, int length)
 {
struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
struct ftmac100_data *priv = dev->priv;
-   int tmo;
struct ftmac100_txdes *curr_des = priv->txdes;
+   ulong start;
 
if (curr_des->txdes0 & FTMAC100_TXDES0_TXDMA_OWN) {
debug ("%s(): no TX descriptor available\n", __func__);
@@ -224,9 +224,9 @@ ftmac100_send (struct eth_device *dev, volatile void 
*packet, int length)
 
/* wait for transfer to succeed */
 
-   tmo = get_timer (0) + 5 * CONFIG_SYS_HZ;
+   start = get_timer(0);
while (curr_des->txdes0 & FTMAC100_TXDES0_TXDMA_OWN) {
-   if (get_timer (0) >= tmo) {
+   if (get_timer(start) >= 5) {
debug ("%s(): timed out\n", __func__);
return -1;
}
-- 
1.6.3.3

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


[U-Boot] [PATCH v2 1/2] net: ftmac100: remove unncessary volatiles

2011-01-20 Thread Po-Yu Chuang
From: Po-Yu Chuang 


Signed-off-by: Po-Yu Chuang 
---
v2:
split get_timer() changes to a seperate patch

 drivers/net/ftmac100.c |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
index 2328cb5..27381a3 100644
--- a/drivers/net/ftmac100.c
+++ b/drivers/net/ftmac100.c
@@ -30,8 +30,8 @@
 #define ETH_ZLEN   60
 
 struct ftmac100_data {
-   volatile struct ftmac100_txdes txdes[1];
-   volatile struct ftmac100_rxdes rxdes[PKTBUFSRX];
+   struct ftmac100_txdes txdes[1];
+   struct ftmac100_rxdes rxdes[PKTBUFSRX];
int rx_index;
 };
 
@@ -88,8 +88,8 @@ static int ftmac100_init (struct eth_device *dev, bd_t *bd)
 {
struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
struct ftmac100_data *priv = dev->priv;
-   volatile struct ftmac100_txdes *txdes = priv->txdes;
-   volatile struct ftmac100_rxdes *rxdes = priv->rxdes;
+   struct ftmac100_txdes *txdes = priv->txdes;
+   struct ftmac100_rxdes *rxdes = priv->rxdes;
unsigned int maccr;
int i;
 
@@ -153,7 +153,7 @@ static int ftmac100_init (struct eth_device *dev, bd_t *bd)
 static int ftmac100_recv (struct eth_device *dev)
 {
struct ftmac100_data *priv = dev->priv;
-   volatile struct ftmac100_rxdes *curr_des;
+   struct ftmac100_rxdes *curr_des;
unsigned short rxlen;
 
curr_des = &priv->rxdes[priv->rx_index];
@@ -195,8 +195,8 @@ ftmac100_send (struct eth_device *dev, volatile void 
*packet, int length)
 {
struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
struct ftmac100_data *priv = dev->priv;
-   volatile struct ftmac100_txdes *curr_des = priv->txdes;
int tmo;
+   struct ftmac100_txdes *curr_des = priv->txdes;
 
if (curr_des->txdes0 & FTMAC100_TXDES0_TXDMA_OWN) {
debug ("%s(): no TX descriptor available\n", __func__);
-- 
1.6.3.3

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


Re: [U-Boot] [PATCH] net: ftmac100: remove unncessary volatiles

2011-01-20 Thread Po-Yu Chuang
Hi Sergei,

On Thu, Jan 20, 2011 at 11:38 PM, Sergei Shtylyov  wrote:
> Hello.
>
> Po-Yu Chuang wrote:
>
>> From: Po-Yu Chuang 
>
>> This patch also update get_timer() usage.
>
>   This seems like a material for a separate patch.

OK, I will split this to 2 patches later.

> [...]
>>
>> @@ -219,14 +219,12 @@ ftmac100_send (struct eth_device *dev, volatile void
>> *packet, int length)
>>        curr_des->txdes0 = FTMAC100_TXDES0_TXDMA_OWN;
>>        /* start transmit */
>> -
>>        writel (1, &ftmac100->txpd);
>>        /* wait for transfer to succeed */
>> -
>> -       tmo = get_timer (0) + 5 * CONFIG_SYS_HZ;
>> +       start = get_timer (0);
>>        while (curr_des->txdes0 & FTMAC100_TXDES0_TXDMA_OWN) {
>> -               if (get_timer (0) >= tmo) {
>> +               if (get_timer (start) >= 5) {
>
>   I'm not sure this is equivalent to the old code...

The original code waits unnecessarily long. This change refers to the way
the newer driver does - drivers/net/ftgmac100.c.

>>                        debug ("%s(): timed out\n", __func__);
>>                        return -1;
>>                }
>
>   checkpatch.pl says:
>
> WARNING: space prohibited between function name and open parenthesis '('
> #66: FILE: drivers/net/ftmac100.c:225:
> +       start = get_timer (0);
>
> WARNING: space prohibited between function name and open parenthesis '('
> #69: FILE: drivers/net/ftmac100.c:227:
> +               if (get_timer (start) >= 5) {
>
>   I know you're only modifying the existing code, but it's time to fix the
> style of it as well...

OK, I'll fix it.

Thanks,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] net: ftmac100: remove unncessary volatiles

2011-01-20 Thread Po-Yu Chuang
From: Po-Yu Chuang 

This patch also update get_timer() usage.

Signed-off-by: Po-Yu Chuang 
---
 drivers/net/ftmac100.c |   20 +---
 1 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
index 2328cb5..787d69b 100644
--- a/drivers/net/ftmac100.c
+++ b/drivers/net/ftmac100.c
@@ -30,8 +30,8 @@
 #define ETH_ZLEN   60
 
 struct ftmac100_data {
-   volatile struct ftmac100_txdes txdes[1];
-   volatile struct ftmac100_rxdes rxdes[PKTBUFSRX];
+   struct ftmac100_txdes txdes[1];
+   struct ftmac100_rxdes rxdes[PKTBUFSRX];
int rx_index;
 };
 
@@ -88,8 +88,8 @@ static int ftmac100_init (struct eth_device *dev, bd_t *bd)
 {
struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
struct ftmac100_data *priv = dev->priv;
-   volatile struct ftmac100_txdes *txdes = priv->txdes;
-   volatile struct ftmac100_rxdes *rxdes = priv->rxdes;
+   struct ftmac100_txdes *txdes = priv->txdes;
+   struct ftmac100_rxdes *rxdes = priv->rxdes;
unsigned int maccr;
int i;
 
@@ -153,7 +153,7 @@ static int ftmac100_init (struct eth_device *dev, bd_t *bd)
 static int ftmac100_recv (struct eth_device *dev)
 {
struct ftmac100_data *priv = dev->priv;
-   volatile struct ftmac100_rxdes *curr_des;
+   struct ftmac100_rxdes *curr_des;
unsigned short rxlen;
 
curr_des = &priv->rxdes[priv->rx_index];
@@ -195,8 +195,8 @@ ftmac100_send (struct eth_device *dev, volatile void 
*packet, int length)
 {
struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
struct ftmac100_data *priv = dev->priv;
-   volatile struct ftmac100_txdes *curr_des = priv->txdes;
-   int tmo;
+   struct ftmac100_txdes *curr_des = priv->txdes;
+   ulong start;
 
if (curr_des->txdes0 & FTMAC100_TXDES0_TXDMA_OWN) {
debug ("%s(): no TX descriptor available\n", __func__);
@@ -219,14 +219,12 @@ ftmac100_send (struct eth_device *dev, volatile void 
*packet, int length)
curr_des->txdes0 = FTMAC100_TXDES0_TXDMA_OWN;
 
/* start transmit */
-
writel (1, &ftmac100->txpd);
 
/* wait for transfer to succeed */
-
-   tmo = get_timer (0) + 5 * CONFIG_SYS_HZ;
+   start = get_timer (0);
while (curr_des->txdes0 & FTMAC100_TXDES0_TXDMA_OWN) {
-   if (get_timer (0) >= tmo) {
+   if (get_timer (start) >= 5) {
debug ("%s(): timed out\n", __func__);
return -1;
}
-- 
1.6.3.3

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


Re: [U-Boot] [PATCH v2 1/2] arm: a320 timer: move static data to global_data struct

2011-01-18 Thread Po-Yu Chuang
Dear Wolfgang,

On Wed, Jan 19, 2011 at 5:45 AM, Wolfgang Denk  wrote:
> Dear Po-Yu Chuang,
> In message  you 
> wrote:
>> Would you please check this patch series?
>> Or should I rebase and resubmit?
>
> This is mostly in the responsibility of Albert, the ARM custodian.

Sorry, I didn't noticed that we have new custodian now.

Thanks,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/2] arm: a320 timer: move static data to global_data struct

2011-01-16 Thread Po-Yu Chuang
Dear Wolfgang,

On Mon, Dec 20, 2010 at 5:00 PM, Po-Yu Chuang  wrote:
> From: Po-Yu Chuang 
>
> timer.c used static data and are called before relocation.
> Move all static variables into global_data structure. Also cleanup
> timer.c from unused stubs and make it truly use 64 bit tick values.
>
> Based on Reinhard Meyer 's patch
> 5dca710a3d7703e41da0e9894f2d71f9e25bea6b
>
> Signed-off-by: Po-Yu Chuang 
> ---
> v2:
> rebase
> use gd->timer_rate_hz.
> remove unused global variable timestamp and lastdec.
> move register bases to local variables
>
>  arch/arm/cpu/arm920t/a320/timer.c |  147 
> ++---
>  1 files changed, 56 insertions(+), 91 deletions(-)

Would you please check this patch series?
Or should I rebase and resubmit?

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 2/2] a320evb: replace built-in ftpmu010 related code

2011-01-05 Thread Po-Yu Chuang
Dear Reinhard,

On Wed, Jan 5, 2011 at 5:46 PM, Reinhard Meyer  wrote:
> Dear Macpaul Lin,
>>
>> Replace built-in ftpmu010 related code in timer.c for shared driver
>> support.
>>
>> Signed-off-by: Macpaul Lin
>> ---
>>  static ulong timestamp;
>>  static ulong lastdec;
>
> This is going to fail if used before relocation

There is a patch to fix that, but has not been accepted yet.

http://lists.denx.de/pipermail/u-boot/2010-December/084001.html

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Dear Friends

2010-12-28 Thread Po-Yu Chuang

 
Just
received  my iphone 3gs 32gb from this website    http://penggefa.com/";>http://penggefa.com   much cheaper than others and genuine
. if you would like to get one,you can check it out, 
all the
best for 2010
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 1/2] arm: a320 timer: move static data to global_data struct

2010-12-20 Thread Po-Yu Chuang
From: Po-Yu Chuang 

timer.c used static data and are called before relocation.
Move all static variables into global_data structure. Also cleanup
timer.c from unused stubs and make it truly use 64 bit tick values.

Based on Reinhard Meyer 's patch
5dca710a3d7703e41da0e9894f2d71f9e25bea6b

Signed-off-by: Po-Yu Chuang 
---
v2:
rebase
use gd->timer_rate_hz.
remove unused global variable timestamp and lastdec.
move register bases to local variables

 arch/arm/cpu/arm920t/a320/timer.c |  147 ++---
 1 files changed, 56 insertions(+), 91 deletions(-)

diff --git a/arch/arm/cpu/arm920t/a320/timer.c 
b/arch/arm/cpu/arm920t/a320/timer.c
index d2e316f..5af94c2 100644
--- a/arch/arm/cpu/arm920t/a320/timer.c
+++ b/arch/arm/cpu/arm920t/a320/timer.c
@@ -18,21 +18,36 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
 
-static ulong timestamp;
-static ulong lastdec;
-
-static struct fttmr010 *tmr = (struct fttmr010 *)CONFIG_FTTMR010_BASE;
-static struct ftpmu010 *pmu = (struct ftpmu010 *)CONFIG_FTPMU010_BASE;
+DECLARE_GLOBAL_DATA_PTR;
 
 #define TIMER_CLOCK32768
 #define TIMER_LOAD_VAL 0x
 
+static inline unsigned long long tick_to_time(unsigned long long tick)
+{
+   tick *= CONFIG_SYS_HZ;
+   do_div(tick, gd->timer_rate_hz);
+
+   return tick;
+}
+
+static inline unsigned long long usec_to_tick(unsigned long long usec)
+{
+   usec *= gd->timer_rate_hz;
+   do_div(usec, 100);
+
+   return usec;
+}
+
 int timer_init(void)
 {
+   struct fttmr010 *tmr = (struct fttmr010 *)CONFIG_FTTMR010_BASE;
+   struct ftpmu010 *pmu = (struct ftpmu010 *)CONFIG_FTPMU010_BASE;
unsigned int oscc;
unsigned int cr;
 
@@ -76,118 +91,68 @@ int timer_init(void)
cr |= FTTMR010_TM3_ENABLE;
writel(cr, &tmr->cr);
 
-   /* init the timestamp and lastdec value */
-   reset_timer_masked();
+   gd->timer_rate_hz = TIMER_CLOCK;
+   gd->tbu = gd->tbl = 0;
 
return 0;
 }
 
 /*
- * timer without interrupts
- */
-
-/*
- * reset time
+ * Get the current 64 bit timer tick count
  */
-void reset_timer_masked(void)
+unsigned long long get_ticks(void)
 {
-   /* capure current decrementer value time */
-   lastdec = readl(&tmr->timer3_counter) / (TIMER_CLOCK / CONFIG_SYS_HZ);
-   timestamp = 0;  /* start "advancing" time stamp from 0 */
-
-   debug("%s(): lastdec = %lx\n", __func__, lastdec);
-}
+   struct fttmr010 *tmr = (struct fttmr010 *)CONFIG_FTTMR010_BASE;
+   ulong now = TIMER_LOAD_VAL - readl(&tmr->timer3_counter);
 
-void reset_timer(void)
-{
debug("%s()\n", __func__);
-   reset_timer_masked();
-}
 
-/*
- * return timer ticks
- */
-ulong get_timer_masked(void)
-{
-   /* current tick value */
-   ulong now = readl(&tmr->timer3_counter) / (TIMER_CLOCK / CONFIG_SYS_HZ);
-
-   debug("%s(): now = %lx, lastdec = %lx\n", __func__, now, lastdec);
-
-   if (lastdec >= now) {
-   /*
-* normal mode (non roll)
-* move stamp fordward with absoulte diff ticks
-*/
-   timestamp += lastdec - now;
-   } else {
-   /*
-* we have overflow of the count down timer
-*
-* nts = ts + ld + (TLV - now)
-* ts=old stamp, ld=time that passed before passing through -1
-* (TLV-now) amount of time after passing though -1
-* nts = new "advancing time stamp"...it could also roll and
-* cause problems.
-*/
-   timestamp += lastdec + TIMER_LOAD_VAL - now;
-   }
-
-   lastdec = now;
-
-   debug("%s() returns %lx\n", __func__, timestamp);
-
-   return timestamp;
-}
-
-/*
- * return difference between timer ticks and base
- */
-ulong get_timer(ulong base)
-{
-   debug("%s(%lx)\n", __func__, base);
-   return get_timer_masked() - base;
-}
-
-void set_timer(ulong t)
-{
-   debug("%s(%lx)\n", __func__, t);
-   timestamp = t;
+   /* increment tbu if tbl has rolled over */
+   if (now < gd->tbl)
+   gd->tbu++;
+   gd->tbl = now;
+   return (((unsigned long long)gd->tbu) << 32) | gd->tbl;
 }
 
 /* delay x useconds AND preserve advance timestamp value */
 void __udelay(unsigned long usec)
 {
-   long tmo = usec * (TIMER_CLOCK / 1000) / 1000;
-   unsigned long now, last = readl(&tmr->timer3_counter);
-
-   debug("%s(%lu)\n", __func__, usec);
-   while (tmo > 0) {
-   now = readl(&tmr->timer3_counter);
-   if (now > last) /* count down timer overflow */
-   tmo -= TIMER_LOAD_VAL + last - now;
-   else
-   tmo -= last - now;
-

[U-Boot] [PATCH v2 2/2] arm: a320evb: fixes for relocation support

2010-12-20 Thread Po-Yu Chuang
From: Po-Yu Chuang 

* add CONFIG_SYS_SDRAM_BASE and CONFIG_SYS_INIT_SP_ADDR
* do not update gd->bd in dram_init() because bd is unavailable then
* move CONFIG_SYS_TEXT_BASE from config.mk to a320evb.h
* remove config.mk

Signed-off-by: Po-Yu Chuang 
---
v2:
rebase
remove config.mk

 board/faraday/a320evb/a320evb.c |3 +--
 board/faraday/a320evb/config.mk |   35 ---
 include/configs/a320evb.h   |   14 ++
 3 files changed, 11 insertions(+), 41 deletions(-)
 delete mode 100644 board/faraday/a320evb/config.mk

diff --git a/board/faraday/a320evb/a320evb.c b/board/faraday/a320evb/a320evb.c
index 85b11b9..b9343e4 100644
--- a/board/faraday/a320evb/a320evb.c
+++ b/board/faraday/a320evb/a320evb.c
@@ -46,8 +46,7 @@ int dram_init(void)
 
actual_size = get_ram_size((void *)sdram_base, expected_size);
 
-   gd->bd->bi_dram[0].start = sdram_base;
-   gd->bd->bi_dram[0].size  = actual_size;
+   gd->ram_size = actual_size;
 
if (expected_size != actual_size)
printf("Warning: Only %lu of %lu MiB SDRAM is working\n",
diff --git a/board/faraday/a320evb/config.mk b/board/faraday/a320evb/config.mk
deleted file mode 100644
index b751d0d..000
--- a/board/faraday/a320evb/config.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# (C) Copyright 2009 Faraday Technology
-# Po-Yu Chuang 
-#
-# 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
-#
-
-# Faraday A320 board with FA526/FA626TE/ARM926EJ-S cpus
-#
-# see http://www.faraday-tech.com/ for more information
-
-# A320 has 1 bank of 64 MB DRAM
-#
-# 1000' to 1400'
-#
-# Linux-Kernel is expected to be at 1000'8000, entry 1000'8000
-#
-# we load ourself to 13f8'
-#
-# download area is 1200'
-
-CONFIG_SYS_TEXT_BASE = 0x13f8
diff --git a/include/configs/a320evb.h b/include/configs/a320evb.h
index f67cf06..27f137f 100644
--- a/include/configs/a320evb.h
+++ b/include/configs/a320evb.h
@@ -138,15 +138,21 @@
 #define PHYS_SDRAM_1   0x1000  /* SDRAM Bank #1 */
 #define PHYS_SDRAM_1_SIZE  0x0400  /* 64 MB */
 
+#define CONFIG_SYS_SDRAM_BASE  PHYS_SDRAM_1
+#define CONFIG_SYS_INIT_SP_ADDR(CONFIG_SYS_SDRAM_BASE + 0x1000 
- \
+   GENERATED_GBL_DATA_SIZE)
+
 /*
  * Load address and memory test area should agree with
  * board/faraday/a320/config.mk. Be careful not to overwrite U-boot itself.
  */
-#define CONFIG_SYS_LOAD_ADDR   0x1200
+#define CONFIG_SYS_LOAD_ADDR   (PHYS_SDRAM_1 + 0x200)
 
 /* memtest works on 63 MB in DRAM */
-#define CONFIG_SYS_MEMTEST_START   0x1000
-#define CONFIG_SYS_MEMTEST_END 0x13F0
+#define CONFIG_SYS_MEMTEST_START   PHYS_SDRAM_1
+#define CONFIG_SYS_MEMTEST_END (PHYS_SDRAM_1 + 0x3F0)
+
+#define CONFIG_SYS_TEXT_BASE   0
 
 /*---
  * Static memory controller configuration
@@ -215,7 +221,7 @@
 
 /* environments */
 #define CONFIG_ENV_IS_IN_FLASH
-#define CONFIG_ENV_ADDR0x0006
+#define CONFIG_ENV_ADDR(PHYS_FLASH_1 + 0x6)
 #define CONFIG_ENV_SIZE0x2
 
 #endif /* __CONFIG_H */
-- 
1.6.3.3

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


Re: [U-Boot] [PATCH 1/2] arm: a320 timer: move static data to global_data struct

2010-11-01 Thread Po-Yu Chuang
Dear Reinhard,

On Mon, Nov 1, 2010 at 4:37 PM, Reinhard Meyer  wrote:
> Dear ratbert.chuang,
>> From: Po-Yu Chuang 
>>
>> timer.c used static data and are called before relocation.
>> Move all static variables into global_data structure. Also cleanup
>> timer.c from unused stubs and make it truly use 64 bit tick values.
>>
>> Based on Reinhard Meyer 's patch
>> 5dca710a3d7703e41da0e9894f2d71f9e25bea6b
>>
>> Signed-off-by: Po-Yu Chuang 
>
> Can you hold on with this for a few days?
> Recent discussions about the timer issue have revealed that there are
> potential improvements and mainly udelay() needs a minor fix to
> prevent a potential failure after a few billion years.
>
> I have improvements in mind and will implement them in a few days, and
> would appreciate if not so perfect code would not be copied and spread
> before that ;)

Sure.
I'll wait for your patch and resubmit then. :-)

Best Regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] get_ram_size: memory content of base address was not restored

2010-08-08 Thread Po-Yu Chuang
Dear Wolfgang,

2010/8/8 Wolfgang Denk :
> Dear ratbert.chu...@gmail.com,
> I think this patch is wrong. The value at address (base + 0) is never
> saved, so there is no need to restore it (nor did we store it's value
> anywhere).

The value at base+0 is saved. Please see the following explanation.

long get_ram_size(volatile long *base, long maxsize)
{
volatile long *addr;
long   save[32];
long   cnt;
long   val;
long   size;
inti = 0;

for (cnt = (maxsize / sizeof (long)) >> 1; cnt > 0; cnt >>= 1) {
addr = base + cnt;  /* pointer arith! */
sync ();
save[i++] = *addr;
sync ();
*addr = ~cnt;
}

addr = base;
sync ();
save[i] = *addr;<- value of [base+0] is saved.
sync ();
*addr = 0;  <- [base+0] is modified.

sync ();
if ((val = *addr) != 0) {
/* Restore the original data before leaving the function.
 */
sync ();
*addr = save[i];<- value of [base+0] is 
restored.
for (cnt = 1; cnt < maxsize / sizeof(long); cnt <<= 1) {
addr  = base + cnt;
sync ();
*addr = save[--i];
}
return (0);
}

+   *addr = save[i];<- Therefore we should also restore 
[base+0] here.
for (cnt = 1; cnt < maxsize / sizeof (long); cnt <<= 1) {
addr = base + cnt;  /* pointer arith! */
val = *addr;
*addr = save[--i];
if (val != ~cnt) {
size = cnt * sizeof (long);
/* Restore the original data before leaving the 
function.
 */
for (cnt <<= 1; cnt < maxsize / sizeof (long); cnt <<= 
1) {
addr  = base + cnt;
*addr = save[--i];
}
return (size);
    }
}

return (maxsize);
}

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 2/8] nds32: add cpu support for nds32 arch

2010-08-05 Thread Po-Yu Chuang
Dear Macpaul Lin,

2010/8/5 Macpaul Lin :
> Add cpu support for nds32 arch.
> Included support of common cpu setting, core n1213, SoC ag101.
>
> Signed-off-by: Macpaul Lin 
> ---
>  arch/nds32/config.mk                  |   34 +++
>  arch/nds32/cpu/Makefile               |   52 
>  arch/nds32/cpu/cpu.c                  |  197 +++
>  arch/nds32/cpu/lowlevel_init.S        |  159 
>  arch/nds32/cpu/n1213/Makefile         |   51 
>  arch/nds32/cpu/n1213/ag101/Makefile   |   50 
>  arch/nds32/cpu/n1213/ag101/cpu.c      |  197 +++
>  arch/nds32/cpu/n1213/ag101/ftsmc020.c |   51 
>  arch/nds32/cpu/n1213/ag101/timer.c    |  213 
>  arch/nds32/cpu/n1213/lowlevel_init.S  |  159 
>  arch/nds32/cpu/n1213/start.S          |  447 
> +
>  arch/nds32/cpu/n1213/u-boot.lds       |   68 +
>  arch/nds32/cpu/start.S                |  447 
> +
>  13 files changed, 2125 insertions(+), 0 deletions(-)

arch/nds32/cpu/cpu.c is almost identical to arch/nds32/cpu/n1213/ag101/cpu.c.
arch/nds32/cpu/lowlevel_init.S is identical to
arch/nds32/cpu/n1213/lowlevel_init.S.
arch/nds32/cpu/start.S is identical to arch/nds32/cpu/n1213/start.S.

There must be better way to do them.

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 7/8] nds32: add board adp-ag101 support

2010-08-05 Thread Po-Yu Chuang
                                       FTSDMC020_TP1_REF_INTV(0x180))
> +
> +#define CONFIG_SYS_FTSDMC020_BANK0_BSR (FTSDMC020_BANK_ENABLE   |      \
> +                                        FTSDMC020_BANK_DDW_X16  |      \
> +                                        FTSDMC020_BANK_DSZ_256M |      \
> +                                        FTSDMC020_BANK_MBW_32   |      \
> +                                        FTSDMC020_BANK_SIZE_64M)
> +
> +/*---
> + * Physical Memory Map
> + */
> +#define CONFIG_NR_DRAM_BANKS   1               /* we have 1 bank of DRAM */
> +#define PHYS_SDRAM_0           0x      /* SDRAM Bank #1 */
> +#define PHYS_SDRAM_0_SIZE      0x0400      /* 64 MB */
> +
> +/*
> + * Load address and memory test area should agree with
> + * board/faraday/a320/config.mk. Be careful not to overwrite U-boot itself.
> + */
ditto.

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] fix bug in get_ram_size()

2010-07-05 Thread Po-Yu Chuang
Dear Wolfgang,

2010/6/28  :
> From: Po-Yu Chuang 
>
> memory content of base address was not restored
>
> Signed-off-by: Po-Yu Chuang 
> ---
>  common/memsize.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/common/memsize.c b/common/memsize.c
> index 6c275c9..99469ab 100644
> --- a/common/memsize.c
> +++ b/common/memsize.c
> @@ -74,6 +74,7 @@ long get_ram_size(volatile long *base, long maxsize)
>                return (0);
>        }
>
> +       *addr = save[i];
>        for (cnt = 1; cnt < maxsize / sizeof (long); cnt <<= 1) {
>                addr = base + cnt;      /* pointer arith! */
>                val = *addr;

Did you get this patch?
I think it is quite straightforward.
If you have any concern, please let me know.

regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v7 2/2] arm: A320: Add support for Faraday A320 evaluation board

2009-11-26 Thread Po-Yu Chuang
Dear Tom and Wolfgang,

2009/11/26 Tom :
> Po-Yu Chuang wrote:
>> Dear Wolfgang and Tom,
>>
>> I posted a new version (v8) of this patch two weeks ago to fix a
>> compiler warning.
>>
>> http://lists.denx.de/pipermail/u-boot/2009-November/064105.html
>>
>> Please use the new version (v8) instead.
>>
>
> This looks good.
> I have pushed v8 to arm/next.

Thank you for accepting these patches, but I found that

[v7 of FTRTC010 driver] is pushed into u-boot.git which is:
commit f2cea405f83da46b72098ea874fb3eefe185d312

[v8 of FTRTC010 driver] is also pushed into u-boot-arm.git which is:
commit 713b3b405b50113e37178542ede5d857c2647a25

I guess one of them should be canceled?

p.s. v7 and v8 are basically the same except that there are no spaces
 between function names and parentheses to pass checkpatch.pl.

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v7 2/2] arm: A320: Add support for Faraday A320 evaluation board

2009-11-22 Thread Po-Yu Chuang
Dear Wolfgang and Tom,

2009/11/23 Wolfgang Denk :
> Dear Tom,
> In message <1253692384-3236-1-git-send-email-ratbert.chu...@gmail.com> Po-Yu 
> Chuang wrote:
>> This patch adds support for A320 evaluation board from Faraday. This board
>> uses FA526 processor by default and has 512kB and 32MB NOR flash, 64M RAM.
>> FA526 is an ARMv4 processor and uses the ARM920T source in this patch.
>>
>> Signed-off-by: Po-Yu Chuang 
>
> Can you please check the status of this patch:
> http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/68663

I posted a new version (v8) of this patch two weeks ago to fix a
compiler warning.

http://lists.denx.de/pipermail/u-boot/2009-November/064105.html

Please use the new version (v8) instead.

Thank you.

regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v8 2/2] arm: A320: Add support for Faraday A320 evaluation board

2009-11-11 Thread Po-Yu Chuang
This patch adds support for A320 evaluation board from Faraday. This board
uses FA526 processor by default and has 512kB and 32MB NOR flash, 64M RAM.
FA526 is an ARMv4 processor and uses the ARM920T source in this patch.

Signed-off-by: Po-Yu Chuang 
---
v2:
move flash timing parameters to config header
do not call timer_init() in board_init()
remove interrupt_init() in board specific code
move soc-specific headers to include/asm-arm/arch-faraday/
use write32 in assembly
remove board/faraday/a320/u-boot.lds
move register bases to soc-specific headers

v3:
do not define network parameters in config file

v4:
keep list of MAINTAINERS sorted
cleanup Makefile
use get_ram_size() for auto-sizing and memory testing
formating

v5:
soc: a320, board: a320evb
move ram and flash base to soc-specific header
move reset_cpu to soc-specific code
no bank swap

v6: rebase
v7: rebase
v8:
rebase
fix compiler warning
no space between function name and parenthesis

 MAINTAINERS   |4 +
 MAKEALL   |1 +
 Makefile  |3 +
 board/faraday/a320evb/Makefile|   51 
 board/faraday/a320evb/a320evb.c   |   73 +++
 board/faraday/a320evb/config.mk   |   35 +
 board/faraday/a320evb/lowlevel_init.S |  118 +
 cpu/arm920t/a320/Makefile |   47 +++
 cpu/arm920t/a320/ftsmc020.c   |   51 
 cpu/arm920t/a320/reset.S  |   22 
 cpu/arm920t/a320/timer.c  |  193 
 include/asm-arm/arch-a320/a320.h  |   35 +
 include/asm-arm/arch-a320/ftpmu010.h  |  146 +
 include/asm-arm/arch-a320/ftsdmc020.h |  103 +++
 include/asm-arm/arch-a320/ftsmc020.h  |   79 
 include/asm-arm/arch-a320/fttmr010.h  |   73 +++
 include/configs/a320evb.h |  222 +
 17 files changed, 1256 insertions(+), 0 deletions(-)
 create mode 100644 board/faraday/a320evb/Makefile
 create mode 100644 board/faraday/a320evb/a320evb.c
 create mode 100644 board/faraday/a320evb/config.mk
 create mode 100644 board/faraday/a320evb/lowlevel_init.S
 create mode 100644 cpu/arm920t/a320/Makefile
 create mode 100644 cpu/arm920t/a320/ftsmc020.c
 create mode 100644 cpu/arm920t/a320/reset.S
 create mode 100644 cpu/arm920t/a320/timer.c
 create mode 100644 include/asm-arm/arch-a320/a320.h
 create mode 100644 include/asm-arm/arch-a320/ftpmu010.h
 create mode 100644 include/asm-arm/arch-a320/ftsdmc020.h
 create mode 100644 include/asm-arm/arch-a320/ftsmc020.h
 create mode 100644 include/asm-arm/arch-a320/fttmr010.h
 create mode 100644 include/configs/a320evb.h

diff --git a/MAINTAINERS b/MAINTAINERS
index d70a9d2..4b8d095 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -543,6 +543,10 @@ Rick Bronson 
 
AT91RM9200DKat91rm9200
 
+Po-Yu Chuang 
+
+   a320evb FA526 (ARM920T-like) (a320 SoC)
+
 George G. Davis 
 
assabet SA1100
diff --git a/MAKEALL b/MAKEALL
index d63c5c2..a10aade 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -538,6 +538,7 @@ LIST_ARM7=" \
 #
 
 LIST_ARM9="\
+   a320evb \
ap920t  \
ap922_XA10  \
ap926ejs\
diff --git a/Makefile b/Makefile
index bcb3fe9..7c64553 100644
--- a/Makefile
+++ b/Makefile
@@ -2693,6 +2693,9 @@ shannon_config:   unconfig
 ## ARM92xT Systems
 #
 
+a320evb_config :   unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm920t a320evb faraday a320
+
 #
 ## Atmel AT91RM9200 Systems
 #
diff --git a/board/faraday/a320evb/Makefile b/board/faraday/a320evb/Makefile
new file mode 100644
index 000..74f660d
--- /dev/null
+++ b/board/faraday/a320evb/Makefile
@@ -0,0 +1,51 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Bos

[U-Boot] [PATCH v8 1/2] arm: A320: driver for FTRTC010 real time clock

2009-11-11 Thread Po-Yu Chuang
This patch adds an FTRTC010 driver for Faraday A320 evaluation board.

Signed-off-by: Po-Yu Chuang 
---
v2: use real/writel to access registers
v3: no volatile on register pointer
v4: rebase
v5: rebase
v6: rebase
v7: rebase
v8:
rebase
no space between function name and parenthesis

 drivers/rtc/Makefile   |1 +
 drivers/rtc/ftrtc010.c |  124 
 2 files changed, 125 insertions(+), 0 deletions(-)
 create mode 100644 drivers/rtc/ftrtc010.c

diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index ea7d899..772a49a 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -40,6 +40,7 @@ COBJS-$(CONFIG_RTC_DS1556) += ds1556.o
 COBJS-$(CONFIG_RTC_DS164x) += ds164x.o
 COBJS-$(CONFIG_RTC_DS174x) += ds174x.o
 COBJS-$(CONFIG_RTC_DS3231) += ds3231.o
+COBJS-$(CONFIG_RTC_FTRTC010) += ftrtc010.o
 COBJS-$(CONFIG_RTC_ISL1208) += isl1208.o
 COBJS-$(CONFIG_RTC_M41T11) += m41t11.o
 COBJS-$(CONFIG_RTC_M41T60) += m41t60.o
diff --git a/drivers/rtc/ftrtc010.c b/drivers/rtc/ftrtc010.c
new file mode 100644
index 000..7738a7a
--- /dev/null
+++ b/drivers/rtc/ftrtc010.c
@@ -0,0 +1,124 @@
+/*
+ * Faraday FTRTC010 Real Time Clock
+ *
+ * (C) Copyright 2009 Faraday Technology
+ * Po-Yu Chuang 
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+struct ftrtc010 {
+   unsigned int sec;   /* 0x00 */
+   unsigned int min;   /* 0x04 */
+   unsigned int hour;  /* 0x08 */
+   unsigned int day;   /* 0x0c */
+   unsigned int alarm_sec; /* 0x10 */
+   unsigned int alarm_min; /* 0x14 */
+   unsigned int alarm_hour;/* 0x18 */
+   unsigned int record;/* 0x1c */
+   unsigned int cr;/* 0x20 */
+};
+
+/*
+ * RTC Control Register
+ */
+#define FTRTC010_CR_ENABLE (1 << 0)
+#define FTRTC010_CR_INTERRUPT_SEC  (1 << 1)/* per second irq */
+#define FTRTC010_CR_INTERRUPT_MIN  (1 << 2)/* per minute irq */
+#define FTRTC010_CR_INTERRUPT_HR   (1 << 3)/* per hour   irq */
+#define FTRTC010_CR_INTERRUPT_DAY  (1 << 4)/* per dayirq */
+
+static struct ftrtc010 *rtc = (struct ftrtc010 *)CONFIG_FTRTC010_BASE;
+
+static void ftrtc010_enable(void)
+{
+   writel(FTRTC010_CR_ENABLE, &rtc->cr);
+}
+
+/*
+ * return current time in seconds
+ */
+static unsigned long ftrtc010_time(void)
+{
+   unsigned long day;
+   unsigned long hour;
+   unsigned long minute;
+   unsigned long second;
+   unsigned long second2;
+
+   do {
+   second  = readl(&rtc->sec);
+   day = readl(&rtc->day);
+   hour= readl(&rtc->hour);
+   minute  = readl(&rtc->min);
+   second2 = readl(&rtc->sec);
+   } while (second != second2);
+
+   return day * 24 * 60 * 60 + hour * 60 * 60 + minute * 60 + second;
+}
+
+/*
+ * Get the current time from the RTC
+ */
+
+int rtc_get(struct rtc_time *tmp)
+{
+   unsigned long now;
+
+   debug("%s(): record register: %x\n",
+ __func__, readl(&rtc->record));
+
+   now = ftrtc010_time() + readl(&rtc->record);
+
+   to_tm(now, tmp);
+
+   return 0;
+}
+
+/*
+ * Set the RTC
+ */
+int rtc_set(struct rtc_time *tmp)
+{
+   unsigned long new;
+   unsigned long now;
+
+   debug("%s(): DATE: %4d-%02d-%02d (wday=%d)  TIME: %2d:%02d:%02d\n",
+ __func__,
+ tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
+ tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
+
+   new = mktime(tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_hour,
+tmp->tm_min, tmp->tm_sec);
+
+   now = ftrtc010_time();
+
+   debug("%s(): write %lx to record register\n", __func__, new - now);
+
+   writel(new - now, &rtc->record);
+
+   return 0;
+}
+
+void rtc_reset(void)
+{
+   debug("%s()\n", __func__);
+   ftrtc010_enable();
+}
-- 
1.6.3.3

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


Re: [U-Boot] [help] is there anything wrong with my previously sent A320 patches?

2009-10-04 Thread Po-Yu Chuang
Dear Wolfgang and Tom,

2009/9/23 Po-Yu Chuang :
> Dear Wolfgang Denk,
>
> 2009/9/23 Wolfgang Denk :
>> Dear Po-Yu Chuang,
>> I cannot find these patches in my archive (even though I see the
>> archive entries).
>>
>> Please (rebase and) resend. Sorry for the inconvenience.
>
> Thanks for your reply.
> I have rebased and resubmitted new patches.
>
> [U-Boot] [PATCH v7 1/2] arm: A320: driver for FTRTC010 real time clock
> http://lists.denx.de/pipermail/u-boot/2009-September/061326.html
>
> [U-Boot] [PATCH v7 2/2] arm: A320: Add support for Faraday A320 evaluation 
> board
> http://lists.denx.de/pipermail/u-boot/2009-September/061327.html
>
> Hope you can see them.

Did you receive the the two patches?

Best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] build failure on denx top

2009-09-29 Thread Po-Yu Chuang
Dear Aggrwal Poonam-B10812,

2009/9/30 Aggrwal Poonam-B10812 :
>        Hello All,
>
>        On denx tree  master branch , u-boot build is  failing for 83xx
> and 85xx platforms.
>
>        Build log
>        make[1]: Entering directory
> `/project/p1020_swe_nobackup/usr/poonam/p20x0/denx/latest/mirrors.u-boot
> /u-boot/examples/standalone'
>
> /opt/freescale/usr/local/gcc-4.3.74-eglibc-2.8.74-dp-2/powerpc-none-linu
> x-gnuspe/bin/powerpc-none-linux-gnuspe-gcc -g  -Os   -fPIC -ffixed-r14
> -meabi -D__KERNEL__ -DTEXT_BASE=0xFE00
> -I/project/p1020_swe_nobackup/usr/poonam/p20x0/denx/latest/mirrors.u-boo
> t/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem
> /opt/freescale/usr/local/gcc-4.3.74-eglibc-2.8.74-dp-2/powerpc-none-linu
> x-gnuspe/lib/gcc/powerpc-none-linux-gnuspe/4.3.2/include -pipe
> -DCONFIG_PPC -D__powerpc__ -DCONFIG_MPC83xx -DCONFIG_E300 -ffixed-r2
> -msoft-float -Wall -Wstrict-prototypes -fno-stack-protector -g  -Os
> -fPIC -ffixed-r14 -meabi -D__KERNEL__ -DTEXT_BASE=0xFE00
> -I/project/p1020_swe_nobackup/usr/poonam/p20x0/denx/latest/mirrors.u-boo
> t/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem
> /opt/freescale/usr/local/gcc-4.3.74-eglibc-2.8.74-dp-2/powerpc-none-linu
> x-gnuspe/lib/gcc/powerpc-none-linux-gnuspe/4.3.2/include -pipe
> -DCONFIG_PPC -D__powerpc__ -DCONFIG_MPC83xx -DCONFIG_E300 -ffixed-r2
> -msoft-float -I.. -Bstatic -T u-boot.lds  -n -Ttext 0xFE00     -o .c
>        powerpc-none-linux-gnuspe-gcc: 0xFE00: No such file or
> directory
>        powerpc-none-linux-gnuspe-gcc: no input files
>        make[1]: *** [.c] Error 1
>        make[1]: Leaving directory
> `/project/p1020_swe_nobackup/usr/poonam/p20x0/denx/latest/mirrors.u-boot
> /u-boot/examples/standalone'
>        make: *** [examples/standalone] Error 2
>
>         When I remove the following commit, things work fine.
>
>        From 557555fe0b82940ba7cc69f81d31d6ef4d4933b4 Mon Sep 17
> 00:00:00 2001
>        From: Mike Frysinger  <mailto:vap...@gentoo.org> >
>        Date: Fri, 4 Sep 2009 19:54:45 -0400
>        Subject: [PATCH] standalone: convert to kbuild style
>
>        Clean up the arch/cpu/board/config checks as well as redundant
> setting of
>        srec/bin variables by using the kbuild VAR-$(...) style.
>
>        Signed-off-by: Mike Frysinger 
>        I am facing it for   FSL 83xx and 85xx platforms.
>        Is anybody else also seeing this build failure.

Which version is your make? 3.80 or earlier?

I think make-3.81 can solve your problem.

Best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [help] is there anything wrong with my previously sent A320 patches?

2009-09-23 Thread Po-Yu Chuang
Dear Wolfgang Denk,

2009/9/23 Wolfgang Denk :
> Dear Po-Yu Chuang,
> I cannot find these patches in my archive (even though I see the
> archive entries).
>
> Please (rebase and) resend. Sorry for the inconvenience.

Thanks for your reply.
I have rebased and resubmitted new patches.

[U-Boot] [PATCH v7 1/2] arm: A320: driver for FTRTC010 real time clock
http://lists.denx.de/pipermail/u-boot/2009-September/061326.html

[U-Boot] [PATCH v7 2/2] arm: A320: Add support for Faraday A320 evaluation board
http://lists.denx.de/pipermail/u-boot/2009-September/061327.html

Hope you can see them.

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v7 2/2] arm: A320: Add support for Faraday A320 evaluation board

2009-09-23 Thread Po-Yu Chuang
This patch adds support for A320 evaluation board from Faraday. This board
uses FA526 processor by default and has 512kB and 32MB NOR flash, 64M RAM.
FA526 is an ARMv4 processor and uses the ARM920T source in this patch.

Signed-off-by: Po-Yu Chuang 
---
 MAINTAINERS   |4 +
 MAKEALL   |1 +
 Makefile  |3 +
 board/faraday/a320evb/Makefile|   51 
 board/faraday/a320evb/a320evb.c   |   73 +++
 board/faraday/a320evb/config.mk   |   35 +
 board/faraday/a320evb/lowlevel_init.S |  118 +
 cpu/arm920t/a320/Makefile |   47 +++
 cpu/arm920t/a320/ftsmc020.c   |   51 
 cpu/arm920t/a320/reset.S  |   22 
 cpu/arm920t/a320/timer.c  |  193 
 include/asm-arm/arch-a320/a320.h  |   35 +
 include/asm-arm/arch-a320/ftpmu010.h  |  146 +
 include/asm-arm/arch-a320/ftsdmc020.h |  103 +++
 include/asm-arm/arch-a320/ftsmc020.h  |   79 
 include/asm-arm/arch-a320/fttmr010.h  |   73 +++
 include/configs/a320evb.h |  222 +
 17 files changed, 1256 insertions(+), 0 deletions(-)
 create mode 100644 board/faraday/a320evb/Makefile
 create mode 100644 board/faraday/a320evb/a320evb.c
 create mode 100644 board/faraday/a320evb/config.mk
 create mode 100644 board/faraday/a320evb/lowlevel_init.S
 create mode 100644 cpu/arm920t/a320/Makefile
 create mode 100644 cpu/arm920t/a320/ftsmc020.c
 create mode 100644 cpu/arm920t/a320/reset.S
 create mode 100644 cpu/arm920t/a320/timer.c
 create mode 100644 include/asm-arm/arch-a320/a320.h
 create mode 100644 include/asm-arm/arch-a320/ftpmu010.h
 create mode 100644 include/asm-arm/arch-a320/ftsdmc020.h
 create mode 100644 include/asm-arm/arch-a320/ftsmc020.h
 create mode 100644 include/asm-arm/arch-a320/fttmr010.h
 create mode 100644 include/configs/a320evb.h

diff --git a/MAINTAINERS b/MAINTAINERS
index f42c8f0..73250d6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -537,6 +537,10 @@ Rick Bronson 
 
AT91RM9200DKat91rm9200
 
+Po-Yu Chuang 
+
+   a320evb FA526 (ARM920T-like) (a320 SoC)
+
 George G. Davis 
 
assabet SA1100
diff --git a/MAKEALL b/MAKEALL
index 1d50c34..3dacd85 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -510,6 +510,7 @@ LIST_ARM7=" \
 #
 
 LIST_ARM9="\
+   a320evb \
ap920t  \
ap922_XA10  \
ap926ejs\
diff --git a/Makefile b/Makefile
index 0b61d05..5a73f6d 100644
--- a/Makefile
+++ b/Makefile
@@ -2724,6 +2724,9 @@ shannon_config:   unconfig
 ## ARM92xT Systems
 #
 
+a320evb_config :   unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm920t a320evb faraday a320
+
 #
 ## Atmel AT91RM9200 Systems
 #
diff --git a/board/faraday/a320evb/Makefile b/board/faraday/a320evb/Makefile
new file mode 100644
index 000..74f660d
--- /dev/null
+++ b/board/faraday/a320evb/Makefile
@@ -0,0 +1,51 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).a
+
+COBJS  := a320evb.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
+
+

[U-Boot] [PATCH v7 1/2] arm: A320: driver for FTRTC010 real time clock

2009-09-23 Thread Po-Yu Chuang
This patch adds an FTRTC010 driver for Faraday A320 evaluation board.

Signed-off-by: Po-Yu Chuang 
---
 drivers/rtc/Makefile   |1 +
 drivers/rtc/ftrtc010.c |  124 
 2 files changed, 125 insertions(+), 0 deletions(-)
 create mode 100644 drivers/rtc/ftrtc010.c

diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index ea7d899..772a49a 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -40,6 +40,7 @@ COBJS-$(CONFIG_RTC_DS1556) += ds1556.o
 COBJS-$(CONFIG_RTC_DS164x) += ds164x.o
 COBJS-$(CONFIG_RTC_DS174x) += ds174x.o
 COBJS-$(CONFIG_RTC_DS3231) += ds3231.o
+COBJS-$(CONFIG_RTC_FTRTC010) += ftrtc010.o
 COBJS-$(CONFIG_RTC_ISL1208) += isl1208.o
 COBJS-$(CONFIG_RTC_M41T11) += m41t11.o
 COBJS-$(CONFIG_RTC_M41T60) += m41t60.o
diff --git a/drivers/rtc/ftrtc010.c b/drivers/rtc/ftrtc010.c
new file mode 100644
index 000..c3c0bc2
--- /dev/null
+++ b/drivers/rtc/ftrtc010.c
@@ -0,0 +1,124 @@
+/*
+ * Faraday FTRTC010 Real Time Clock
+ *
+ * (C) Copyright 2009 Faraday Technology
+ * Po-Yu Chuang 
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+struct ftrtc010 {
+   unsigned int sec;   /* 0x00 */
+   unsigned int min;   /* 0x04 */
+   unsigned int hour;  /* 0x08 */
+   unsigned int day;   /* 0x0c */
+   unsigned int alarm_sec; /* 0x10 */
+   unsigned int alarm_min; /* 0x14 */
+   unsigned int alarm_hour;/* 0x18 */
+   unsigned int record;/* 0x1c */
+   unsigned int cr;/* 0x20 */
+};
+
+/*
+ * RTC Control Register
+ */
+#define FTRTC010_CR_ENABLE (1 << 0)
+#define FTRTC010_CR_INTERRUPT_SEC  (1 << 1)/* per second irq */
+#define FTRTC010_CR_INTERRUPT_MIN  (1 << 2)/* per minute irq */
+#define FTRTC010_CR_INTERRUPT_HR   (1 << 3)/* per hour   irq */
+#define FTRTC010_CR_INTERRUPT_DAY  (1 << 4)/* per dayirq */
+
+static struct ftrtc010 *rtc = (struct ftrtc010 *)CONFIG_FTRTC010_BASE;
+
+static void ftrtc010_enable (void)
+{
+   writel (FTRTC010_CR_ENABLE, &rtc->cr);
+}
+
+/*
+ * return current time in seconds
+ */
+static unsigned long ftrtc010_time (void)
+{
+   unsigned long day;
+   unsigned long hour;
+   unsigned long minute;
+   unsigned long second;
+   unsigned long second2;
+
+   do {
+   second  = readl (&rtc->sec);
+   day = readl (&rtc->day);
+   hour= readl (&rtc->hour);
+   minute  = readl (&rtc->min);
+   second2 = readl (&rtc->sec);
+   } while (second != second2);
+
+   return day * 24 * 60 * 60 + hour * 60 * 60 + minute * 60 + second;
+}
+
+/*
+ * Get the current time from the RTC
+ */
+
+int rtc_get (struct rtc_time *tmp)
+{
+   unsigned long now;
+
+   debug ("%s(): record register: %x\n",
+  __func__, readl (&rtc->record));
+
+   now = ftrtc010_time () + readl (&rtc->record);
+
+   to_tm (now, tmp);
+
+   return 0;
+}
+
+/*
+ * Set the RTC
+ */
+int rtc_set (struct rtc_time *tmp)
+{
+   unsigned long new;
+   unsigned long now;
+
+   debug ("%s(): DATE: %4d-%02d-%02d (wday=%d)  TIME: %2d:%02d:%02d\n",
+  __func__,
+  tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
+  tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
+
+   new = mktime (tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_hour,
+ tmp->tm_min, tmp->tm_sec);
+
+   now = ftrtc010_time ();
+
+   debug ("%s(): write %lx to record register\n", __func__, new - now);
+
+   writel (new - now, &rtc->record);
+
+   return 0;
+}
+
+void rtc_reset (void)
+{
+   debug ("%s()\n", __func__);
+   ftrtc010_enable ();
+}
-- 
1.6.3.3

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


[U-Boot] [help] is there anything wrong with my previously sent A320 patches?

2009-09-13 Thread Po-Yu Chuang
Dear Jean-Christophe PLAGNIOL-VILLARD and Wolfgang Denk,

I sent the following patches two weeks ago and got no reply.
Maybe you did not receive the mails?
I wonder if there was something wrong with my mail server or if I
messed up something.

[U-Boot] [PATCH v6 1/2 resend] arm: A320: driver for FTRTC010 real time clock
http://lists.denx.de/pipermail/u-boot/2009-September/059753.html

[U-Boot] [PATCH v6 2/2 resend] arm: A320: Add support for Faraday A320
evaluation board
http://lists.denx.de/pipermail/u-boot/2009-September/059755.html

Please let me know if there is anything wrong.
Thank you.

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v6 2/2 resend] arm: A320: Add support for Faraday A320 evaluation board

2009-09-10 Thread Po-Yu Chuang
Hello,

2009/9/2  :
> From: Po-Yu Chuang 
>
> This patch adds support for A320 evaluation board from Faraday. This board
> uses FA526 processor by default and has 512kB and 32MB NOR flash, 64M RAM.
> FA526 is an ARMv4 processor and uses the ARM920T source in this patch.
>
> Signed-off-by: Po-Yu Chuang 
> ---
>  MAINTAINERS                           |    4 +
>  MAKEALL                               |    1 +
>  Makefile                              |    3 +
>  board/faraday/a320evb/Makefile        |   51 
>  board/faraday/a320evb/a320evb.c       |   73 +++
>  board/faraday/a320evb/config.mk       |   35 +
>  board/faraday/a320evb/lowlevel_init.S |  118 +
>  cpu/arm920t/a320/Makefile             |   47 +++
>  cpu/arm920t/a320/ftsmc020.c           |   51 
>  cpu/arm920t/a320/reset.S              |   22 
>  cpu/arm920t/a320/timer.c              |  193 
>  include/asm-arm/arch-a320/a320.h      |   35 +
>  include/asm-arm/arch-a320/ftpmu010.h  |  190 
>  include/asm-arm/arch-a320/ftsdmc020.h |  103 +++
>  include/asm-arm/arch-a320/ftsmc020.h  |   79 
>  include/asm-arm/arch-a320/fttmr010.h  |   73 +++
>  include/configs/a320evb.h             |  222 
> +
>  17 files changed, 1300 insertions(+), 0 deletions(-)
>  create mode 100644 board/faraday/a320evb/Makefile
>  create mode 100644 board/faraday/a320evb/a320evb.c
>  create mode 100644 board/faraday/a320evb/config.mk
>  create mode 100644 board/faraday/a320evb/lowlevel_init.S
>  create mode 100644 cpu/arm920t/a320/Makefile
>  create mode 100644 cpu/arm920t/a320/ftsmc020.c
>  create mode 100644 cpu/arm920t/a320/reset.S
>  create mode 100644 cpu/arm920t/a320/timer.c
>  create mode 100644 include/asm-arm/arch-a320/a320.h
>  create mode 100644 include/asm-arm/arch-a320/ftpmu010.h
>  create mode 100644 include/asm-arm/arch-a320/ftsdmc020.h
>  create mode 100644 include/asm-arm/arch-a320/ftsmc020.h
>  create mode 100644 include/asm-arm/arch-a320/fttmr010.h
>  create mode 100644 include/configs/a320evb.h

Is there any comment about these patches?

The patches was resent 9 days ago and there is not any response.
I wonder if there was something wrong on my mail server.
Please tell me if these patches are lost. Thank you.

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v6 1/2 resend] arm: A320: driver for FTRTC010 real time clock

2009-09-02 Thread Po-Yu Chuang
Dear Jean-Christophe PLAGNIOL-VILLARD,

2009/9/2  :
> From: Po-Yu Chuang 
> This patch adds an FTRTC010 driver for Faraday A320 evaluation board.
> Signed-off-by: Po-Yu Chuang 

Do you receive the patches resent yesterday?

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v6 2/2] arm: A320: Add support for Faraday A320 evaluation board

2009-08-31 Thread Po-Yu Chuang
Dear Jean-Christophe PLAGNIOL-VILLARD,

2009/8/20 Po-Yu Chuang :
> Dear Jean-Christophe PLAGNIOL-VILLARD,
>> From: Po-Yu Chuang 
>>
>> This patch adds support for A320 evaluation board from Faraday. This board
>> uses FA526 processor by default and has 512kB and 32MB NOR flash, 64M RAM.
>> FA526 is an ARMv4 processor and uses the ARM920T source in this patch.
>>
>> Signed-off-by: Po-Yu Chuang 
> I failed to CC you again, but the patches appear in the mailing list.
> Hope you can see them.
>
> The command I used is like below.
> Is there anything wrong?
>
> git send-email \
> --from=ratbert.chu...@gmail.com \
> --to=u-b...@lists.denx.de \
> --cc=plagn...@jcrosoft.com \
> --cc...@denx.de \
> --cc=augulis.dar...@gmail.com \
> 0002-arm-A320-Add-support-for-Faraday-A320-evaluation-boa.patch

Did you get the patches?
or I need to resend again?

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v6 2/2] arm: A320: Add support for Faraday A320 evaluation board

2009-08-19 Thread Po-Yu Chuang
Dear Jean-Christophe PLAGNIOL-VILLARD,

2009/8/20  :
> From: Po-Yu Chuang 
>
> This patch adds support for A320 evaluation board from Faraday. This board
> uses FA526 processor by default and has 512kB and 32MB NOR flash, 64M RAM.
> FA526 is an ARMv4 processor and uses the ARM920T source in this patch.
>
> Signed-off-by: Po-Yu Chuang 
> ---
>  MAINTAINERS                           |    4 +
>  MAKEALL                               |    1 +
>  Makefile                              |    3 +
>  board/faraday/a320evb/Makefile        |   51 
>  board/faraday/a320evb/a320evb.c       |   73 +++
>  board/faraday/a320evb/config.mk       |   35 +
>  board/faraday/a320evb/lowlevel_init.S |  118 +
>  cpu/arm920t/a320/Makefile             |   47 +++
>  cpu/arm920t/a320/ftsmc020.c           |   51 
>  cpu/arm920t/a320/reset.S              |   22 
>  cpu/arm920t/a320/timer.c              |  193 
>  include/asm-arm/arch-a320/a320.h      |   35 +
>  include/asm-arm/arch-a320/ftpmu010.h  |  190 
>  include/asm-arm/arch-a320/ftsdmc020.h |  103 +++
>  include/asm-arm/arch-a320/ftsmc020.h  |   79 
>  include/asm-arm/arch-a320/fttmr010.h  |   73 +++
>  include/configs/a320evb.h             |  222 
> +
>  17 files changed, 1300 insertions(+), 0 deletions(-)
>  create mode 100644 board/faraday/a320evb/Makefile
>  create mode 100644 board/faraday/a320evb/a320evb.c
>  create mode 100644 board/faraday/a320evb/config.mk
>  create mode 100644 board/faraday/a320evb/lowlevel_init.S
>  create mode 100644 cpu/arm920t/a320/Makefile
>  create mode 100644 cpu/arm920t/a320/ftsmc020.c
>  create mode 100644 cpu/arm920t/a320/reset.S
>  create mode 100644 cpu/arm920t/a320/timer.c
>  create mode 100644 include/asm-arm/arch-a320/a320.h
>  create mode 100644 include/asm-arm/arch-a320/ftpmu010.h
>  create mode 100644 include/asm-arm/arch-a320/ftsdmc020.h
>  create mode 100644 include/asm-arm/arch-a320/ftsmc020.h
>  create mode 100644 include/asm-arm/arch-a320/fttmr010.h
>  create mode 100644 include/configs/a320evb.h

I failed to CC you again, but the patches appear in the mailing list.
Hope you can see them.

The command I used is like below.
Is there anything wrong?

git send-email \
--from=ratbert.chu...@gmail.com \
--to=u-b...@lists.denx.de \
--cc=plagn...@jcrosoft.com \
--cc...@denx.de \
--cc=augulis.dar...@gmail.com \
0002-arm-A320-Add-support-for-Faraday-A320-evaluation-boa.patch

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3 v4] arm: A320: Add support for Faraday A320 evaluation board

2009-08-19 Thread Po-Yu Chuang
Dear Jean-Christophe PLAGNIOL-VILLARD,

2009/8/20 Jean-Christophe PLAGNIOL-VILLARD :
> On 09:38 Tue 18 Aug     , Po-Yu Chuang wrote:
>> I have submitted a v5 patch. Please check.
> where?
> I do not seen it

http://lists.denx.de/pipermail/u-boot/2009-August/058315.html

It looks like I did not CC well. If needed, I can resubmit again

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3 v4] arm: A320: Add support for Faraday A320 evaluation board

2009-08-17 Thread Po-Yu Chuang
Dear Jean-Christophe PLAGNIOL-VILLARD,

2009/8/18 Jean-Christophe PLAGNIOL-VILLARD :
> On 14:13 Thu 06 Aug     , Po-Yu Chuang wrote:
>> Anyway, I have an idea now.
>> I can submit a version that do not do the bank swap
>> (SDRAM stays at 0x1000).
>>
>> The the mainline keeps beautiful as you wish.
>> Then I create another patch to do the bank swap for our internal use.
>>
>> This should be a win-win. :-)
> why not but show us the code please
> and we will see

I have submitted a v5 patch. Please check.

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3 v4] arm: A320: Add support for Faraday A320 evaluation board

2009-08-05 Thread Po-Yu Chuang
Dear Jean-Christophe,

2009/7/8 Jean-Christophe PLAGNIOL-VILLARD :
>> +.globl lowlevel_init
>> +lowlevel_init:
>> +     mov     r11, lr
>> +
>> +     led     0x0
>> +
>> +     /* if REMAP bit is set -> memory had been initialzed */
>> +
>> +     ldr     r0, =CONFIG_SYS_AHBC_BASE
>> +     ldr     r1, [r0, #FTAHBC020_OFFSET_ICR]
>> +     tst     r1, #FTAHBC020_ICR_REMAP                @ test REMAP bit
>> +     bne     skip_remap
>> +
>> +     led     0x1
>> +
>> +     bl      init_sdmc
>> +
>> +     led     0x2
>> +
>> +     /*
>> +      * copy U-Boot to RAM
>> +      */
>> +copy_code:
>> +     ldr     r0, =ROM_DEFAULT_BASE   /* r0 <- source address     */
>> +     ldr     r1, =SDRAM_DEFAULT_BASE /* r1 <- target address     */
>> +
>> +     ldr     r2, .LC5
>> +     ldr     r3, .LC6
>> +     sub     r2, r3, r2              /* r2 <- size of armboot            */
>> +     add     r2, r0, r2              /* r2 <- source end address         */
>> +
>> +     led     0x3
>> +
>> +copy_loop:
>> +     ldmia   r0!, {r3-r10}           /* copy from source address [r0]    */
>> +     stmia   r1!, {r3-r10}           /* copy to   target address [r1]    */
>> +     cmp     r0, r2                  /* until source end addreee [r2]    */
>> +     ble     copy_loop
>> +
> I do not like to do this twice we need to find an otherway
> do we really need to run in SDRAM before remap?

I am afraid so.
u-boot needs to be copied to SDRAM first to do the remap
(swap ROM and SDRAM bank) to make SDRAM base becomes 0x0.
cpu/arm920t/start.S then relocates u-boot to the end of SDRAM.

Anyway, I have an idea now.
I can submit a version that do not do the bank swap
(SDRAM stays at 0x1000).

The the mainline keeps beautiful as you wish.
Then I create another patch to do the bank swap for our internal use.

This should be a win-win. :-)


best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3 v4] arm: A320: Add support for Faraday A320 evaluation board

2009-08-05 Thread Po-Yu Chuang
Dear Jean-Christophe and Darius,

2009/8/5 Darius Augulis :
> On 08/04/2009 10:48 PM, Jean-Christophe PLAGNIOL-VILLARD wrote:
>>>> as I understand correctly the faraday and the CS3518 share the same core
>>>> and
>>>> IP so it will be better to have the same dir
>>>
>>> I don't think so. Both A320 and Gemini share the same FA526 core,
>>> but different peripheral. There is no reason to create generic dir
>>> for A320 and Gemini. Also, no reason to create cpu/fa526 because
>>> fa526 is almost arm920t.

Let me summarize. Correct me if I am wrong.

a320 is an soc with fa526 core which is similar to arm920t.
Gemini is an soc with fa526 core.

board  | A320 evb | NAS4220 |
soc family |  | Gemini  |
soc| A320 | CS3516  |
cpu| FA526| FA526   |

CS3516 and A320 maybe have the same timer (but most IPs are different).

>> duplicate code is worse
>> as example on at91 we do support multiple soc of the family in the same
>> generic dir which allow us to factorize common code and ofcourse split
>> soc specific code too

What is the definition of an SOC family?

> Gemini and A320 are not from the same family. There isn't any common code
> *yet*. They share only the same core.
> There are more dirs in cpu/arm920t: "imx", "s3c24x0", etc. Perhaps you won't
> suggest to move all these SoC's into single dir?

Agree. Gemini and A320 are not the same family IMO.
The only common parts are the FA526 core and the timer.
(or is this sufficient to be a family?)

The problem is how should the files be organized if two SOC families
use the same IP.
Maybe we can create a cpu/arm920t/common/ ?
But what if that IP is used in another SOC with arm926 core? (This
happens in Faraday's other SOCs)

I think the easiest way is to treat A320 and Gemini patches unrelated.

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] A320: driver for FTMAC100 ethernet controller

2009-08-05 Thread Po-Yu Chuang
Dear Ben and Wolfgang,

2009/8/6 Ben Warren :
> Wolfgang Denk wrote:
>> In message 
>> Po-Yu Chuang wrote:
>>> This patch adds an FTMAC100 ethernet driver for Faraday A320 evaluation
>>> board.
>>>
>>> Signed-off-by: Po-Yu Chuang 
>> Ping??
> This was the last communication:
>
> http://article.gmane.org/gmane.comp.boot-loaders.u-boot/63482
> <http://article.gmane.org/gmane.comp.boot-loaders.u-boot/63482/match=ftmac100>
>
> No follow-on was posted.

Sorry for my slow progress. I am doing other projects recently.

Because FTMAC100 is part of A320 BSP, I have to finish the review
comments about A320 source.
I will make a new patch of FTMAC100 together with A320 BSP later.

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [help] u-boot mailing list seems to block my git send-email

2009-07-13 Thread Po-Yu Chuang
Dear Simon Kagstrom,

2009/7/13 Simon Kagstrom :
>> Both mails are not appeared in the mailing list, but Stefan received
>> (1) and I received (1) and (2).
>> It looks like u-boot mailing list blocks my mails.
>> Any ideas?
> They appear in the mailing list as well, see here:
>  http://lists.denx.de/pipermail/u-boot/2009-July/thread.html

I did not see them several hours ago -- (maybe something weird with my proxy?).
Now I see.
Thank you.

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [help] u-boot mailing list seems to block my git send-email

2009-07-13 Thread Po-Yu Chuang
Dear all,

I  sent two patches last week by git send-email:
(1) [PATCH] [U-Boot] [PATCH v2] issue write command to base for JEDEC flash
to u-boot@lists.denx.de cc: Stefan Roese  and

(2) [U-Boot] [PATCH] ignore tags
to u-boot@lists.denx.de cc: 

Both mails are not appeared in the mailing list, but Stefan received
(1) and I received (1) and (2).
It looks like u-boot mailing list blocks my mails.
Any ideas?

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 3/3] A320: Add support for Faraday A320 evaluation board

2009-07-09 Thread Po-Yu Chuang
Dear Wolfgang Denk,

2009/7/9 Wolfgang Denk :
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -680,6 +680,10 @@ Sergey Lapin 
>>
>>       afeb9260        ARM926EJS (AT91SAM9260 SoC)
>>
>> +Po-Yu Chuang 
>> +
>> +     a320            FA526 (ARMv4/reuse arm920t source) faraday SoC
>
> Please keep list of maintainers alphabetically sorted.

What is the key for sorting? I cannot figure it out.

>> --- a/Makefile
>> +++ b/Makefile
>> @@ -2991,6 +2991,13 @@ B2_config      :       unconfig
>>       @$(MKCONFIG) $(@:_config=) arm s3c44b0 B2 dave
>>
>>  #
>> +## Faraday A320 Systems
>> +#
>
> We don't add such big headers for all vendors.

OK, removed.

>> +a320_config  :       unconfig
>> +     @$(MKCONFIG) $(@:_config=) arm arm920t a320 faraday faraday
>
> This is a arm920t processor, so please add it in "ARM720T Systems"
> section.
>
>> +#
>>  ## ARM720T Systems
>>  #

720t?
How about integrator section? Many 920t boards are there.


## ARM Integrator boards - see doc/README-integrator for more info.

>> diff --git a/board/faraday/a320/a320.c b/board/faraday/a320/a320.c
>> new file mode 100644
>> index 000..f9cca4f
>> --- /dev/null
>> +++ b/board/faraday/a320/a320.c
...
>> +int dram_init (void)
>> +{
>> +     gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
>> +     gd->bd->bi_dram[0].size  = PHYS_SDRAM_1_SIZE;
>> +
>> +     return 0;
>> +}
>
> Would it be possible to use get_ram_size() for auto-sizing and memory
> testing?

OK, I'll try.

>> diff --git a/board/faraday/a320/lowlevel_init.S
>> b/board/faraday/a320/lowlevel_init.S
>> new file mode 100644
>> index 000..2adb9ef
>> --- /dev/null
>> +++ b/board/faraday/a320/lowlevel_init.S
...
>> +copy_code:
>> +     ldr     r0, =ROM_DEFAULT_BASE   /* r0 <- source address     */
>> +     ldr     r1, =SDRAM_DEFAULT_BASE /* r1 <- target address     */
>> +
>> +     ldr     r2, .LC5
>> +     ldr     r3, .LC6
>> +     sub     r2, r3, r2              /* r2 <- size of armboot            */
>
> Please use TABs for vertical alignment.
>

Spaces removed.

>> diff --git a/cpu/arm920t/faraday/timer.c b/cpu/arm920t/faraday/timer.c
>> new file mode 100644
>> index 000..7762012
>> --- /dev/null
>> +++ b/cpu/arm920t/faraday/timer.c
...
>> +#undef DEBUG
>
> Please do not add dead code.
>
removed

...
>> +static volatile struct fttmr010 *tmr = (struct fttmr010 
>> *)CONFIG_SYS_TIMERBASE;
>> +static volatile struct ftpmu010 *pmu = (struct ftpmu010
>> *)CONFIG_SYS_FTPMU_BASE;
>
> Bad formatting here?

I will use git send-email next time to avoid this. Thanks.

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCHv2 1/3] A320: driver for FTMAC100 ethernet controller

2009-07-08 Thread Po-Yu Chuang
Dear Jean-Christophe,

2009/7/8 Jean-Christophe PLAGNIOL-VILLARD :
> On 19:12 Wed 01 Jul     , Po-Yu Chuang wrote:
>> This patch adds an FTMAC100 ethernet driver for Faraday A320 evaluation 
>> board.
> it's seem good for me
> but I'll add it after the core soc

Thank you for your detailed review.
I will resubmit this patch with new soc patch.

>> diff --git a/drivers/net/Makefile b/drivers/net/Makefile
>> index c6097c3..8edf529 100644
>> --- a/drivers/net/Makefile
>> +++ b/drivers/net/Makefile
>> @@ -38,6 +38,7 @@ COBJS-$(CONFIG_E1000) += e1000.o
>>  COBJS-$(CONFIG_EEPRO100) += eepro100.o
>>  COBJS-$(CONFIG_ENC28J60) += enc28j60.o
>>  COBJS-$(CONFIG_FSLDMAFEC) += fsl_mcdmafec.o mcfmii.o
>> +COBJS-$(CONFIG_DRIVER_FTMAC100) += ftmac100.o
> please remove the DRIVER_

OK, but some recent patches use DRIVER_  naming.

CONFIG_DRIVER_TI_EMAC
CONFIG_DRIVER_AX88180

Is it not the preferred style?

>>  COBJS-$(CONFIG_GRETH) += greth.o
>>  COBJS-$(CONFIG_INCA_IP_SWITCH) += inca-ip_sw.o
>>  COBJS-$(CONFIG_KIRKWOOD_EGIGA) += kirkwood_egiga.o
>> diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
>> new file mode 100644
>> index 000..3057822
>> --- /dev/null
>> +++ b/drivers/net/ftmac100.c
>> +static void ftmac100_reset (struct eth_device *dev)
>> +{
>> +     volatile struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
> do you really need to have all the struct volatile?

I had submitted a v3 of this driver which removed unnecessary volatiles
according to the warnings told by checkpatch.pl.

http://lists.denx.de/pipermail/u-boot/2009-July/055421.html

Please ignore it, since I need to resubmit a new patch later.

>> +
>> +     debug ("%s()\n", __func__);
>> +
>> +     writel (FTMAC100_MACCR_SW_RST, &ftmac100->maccr);
>> +
>> +     while (readl (&ftmac100->maccr) & FTMAC100_MACCR_SW_RST) ;
>> +}
>> +
>> +/*
>> + * Set MAC address
>> + */
>
>> +int ftmac100_initialize (bd_t * bd)
>> +{
>> +     struct eth_device *dev;
>> +     struct ftmac100_data *priv;
>> +
>> +     if (!(dev = malloc (sizeof *dev))) {
> use calloc instead

Is it preferred way?
No driver in driver/net/ uses calloc.

>> +             printf ("%s(): failed to allocate dev\n", __func__);
>> +             goto out;
>> +     }
>> +
>> +     /* Transmit and receive descriptors should align to 16 bytes */
>> +
>> +     if (!(priv = memalign (16, sizeof (struct ftmac100_data {
>> +             printf ("%s(): failed to allocate priv\n", __func__);
>> +             goto free_dev;
>> +     }
>> +
>> +     memset (dev, 0, sizeof (*dev));
>> +     memset (priv, 0, sizeof (*priv));
>> +
>> +     sprintf (dev->name, "FTMAC100");
>> +     dev->iobase = CONFIG_SYS_MAC100_BASE;
>> +     dev->init   = ftmac100_init;
> please use tab for indent

ok, fixed.

>> +     dev->halt   = ftmac100_halt;
>> +     dev->send   = ftmac100_send;
>> +     dev->recv   = ftmac100_recv;
>> +     dev->priv   = priv;

best regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] for JEDEC flash, command of word programing should be issued relatvie to base

2009-07-08 Thread Po-Yu Chuang
Dear Stefan Roese,

2009/7/8 Stefan Roese :
> This patch is line wrapped and can't be applied. Please fix and resubmit. And
> while at it please use a somewhat shorted subject.

Sorry, I don't understand what does "line wrapped" mean.
The source is 80 chars width max.
or... Did I send the mail in dos format?

regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] for JEDEC flash, command of word programing should be issued relatvie to base

2009-07-06 Thread Po-Yu Chuang
For JEDEC flash, we should issue word programming command relative to
base address rather than sector base address. Original source makes
SST Flash fails to program sectors which are not on the 0x1 boundaries.

e.g.
SST39LF040 uses addr1=0x and addr2=0x2AAA, however, each sector
is 0x1000 bytes.

Thus, if we issue command to "sector base (0x41000) + offset(0x)",
it sends to 0x46555 and the chip fails to recognize that address.

This patch is tested with SST39LF040.

Signed-off-by: Po-Yu Chuang 
---
 drivers/mtd/cfi_flash.c |   11 ---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index d0732f5..81ac5d3 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -835,14 +835,19 @@ static int flash_write_cfiword (flash_info_t *
info, ulong dest,
break;
case CFI_CMDSET_AMD_EXTENDED:
case CFI_CMDSET_AMD_STANDARD:
-#ifdef CONFIG_FLASH_CFI_LEGACY
-   case CFI_CMDSET_AMD_LEGACY:
-#endif
sect = find_sector(info, dest);
flash_unlock_seq (info, sect);
flash_write_cmd (info, sect, info->addr_unlock1, AMD_CMD_WRITE);
sect_found = 1;
break;
+#ifdef CONFIG_FLASH_CFI_LEGACY
+   case CFI_CMDSET_AMD_LEGACY:
+   sect = find_sector(info, dest);
+   flash_unlock_seq (info, 0);
+   flash_write_cmd (info, 0, info->addr_unlock1, AMD_CMD_WRITE);
+   sect_found = 1;
+   break;
+#endif
}

switch (info->portwidth) {
-- 
1.6.3.3
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [U-BOOT] cfi_flash.c fails to program NOR Flash SST39LF040

2009-07-03 Thread Po-Yu Chuang
Dear Stefan Roese,

2009/7/3 Stefan Roese :
> Yes, I understand your problem and it needs to get fixed. But your original
> patch changed the unlock address not only for this "legacy" FLASH type but for
> all AMD type FLASH chips. And I'm not sure if this is correct. Meaning if the
> AMD/Spansion chips will accept these unlock addresses.
>
> Perhaps you could check some data-sheets (some older and more recent Spansion
> CFI chips) which unlock addresses should be used here.

After checked the data sheets of jedec flash currently supported in u-boot -

SST 39LF020
AMD AM29LV040B
SST 39LF040
ST Micro M29W040B
AMD AM29LV400BB
AMD AM29LV800BB

I found that the addresses to program a word of these chips are
related to 0 (not sector base).

And in flash_erase() in drivers/mtd/cfi_flash.c

case CFI_CMDSET_AMD_STANDARD:
case CFI_CMDSET_AMD_EXTENDED:
flash_unlock_seq (info, sect);
flash_write_cmd (info, sect,
info->addr_unlock1,
AMD_CMD_ERASE_START);
flash_unlock_seq (info, sect);
flash_write_cmd (info, sect, 0,
 AMD_CMD_ERASE_SECTOR);
break;
#ifdef CONFIG_FLASH_CFI_LEGACY
case CFI_CMDSET_AMD_LEGACY:
flash_unlock_seq (info, 0);
flash_write_cmd (info, 0, info->addr_unlock1,
AMD_CMD_ERASE_START);
flash_unlock_seq (info, 0);
flash_write_cmd (info, sect, 0,
AMD_CMD_ERASE_SECTOR);
break;
#endif

It look like CFI_CMDSET_AMD_LEGACY use base 0
CFI_CMDSET_AMD_STANDARD and CFI_CMDSET_AMD_EXTENDED use sector base
for erase.

It probably is the same case while programing a word.

The following patch might be feasible.
However, I don't have those chips for testing.

regards,
Po-Yu Chuang

---
 drivers/mtd/cfi_flash.c |   11 ---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index d0732f5..81ac5d3 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -835,14 +835,19 @@ static int flash_write_cfiword (flash_info_t *
info, ulong dest,
break;
case CFI_CMDSET_AMD_EXTENDED:
case CFI_CMDSET_AMD_STANDARD:
-#ifdef CONFIG_FLASH_CFI_LEGACY
-   case CFI_CMDSET_AMD_LEGACY:
-#endif
sect = find_sector(info, dest);
flash_unlock_seq (info, sect);
flash_write_cmd (info, sect, info->addr_unlock1, AMD_CMD_WRITE);
sect_found = 1;
break;
+#ifdef CONFIG_FLASH_CFI_LEGACY
+   case CFI_CMDSET_AMD_LEGACY:
+   sect = find_sector(info, dest);
+   flash_unlock_seq (info, 0);
+   flash_write_cmd (info, 0, info->addr_unlock1, AMD_CMD_WRITE);
+   sect_found = 1;
+   break;
+#endif
}

switch (info->portwidth) {
-- 
1.6.3.3
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [U-BOOT] cfi_flash.c fails to program NOR Flash SST39LF040

2009-07-03 Thread Po-Yu Chuang
Dear Stefan Roese,

2009/4/28 Po-Yu Chuang :
> Dear Stefan Roese,
>> Did you define CONFIG_FLASH_CFI_LEGACY (and CONFIG_SYS_FLASH_LEGACY_512Kx8)?
>> IIRC then the SST FLASH chips are not completely CFI compatible. So you need
>> to enable the JEDEC framework.
>
> Yes, I have defined the fallowing macros:
>
> #define CONFIG_SYS_FLASH_CFI
> #define CONFIG_FLASH_CFI_DRIVER
> #define CONFIG_FLASH_CFI_LEGACY
> #define CONFIG_SYS_FLASH_LEGACY_512Kx8
>
> SST39LF040 use addr1=0x and addr2=0x2AAA, however, each sector is
> 0x1000 bytes.
>
> Thus, if we issue command to "sector base (0x41000) + offset(0x)",
> it sends to 0x46555 and the chip fails to recognize that address.
>
> I guess that SST39LF020 might suffer the same problem.

How do you think about this?
I can submit a patch for it.

regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3 v4] arm: A320: Add support for Faraday A320 evaluation board

2009-07-03 Thread Po-Yu Chuang
This patch adds support for A320 development board from Faraday. This board
uses FA526 processor by default and has 512kB and 32MB NOR flash, 64M RAM.
FA526 is an ARMv4 processor and uses the ARM920T source in this patch.

Signed-off-by: Po-Yu Chuang 
---
 MAINTAINERS  |4 +
 MAKEALL  |1 +
 Makefile |7 +
 board/faraday/a320/Makefile  |   51 +++
 board/faraday/a320/a320.c|   64 
 board/faraday/a320/config.mk |   35 +
 board/faraday/a320/lowlevel_init.S   |  191 
 cpu/arm920t/faraday/Makefile |   46 ++
 cpu/arm920t/faraday/ftsmc020.c   |   51 +++
 cpu/arm920t/faraday/timer.c  |  195 +
 include/asm-arm/arch-faraday/ftahbc020.h |   71 +
 include/asm-arm/arch-faraday/ftpmu010.h  |  190 
 include/asm-arm/arch-faraday/ftsdmc020.h |  103 +
 include/asm-arm/arch-faraday/ftsmc020.h  |   79 ++
 include/asm-arm/arch-faraday/fttmr010.h  |   73 +
 include/configs/a320.h   |  235 ++
 16 files changed, 1396 insertions(+), 0 deletions(-)
 create mode 100644 board/faraday/a320/Makefile
 create mode 100644 board/faraday/a320/a320.c
 create mode 100644 board/faraday/a320/config.mk
 create mode 100644 board/faraday/a320/lowlevel_init.S
 create mode 100644 cpu/arm920t/faraday/Makefile
 create mode 100644 cpu/arm920t/faraday/ftsmc020.c
 create mode 100644 cpu/arm920t/faraday/timer.c
 create mode 100644 include/asm-arm/arch-faraday/ftahbc020.h
 create mode 100644 include/asm-arm/arch-faraday/ftpmu010.h
 create mode 100644 include/asm-arm/arch-faraday/ftsdmc020.h
 create mode 100644 include/asm-arm/arch-faraday/ftsmc020.h
 create mode 100644 include/asm-arm/arch-faraday/fttmr010.h
 create mode 100644 include/configs/a320.h

diff --git a/MAINTAINERS b/MAINTAINERS
index b0e370f..ed41b3a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -680,6 +680,10 @@ Sergey Lapin 

afeb9260ARM926EJS (AT91SAM9260 SoC)

+Po-Yu Chuang 
+
+   a320FA526 (ARMv4/reuse arm920t source) faraday SoC
+
 -

 Unknown / orphaned boards:
diff --git a/MAKEALL b/MAKEALL
index 027207d..530a253 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -498,6 +498,7 @@ LIST_ARM7=" \
 #

 LIST_ARM9="\
+   a320\
ap920t  \
ap922_XA10  \
ap926ejs\
diff --git a/Makefile b/Makefile
index 0ae1d36..f99e9d4 100644
--- a/Makefile
+++ b/Makefile
@@ -2991,6 +2991,13 @@ B2_config:   unconfig
@$(MKCONFIG) $(@:_config=) arm s3c44b0 B2 dave

 #
+## Faraday A320 Systems
+#
+
+a320_config:   unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm920t a320 faraday faraday
+
+#
 ## ARM720T Systems
 #

diff --git a/board/faraday/a320/Makefile b/board/faraday/a320/Makefile
new file mode 100644
index 000..ef053c2
--- /dev/null
+++ b/board/faraday/a320/Makefile
@@ -0,0 +1,51 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).a
+
+COBJS  := a320.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
+
+#
+

Re: [U-Boot] [PATCH 2/3 v3] arm: A320: driver for FTRTC010 real time clock

2009-07-03 Thread Po-Yu Chuang
This patch adds an FTRTC010 driver for Faraday A320 evaluation board.

Signed-off-by: Po-Yu Chuang 
---
 drivers/rtc/Makefile   |1 +
 drivers/rtc/ftrtc010.c |  126 
 2 files changed, 127 insertions(+), 0 deletions(-)
 create mode 100644 drivers/rtc/ftrtc010.c

diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 822dc1a..25252b5 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -40,6 +40,7 @@ COBJS-$(CONFIG_RTC_DS1556) += ds1556.o
 COBJS-$(CONFIG_RTC_DS164x) += ds164x.o
 COBJS-$(CONFIG_RTC_DS174x) += ds174x.o
 COBJS-$(CONFIG_RTC_DS3231) += ds3231.o
+COBJS-$(CONFIG_RTC_FTRTC010) += ftrtc010.o
 COBJS-$(CONFIG_RTC_ISL1208) += isl1208.o
 COBJS-$(CONFIG_RTC_M41T11) += m41t11.o
 COBJS-$(CONFIG_RTC_M41T60) += m41t60.o
diff --git a/drivers/rtc/ftrtc010.c b/drivers/rtc/ftrtc010.c
new file mode 100644
index 000..0489565
--- /dev/null
+++ b/drivers/rtc/ftrtc010.c
@@ -0,0 +1,126 @@
+/*
+ * Faraday FTRTC010 Real Time Clock
+ *
+ * (C) Copyright 2009 Faraday Technology
+ * Po-Yu Chuang 
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#undef DEBUG
+
+#include 
+#include 
+#include 
+#include 
+
+struct ftrtc010 {
+   unsigned int sec;   /* 0x00 */
+   unsigned int min;   /* 0x04 */
+   unsigned int hour;  /* 0x08 */
+   unsigned int day;   /* 0x0c */
+   unsigned int alarm_sec; /* 0x10 */
+   unsigned int alarm_min; /* 0x14 */
+   unsigned int alarm_hour;/* 0x18 */
+   unsigned int record;/* 0x1c */
+   unsigned int cr;/* 0x20 */
+};
+
+/*
+ * RTC Control Register
+ */
+#define FTRTC010_CR_ENABLE (1 << 0)
+#define FTRTC010_CR_INTERRUPT_SEC  (1 << 1)/* per second irq */
+#define FTRTC010_CR_INTERRUPT_MIN  (1 << 2)/* per minute irq */
+#define FTRTC010_CR_INTERRUPT_HR   (1 << 3)/* per hour   irq */
+#define FTRTC010_CR_INTERRUPT_DAY  (1 << 4)/* per dayirq */
+
+static struct ftrtc010 *rtc = (struct ftrtc010 *)CONFIG_SYS_RTC_BASE;
+
+static void ftrtc010_enable (void)
+{
+   writel (FTRTC010_CR_ENABLE, &rtc->cr);
+}
+
+/*
+ * return current time in seconds
+ */
+static unsigned long ftrtc010_time (void)
+{
+   unsigned long day;
+   unsigned long hour;
+   unsigned long minute;
+   unsigned long second;
+   unsigned long second2;
+
+   do {
+   second  = readl (&rtc->sec);
+   day = readl (&rtc->day);
+   hour= readl (&rtc->hour);
+   minute  = readl (&rtc->min);
+   second2 = readl (&rtc->sec);
+   } while (second != second2);
+
+   return day * 24 * 60 * 60 + hour * 60 * 60 + minute * 60 + second;
+}
+
+/*
+ * Get the current time from the RTC
+ */
+
+int rtc_get (struct rtc_time *tmp)
+{
+   unsigned long now;
+
+   debug ("%s(): record register: %x\n",
+  __func__, readl (&rtc->record));
+
+   now = ftrtc010_time () + readl (&rtc->record);
+
+   to_tm (now, tmp);
+
+   return 0;
+}
+
+/*
+ * Set the RTC
+ */
+int rtc_set (struct rtc_time *tmp)
+{
+   unsigned long new;
+   unsigned long now;
+
+   debug ("%s(): DATE: %4d-%02d-%02d (wday=%d)  TIME: %2d:%02d:%02d\n",
+  __func__,
+  tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
+  tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
+
+   new = mktime (tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_hour,
+ tmp->tm_min, tmp->tm_sec);
+
+   now = ftrtc010_time ();
+
+   debug ("%s(): write %lx to record register\n", __func__, new - now);
+
+   writel (new - now, &rtc->record);
+
+   return 0;
+}
+
+void rtc_reset (void)
+{
+   debug ("%s()\n", __func__);
+   ftrtc010_enable ();
+}
-- 
1.6.3.3
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3 v3] A320: driver for FTRTC010 real time clock

2009-07-03 Thread Po-Yu Chuang
This patch adds an FTRTC010 driver for Faraday A320 evaluation board.

Signed-off-by: Po-Yu Chuang 
---
 drivers/rtc/Makefile   |1 +
 drivers/rtc/ftrtc010.c |  126 
 2 files changed, 127 insertions(+), 0 deletions(-)
 create mode 100644 drivers/rtc/ftrtc010.c

diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 822dc1a..25252b5 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -40,6 +40,7 @@ COBJS-$(CONFIG_RTC_DS1556) += ds1556.o
 COBJS-$(CONFIG_RTC_DS164x) += ds164x.o
 COBJS-$(CONFIG_RTC_DS174x) += ds174x.o
 COBJS-$(CONFIG_RTC_DS3231) += ds3231.o
+COBJS-$(CONFIG_RTC_FTRTC010) += ftrtc010.o
 COBJS-$(CONFIG_RTC_ISL1208) += isl1208.o
 COBJS-$(CONFIG_RTC_M41T11) += m41t11.o
 COBJS-$(CONFIG_RTC_M41T60) += m41t60.o
diff --git a/drivers/rtc/ftrtc010.c b/drivers/rtc/ftrtc010.c
new file mode 100644
index 000..0489565
--- /dev/null
+++ b/drivers/rtc/ftrtc010.c
@@ -0,0 +1,126 @@
+/*
+ * Faraday FTRTC010 Real Time Clock
+ *
+ * (C) Copyright 2009 Faraday Technology
+ * Po-Yu Chuang 
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#undef DEBUG
+
+#include 
+#include 
+#include 
+#include 
+
+struct ftrtc010 {
+   unsigned int sec;   /* 0x00 */
+   unsigned int min;   /* 0x04 */
+   unsigned int hour;  /* 0x08 */
+   unsigned int day;   /* 0x0c */
+   unsigned int alarm_sec; /* 0x10 */
+   unsigned int alarm_min; /* 0x14 */
+   unsigned int alarm_hour;/* 0x18 */
+   unsigned int record;/* 0x1c */
+   unsigned int cr;/* 0x20 */
+};
+
+/*
+ * RTC Control Register
+ */
+#define FTRTC010_CR_ENABLE (1 << 0)
+#define FTRTC010_CR_INTERRUPT_SEC  (1 << 1)/* per second irq */
+#define FTRTC010_CR_INTERRUPT_MIN  (1 << 2)/* per minute irq */
+#define FTRTC010_CR_INTERRUPT_HR   (1 << 3)/* per hour   irq */
+#define FTRTC010_CR_INTERRUPT_DAY  (1 << 4)/* per dayirq */
+
+static struct ftrtc010 *rtc = (struct ftrtc010 *)CONFIG_SYS_RTC_BASE;
+
+static void ftrtc010_enable (void)
+{
+   writel (FTRTC010_CR_ENABLE, &rtc->cr);
+}
+
+/*
+ * return current time in seconds
+ */
+static unsigned long ftrtc010_time (void)
+{
+   unsigned long day;
+   unsigned long hour;
+   unsigned long minute;
+   unsigned long second;
+   unsigned long second2;
+
+   do {
+   second  = readl (&rtc->sec);
+   day = readl (&rtc->day);
+   hour= readl (&rtc->hour);
+   minute  = readl (&rtc->min);
+   second2 = readl (&rtc->sec);
+   } while (second != second2);
+
+   return day * 24 * 60 * 60 + hour * 60 * 60 + minute * 60 + second;
+}
+
+/*
+ * Get the current time from the RTC
+ */
+
+int rtc_get (struct rtc_time *tmp)
+{
+   unsigned long now;
+
+   debug ("%s(): record register: %x\n",
+  __func__, readl (&rtc->record));
+
+   now = ftrtc010_time () + readl (&rtc->record);
+
+   to_tm (now, tmp);
+
+   return 0;
+}
+
+/*
+ * Set the RTC
+ */
+int rtc_set (struct rtc_time *tmp)
+{
+   unsigned long new;
+   unsigned long now;
+
+   debug ("%s(): DATE: %4d-%02d-%02d (wday=%d)  TIME: %2d:%02d:%02d\n",
+  __func__,
+  tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
+  tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
+
+   new = mktime (tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_hour,
+ tmp->tm_min, tmp->tm_sec);
+
+   now = ftrtc010_time ();
+
+   debug ("%s(): write %lx to record register\n", __func__, new - now);
+
+   writel (new - now, &rtc->record);
+
+   return 0;
+}
+
+void rtc_reset (void)
+{
+   debug ("%s()\n", __func__);
+   ftrtc010_enable ();
+}
-- 
1.6.3.3
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3 v3] A320: driver for FTMAC100 ethernet controller

2009-07-03 Thread Po-Yu Chuang
This patch adds an FTMAC100 Ethernet driver for Faraday A320 evaluation board.

Signed-off-by: Po-Yu Chuang 
---
 drivers/net/Makefile   |1 +
 drivers/net/ftmac100.c |  278 
 drivers/net/ftmac100.h |  154 ++
 include/netdev.h   |1 +
 4 files changed, 434 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/ftmac100.c
 create mode 100644 drivers/net/ftmac100.h

diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index c6097c3..8edf529 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -38,6 +38,7 @@ COBJS-$(CONFIG_E1000) += e1000.o
 COBJS-$(CONFIG_EEPRO100) += eepro100.o
 COBJS-$(CONFIG_ENC28J60) += enc28j60.o
 COBJS-$(CONFIG_FSLDMAFEC) += fsl_mcdmafec.o mcfmii.o
+COBJS-$(CONFIG_DRIVER_FTMAC100) += ftmac100.o
 COBJS-$(CONFIG_GRETH) += greth.o
 COBJS-$(CONFIG_INCA_IP_SWITCH) += inca-ip_sw.o
 COBJS-$(CONFIG_KIRKWOOD_EGIGA) += kirkwood_egiga.o
diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
new file mode 100644
index 000..3f2b111
--- /dev/null
+++ b/drivers/net/ftmac100.c
@@ -0,0 +1,278 @@
+/*
+ * Faraday FTMAC100 Ethernet
+ *
+ * (C) Copyright 2009 Faraday Technology
+ * Po-Yu Chuang 
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#undef DEBUG
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "ftmac100.h"
+
+struct ftmac100_data {
+   volatile struct ftmac100_txdes txdes[1];
+   volatile struct ftmac100_rxdes rxdes[PKTBUFSRX];
+   int rx_index;
+};
+
+/*
+ * Reset MAC
+ */
+static void ftmac100_reset (struct eth_device *dev)
+{
+   struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
+
+   debug ("%s()\n", __func__);
+
+   writel (FTMAC100_MACCR_SW_RST, &ftmac100->maccr);
+
+   while (readl (&ftmac100->maccr) & FTMAC100_MACCR_SW_RST)
+   ;
+}
+
+/*
+ * Set MAC address
+ */
+static void ftmac100_set_mac (struct eth_device *dev, const unsigned char *mac)
+{
+   struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
+   unsigned int maddr = mac[0] << 8 | mac[1];
+   unsigned int laddr = mac[2] << 24 | mac[3] << 16 | mac[4] << 8 | mac[5];
+
+   debug ("%s(%x %x)\n", __func__, maddr, laddr);
+
+   writel (maddr, &ftmac100->mac_madr);
+   writel (laddr, &ftmac100->mac_ladr);
+}
+
+static void ftmac100_set_mac_from_env (struct eth_device *dev)
+{
+   eth_getenv_enetaddr ("ethaddr", dev->enetaddr);
+
+   ftmac100_set_mac (dev, dev->enetaddr);
+}
+
+/*
+ * disable transmitter, receiver
+ */
+static void ftmac100_halt (struct eth_device *dev)
+{
+   struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
+
+   debug ("%s()\n", __func__);
+
+   writel (0, &ftmac100->maccr);
+}
+
+static int ftmac100_init (struct eth_device *dev, bd_t *bd)
+{
+   struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
+   struct ftmac100_data *priv = dev->priv;
+   volatile struct ftmac100_txdes *txdes = priv->txdes;
+   volatile struct ftmac100_rxdes *rxdes = priv->rxdes;
+   unsigned int maccr;
+   int i;
+
+   debug ("%s()\n", __func__);
+
+   ftmac100_reset (dev);
+
+   /* set the ethernet address */
+
+   ftmac100_set_mac_from_env (dev);
+
+   /* disable all interrupts */
+
+   writel (0, &ftmac100->imr);
+
+   /* initialize descriptors */
+
+   priv->rx_index = 0;
+
+   txdes[0].txdes1 = FTMAC100_TXDES1_EDOTR;
+   rxdes[PKTBUFSRX - 1].rxdes1 = FTMAC100_RXDES1_EDORR;
+
+   for (i = 0; i < PKTBUFSRX; i++) {
+   /* RXBUF_BADR */
+   rxdes[i].rxdes2 = (unsigned int)NetRxPackets[i];
+   rxdes[i].rxdes1 |= FTMAC100_RXDES1_RXBUF_SIZE (PKTSIZE_ALIGN);
+   rxdes[i].rxdes0 = FTMAC100_RXDES0_RXDMA_OWN;
+   }
+
+   /* transmit ring */
+
+   writel ((unsigned int)txdes, &ftmac100->txr_badr);
+
+   /* receive ring */
+
+   writel ((unsigned int)rxdes, &ftmac100->rxr_badr);
+
+   /* poll receive descriptor automatically */
+
+   writel (FTMAC100_APTC_RXPOLL_CNT (1), &f

Re: [U-Boot] [PATCH 1/3 v3] arm: A320: driver for FTMAC100 ethernet controller

2009-07-02 Thread Po-Yu Chuang
This patch adds an FTMAC100 Ethernet driver for Faraday A320 evaluation board.

Signed-off-by: Po-Yu Chuang 
---
 drivers/net/Makefile   |1 +
 drivers/net/ftmac100.c |  278 
 drivers/net/ftmac100.h |  154 ++
 include/netdev.h   |1 +
 4 files changed, 434 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/ftmac100.c
 create mode 100644 drivers/net/ftmac100.h

diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index c6097c3..8edf529 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -38,6 +38,7 @@ COBJS-$(CONFIG_E1000) += e1000.o
 COBJS-$(CONFIG_EEPRO100) += eepro100.o
 COBJS-$(CONFIG_ENC28J60) += enc28j60.o
 COBJS-$(CONFIG_FSLDMAFEC) += fsl_mcdmafec.o mcfmii.o
+COBJS-$(CONFIG_DRIVER_FTMAC100) += ftmac100.o
 COBJS-$(CONFIG_GRETH) += greth.o
 COBJS-$(CONFIG_INCA_IP_SWITCH) += inca-ip_sw.o
 COBJS-$(CONFIG_KIRKWOOD_EGIGA) += kirkwood_egiga.o
diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
new file mode 100644
index 000..3f2b111
--- /dev/null
+++ b/drivers/net/ftmac100.c
@@ -0,0 +1,278 @@
+/*
+ * Faraday FTMAC100 Ethernet
+ *
+ * (C) Copyright 2009 Faraday Technology
+ * Po-Yu Chuang 
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#undef DEBUG
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "ftmac100.h"
+
+struct ftmac100_data {
+   volatile struct ftmac100_txdes txdes[1];
+   volatile struct ftmac100_rxdes rxdes[PKTBUFSRX];
+   int rx_index;
+};
+
+/*
+ * Reset MAC
+ */
+static void ftmac100_reset (struct eth_device *dev)
+{
+   struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
+
+   debug ("%s()\n", __func__);
+
+   writel (FTMAC100_MACCR_SW_RST, &ftmac100->maccr);
+
+   while (readl (&ftmac100->maccr) & FTMAC100_MACCR_SW_RST)
+   ;
+}
+
+/*
+ * Set MAC address
+ */
+static void ftmac100_set_mac (struct eth_device *dev, const unsigned char *mac)
+{
+   struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
+   unsigned int maddr = mac[0] << 8 | mac[1];
+   unsigned int laddr = mac[2] << 24 | mac[3] << 16 | mac[4] << 8 | mac[5];
+
+   debug ("%s(%x %x)\n", __func__, maddr, laddr);
+
+   writel (maddr, &ftmac100->mac_madr);
+   writel (laddr, &ftmac100->mac_ladr);
+}
+
+static void ftmac100_set_mac_from_env (struct eth_device *dev)
+{
+   eth_getenv_enetaddr ("ethaddr", dev->enetaddr);
+
+   ftmac100_set_mac (dev, dev->enetaddr);
+}
+
+/*
+ * disable transmitter, receiver
+ */
+static void ftmac100_halt (struct eth_device *dev)
+{
+   struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
+
+   debug ("%s()\n", __func__);
+
+   writel (0, &ftmac100->maccr);
+}
+
+static int ftmac100_init (struct eth_device *dev, bd_t *bd)
+{
+   struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;
+   struct ftmac100_data *priv = dev->priv;
+   volatile struct ftmac100_txdes *txdes = priv->txdes;
+   volatile struct ftmac100_rxdes *rxdes = priv->rxdes;
+   unsigned int maccr;
+   int i;
+
+   debug ("%s()\n", __func__);
+
+   ftmac100_reset (dev);
+
+   /* set the ethernet address */
+
+   ftmac100_set_mac_from_env (dev);
+
+   /* disable all interrupts */
+
+   writel (0, &ftmac100->imr);
+
+   /* initialize descriptors */
+
+   priv->rx_index = 0;
+
+   txdes[0].txdes1 = FTMAC100_TXDES1_EDOTR;
+   rxdes[PKTBUFSRX - 1].rxdes1 = FTMAC100_RXDES1_EDORR;
+
+   for (i = 0; i < PKTBUFSRX; i++) {
+   /* RXBUF_BADR */
+   rxdes[i].rxdes2 = (unsigned int)NetRxPackets[i];
+   rxdes[i].rxdes1 |= FTMAC100_RXDES1_RXBUF_SIZE (PKTSIZE_ALIGN);
+   rxdes[i].rxdes0 = FTMAC100_RXDES0_RXDMA_OWN;
+   }
+
+   /* transmit ring */
+
+   writel ((unsigned int)txdes, &ftmac100->txr_badr);
+
+   /* receive ring */
+
+   writel ((unsigned int)rxdes, &ftmac100->rxr_badr);
+
+   /* poll receive descriptor automatically */
+
+   writel (FTMAC100_APTC_RXPOLL_CNT (1), &f

Re: [U-Boot] [PATCHv2 3/3] A320: Add support for Faraday A320 evaluation board

2009-07-02 Thread Po-Yu Chuang
Dear all,

2009/7/3 Po-Yu Chuang :
>> please check your patch with checkpatch.pl script.
>> It would warn you about such code style errors.
>
> Do you mean no braces for single statement block?
> Itcomes from linux coding style.
>
> I use Lindent -pcs which is suggested in u-boot coding style.
> It adds spaces before parameters to function calls.
> This causes checkpatch.pl to create a lot of warning.
> checkpatch.pl from linux doesn't seem to work well with u-boot coding style,
> but it is helpful still. Thanks.

I will resubmit the all the patches which fixed warnings told by checkpatch.pl
(except spaces after function name).

regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH] Add support for Raidsonic ICYBOX NAS4220 board

2009-07-02 Thread Po-Yu Chuang
Dear Darius Augulis,

2009/7/1 Darius Augulis :
> This board is based on Cortina Systems networking processor
> CS3516. It has FA526 core, which is ARMv4 compatible.
> Many SoC specific definitions may be used for similar
> processors CS3512 and dual-core CS3518. This processor
> family has Gemini name.
>
> Signed-off-by: Darius Augulis 
> ---
> diff --git a/cpu/arm920t/start.S b/cpu/arm920t/start.S
> index 475cdaf..761753e 100644
> --- a/cpu/arm920t/start.S
> +++ b/cpu/arm920t/start.S
> @@ -115,8 +115,10 @@ start_code:
>        orr     r0,r0,#0xd3
>        msr     cpsr,r0
>
> -       bl coloured_LED_init
> -       bl red_LED_on
> +#ifndef CONFIG_GEMINI
> +       bl      coloured_LED_init
> +       bl      red_LED_on
> +#endif
This is unnecessary.

>  #if    defined(CONFIG_AT91RM9200DK) || defined(CONFIG_AT91RM9200EK)
>        /*
> @@ -189,6 +191,11 @@ relocate:                          /* relocate U-Boot to 
> RAM           */
>        sub     r2, r3, r2              /* r2 <- size of armboot            */
>        add     r2, r0, r2              /* r2 <- source end address         */
>
> +#ifdef CONFIG_GEMINI
> +       orr     r0, r0, #CONFIG_SYS_FLASH_BASE
> +       orr     r2, r2, #CONFIG_SYS_FLASH_BASE
> +#endif

How about put a jump to the Flash at the very beginning of "start_code"?

start_code:
ldrr0, _start_from_flash
orrpc, r0, #CONFIG_SYS_FLASH_BASE

_start_from_flash: .word start_from_flash

start_from_flash:
/* original start code here*/

Then maybe you don't need a customized linker script?

regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCHv2 3/3] A320: Add support for Faraday A320 evaluation board

2009-07-02 Thread Po-Yu Chuang
Darius Augulis,

2009/7/2 Darius Augulis :
> Hi Po-Yu,
> On 07/01/2009 02:13 PM, Po-Yu Chuang wrote:
>> This patch adds support for A320 development board from Faraday. This
>> board
>> uses FA526 processor by default and has 512kB and 32MB NOR flash, 64M RAM.
>> FA526 is an ARMv4 processor and uses the ARM920T source in this patch.
> It's very interesting. Please find my recent post with patch for NAS4220. It
> has CS3516 SoC with the same(?) FA526 core.
> Few comments inline below.

>> diff --git a/board/faraday/a320/config.mk b/board/faraday/a320/config.mk
>> new file mode 100644
>> index 000..7573bbd
>> --- /dev/null
>> +++ b/board/faraday/a320/config.mk
>> +# Faraday A320 board with FA526/FA626TE/ARM926EJ-S cpus
>> +# A320 has 1 bank of 64 MB DRAM (after remapped)
>> +#
>> +# ' to 0400'
>> +#
>> +# Linux-Kernel is expected to be at '8000, entry '8000
>> +#
>> +# we load ourself to 03f8'
>> +#
>> +# download area is 0200'
>> +
>> +TEXT_BASE = 0x03f8
>
> where is your physical DRAM base?
> Where does your system boot from? Does it execute code directly from Flash
> memory? I am asking, because CS351x does that very strange: some hardware(?)
> locig copies 2K from Flash base to internal SDRAM, mapped to 0x0 address.
> After that it starts execute code from SDRAM.
> This caused me to change cpu/arm920t/start.S and make linker script.
> You didn't such modifications, so I understand, this is Gemini specific, not
> Faraday FA526 core?

After power on, cpu starts from ROM (at 0x0) which is "_start" in
cpu/arm920t/start.S.
Then the "lowlevel_init" routine in my patch does the following things:
"copy_code" copies u-boot to SDRAM (at 0x1000).
The later "remap" routine modifies the setting of the AHB controller.
SDRAM base becomes 0x0. ROM base becomes 0x8000.

It sounds like your hardware (?) works similar to what I do in "lowlevel_init".

I have to do this strange remap because other boot loader of our
company behaves like this
and our kernel and non-OS verification programs depends on it (SDRAM base 0x0).
Therefore, TEXT_BASE is 0x03f8 rather than 0x13f8.


> Should be possibility to make something common for your SoC and Gemini
> processors?

Yes.
After reading your patch, I found that it looks like your SoC use
Faraday's timer IP FTTMR010.
Maybe we should do something about it.

>> diff --git a/board/faraday/a320/lowlevel_init.S
>> b/board/faraday/a320/lowlevel_init.S
>> new file mode 100644
>> index 000..2adb9ef
>> --- /dev/null
>> +++ b/board/faraday/a320/lowlevel_init.S
>> +.globl lowlevel_init
>> +lowlevel_init:
>> +       mov     r11, lr
>> +
>> +       led     0x0
>> +
>> +       /* if REMAP bit is set ->  memory had been initialzed */
>> +
>> +       ldr     r0, =CONFIG_SYS_AHBC_BASE
>> +       ldr     r1, [r0, #FTAHBC020_OFFSET_ICR]
>> +       tst     r1, #FTAHBC020_ICR_REMAP                @ test REMAP bit
>> +       bne     skip_remap
>> +
>> +       led     0x1
>> +
>> +       bl      init_sdmc
>> +
>> +       led     0x2
>> +
>> +       /*
>> +        * copy U-Boot to RAM
>> +        */
>> +copy_code:
>> +       ldr     r0, =ROM_DEFAULT_BASE   /* r0<- source address     */
>> +       ldr     r1, =SDRAM_DEFAULT_BASE /* r1<- target address     */
>> +
>> +       ldr     r2, .LC5
>> +       ldr     r3, .LC6
>> +       sub     r2, r3, r2              /* r2<- size of armboot
>>  */
>> +       add     r2, r0, r2              /* r2<- source end address
>> */
>> +
>> +       led     0x3
>> +
>> +copy_loop:
>> +       ldmia   r0!, {r3-r10}           /* copy from source address [r0]
>>  */
>> +       stmia   r1!, {r3-r10}           /* copy to   target address [r1]
>>  */
>> +       cmp     r0, r2                  /* until source end addreee [r2]
>>  */
>> +       ble     copy_loop
>> +
>> +       led     0x4
>
> do you really need to repeat reallocation? it is done in start.S...

explained above. I have to do this to make the later "remap" work.

>> +/*
>> + * This code will remap the memory ROM and SDRAM
>> + * ROM will be placed on 0x8000 SDRAM will jump to 0x0
>> + */
> why are you doing this remap?

explained above.

>> +remap:
>> +       ldr     r0, =CONFIG_SYS_SDMC_BASE
>> +
>> +       /* first adjust sdram */
>> +       write32 B0_BSR_A, B0_BSR_D2
>> +
>> +       /

[U-Boot] [PATCH v3 3/3] A320: Add support for Faraday A320 evaluation board

2009-07-01 Thread Po-Yu Chuang
This patch adds support for A320 development board from Faraday. This board
uses FA526 processor by default and has 512kB and 32MB NOR flash, 64M RAM.
FA526 is an ARMv4 processor and uses the ARM920T source in this patch.

Signed-off-by: Po-Yu Chuang 
---
 MAINTAINERS  |4 +
 MAKEALL  |1 +
 Makefile |7 +
 board/faraday/a320/Makefile  |   51 +++
 board/faraday/a320/a320.c|   64 
 board/faraday/a320/config.mk |   35 +
 board/faraday/a320/lowlevel_init.S   |  191 
 cpu/arm920t/faraday/Makefile |   46 ++
 cpu/arm920t/faraday/ftsmc020.c   |   52 +++
 cpu/arm920t/faraday/timer.c  |  194 
 include/asm-arm/arch-faraday/ftahbc020.h |   71 +
 include/asm-arm/arch-faraday/ftpmu010.h  |  190 
 include/asm-arm/arch-faraday/ftsdmc020.h |  103 +
 include/asm-arm/arch-faraday/ftsmc020.h  |   79 ++
 include/asm-arm/arch-faraday/fttmr010.h  |   73 +
 include/configs/a320.h   |  239 ++
 16 files changed, 1400 insertions(+), 0 deletions(-)
 create mode 100644 board/faraday/a320/Makefile
 create mode 100644 board/faraday/a320/a320.c
 create mode 100644 board/faraday/a320/config.mk
 create mode 100644 board/faraday/a320/lowlevel_init.S
 create mode 100644 cpu/arm920t/faraday/Makefile
 create mode 100644 cpu/arm920t/faraday/ftsmc020.c
 create mode 100644 cpu/arm920t/faraday/timer.c
 create mode 100644 include/asm-arm/arch-faraday/ftahbc020.h
 create mode 100644 include/asm-arm/arch-faraday/ftpmu010.h
 create mode 100644 include/asm-arm/arch-faraday/ftsdmc020.h
 create mode 100644 include/asm-arm/arch-faraday/ftsmc020.h
 create mode 100644 include/asm-arm/arch-faraday/fttmr010.h
 create mode 100644 include/configs/a320.h

diff --git a/MAINTAINERS b/MAINTAINERS
index b0e370f..ed41b3a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -680,6 +680,10 @@ Sergey Lapin 

afeb9260ARM926EJS (AT91SAM9260 SoC)

+Po-Yu Chuang 
+
+   a320FA526 (ARMv4/reuse arm920t source) faraday SoC
+
 -

 Unknown / orphaned boards:
diff --git a/MAKEALL b/MAKEALL
index 027207d..530a253 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -498,6 +498,7 @@ LIST_ARM7=" \
 #

 LIST_ARM9="\
+   a320\
ap920t  \
ap922_XA10  \
ap926ejs\
diff --git a/Makefile b/Makefile
index 0ae1d36..f99e9d4 100644
--- a/Makefile
+++ b/Makefile
@@ -2991,6 +2991,13 @@ B2_config:   unconfig
@$(MKCONFIG) $(@:_config=) arm s3c44b0 B2 dave

 #
+## Faraday A320 Systems
+#
+
+a320_config:   unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm920t a320 faraday faraday
+
+#
 ## ARM720T Systems
 #

diff --git a/board/faraday/a320/Makefile b/board/faraday/a320/Makefile
new file mode 100644
index 000..ef053c2
--- /dev/null
+++ b/board/faraday/a320/Makefile
@@ -0,0 +1,51 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).a
+
+COBJS  := a320.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
+
+#
+

Re: [U-Boot] [PATCHv2 3/3] A320: Add support for Faraday A320 evaluation board

2009-07-01 Thread Po-Yu Chuang
Hello,

2009/7/1 Po-Yu Chuang :
> diff --git a/include/configs/a320.h b/include/configs/a320.h
> +/*---
> + * Ethernet
> + */
> +#define CONFIG_NET_MULTI
> +#define CONFIG_DRIVER_FTMAC100
> +#define CONFIG_SYS_MAC100_BASE 0x9090
> +
> +#define CONFIG_BOOTDELAY       3
> +#define CONFIG_ETHADDR         c3:10:da:ce:3f:3e
> +#define CONFIG_NETMASK         255.255.255.0
> +#define CONFIG_IPADDR          192.168.68.55
> +#define CONFIG_SERVERIP                192.168.68.63

Sorry I forgot to remove ip and mac address. I will resubmit this patch.

regards,
Po-Yu Chuang
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCHv2 3/3] A320: Add support for Faraday A320 evaluation board

2009-07-01 Thread Po-Yu Chuang
This patch adds support for A320 development board from Faraday. This board
uses FA526 processor by default and has 512kB and 32MB NOR flash, 64M RAM.
FA526 is an ARMv4 processor and uses the ARM920T source in this patch.

Signed-off-by: Po-Yu Chuang 
---
 MAINTAINERS  |4 +
 MAKEALL  |1 +
 Makefile |7 +
 board/faraday/a320/Makefile  |   51 +++
 board/faraday/a320/a320.c|   64 
 board/faraday/a320/config.mk |   35 +
 board/faraday/a320/lowlevel_init.S   |  191 
 cpu/arm920t/faraday/Makefile |   46 ++
 cpu/arm920t/faraday/ftsmc020.c   |   52 +++
 cpu/arm920t/faraday/timer.c  |  194 
 include/asm-arm/arch-faraday/ftahbc020.h |   71 +
 include/asm-arm/arch-faraday/ftpmu010.h  |  190 
 include/asm-arm/arch-faraday/ftsdmc020.h |  103 +
 include/asm-arm/arch-faraday/ftsmc020.h  |   79 ++
 include/asm-arm/arch-faraday/fttmr010.h  |   73 +
 include/configs/a320.h   |  239 ++
 16 files changed, 1400 insertions(+), 0 deletions(-)
 create mode 100644 board/faraday/a320/Makefile
 create mode 100644 board/faraday/a320/a320.c
 create mode 100644 board/faraday/a320/config.mk
 create mode 100644 board/faraday/a320/lowlevel_init.S
 create mode 100644 cpu/arm920t/faraday/Makefile
 create mode 100644 cpu/arm920t/faraday/ftsmc020.c
 create mode 100644 cpu/arm920t/faraday/timer.c
 create mode 100644 include/asm-arm/arch-faraday/ftahbc020.h
 create mode 100644 include/asm-arm/arch-faraday/ftpmu010.h
 create mode 100644 include/asm-arm/arch-faraday/ftsdmc020.h
 create mode 100644 include/asm-arm/arch-faraday/ftsmc020.h
 create mode 100644 include/asm-arm/arch-faraday/fttmr010.h
 create mode 100644 include/configs/a320.h

diff --git a/MAINTAINERS b/MAINTAINERS
index b0e370f..ed41b3a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -680,6 +680,10 @@ Sergey Lapin 

afeb9260ARM926EJS (AT91SAM9260 SoC)

+Po-Yu Chuang 
+
+   a320FA526 (ARMv4/reuse arm920t source) faraday SoC
+
 -

 Unknown / orphaned boards:
diff --git a/MAKEALL b/MAKEALL
index 027207d..530a253 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -498,6 +498,7 @@ LIST_ARM7=" \
 #

 LIST_ARM9="\
+   a320\
ap920t  \
ap922_XA10  \
ap926ejs\
diff --git a/Makefile b/Makefile
index 0ae1d36..f99e9d4 100644
--- a/Makefile
+++ b/Makefile
@@ -2991,6 +2991,13 @@ B2_config:   unconfig
@$(MKCONFIG) $(@:_config=) arm s3c44b0 B2 dave

 #
+## Faraday A320 Systems
+#
+
+a320_config:   unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm920t a320 faraday faraday
+
+#
 ## ARM720T Systems
 #

diff --git a/board/faraday/a320/Makefile b/board/faraday/a320/Makefile
new file mode 100644
index 000..ef053c2
--- /dev/null
+++ b/board/faraday/a320/Makefile
@@ -0,0 +1,51 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).a
+
+COBJS  := a320.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
+
+#
+

[U-Boot] [PATCHv2 2/3] A320: driver for FTRTC010 real time clock

2009-07-01 Thread Po-Yu Chuang
This patch adds an FTRTC010 driver for Faraday A320 evaluation board.

Signed-off-by: Po-Yu Chuang 
---
 drivers/rtc/Makefile   |1 +
 drivers/rtc/ftrtc010.c |  126 
 2 files changed, 127 insertions(+), 0 deletions(-)
 create mode 100644 drivers/rtc/ftrtc010.c

diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 822dc1a..25252b5 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -40,6 +40,7 @@ COBJS-$(CONFIG_RTC_DS1556) += ds1556.o
 COBJS-$(CONFIG_RTC_DS164x) += ds164x.o
 COBJS-$(CONFIG_RTC_DS174x) += ds174x.o
 COBJS-$(CONFIG_RTC_DS3231) += ds3231.o
+COBJS-$(CONFIG_RTC_FTRTC010) += ftrtc010.o
 COBJS-$(CONFIG_RTC_ISL1208) += isl1208.o
 COBJS-$(CONFIG_RTC_M41T11) += m41t11.o
 COBJS-$(CONFIG_RTC_M41T60) += m41t60.o
diff --git a/drivers/rtc/ftrtc010.c b/drivers/rtc/ftrtc010.c
new file mode 100644
index 000..7ee2f66
--- /dev/null
+++ b/drivers/rtc/ftrtc010.c
@@ -0,0 +1,126 @@
+/*
+ * Faraday FTRTC010 Real Time Clock
+ *
+ * (C) Copyright 2009 Faraday Technology
+ * Po-Yu Chuang 
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#undef DEBUG
+
+#include 
+#include 
+#include 
+#include 
+
+struct ftrtc010 {
+   unsigned int sec;   /* 0x00 */
+   unsigned int min;   /* 0x04 */
+   unsigned int hour;  /* 0x08 */
+   unsigned int day;   /* 0x0c */
+   unsigned int alarm_sec; /* 0x10 */
+   unsigned int alarm_min; /* 0x14 */
+   unsigned int alarm_hour;/* 0x18 */
+   unsigned int record;/* 0x1c */
+   unsigned int cr;/* 0x20 */
+};
+
+/*
+ * RTC Control Register
+ */
+#define FTRTC010_CR_ENABLE (1 << 0)
+#define FTRTC010_CR_INTERRUPT_SEC  (1 << 1)/* per second irq */
+#define FTRTC010_CR_INTERRUPT_MIN  (1 << 2)/* per minute irq */
+#define FTRTC010_CR_INTERRUPT_HR   (1 << 3)/* per hour   irq */
+#define FTRTC010_CR_INTERRUPT_DAY  (1 << 4)/* per dayirq */
+
+static volatile struct ftrtc010 *rtc = (struct ftrtc010 *)CONFIG_SYS_RTC_BASE;
+
+static void ftrtc010_enable (void)
+{
+   writel (FTRTC010_CR_ENABLE, &rtc->cr);
+}
+
+/*
+ * return current time in seconds
+ */
+static unsigned long ftrtc010_time (void)
+{
+   unsigned long day;
+   unsigned long hour;
+   unsigned long minute;
+   unsigned long second;
+   unsigned long second2;
+
+   do {
+   second  = readl (&rtc->sec);
+   day = readl (&rtc->day);
+   hour= readl (&rtc->hour);
+   minute  = readl (&rtc->min);
+   second2 = readl (&rtc->sec);
+   } while (second != second2);
+
+   return day * 24 * 60 * 60 + hour * 60 * 60 + minute * 60 + second;
+}
+
+/*
+ * Get the current time from the RTC
+ */
+
+int rtc_get (struct rtc_time *tmp)
+{
+   unsigned long now;
+
+   debug ("%s(): record register: %x\n",
+  __func__, readl (&rtc->record));
+
+   now = ftrtc010_time () + readl (&rtc->record);
+
+   to_tm (now, tmp);
+
+   return 0;
+}
+
+/*
+ * Set the RTC
+ */
+int rtc_set (struct rtc_time *tmp)
+{
+   unsigned long new;
+   unsigned long now;
+
+   debug ("%s(): DATE: %4d-%02d-%02d (wday=%d)  TIME: %2d:%02d:%02d\n",
+  __func__,
+  tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
+  tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
+
+   new = mktime (tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_hour,
+ tmp->tm_min, tmp->tm_sec);
+
+   now = ftrtc010_time ();
+
+   debug ("%s(): write %lx to record register\n", __func__, new - now);
+
+   writel (new - now, &rtc->record);
+
+   return 0;
+}
+
+void rtc_reset (void)
+{
+   debug ("%s()\n", __func__);
+   ftrtc010_enable ();
+}
-- 
1.6.3.3
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


  1   2   >