rtl8180.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. /* rtl8180 driver specific */
  54. spinlock_t lock;
  55. struct rtl8180_rx_desc *rx_ring;
  56. dma_addr_t rx_ring_dma;
  57. unsigned int rx_idx;
  58. struct sk_buff *rx_buf[32];
  59. struct rtl8180_tx_ring tx_ring[4];
  60. struct ieee80211_channel channels[14];
  61. struct ieee80211_rate rates[12];
  62. struct ieee80211_supported_band band;
  63. struct pci_dev *pdev;
  64. u32 rx_conf;
  65. int r8185;
  66. u32 anaparam;
  67. u16 rfparam;
  68. u8 csthreshold;
  69. };
  70. void rtl8180_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);
  71. void rtl8180_set_anaparam(struct rtl8180_priv *priv, u32 anaparam);
  72. static inline u8 rtl818x_ioread8(struct rtl8180_priv *priv, u8 __iomem *addr)
  73. {
  74. return ioread8(addr);
  75. }
  76. static inline u16 rtl818x_ioread16(struct rtl8180_priv *priv, __le16 __iomem *addr)
  77. {
  78. return ioread16(addr);
  79. }
  80. static inline u32 rtl818x_ioread32(struct rtl8180_priv *priv, __le32 __iomem *addr)
  81. {
  82. return ioread32(addr);
  83. }
  84. static inline void rtl818x_iowrite8(struct rtl8180_priv *priv,
  85. u8 __iomem *addr, u8 val)
  86. {
  87. iowrite8(val, addr);
  88. }
  89. static inline void rtl818x_iowrite16(struct rtl8180_priv *priv,
  90. __le16 __iomem *addr, u16 val)
  91. {
  92. iowrite16(val, addr);
  93. }
  94. static inline void rtl818x_iowrite32(struct rtl8180_priv *priv,
  95. __le32 __iomem *addr, u32 val)
  96. {
  97. iowrite32(val, addr);
  98. }
  99. #endif /* RTL8180_H */