Wolfgang Denk | 4646d2a | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 1 | /** |
| 2 | * @file IxEthMii.h |
| 3 | * |
| 4 | * @brief this file contains the public API of @ref IxEthMii component |
| 5 | * |
| 6 | * Design notes : |
| 7 | * The main intent of this API is to inplement MII high level fonctionalitoes |
| 8 | * to support the codelets provided with the IXP400 software releases. It |
| 9 | * superceedes previous interfaces provided with @ref IxEThAcc component. |
| 10 | * |
| 11 | * This API has been tested with the PHYs provided with the |
| 12 | * IXP400 development platforms. It may not work for specific Ethernet PHYs |
| 13 | * used on specific boards. |
| 14 | * |
| 15 | * This source code detects and interface the LXT972, LXT973 and KS6995 |
| 16 | * Ethernet PHYs. |
| 17 | * |
| 18 | * This source code should be considered as an example which may need |
| 19 | * to be adapted for different hardware implementations. |
| 20 | * |
| 21 | * It is strongly recommended to use public domain and GPL utilities |
| 22 | * like libmii, mii-diag for MII interface support. |
| 23 | * |
| 24 | * |
| 25 | * |
| 26 | * @par |
| 27 | * IXP400 SW Release version 2.0 |
| 28 | * |
| 29 | * -- Copyright Notice -- |
| 30 | * |
| 31 | * @par |
| 32 | * Copyright 2001-2005, Intel Corporation. |
| 33 | * All rights reserved. |
| 34 | * |
| 35 | * @par |
Wolfgang Denk | c57eadc | 2013-07-28 22:12:47 +0200 | [diff] [blame] | 36 | * SPDX-License-Identifier: BSD-3-Clause |
Wolfgang Denk | 4646d2a | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 37 | * @par |
| 38 | * -- End of Copyright Notice -- |
| 39 | */ |
| 40 | |
| 41 | #ifndef IxEthMii_H |
| 42 | #define IxEthMii_H |
| 43 | |
| 44 | #include <IxTypes.h> |
| 45 | |
| 46 | /** |
| 47 | * @defgroup IxEthMii IXP400 Ethernet Phy Access (IxEthMii) API |
| 48 | * |
| 49 | * @brief ethMii is a library that does provides access to the |
| 50 | * Ethernet PHYs |
| 51 | * |
| 52 | *@{ |
| 53 | */ |
| 54 | |
| 55 | /** |
| 56 | * @ingroup IxEthMii |
| 57 | * |
| 58 | * @fn ixEthMiiPhyScan(BOOL phyPresent[], UINT32 maxPhyCount) |
| 59 | * |
| 60 | * @brief Scan the MDIO bus for PHYs |
| 61 | * This function scans PHY addresses 0 through 31, and sets phyPresent[n] to |
York Sun | 4a59809 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 62 | * true if a phy is discovered at address n. |
Wolfgang Denk | 4646d2a | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 63 | * |
| 64 | * - Reentrant - no |
| 65 | * - ISR Callable - no |
| 66 | * |
| 67 | * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock. |
| 68 | * |
| 69 | * @param phyPresent BOOL [in] - boolean array of IXP425_ETH_ACC_MII_MAX_ADDR entries |
| 70 | * @param maxPhyCount UINT32 [in] - number of PHYs to search for (the scan will stop when |
| 71 | * the indicated number of PHYs is found). |
| 72 | * |
| 73 | * @return IX_STATUS |
| 74 | * - IX_ETH_ACC_SUCCESS |
| 75 | * - IX_ETH_ACC_FAIL : invalid arguments. |
| 76 | * |
| 77 | * <hr> |
| 78 | */ |
| 79 | PUBLIC IX_STATUS ixEthMiiPhyScan(BOOL phyPresent[], UINT32 maxPhyCount); |
| 80 | |
| 81 | /** |
| 82 | * @ingroup IxEthMii |
| 83 | * |
| 84 | * @fn ixEthMiiPhyConfig(UINT32 phyAddr, |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 85 | BOOL speed100, |
| 86 | BOOL fullDuplex, |
| 87 | BOOL autonegotiate) |
Wolfgang Denk | 4646d2a | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 88 | * |
| 89 | * |
| 90 | * @brief Configure a PHY |
| 91 | * Configure a PHY's speed, duplex and autonegotiation status |
| 92 | * |
| 93 | * - Reentrant - no |
| 94 | * - ISR Callable - no |
| 95 | * |
| 96 | * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock. |
| 97 | * |
| 98 | * @param phyAddr UINT32 [in] |
York Sun | 4a59809 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 99 | * @param speed100 BOOL [in] - set to true for 100Mbit/s operation, false for 10Mbit/s |
| 100 | * @param fullDuplex BOOL [in] - set to true for Full Duplex, false for Half Duplex |
| 101 | * @param autonegotiate BOOL [in] - set to true to enable autonegotiation |
Wolfgang Denk | 4646d2a | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 102 | * |
| 103 | * @return IX_STATUS |
| 104 | * - IX_SUCCESS |
| 105 | * - IX_FAIL : invalid arguments. |
| 106 | * |
| 107 | * <hr> |
| 108 | */ |
| 109 | PUBLIC IX_STATUS ixEthMiiPhyConfig(UINT32 phyAddr, |
| 110 | BOOL speed100, |
| 111 | BOOL fullDuplex, |
| 112 | BOOL autonegotiate); |
| 113 | |
| 114 | /** |
| 115 | * @ingroup IxEthMii |
| 116 | * |
| 117 | * @fn ixEthMiiPhyLoopbackEnable(UINT32 phyAddr) |
| 118 | * |
| 119 | * |
| 120 | * @brief Enable PHY Loopback in a specific Eth MII port |
| 121 | * |
| 122 | * @note When PHY Loopback is enabled, frames sent out to the PHY from the |
| 123 | * IXP400 will be looped back to the IXP400. They will not be transmitted out |
| 124 | * on the wire. |
| 125 | * |
| 126 | * - Reentrant - no |
| 127 | * - ISR Callable - no |
| 128 | * |
| 129 | * @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31) |
| 130 | * |
| 131 | * @return IX_STATUS |
| 132 | * - IX_SUCCESS |
| 133 | * - IX_FAIL : invalid arguments. |
| 134 | * <hr> |
| 135 | */ |
| 136 | PUBLIC IX_STATUS |
| 137 | ixEthMiiPhyLoopbackEnable (UINT32 phyAddr); |
| 138 | |
| 139 | /** |
| 140 | * @ingroup IxEthMii |
| 141 | * |
| 142 | * @fn ixEthMiiPhyLoopbackDisable(UINT32 phyAddr) |
| 143 | * |
| 144 | * |
| 145 | * @brief Disable PHY Loopback in a specific Eth MII port |
| 146 | * |
| 147 | * - Reentrant - no |
| 148 | * - ISR Callable - no |
| 149 | * |
| 150 | * @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31) |
| 151 | * |
| 152 | * @return IX_STATUS |
| 153 | * - IX_SUCCESS |
| 154 | * - IX_FAIL : invalid arguments. |
| 155 | * <hr> |
| 156 | */ |
| 157 | PUBLIC IX_STATUS |
| 158 | ixEthMiiPhyLoopbackDisable (UINT32 phyAddr); |
| 159 | |
| 160 | /** |
| 161 | * @ingroup IxEthMii |
| 162 | * |
| 163 | * @fn ixEthMiiPhyReset(UINT32 phyAddr) |
| 164 | * |
| 165 | * @brief Reset a PHY |
| 166 | * Reset a PHY |
| 167 | * |
| 168 | * - Reentrant - no |
| 169 | * - ISR Callable - no |
| 170 | * |
| 171 | * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock. |
| 172 | * |
| 173 | * @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31) |
| 174 | * |
| 175 | * @return IX_STATUS |
| 176 | * - IX_SUCCESS |
| 177 | * - IX_FAIL : invalid arguments. |
| 178 | * |
| 179 | * <hr> |
| 180 | */ |
| 181 | PUBLIC IX_STATUS ixEthMiiPhyReset(UINT32 phyAddr); |
| 182 | |
| 183 | |
| 184 | /** |
| 185 | * @ingroup IxEthMii |
| 186 | * |
| 187 | * @fn ixEthMiiLinkStatus(UINT32 phyAddr, |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 188 | BOOL *linkUp, |
| 189 | BOOL *speed100, |
| 190 | BOOL *fullDuplex, |
| 191 | BOOL *autoneg) |
Wolfgang Denk | 4646d2a | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 192 | * |
| 193 | * @brief Retrieve the current status of a PHY |
| 194 | * Retrieve the link, speed, duplex and autonegotiation status of a PHY |
| 195 | * |
| 196 | * - Reentrant - no |
| 197 | * - ISR Callable - no |
| 198 | * |
| 199 | * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock. |
| 200 | * |
| 201 | * @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31) |
York Sun | 4a59809 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 202 | * @param linkUp BOOL [out] - set to true if the link is up |
| 203 | * @param speed100 BOOL [out] - set to true indicates 100Mbit/s, false indicates 10Mbit/s |
| 204 | * @param fullDuplex BOOL [out] - set to true indicates Full Duplex, false indicates Half Duplex |
| 205 | * @param autoneg BOOL [out] - set to true indicates autonegotiation is enabled, false indicates autonegotiation is disabled |
Wolfgang Denk | 4646d2a | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 206 | * |
| 207 | * @return IX_STATUS |
| 208 | * - IX_SUCCESS |
| 209 | * - IX_FAIL : invalid arguments. |
| 210 | * |
| 211 | * <hr> |
| 212 | */ |
| 213 | PUBLIC IX_STATUS ixEthMiiLinkStatus(UINT32 phyAddr, |
| 214 | BOOL *linkUp, |
| 215 | BOOL *speed100, |
| 216 | BOOL *fullDuplex, |
| 217 | BOOL *autoneg); |
| 218 | |
| 219 | /** |
| 220 | * @ingroup IxEthMii |
| 221 | * |
| 222 | * @fn ixEthMiiPhyShow (UINT32 phyAddr) |
| 223 | * |
| 224 | * |
| 225 | * @brief Display information on a specified PHY |
| 226 | * Display link status, speed, duplex and Auto Negotiation status |
| 227 | * |
| 228 | * - Reentrant - no |
| 229 | * - ISR Callable - no |
| 230 | * |
| 231 | * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock. |
| 232 | * |
| 233 | * @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31) |
| 234 | * |
| 235 | * @return IX_STATUS |
| 236 | * - IX_SUCCESS |
| 237 | * - IX_FAIL : invalid arguments. |
| 238 | * |
| 239 | * <hr> |
| 240 | */ |
| 241 | PUBLIC IX_STATUS ixEthMiiPhyShow (UINT32 phyAddr); |
| 242 | |
| 243 | #endif /* ndef IxEthMii_H */ |
| 244 | /** |
| 245 | *@} |
| 246 | */ |