2 * timer.h -- ColdFire internal TIMER support defines.
4 * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
5 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
7 * SPDX-License-Identifier: GPL-2.0+
10 /****************************************************************************/
13 /****************************************************************************/
15 /****************************************************************************/
17 /****************************************************************************/
18 /* DMA Timer module registers */
19 typedef struct dtimer_ctrl {
20 #if defined(CONFIG_M5249) || defined(CONFIG_M5253) || \
21 defined(CONFIG_M5272) || defined(CONFIG_M5307)
22 u16 tmr; /* 0x00 Mode register */
24 u16 trr; /* 0x04 Reference register */
26 u16 tcr; /* 0x08 Capture register */
28 u16 tcn; /* 0x0C Counter register */
31 u8 ter; /* 0x11 Event register */
34 u16 tmr; /* 0x00 Mode register */
35 u8 txmr; /* 0x02 Extended Mode register */
36 u8 ter; /* 0x03 Event register */
37 u32 trr; /* 0x04 Reference register */
38 u32 tcr; /* 0x08 Capture register */
39 u32 tcn; /* 0x0C Counter register */
43 /*Programmable Interrupt Timer */
44 typedef struct pit_ctrl {
45 u16 pcsr; /* 0x00 Control and Status Register */
46 u16 pmr; /* 0x02 Modulus Register */
47 u16 pcntr; /* 0x04 Count Register */
50 /*********************************************************************
52 *********************************************************************/
53 /* Bit definitions and macros for DTMR */
54 #define DTIM_DTMR_RST (0x0001) /* Reset */
55 #define DTIM_DTMR_CLK(x) (((x)&0x0003)<<1) /* Input clock source */
56 #define DTIM_DTMR_FRR (0x0008) /* Free run/restart */
57 #define DTIM_DTMR_ORRI (0x0010) /* Output reference request/interrupt enable */
58 #define DTIM_DTMR_OM (0x0020) /* Output Mode */
59 #define DTIM_DTMR_CE(x) (((x)&0x0003)<<6) /* Capture Edge */
60 #define DTIM_DTMR_PS(x) (((x)&0x00FF)<<8) /* Prescaler value */
61 #define DTIM_DTMR_RST_EN (0x0001)
62 #define DTIM_DTMR_RST_RST (0x0000)
63 #define DTIM_DTMR_CE_ANY (0x00C0)
64 #define DTIM_DTMR_CE_FALL (0x0080)
65 #define DTIM_DTMR_CE_RISE (0x0040)
66 #define DTIM_DTMR_CE_NONE (0x0000)
67 #define DTIM_DTMR_CLK_DTIN (0x0006)
68 #define DTIM_DTMR_CLK_DIV16 (0x0004)
69 #define DTIM_DTMR_CLK_DIV1 (0x0002)
70 #define DTIM_DTMR_CLK_STOP (0x0000)
72 /* Bit definitions and macros for DTXMR */
73 #define DTIM_DTXMR_MODE16 (0x01) /* Increment Mode */
74 #define DTIM_DTXMR_DMAEN (0x80) /* DMA request */
76 /* Bit definitions and macros for DTER */
77 #define DTIM_DTER_CAP (0x01) /* Capture event */
78 #define DTIM_DTER_REF (0x02) /* Output reference event */
80 /*********************************************************************
82 * Programmable Interrupt Timer Modules (PIT)
84 *********************************************************************/
86 /* Bit definitions and macros for PCSR */
87 #define PIT_PCSR_EN (0x0001)
88 #define PIT_PCSR_RLD (0x0002)
89 #define PIT_PCSR_PIF (0x0004)
90 #define PIT_PCSR_PIE (0x0008)
91 #define PIT_PCSR_OVW (0x0010)
92 #define PIT_PCSR_HALTED (0x0020)
93 #define PIT_PCSR_DOZE (0x0040)
94 #define PIT_PCSR_PRE(x) (((x)&0x000F)<<8)
96 /* Bit definitions and macros for PMR */
97 #define PIT_PMR_PM(x) (x)
99 /* Bit definitions and macros for PCNTR */
100 #define PIT_PCNTR_PC(x) (x)
102 /****************************************************************************/