lan8710a.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /**
  2. * \file lan8710a.h
  3. *
  4. * \brief Macros and function definitions for LAN8710A PHY
  5. */
  6. /*
  7. * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
  8. */
  9. /*
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. *
  14. * Redistributions of source code must retain the above copyright
  15. * notice, this list of conditions and the following disclaimer.
  16. *
  17. * Redistributions in binary form must reproduce the above copyright
  18. * notice, this list of conditions and the following disclaimer in the
  19. * documentation and/or other materials provided with the
  20. * distribution.
  21. *
  22. * Neither the name of Texas Instruments Incorporated nor the names of
  23. * its contributors may be used to endorse or promote products derived
  24. * from this software without specific prior written permission.
  25. *
  26. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  27. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  28. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  29. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  30. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  31. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  32. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  33. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  34. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  35. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  36. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  37. *
  38. */
  39. #ifndef _LAN8710_H_
  40. #define _LAN8710_H_
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif
  44. /* PHY register offset definitions */
  45. #define PHY_BCR (0u)
  46. #define PHY_BSR (1u)
  47. #define PHY_ID1 (2u)
  48. #define PHY_ID2 (3u)
  49. #define PHY_AUTONEG_ADV (4u)
  50. #define PHY_LINK_PARTNER_ABLTY (5u)
  51. /* PHY status definitions */
  52. #define PHY_ID_SHIFT (16u)
  53. #define PHY_SOFTRESET (0x8000)
  54. #define PHY_AUTONEG_ENABLE (0x1000u)
  55. #define PHY_AUTONEG_RESTART (0x0200u)
  56. #define PHY_AUTONEG_COMPLETE (0x0020u)
  57. #define PHY_AUTONEG_INCOMPLETE (0x0000u)
  58. #define PHY_AUTONEG_STATUS (0x0020u)
  59. #define PHY_AUTONEG_ABLE (0x0008u)
  60. #define PHY_LPBK_ENABLE (0x4000u)
  61. #define PHY_LINK_STATUS (0x0004u)
  62. /* PHY ID. The LSB nibble will vary between different phy revisions */
  63. #define LAN8710A_PHY_ID (0x0007C0F0u)
  64. #define LAN8710A_PHY_ID_REV_MASK (0x0000000Fu)
  65. /* Pause operations */
  66. #define LAN8710A_PAUSE_NIL (0x0000u)
  67. #define LAN8710A_PAUSE_SYM (0x0400u)
  68. #define LAN8710A_PAUSE_ASYM (0x0800u)
  69. #define LAN8710A_PAUSE_BOTH_SYM_ASYM (0x0C00u)
  70. /* 100 Base TX Full Duplex capablity */
  71. #define LAN8710A_100BTX_HD (0x0000u)
  72. #define LAN8710A_100BTX_FD (0x0100u)
  73. /* 100 Base TX capability */
  74. #define LAN8710A_NO_100BTX (0x0000u)
  75. #define LAN8710A_100BTX (0x0080u)
  76. /* 10 BaseT duplex capabilities */
  77. #define LAN8710A_10BT_HD (0x0000u)
  78. #define LAN8710A_10BT_FD (0x0040u)
  79. /* 10 BaseT ability*/
  80. #define LAN8710A_NO_10BT (0x0000u)
  81. #define LAN8710A_10BT (0x0020u)
  82. /**************************************************************************
  83. API function Prototypes
  84. **************************************************************************/
  85. extern unsigned int Lan8710aIDGet(unsigned int mdioBaseAddr,
  86. unsigned int phyAddr);
  87. extern void Lan8710aReset(unsigned int mdioBaseAddr,
  88. unsigned int phyAddr);
  89. extern unsigned int Lan8710aLoopBackEnable(unsigned int mdioBaseAddr,
  90. unsigned int phyAddr);
  91. extern unsigned int Lan8710aLoopBackDisable(unsigned int mdioBaseAddr,
  92. unsigned int phyAddr);
  93. extern unsigned int Lan8710aConfigure(unsigned int mdioBaseAddr,
  94. unsigned int phyAddr,
  95. unsigned short speed,
  96. unsigned short dulplexMode);
  97. extern unsigned int Lan8710aAutoNegotiate(unsigned int mdioBaseAddr,
  98. unsigned int phyAddr,
  99. unsigned short advVal);
  100. extern unsigned int Lan8710aRegRead(unsigned int mdioBaseAddr,
  101. unsigned int phyAddr,
  102. unsigned int regIdx,
  103. unsigned short *regValAdr);
  104. extern void Lan8710aRegWrite(unsigned int mdioBaseAddr,
  105. unsigned int phyAddr,
  106. unsigned int regIdx,
  107. unsigned short regVal);
  108. extern unsigned int Lan8710aPartnerAbilityGet(unsigned int mdioBaseAddr,
  109. unsigned int phyAddr,
  110. unsigned short *ptnerAblty);
  111. unsigned int Lan8710aLinkStatusGet(unsigned int mdioBaseAddr,
  112. unsigned int phyAddr,
  113. volatile unsigned int retries);
  114. #ifdef __cplusplus
  115. }
  116. #endif
  117. #endif