bfin_mac.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * File: drivers/net/bfin_mac.c
  3. * Based on:
  4. * Maintainer:
  5. * Bryan Wu <bryan.wu@analog.com>
  6. *
  7. * Original author:
  8. * Luke Yang <luke.yang@analog.com>
  9. *
  10. * Created:
  11. * Description:
  12. *
  13. * Modified:
  14. * Copyright 2004-2006 Analog Devices Inc.
  15. *
  16. * Bugs: Enter bugs at http://blackfin.uclinux.org/
  17. *
  18. * This program is free software ; you can redistribute it and/or modify
  19. * it under the terms of the GNU General Public License as published by
  20. * the Free Software Foundation ; either version 2, or (at your option)
  21. * any later version.
  22. *
  23. * This program is distributed in the hope that it will be useful,
  24. * but WITHOUT ANY WARRANTY ; without even the implied warranty of
  25. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. * GNU General Public License for more details.
  27. *
  28. * You should have received a copy of the GNU General Public License
  29. * along with this program ; see the file COPYING.
  30. * If not, write to the Free Software Foundation,
  31. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  32. */
  33. /*
  34. * PHY REGISTER NAMES
  35. */
  36. #define PHYREG_MODECTL 0x0000
  37. #define PHYREG_MODESTAT 0x0001
  38. #define PHYREG_PHYID1 0x0002
  39. #define PHYREG_PHYID2 0x0003
  40. #define PHYREG_ANAR 0x0004
  41. #define PHYREG_ANLPAR 0x0005
  42. #define PHYREG_ANER 0x0006
  43. #define PHYREG_NSR 0x0010
  44. #define PHYREG_LBREMR 0x0011
  45. #define PHYREG_REC 0x0012
  46. #define PHYREG_10CFG 0x0013
  47. #define PHYREG_PHY1_1 0x0014
  48. #define PHYREG_PHY1_2 0x0015
  49. #define PHYREG_PHY2 0x0016
  50. #define PHYREG_TW_1 0x0017
  51. #define PHYREG_TW_2 0x0018
  52. #define PHYREG_TEST 0x0019
  53. #define PHY_RESET 0x8000
  54. #define PHY_ANEG_EN 0x1000
  55. #define PHY_DUPLEX 0x0100
  56. #define PHY_SPD_SET 0x2000
  57. #define BFIN_MAC_CSUM_OFFLOAD
  58. struct dma_descriptor {
  59. struct dma_descriptor *next_dma_desc;
  60. unsigned long start_addr;
  61. unsigned short config;
  62. unsigned short x_count;
  63. };
  64. struct status_area_rx {
  65. #if defined(BFIN_MAC_CSUM_OFFLOAD)
  66. unsigned short ip_hdr_csum; /* ip header checksum */
  67. /* ip payload(udp or tcp or others) checksum */
  68. unsigned short ip_payload_csum;
  69. #endif
  70. unsigned long status_word; /* the frame status word */
  71. };
  72. struct status_area_tx {
  73. unsigned long status_word; /* the frame status word */
  74. };
  75. /* use two descriptors for a packet */
  76. struct net_dma_desc_rx {
  77. struct net_dma_desc_rx *next;
  78. struct sk_buff *skb;
  79. struct dma_descriptor desc_a;
  80. struct dma_descriptor desc_b;
  81. struct status_area_rx status;
  82. };
  83. /* use two descriptors for a packet */
  84. struct net_dma_desc_tx {
  85. struct net_dma_desc_tx *next;
  86. struct sk_buff *skb;
  87. struct dma_descriptor desc_a;
  88. struct dma_descriptor desc_b;
  89. unsigned char packet[1560];
  90. struct status_area_tx status;
  91. };
  92. struct bf537mac_local {
  93. /*
  94. * these are things that the kernel wants me to keep, so users
  95. * can find out semi-useless statistics of how well the card is
  96. * performing
  97. */
  98. struct net_device_stats stats;
  99. int version;
  100. int FlowEnabled; /* record if data flow is active */
  101. int EtherIntIVG; /* IVG for the ethernet interrupt */
  102. int RXIVG; /* IVG for the RX completion */
  103. int TXIVG; /* IVG for the TX completion */
  104. int PhyAddr; /* PHY address */
  105. int OpMode; /* set these bits n the OPMODE regs */
  106. int Port10; /* set port speed to 10 Mbit/s */
  107. int GenChksums; /* IP checksums to be calculated */
  108. int NoRcveLnth; /* dont insert recv length at start of buffer */
  109. int StripPads; /* remove trailing pad bytes */
  110. int FullDuplex; /* set full duplex mode */
  111. int Negotiate; /* enable auto negotiation */
  112. int Loopback; /* loopback at the PHY */
  113. int Cache; /* Buffers may be cached */
  114. int FlowControl; /* flow control active */
  115. int CLKIN; /* clock in value in MHZ */
  116. unsigned short IntMask; /* interrupt mask */
  117. unsigned char Mac[6]; /* MAC address of the board */
  118. spinlock_t lock;
  119. };
  120. extern void get_bf537_ether_addr(char *addr);