mv88e1xxx.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* $Date: 2005/03/07 23:59:05 $ $RCSfile: mv88e1xxx.h,v $ $Revision: 1.13 $ */
  3. #ifndef CHELSIO_MV8E1XXX_H
  4. #define CHELSIO_MV8E1XXX_H
  5. #ifndef BMCR_SPEED1000
  6. # define BMCR_SPEED1000 0x40
  7. #endif
  8. #ifndef ADVERTISE_PAUSE
  9. # define ADVERTISE_PAUSE 0x400
  10. #endif
  11. #ifndef ADVERTISE_PAUSE_ASYM
  12. # define ADVERTISE_PAUSE_ASYM 0x800
  13. #endif
  14. /* Gigabit MII registers */
  15. #define MII_GBCR 9 /* 1000Base-T control register */
  16. #define MII_GBSR 10 /* 1000Base-T status register */
  17. /* 1000Base-T control register fields */
  18. #define GBCR_ADV_1000HALF 0x100
  19. #define GBCR_ADV_1000FULL 0x200
  20. #define GBCR_PREFER_MASTER 0x400
  21. #define GBCR_MANUAL_AS_MASTER 0x800
  22. #define GBCR_MANUAL_CONFIG_ENABLE 0x1000
  23. /* 1000Base-T status register fields */
  24. #define GBSR_LP_1000HALF 0x400
  25. #define GBSR_LP_1000FULL 0x800
  26. #define GBSR_REMOTE_OK 0x1000
  27. #define GBSR_LOCAL_OK 0x2000
  28. #define GBSR_LOCAL_MASTER 0x4000
  29. #define GBSR_MASTER_FAULT 0x8000
  30. /* Marvell PHY interrupt status bits. */
  31. #define MV88E1XXX_INTR_JABBER 0x0001
  32. #define MV88E1XXX_INTR_POLARITY_CHNG 0x0002
  33. #define MV88E1XXX_INTR_ENG_DETECT_CHNG 0x0010
  34. #define MV88E1XXX_INTR_DOWNSHIFT 0x0020
  35. #define MV88E1XXX_INTR_MDI_XOVER_CHNG 0x0040
  36. #define MV88E1XXX_INTR_FIFO_OVER_UNDER 0x0080
  37. #define MV88E1XXX_INTR_FALSE_CARRIER 0x0100
  38. #define MV88E1XXX_INTR_SYMBOL_ERROR 0x0200
  39. #define MV88E1XXX_INTR_LINK_CHNG 0x0400
  40. #define MV88E1XXX_INTR_AUTONEG_DONE 0x0800
  41. #define MV88E1XXX_INTR_PAGE_RECV 0x1000
  42. #define MV88E1XXX_INTR_DUPLEX_CHNG 0x2000
  43. #define MV88E1XXX_INTR_SPEED_CHNG 0x4000
  44. #define MV88E1XXX_INTR_AUTONEG_ERR 0x8000
  45. /* Marvell PHY specific registers. */
  46. #define MV88E1XXX_SPECIFIC_CNTRL_REGISTER 16
  47. #define MV88E1XXX_SPECIFIC_STATUS_REGISTER 17
  48. #define MV88E1XXX_INTERRUPT_ENABLE_REGISTER 18
  49. #define MV88E1XXX_INTERRUPT_STATUS_REGISTER 19
  50. #define MV88E1XXX_EXT_PHY_SPECIFIC_CNTRL_REGISTER 20
  51. #define MV88E1XXX_RECV_ERR_CNTR_REGISTER 21
  52. #define MV88E1XXX_RES_REGISTER 22
  53. #define MV88E1XXX_GLOBAL_STATUS_REGISTER 23
  54. #define MV88E1XXX_LED_CONTROL_REGISTER 24
  55. #define MV88E1XXX_MANUAL_LED_OVERRIDE_REGISTER 25
  56. #define MV88E1XXX_EXT_PHY_SPECIFIC_CNTRL_2_REGISTER 26
  57. #define MV88E1XXX_EXT_PHY_SPECIFIC_STATUS_REGISTER 27
  58. #define MV88E1XXX_VIRTUAL_CABLE_TESTER_REGISTER 28
  59. #define MV88E1XXX_EXTENDED_ADDR_REGISTER 29
  60. #define MV88E1XXX_EXTENDED_REGISTER 30
  61. /* PHY specific control register fields */
  62. #define S_PSCR_MDI_XOVER_MODE 5
  63. #define M_PSCR_MDI_XOVER_MODE 0x3
  64. #define V_PSCR_MDI_XOVER_MODE(x) ((x) << S_PSCR_MDI_XOVER_MODE)
  65. #define G_PSCR_MDI_XOVER_MODE(x) (((x) >> S_PSCR_MDI_XOVER_MODE) & M_PSCR_MDI_XOVER_MODE)
  66. /* Extended PHY specific control register fields */
  67. #define S_DOWNSHIFT_ENABLE 8
  68. #define V_DOWNSHIFT_ENABLE (1 << S_DOWNSHIFT_ENABLE)
  69. #define S_DOWNSHIFT_CNT 9
  70. #define M_DOWNSHIFT_CNT 0x7
  71. #define V_DOWNSHIFT_CNT(x) ((x) << S_DOWNSHIFT_CNT)
  72. #define G_DOWNSHIFT_CNT(x) (((x) >> S_DOWNSHIFT_CNT) & M_DOWNSHIFT_CNT)
  73. /* PHY specific status register fields */
  74. #define S_PSSR_JABBER 0
  75. #define V_PSSR_JABBER (1 << S_PSSR_JABBER)
  76. #define S_PSSR_POLARITY 1
  77. #define V_PSSR_POLARITY (1 << S_PSSR_POLARITY)
  78. #define S_PSSR_RX_PAUSE 2
  79. #define V_PSSR_RX_PAUSE (1 << S_PSSR_RX_PAUSE)
  80. #define S_PSSR_TX_PAUSE 3
  81. #define V_PSSR_TX_PAUSE (1 << S_PSSR_TX_PAUSE)
  82. #define S_PSSR_ENERGY_DETECT 4
  83. #define V_PSSR_ENERGY_DETECT (1 << S_PSSR_ENERGY_DETECT)
  84. #define S_PSSR_DOWNSHIFT_STATUS 5
  85. #define V_PSSR_DOWNSHIFT_STATUS (1 << S_PSSR_DOWNSHIFT_STATUS)
  86. #define S_PSSR_MDI 6
  87. #define V_PSSR_MDI (1 << S_PSSR_MDI)
  88. #define S_PSSR_CABLE_LEN 7
  89. #define M_PSSR_CABLE_LEN 0x7
  90. #define V_PSSR_CABLE_LEN(x) ((x) << S_PSSR_CABLE_LEN)
  91. #define G_PSSR_CABLE_LEN(x) (((x) >> S_PSSR_CABLE_LEN) & M_PSSR_CABLE_LEN)
  92. #define S_PSSR_LINK 10
  93. #define V_PSSR_LINK (1 << S_PSSR_LINK)
  94. #define S_PSSR_STATUS_RESOLVED 11
  95. #define V_PSSR_STATUS_RESOLVED (1 << S_PSSR_STATUS_RESOLVED)
  96. #define S_PSSR_PAGE_RECEIVED 12
  97. #define V_PSSR_PAGE_RECEIVED (1 << S_PSSR_PAGE_RECEIVED)
  98. #define S_PSSR_DUPLEX 13
  99. #define V_PSSR_DUPLEX (1 << S_PSSR_DUPLEX)
  100. #define S_PSSR_SPEED 14
  101. #define M_PSSR_SPEED 0x3
  102. #define V_PSSR_SPEED(x) ((x) << S_PSSR_SPEED)
  103. #define G_PSSR_SPEED(x) (((x) >> S_PSSR_SPEED) & M_PSSR_SPEED)
  104. #endif