bfin_mac.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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/ptp_clock_kernel.h>
  14. #include <linux/timer.h>
  15. #include <linux/etherdevice.h>
  16. #include <linux/bfin_mac.h>
  17. /*
  18. * Disable hardware checksum for bug #5600 if writeback cache is
  19. * enabled. Otherwize, corrupted RX packet will be sent up stack
  20. * without error mark.
  21. */
  22. #ifndef CONFIG_BFIN_EXTMEM_WRITEBACK
  23. #define BFIN_MAC_CSUM_OFFLOAD
  24. #endif
  25. #define TX_RECLAIM_JIFFIES (HZ / 5)
  26. struct dma_descriptor {
  27. struct dma_descriptor *next_dma_desc;
  28. unsigned long start_addr;
  29. unsigned short config;
  30. unsigned short x_count;
  31. };
  32. struct status_area_rx {
  33. #if defined(BFIN_MAC_CSUM_OFFLOAD)
  34. unsigned short ip_hdr_csum; /* ip header checksum */
  35. /* ip payload(udp or tcp or others) checksum */
  36. unsigned short ip_payload_csum;
  37. #endif
  38. unsigned long status_word; /* the frame status word */
  39. };
  40. struct status_area_tx {
  41. unsigned long status_word; /* the frame status word */
  42. };
  43. /* use two descriptors for a packet */
  44. struct net_dma_desc_rx {
  45. struct net_dma_desc_rx *next;
  46. struct sk_buff *skb;
  47. struct dma_descriptor desc_a;
  48. struct dma_descriptor desc_b;
  49. struct status_area_rx status;
  50. };
  51. /* use two descriptors for a packet */
  52. struct net_dma_desc_tx {
  53. struct net_dma_desc_tx *next;
  54. struct sk_buff *skb;
  55. struct dma_descriptor desc_a;
  56. struct dma_descriptor desc_b;
  57. unsigned char packet[1560];
  58. struct status_area_tx status;
  59. };
  60. struct bfin_mac_local {
  61. /*
  62. * these are things that the kernel wants me to keep, so users
  63. * can find out semi-useless statistics of how well the card is
  64. * performing
  65. */
  66. struct net_device_stats stats;
  67. spinlock_t lock;
  68. int wol; /* Wake On Lan */
  69. int irq_wake_requested;
  70. struct timer_list tx_reclaim_timer;
  71. struct net_device *ndev;
  72. /* Data for EMAC_VLAN1 regs */
  73. u16 vlan1_mask, vlan2_mask;
  74. /* MII and PHY stuffs */
  75. int old_link; /* used by bf537_adjust_link */
  76. int old_speed;
  77. int old_duplex;
  78. struct phy_device *phydev;
  79. struct mii_bus *mii_bus;
  80. #if defined(CONFIG_BFIN_MAC_USE_HWSTAMP)
  81. u32 addend;
  82. unsigned int shift;
  83. s32 max_ppb;
  84. struct hwtstamp_config stamp_cfg;
  85. struct ptp_clock_info caps;
  86. struct ptp_clock *clock;
  87. int phc_index;
  88. spinlock_t phc_lock; /* protects time lo/hi registers */
  89. #endif
  90. };
  91. extern int bfin_get_ether_addr(char *addr);
  92. #endif