20 #define TCR_BASE (TXx9_TMTCR_CCDE | TXx9_TMTCR_CRE | TXx9_TMTCR_TMODE_ITVL)
22 #define TIMER_CLK(imclk) ((imclk) / (2 << TIMER_CCD))
37 #define TXX9_CLOCKSOURCE_BITS (TXX9_TIMER_BITS - 1)
50 unsigned int imbusclk)
54 clocksource_register_hz(&txx9_clocksource.
cs,
TIMER_CLK(imbusclk));
63 txx9_clocksource.
tmrptr = tmrptr;
67 struct clock_event_device
cd;
79 static void txx9tmr_set_mode(
enum clock_event_mode
mode,
80 struct clock_event_device *
evt)
86 txx9tmr_stop_and_clear(tmrptr);
88 case CLOCK_EVT_MODE_PERIODIC:
97 case CLOCK_EVT_MODE_SHUTDOWN:
98 case CLOCK_EVT_MODE_UNUSED:
101 case CLOCK_EVT_MODE_ONESHOT:
104 case CLOCK_EVT_MODE_RESUME:
111 static int txx9tmr_set_next_event(
unsigned long delta,
112 struct clock_event_device *evt)
118 txx9tmr_stop_and_clear(tmrptr);
128 .features = CLOCK_EVT_FEAT_PERIODIC |
129 CLOCK_EVT_FEAT_ONESHOT,
131 .set_mode = txx9tmr_set_mode,
132 .set_next_event = txx9tmr_set_next_event,
138 struct txx9_clock_event_device *txx9_cd =
dev_id;
139 struct clock_event_device *
cd = &txx9_cd->
cd;
143 cd->event_handler(cd);
148 .handler = txx9tmr_interrupt,
151 .dev_id = &txx9_clock_event_device,
155 unsigned int imbusclk)
157 struct clock_event_device *cd = &txx9_clock_event_device.
cd;
161 txx9tmr_stop_and_clear(tmrptr);
164 txx9_clock_event_device.
tmrptr = tmrptr;
166 clockevent_set_clock(cd,
TIMER_CLK(imbusclk));