Skip to contentSkip to conversation

arm: a320: use new ftpmu010 API

PATCH Superseded Po-Yu Chuang 2 participants 3 messages Feb 16, 2011 – Mar 3, 2011 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 arm: a320: use new ftpmu010 API

From: Po-Yu Chuang <[email protected]>

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

---
 arch/arm/cpu/arm920t/a320/timer.c |   22 +++-------------------
 include/configs/a320evb.h         |    5 +++++
 2 files changed, 8 insertions(+), 19 deletions(-)
arch/arm/cpu/arm920t/a320/timer.c +3 -19
index d2e316f..e261a49 100644
@@ -19,14 +19,13 @@
 
 #include <common.h>
 #include <asm/io.h>
-#include <asm/arch/ftpmu010.h>
+#include <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
@@ -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);
include/configs/a320evb.h +5 -0
index 27f137f..5373bcb 100644
@@ -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 */
Signature · 1 line
1.6.3.3
#1 lore raw

PATCH v2 2/2 arm: a320: use new ftpmu010 API

From: Po-Yu Chuang <[email protected]>

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

---
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(-)
arch/arm/cpu/arm920t/a320/timer.c +3 -20
index d2e316f..7785036 100644
@@ -19,21 +19,19 @@
 
 #include <common.h>
 #include <asm/io.h>
-#include <asm/arch/ftpmu010.h>
 #include <asm/arch/fttmr010.h>
+#include <faraday/ftpmu010.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 +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);
include/configs/a320evb.h +5 -0
index 27f137f..5373bcb 100644
@@ -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 */
Signature · 1 line
1.6.3.3
#2 lore raw

PATCH v2 2/2 arm: a320: use new ftpmu010 API

Le 18/02/2011 06:35, Po-Yu Chuang a ?crit :

Quoted 9 lines

From: Po-Yu Chuang<[email protected]>

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

---
v2:
remove unused local variable oscc
include/ftpmu010.h -> include/faraday/ftpmu010.h

Applied to u-boot-arm/next, thanks!

Amicalement,

Signature · 1 line
Albert.