3 * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
60 u32 ic_tx_abrt_source;
64 #define NANO_TO_MICRO 1000
66 /* High and low times in different speed modes (in ns) */
67 #define MIN_SS_SCL_HIGHTIME 4000
68 #define MIN_SS_SCL_LOWTIME 5000
69 #define MIN_FS_SCL_HIGHTIME 800
70 #define MIN_FS_SCL_LOWTIME 1700
71 #define MIN_HS_SCL_HIGHTIME 60
72 #define MIN_HS_SCL_LOWTIME 160
74 /* Worst case timeout for 1 byte is kept as 2ms */
75 #define I2C_BYTE_TO (CONFIG_SYS_HZ/500)
76 #define I2C_STOPDET_TO (CONFIG_SYS_HZ/500)
77 #define I2C_BYTE_TO_BB (I2C_BYTE_TO * 16)
79 /* i2c control register definitions */
80 #define IC_CON_SD 0x0040
81 #define IC_CON_RE 0x0020
82 #define IC_CON_10BITADDRMASTER 0x0010
83 #define IC_CON_10BITADDR_SLAVE 0x0008
84 #define IC_CON_SPD_MSK 0x0006
85 #define IC_CON_SPD_SS 0x0002
86 #define IC_CON_SPD_FS 0x0004
87 #define IC_CON_SPD_HS 0x0006
88 #define IC_CON_MM 0x0001
90 /* i2c target address register definitions */
91 #define TAR_ADDR 0x0050
93 /* i2c slave address register definitions */
94 #define IC_SLAVE_ADDR 0x0002
96 /* i2c data buffer and command register definitions */
99 /* i2c interrupt status register definitions */
100 #define IC_GEN_CALL 0x0800
101 #define IC_START_DET 0x0400
102 #define IC_STOP_DET 0x0200
103 #define IC_ACTIVITY 0x0100
104 #define IC_RX_DONE 0x0080
105 #define IC_TX_ABRT 0x0040
106 #define IC_RD_REQ 0x0020
107 #define IC_TX_EMPTY 0x0010
108 #define IC_TX_OVER 0x0008
109 #define IC_RX_FULL 0x0004
110 #define IC_RX_OVER 0x0002
111 #define IC_RX_UNDER 0x0001
113 /* fifo threshold register definitions */
122 #define IC_RX_TL IC_TL0
123 #define IC_TX_TL IC_TL0
125 /* i2c enable register definitions */
126 #define IC_ENABLE_0B 0x0001
128 /* i2c status register definitions */
129 #define IC_STATUS_SA 0x0040
130 #define IC_STATUS_MA 0x0020
131 #define IC_STATUS_RFF 0x0010
132 #define IC_STATUS_RFNE 0x0008
133 #define IC_STATUS_TFE 0x0004
134 #define IC_STATUS_TFNF 0x0002
135 #define IC_STATUS_ACT 0x0001
137 /* Speed Selection */
138 #define IC_SPEED_MODE_STANDARD 1
139 #define IC_SPEED_MODE_FAST 2
140 #define IC_SPEED_MODE_MAX 3
142 #define I2C_MAX_SPEED 3400000
143 #define I2C_FAST_SPEED 400000
144 #define I2C_STANDARD_SPEED 100000
146 #endif /* __DW_I2C_H_ */