Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
mpc52xx_gpt.c File Reference
#include <linux/device.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/of_gpio.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/watchdog.h>
#include <linux/miscdevice.h>
#include <linux/uaccess.h>
#include <linux/module.h>
#include <asm/div64.h>
#include <asm/mpc52xx.h>

Go to the source code of this file.

Data Structures

struct  mpc52xx_gpt_priv
 

Macros

#define MPC52xx_GPT_MODE_MS_MASK   (0x07)
 
#define MPC52xx_GPT_MODE_MS_IC   (0x01)
 
#define MPC52xx_GPT_MODE_MS_OC   (0x02)
 
#define MPC52xx_GPT_MODE_MS_PWM   (0x03)
 
#define MPC52xx_GPT_MODE_MS_GPIO   (0x04)
 
#define MPC52xx_GPT_MODE_GPIO_MASK   (0x30)
 
#define MPC52xx_GPT_MODE_GPIO_OUT_LOW   (0x20)
 
#define MPC52xx_GPT_MODE_GPIO_OUT_HIGH   (0x30)
 
#define MPC52xx_GPT_MODE_COUNTER_ENABLE   (0x1000)
 
#define MPC52xx_GPT_MODE_CONTINUOUS   (0x0400)
 
#define MPC52xx_GPT_MODE_OPEN_DRAIN   (0x0200)
 
#define MPC52xx_GPT_MODE_IRQ_EN   (0x0100)
 
#define MPC52xx_GPT_MODE_WDT_EN   (0x8000)
 
#define MPC52xx_GPT_MODE_ICT_MASK   (0x030000)
 
#define MPC52xx_GPT_MODE_ICT_RISING   (0x010000)
 
#define MPC52xx_GPT_MODE_ICT_FALLING   (0x020000)
 
#define MPC52xx_GPT_MODE_ICT_TOGGLE   (0x030000)
 
#define MPC52xx_GPT_MODE_WDT_PING   (0xa5)
 
#define MPC52xx_GPT_STATUS_IRQMASK   (0x000f)
 
#define MPC52xx_GPT_CAN_WDT   (1 << 0)
 
#define MPC52xx_GPT_IS_WDT   (1 << 1)
 

Functions

 MODULE_DESCRIPTION ("Freescale MPC52xx gpt driver")
 
 MODULE_AUTHOR ("Sascha Hauer, Grant Likely, Albrecht Dreß")
 
 MODULE_LICENSE ("GPL")
 
 LIST_HEAD (mpc52xx_gpt_list)
 
 DEFINE_MUTEX (mpc52xx_gpt_list_mutex)
 
void mpc52xx_gpt_irq_cascade (unsigned int virq, struct irq_desc *desc)
 
struct mpc52xx_gpt_privmpc52xx_gpt_from_irq (int irq)
 
 EXPORT_SYMBOL (mpc52xx_gpt_from_irq)
 
int mpc52xx_gpt_start_timer (struct mpc52xx_gpt_priv *gpt, u64 period, int continuous)
 
 EXPORT_SYMBOL (mpc52xx_gpt_start_timer)
 
int mpc52xx_gpt_stop_timer (struct mpc52xx_gpt_priv *gpt)
 
 EXPORT_SYMBOL (mpc52xx_gpt_stop_timer)
 
u64 mpc52xx_gpt_timer_period (struct mpc52xx_gpt_priv *gpt)
 
 EXPORT_SYMBOL (mpc52xx_gpt_timer_period)
 
 subsys_initcall (mpc52xx_gpt_init)
 
 device_initcall (mpc52xx_gpt_wdt_init)
 

Macro Definition Documentation

#define MPC52xx_GPT_CAN_WDT   (1 << 0)

Definition at line 131 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_IS_WDT   (1 << 1)

Definition at line 132 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_MODE_CONTINUOUS   (0x0400)

Definition at line 117 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_MODE_COUNTER_ENABLE   (0x1000)

Definition at line 116 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_MODE_GPIO_MASK   (0x30)

Definition at line 112 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_MODE_GPIO_OUT_HIGH   (0x30)

Definition at line 114 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_MODE_GPIO_OUT_LOW   (0x20)

Definition at line 113 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_MODE_ICT_FALLING   (0x020000)

Definition at line 124 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_MODE_ICT_MASK   (0x030000)

Definition at line 122 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_MODE_ICT_RISING   (0x010000)

Definition at line 123 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_MODE_ICT_TOGGLE   (0x030000)

Definition at line 125 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_MODE_IRQ_EN   (0x0100)

Definition at line 119 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_MODE_MS_GPIO   (0x04)

Definition at line 110 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_MODE_MS_IC   (0x01)

Definition at line 107 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_MODE_MS_MASK   (0x07)

Definition at line 106 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_MODE_MS_OC   (0x02)

Definition at line 108 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_MODE_MS_PWM   (0x03)

Definition at line 109 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_MODE_OPEN_DRAIN   (0x0200)

Definition at line 118 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_MODE_WDT_EN   (0x8000)

Definition at line 120 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_MODE_WDT_PING   (0xa5)

Definition at line 127 of file mpc52xx_gpt.c.

#define MPC52xx_GPT_STATUS_IRQMASK   (0x000f)

Definition at line 129 of file mpc52xx_gpt.c.

Function Documentation

DEFINE_MUTEX ( mpc52xx_gpt_list_mutex  )
device_initcall ( mpc52xx_gpt_wdt_init  )
EXPORT_SYMBOL ( mpc52xx_gpt_from_irq  )
EXPORT_SYMBOL ( mpc52xx_gpt_start_timer  )
EXPORT_SYMBOL ( mpc52xx_gpt_stop_timer  )
EXPORT_SYMBOL ( mpc52xx_gpt_timer_period  )
LIST_HEAD ( mpc52xx_gpt_list  )
MODULE_AUTHOR ( "Sascha  Hauer,
Grant  Likely,
Albrecht Dreß"   
)
MODULE_DESCRIPTION ( "Freescale MPC52xx gpt driver )
MODULE_LICENSE ( "GPL"  )
struct mpc52xx_gpt_priv* mpc52xx_gpt_from_irq ( int  irq)
read

mpc52xx_gpt_from_irq - Return the GPT device associated with an IRQ number : irq of timer.

Definition at line 376 of file mpc52xx_gpt.c.

void mpc52xx_gpt_irq_cascade ( unsigned int  virq,
struct irq_desc desc 
)

Definition at line 194 of file mpc52xx_gpt.c.

int mpc52xx_gpt_start_timer ( struct mpc52xx_gpt_priv gpt,
u64  period,
int  continuous 
)

mpc52xx_gpt_start_timer - Set and enable the GPT timer : Pointer to gpt private data structure : period of timer in ns; max. ~130s @ 33MHz IPB clock : set to 1 to make timer continuous free running

An interrupt will be generated every time the timer fires

Definition at line 466 of file mpc52xx_gpt.c.

int mpc52xx_gpt_stop_timer ( struct mpc52xx_gpt_priv gpt)

mpc52xx_gpt_stop_timer - Stop a gpt : Pointer to gpt private data structure

Returns an error if attempting to stop a wdt

Definition at line 479 of file mpc52xx_gpt.c.

u64 mpc52xx_gpt_timer_period ( struct mpc52xx_gpt_priv gpt)

mpc52xx_gpt_timer_period - Read the timer period : Pointer to gpt private data structure

Returns the timer period in ns

Definition at line 502 of file mpc52xx_gpt.c.

subsys_initcall ( mpc52xx_gpt_init  )