1 /* drivers/i2c/busses/i2c_rk2818.h
3 * Copyright (C) 2010 ROCKCHIP, Inc.
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
16 #ifndef __RK2818_I2C_H
17 #define __RK2818_I2C_H
20 #define I2C_MTXR (0x0000)
22 #define I2C_MRXR (0x0004)
24 #define I2C_SADDR (0x0010)
25 /* interrupt enable control */
26 #define I2C_IER (0x0014)
27 #define I2C_IER_ARBITR_LOSE (1<<7)
28 #define I2C_IER_MRX_NEED_ACK (1<<1)
29 #define I2C_IER_MTX_RCVD_ACK (1<<0)
31 #define IRQ_MST_ENABLE (I2C_IER_ARBITR_LOSE | \
32 I2C_IER_MRX_NEED_ACK | \
34 #define IRQ_ALL_DISABLE (0x00)
36 /* interrupt status, write 0 to clear */
37 #define I2C_ISR (0x0018)
38 #define I2C_ISR_ARBITR_LOSE (1<<7)
39 #define I2C_ISR_MRX_NEED_ACK (1<<1)
40 #define I2C_ISR_MTX_RCVD_ACK (1<<0)
42 /* stop/start/resume command, write 1 to set */
43 #define I2C_LCMR (0x001c)
44 #define I2C_LCMR_RESUME (1<<2)
45 #define I2C_LCMR_STOP (1<<1)
46 #define I2C_LCMR_START (1<<0)
49 #define I2C_LSR (0x0020)
50 #define I2C_LSR_RCV_NAK (1<<1)
51 #define I2C_LSR_RCV_ACK (~(1<<1))
52 #define I2C_LSR_BUSY (1<<0)
55 #define I2C_CONR (0x0024)
56 #define I2C_CONR_NAK (1<<4)
57 #define I2C_CONR_ACK (~(1<<4))
58 #define I2C_CONR_MTX_MODE (1<<3)
59 #define I2C_CONR_MRX_MODE (~(1<<3))
60 #define I2C_CONR_MPORT_ENABLE (1<<2)
61 #define I2C_CONR_MPORT_DISABLE (~(1<<2))
64 #define I2C_OPR (0x0028)
65 #define I2C_OPR_RESET_STATUS (1<<7)
66 #define I2C_OPR_CORE_ENABLE (1<<6)
68 #define I2CCDVR_REM_BITS (0x03)
69 #define I2CCDVR_REM_MAX (1<<(I2CCDVR_REM_BITS))
70 #define I2CCDVR_EXP_BITS (0x03)
71 #define I2CCDVR_EXP_MAX (1<<(I2CCDVR_EXP_BITS))