summaryrefslogtreecommitdiffstats
path: root/sys/arm/ti/ti_i2c.h
blob: d8dac60b1c4c0473bd9cceace45c652526a934e6 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*-
 * Copyright (c) 2011
 *	Ben Gray <ben.r.gray@gmail.com>.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $FreeBSD$
 */

#ifndef _TI_I2C_H_
#define	_TI_I2C_H_

/**
 * Header file for the OMAP I2C driver.
 *
 * Simply contains register bit flags.
 */

/*
 * OMAP4 I2C Registers, Summary 1
 */
#define	I2C_REG_IE		0x84
#define		I2C_IE_XDR		(1UL << 14)   /* Transmit draining interrupt */
#define		I2C_IE_RDR		(1UL << 13)   /* Receive draining interrupt */
#define		I2C_IE_AAS		(1UL << 9)    /* Addressed as Slave interrupt */
#define		I2C_IE_BF		(1UL << 8)    /* Bus Free interrupt */
#define		I2C_IE_AERR		(1UL << 7)    /* Access Error interrupt */
#define		I2C_IE_STC		(1UL << 6)    /* Start Condition interrupt */
#define		I2C_IE_GC		(1UL << 5)    /* General Call interrupt */
#define		I2C_IE_XRDY		(1UL << 4)    /* Transmit Data Ready interrupt */
#define		I2C_IE_RRDY		(1UL << 3)    /* Receive Data Ready interrupt */
#define		I2C_IE_ARDY		(1UL << 2)    /* Register Access Ready interrupt */
#define		I2C_IE_NACK		(1UL << 1)    /* No Acknowledgment interrupt */
#define		I2C_IE_AL		(1UL << 0)    /* Arbitration Lost interrupt */
#define	I2C_REG_STAT		0x88
#define		I2C_STAT_XDR		(1UL << 14)
#define		I2C_STAT_RDR		(1UL << 13)
#define		I2C_STAT_BB		(1UL << 12)
#define		I2C_STAT_ROVR		(1UL << 11)
#define		I2C_STAT_XUDF		(1UL << 10)
#define		I2C_STAT_AAS		(1UL << 9)
#define		I2C_STAT_BF		(1UL << 8)
#define		I2C_STAT_AERR		(1UL << 7)
#define		I2C_STAT_STC		(1UL << 6)
#define		I2C_STAT_GC		(1UL << 5)
#define		I2C_STAT_XRDY		(1UL << 4)
#define		I2C_STAT_RRDY		(1UL << 3)
#define		I2C_STAT_ARDY		(1UL << 2)
#define		I2C_STAT_NACK		(1UL << 1)
#define		I2C_STAT_AL		(1UL << 0)
#define	I2C_REG_SYSS		0x90
#define		I2C_SYSS_RDONE		(1UL << 0)
#define	I2C_REG_BUF		0x94
#define		I2C_BUF_RXFIFO_CLR	(1UL << 14)
#define		I2C_BUF_TXFIFO_CLR	(1UL << 6)
#define		I2C_BUF_RXTRSH_SHIFT	8
#define		I2C_BUF_TRSH_MASK	0x3f
#define	I2C_REG_CNT		0x98
#define	I2C_REG_DATA		0x9c
#define	I2C_REG_CON		0xa4
#define		I2C_CON_I2C_EN		(1UL << 15)
#define		I2C_CON_OPMODE_STD	(0UL << 12)
#define		I2C_CON_OPMODE_HS	(1UL << 12)
#define		I2C_CON_OPMODE_SCCB	(2UL << 12)
#define		I2C_CON_OPMODE_MASK	(3UL << 13)
#define		I2C_CON_I2C_STB		(1UL << 11)
#define		I2C_CON_MST		(1UL << 10)
#define		I2C_CON_TRX		(1UL << 9)
#define		I2C_CON_XSA		(1UL << 8)
#define		I2C_CON_XOA0		(1UL << 7)
#define		I2C_CON_XOA1		(1UL << 6)
#define		I2C_CON_XOA2		(1UL << 5)
#define		I2C_CON_XOA3		(1UL << 4)
#define		I2C_CON_STP		(1UL << 1)
#define		I2C_CON_STT		(1UL << 0)
#define	I2C_REG_OA0		0xa8
#define	I2C_REG_SA		0xac
#define	I2C_REG_PSC		0xb0
#define		I2C_PSC_MASK		0xff
#define	I2C_REG_SCLL		0xb4
#define		I2C_SCLL_MASK		0xff
#define		I2C_HSSCLL_SHIFT	8
#define	I2C_REG_SCLH		0xb8
#define		I2C_SCLH_MASK		0xff
#define		I2C_HSSCLH_SHIFT	8
#define	I2C_REG_SYSTEST		0xbc
#define	I2C_REG_BUFSTAT		0xc0
#define		I2C_BUFSTAT_FIFODEPTH_MASK	0x3
#define		I2C_BUFSTAT_FIFODEPTH_SHIFT	14
#define	I2C_REG_OA1		0xc4
#define	I2C_REG_OA2		0xc8
#define	I2C_REG_OA3		0xcc
#define	I2C_REG_ACTOA		0xd0
#define	I2C_REG_SBLOCK		0xd4

/*
 * OMAP4 I2C Registers, Summary 2 
 */
#define	I2C_REG_REVNB_LO	0x00
#define	I2C_REG_REVNB_HI	0x04
#define	I2C_REG_SYSC		0x10
#define		I2C_REG_SYSC_SRST	(1UL << 1)
#define	I2C_REG_STATUS_RAW	0x24
#define	I2C_REG_STATUS		0x28
#define	I2C_REG_IRQENABLE_SET	0x2C
#define	I2C_REG_IRQENABLE_CLR	0x30

#define	I2C_CLK			96000000UL	/* 96MHz */
#define	I2C_ICLK		12000000UL	/* 12MHz */

#endif /* _TI_I2C_H_ */
OpenPOWER on IntegriCloud