greth.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* Gaisler.com GRETH 10/100/1000 Ethernet MAC driver
  2. *
  3. * (C) Copyright 2007
  4. * Daniel Hellstrom, Gaisler Research, daniel@gaisler.com
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  22. * MA 02111-1307 USA
  23. */
  24. #define GRETH_FD 0x10
  25. #define GRETH_RESET 0x40
  26. #define GRETH_MII_BUSY 0x8
  27. #define GRETH_MII_NVALID 0x10
  28. /* MII registers */
  29. #define GRETH_MII_EXTADV_1000FD 0x00000200
  30. #define GRETH_MII_EXTADV_1000HD 0x00000100
  31. #define GRETH_MII_EXTPRT_1000FD 0x00000800
  32. #define GRETH_MII_EXTPRT_1000HD 0x00000400
  33. #define GRETH_MII_100T4 0x00000200
  34. #define GRETH_MII_100TXFD 0x00000100
  35. #define GRETH_MII_100TXHD 0x00000080
  36. #define GRETH_MII_10FD 0x00000040
  37. #define GRETH_MII_10HD 0x00000020
  38. #define GRETH_BD_EN 0x800
  39. #define GRETH_BD_WR 0x1000
  40. #define GRETH_BD_IE 0x2000
  41. #define GRETH_BD_LEN 0x7FF
  42. #define GRETH_TXEN 0x1
  43. #define GRETH_INT_TX 0x8
  44. #define GRETH_TXI 0x4
  45. #define GRETH_TXBD_STATUS 0x0001C000
  46. #define GRETH_TXBD_MORE 0x20000
  47. #define GRETH_TXBD_IPCS 0x40000
  48. #define GRETH_TXBD_TCPCS 0x80000
  49. #define GRETH_TXBD_UDPCS 0x100000
  50. #define GRETH_TXBD_ERR_LC 0x10000
  51. #define GRETH_TXBD_ERR_UE 0x4000
  52. #define GRETH_TXBD_ERR_AL 0x8000
  53. #define GRETH_TXBD_NUM 128
  54. #define GRETH_TXBD_NUM_MASK (GRETH_TXBD_NUM-1)
  55. #define GRETH_TX_BUF_SIZE 2048
  56. #define GRETH_INT_RX 0x4
  57. #define GRETH_RXEN 0x2
  58. #define GRETH_RXI 0x8
  59. #define GRETH_RXBD_STATUS 0xFFFFC000
  60. #define GRETH_RXBD_ERR_AE 0x4000
  61. #define GRETH_RXBD_ERR_FT 0x8000
  62. #define GRETH_RXBD_ERR_CRC 0x10000
  63. #define GRETH_RXBD_ERR_OE 0x20000
  64. #define GRETH_RXBD_ERR_LE 0x40000
  65. #define GRETH_RXBD_IP_DEC 0x80000
  66. #define GRETH_RXBD_IP_CSERR 0x100000
  67. #define GRETH_RXBD_UDP_DEC 0x200000
  68. #define GRETH_RXBD_UDP_CSERR 0x400000
  69. #define GRETH_RXBD_TCP_DEC 0x800000
  70. #define GRETH_RXBD_TCP_CSERR 0x1000000
  71. #define GRETH_RXBD_NUM 128
  72. #define GRETH_RXBD_NUM_MASK (GRETH_RXBD_NUM-1)
  73. #define GRETH_RX_BUF_SIZE 2048
  74. /* Ethernet configuration registers */
  75. typedef struct _greth_regs {
  76. volatile unsigned int control;
  77. volatile unsigned int status;
  78. volatile unsigned int esa_msb;
  79. volatile unsigned int esa_lsb;
  80. volatile unsigned int mdio;
  81. volatile unsigned int tx_desc_p;
  82. volatile unsigned int rx_desc_p;
  83. } greth_regs;
  84. /* Ethernet buffer descriptor */
  85. typedef struct _greth_bd {
  86. volatile unsigned int stat;
  87. unsigned int addr; /* Buffer address not changed by HW */
  88. } greth_bd;