ep93xx_eth.h 2.3 KB

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