diff mbox

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

Message ID 1294218744-2535-2-git-send-email-macpaul@andestech.com
State Changes Requested
Headers show

Commit Message

Macpaul Lin Jan. 5, 2011, 9:12 a.m. UTC
Replace built-in ftpmu010 related code in timer.c for shared driver support.

Signed-off-by: Macpaul Lin <macpaul@andestech.com>
---
Change v2
  - Code cleanup

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

Comments

Reinhard Meyer Jan. 5, 2011, 9:46 a.m. UTC | #1
Dear Macpaul Lin,
> Replace built-in ftpmu010 related code in timer.c for shared driver support.
>
> Signed-off-by: Macpaul Lin<macpaul@andestech.com>
> ---
>   static ulong timestamp;
>   static ulong lastdec;

This is going to fail if used before relocation....

Best Regards,
Reinhard
Po-Yu Chuang Jan. 5, 2011, 9:56 a.m. UTC | #2
Dear Reinhard,

On Wed, Jan 5, 2011 at 5:46 PM, Reinhard Meyer <u-boot@emk-elektronik.de> wrote:
> Dear Macpaul Lin,
>>
>> Replace built-in ftpmu010 related code in timer.c for shared driver
>> support.
>>
>> Signed-off-by: Macpaul Lin<macpaul@andestech.com>
>> ---
>>  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
Macpaul Lin Jan. 5, 2011, 9:56 a.m. UTC | #3
HI Reinhard,

2011/1/5 Reinhard Meyer <u-boot@emk-elektronik.de>:
> Dear Macpaul Lin,
>> Replace built-in ftpmu010 related code in timer.c for shared driver support.
>>
>> Signed-off-by: Macpaul Lin<macpaul@andestech.com>
>> ---
>>   static ulong timestamp;
>>   static ulong lastdec;
>
> This is going to fail if used before relocation....

I've found that
[PATCH v2 1/2] arm: a320 timer: move static data to global_data struct
(http://patchwork.ozlabs.org/patch/76177/) which has been hold because the
relocation related work still under going.

This patch [PATCH v2 2/2] a320evb: replace built-in ftpmu010 related code
was based on current master tree.

Please help on suggest how to merge or correct these patches.
However, I think this patch
[PATCH v2 1/2] ftpmu010: support faraday ftpmu010 driver
is independent to the a320evb timer fix.

I think ftpmu010 could be review at first then we may discuss to fix
the a320 related
issues.

Thanks a lot.
diff mbox

Patch

diff --git a/arch/arm/cpu/arm920t/a320/timer.c b/arch/arm/cpu/arm920t/a320/timer.c
index d2e316f..106fd7f 100644
--- a/arch/arm/cpu/arm920t/a320/timer.c
+++ b/arch/arm/cpu/arm920t/a320/timer.c
@@ -19,21 +19,18 @@ 
 
 #include <common.h>
 #include <asm/io.h>
-#include <asm/arch/ftpmu010.h>
 #include <asm/arch/fttmr010.h>
 
 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_CLOCK	32768
 #define TIMER_LOAD_VAL	0xffffffff
 
 int timer_init(void)
 {
-	unsigned int oscc;
 	unsigned int cr;
 
 	debug("%s()\n", __func__);
@@ -41,23 +38,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 f67cf06..f169e5e 100644
--- a/include/configs/a320evb.h
+++ b/include/configs/a320evb.h
@@ -41,6 +41,11 @@ 
  */
 #define CONFIG_RTC_FTRTC010
 
+/*
+ * PMU
+ */
+#define CONFIG_FTPMU010_POWER
+
 /*-----------------------------------------------------------------------
  * Serial console configuration
  */