ep93xx_eth.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * Copyright (C) 2009 Matthias Kaehlcke <matthias@kaehlcke.net>
  3. *
  4. * Copyright (C) 2004, 2005
  5. * Cory T. Tusar, Videon Central, Inc., <ctusar@videon-central.com>
  6. *
  7. * SPDX-License-Identifier: GPL-2.0+
  8. */
  9. #ifndef _EP93XX_ETH_H
  10. #define _EP93XX_ETH_H
  11. #include <net.h>
  12. /**
  13. * #define this to dump device status and queue info during initialization and
  14. * following errors.
  15. */
  16. #undef EP93XX_MAC_DEBUG
  17. /**
  18. * Number of descriptor and status entries in our RX queues.
  19. * It must be power of 2 !
  20. */
  21. #define NUMRXDESC PKTBUFSRX
  22. /**
  23. * Number of descriptor and status entries in our TX queues.
  24. */
  25. #define NUMTXDESC 1
  26. /**
  27. * 944 = (1024 - 64) - 16, Fifo size - Minframesize - 16 (Chip FACT)
  28. */
  29. #define TXSTARTMAX 944
  30. /**
  31. * Receive descriptor queue entry
  32. */
  33. struct rx_descriptor {
  34. uint32_t word1;
  35. uint32_t word2;
  36. };
  37. /**
  38. * Receive status queue entry
  39. */
  40. struct rx_status {
  41. uint32_t word1;
  42. uint32_t word2;
  43. };
  44. #define RX_STATUS_RWE(rx_status) ((rx_status->word1 >> 30) & 0x01)
  45. #define RX_STATUS_RFP(rx_status) ((rx_status->word1 >> 31) & 0x01)
  46. #define RX_STATUS_FRAME_LEN(rx_status) (rx_status->word2 & 0xFFFF)
  47. /**
  48. * Transmit descriptor queue entry
  49. */
  50. struct tx_descriptor {
  51. uint32_t word1;
  52. uint32_t word2;
  53. };
  54. #define TX_DESC_EOF (1 << 31)
  55. /**
  56. * Transmit status queue entry
  57. */
  58. struct tx_status {
  59. uint32_t word1;
  60. };
  61. #define TX_STATUS_TXWE(tx_status) (((tx_status)->word1 >> 30) & 0x01)
  62. #define TX_STATUS_TXFP(tx_status) (((tx_status)->word1 >> 31) & 0x01)
  63. /**
  64. * Transmit descriptor queue
  65. */
  66. struct tx_descriptor_queue {
  67. struct tx_descriptor *base;
  68. struct tx_descriptor *current;
  69. struct tx_descriptor *end;
  70. };
  71. /**
  72. * Transmit status queue
  73. */
  74. struct tx_status_queue {
  75. struct tx_status *base;
  76. volatile struct tx_status *current;
  77. struct tx_status *end;
  78. };
  79. /**
  80. * Receive descriptor queue
  81. */
  82. struct rx_descriptor_queue {
  83. struct rx_descriptor *base;
  84. struct rx_descriptor *current;
  85. struct rx_descriptor *end;
  86. };
  87. /**
  88. * Receive status queue
  89. */
  90. struct rx_status_queue {
  91. struct rx_status *base;
  92. volatile struct rx_status *current;
  93. struct rx_status *end;
  94. };
  95. /**
  96. * EP93xx MAC private data structure
  97. */
  98. struct ep93xx_priv {
  99. struct rx_descriptor_queue rx_dq;
  100. struct rx_status_queue rx_sq;
  101. void *rx_buffer[NUMRXDESC];
  102. struct tx_descriptor_queue tx_dq;
  103. struct tx_status_queue tx_sq;
  104. struct mac_regs *regs;
  105. };
  106. #endif