rtl8180.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #ifndef RTL8180_H
  2. #define RTL8180_H
  3. #include "rtl818x.h"
  4. #define MAX_RX_SIZE IEEE80211_MAX_RTS_THRESHOLD
  5. #define RF_PARAM_ANALOGPHY (1 << 0)
  6. #define RF_PARAM_ANTBDEFAULT (1 << 1)
  7. #define RF_PARAM_CARRIERSENSE1 (1 << 2)
  8. #define RF_PARAM_CARRIERSENSE2 (1 << 3)
  9. #define BB_ANTATTEN_CHAN14 0x0C
  10. #define BB_ANTENNA_B 0x40
  11. #define BB_HOST_BANG (1 << 30)
  12. #define BB_HOST_BANG_EN (1 << 2)
  13. #define BB_HOST_BANG_CLK (1 << 1)
  14. #define BB_HOST_BANG_DATA 1
  15. #define ANAPARAM_TXDACOFF_SHIFT 27
  16. #define ANAPARAM_PWR0_SHIFT 28
  17. #define ANAPARAM_PWR0_MASK (0x07 << ANAPARAM_PWR0_SHIFT)
  18. #define ANAPARAM_PWR1_SHIFT 20
  19. #define ANAPARAM_PWR1_MASK (0x7F << ANAPARAM_PWR1_SHIFT)
  20. struct rtl8180_tx_desc {
  21. __le32 flags;
  22. __le16 rts_duration;
  23. __le16 plcp_len;
  24. __le32 tx_buf;
  25. __le32 frame_len;
  26. __le32 next_tx_desc;
  27. u8 cw;
  28. u8 retry_limit;
  29. u8 agc;
  30. u8 flags2;
  31. u32 reserved[2];
  32. } __attribute__ ((packed));
  33. struct rtl8180_rx_desc {
  34. __le32 flags;
  35. __le32 flags2;
  36. union {
  37. __le32 rx_buf;
  38. __le64 tsft;
  39. };
  40. } __attribute__ ((packed));
  41. struct rtl8180_tx_ring {
  42. struct rtl8180_tx_desc *desc;
  43. dma_addr_t dma;
  44. unsigned int idx;
  45. unsigned int entries;
  46. struct sk_buff_head queue;
  47. };
  48. struct rtl8180_priv {
  49. /* common between rtl818x drivers */
  50. struct rtl818x_csr __iomem *map;
  51. const struct rtl818x_rf_ops *rf;
  52. struct ieee80211_vif *vif;
  53. int mode;
  54. /* rtl8180 driver specific */
  55. spinlock_t lock;
  56. struct rtl8180_rx_desc *rx_ring;
  57. dma_addr_t rx_ring_dma;
  58. unsigned int rx_idx;
  59. struct sk_buff *rx_buf[32];
  60. struct rtl8180_tx_ring tx_ring[4];
  61. struct ieee80211_channel channels[14];
  62. struct ieee80211_rate rates[12];
  63. struct ieee80211_supported_band band;
  64. struct pci_dev *pdev;
  65. u32 rx_conf;
  66. int r8185;
  67. u32 anaparam;
  68. u16 rfparam;
  69. u8 csthreshold;
  70. };
  71. void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);
  72. void rtl8180_set_anaparam(struct rtl8180_priv *priv, u32 anaparam);
  73. static inline u8 rtl818x_ioread8(struct rtl8180_priv *priv, u8 __iomem *addr)
  74. {
  75. return ioread8(addr);
  76. }
  77. static inline u16 rtl818x_ioread16(struct rtl8180_priv *priv, __le16 __iomem *addr)
  78. {
  79. return ioread16(addr);
  80. }
  81. static inline u32 rtl818x_ioread32(struct rtl8180_priv *priv, __le32 __iomem *addr)
  82. {
  83. return ioread32(addr);
  84. }
  85. static inline void rtl818x_iowrite8(struct rtl8180_priv *priv,
  86. u8 __iomem *addr, u8 val)
  87. {
  88. iowrite8(val, addr);
  89. }
  90. static inline void rtl818x_iowrite16(struct rtl8180_priv *priv,
  91. __le16 __iomem *addr, u16 val)
  92. {
  93. iowrite16(val, addr);
  94. }
  95. static inline void rtl818x_iowrite32(struct rtl8180_priv *priv,
  96. __le32 __iomem *addr, u32 val)
  97. {
  98. iowrite32(val, addr);
  99. }
  100. #endif /* RTL8180_H */