Skip to content
Commit daea7283 authored by Viresh Kumar's avatar Viresh Kumar Committed by Daniel Lezcano
Browse files

clockevents/drivers/timer-sp804: Migrate to new 'set-state' interface



Migrate timer-sp 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.

There are few more changes worth noticing:

- The clockevent device was disabled by writing: 'TIMER_CTRL_32BIT |
  TIMER_CTRL_IE' to ctrl register earlier. i.e. by un-setting the
  TIMER_CTRL_ENABLE bit. Its done by writing zero now and should have
  the same effect.

- For shutdown and resume we were writing the same value twice to the
  register (to disable the timer), which is fixed now.

- Switching to oneshot mode was divided into two parts earlier:
  - Firstly set_mode() was writing:
    'TIMER_CTRL_32BIT | TIMER_CTRL_IE | TIMER_CTRL_ONESHOT'
    to ctrl register (device not enabled yet)
  - Then sp804_set_next_event() was enabling the device by writing
    'readl(ctrl) | TIMER_CTRL_ENABLE' to the ctrl register. This was
    unnecessarily complicated.
  - Change this to: Stop device on set_state_oneshot and configure it in
    sp804_set_next_event().

Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Olof Johansson <olof@lixom.net>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
parent 26b91f04
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment