bfin_mac.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * Blackfin On-Chip MAC Driver
  3. *
  4. * Copyright 2004-2007 Analog Devices Inc.
  5. *
  6. * Enter bugs at http://blackfin.uclinux.org/
  7. *
  8. * Licensed under the GPL-2 or later.
  9. */
  10. #ifndef _BFIN_MAC_H_
  11. #define _BFIN_MAC_H_
  12. #include <linux/net_tstamp.h>
  13. #include <linux/clocksource.h>
  14. #include <linux/timecompare.h>
  15. #include <linux/timer.h>
  16. #include <linux/etherdevice.h>
  17. #include <linux/bfin_mac.h>
  18. /*
  19. * Disable hardware checksum for bug #5600 if writeback cache is
  20. * enabled. Otherwize, corrupted RX packet will be sent up stack
  21. * without error mark.
  22. */
  23. #ifndef CONFIG_BFIN_EXTMEM_WRITEBACK
  24. #define BFIN_MAC_CSUM_OFFLOAD
  25. #endif
  26. #define TX_RECLAIM_JIFFIES (HZ / 5)
  27. struct dma_descriptor {
  28. struct dma_descriptor *next_dma_desc;
  29. unsigned long start_addr;
  30. unsigned short config;
  31. unsigned short x_count;
  32. };
  33. struct status_area_rx {
  34. #if defined(BFIN_MAC_CSUM_OFFLOAD)
  35. unsigned short ip_hdr_csum; /* ip header checksum */
  36. /* ip payload(udp or tcp or others) checksum */
  37. unsigned short ip_payload_csum;
  38. #endif
  39. unsigned long status_word; /* the frame status word */
  40. };
  41. struct status_area_tx {
  42. unsigned long status_word; /* the frame status word */
  43. };
  44. /* use two descriptors for a packet */
  45. struct net_dma_desc_rx {
  46. struct net_dma_desc_rx *next;
  47. struct sk_buff *skb;
  48. struct dma_descriptor desc_a;
  49. struct dma_descriptor desc_b;
  50. struct status_area_rx status;
  51. };
  52. /* use two descriptors for a packet */
  53. struct net_dma_desc_tx {
  54. struct net_dma_desc_tx *next;
  55. struct sk_buff *skb;
  56. struct dma_descriptor desc_a;
  57. struct dma_descriptor desc_b;
  58. unsigned char packet[1560];
  59. struct status_area_tx status;
  60. };
  61. struct bfin_mac_local {
  62. /*
  63. * these are things that the kernel wants me to keep, so users
  64. * can find out semi-useless statistics of how well the card is
  65. * performing
  66. */
  67. struct net_device_stats stats;
  68. spinlock_t lock;
  69. int wol; /* Wake On Lan */
  70. int irq_wake_requested;
  71. struct timer_list tx_reclaim_timer;
  72. struct net_device *ndev;
  73. /* Data for EMAC_VLAN1 regs */
  74. u16 vlan1_mask, vlan2_mask;
  75. /* MII and PHY stuffs */
  76. int old_link; /* used by bf537_adjust_link */
  77. int old_speed;
  78. int old_duplex;
  79. struct phy_device *phydev;
  80. struct mii_bus *mii_bus;
  81. #if defined(CONFIG_BFIN_MAC_USE_HWSTAMP)
  82. struct cyclecounter cycles;
  83. struct timecounter clock;
  84. struct timecompare compare;
  85. struct hwtstamp_config stamp_cfg;
  86. #endif
  87. };
  88. extern void bfin_get_ether_addr(char *addr);
  89. #endif