1 /* 2 * Copyright 2023 NXP 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** 8 * @file 9 * @brief Definitions for IEEE 802.3 management interface 10 */ 11 12 #ifndef ZEPHYR_INCLUDE_NET_MDIO_H_ 13 #define ZEPHYR_INCLUDE_NET_MDIO_H_ 14 15 /** 16 * @brief Definitions for IEEE 802.3 management interface 17 * @defgroup ethernet_mdio IEEE 802.3 management interface 18 * @ingroup ethernet 19 * @{ 20 */ 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 /** MDIO transaction operation code */ 27 enum mdio_opcode { 28 /** IEEE 802.3 22.2.4.5.4 write operation */ 29 MDIO_OP_C22_WRITE = 1, 30 31 /** IEEE 802.3 22.2.4.5.4 read operation */ 32 MDIO_OP_C22_READ = 2, 33 34 /** IEEE 802.3 45.3.4 address operation */ 35 MDIO_OP_C45_ADDRESS = 0, 36 37 /** IEEE 802.3 45.3.4 write operation */ 38 MDIO_OP_C45_WRITE = 1, 39 40 /** IEEE 802.3 45.3.4 post-read-increment-address operation */ 41 MDIO_OP_C45_READ_INC = 2, 42 43 /** IEEE 802.3 45.3.4 read operation */ 44 MDIO_OP_C45_READ = 3 45 }; 46 47 /* MDIO Manageable Device addresses */ 48 /** Physical Medium Attachment / Physical Medium Dependent */ 49 #define MDIO_MMD_PMAPMD 0x01U 50 /** WAN Interface Sublayer */ 51 #define MDIO_MMD_WIS 0x02U 52 /** Physical Coding Sublayer */ 53 #define MDIO_MMD_PCS 0x03U 54 /** PHY Extender Sublayer */ 55 #define MDIO_MMD_PHYXS 0x04U 56 /** DTE Extender Sublayer */ 57 #define MDIO_MMD_DTEXS 0x05U 58 /** Transmission Convergence */ 59 #define MDIO_MMD_TC 0x06U 60 /** Auto-negotiation */ 61 #define MDIO_MMD_AN 0x07U 62 /** Separated PMA (1) */ 63 #define MDIO_MMD_SEPARATED_PMA1 0x08U 64 /** Separated PMA (2) */ 65 #define MDIO_MMD_SEPARATED_PMA2 0x09U 66 /** Separated PMA (3) */ 67 #define MDIO_MMD_SEPARATED_PMA3 0x0AU 68 /** Separated PMA (4) */ 69 #define MDIO_MMD_SEPARATED_PMA4 0x0BU 70 /** Clause 22 extension */ 71 #define MDIO_MMD_C22EXT 0x1DU 72 /** Vendor Specific 1 */ 73 #define MDIO_MMD_VENDOR_SPECIFIC1 0x1EU 74 /** Vendor Specific 2 */ 75 #define MDIO_MMD_VENDOR_SPECIFIC2 0x1FU 76 77 /* MDIO generic registers */ 78 /** Control 1 */ 79 #define MDIO_CTRL1 0x0000U 80 /** Status 1 */ 81 #define MDIO_STAT1 0x0001U 82 /** Device identifier (1) */ 83 #define MDIO_DEVID1 0x0002U 84 /** Device identifier (2) */ 85 #define MDIO_DEVID2 0x0003U 86 /** Speed ability */ 87 #define MDIO_SPEED 0x0004U 88 /** Devices in package (1) */ 89 #define MDIO_DEVS1 0x0005U 90 /** Devices in package (2) */ 91 #define MDIO_DEVS2 0x0006U 92 /** Control 2 */ 93 #define MDIO_CTRL2 0x0007U 94 /** Status 2 */ 95 #define MDIO_STAT2 0x0008U 96 /** Package identifier (1) */ 97 #define MDIO_PKGID1 0x000EU 98 /** Package identifier (2) */ 99 #define MDIO_PKGID2 0x000FU 100 101 102 /* BASE-T1 registers */ 103 /** BASE-T1 Auto-negotiation control */ 104 #define MDIO_AN_T1_CTRL 0x0200U 105 /** BASE-T1 Auto-negotiation status */ 106 #define MDIO_AN_T1_STAT 0x0201U 107 /** BASE-T1 Auto-negotiation advertisement register [15:0] */ 108 #define MDIO_AN_T1_ADV_L 0x0202U 109 /** BASE-T1 Auto-negotiation advertisement register [31:16] */ 110 #define MDIO_AN_T1_ADV_M 0x0203U 111 /** BASE-T1 Auto-negotiation advertisement register [47:32] */ 112 #define MDIO_AN_T1_ADV_H 0x0204U 113 114 /* BASE-T1 Auto-negotiation Control register */ 115 /** Auto-negotiation Restart */ 116 #define MDIO_AN_T1_CTRL_RESTART BIT(9) 117 /** Auto-negotiation Enable */ 118 #define MDIO_AN_T1_CTRL_EN BIT(12) 119 120 /* BASE-T1 Auto-negotiation Status register */ 121 /** Link Status */ 122 #define MDIO_AN_T1_STAT_LINK_STATUS BIT(2) 123 /** Auto-negotiation Ability */ 124 #define MDIO_AN_T1_STAT_ABLE BIT(3) 125 /** Auto-negotiation Remote Fault */ 126 #define MDIO_AN_T1_STAT_REMOTE_FAULT BIT(4) 127 /** Auto-negotiation Complete */ 128 #define MDIO_AN_T1_STAT_COMPLETE BIT(5) 129 /** Page Received */ 130 #define MDIO_AN_T1_STAT_PAGE_RX BIT(6) 131 132 /* BASE-T1 Auto-negotiation Advertisement register [15:0] */ 133 /** Pause Ability */ 134 #define MDIO_AN_T1_ADV_L_PAUSE_CAP BIT(10) 135 /** Pause Ability */ 136 #define MDIO_AN_T1_ADV_L_PAUSE_ASYM BIT(11) 137 /** Force Master/Slave Configuration */ 138 #define MDIO_AN_T1_ADV_L_FORCE_MS BIT(12) 139 /** Remote Fault */ 140 #define MDIO_AN_T1_ADV_L_REMOTE_FAULT BIT(13) 141 /** Acknowledge (ACK) */ 142 #define MDIO_AN_T1_ADV_L_ACK BIT(14) 143 /** Next Page Request */ 144 #define MDIO_AN_T1_ADV_L_NEXT_PAGE_REQ BIT(15) 145 146 /* BASE-T1 Auto-negotiation Advertisement register [31:16] */ 147 /** 10BASE-T1L Ability */ 148 #define MDIO_AN_T1_ADV_M_B10L BIT(14) 149 /** Master/slave Configuration */ 150 #define MDIO_AN_T1_ADV_M_MST BIT(4) 151 152 /* BASE-T1 Auto-negotiation Advertisement register [47:32] */ 153 /* 10BASE-T1L High Level Transmit Operating Mode Request */ 154 #define MDIO_AN_T1_ADV_H_10L_TX_HI_REQ BIT(12) 155 /* 10BASE-T1L High Level Transmit Operating Mode Ability */ 156 #define MDIO_AN_T1_ADV_H_10L_TX_HI BIT(13) 157 158 159 /* 10BASE-T1L registers */ 160 /** 10BASE-T1L PMA control */ 161 #define MDIO_PMA_B10L_CTRL 0x08F6U 162 /** 10BASE-T1L PMA status */ 163 #define MDIO_PMA_B10L_STAT 0x08F7U 164 /** 10BASE-T1L PMA link status*/ 165 #define MDIO_PMA_B10L_LINK_STAT 0x8302U 166 /** 10BASE-T1L PCS control */ 167 #define MDIO_PCS_B10L_CTRL 0x08E6U 168 /** 10BASE-T1L PCS status */ 169 #define MDIO_PCS_B10L_STAT 0x08E7U 170 171 /* 10BASE-T1L PMA control register */ 172 /** 10BASE-T1L Transmit Disable Mode */ 173 #define MDIO_PMA_B10L_CTRL_TX_DIS_MODE_EN BIT(14) 174 /** 10BASE-T1L Transmit Voltage Amplitude Control */ 175 #define MDIO_PMA_B10L_CTRL_TX_LVL_HI BIT(12) 176 /** 10BASE-T1L EEE Enable */ 177 #define MDIO_PMA_B10L_CTRL_EEE BIT(10) 178 /** 10BASE-T1L PMA Loopback */ 179 #define MDIO_PMA_B10L_CTRL_LB_PMA_LOC_EN BIT(0) 180 181 /* 10BASE-T1L PMA status register */ 182 /** 10BASE-T1L PMA receive link up */ 183 #define MDIO_PMA_B10L_STAT_LINK BIT(0) 184 /** 10BASE-T1L Fault condition detected */ 185 #define MDIO_PMA_B10L_STAT_FAULT BIT(1) 186 /** 10BASE-T1L Receive polarity is reversed */ 187 #define MDIO_PMA_B10L_STAT_POLARITY BIT(2) 188 /** 10BASE-T1L Able to detect fault on receive path */ 189 #define MDIO_PMA_B10L_STAT_RECV_FAULT BIT(9) 190 /** 10BASE-T1L PHY has EEE ability */ 191 #define MDIO_PMA_B10L_STAT_EEE BIT(10) 192 /** 10BASE-T1L PMA has low-power ability */ 193 #define MDIO_PMA_B10L_STAT_LOW_POWER BIT(11) 194 /** 10BASE-T1L PHY has 2.4 Vpp operating mode ability */ 195 #define MDIO_PMA_B10L_STAT_2V4_ABLE BIT(12) 196 /** 10BASE-T1L PHY has loopback ability */ 197 #define MDIO_PMA_B10L_STAT_LB_ABLE BIT(13) 198 199 /* 10BASE-T1L PMA link status*/ 200 /** 10BASE-T1L Remote Receiver Status OK Latch Low */ 201 #define MDIO_PMA_B10L_LINK_STAT_REM_RCVR_STAT_OK_LL BIT(9) 202 /** 10BASE-T1L Remote Receiver Status OK */ 203 #define MDIO_PMA_B10L_LINK_STAT_REM_RCVR_STAT_OK BIT(8) 204 /** 10BASE-T1L Local Receiver Status OK */ 205 #define MDIO_PMA_B10L_LINK_STAT_LOC_RCVR_STAT_OK_LL BIT(7) 206 /** 10BASE-T1L Local Receiver Status OK */ 207 #define MDIO_PMA_B10L_LINK_STAT_LOC_RCVR_STAT_OK BIT(6) 208 /** 10BASE-T1L Descrambler Status OK Latch Low */ 209 #define MDIO_PMA_B10L_LINK_STAT_DSCR_STAT_OK_LL BIT(5) 210 /** 10BASE-T1L Descrambler Status OK */ 211 #define MDIO_PMA_B10L_LINK_STAT_DSCR_STAT_OK BIT(4) 212 /** 10BASE-T1L Link Status OK Latch Low */ 213 #define MDIO_PMA_B10L_LINK_STAT_LINK_STAT_OK_LL BIT(1) 214 /** 10BASE-T1L Link Status OK */ 215 #define MDIO_PMA_B10L_LINK_STAT_LINK_STAT_OK BIT(0) 216 217 /* 10BASE-T1L PCS control */ 218 /** 10BASE-T1L PCS Loopback Enable */ 219 #define MDIO_PCS_B10L_CTRL_LB_PCS_EN BIT(14) 220 221 /* 10BASE-T1L PCS status */ 222 /** 10BASE-T1L PCS Descrambler Status */ 223 #define MDIO_PCS_B10L_STAT_DSCR_STAT_OK_LL BIT(2) 224 225 #ifdef __cplusplus 226 } 227 #endif 228 229 /** 230 * @} 231 */ 232 233 #endif /* ZEPHYR_INCLUDE_NET_MDIO_H_ */ 234