diff options
author | Magnus Damm <damm@opensource.se> | 2014-03-05 22:28:24 -0500 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2014-04-13 22:25:33 -0400 |
commit | c39dae380b4a11f1050a2ef6607598dcbe0541be (patch) | |
tree | 442327a5a2a9b7bbb473b6d73be2520cf474d85f | |
parent | ce4b6a04c49b0b414d537b45ededd9dfd4e48336 (diff) |
ARM: shmobile: Add shared shmobile_init_delay()
Introduce shmobile_init_delay() that gets CPU specific
parameters from DT and sets up the early delay from
there. This allows us to both remove frequency information
from the C code and consolidate existing code.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r-- | arch/arm/mach-shmobile/include/mach/common.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-shmobile/timer.c | 28 |
2 files changed, 29 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h index cb8e32deb2a3..f7a360edcc35 100644 --- a/arch/arm/mach-shmobile/include/mach/common.h +++ b/arch/arm/mach-shmobile/include/mach/common.h | |||
@@ -4,6 +4,7 @@ | |||
4 | extern void shmobile_earlytimer_init(void); | 4 | extern void shmobile_earlytimer_init(void); |
5 | extern void shmobile_setup_delay(unsigned int max_cpu_core_mhz, | 5 | extern void shmobile_setup_delay(unsigned int max_cpu_core_mhz, |
6 | unsigned int mult, unsigned int div); | 6 | unsigned int mult, unsigned int div); |
7 | extern void shmobile_init_delay(void); | ||
7 | struct twd_local_timer; | 8 | struct twd_local_timer; |
8 | extern void shmobile_setup_console(void); | 9 | extern void shmobile_setup_console(void); |
9 | extern void shmobile_boot_vector(void); | 10 | extern void shmobile_boot_vector(void); |
diff --git a/arch/arm/mach-shmobile/timer.c b/arch/arm/mach-shmobile/timer.c index 62d7052d6f21..ccecde9a3362 100644 --- a/arch/arm/mach-shmobile/timer.c +++ b/arch/arm/mach-shmobile/timer.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/clocksource.h> | 22 | #include <linux/clocksource.h> |
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/of_address.h> | ||
24 | 25 | ||
25 | void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz, | 26 | void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz, |
26 | unsigned int mult, unsigned int div) | 27 | unsigned int mult, unsigned int div) |
@@ -39,6 +40,33 @@ void __init shmobile_setup_delay(unsigned int max_cpu_core_mhz, | |||
39 | preset_lpj = max_cpu_core_mhz * value; | 40 | preset_lpj = max_cpu_core_mhz * value; |
40 | } | 41 | } |
41 | 42 | ||
43 | void __init shmobile_init_delay(void) | ||
44 | { | ||
45 | struct device_node *np, *parent; | ||
46 | u32 max_freq, freq; | ||
47 | |||
48 | max_freq = 0; | ||
49 | |||
50 | parent = of_find_node_by_path("/cpus"); | ||
51 | if (parent) { | ||
52 | for_each_child_of_node(parent, np) { | ||
53 | if (!of_property_read_u32(np, "clock-frequency", &freq)) | ||
54 | max_freq = max(max_freq, freq); | ||
55 | } | ||
56 | of_node_put(parent); | ||
57 | } | ||
58 | |||
59 | if (max_freq) { | ||
60 | if (of_find_compatible_node(NULL, NULL, "arm,cortex-a8")) | ||
61 | shmobile_setup_delay(max_freq, 1, 3); | ||
62 | else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9")) | ||
63 | shmobile_setup_delay(max_freq, 1, 3); | ||
64 | else if (of_find_compatible_node(NULL, NULL, "arm,cortex-a15")) | ||
65 | if (!IS_ENABLED(CONFIG_ARM_ARCH_TIMER)) | ||
66 | shmobile_setup_delay(max_freq, 2, 4); | ||
67 | } | ||
68 | } | ||
69 | |||
42 | static void __init shmobile_late_time_init(void) | 70 | static void __init shmobile_late_time_init(void) |
43 | { | 71 | { |
44 | /* | 72 | /* |