summaryrefslogtreecommitdiff
path: root/arch/arm/mach-imx/epit.h
blob: 06f4cfdd66909790ef25d8328b0ddb1a3f392197 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
 * Copyright (C) 2005-2014 Freescale Semiconductor, Inc. All Rights Reserved.
 */
/*
 * The code contained herein is licensed under the GNU General Public
 * License. You may obtain a copy of the GNU General Public License
 * Version 2 or later at the following locations:
 *
 * http://www.opensource.org/licenses/gpl-license.html
 * http://www.gnu.org/copyleft/gpl.html
 */
#ifndef __PLAT_MXC_EPIT_H
#define __PLAT_MXC_EPIT_H


#define EPITCR		0x00
#define EPITSR		0x04
#define EPITLR		0x08
#define EPITCMPR	0x0c
#define EPITCNR		0x10

#define EPITCR_EN				(1 << 0)
#define EPITCR_ENMOD			(1 << 1)
#define EPITCR_OCIEN			(1 << 2)
#define EPITCR_RLD				(1 << 3)
#define EPITCR_PRESC(x)			(((x) & 0xfff) << 4)
#define EPITCR_SWR				(1 << 16)
#define EPITCR_IOVW				(1 << 17)
#define EPITCR_DBGEN			(1 << 18)
#define EPITCR_WAITEN			(1 << 19)
#define EPITCR_RES				(1 << 20)
#define EPITCR_STOPEN			(1 << 21)
#define EPITCR_OM_DISCON		(0 << 22)
#define EPITCR_OM_TOGGLE		(1 << 22)
#define EPITCR_OM_CLEAR			(2 << 22)
#define EPITCR_OM_SET			(3 << 22)
#define EPITCR_CLKSRC_OFF		(0 << 24)
#define EPITCR_CLKSRC_PERIPHERAL	(1 << 24)
#define EPITCR_CLKSRC_REF_HIGH		(2 << 24)
#define EPITCR_CLKSRC_REF_LOW		(3 << 24)
#define EPIT_FREE_RUN_MODE			(0)
#define EPIT_SET_FORGET_MODE		(1)

#define EPITSR_OCIF					(1 << 0)


struct epit_device;
/*
 * epit_request - request a epit device
 */
struct epit_device *epit_request(int epit_id, const char *label);

/*
 * epit_free - free a epit device
 */
void epit_free(struct epit_device *epit);

/*
 * epit_config - change a epit device configuration
 */
int epit_config(struct epit_device *epit, int mode, void *cb, void *para);

/*
 * epit_start - start a epit output toggling
 */
void epit_start(struct epit_device *epit, int time_ns);

/*
 * epit_stop - stop a epit output toggling
 */
void  epit_stop(struct epit_device *epit);

#endif /* __LINUX_epit_H */