Patchwork [U-Boot] armv7: s5pc1xx: don't use function pointer for clock functions

login
register
mail settings
Submitter Minkyu Kang
Date Dec. 27, 2010, 9:02 a.m.
Message ID <4D185630.7050103@samsung.com>
Download mbox | patch
Permalink /patch/76776/
State Accepted
Commit 3c152165c78408e44845f2d08469db887f050e43
Delegated to: Minkyu Kang
Headers show

Comments

Minkyu Kang - Dec. 27, 2010, 9:02 a.m.
Because of the bss area is cleared after relocation, we've lost pointers.
This patch fixed it.

Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 arch/arm/cpu/armv7/s5p-common/cpu_info.c |    2 -
 arch/arm/cpu/armv7/s5pc1xx/clock.c       |   38 ++++++++++++++++++-----------
 arch/arm/include/asm/arch-s5pc1xx/clk.h  |   10 +++----
 3 files changed, 27 insertions(+), 23 deletions(-)
Minkyu Kang - Jan. 4, 2011, 8:23 a.m.
On 27 December 2010 18:02, Minkyu Kang <mk7.kang@samsung.com> wrote:
> Because of the bss area is cleared after relocation, we've lost pointers.
> This patch fixed it.
>
> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  arch/arm/cpu/armv7/s5p-common/cpu_info.c |    2 -
>  arch/arm/cpu/armv7/s5pc1xx/clock.c       |   38 ++++++++++++++++++-----------
>  arch/arm/include/asm/arch-s5pc1xx/clk.h  |   10 +++----
>  3 files changed, 27 insertions(+), 23 deletions(-)
>
applied to u-boot-samsung

Minkyu Kang

Patch

diff --git a/arch/arm/cpu/armv7/s5p-common/cpu_info.c b/arch/arm/cpu/armv7/s5p-common/cpu_info.c
index 2f6c708..c8a543a 100644
--- a/arch/arm/cpu/armv7/s5p-common/cpu_info.c
+++ b/arch/arm/cpu/armv7/s5p-common/cpu_info.c
@@ -32,8 +32,6 @@  int arch_cpu_init(void)
 {
 	s5p_set_cpu_id();
 
-	s5p_clock_init();
-
 	return 0;
 }
 #endif
diff --git a/arch/arm/cpu/armv7/s5pc1xx/clock.c b/arch/arm/cpu/armv7/s5pc1xx/clock.c
index 98a27e5..e92647c 100644
--- a/arch/arm/cpu/armv7/s5pc1xx/clock.c
+++ b/arch/arm/cpu/armv7/s5pc1xx/clock.c
@@ -38,11 +38,6 @@ 
 #define CONFIG_SYS_CLK_FREQ_C110	24000000
 #endif
 
-unsigned long (*get_uart_clk)(int dev_index);
-unsigned long (*get_pwm_clk)(void);
-unsigned long (*get_arm_clk)(void);
-unsigned long (*get_pll_clk)(int);
-
 /* s5pc110: return pll clock frequency */
 static unsigned long s5pc100_get_pll_clk(int pllreg)
 {
@@ -316,15 +311,28 @@  static unsigned long s5pc1xx_get_pwm_clk(void)
 		return s5pc100_get_pclk();
 }
 
-void s5p_clock_init(void)
+unsigned long get_pll_clk(int pllreg)
 {
-	if (cpu_is_s5pc110()) {
-		get_pll_clk = s5pc110_get_pll_clk;
-		get_arm_clk = s5pc110_get_arm_clk;
-	} else {
-		get_pll_clk = s5pc100_get_pll_clk;
-		get_arm_clk = s5pc100_get_arm_clk;
-	}
-	get_uart_clk = s5pc1xx_get_uart_clk;
-	get_pwm_clk = s5pc1xx_get_pwm_clk;
+	if (cpu_is_s5pc110())
+		return s5pc110_get_pll_clk(pllreg);
+	else
+		return s5pc100_get_pll_clk(pllreg);
+}
+
+unsigned long get_arm_clk(void)
+{
+	if (cpu_is_s5pc110())
+		return s5pc110_get_arm_clk();
+	else
+		return s5pc100_get_arm_clk();
+}
+
+unsigned long get_pwm_clk(void)
+{
+	return s5pc1xx_get_pwm_clk();
+}
+
+unsigned long get_uart_clk(int dev_index)
+{
+	return s5pc1xx_get_uart_clk(dev_index);
 }
diff --git a/arch/arm/include/asm/arch-s5pc1xx/clk.h b/arch/arm/include/asm/arch-s5pc1xx/clk.h
index 3488eb7..4c389c1 100644
--- a/arch/arm/include/asm/arch-s5pc1xx/clk.h
+++ b/arch/arm/include/asm/arch-s5pc1xx/clk.h
@@ -29,11 +29,9 @@ 
 #define HPLL	3
 #define VPLL	4
 
-void s5p_clock_init(void);
-
-extern unsigned long (*get_pll_clk)(int pllreg);
-extern unsigned long (*get_arm_clk)(void);
-extern unsigned long (*get_pwm_clk)(void);
-extern unsigned long (*get_uart_clk)(int dev_index);
+unsigned long get_pll_clk(int pllreg);
+unsigned long get_arm_clk(void);
+unsigned long get_pwm_clk(void);
+unsigned long get_uart_clk(int dev_index);
 
 #endif