at91_ether.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * Ethernet driver for the Atmel AT91RM9200 (Thunder)
  3. *
  4. * Copyright (C) SAN People (Pty) Ltd
  5. *
  6. * Based on an earlier Atmel EMAC macrocell driver by Atmel and Lineo Inc.
  7. * Initial version by Rick Bronson.
  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
  11. * as published by the Free Software Foundation; either version
  12. * 2 of the License, or (at your option) any later version.
  13. */
  14. #ifndef AT91_ETHERNET
  15. #define AT91_ETHERNET
  16. /* Davicom 9161 PHY */
  17. #define MII_DM9161_ID 0x0181b880
  18. #define MII_DM9161A_ID 0x0181b8a0
  19. /* Davicom specific registers */
  20. #define MII_DSCR_REG 16
  21. #define MII_DSCSR_REG 17
  22. #define MII_DSINTR_REG 21
  23. /* Intel LXT971A PHY */
  24. #define MII_LXT971A_ID 0x001378E0
  25. /* Intel specific registers */
  26. #define MII_ISINTE_REG 18
  27. #define MII_ISINTS_REG 19
  28. #define MII_LEDCTRL_REG 20
  29. /* Realtek RTL8201 PHY */
  30. #define MII_RTL8201_ID 0x00008200
  31. /* Broadcom BCM5221 PHY */
  32. #define MII_BCM5221_ID 0x004061e0
  33. /* Broadcom specific registers */
  34. #define MII_BCMINTR_REG 26
  35. /* National Semiconductor DP83847 */
  36. #define MII_DP83847_ID 0x20005c30
  37. /* Altima AC101L PHY */
  38. #define MII_AC101L_ID 0x00225520
  39. /* Micrel KS8721 PHY */
  40. #define MII_KS8721_ID 0x00221610
  41. /* ........................................................................ */
  42. #define MAX_RBUFF_SZ 0x600 /* 1518 rounded up */
  43. #define MAX_RX_DESCR 9 /* max number of receive buffers */
  44. #define EMAC_DESC_DONE 0x00000001 /* bit for if DMA is done */
  45. #define EMAC_DESC_WRAP 0x00000002 /* bit for wrap */
  46. #define EMAC_BROADCAST 0x80000000 /* broadcast address */
  47. #define EMAC_MULTICAST 0x40000000 /* multicast address */
  48. #define EMAC_UNICAST 0x20000000 /* unicast address */
  49. struct rbf_t
  50. {
  51. unsigned int addr;
  52. unsigned long size;
  53. };
  54. struct recv_desc_bufs
  55. {
  56. struct rbf_t descriptors[MAX_RX_DESCR]; /* must be on sizeof (rbf_t) boundary */
  57. char recv_buf[MAX_RX_DESCR][MAX_RBUFF_SZ]; /* must be on long boundary */
  58. };
  59. struct at91_private
  60. {
  61. struct net_device_stats stats;
  62. struct mii_if_info mii; /* ethtool support */
  63. struct at91_eth_data board_data; /* board-specific configuration */
  64. struct clk *ether_clk; /* clock */
  65. /* PHY */
  66. unsigned long phy_type; /* type of PHY (PHY_ID) */
  67. spinlock_t lock; /* lock for MDI interface */
  68. short phy_media; /* media interface type */
  69. unsigned short phy_address; /* 5-bit MDI address of PHY (0..31) */
  70. /* Transmit */
  71. struct sk_buff *skb; /* holds skb until xmit interrupt completes */
  72. dma_addr_t skb_physaddr; /* phys addr from pci_map_single */
  73. int skb_length; /* saved skb length for pci_unmap_single */
  74. /* Receive */
  75. int rxBuffIndex; /* index into receive descriptor list */
  76. struct recv_desc_bufs *dlist; /* descriptor list address */
  77. struct recv_desc_bufs *dlist_phys; /* descriptor list physical address */
  78. };
  79. #endif