Thomas Gleixner | 9c92ab6 | 2019-05-29 07:17:56 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Stephen Boyd | dd15ab8 | 2011-11-08 10:34:05 -0800 | [diff] [blame] | 2 | /* |
Arve Hjønnevåg | 3e4ea37 | 2007-11-26 04:11:58 -0800 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2007 Google, Inc. |
Kumar Gala | 3f8e8ce | 2014-01-29 16:17:30 -0600 | [diff] [blame] | 5 | * Copyright (c) 2009-2012,2014, The Linux Foundation. All rights reserved. |
Arve Hjønnevåg | 3e4ea37 | 2007-11-26 04:11:58 -0800 | [diff] [blame] | 6 | */ |
| 7 | |
Stephen Boyd | 4a18407 | 2011-11-08 10:34:04 -0800 | [diff] [blame] | 8 | #include <linux/clocksource.h> |
| 9 | #include <linux/clockchips.h> |
Stephen Boyd | 4d70c59 | 2013-02-15 17:31:31 -0800 | [diff] [blame] | 10 | #include <linux/cpu.h> |
Arve Hjønnevåg | 3e4ea37 | 2007-11-26 04:11:58 -0800 | [diff] [blame] | 11 | #include <linux/init.h> |
Arve Hjønnevåg | 3e4ea37 | 2007-11-26 04:11:58 -0800 | [diff] [blame] | 12 | #include <linux/interrupt.h> |
| 13 | #include <linux/irq.h> |
Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 14 | #include <linux/io.h> |
Stephen Boyd | 6e33216 | 2012-09-05 12:28:53 -0700 | [diff] [blame] | 15 | #include <linux/of.h> |
| 16 | #include <linux/of_address.h> |
| 17 | #include <linux/of_irq.h> |
Stephen Boyd | 38ff87f | 2013-06-01 23:39:40 -0700 | [diff] [blame] | 18 | #include <linux/sched_clock.h> |
Arve Hjønnevåg | 3e4ea37 | 2007-11-26 04:11:58 -0800 | [diff] [blame] | 19 | |
Stephen Boyd | 013be5a | 2014-05-13 16:01:00 -0700 | [diff] [blame] | 20 | #include <asm/delay.h> |
| 21 | |
Stephen Boyd | e25e3d1 | 2013-03-14 20:31:39 -0700 | [diff] [blame] | 22 | #define TIMER_MATCH_VAL 0x0000 |
| 23 | #define TIMER_COUNT_VAL 0x0004 |
| 24 | #define TIMER_ENABLE 0x0008 |
| 25 | #define TIMER_ENABLE_CLR_ON_MATCH_EN BIT(1) |
| 26 | #define TIMER_ENABLE_EN BIT(0) |
| 27 | #define TIMER_CLEAR 0x000C |
| 28 | #define DGT_CLK_CTL 0x10 |
| 29 | #define DGT_CLK_CTL_DIV_4 0x3 |
| 30 | #define TIMER_STS_GPT0_CLR_PEND BIT(10) |
Arve Hjønnevåg | 3e4ea37 | 2007-11-26 04:11:58 -0800 | [diff] [blame] | 31 | |
| 32 | #define GPT_HZ 32768 |
Jeff Ohlstein | 672039f | 2010-10-05 15:23:57 -0700 | [diff] [blame] | 33 | |
Stephen Boyd | 2a00c10 | 2011-11-08 10:34:07 -0800 | [diff] [blame] | 34 | static void __iomem *event_base; |
Stephen Boyd | e25e3d1 | 2013-03-14 20:31:39 -0700 | [diff] [blame] | 35 | static void __iomem *sts_base; |
Stephen Boyd | a850c3f | 2011-11-08 10:34:06 -0800 | [diff] [blame] | 36 | |
Arve Hjønnevåg | 3e4ea37 | 2007-11-26 04:11:58 -0800 | [diff] [blame] | 37 | static irqreturn_t msm_timer_interrupt(int irq, void *dev_id) |
| 38 | { |
Stephen Boyd | 4d70c59 | 2013-02-15 17:31:31 -0800 | [diff] [blame] | 39 | struct clock_event_device *evt = dev_id; |
Stephen Boyd | a850c3f | 2011-11-08 10:34:06 -0800 | [diff] [blame] | 40 | /* Stop the timer tick */ |
Viresh Kumar | 736b2df | 2015-06-18 16:24:31 +0530 | [diff] [blame] | 41 | if (clockevent_state_oneshot(evt)) { |
Stephen Boyd | 2a00c10 | 2011-11-08 10:34:07 -0800 | [diff] [blame] | 42 | u32 ctrl = readl_relaxed(event_base + TIMER_ENABLE); |
Stephen Boyd | a850c3f | 2011-11-08 10:34:06 -0800 | [diff] [blame] | 43 | ctrl &= ~TIMER_ENABLE_EN; |
Stephen Boyd | 2a00c10 | 2011-11-08 10:34:07 -0800 | [diff] [blame] | 44 | writel_relaxed(ctrl, event_base + TIMER_ENABLE); |
Stephen Boyd | a850c3f | 2011-11-08 10:34:06 -0800 | [diff] [blame] | 45 | } |
Arve Hjønnevåg | 3e4ea37 | 2007-11-26 04:11:58 -0800 | [diff] [blame] | 46 | evt->event_handler(evt); |
| 47 | return IRQ_HANDLED; |
| 48 | } |
| 49 | |
Arve Hjønnevåg | 3e4ea37 | 2007-11-26 04:11:58 -0800 | [diff] [blame] | 50 | static int msm_timer_set_next_event(unsigned long cycles, |
| 51 | struct clock_event_device *evt) |
| 52 | { |
Stephen Boyd | 2a00c10 | 2011-11-08 10:34:07 -0800 | [diff] [blame] | 53 | u32 ctrl = readl_relaxed(event_base + TIMER_ENABLE); |
Arve Hjønnevåg | 3e4ea37 | 2007-11-26 04:11:58 -0800 | [diff] [blame] | 54 | |
Stephen Boyd | 4080d2d | 2013-03-14 20:31:37 -0700 | [diff] [blame] | 55 | ctrl &= ~TIMER_ENABLE_EN; |
| 56 | writel_relaxed(ctrl, event_base + TIMER_ENABLE); |
| 57 | |
| 58 | writel_relaxed(ctrl, event_base + TIMER_CLEAR); |
Stephen Boyd | 2a00c10 | 2011-11-08 10:34:07 -0800 | [diff] [blame] | 59 | writel_relaxed(cycles, event_base + TIMER_MATCH_VAL); |
Stephen Boyd | e25e3d1 | 2013-03-14 20:31:39 -0700 | [diff] [blame] | 60 | |
| 61 | if (sts_base) |
| 62 | while (readl_relaxed(sts_base) & TIMER_STS_GPT0_CLR_PEND) |
| 63 | cpu_relax(); |
| 64 | |
Stephen Boyd | 2a00c10 | 2011-11-08 10:34:07 -0800 | [diff] [blame] | 65 | writel_relaxed(ctrl | TIMER_ENABLE_EN, event_base + TIMER_ENABLE); |
Arve Hjønnevåg | 3e4ea37 | 2007-11-26 04:11:58 -0800 | [diff] [blame] | 66 | return 0; |
| 67 | } |
| 68 | |
Viresh Kumar | 736b2df | 2015-06-18 16:24:31 +0530 | [diff] [blame] | 69 | static int msm_timer_shutdown(struct clock_event_device *evt) |
Arve Hjønnevåg | 3e4ea37 | 2007-11-26 04:11:58 -0800 | [diff] [blame] | 70 | { |
Stephen Boyd | a850c3f | 2011-11-08 10:34:06 -0800 | [diff] [blame] | 71 | u32 ctrl; |
| 72 | |
Stephen Boyd | 2a00c10 | 2011-11-08 10:34:07 -0800 | [diff] [blame] | 73 | ctrl = readl_relaxed(event_base + TIMER_ENABLE); |
Stephen Boyd | a850c3f | 2011-11-08 10:34:06 -0800 | [diff] [blame] | 74 | ctrl &= ~(TIMER_ENABLE_EN | TIMER_ENABLE_CLR_ON_MATCH_EN); |
Stephen Boyd | 2a00c10 | 2011-11-08 10:34:07 -0800 | [diff] [blame] | 75 | writel_relaxed(ctrl, event_base + TIMER_ENABLE); |
Viresh Kumar | 736b2df | 2015-06-18 16:24:31 +0530 | [diff] [blame] | 76 | return 0; |
Arve Hjønnevåg | 3e4ea37 | 2007-11-26 04:11:58 -0800 | [diff] [blame] | 77 | } |
| 78 | |
Stephen Boyd | 4d70c59 | 2013-02-15 17:31:31 -0800 | [diff] [blame] | 79 | static struct clock_event_device __percpu *msm_evt; |
Stephen Boyd | 2a00c10 | 2011-11-08 10:34:07 -0800 | [diff] [blame] | 80 | |
| 81 | static void __iomem *source_base; |
| 82 | |
Thomas Gleixner | a5a1d1c | 2016-12-21 20:32:01 +0100 | [diff] [blame] | 83 | static notrace u64 msm_read_timer_count(struct clocksource *cs) |
Stephen Boyd | 2a00c10 | 2011-11-08 10:34:07 -0800 | [diff] [blame] | 84 | { |
Stephen Boyd | 2081a6b | 2011-11-08 10:34:08 -0800 | [diff] [blame] | 85 | return readl_relaxed(source_base + TIMER_COUNT_VAL); |
| 86 | } |
| 87 | |
Stephen Boyd | 2a00c10 | 2011-11-08 10:34:07 -0800 | [diff] [blame] | 88 | static struct clocksource msm_clocksource = { |
| 89 | .name = "dg_timer", |
| 90 | .rating = 300, |
| 91 | .read = msm_read_timer_count, |
Stephen Boyd | 2081a6b | 2011-11-08 10:34:08 -0800 | [diff] [blame] | 92 | .mask = CLOCKSOURCE_MASK(32), |
Stephen Boyd | 2a00c10 | 2011-11-08 10:34:07 -0800 | [diff] [blame] | 93 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
Arve Hjønnevåg | 3e4ea37 | 2007-11-26 04:11:58 -0800 | [diff] [blame] | 94 | }; |
| 95 | |
Stephen Boyd | 4d70c59 | 2013-02-15 17:31:31 -0800 | [diff] [blame] | 96 | static int msm_timer_irq; |
| 97 | static int msm_timer_has_ppi; |
| 98 | |
Richard Cochran | b040416 | 2016-07-13 17:16:43 +0000 | [diff] [blame] | 99 | static int msm_local_timer_starting_cpu(unsigned int cpu) |
Marc Zyngier | 5ca709c | 2012-01-10 19:44:19 +0000 | [diff] [blame] | 100 | { |
Richard Cochran | b040416 | 2016-07-13 17:16:43 +0000 | [diff] [blame] | 101 | struct clock_event_device *evt = per_cpu_ptr(msm_evt, cpu); |
Stephen Boyd | 4d70c59 | 2013-02-15 17:31:31 -0800 | [diff] [blame] | 102 | int err; |
Marc Zyngier | 5ca709c | 2012-01-10 19:44:19 +0000 | [diff] [blame] | 103 | |
Stephen Boyd | 4d70c59 | 2013-02-15 17:31:31 -0800 | [diff] [blame] | 104 | evt->irq = msm_timer_irq; |
| 105 | evt->name = "msm_timer"; |
| 106 | evt->features = CLOCK_EVT_FEAT_ONESHOT; |
| 107 | evt->rating = 200; |
Viresh Kumar | 736b2df | 2015-06-18 16:24:31 +0530 | [diff] [blame] | 108 | evt->set_state_shutdown = msm_timer_shutdown; |
| 109 | evt->set_state_oneshot = msm_timer_shutdown; |
| 110 | evt->tick_resume = msm_timer_shutdown; |
Marc Zyngier | 5ca709c | 2012-01-10 19:44:19 +0000 | [diff] [blame] | 111 | evt->set_next_event = msm_timer_set_next_event; |
Stephen Boyd | 4d70c59 | 2013-02-15 17:31:31 -0800 | [diff] [blame] | 112 | evt->cpumask = cpumask_of(cpu); |
Marc Zyngier | 5ca709c | 2012-01-10 19:44:19 +0000 | [diff] [blame] | 113 | |
Stephen Boyd | 4d70c59 | 2013-02-15 17:31:31 -0800 | [diff] [blame] | 114 | clockevents_config_and_register(evt, GPT_HZ, 4, 0xffffffff); |
| 115 | |
| 116 | if (msm_timer_has_ppi) { |
| 117 | enable_percpu_irq(evt->irq, IRQ_TYPE_EDGE_RISING); |
| 118 | } else { |
| 119 | err = request_irq(evt->irq, msm_timer_interrupt, |
| 120 | IRQF_TIMER | IRQF_NOBALANCING | |
| 121 | IRQF_TRIGGER_RISING, "gp_timer", evt); |
| 122 | if (err) |
| 123 | pr_err("request_irq failed\n"); |
| 124 | } |
| 125 | |
Marc Zyngier | 5ca709c | 2012-01-10 19:44:19 +0000 | [diff] [blame] | 126 | return 0; |
| 127 | } |
| 128 | |
Richard Cochran | b040416 | 2016-07-13 17:16:43 +0000 | [diff] [blame] | 129 | static int msm_local_timer_dying_cpu(unsigned int cpu) |
Marc Zyngier | 5ca709c | 2012-01-10 19:44:19 +0000 | [diff] [blame] | 130 | { |
Richard Cochran | b040416 | 2016-07-13 17:16:43 +0000 | [diff] [blame] | 131 | struct clock_event_device *evt = per_cpu_ptr(msm_evt, cpu); |
| 132 | |
Viresh Kumar | 736b2df | 2015-06-18 16:24:31 +0530 | [diff] [blame] | 133 | evt->set_state_shutdown(evt); |
Marc Zyngier | 5ca709c | 2012-01-10 19:44:19 +0000 | [diff] [blame] | 134 | disable_percpu_irq(evt->irq); |
Richard Cochran | b040416 | 2016-07-13 17:16:43 +0000 | [diff] [blame] | 135 | return 0; |
Marc Zyngier | 5ca709c | 2012-01-10 19:44:19 +0000 | [diff] [blame] | 136 | } |
| 137 | |
Stephen Boyd | 6aa16a2 | 2013-11-15 15:26:16 -0800 | [diff] [blame] | 138 | static u64 notrace msm_sched_clock_read(void) |
Stephen Boyd | f8e56c4 | 2012-02-22 01:39:37 +0000 | [diff] [blame] | 139 | { |
| 140 | return msm_clocksource.read(&msm_clocksource); |
| 141 | } |
| 142 | |
Stephen Boyd | 013be5a | 2014-05-13 16:01:00 -0700 | [diff] [blame] | 143 | static unsigned long msm_read_current_timer(void) |
| 144 | { |
| 145 | return msm_clocksource.read(&msm_clocksource); |
| 146 | } |
| 147 | |
| 148 | static struct delay_timer msm_delay_timer = { |
| 149 | .read_current_timer = msm_read_current_timer, |
| 150 | }; |
| 151 | |
Daniel Lezcano | ab51189 | 2016-06-06 17:58:43 +0200 | [diff] [blame] | 152 | static int __init msm_timer_init(u32 dgt_hz, int sched_bits, int irq, |
Stephen Boyd | 4312a7e | 2012-09-05 12:28:52 -0700 | [diff] [blame] | 153 | bool percpu) |
Arve Hjønnevåg | 3e4ea37 | 2007-11-26 04:11:58 -0800 | [diff] [blame] | 154 | { |
Stephen Boyd | 2a00c10 | 2011-11-08 10:34:07 -0800 | [diff] [blame] | 155 | struct clocksource *cs = &msm_clocksource; |
Stephen Boyd | 4d70c59 | 2013-02-15 17:31:31 -0800 | [diff] [blame] | 156 | int res = 0; |
Arve Hjønnevåg | 3e4ea37 | 2007-11-26 04:11:58 -0800 | [diff] [blame] | 157 | |
Stephen Boyd | 4d70c59 | 2013-02-15 17:31:31 -0800 | [diff] [blame] | 158 | msm_timer_irq = irq; |
| 159 | msm_timer_has_ppi = percpu; |
David Brown | 8c27e6f | 2011-01-07 10:20:49 -0800 | [diff] [blame] | 160 | |
Stephen Boyd | 4d70c59 | 2013-02-15 17:31:31 -0800 | [diff] [blame] | 161 | msm_evt = alloc_percpu(struct clock_event_device); |
| 162 | if (!msm_evt) { |
| 163 | pr_err("memory allocation failed for clockevents\n"); |
| 164 | goto err; |
Arve Hjønnevåg | 3e4ea37 | 2007-11-26 04:11:58 -0800 | [diff] [blame] | 165 | } |
Stephen Boyd | dd15ab8 | 2011-11-08 10:34:05 -0800 | [diff] [blame] | 166 | |
Stephen Boyd | 4d70c59 | 2013-02-15 17:31:31 -0800 | [diff] [blame] | 167 | if (percpu) |
| 168 | res = request_percpu_irq(irq, msm_timer_interrupt, |
| 169 | "gp_timer", msm_evt); |
| 170 | |
| 171 | if (res) { |
| 172 | pr_err("request_percpu_irq failed\n"); |
| 173 | } else { |
Richard Cochran | b040416 | 2016-07-13 17:16:43 +0000 | [diff] [blame] | 174 | /* Install and invoke hotplug callbacks */ |
| 175 | res = cpuhp_setup_state(CPUHP_AP_QCOM_TIMER_STARTING, |
Thomas Gleixner | 73c1b41 | 2016-12-21 20:19:54 +0100 | [diff] [blame] | 176 | "clockevents/qcom/timer:starting", |
Richard Cochran | b040416 | 2016-07-13 17:16:43 +0000 | [diff] [blame] | 177 | msm_local_timer_starting_cpu, |
| 178 | msm_local_timer_dying_cpu); |
Stephen Boyd | 4d70c59 | 2013-02-15 17:31:31 -0800 | [diff] [blame] | 179 | if (res) { |
| 180 | free_percpu_irq(irq, msm_evt); |
| 181 | goto err; |
| 182 | } |
Stephen Boyd | 4d70c59 | 2013-02-15 17:31:31 -0800 | [diff] [blame] | 183 | } |
| 184 | |
Stephen Boyd | dd15ab8 | 2011-11-08 10:34:05 -0800 | [diff] [blame] | 185 | err: |
Stephen Boyd | 2a00c10 | 2011-11-08 10:34:07 -0800 | [diff] [blame] | 186 | writel_relaxed(TIMER_ENABLE_EN, source_base + TIMER_ENABLE); |
Stephen Boyd | 2081a6b | 2011-11-08 10:34:08 -0800 | [diff] [blame] | 187 | res = clocksource_register_hz(cs, dgt_hz); |
Stephen Boyd | dd15ab8 | 2011-11-08 10:34:05 -0800 | [diff] [blame] | 188 | if (res) |
Stephen Boyd | 2a00c10 | 2011-11-08 10:34:07 -0800 | [diff] [blame] | 189 | pr_err("clocksource_register failed\n"); |
Stephen Boyd | 6aa16a2 | 2013-11-15 15:26:16 -0800 | [diff] [blame] | 190 | sched_clock_register(msm_sched_clock_read, sched_bits, dgt_hz); |
Stephen Boyd | 013be5a | 2014-05-13 16:01:00 -0700 | [diff] [blame] | 191 | msm_delay_timer.freq = dgt_hz; |
| 192 | register_current_timer_delay(&msm_delay_timer); |
Daniel Lezcano | ab51189 | 2016-06-06 17:58:43 +0200 | [diff] [blame] | 193 | |
| 194 | return res; |
Arve Hjønnevåg | 3e4ea37 | 2007-11-26 04:11:58 -0800 | [diff] [blame] | 195 | } |
| 196 | |
Daniel Lezcano | ab51189 | 2016-06-06 17:58:43 +0200 | [diff] [blame] | 197 | static int __init msm_dt_timer_init(struct device_node *np) |
Stephen Boyd | 6e33216 | 2012-09-05 12:28:53 -0700 | [diff] [blame] | 198 | { |
Stephen Boyd | 6e33216 | 2012-09-05 12:28:53 -0700 | [diff] [blame] | 199 | u32 freq; |
Daniel Lezcano | ab51189 | 2016-06-06 17:58:43 +0200 | [diff] [blame] | 200 | int irq, ret; |
Stephen Boyd | 6e33216 | 2012-09-05 12:28:53 -0700 | [diff] [blame] | 201 | struct resource res; |
| 202 | u32 percpu_offset; |
Stephen Boyd | eebdb0c | 2013-03-14 20:31:38 -0700 | [diff] [blame] | 203 | void __iomem *base; |
| 204 | void __iomem *cpu0_base; |
Stephen Boyd | 6e33216 | 2012-09-05 12:28:53 -0700 | [diff] [blame] | 205 | |
Stephen Boyd | eebdb0c | 2013-03-14 20:31:38 -0700 | [diff] [blame] | 206 | base = of_iomap(np, 0); |
| 207 | if (!base) { |
Stephen Boyd | 6e33216 | 2012-09-05 12:28:53 -0700 | [diff] [blame] | 208 | pr_err("Failed to map event base\n"); |
Daniel Lezcano | ab51189 | 2016-06-06 17:58:43 +0200 | [diff] [blame] | 209 | return -ENXIO; |
Stephen Boyd | 6e33216 | 2012-09-05 12:28:53 -0700 | [diff] [blame] | 210 | } |
| 211 | |
Stephen Boyd | eebdb0c | 2013-03-14 20:31:38 -0700 | [diff] [blame] | 212 | /* We use GPT0 for the clockevent */ |
| 213 | irq = irq_of_parse_and_map(np, 1); |
Stephen Boyd | 6e33216 | 2012-09-05 12:28:53 -0700 | [diff] [blame] | 214 | if (irq <= 0) { |
| 215 | pr_err("Can't get irq\n"); |
Daniel Lezcano | ab51189 | 2016-06-06 17:58:43 +0200 | [diff] [blame] | 216 | return -EINVAL; |
Stephen Boyd | 6e33216 | 2012-09-05 12:28:53 -0700 | [diff] [blame] | 217 | } |
Stephen Boyd | 6e33216 | 2012-09-05 12:28:53 -0700 | [diff] [blame] | 218 | |
Stephen Boyd | eebdb0c | 2013-03-14 20:31:38 -0700 | [diff] [blame] | 219 | /* We use CPU0's DGT for the clocksource */ |
Stephen Boyd | 6e33216 | 2012-09-05 12:28:53 -0700 | [diff] [blame] | 220 | if (of_property_read_u32(np, "cpu-offset", &percpu_offset)) |
| 221 | percpu_offset = 0; |
| 222 | |
Daniel Lezcano | ab51189 | 2016-06-06 17:58:43 +0200 | [diff] [blame] | 223 | ret = of_address_to_resource(np, 0, &res); |
| 224 | if (ret) { |
Stephen Boyd | 6e33216 | 2012-09-05 12:28:53 -0700 | [diff] [blame] | 225 | pr_err("Failed to parse DGT resource\n"); |
Daniel Lezcano | ab51189 | 2016-06-06 17:58:43 +0200 | [diff] [blame] | 226 | return ret; |
Stephen Boyd | 6e33216 | 2012-09-05 12:28:53 -0700 | [diff] [blame] | 227 | } |
| 228 | |
Stephen Boyd | eebdb0c | 2013-03-14 20:31:38 -0700 | [diff] [blame] | 229 | cpu0_base = ioremap(res.start + percpu_offset, resource_size(&res)); |
| 230 | if (!cpu0_base) { |
Stephen Boyd | 6e33216 | 2012-09-05 12:28:53 -0700 | [diff] [blame] | 231 | pr_err("Failed to map source base\n"); |
Daniel Lezcano | ab51189 | 2016-06-06 17:58:43 +0200 | [diff] [blame] | 232 | return -EINVAL; |
Stephen Boyd | 6e33216 | 2012-09-05 12:28:53 -0700 | [diff] [blame] | 233 | } |
| 234 | |
Stephen Boyd | 6e33216 | 2012-09-05 12:28:53 -0700 | [diff] [blame] | 235 | if (of_property_read_u32(np, "clock-frequency", &freq)) { |
| 236 | pr_err("Unknown frequency\n"); |
Daniel Lezcano | ab51189 | 2016-06-06 17:58:43 +0200 | [diff] [blame] | 237 | return -EINVAL; |
Stephen Boyd | 6e33216 | 2012-09-05 12:28:53 -0700 | [diff] [blame] | 238 | } |
Stephen Boyd | 6e33216 | 2012-09-05 12:28:53 -0700 | [diff] [blame] | 239 | |
Stephen Boyd | eebdb0c | 2013-03-14 20:31:38 -0700 | [diff] [blame] | 240 | event_base = base + 0x4; |
Stephen Boyd | e25e3d1 | 2013-03-14 20:31:39 -0700 | [diff] [blame] | 241 | sts_base = base + 0x88; |
Stephen Boyd | eebdb0c | 2013-03-14 20:31:38 -0700 | [diff] [blame] | 242 | source_base = cpu0_base + 0x24; |
| 243 | freq /= 4; |
| 244 | writel_relaxed(DGT_CLK_CTL_DIV_4, source_base + DGT_CLK_CTL); |
| 245 | |
Daniel Lezcano | ab51189 | 2016-06-06 17:58:43 +0200 | [diff] [blame] | 246 | return msm_timer_init(freq, 32, irq, !!percpu_offset); |
Stephen Boyd | 6e33216 | 2012-09-05 12:28:53 -0700 | [diff] [blame] | 247 | } |
Daniel Lezcano | 1727339 | 2017-05-26 16:56:11 +0200 | [diff] [blame] | 248 | TIMER_OF_DECLARE(kpss_timer, "qcom,kpss-timer", msm_dt_timer_init); |
| 249 | TIMER_OF_DECLARE(scss_timer, "qcom,scss-timer", msm_dt_timer_init); |