gw16083.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*
  2. * drivers/net/phy/mv88e6176.h
  3. *
  4. * Driver for Marvell Switch
  5. *
  6. * Author: Tim Harvey
  7. *
  8. * Copyright (c) 2014 Tim Harvey <tharvey@gateworks.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at your
  13. * option) any later version.
  14. *
  15. */
  16. #ifndef _GW16083_H_
  17. #define _GW16083_H_
  18. #define MII_MARVELL_PHY_PAGE 22
  19. /*
  20. * I2C Addresses
  21. */
  22. #define GW16083_I2C_ADDR_SFP1 0x50
  23. #define GW16083_I2C_ADDR_SFP2 0x51
  24. #define GW16083_I2C_ADDR_EEPROM 0x52
  25. #define GW16083_I2C_ADDR_PCA9543 0x70
  26. /*
  27. * MV88E1111 PHY Registers
  28. */
  29. enum {
  30. MII_M1111_PHY_CONTROL = 0,
  31. MII_M1111_PHY_STATUS = 1,
  32. MII_M1111_PHY_IDENT0 = 2,
  33. MII_M1111_PHY_IDENT1 = 3,
  34. MII_M1111_PHY_EXT_CR = 20,
  35. MII_M1111_PHY_LED_CONTROL = 24,
  36. MII_M1111_PHY_EXT_SR = 27,
  37. };
  38. #define MII_M1111_PHY_ID_MASK 0xfffffff0
  39. #define MII_M1111_PHY_ID 0x01410cc0
  40. #define MII_M1111_PHY_CONTROL_RESET (1 << 15)
  41. #define MII_M1111_PHY_LED_DIRECT 0x4100
  42. #define MII_M1111_PHY_LED_PULSE_STR 0x4111
  43. #define MII_M1111_PHY_LED_COMBINE 0x411c
  44. #define MII_M1111_RX_DELAY 0x80
  45. #define MII_M1111_TX_DELAY 0x2
  46. /*
  47. * MV88E6176 Switch Registers
  48. */
  49. /* PHY Addrs */
  50. #define MV_BASE 0x10
  51. #define MV_GLOBAL1 0x1b
  52. #define MV_GLOBAL2 0x1c
  53. #define MV_GLOBAL3 0x1d
  54. /* Global2 Registers */
  55. enum {
  56. MV_SMI_PHY_COMMAND = 0x18,
  57. MV_SMI_PHY_DATA = 0x19,
  58. MV_SCRATCH_MISC = 0x1A,
  59. };
  60. /* Scratch And Misc Reg offsets */
  61. enum {
  62. MV_GPIO_MODE = 0x60,
  63. MV_GPIO_DIR = 0x62,
  64. MV_GPIO_DATA = 0x64,
  65. MV_GPIO76_CNTL = 0x6B,
  66. MV_GPIO54_CNTL = 0x6A,
  67. MV_GPIO32_CNTL = 0x69,
  68. MV_GPIO10_CNTL = 0x68,
  69. MV_CONFIG0 = 0x70,
  70. MV_CONFIG1 = 0x71,
  71. MV_CONFIG2 = 0x72,
  72. MV_CONFIG3 = 0x73,
  73. };
  74. /* PHY Registers */
  75. enum {
  76. MV_PHY_CONTROL = 0x00,
  77. MV_PHY_STATUS = 0x01,
  78. MV_PHY_IDENT0 = 0x02,
  79. MV_PHY_IDENT1 = 0x03,
  80. MV_PHY_ANEG = 0x04,
  81. MV_PHY_LINK_ABILITY = 0x05,
  82. MV_PHY_ANEG_EXPAND = 0x06,
  83. MV_PHY_XMIT_NEXTP = 0x07,
  84. MV_PHY_LINK_NEXTP = 0x08,
  85. MV_PHY_CONTROL1 = 0x10,
  86. MV_PHY_STATUS1 = 0x11,
  87. MV_PHY_INTR_EN = 0x12,
  88. };
  89. /* Port Registers */
  90. enum {
  91. MV_PORT_STATUS = 0x00,
  92. MV_PORT_PHYS_CONTROL = 0x01,
  93. MV_PORT_IDENT = 0x03,
  94. MV_PORT_CONTROL = 0x04,
  95. MV_PORT_VLANMAP = 0x06,
  96. MV_PORT_ASSOC = 0x0b,
  97. MV_PORT_RXCOUNT = 0x10,
  98. MV_PORT_TXCOUNT = 0x11,
  99. };
  100. #define SMIBUSY (1<<15)
  101. #define SMIMODE22 (1<<12)
  102. #define SMIOP_READ (2<<10)
  103. #define SMIOP_WRITE (1<<10)
  104. #define DEVADDR 5
  105. #define REGADDR 0
  106. #define MV_IDENT_MASK 0x0000fff0
  107. #define MV_IDENT_VALUE 0x00001760
  108. #endif /* _GW16083_H_ */