bfin_mac.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. #define BFIN_MAC_RX_IRQ_DISABLED 1
  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. struct napi_struct napi;
  74. unsigned long flags;
  75. /* Data for EMAC_VLAN1 regs */
  76. u16 vlan1_mask, vlan2_mask;
  77. /* MII and PHY stuffs */
  78. int old_link; /* used by bf537_adjust_link */
  79. int old_speed;
  80. int old_duplex;
  81. struct phy_device *phydev;
  82. struct mii_bus *mii_bus;
  83. #if defined(CONFIG_BFIN_MAC_USE_HWSTAMP)
  84. u32 addend;
  85. unsigned int shift;
  86. s32 max_ppb;
  87. struct hwtstamp_config stamp_cfg;
  88. struct ptp_clock_info caps;
  89. struct ptp_clock *clock;
  90. int phc_index;
  91. spinlock_t phc_lock; /* protects time lo/hi registers */
  92. #endif
  93. };
  94. int bfin_get_ether_addr(char *addr);
  95. #endif