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;
66 #define NANO_TO_MICRO 1000
68 /* High and low times in different speed modes (in ns) */
69 #define MIN_SS_SCL_HIGHTIME 4000
70 #define MIN_SS_SCL_LOWTIME 4700
71 #define MIN_FS_SCL_HIGHTIME 600
72 #define MIN_FS_SCL_LOWTIME 1300
73 #define MIN_HS_SCL_HIGHTIME 60
74 #define MIN_HS_SCL_LOWTIME 160
76 /* Worst case timeout for 1 byte is kept as 2ms */
77 #define I2C_BYTE_TO (CONFIG_SYS_HZ/500)
78 #define I2C_STOPDET_TO (CONFIG_SYS_HZ/500)
79 #define I2C_BYTE_TO_BB (I2C_BYTE_TO * 16)
81 /* i2c control register definitions */
82 #define IC_CON_SD 0x0040
83 #define IC_CON_RE 0x0020
84 #define IC_CON_10BITADDRMASTER 0x0010
85 #define IC_CON_10BITADDR_SLAVE 0x0008
86 #define IC_CON_SPD_MSK 0x0006
87 #define IC_CON_SPD_SS 0x0002
88 #define IC_CON_SPD_FS 0x0004
89 #define IC_CON_SPD_HS 0x0006
90 #define IC_CON_MM 0x0001
92 /* i2c target address register definitions */
93 #define TAR_ADDR 0x0050
95 /* i2c slave address register definitions */
96 #define IC_SLAVE_ADDR 0x0002
98 /* i2c data buffer and command register definitions */
100 #define IC_STOP 0x0200
102 /* i2c interrupt status register definitions */
103 #define IC_GEN_CALL 0x0800
104 #define IC_START_DET 0x0400
105 #define IC_STOP_DET 0x0200
106 #define IC_ACTIVITY 0x0100
107 #define IC_RX_DONE 0x0080
108 #define IC_TX_ABRT 0x0040
109 #define IC_RD_REQ 0x0020
110 #define IC_TX_EMPTY 0x0010
111 #define IC_TX_OVER 0x0008
112 #define IC_RX_FULL 0x0004
113 #define IC_RX_OVER 0x0002
114 #define IC_RX_UNDER 0x0001
116 /* fifo threshold register definitions */
125 #define IC_RX_TL IC_TL0
126 #define IC_TX_TL IC_TL0
128 /* i2c enable register definitions */
129 #define IC_ENABLE_0B 0x0001
131 /* i2c status register definitions */
132 #define IC_STATUS_SA 0x0040
133 #define IC_STATUS_MA 0x0020
134 #define IC_STATUS_RFF 0x0010
135 #define IC_STATUS_RFNE 0x0008
136 #define IC_STATUS_TFE 0x0004
137 #define IC_STATUS_TFNF 0x0002
138 #define IC_STATUS_ACT 0x0001
140 /* Speed Selection */
141 #define IC_SPEED_MODE_STANDARD 1
142 #define IC_SPEED_MODE_FAST 2
143 #define IC_SPEED_MODE_MAX 3
145 #define I2C_MAX_SPEED 3400000
146 #define I2C_FAST_SPEED 400000
147 #define I2C_STANDARD_SPEED 100000
149 #endif /* __DW_I2C_H_ */