aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-iop
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-02-27 03:09:52 -0500
committerViresh Kumar <viresh.kumar@linaro.org>2015-07-16 22:59:42 -0400
commit8d778377e598bd78d4ce788b20b1c74777c5d137 (patch)
treefcc49241c3944ef97447552b1764eaf700436b3b /arch/arm/plat-iop
parent6c724d4388997588f38587213ce1ab7d3925b87c (diff)
ARM/iop/time: Migrate to new 'set-state' interface
Migrate iop driver to the new 'set-state' interface provided by clockevents core, the earlier 'set-mode' interface is marked obsolete now. This also enables us to implement callbacks for new states of clockevent devices, for example: ONESHOT_STOPPED. Cc: Russell King <linux@arm.linux.org.uk> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'arch/arm/plat-iop')
-rw-r--r--arch/arm/plat-iop/time.c70
1 files changed, 43 insertions, 27 deletions
diff --git a/arch/arm/plat-iop/time.c b/arch/arm/plat-iop/time.c
index 6ad65d8ae237..101e8f2c7abe 100644
--- a/arch/arm/plat-iop/time.c
+++ b/arch/arm/plat-iop/time.c
@@ -77,41 +77,57 @@ static int iop_set_next_event(unsigned long delta,
77 77
78static unsigned long ticks_per_jiffy; 78static unsigned long ticks_per_jiffy;
79 79
80static void iop_set_mode(enum clock_event_mode mode, 80static int iop_set_periodic(struct clock_event_device *evt)
81 struct clock_event_device *unused)
82{ 81{
83 u32 tmr = read_tmr0(); 82 u32 tmr = read_tmr0();
84 83
85 switch (mode) { 84 write_tmr0(tmr & ~IOP_TMR_EN);
86 case CLOCK_EVT_MODE_PERIODIC: 85 write_tcr0(ticks_per_jiffy - 1);
87 write_tmr0(tmr & ~IOP_TMR_EN); 86 write_trr0(ticks_per_jiffy - 1);
88 write_tcr0(ticks_per_jiffy - 1); 87 tmr |= (IOP_TMR_RELOAD | IOP_TMR_EN);
89 write_trr0(ticks_per_jiffy - 1);
90 tmr |= (IOP_TMR_RELOAD | IOP_TMR_EN);
91 break;
92 case CLOCK_EVT_MODE_ONESHOT:
93 /* ->set_next_event sets period and enables timer */
94 tmr &= ~(IOP_TMR_RELOAD | IOP_TMR_EN);
95 break;
96 case CLOCK_EVT_MODE_RESUME:
97 tmr |= IOP_TMR_EN;
98 break;
99 case CLOCK_EVT_MODE_SHUTDOWN:
100 case CLOCK_EVT_MODE_UNUSED:
101 default:
102 tmr &= ~IOP_TMR_EN;
103 break;
104 }
105 88
106 write_tmr0(tmr); 89 write_tmr0(tmr);
90 return 0;
91}
92
93static int iop_set_oneshot(struct clock_event_device *evt)
94{
95 u32 tmr = read_tmr0();
96
97 /* ->set_next_event sets period and enables timer */
98 tmr &= ~(IOP_TMR_RELOAD | IOP_TMR_EN);
99 write_tmr0(tmr);
100 return 0;
101}
102
103static int iop_shutdown(struct clock_event_device *evt)
104{
105 u32 tmr = read_tmr0();
106
107 tmr &= ~IOP_TMR_EN;
108 write_tmr0(tmr);
109 return 0;
110}
111
112static int iop_resume(struct clock_event_device *evt)
113{
114 u32 tmr = read_tmr0();
115
116 tmr |= IOP_TMR_EN;
117 write_tmr0(tmr);
118 return 0;
107} 119}
108 120
109static struct clock_event_device iop_clockevent = { 121static struct clock_event_device iop_clockevent = {
110 .name = "iop_timer0", 122 .name = "iop_timer0",
111 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 123 .features = CLOCK_EVT_FEAT_PERIODIC |
112 .rating = 300, 124 CLOCK_EVT_FEAT_ONESHOT,
113 .set_next_event = iop_set_next_event, 125 .rating = 300,
114 .set_mode = iop_set_mode, 126 .set_next_event = iop_set_next_event,
127 .set_state_shutdown = iop_shutdown,
128 .set_state_periodic = iop_set_periodic,
129 .tick_resume = iop_resume,
130 .set_state_oneshot = iop_set_oneshot,
115}; 131};
116 132
117static irqreturn_t 133static irqreturn_t