-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
powerpc/mpic: add global timer support
The MPIC global timer is a hardware timer inside the Freescale PIC complying with OpenPIC standard. When the specified interval times out, the hardware timer generates an interrupt. The driver currently is only tested on fsl chip, but it can potentially support other global timers complying to OpenPIC standard. The two independent groups of global timer on fsl chip, group A and group B, are identical in their functionality, except that they appear at different locations within the PIC register map. The hardware timer can be cascaded to create timers larger than the default 31-bit global timers. Timer cascade fields allow configuration of up to two 63-bit timers. But These two groups of timers cannot be cascaded together. It can be used as a wakeup source for low power modes. It also could be used as periodical timer for protocols, drivers and etc. Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com> Signed-off-by: Li Yang <leoli@freescale.com> Signed-off-by: Scott Wood <scottwood@freescale.com>
- Loading branch information
Dongsheng.wang@freescale.com
authored and
Scott Wood
committed
Jul 1, 2013
1 parent
5ff04b7
commit 36ca09b
Showing
4 changed files
with
652 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* arch/powerpc/include/asm/mpic_timer.h | ||
* | ||
* Header file for Mpic Global Timer | ||
* | ||
* Copyright 2013 Freescale Semiconductor, Inc. | ||
* | ||
* Author: Wang Dongsheng <Dongsheng.Wang@freescale.com> | ||
* Li Yang <leoli@freescale.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. | ||
*/ | ||
|
||
#ifndef __MPIC_TIMER__ | ||
#define __MPIC_TIMER__ | ||
|
||
#include <linux/interrupt.h> | ||
#include <linux/time.h> | ||
|
||
struct mpic_timer { | ||
void *dev; | ||
struct cascade_priv *cascade_handle; | ||
unsigned int num; | ||
unsigned int irq; | ||
}; | ||
|
||
#ifdef CONFIG_MPIC_TIMER | ||
struct mpic_timer *mpic_request_timer(irq_handler_t fn, void *dev, | ||
const struct timeval *time); | ||
void mpic_start_timer(struct mpic_timer *handle); | ||
void mpic_stop_timer(struct mpic_timer *handle); | ||
void mpic_get_remain_time(struct mpic_timer *handle, struct timeval *time); | ||
void mpic_free_timer(struct mpic_timer *handle); | ||
#else | ||
struct mpic_timer *mpic_request_timer(irq_handler_t fn, void *dev, | ||
const struct timeval *time) { return NULL; } | ||
void mpic_start_timer(struct mpic_timer *handle) { } | ||
void mpic_stop_timer(struct mpic_timer *handle) { } | ||
void mpic_get_remain_time(struct mpic_timer *handle, struct timeval *time) { } | ||
void mpic_free_timer(struct mpic_timer *handle) { } | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.