au1000_eth.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. *
  3. * Alchemy Au1x00 ethernet driver include file
  4. *
  5. * Author: Pete Popov <ppopov@mvista.com>
  6. *
  7. * Copyright 2001 MontaVista Software Inc.
  8. *
  9. * ########################################################################
  10. *
  11. * This program is free software; you can distribute it and/or modify it
  12. * under the terms of the GNU General Public License (Version 2) as
  13. * published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope it will be useful, but WITHOUT
  16. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  17. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  18. * for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License along
  21. * with this program; if not, write to the Free Software Foundation, Inc.,
  22. * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
  23. *
  24. * ########################################################################
  25. *
  26. *
  27. */
  28. #define MAC_IOSIZE 0x10000
  29. #define NUM_RX_DMA 4 /* Au1x00 has 4 rx hardware descriptors */
  30. #define NUM_TX_DMA 4 /* Au1x00 has 4 tx hardware descriptors */
  31. #define NUM_RX_BUFFS 4
  32. #define NUM_TX_BUFFS 4
  33. #define MAX_BUF_SIZE 2048
  34. #define ETH_TX_TIMEOUT (HZ/4)
  35. #define MAC_MIN_PKT_SIZE 64
  36. #define MULTICAST_FILTER_LIMIT 64
  37. /*
  38. * Data Buffer Descriptor. Data buffers must be aligned on 32 byte
  39. * boundary for both, receive and transmit.
  40. */
  41. struct db_dest {
  42. struct db_dest *pnext;
  43. u32 *vaddr;
  44. dma_addr_t dma_addr;
  45. };
  46. /*
  47. * The transmit and receive descriptors are memory
  48. * mapped registers.
  49. */
  50. struct tx_dma {
  51. u32 status;
  52. u32 buff_stat;
  53. u32 len;
  54. u32 pad;
  55. };
  56. struct rx_dma {
  57. u32 status;
  58. u32 buff_stat;
  59. u32 pad[2];
  60. };
  61. /*
  62. * MAC control registers, memory mapped.
  63. */
  64. struct mac_reg {
  65. u32 control;
  66. u32 mac_addr_high;
  67. u32 mac_addr_low;
  68. u32 multi_hash_high;
  69. u32 multi_hash_low;
  70. u32 mii_control;
  71. u32 mii_data;
  72. u32 flow_control;
  73. u32 vlan1_tag;
  74. u32 vlan2_tag;
  75. };
  76. struct au1000_private {
  77. struct db_dest *pDBfree;
  78. struct db_dest db[NUM_RX_BUFFS+NUM_TX_BUFFS];
  79. struct rx_dma *rx_dma_ring[NUM_RX_DMA];
  80. struct tx_dma *tx_dma_ring[NUM_TX_DMA];
  81. struct db_dest *rx_db_inuse[NUM_RX_DMA];
  82. struct db_dest *tx_db_inuse[NUM_TX_DMA];
  83. u32 rx_head;
  84. u32 tx_head;
  85. u32 tx_tail;
  86. u32 tx_full;
  87. int mac_id;
  88. int mac_enabled; /* whether MAC is currently enabled and running
  89. * (req. for mdio)
  90. */
  91. int old_link; /* used by au1000_adjust_link */
  92. int old_speed;
  93. int old_duplex;
  94. struct phy_device *phy_dev;
  95. struct mii_bus *mii_bus;
  96. /* PHY configuration */
  97. int phy_static_config;
  98. int phy_search_highest_addr;
  99. int phy1_search_mac0;
  100. int phy_addr;
  101. int phy_busid;
  102. int phy_irq;
  103. /* These variables are just for quick access
  104. * to certain regs addresses.
  105. */
  106. struct mac_reg *mac; /* mac registers */
  107. u32 *enable; /* address of MAC Enable Register */
  108. u32 vaddr; /* virtual address of rx/tx buffers */
  109. dma_addr_t dma_addr; /* dma address of rx/tx buffers */
  110. spinlock_t lock; /* Serialise access to device */
  111. u32 msg_enable;
  112. };