tegra_i2creg.h revision 1.1 1 1.1 jmcneill /* $NetBSD: tegra_i2creg.h,v 1.1 2015/05/10 23:50:21 jmcneill Exp $ */
2 1.1 jmcneill
3 1.1 jmcneill /*-
4 1.1 jmcneill * Copyright (c) 2015 Jared D. McNeill <jmcneill (at) invisible.ca>
5 1.1 jmcneill * All rights reserved.
6 1.1 jmcneill *
7 1.1 jmcneill * Redistribution and use in source and binary forms, with or without
8 1.1 jmcneill * modification, are permitted provided that the following conditions
9 1.1 jmcneill * are met:
10 1.1 jmcneill * 1. Redistributions of source code must retain the above copyright
11 1.1 jmcneill * notice, this list of conditions and the following disclaimer.
12 1.1 jmcneill * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 jmcneill * notice, this list of conditions and the following disclaimer in the
14 1.1 jmcneill * documentation and/or other materials provided with the distribution.
15 1.1 jmcneill *
16 1.1 jmcneill * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 1.1 jmcneill * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 1.1 jmcneill * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 1.1 jmcneill * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 1.1 jmcneill * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 1.1 jmcneill * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 1.1 jmcneill * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 1.1 jmcneill * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 1.1 jmcneill * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 1.1 jmcneill * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 1.1 jmcneill * SUCH DAMAGE.
27 1.1 jmcneill */
28 1.1 jmcneill
29 1.1 jmcneill #ifndef _ARM_TEGRA_I2CREG_H
30 1.1 jmcneill #define _ARM_TEGRA_I2CREG_H
31 1.1 jmcneill
32 1.1 jmcneill #define I2C_CNFG_REG 0x00
33 1.1 jmcneill #define I2C_CNFG_MSTR_CLR_BUS_ON_TIMEOUT __BIT(15)
34 1.1 jmcneill #define I2C_CNFG_DEBOUNCE_CNT __BITS(14,12)
35 1.1 jmcneill #define I2C_CNFG_NEW_MASTER_FSM __BIT(11)
36 1.1 jmcneill #define I2C_CNFG_PACKET_MODE_EN __BIT(10)
37 1.1 jmcneill #define I2C_CNFG_SEND __BIT(9)
38 1.1 jmcneill #define I2C_CNFG_NOACK __BIT(8)
39 1.1 jmcneill #define I2C_CNFG_CMD2 __BIT(7)
40 1.1 jmcneill #define I2C_CNFG_CMD1 __BIT(6)
41 1.1 jmcneill #define I2C_CNFG_START __BIT(5)
42 1.1 jmcneill #define I2C_CNFG_SLV2 __BIT(4)
43 1.1 jmcneill #define I2C_CNFG_LENGTH __BITS(3,1)
44 1.1 jmcneill #define I2C_CNFG_A_MOD __BIT(0)
45 1.1 jmcneill
46 1.1 jmcneill #define I2C_CMD_ADDR0_REG 0x04
47 1.1 jmcneill #define I2C_CMD_ADDR1_REG 0x08
48 1.1 jmcneill #define I2C_CMD_DATA1_REG 0x0c
49 1.1 jmcneill #define I2C_CMD_DATA2_REG 0x10
50 1.1 jmcneill
51 1.1 jmcneill #define I2C_STATUS_REG 0x1c
52 1.1 jmcneill #define I2C_STATUS_BUSY __BIT(8)
53 1.1 jmcneill #define I2C_STATUS_CMD2_STAT __BITS(7,4)
54 1.1 jmcneill #define I2C_STATUS_CMD1_STAT __BITS(3,0)
55 1.1 jmcneill
56 1.1 jmcneill #define I2C_SL_CNFG_REG 0x20
57 1.1 jmcneill #define I2C_SL_CNFG_FIFO_XFER_EN __BIT(20)
58 1.1 jmcneill #define I2C_SL_CNFG_BUFFER_SIZE __BITS(19,8)
59 1.1 jmcneill #define I2C_SL_CNFG_ACK_LAST_BYTE_VALID __BIT(7)
60 1.1 jmcneill #define I2C_SL_CNFG_ACK_LAST_BYTE __BIT(6)
61 1.1 jmcneill #define I2C_SL_CNFG_ACK_WITHHOLD_EN __BIT(5)
62 1.1 jmcneill #define I2C_SL_CNFG_PKT_MODE_EN __BIT(4)
63 1.1 jmcneill #define I2C_SL_CNFG_ENABLE_SL __BIT(3)
64 1.1 jmcneill #define I2C_SL_CNFG_NEWSL __BIT(2)
65 1.1 jmcneill #define I2C_SL_CNFG_NACK __BIT(1)
66 1.1 jmcneill #define I2C_SL_CNFG_RESP __BIT(0)
67 1.1 jmcneill
68 1.1 jmcneill #define I2C_SL_RCVD_REG 0x24
69 1.1 jmcneill #define I2C_SL_STATUS_REG 0x28
70 1.1 jmcneill #define I2C_SL_ADDR1_REG 0x2c
71 1.1 jmcneill #define I2C_SL_ADDR2_REG 0x30
72 1.1 jmcneill #define I2C_TLOW_SEXT_REG 0x34
73 1.1 jmcneill #define I2C_SL_DELAY_COUNT_REG 0x3c
74 1.1 jmcneill #define I2C_SL_INT_MASK_REG 0x40
75 1.1 jmcneill #define I2C_SL_INT_SOURCE_REG 0x44
76 1.1 jmcneill #define I2C_SL_INT_SET_REG 0x48
77 1.1 jmcneill #define I2C_TX_PACKET_FIFO_REG 0x50
78 1.1 jmcneill #define I2C_RX_FIFO_REG 0x54
79 1.1 jmcneill #define I2C_PACKET_TRANSFER_STATUS_REG 0x58
80 1.1 jmcneill
81 1.1 jmcneill #define I2C_FIFO_CONTROL_REG 0x5c
82 1.1 jmcneill #define I2C_FIFO_CONTROL_SLV_TX_FIFO_TRIG __BITS(15,13)
83 1.1 jmcneill #define I2C_FIFO_CONTROL_SLV_RX_FIFO_TRIG __BITS(12,10)
84 1.1 jmcneill #define I2C_FIFO_CONTROL_SLV_TX_FIFO_FLUSH __BIT(9)
85 1.1 jmcneill #define I2C_FIFO_CONTROL_SLV_RX_FIFO_FLUSH __BIT(8)
86 1.1 jmcneill #define I2C_FIFO_CONTROL_TX_FIFO_TRIG __BITS(7,5)
87 1.1 jmcneill #define I2C_FIFO_CONTROL_RX_FIFO_TRIG __BITS(4,2)
88 1.1 jmcneill #define I2C_FIFO_CONTROL_TX_FIFO_FLUSH __BIT(1)
89 1.1 jmcneill #define I2C_FIFO_CONTROL_RX_FIFO_FLUSH __BIT(0)
90 1.1 jmcneill
91 1.1 jmcneill #define I2C_FIFO_STATUS_REG 0x60
92 1.1 jmcneill #define I2C_FIFO_STATUS_SLV_XFER_ERR_REASON __BIT(25)
93 1.1 jmcneill #define I2C_FIFO_STATUS_SLV_TX_FIFO_EMPTY_CNT __BITS(23,20)
94 1.1 jmcneill #define I2C_FIFO_STATUS_SLV_RX_FIFO_EMPTY_CNT __BITS(19,16)
95 1.1 jmcneill #define I2C_FIFO_STATUS_TX_FIFO_EMPTY_CNT __BITS(7,4)
96 1.1 jmcneill #define I2C_FIFO_STATUS_RX_FIFO_EMPTY_CNT __BITS(3,0)
97 1.1 jmcneill
98 1.1 jmcneill #define I2C_INTERRUPT_MASK_REG 0x64
99 1.1 jmcneill #define I2C_INTERRUPT_MASK_TIMEOUT __BIT(8)
100 1.1 jmcneill #define I2C_INTERRUPT_MASK_PACKET_XFER_COMPLETE __BIT(7)
101 1.1 jmcneill #define I2C_INTERRUPT_MASK_ALL_PACKETS_XFER_COMPLETE __BIT(6)
102 1.1 jmcneill #define I2C_INTERRUPT_MASK_NOACK __BIT(3)
103 1.1 jmcneill #define I2C_INTERRUPT_MASK_ARB_LOST __BIT(2)
104 1.1 jmcneill #define I2C_INTERRUPT_MASK_TFIFO_DATA_REQ __BIT(1)
105 1.1 jmcneill #define I2C_INTERRUPT_MASK_RFIFO_DATA_REQ __BIT(0)
106 1.1 jmcneill
107 1.1 jmcneill #define I2C_INTERRUPT_STATUS_REG 0x68
108 1.1 jmcneill
109 1.1 jmcneill #define I2C_CLK_DIVISOR_REG 0x6c
110 1.1 jmcneill #define I2C_CLK_DIVISOR_STD_FAST_MODE __BITS(31,16)
111 1.1 jmcneill #define I2C_CLK_DIVISOR_HSMODE __BITS(15,0)
112 1.1 jmcneill
113 1.1 jmcneill #define I2C_INTERRUPT_SOURCE_REG 0x70
114 1.1 jmcneill #define I2C_INTERRUPT_SET_REG 0x74
115 1.1 jmcneill #define I2C_SLV_TX_PACKET_FIFO_REG 0x78
116 1.1 jmcneill #define I2C_SLV_RX_FIFO_REG 0x7c
117 1.1 jmcneill #define I2C_SLV_PACKET_STATUS_REG 0x80
118 1.1 jmcneill #define I2C_BUS_CLEAR_CONFIG_REG 0x84
119 1.1 jmcneill #define I2C_BUS_CLEAR_STATUS_REG 0x88
120 1.1 jmcneill
121 1.1 jmcneill #define I2C_BUS_CONFIG_LOAD_REG 0x8c
122 1.1 jmcneill #define I2C_BUS_CONFIG_LOAD_TIMEOUT_CONFIG_LOAD __BIT(2)
123 1.1 jmcneill #define I2C_BUS_CONFIG_LOAD_SLV_CONFIG_LOAD __BIT(1)
124 1.1 jmcneill #define I2C_BUS_CONFIG_LOAD_MSTR_CONFIG_LOAD __BIT(0)
125 1.1 jmcneill
126 1.1 jmcneill #define I2C_INTERFACE_TIMING0_REG 0x94
127 1.1 jmcneill #define I2C_INTERFACE_TIMING0_THIGH __BITS(13,8)
128 1.1 jmcneill #define I2C_INTERFACE_TIMING0_TLOW __BITS(5,0)
129 1.1 jmcneill
130 1.1 jmcneill #define I2C_INTERFACE_TIMING1_REG 0x98
131 1.1 jmcneill #define I2C_HS_INTERFACE_TIMING0_REG 0x9c
132 1.1 jmcneill #define I2C_HS_INTERFACE_TIMING1_REG 0xa0
133 1.1 jmcneill
134 1.1 jmcneill #endif /* _ARM_TEGRA_I2CREG_H */
135