sun4i-emac.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Allwinner EMAC Fast Ethernet driver for Linux.
  3. *
  4. * Copyright 2012 Stefan Roese <sr@denx.de>
  5. * Copyright 2013 Maxime Ripard <maxime.ripard@free-electrons.com>
  6. *
  7. * Based on the Linux driver provided by Allwinner:
  8. * Copyright (C) 1997 Sten Wang
  9. *
  10. * This file is licensed under the terms of the GNU General Public
  11. * License version 2. This program is licensed "as is" without any
  12. * warranty of any kind, whether express or implied.
  13. */
  14. #ifndef _SUN4I_EMAC_H_
  15. #define _SUN4I_EMAC_H_
  16. #define EMAC_CTL_REG (0x00)
  17. #define EMAC_CTL_RESET (1 << 0)
  18. #define EMAC_CTL_TX_EN (1 << 1)
  19. #define EMAC_CTL_RX_EN (1 << 2)
  20. #define EMAC_TX_MODE_REG (0x04)
  21. #define EMAC_TX_MODE_ABORTED_FRAME_EN (1 << 0)
  22. #define EMAC_TX_MODE_DMA_EN (1 << 1)
  23. #define EMAC_TX_FLOW_REG (0x08)
  24. #define EMAC_TX_CTL0_REG (0x0c)
  25. #define EMAC_TX_CTL1_REG (0x10)
  26. #define EMAC_TX_INS_REG (0x14)
  27. #define EMAC_TX_PL0_REG (0x18)
  28. #define EMAC_TX_PL1_REG (0x1c)
  29. #define EMAC_TX_STA_REG (0x20)
  30. #define EMAC_TX_IO_DATA_REG (0x24)
  31. #define EMAC_TX_IO_DATA1_REG (0x28)
  32. #define EMAC_TX_TSVL0_REG (0x2c)
  33. #define EMAC_TX_TSVH0_REG (0x30)
  34. #define EMAC_TX_TSVL1_REG (0x34)
  35. #define EMAC_TX_TSVH1_REG (0x38)
  36. #define EMAC_RX_CTL_REG (0x3c)
  37. #define EMAC_RX_CTL_AUTO_DRQ_EN (1 << 1)
  38. #define EMAC_RX_CTL_DMA_EN (1 << 2)
  39. #define EMAC_RX_CTL_PASS_ALL_EN (1 << 4)
  40. #define EMAC_RX_CTL_PASS_CTL_EN (1 << 5)
  41. #define EMAC_RX_CTL_PASS_CRC_ERR_EN (1 << 6)
  42. #define EMAC_RX_CTL_PASS_LEN_ERR_EN (1 << 7)
  43. #define EMAC_RX_CTL_PASS_LEN_OOR_EN (1 << 8)
  44. #define EMAC_RX_CTL_ACCEPT_UNICAST_EN (1 << 16)
  45. #define EMAC_RX_CTL_DA_FILTER_EN (1 << 17)
  46. #define EMAC_RX_CTL_ACCEPT_MULTICAST_EN (1 << 20)
  47. #define EMAC_RX_CTL_HASH_FILTER_EN (1 << 21)
  48. #define EMAC_RX_CTL_ACCEPT_BROADCAST_EN (1 << 22)
  49. #define EMAC_RX_CTL_SA_FILTER_EN (1 << 24)
  50. #define EMAC_RX_CTL_SA_FILTER_INVERT_EN (1 << 25)
  51. #define EMAC_RX_HASH0_REG (0x40)
  52. #define EMAC_RX_HASH1_REG (0x44)
  53. #define EMAC_RX_STA_REG (0x48)
  54. #define EMAC_RX_IO_DATA_REG (0x4c)
  55. #define EMAC_RX_IO_DATA_LEN(x) (x & 0xffff)
  56. #define EMAC_RX_IO_DATA_STATUS(x) ((x >> 16) & 0xffff)
  57. #define EMAC_RX_IO_DATA_STATUS_CRC_ERR (1 << 4)
  58. #define EMAC_RX_IO_DATA_STATUS_LEN_ERR (3 << 5)
  59. #define EMAC_RX_IO_DATA_STATUS_OK (1 << 7)
  60. #define EMAC_RX_FBC_REG (0x50)
  61. #define EMAC_INT_CTL_REG (0x54)
  62. #define EMAC_INT_STA_REG (0x58)
  63. #define EMAC_MAC_CTL0_REG (0x5c)
  64. #define EMAC_MAC_CTL0_RX_FLOW_CTL_EN (1 << 2)
  65. #define EMAC_MAC_CTL0_TX_FLOW_CTL_EN (1 << 3)
  66. #define EMAC_MAC_CTL0_SOFT_RESET (1 << 15)
  67. #define EMAC_MAC_CTL1_REG (0x60)
  68. #define EMAC_MAC_CTL1_DUPLEX_EN (1 << 0)
  69. #define EMAC_MAC_CTL1_LEN_CHECK_EN (1 << 1)
  70. #define EMAC_MAC_CTL1_HUGE_FRAME_EN (1 << 2)
  71. #define EMAC_MAC_CTL1_DELAYED_CRC_EN (1 << 3)
  72. #define EMAC_MAC_CTL1_CRC_EN (1 << 4)
  73. #define EMAC_MAC_CTL1_PAD_EN (1 << 5)
  74. #define EMAC_MAC_CTL1_PAD_CRC_EN (1 << 6)
  75. #define EMAC_MAC_CTL1_AD_SHORT_FRAME_EN (1 << 7)
  76. #define EMAC_MAC_CTL1_BACKOFF_DIS (1 << 12)
  77. #define EMAC_MAC_IPGT_REG (0x64)
  78. #define EMAC_MAC_IPGT_HALF_DUPLEX (0x12)
  79. #define EMAC_MAC_IPGT_FULL_DUPLEX (0x15)
  80. #define EMAC_MAC_IPGR_REG (0x68)
  81. #define EMAC_MAC_IPGR_IPG1 (0x0c)
  82. #define EMAC_MAC_IPGR_IPG2 (0x12)
  83. #define EMAC_MAC_CLRT_REG (0x6c)
  84. #define EMAC_MAC_CLRT_COLLISION_WINDOW (0x37)
  85. #define EMAC_MAC_CLRT_RM (0x0f)
  86. #define EMAC_MAC_MAXF_REG (0x70)
  87. #define EMAC_MAC_SUPP_REG (0x74)
  88. #define EMAC_MAC_TEST_REG (0x78)
  89. #define EMAC_MAC_MCFG_REG (0x7c)
  90. #define EMAC_MAC_A0_REG (0x98)
  91. #define EMAC_MAC_A1_REG (0x9c)
  92. #define EMAC_MAC_A2_REG (0xa0)
  93. #define EMAC_SAFX_L_REG0 (0xa4)
  94. #define EMAC_SAFX_H_REG0 (0xa8)
  95. #define EMAC_SAFX_L_REG1 (0xac)
  96. #define EMAC_SAFX_H_REG1 (0xb0)
  97. #define EMAC_SAFX_L_REG2 (0xb4)
  98. #define EMAC_SAFX_H_REG2 (0xb8)
  99. #define EMAC_SAFX_L_REG3 (0xbc)
  100. #define EMAC_SAFX_H_REG3 (0xc0)
  101. #define EMAC_PHY_DUPLEX (1 << 8)
  102. #define EMAC_EEPROM_MAGIC (0x444d394b)
  103. #define EMAC_UNDOCUMENTED_MAGIC (0x0143414d)
  104. #endif /* _SUN4I_EMAC_H_ */