diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2011-06-01 08:44:16 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2011-06-23 06:10:53 -0400 |
commit | ef7a474cef00594ccef432ce0840464e51ea4ac0 (patch) | |
tree | d8b9798b2eb13d50d3a461f20c53b28155aff4ab /arch/arm/mach-ux500/clock.c | |
parent | 32d55ff91635c22dc853c532ec85dc16663d251f (diff) |
mach-ux500: register a clock for the SMP TWD
The SMP TWD on the ux500 will change frequency at the same time as
the CPU. Loop back the frequency presented from the CPU into a
clock that is looked up by the SMP TWD driver with the new cpufreq
notifier hook.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/arm/mach-ux500/clock.c')
-rw-r--r-- | arch/arm/mach-ux500/clock.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/arch/arm/mach-ux500/clock.c b/arch/arm/mach-ux500/clock.c index 32ce90840ee1..b4e786a0fa4f 100644 --- a/arch/arm/mach-ux500/clock.c +++ b/arch/arm/mach-ux500/clock.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/clk.h> | 14 | #include <linux/clk.h> |
15 | #include <linux/io.h> | 15 | #include <linux/io.h> |
16 | #include <linux/clkdev.h> | 16 | #include <linux/clkdev.h> |
17 | #include <linux/cpufreq.h> | ||
17 | 18 | ||
18 | #include <plat/mtu.h> | 19 | #include <plat/mtu.h> |
19 | #include <mach/hardware.h> | 20 | #include <mach/hardware.h> |
@@ -759,6 +760,51 @@ err_out: | |||
759 | late_initcall(clk_debugfs_init); | 760 | late_initcall(clk_debugfs_init); |
760 | #endif /* defined(CONFIG_DEBUG_FS) */ | 761 | #endif /* defined(CONFIG_DEBUG_FS) */ |
761 | 762 | ||
763 | unsigned long clk_smp_twd_rate = 400000000; | ||
764 | |||
765 | unsigned long clk_smp_twd_get_rate(struct clk *clk) | ||
766 | { | ||
767 | return clk_smp_twd_rate; | ||
768 | } | ||
769 | |||
770 | static struct clk clk_smp_twd = { | ||
771 | .get_rate = clk_smp_twd_get_rate, | ||
772 | .name = "smp_twd", | ||
773 | }; | ||
774 | |||
775 | static struct clk_lookup clk_smp_twd_lookup = { | ||
776 | .dev_id = "smp_twd", | ||
777 | .clk = &clk_smp_twd, | ||
778 | }; | ||
779 | |||
780 | #ifdef CONFIG_CPU_FREQ | ||
781 | |||
782 | static int clk_twd_cpufreq_transition(struct notifier_block *nb, | ||
783 | unsigned long state, void *data) | ||
784 | { | ||
785 | struct cpufreq_freqs *f = data; | ||
786 | |||
787 | if (state == CPUFREQ_PRECHANGE) { | ||
788 | /* Save frequency in simple Hz */ | ||
789 | clk_smp_twd_rate = f->new * 1000; | ||
790 | } | ||
791 | |||
792 | return NOTIFY_OK; | ||
793 | } | ||
794 | |||
795 | static struct notifier_block clk_twd_cpufreq_nb = { | ||
796 | .notifier_call = clk_twd_cpufreq_transition, | ||
797 | }; | ||
798 | |||
799 | static int clk_init_smp_twd_cpufreq(void) | ||
800 | { | ||
801 | return cpufreq_register_notifier(&clk_twd_cpufreq_nb, | ||
802 | CPUFREQ_TRANSITION_NOTIFIER); | ||
803 | } | ||
804 | late_initcall(clk_init_smp_twd_cpufreq); | ||
805 | |||
806 | #endif | ||
807 | |||
762 | int __init clk_init(void) | 808 | int __init clk_init(void) |
763 | { | 809 | { |
764 | if (cpu_is_u8500ed()) { | 810 | if (cpu_is_u8500ed()) { |
@@ -779,6 +825,8 @@ int __init clk_init(void) | |||
779 | else | 825 | else |
780 | clkdev_add_table(u8500_v1_clks, ARRAY_SIZE(u8500_v1_clks)); | 826 | clkdev_add_table(u8500_v1_clks, ARRAY_SIZE(u8500_v1_clks)); |
781 | 827 | ||
828 | clkdev_add(&clk_smp_twd_lookup); | ||
829 | |||
782 | #ifdef CONFIG_DEBUG_FS | 830 | #ifdef CONFIG_DEBUG_FS |
783 | clk_debugfs_add_table(u8500_common_clks, ARRAY_SIZE(u8500_common_clks)); | 831 | clk_debugfs_add_table(u8500_common_clks, ARRAY_SIZE(u8500_common_clks)); |
784 | if (cpu_is_u8500ed()) | 832 | if (cpu_is_u8500ed()) |