27 #define NV04_PTIMER_INTR_0 0x009100
28 #define NV04_PTIMER_INTR_EN_0 0x009140
29 #define NV04_PTIMER_NUMERATOR 0x009200
30 #define NV04_PTIMER_DENOMINATOR 0x009210
31 #define NV04_PTIMER_TIME_0 0x009400
32 #define NV04_PTIMER_TIME_1 0x009410
33 #define NV04_PTIMER_ALARM_0 0x009420
52 return ((
u64)hi << 32 | lo);
71 if (!list_empty(&priv->
alarms)) {
78 spin_unlock_irqrestore(&priv->
lock, flags);
104 spin_unlock_irqrestore(&priv->
lock, flags);
107 nv04_timer_alarm_trigger(ptimer);
116 if (stat & 0x00000001) {
117 nv04_timer_alarm_trigger(&priv->
base);
123 nv_error(priv,
"unknown stat 0x%08x\n", stat);
137 *pobject = nv_object(priv);
141 priv->
base.base.intr = nv04_timer_intr;
142 priv->
base.read = nv04_timer_read;
143 priv->
base.alarm = nv04_timer_alarm;
145 INIT_LIST_HEAD(&priv->
alarms);
185 while (n < (d * 2)) {
190 nv_wr32(priv, 0x009220, m - 1);
194 nv_warn(priv,
"unknown input clock freq\n");
204 while (((n % 5) == 0) && ((d % 5) == 0)) {
209 while (((n % 2) == 0) && ((d % 2) == 0)) {
214 while (n > 0xffff || d > 0xffff) {
219 nv_debug(priv,
"input frequency : %dHz\n",
f);
220 nv_debug(priv,
"input multiplier: %d\n", m);
221 nv_debug(priv,
"numerator : 0x%08x\n", n);
222 nv_debug(priv,
"denominator : 0x%08x\n", d);
223 nv_debug(priv,
"timer frequency : %dHz\n", (
f * m) * d / n);
244 .ctor = nv04_timer_ctor,
245 .dtor = nv04_timer_dtor,
246 .init = nv04_timer_init,
247 .fini = nv04_timer_fini,