bcm5221.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Broadcom BCM5221 Ethernet PHY
  3. *
  4. * (C) Copyright 2005 REA Elektronik GmbH <www.rea.de>
  5. * Anders Larsen <alarsen@rea.de>
  6. *
  7. * See file CREDITS for list of people who contributed to this
  8. * project.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. */
  25. #define BCM5221_BMCR 0 /* Basic Mode Control Register */
  26. #define BCM5221_BMSR 1 /* Basic Mode Status Register */
  27. #define BCM5221_PHYID1 2 /* PHY Identifier Register 1 */
  28. #define BCM5221_PHYID2 3 /* PHY Identifier Register 2 */
  29. #define BCM5221_ANAR 4 /* Auto-negotiation Advertisement Register */
  30. #define BCM5221_ANLPAR 5 /* Auto-negotiation Link Partner Ability Register */
  31. #define BCM5221_ANER 6 /* Auto-negotiation Expansion Register */
  32. #define BCM5221_ACSR 24 /* Auxiliary Control/Status Register */
  33. #define BCM5221_INTR 26 /* Interrupt Register */
  34. /* --Bit definitions: BCM5221_BMCR */
  35. #define BCM5221_RESET (1 << 15) /* 1= Software Reset; 0=Normal Operation */
  36. #define BCM5221_LOOPBACK (1 << 14) /* 1=loopback Enabled; 0=Normal Operation */
  37. #define BCM5221_SPEED_SELECT (1 << 13) /* 1=100Mbps; 0=10Mbps */
  38. #define BCM5221_AUTONEG (1 << 12)
  39. #define BCM5221_POWER_DOWN (1 << 11)
  40. #define BCM5221_ISOLATE (1 << 10)
  41. #define BCM5221_RESTART_AUTONEG (1 << 9)
  42. #define BCM5221_DUPLEX_MODE (1 << 8)
  43. #define BCM5221_COLLISION_TEST (1 << 7)
  44. /*--Bit definitions: BCM5221_BMSR */
  45. #define BCM5221_100BASE_T4 (1 << 15)
  46. #define BCM5221_100BASE_TX_FD (1 << 14)
  47. #define BCM5221_100BASE_TX_HD (1 << 13)
  48. #define BCM5221_10BASE_T_FD (1 << 12)
  49. #define BCM5221_10BASE_T_HD (1 << 11)
  50. #define BCM5221_MF_PREAMB_SUPPR (1 << 6)
  51. #define BCM5221_AUTONEG_COMP (1 << 5)
  52. #define BCM5221_REMOTE_FAULT (1 << 4)
  53. #define BCM5221_AUTONEG_ABILITY (1 << 3)
  54. #define BCM5221_LINK_STATUS (1 << 2)
  55. #define BCM5221_JABBER_DETECT (1 << 1)
  56. #define BCM5221_EXTEND_CAPAB (1 << 0)
  57. /*--definitions: BCM5221_PHYID1 */
  58. #define BCM5221_PHYID1_OUI 0x1018
  59. #define BCM5221_LSB_MASK 0x3F
  60. /*--Bit definitions: BCM5221_ANAR, BCM5221_ANLPAR */
  61. #define BCM5221_NP (1 << 15)
  62. #define BCM5221_ACK (1 << 14)
  63. #define BCM5221_RF (1 << 13)
  64. #define BCM5221_FCS (1 << 10)
  65. #define BCM5221_T4 (1 << 9)
  66. #define BCM5221_TX_FDX (1 << 8)
  67. #define BCM5221_TX_HDX (1 << 7)
  68. #define BCM5221_10_FDX (1 << 6)
  69. #define BCM5221_10_HDX (1 << 5)
  70. #define BCM5221_AN_IEEE_802_3 0x0001
  71. /*--Bit definitions: BCM5221_ANER */
  72. #define BCM5221_PDF (1 << 4)
  73. #define BCM5221_LP_NP_ABLE (1 << 3)
  74. #define BCM5221_NP_ABLE (1 << 2)
  75. #define BCM5221_PAGE_RX (1 << 1)
  76. #define BCM5221_LP_AN_ABLE (1 << 0)
  77. /*--Bit definitions: BCM5221_ACSR */
  78. #define BCM5221_100 (1 << 1)
  79. #define BCM5221_FDX (1 << 0)
  80. /*--Bit definitions: BCM5221_INTR */
  81. #define BCM5221_FDX_LED (1 << 15)
  82. #define BCM5221_INTR_ENABLE (1 << 14)
  83. #define BCM5221_FDX_MASK (1 << 11)
  84. #define BCM5221_SPD_MASK (1 << 10)
  85. #define BCM5221_LINK_MASK (1 << 9)
  86. #define BCM5221_INTR_MASK (1 << 8)
  87. #define BCM5221_FDX_CHG (1 << 3)
  88. #define BCM5221_SPD_CHG (1 << 2)
  89. #define BCM5221_LINK_CHG (1 << 1)
  90. #define BCM5221_INTR_STATUS (1 << 0)
  91. /****************** function prototypes **********************/
  92. unsigned int bcm5221_IsPhyConnected(AT91PS_EMAC p_mac);
  93. unsigned char bcm5221_GetLinkSpeed(AT91PS_EMAC p_mac);
  94. unsigned char bcm5221_AutoNegotiate(AT91PS_EMAC p_mac, int *status);
  95. unsigned char bcm5221_InitPhy(AT91PS_EMAC p_mac);