timer: Add support for 64 bit timers.

This patch changes the time and timeouts used by timers from a uint32_t to a
uint64_t. This means clocks can run for years before overflow.

This patch also provides a virtual high 32 bits for HW that only has
32bit timer support. i.e. the high 32 is incremented at every HW timer
overflow.

Finally the patch updates all timer users to use uint64_t timeouts.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
diff --git a/src/lib/work.c b/src/lib/work.c
index 3172710..cac3deb 100644
--- a/src/lib/work.c
+++ b/src/lib/work.c
@@ -60,22 +60,26 @@
 
 struct work_queue {
 	struct list_item work;		/* list of work */
-	uint32_t timeout;		/* timeout for next queue run */
+	uint64_t timeout;		/* timeout for next queue run */
 	uint32_t window_size;		/* window size for pending work */
 	spinlock_t lock;
 	struct notifier notifier;	/* notify CPU freq changes */
 	struct work_queue_timesource *ts;	/* time source for work queue */
 	uint32_t ticks_per_usec;	/* ticks per msec */
-	uint32_t run_ticks;	/* ticks when last run */
+	uint64_t run_ticks;	/* ticks when last run */
 };
 
 /* generic system work queue */
 static struct work_queue *queue_;
 
-static inline void work_set_timer(struct work_queue *queue, uint32_t ticks)
+static inline int work_set_timer(struct work_queue *queue, uint64_t ticks)
 {
-	queue->ts->timer_set(&queue->ts->timer, ticks);
+	int ret;
+
+	ret = queue->ts->timer_set(&queue->ts->timer, ticks);
 	timer_enable(&queue->ts->timer);
+
+	return ret;
 }
 
 static inline void work_clear_timer(struct work_queue *queue)
@@ -84,7 +88,7 @@
 	timer_disable(&queue->ts->timer);
 }
 
-static inline uint32_t work_get_timer(struct work_queue *queue)
+static inline uint64_t work_get_timer(struct work_queue *queue)
 {
 	return queue->ts->timer_get(&queue->ts->timer);
 }
@@ -317,7 +321,7 @@
 	spin_unlock_irq(&queue->lock, flags);
 }
 
-void work_schedule(struct work_queue *queue, struct work *w, uint32_t timeout)
+void work_schedule(struct work_queue *queue, struct work *w, uint64_t timeout)
 {
 	struct work *work;
 	struct list_item *wlist;
@@ -362,7 +366,7 @@
 	spin_unlock_irq(&queue->lock, flags);
 }
 
-void work_schedule_default(struct work *w, uint32_t timeout)
+void work_schedule_default(struct work *w, uint64_t timeout)
 {
 	struct work *work;
 	struct list_item *wlist;