mmc.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*******************************************************************************
  2. MMC Header file
  3. Copyright (C) 2011 STMicroelectronics Ltd
  4. This program is free software; you can redistribute it and/or modify it
  5. under the terms and conditions of the GNU General Public License,
  6. version 2, as published by the Free Software Foundation.
  7. This program is distributed in the hope it will be useful, but WITHOUT
  8. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  10. more details.
  11. You should have received a copy of the GNU General Public License along with
  12. this program; if not, write to the Free Software Foundation, Inc.,
  13. 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  14. The full GNU General Public License is included in this distribution in
  15. the file called "COPYING".
  16. Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
  17. *******************************************************************************/
  18. #ifndef __MMC_H__
  19. #define __MMC_H__
  20. /* MMC control register */
  21. /* When set, all counter are reset */
  22. #define MMC_CNTRL_COUNTER_RESET 0x1
  23. /* When set, do not roll over zero after reaching the max value*/
  24. #define MMC_CNTRL_COUNTER_STOP_ROLLOVER 0x2
  25. #define MMC_CNTRL_RESET_ON_READ 0x4 /* Reset after reading */
  26. #define MMC_CNTRL_COUNTER_FREEZER 0x8 /* Freeze counter values to the
  27. * current value.*/
  28. #define MMC_CNTRL_PRESET 0x10
  29. #define MMC_CNTRL_FULL_HALF_PRESET 0x20
  30. #define MMC_GMAC4_OFFSET 0x700
  31. #define MMC_GMAC3_X_OFFSET 0x100
  32. struct stmmac_counters {
  33. unsigned int mmc_tx_octetcount_gb;
  34. unsigned int mmc_tx_framecount_gb;
  35. unsigned int mmc_tx_broadcastframe_g;
  36. unsigned int mmc_tx_multicastframe_g;
  37. unsigned int mmc_tx_64_octets_gb;
  38. unsigned int mmc_tx_65_to_127_octets_gb;
  39. unsigned int mmc_tx_128_to_255_octets_gb;
  40. unsigned int mmc_tx_256_to_511_octets_gb;
  41. unsigned int mmc_tx_512_to_1023_octets_gb;
  42. unsigned int mmc_tx_1024_to_max_octets_gb;
  43. unsigned int mmc_tx_unicast_gb;
  44. unsigned int mmc_tx_multicast_gb;
  45. unsigned int mmc_tx_broadcast_gb;
  46. unsigned int mmc_tx_underflow_error;
  47. unsigned int mmc_tx_singlecol_g;
  48. unsigned int mmc_tx_multicol_g;
  49. unsigned int mmc_tx_deferred;
  50. unsigned int mmc_tx_latecol;
  51. unsigned int mmc_tx_exesscol;
  52. unsigned int mmc_tx_carrier_error;
  53. unsigned int mmc_tx_octetcount_g;
  54. unsigned int mmc_tx_framecount_g;
  55. unsigned int mmc_tx_excessdef;
  56. unsigned int mmc_tx_pause_frame;
  57. unsigned int mmc_tx_vlan_frame_g;
  58. /* MMC RX counter registers */
  59. unsigned int mmc_rx_framecount_gb;
  60. unsigned int mmc_rx_octetcount_gb;
  61. unsigned int mmc_rx_octetcount_g;
  62. unsigned int mmc_rx_broadcastframe_g;
  63. unsigned int mmc_rx_multicastframe_g;
  64. unsigned int mmc_rx_crc_error;
  65. unsigned int mmc_rx_align_error;
  66. unsigned int mmc_rx_run_error;
  67. unsigned int mmc_rx_jabber_error;
  68. unsigned int mmc_rx_undersize_g;
  69. unsigned int mmc_rx_oversize_g;
  70. unsigned int mmc_rx_64_octets_gb;
  71. unsigned int mmc_rx_65_to_127_octets_gb;
  72. unsigned int mmc_rx_128_to_255_octets_gb;
  73. unsigned int mmc_rx_256_to_511_octets_gb;
  74. unsigned int mmc_rx_512_to_1023_octets_gb;
  75. unsigned int mmc_rx_1024_to_max_octets_gb;
  76. unsigned int mmc_rx_unicast_g;
  77. unsigned int mmc_rx_length_error;
  78. unsigned int mmc_rx_autofrangetype;
  79. unsigned int mmc_rx_pause_frames;
  80. unsigned int mmc_rx_fifo_overflow;
  81. unsigned int mmc_rx_vlan_frames_gb;
  82. unsigned int mmc_rx_watchdog_error;
  83. /* IPC */
  84. unsigned int mmc_rx_ipc_intr_mask;
  85. unsigned int mmc_rx_ipc_intr;
  86. /* IPv4 */
  87. unsigned int mmc_rx_ipv4_gd;
  88. unsigned int mmc_rx_ipv4_hderr;
  89. unsigned int mmc_rx_ipv4_nopay;
  90. unsigned int mmc_rx_ipv4_frag;
  91. unsigned int mmc_rx_ipv4_udsbl;
  92. unsigned int mmc_rx_ipv4_gd_octets;
  93. unsigned int mmc_rx_ipv4_hderr_octets;
  94. unsigned int mmc_rx_ipv4_nopay_octets;
  95. unsigned int mmc_rx_ipv4_frag_octets;
  96. unsigned int mmc_rx_ipv4_udsbl_octets;
  97. /* IPV6 */
  98. unsigned int mmc_rx_ipv6_gd_octets;
  99. unsigned int mmc_rx_ipv6_hderr_octets;
  100. unsigned int mmc_rx_ipv6_nopay_octets;
  101. unsigned int mmc_rx_ipv6_gd;
  102. unsigned int mmc_rx_ipv6_hderr;
  103. unsigned int mmc_rx_ipv6_nopay;
  104. /* Protocols */
  105. unsigned int mmc_rx_udp_gd;
  106. unsigned int mmc_rx_udp_err;
  107. unsigned int mmc_rx_tcp_gd;
  108. unsigned int mmc_rx_tcp_err;
  109. unsigned int mmc_rx_icmp_gd;
  110. unsigned int mmc_rx_icmp_err;
  111. unsigned int mmc_rx_udp_gd_octets;
  112. unsigned int mmc_rx_udp_err_octets;
  113. unsigned int mmc_rx_tcp_gd_octets;
  114. unsigned int mmc_rx_tcp_err_octets;
  115. unsigned int mmc_rx_icmp_gd_octets;
  116. unsigned int mmc_rx_icmp_err_octets;
  117. };
  118. void dwmac_mmc_ctrl(void __iomem *ioaddr, unsigned int mode);
  119. void dwmac_mmc_intr_all_mask(void __iomem *ioaddr);
  120. void dwmac_mmc_read(void __iomem *ioaddr, struct stmmac_counters *mmc);
  121. #endif /* __MMC_H__ */