diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2017-02-01 06:53:46 -0500 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2017-04-07 06:22:09 -0400 |
commit | 992dd16f6528bd3f378dbcda43688d374be02943 (patch) | |
tree | e4db189dec550b8a0561beac41d553c31e3d529e /drivers/clocksource/arm_arch_timer.c | |
parent | 6acc71ccac7187fc0ef85f10bd09c2058f21fab5 (diff) |
arm64: arch_timer: Move clocksource_counter and co around
In order to access clocksource_counter from the errata handling code,
move it (together with the related structures and functions) towards
the top of the file.
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'drivers/clocksource/arm_arch_timer.c')
-rw-r--r-- | drivers/clocksource/arm_arch_timer.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 4551587bcb44..395f5d95a737 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c | |||
@@ -158,6 +158,37 @@ u32 arch_timer_reg_read(int access, enum arch_timer_reg reg, | |||
158 | return val; | 158 | return val; |
159 | } | 159 | } |
160 | 160 | ||
161 | /* | ||
162 | * Default to cp15 based access because arm64 uses this function for | ||
163 | * sched_clock() before DT is probed and the cp15 method is guaranteed | ||
164 | * to exist on arm64. arm doesn't use this before DT is probed so even | ||
165 | * if we don't have the cp15 accessors we won't have a problem. | ||
166 | */ | ||
167 | u64 (*arch_timer_read_counter)(void) = arch_counter_get_cntvct; | ||
168 | |||
169 | static u64 arch_counter_read(struct clocksource *cs) | ||
170 | { | ||
171 | return arch_timer_read_counter(); | ||
172 | } | ||
173 | |||
174 | static u64 arch_counter_read_cc(const struct cyclecounter *cc) | ||
175 | { | ||
176 | return arch_timer_read_counter(); | ||
177 | } | ||
178 | |||
179 | static struct clocksource clocksource_counter = { | ||
180 | .name = "arch_sys_counter", | ||
181 | .rating = 400, | ||
182 | .read = arch_counter_read, | ||
183 | .mask = CLOCKSOURCE_MASK(56), | ||
184 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | ||
185 | }; | ||
186 | |||
187 | static struct cyclecounter cyclecounter __ro_after_init = { | ||
188 | .read = arch_counter_read_cc, | ||
189 | .mask = CLOCKSOURCE_MASK(56), | ||
190 | }; | ||
191 | |||
161 | #ifdef CONFIG_FSL_ERRATUM_A008585 | 192 | #ifdef CONFIG_FSL_ERRATUM_A008585 |
162 | /* | 193 | /* |
163 | * The number of retries is an arbitrary value well beyond the highest number | 194 | * The number of retries is an arbitrary value well beyond the highest number |
@@ -742,37 +773,6 @@ static u64 arch_counter_get_cntvct_mem(void) | |||
742 | return ((u64) vct_hi << 32) | vct_lo; | 773 | return ((u64) vct_hi << 32) | vct_lo; |
743 | } | 774 | } |
744 | 775 | ||
745 | /* | ||
746 | * Default to cp15 based access because arm64 uses this function for | ||
747 | * sched_clock() before DT is probed and the cp15 method is guaranteed | ||
748 | * to exist on arm64. arm doesn't use this before DT is probed so even | ||
749 | * if we don't have the cp15 accessors we won't have a problem. | ||
750 | */ | ||
751 | u64 (*arch_timer_read_counter)(void) = arch_counter_get_cntvct; | ||
752 | |||
753 | static u64 arch_counter_read(struct clocksource *cs) | ||
754 | { | ||
755 | return arch_timer_read_counter(); | ||
756 | } | ||
757 | |||
758 | static u64 arch_counter_read_cc(const struct cyclecounter *cc) | ||
759 | { | ||
760 | return arch_timer_read_counter(); | ||
761 | } | ||
762 | |||
763 | static struct clocksource clocksource_counter = { | ||
764 | .name = "arch_sys_counter", | ||
765 | .rating = 400, | ||
766 | .read = arch_counter_read, | ||
767 | .mask = CLOCKSOURCE_MASK(56), | ||
768 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | ||
769 | }; | ||
770 | |||
771 | static struct cyclecounter cyclecounter __ro_after_init = { | ||
772 | .read = arch_counter_read_cc, | ||
773 | .mask = CLOCKSOURCE_MASK(56), | ||
774 | }; | ||
775 | |||
776 | static struct arch_timer_kvm_info arch_timer_kvm_info; | 776 | static struct arch_timer_kvm_info arch_timer_kvm_info; |
777 | 777 | ||
778 | struct arch_timer_kvm_info *arch_timer_get_kvm_info(void) | 778 | struct arch_timer_kvm_info *arch_timer_get_kvm_info(void) |