Go to the documentation of this file.
31 #ifndef _TJA1102_DRIVER_H
32 #define _TJA1102_DRIVER_H
38 #ifndef TJA1102_PHY_ADDR
39 #define TJA1102_PHY_ADDR 0
40 #elif (TJA1102_PHY_ADDR < 0 || TJA1102_PHY_ADDR > 31)
41 #error TJA1102_PHY_ADDR parameter is not valid
45 #define TJA1102_BASIC_CTRL 0x00
46 #define TJA1102_BASIC_STAT 0x01
47 #define TJA1102_PHY_ID1 0x02
48 #define TJA1102_PHY_ID2 0x03
49 #define TJA1102_EXTENDED_STAT 0x0F
50 #define TJA1102_PHY_ID3 0x10
51 #define TJA1102_EXTENDED_CTRL 0x11
52 #define TJA1102_CONFIG1 0x12
53 #define TJA1102_CONFIG2 0x13
54 #define TJA1102_SYM_ERR_COUNTER 0x14
55 #define TJA1102_INT_SRC 0x15
56 #define TJA1102_INT_EN 0x16
57 #define TJA1102_COMM_STAT 0x17
58 #define TJA1102_GENERAL_STAT 0x18
59 #define TJA1102_EXTERNAL_STAT 0x19
60 #define TJA1102_LINK_FAIL_COUNTER 0x1A
61 #define TJA1102_COMM_CTRL 0x1B
62 #define TJA1102_CONFIG3 0x1C
65 #define TJA1102_BASIC_CTRL_RESET 0x8000
66 #define TJA1102_BASIC_CTRL_LOOPBACK 0x4000
67 #define TJA1102_BASIC_CTRL_SPEED_SEL_LSB 0x2000
68 #define TJA1102_BASIC_CTRL_AUTONEG_EN 0x1000
69 #define TJA1102_BASIC_CTRL_POWER_DOWN 0x0800
70 #define TJA1102_BASIC_CTRL_ISOLATE 0x0400
71 #define TJA1102_BASIC_CTRL_RE_AUTONEG 0x0200
72 #define TJA1102_BASIC_CTRL_DUPLEX_MODE 0x0100
73 #define TJA1102_BASIC_CTRL_COL_TEST 0x0080
74 #define TJA1102_BASIC_CTRL_SPEED_SEL_MSB 0x0040
75 #define TJA1102_BASIC_CTRL_UNIDIRECT_EN 0x0020
78 #define TJA1102_BASIC_STAT_100BT4 0x8000
79 #define TJA1102_BASIC_STAT_100BTX_FD 0x4000
80 #define TJA1102_BASIC_STAT_100BTX_HD 0x2000
81 #define TJA1102_BASIC_STAT_10BT_FD 0x1000
82 #define TJA1102_BASIC_STAT_10BT_HD 0x0800
83 #define TJA1102_BASIC_STAT_100BT2_FD 0x0400
84 #define TJA1102_BASIC_STAT_100BT2_HD 0x0200
85 #define TJA1102_BASIC_STAT_EXTENDED_STATUS 0x0100
86 #define TJA1102_BASIC_STAT_UNIDIRECT_ABILITY 0x0080
87 #define TJA1102_BASIC_STAT_MF_PREAMBLE_SUPPR 0x0040
88 #define TJA1102_BASIC_STAT_AUTONEG_COMPLETE 0x0020
89 #define TJA1102_BASIC_STAT_REMOTE_FAULT 0x0010
90 #define TJA1102_BASIC_STAT_AUTONEG_ABILITY 0x0008
91 #define TJA1102_BASIC_STAT_LINK_STATUS 0x0004
92 #define TJA1102_BASIC_STAT_JABBER_DETECT 0x0002
93 #define TJA1102_BASIC_STAT_EXTENDED_CAPABILITY 0x0001
96 #define TJA1102_PHY_ID1_OUI_MSB 0xFFFF
97 #define TJA1102_PHY_ID1_OUI_MSB_DEFAULT 0x0180
100 #define TJA1102_PHY_ID2_OUI_LSB 0xFC00
101 #define TJA1102_PHY_ID2_OUI_LSB_DEFAULT 0xDC00
102 #define TJA1102_PHY_ID2_TYPE_NO 0x03F0
103 #define TJA1102_PHY_ID2_TYPE_NO_TJA1102A 0x0100
104 #define TJA1102_PHY_ID2_TYPE_NO_TJA1102AS 0x0090
105 #define TJA1102_PHY_ID2_REVISION_NO 0x000F
106 #define TJA1102_PHY_ID2_REVISION_NO_DEFAULT 0x0002
109 #define TJA1102_EXTENDED_STAT_1000BX_FD 0x8000
110 #define TJA1102_EXTENDED_STAT_1000BX_HD 0x4000
111 #define TJA1102_EXTENDED_STAT_1000BT_FD 0x2000
112 #define TJA1102_EXTENDED_STAT_1000BT_HD 0x1000
113 #define TJA1102_EXTENDED_STAT_100BT1 0x0080
114 #define TJA1102_EXTENDED_STAT_RTPGE 0x0040
117 #define TJA1102_PHY_ID3_VERSION_NO 0x00FF
120 #define TJA1102_EXTENDED_CTRL_LINK_CONTROL 0x8000
121 #define TJA1102_EXTENDED_CTRL_POWER_MODE 0x7800
122 #define TJA1102_EXTENDED_CTRL_POWER_MODE_NO_CHANGE 0x0000
123 #define TJA1102_EXTENDED_CTRL_POWER_MODE_NORMAL 0x1800
124 #define TJA1102_EXTENDED_CTRL_POWER_MODE_SILENT 0x4800
125 #define TJA1102_EXTENDED_CTRL_POWER_MODE_SLEEP 0x5000
126 #define TJA1102_EXTENDED_CTRL_POWER_MODE_SLEEP_REQ 0x5800
127 #define TJA1102_EXTENDED_CTRL_POWER_MODE_STANDBY 0x6000
128 #define TJA1102_EXTENDED_CTRL_SLAVE_JITTER_TEST 0x0400
129 #define TJA1102_EXTENDED_CTRL_TRAINING_RESTART 0x0200
130 #define TJA1102_EXTENDED_CTRL_TEST_MODE 0x01C0
131 #define TJA1102_EXTENDED_CTRL_TEST_MODE_0 0x0000
132 #define TJA1102_EXTENDED_CTRL_TEST_MODE_1 0x0040
133 #define TJA1102_EXTENDED_CTRL_TEST_MODE_2 0x0080
134 #define TJA1102_EXTENDED_CTRL_TEST_MODE_3 0x00C0
135 #define TJA1102_EXTENDED_CTRL_TEST_MODE_4 0x0100
136 #define TJA1102_EXTENDED_CTRL_TEST_MODE_5 0x0140
137 #define TJA1102_EXTENDED_CTRL_TEST_MODE_6 0x0180
138 #define TJA1102_EXTENDED_CTRL_CABLE_TEST 0x0020
139 #define TJA1102_EXTENDED_CTRL_LOOPBACK_MODE 0x0018
140 #define TJA1102_EXTENDED_CTRL_LOOPBACK_MODE_INTERNAL 0x0000
141 #define TJA1102_EXTENDED_CTRL_LOOPBACK_MODE_EXTERNAL 0x0008
142 #define TJA1102_EXTENDED_CTRL_LOOPBACK_MODE_REMOTE 0x0018
143 #define TJA1102_EXTENDED_CTRL_CONFIG_EN 0x0004
144 #define TJA1102_EXTENDED_CTRL_WAKE_REQUEST 0x0001
147 #define TJA1102_CONFIG1_MASTER_SLAVE 0x8000
148 #define TJA1102_CONFIG1_FWDPHYLOC 0x4000
149 #define TJA1102_CONFIG1_REMWUPHY 0x0800
150 #define TJA1102_CONFIG1_LOCWUPHY 0x0400
151 #define TJA1102_CONFIG1_MII_MODE 0x0300
152 #define TJA1102_CONFIG1_MII_MODE_MII 0x0000
153 #define TJA1102_CONFIG1_MII_MODE_RMII_50MHZ_REF_CLK_IN 0x0100
154 #define TJA1102_CONFIG1_MII_MODE_RMII_50MHZ_REF_CLK_OUT 0x0200
155 #define TJA1102_CONFIG1_MII_MODE_REV_MII 0x0300
156 #define TJA1102_CONFIG1_MII_DRIVER 0x0080
157 #define TJA1102_CONFIG1_MII_DRIVER_STANDARD 0x0000
158 #define TJA1102_CONFIG1_MII_DRIVER_REDUCED 0x0080
159 #define TJA1102_CONFIG1_SLEEP_CONFIRM 0x0040
160 #define TJA1102_CONFIG1_LPS_WUR_DIS 0x0020
161 #define TJA1102_CONFIG1_SLEEP_ACK 0x0010
162 #define TJA1102_CONFIG1_FWDPHYREM 0x0004
163 #define TJA1102_CONFIG1_AUTO_PWD 0x0002
164 #define TJA1102_CONFIG1_LPS_ACTIVE 0x0001
167 #define TJA1102_CONFIG2_PHYAD 0xF800
168 #define TJA1102_CONFIG2_SQI_AVERAGING 0x0600
169 #define TJA1102_CONFIG2_SQI_AVERAGING_32_SYMBOLS 0x0000
170 #define TJA1102_CONFIG2_SQI_AVERAGING_64_SYMBOLS 0x0200
171 #define TJA1102_CONFIG2_SQI_AVERAGING_128_SYMBOLS 0x0400
172 #define TJA1102_CONFIG2_SQI_AVERAGING_256_SYMBOLS 0x0600
173 #define TJA1102_CONFIG2_SQI_WLIMIT 0x01C0
174 #define TJA1102_CONFIG2_SQI_WLIMIT_NONE 0x0000
175 #define TJA1102_CONFIG2_SQI_WLIMIT_CLASS_A 0x0040
176 #define TJA1102_CONFIG2_SQI_WLIMIT_CLASS_B 0x0080
177 #define TJA1102_CONFIG2_SQI_WLIMIT_CLASS_C 0x00C0
178 #define TJA1102_CONFIG2_SQI_WLIMIT_CLASS_D 0x0100
179 #define TJA1102_CONFIG2_SQI_WLIMIT_CLASS_E 0x0140
180 #define TJA1102_CONFIG2_SQI_WLIMIT_CLASS_F 0x0180
181 #define TJA1102_CONFIG2_SQI_WLIMIT_CLASS_G 0x01C0
182 #define TJA1102_CONFIG2_SQI_FAILLIMIT 0x0038
183 #define TJA1102_CONFIG2_SQI_FAILLIMIT_NONE 0x0000
184 #define TJA1102_CONFIG2_SQI_FAILLIMIT_CLASS_A 0x0008
185 #define TJA1102_CONFIG2_SQI_FAILLIMIT_CLASS_B 0x0010
186 #define TJA1102_CONFIG2_SQI_FAILLIMIT_CLASS_C 0x0018
187 #define TJA1102_CONFIG2_SQI_FAILLIMIT_CLASS_D 0x0020
188 #define TJA1102_CONFIG2_SQI_FAILLIMIT_CLASS_E 0x0028
189 #define TJA1102_CONFIG2_SQI_FAILLIMIT_CLASS_F 0x0030
190 #define TJA1102_CONFIG2_SQI_FAILLIMIT_CLASS_G 0x0038
191 #define TJA1102_CONFIG2_JUMBO_ENABLE 0x0004
192 #define TJA1102_CONFIG2_SLEEP_REQUEST_TO 0x0003
193 #define TJA1102_CONFIG2_SLEEP_REQUEST_TO_0_4MS 0x0000
194 #define TJA1102_CONFIG2_SLEEP_REQUEST_TO_1MS 0x0001
195 #define TJA1102_CONFIG2_SLEEP_REQUEST_TO_4MS 0x0002
196 #define TJA1102_CONFIG2_SLEEP_REQUEST_TO_16MS 0x0003
199 #define TJA1102_SYM_ERR_COUNTER_SYM_ERR_CNT 0xFFFF
202 #define TJA1102_INT_SRC_PWON 0x8000
203 #define TJA1102_INT_SRC_WAKEUP 0x4000
204 #define TJA1102_INT_SRC_WUR_RECEIVED 0x2000
205 #define TJA1102_INT_SRC_LPS_RECEIVED 0x1000
206 #define TJA1102_INT_SRC_PHY_INIT_FAIL 0x0800
207 #define TJA1102_INT_SRC_LINK_STATUS_FAIL 0x0400
208 #define TJA1102_INT_SRC_LINK_STATUS_UP 0x0200
209 #define TJA1102_INT_SRC_SYM_ERR 0x0100
210 #define TJA1102_INT_SRC_TRAINING_FAILED 0x0080
211 #define TJA1102_INT_SRC_SQI_WARNING 0x0040
212 #define TJA1102_INT_SRC_CONTROL_ERR 0x0020
213 #define TJA1102_INT_SRC_UV_ERR 0x0008
214 #define TJA1102_INT_SRC_UV_RECOVERY 0x0004
215 #define TJA1102_INT_SRC_TEMP_ERR 0x0002
216 #define TJA1102_INT_SRC_SLEEP_ABORT 0x0001
219 #define TJA1102_INT_EN_PWON 0x8000
220 #define TJA1102_INT_EN_WAKEUP 0x4000
221 #define TJA1102_INT_EN_WUR_RECEIVED 0x2000
222 #define TJA1102_INT_EN_LPS_RECEIVED 0x1000
223 #define TJA1102_INT_EN_PHY_INIT_FAIL 0x0800
224 #define TJA1102_INT_EN_LINK_STATUS_FAIL 0x0400
225 #define TJA1102_INT_EN_LINK_STATUS_UP 0x0200
226 #define TJA1102_INT_EN_SYM_ERR 0x0100
227 #define TJA1102_INT_EN_TRAINING_FAILED 0x0080
228 #define TJA1102_INT_EN_SQI_WARNING 0x0040
229 #define TJA1102_INT_EN_CONTROL_ERR 0x0020
230 #define TJA1102_INT_EN_UV_ERR 0x0008
231 #define TJA1102_INT_EN_UV_RECOVERY 0x0004
232 #define TJA1102_INT_EN_TEMP_ERR 0x0002
233 #define TJA1102_INT_EN_SLEEP_ABORT 0x0001
236 #define TJA1102_COMM_STAT_LINK_UP 0x8000
237 #define TJA1102_COMM_STAT_TX_MODE 0x6000
238 #define TJA1102_COMM_STAT_TX_MODE_DISABLED 0x0000
239 #define TJA1102_COMM_STAT_TX_MODE_SEND_N 0x2000
240 #define TJA1102_COMM_STAT_TX_MODE_SEND_I 0x4000
241 #define TJA1102_COMM_STAT_TX_MODE_SEND_Z 0x6000
242 #define TJA1102_COMM_STAT_LOC_RCVR_STATUS 0x1000
243 #define TJA1102_COMM_STAT_REM_RCVR_STATUS 0x0800
244 #define TJA1102_COMM_STAT_SCR_LOCKED 0x0400
245 #define TJA1102_COMM_STAT_SSD_ERR 0x0200
246 #define TJA1102_COMM_STAT_ESD_ERR 0x0100
247 #define TJA1102_COMM_STAT_SQI 0x00E0
248 #define TJA1102_COMM_STAT_SQI_WORSE_THAN_CLASS_A 0x0000
249 #define TJA1102_COMM_STAT_SQI_CLASS_A 0x0020
250 #define TJA1102_COMM_STAT_SQI_CLASS_B 0x0040
251 #define TJA1102_COMM_STAT_SQI_CLASS_C 0x0060
252 #define TJA1102_COMM_STAT_SQI_CLASS_D 0x0080
253 #define TJA1102_COMM_STAT_SQI_CLASS_E 0x00A0
254 #define TJA1102_COMM_STAT_SQI_CLASS_F 0x00C0
255 #define TJA1102_COMM_STAT_SQI_CLASS_G 0x00E0
256 #define TJA1102_COMM_STAT_RECEIVE_ERR 0x0010
257 #define TJA1102_COMM_STAT_TRANSMIT_ERR 0x0008
258 #define TJA1102_COMM_STAT_PHY_STATE 0x0007
259 #define TJA1102_COMM_STAT_PHY_STATE_IDLE 0x0000
260 #define TJA1102_COMM_STAT_PHY_STATE_INITIALIZING 0x0001
261 #define TJA1102_COMM_STAT_PHY_STATE_CONFIGURED 0x0002
262 #define TJA1102_COMM_STAT_PHY_STATE_OFFLINE 0x0003
263 #define TJA1102_COMM_STAT_PHY_STATE_ACTIVE 0x0004
264 #define TJA1102_COMM_STAT_PHY_STATE_ISOLATE 0x0005
265 #define TJA1102_COMM_STAT_PHY_STATE_CABLE_TEST 0x0006
266 #define TJA1102_COMM_STAT_PHY_STATE_TEST_MODE 0x0007
269 #define TJA1102_GENERAL_STAT_INT_STATUS 0x8000
270 #define TJA1102_GENERAL_STAT_PLL_LOCKED 0x4000
271 #define TJA1102_GENERAL_STAT_LOCAL_WU 0x2000
272 #define TJA1102_GENERAL_STAT_REMOTE_WU 0x1000
273 #define TJA1102_GENERAL_STAT_DATA_DET_WU 0x0800
274 #define TJA1102_GENERAL_STAT_EN_STATUS 0x0400
275 #define TJA1102_GENERAL_STAT_RESET_STATUS 0x0200
276 #define TJA1102_GENERAL_STAT_LINKFAIL_CNT 0x00F8
279 #define TJA1102_EXTERNAL_STAT_UV_VDDA_3V3 0x8000
280 #define TJA1102_EXTERNAL_STAT_UV_VDDD_1V8 0x4000
281 #define TJA1102_EXTERNAL_STAT_UV_VDDA_1V8 0x2000
282 #define TJA1102_EXTERNAL_STAT_UV_VDDIO 0x0800
283 #define TJA1102_EXTERNAL_STAT_TEMP_HIGH 0x0400
284 #define TJA1102_EXTERNAL_STAT_TEMP_WARN 0x0200
285 #define TJA1102_EXTERNAL_STAT_SHORT_DETECT 0x0100
286 #define TJA1102_EXTERNAL_STAT_OPEN_DETECT 0x0080
287 #define TJA1102_EXTERNAL_STAT_POLARITY_DETECT 0x0040
288 #define TJA1102_EXTERNAL_STAT_INTERLEAVE_DETECT 0x0020
291 #define TJA1102_LINK_FAIL_COUNTER_LOC_RCVR_CNT 0xFF00
292 #define TJA1102_LINK_FAIL_COUNTER_REM_RCVR_CNT 0x00FF
295 #define TJA1102_COMM_CTRL_AUTO_OP 0x8000
296 #define TJA1102_COMM_CTRL_INT_REV_MII 0x4000
297 #define TJA1102_COMM_CTRL_CLK_MODE 0x3000
298 #define TJA1102_COMM_CTRL_CLK_MODE_25MHZ_XTAL_NO_CLK_OUT 0x0000
299 #define TJA1102_COMM_CTRL_CLK_MODE_25MHZ_XTAL_CLK_OUT 0x1000
300 #define TJA1102_COMM_CTRL_CLK_MODE_25MHZ_EXT_CLK_IN 0x2000
301 #define TJA1102_COMM_CTRL_CLK_MODE_50MHZ_REF_CLK_IN 0x3000
302 #define TJA1102_COMM_CTRL_LDO_MODE 0x0800
303 #define TJA1102_COMM_CTRL_CLK_DRIVER 0x0400
304 #define TJA1102_COMM_CTRL_CLK_HOLD 0x0200
305 #define TJA1102_COMM_CTRL_LOC_WU_TIM 0x0180
306 #define TJA1102_COMM_CTRL_LOC_WU_TIM_LONGEST 0x0000
307 #define TJA1102_COMM_CTRL_LOC_WU_TIM_LONG 0x0080
308 #define TJA1102_COMM_CTRL_LOC_WU_TIM_SHORT 0x0100
309 #define TJA1102_COMM_CTRL_LOC_WU_TIM_SHORTEST 0x0180
310 #define TJA1102_COMM_CTRL_CONFIG_WAKE 0x0040
311 #define TJA1102_COMM_CTRL_CONFIG_INH 0x0020
314 #define TJA1102_CONFIG3_MDI_POL 0x0004
315 #define TJA1102_CONFIG3_FORCE_SLEEP 0x0002
const PhyDriver tja1102PhyDriver
TJA1102 Ethernet PHY driver.
void tja1102WritePhyReg(NetInterface *interface, uint8_t address, uint16_t data)
Write PHY register.
void tja1102EnableIrq(NetInterface *interface)
Enable interrupts.
void tja1102DumpPhyReg(NetInterface *interface)
Dump PHY registers for debugging purpose.
void tja1102DisableIrq(NetInterface *interface)
Disable interrupts.
uint16_t tja1102ReadPhyReg(NetInterface *interface, uint8_t address)
Read PHY register.
error_t tja1102Init(NetInterface *interface)
TJA1102 PHY transceiver initialization.
Network interface controller abstraction layer.
void tja1102InitHook(NetInterface *interface)
TJA1102 custom configuration.
void tja1102EventHandler(NetInterface *interface)
TJA1102 event handler.
void tja1102Tick(NetInterface *interface)
TJA1102 timer handler.