1 /*
2  * Copyright (c) 2006 Brian Swetland
3  *
4  * Use of this source code is governed by a MIT-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/MIT
7  */
8 
9 #pragma once
10 
11 #define MII_REG_BCR           0x00
12 #define MII_REG_BSR           0x01
13 #define MII_REG_PHY_ID1       0x02
14 #define MII_REG_PHY_ID2       0x03
15 #define MII_REG_AUTO_ADV      0x04
16 #define MII_REG_AUTO_LINK     0x05
17 #define MII_REG_AUTO_EXPN     0x06
18 #define MII_REG_AUTO_NEXT     0x07
19 #define MII_REG_LINK_NEXT     0x08
20 #define MII_REG_RXER_CNT      0x15
21 #define MII_REG_ICSR          0x1b
22 #define MII_REG_100TX_PHY     0x1f
23 
24 #define MII_BCR_RESET         0x8000
25 #define MII_BCR_LOOPBACK      0x4000
26 #define MII_BCR_100MBPS       0x2000
27 #define MII_BCR_AUTO_ENABLE   0x1000
28 #define MII_BCR_PWR_DOWN      0x0800
29 #define MII_BCR_ISOLATE       0x0400
30 #define MII_BCR_AUTO_RESTART  0x0200
31 #define MII_BCR_FULL_DUPLEX   0x0100
32 #define MII_BCR_COL_TEST      0x0080
33 #define MII_BCR_TX_DISABLE    0x0001
34 
35 #define MII_BSR_T4            0x8000
36 #define MII_BSR_100TX_FULL    0x4000
37 #define MII_BSR_100TX_HALF    0x2000
38 #define MII_BSR_10T_FULL      0x1000
39 #define MII_BSR_10T_HALF      0x0800
40 #define MII_BSR_NO_PREAMBLE   0x0040
41 #define MII_BSR_AUTO_COMPLETE 0x0020
42 #define MII_BSR_REMOTE_FAULT  0x0010
43 #define MII_BSR_AUTO_ABLE     0x0008
44 #define MII_BSR_LINK_UP       0x0004
45 #define MII_BSR_JABBER        0x0002
46 #define MII_BSR_EXTEND        0x0001
47 
48 #define MII_100TX_PHY_ISOLATE  0x0040
49 #define MII_100TX_MODE_MASK    0x001C
50 #define MII_100TX_MODE_AUTO    0x0000
51 #define MII_100TX_MODE_10T_H   0x0004
52 #define MII_100TX_MODE_100TX_H 0x0008
53 #define MII_100TX_MODE_10T_F   0x0014
54 #define MII_100TX_MODE_100TX_F 0x0018
55 #define MII_100TX_MODE_ISOLATE 0x001C
56 #define MII_100TX_SQE_TEST     0x0002
57 #define MII_100TX_NO_SCRAMBLE  0x0001
58