Home | History | Annotate | Line # | Download | only in nvidia
      1  1.2  jmcneill /* $NetBSD: tegra_i2creg.h,v 1.2 2015/05/16 21:31:39 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.2  jmcneill 
     80  1.1  jmcneill #define I2C_PACKET_TRANSFER_STATUS_REG	0x58
     81  1.2  jmcneill #define I2C_PACKET_TRANSFER_STATUS_TRANSFER_COMPLETE __BIT(24)
     82  1.2  jmcneill #define I2C_PACKET_TRANSFER_STATUS_TRANSFER_PKT_ID __BITS(23,16)
     83  1.2  jmcneill #define I2C_PACKET_TRANSFER_STATUS_TRANSFER_BYTENUM __BITS(15,4)
     84  1.2  jmcneill #define I2C_PACKET_TRANSFER_STATUS_NOACK_FOR_ADDR __BIT(3)
     85  1.2  jmcneill #define I2C_PACKET_TRANSFER_STATUS_NOACK_FOR_DATA __BIT(2)
     86  1.2  jmcneill #define I2C_PACKET_TRANSFER_STATUS_ARB_LOST	__BIT(1)
     87  1.2  jmcneill #define I2C_PACKET_TRANSFER_STATUS_CONTROLLER_BUSY __BIT(0)
     88  1.1  jmcneill 
     89  1.1  jmcneill #define I2C_FIFO_CONTROL_REG		0x5c
     90  1.1  jmcneill #define I2C_FIFO_CONTROL_SLV_TX_FIFO_TRIG	__BITS(15,13)
     91  1.1  jmcneill #define I2C_FIFO_CONTROL_SLV_RX_FIFO_TRIG	__BITS(12,10)
     92  1.1  jmcneill #define I2C_FIFO_CONTROL_SLV_TX_FIFO_FLUSH	__BIT(9)
     93  1.1  jmcneill #define I2C_FIFO_CONTROL_SLV_RX_FIFO_FLUSH	__BIT(8)
     94  1.1  jmcneill #define I2C_FIFO_CONTROL_TX_FIFO_TRIG		__BITS(7,5)
     95  1.1  jmcneill #define I2C_FIFO_CONTROL_RX_FIFO_TRIG		__BITS(4,2)
     96  1.1  jmcneill #define I2C_FIFO_CONTROL_TX_FIFO_FLUSH		__BIT(1)
     97  1.1  jmcneill #define I2C_FIFO_CONTROL_RX_FIFO_FLUSH		__BIT(0)
     98  1.1  jmcneill 
     99  1.1  jmcneill #define I2C_FIFO_STATUS_REG		0x60
    100  1.1  jmcneill #define I2C_FIFO_STATUS_SLV_XFER_ERR_REASON	__BIT(25)
    101  1.1  jmcneill #define I2C_FIFO_STATUS_SLV_TX_FIFO_EMPTY_CNT	__BITS(23,20)
    102  1.2  jmcneill #define I2C_FIFO_STATUS_SLV_RX_FIFO_FULL_CNT	__BITS(19,16)
    103  1.1  jmcneill #define I2C_FIFO_STATUS_TX_FIFO_EMPTY_CNT	__BITS(7,4)
    104  1.2  jmcneill #define I2C_FIFO_STATUS_RX_FIFO_FULL_CNT	__BITS(3,0)
    105  1.1  jmcneill 
    106  1.1  jmcneill #define I2C_INTERRUPT_MASK_REG		0x64
    107  1.1  jmcneill #define I2C_INTERRUPT_MASK_TIMEOUT		__BIT(8)
    108  1.1  jmcneill #define I2C_INTERRUPT_MASK_PACKET_XFER_COMPLETE	__BIT(7)
    109  1.1  jmcneill #define I2C_INTERRUPT_MASK_ALL_PACKETS_XFER_COMPLETE __BIT(6)
    110  1.1  jmcneill #define I2C_INTERRUPT_MASK_NOACK		__BIT(3)
    111  1.1  jmcneill #define I2C_INTERRUPT_MASK_ARB_LOST		__BIT(2)
    112  1.1  jmcneill #define I2C_INTERRUPT_MASK_TFIFO_DATA_REQ	__BIT(1)
    113  1.1  jmcneill #define I2C_INTERRUPT_MASK_RFIFO_DATA_REQ	__BIT(0)
    114  1.1  jmcneill 
    115  1.1  jmcneill #define I2C_INTERRUPT_STATUS_REG	0x68
    116  1.2  jmcneill #define I2C_INTERRUPT_STATUS_TIMEOUT		__BIT(8)
    117  1.2  jmcneill #define I2C_INTERRUPT_STATUS_PACKET_XFER_COMPLETE __BIT(7)
    118  1.2  jmcneill #define I2C_INTERRUPT_STATUS_ALL_PACKETS_XFER_COMPLETE __BIT(6)
    119  1.2  jmcneill #define I2C_INTERRUPT_STATUS_NOACK		__BIT(3)
    120  1.2  jmcneill #define I2C_INTERRUPT_STATUS_ARB_LOST		__BIT(2)
    121  1.2  jmcneill #define I2C_INTERRUPT_STATUS_TFIFO_DATA_REQ	__BIT(1)
    122  1.2  jmcneill #define I2C_INTERRUPT_STATUS_RFIFO_DATA_REQ	__BIT(0)
    123  1.1  jmcneill 
    124  1.1  jmcneill #define I2C_CLK_DIVISOR_REG		0x6c
    125  1.1  jmcneill #define I2C_CLK_DIVISOR_STD_FAST_MODE		__BITS(31,16)
    126  1.1  jmcneill #define I2C_CLK_DIVISOR_HSMODE			__BITS(15,0)
    127  1.1  jmcneill 
    128  1.1  jmcneill #define I2C_INTERRUPT_SOURCE_REG	0x70
    129  1.1  jmcneill #define I2C_INTERRUPT_SET_REG		0x74
    130  1.1  jmcneill #define I2C_SLV_TX_PACKET_FIFO_REG	0x78
    131  1.1  jmcneill #define I2C_SLV_RX_FIFO_REG		0x7c
    132  1.1  jmcneill #define I2C_SLV_PACKET_STATUS_REG	0x80
    133  1.1  jmcneill #define I2C_BUS_CLEAR_CONFIG_REG	0x84
    134  1.1  jmcneill #define I2C_BUS_CLEAR_STATUS_REG	0x88
    135  1.1  jmcneill 
    136  1.1  jmcneill #define I2C_BUS_CONFIG_LOAD_REG		0x8c
    137  1.1  jmcneill #define I2C_BUS_CONFIG_LOAD_TIMEOUT_CONFIG_LOAD	__BIT(2)
    138  1.1  jmcneill #define I2C_BUS_CONFIG_LOAD_SLV_CONFIG_LOAD	__BIT(1)
    139  1.1  jmcneill #define I2C_BUS_CONFIG_LOAD_MSTR_CONFIG_LOAD	__BIT(0)
    140  1.1  jmcneill 
    141  1.1  jmcneill #define I2C_INTERFACE_TIMING0_REG	0x94
    142  1.1  jmcneill #define I2C_INTERFACE_TIMING0_THIGH		__BITS(13,8)
    143  1.1  jmcneill #define I2C_INTERFACE_TIMING0_TLOW		__BITS(5,0)
    144  1.1  jmcneill 
    145  1.1  jmcneill #define I2C_INTERFACE_TIMING1_REG	0x98
    146  1.1  jmcneill #define I2C_HS_INTERFACE_TIMING0_REG	0x9c
    147  1.1  jmcneill #define I2C_HS_INTERFACE_TIMING1_REG	0xa0
    148  1.1  jmcneill 
    149  1.2  jmcneill /*
    150  1.2  jmcneill  * I/O Packets
    151  1.2  jmcneill  */
    152  1.2  jmcneill #define I2C_IOPACKET_WORD0_PROTHDRSZ		__BITS(29,28)
    153  1.2  jmcneill #define I2C_IOPACKET_WORD0_PROTHDRSZ_REQ	0
    154  1.2  jmcneill #define I2C_IOPACKET_WORD0_PROTHDRSZ_RES	1
    155  1.2  jmcneill #define I2C_IOPACKET_WORD0_PKTID		__BITS(23,16)
    156  1.2  jmcneill #define I2C_IOPACKET_WORD0_CONTROLLERID		__BITS(15,12)
    157  1.2  jmcneill #define I2C_IOPACKET_WORD0_PROTOCOL		__BITS(7,4)
    158  1.2  jmcneill #define I2C_IOPACKET_WORD0_PROTOCOL_I2C		1
    159  1.2  jmcneill #define I2C_IOPACKET_WORD0_PKTTYPE		__BITS(2,0)
    160  1.2  jmcneill #define I2C_IOPACKET_WORD0_PKTTYPE_REQ		0
    161  1.2  jmcneill #define I2C_IOPACKET_WORD0_PKTTYPE_RES		1
    162  1.2  jmcneill #define I2C_IOPACKET_WORD0_PKTTYPE_INT		2
    163  1.2  jmcneill #define I2C_IOPACKET_WORD0_PKTTYPE_STOP		3
    164  1.2  jmcneill 
    165  1.2  jmcneill #define I2C_IOPACKET_WORD1_PAYLOADSIZE		__BITS(11,0)
    166  1.2  jmcneill 
    167  1.2  jmcneill #define I2C_IOPACKET_XMITHDR_RESP_PKT_FREQ	__BIT(25)
    168  1.2  jmcneill #define I2C_IOPACKET_XMITHDR_RESP_PKT_ENABLE	__BIT(24)
    169  1.2  jmcneill #define I2C_IOPACKET_XMITHDR_HS_MODE		__BIT(22)
    170  1.2  jmcneill #define I2C_IOPACKET_XMITHDR_CONTINUE_ON_NACK	__BIT(21)
    171  1.2  jmcneill #define I2C_IOPACKET_XMITHDR_SEND_START_BYTE	__BIT(20)
    172  1.2  jmcneill #define I2C_IOPACKET_XMITHDR_READ		__BIT(19)
    173  1.2  jmcneill #define I2C_IOPACKET_XMITHDR_ADDRESS_MODE	__BIT(18)
    174  1.2  jmcneill #define I2C_IOPACKET_XMITHDR_IE			__BIT(17)
    175  1.2  jmcneill #define I2C_IOPACKET_XMITHDR_REPEAT_STARTSTOP	__BIT(16)
    176  1.2  jmcneill #define I2C_IOPACKET_XMITHDR_CONTINUE_XFER	__BIT(15)
    177  1.2  jmcneill #define I2C_IOPACKET_XMITHDR_HS_MASTER_ADDR	__BITS(14,12)
    178  1.2  jmcneill #define I2C_IOPACKET_XMITHDR_SLAVE_ADDR		__BITS(9,0)
    179  1.2  jmcneill 
    180  1.2  jmcneill #define I2C_IOPACKET_RESPHDR_RFIFO_OVF		__BIT(26)
    181  1.2  jmcneill #define I2C_IOPACKET_RESPHDR_TFIFO_OVF		__BIT(25)
    182  1.2  jmcneill #define I2C_IOPACKET_RESPHDR_TRANSFER_COMPLETE	__BIT(24)
    183  1.2  jmcneill #define I2C_IOPACKET_RESPHDR_TRANSFER_PKT_ID	__BITS(23,16)
    184  1.2  jmcneill #define I2C_IOPACKET_RESPHDR_TRANSFER_BYTENUM	__BITS(15,4)
    185  1.2  jmcneill #define I2C_IOPACKET_RESPHDR_NOACK_FOR_ADDR	__BIT(3)
    186  1.2  jmcneill #define I2C_IOPACKET_RESPHDR_NOACK_FOR_DATA	__BIT(2)
    187  1.2  jmcneill #define I2C_IOPACKET_RESPHDR_ARB_LOST		__BIT(1)
    188  1.2  jmcneill #define I2C_IOPACKET_RESPHDR_CONTROLLER_BUSY	__BIT(0)
    189  1.2  jmcneill 
    190  1.1  jmcneill #endif /* _ARM_TEGRA_I2CREG_H */
    191