1 /* SPDX-License-Identifier: GPL-2.0 */
7 #define MAX_RX_SIZE IEEE80211_MAX_RTS_THRESHOLD
9 #define RF_PARAM_ANALOGPHY (1 << 0)
10 #define RF_PARAM_ANTBDEFAULT (1 << 1)
11 #define RF_PARAM_CARRIERSENSE1 (1 << 2)
12 #define RF_PARAM_CARRIERSENSE2 (1 << 3)
14 #define BB_ANTATTEN_CHAN14 0x0C
15 #define BB_ANTENNA_B 0x40
17 #define BB_HOST_BANG (1 << 30)
18 #define BB_HOST_BANG_EN (1 << 2)
19 #define BB_HOST_BANG_CLK (1 << 1)
20 #define BB_HOST_BANG_DATA 1
22 #define ANAPARAM_TXDACOFF_SHIFT 27
23 #define ANAPARAM_PWR0_SHIFT 28
24 #define ANAPARAM_PWR0_MASK (0x07 << ANAPARAM_PWR0_SHIFT)
25 #define ANAPARAM_PWR1_SHIFT 20
26 #define ANAPARAM_PWR1_MASK (0x7F << ANAPARAM_PWR1_SHIFT)
28 /* rtl8180/rtl8185 have 3 queue + beacon queue.
29 * mac80211 can use just one, + beacon = 2 tot.
31 #define RTL8180_NR_TX_QUEUES 2
33 /* rtl8187SE have 6 queues + beacon queues
34 * mac80211 can use 4 QoS data queue, + beacon = 5 tot
36 #define RTL8187SE_NR_TX_QUEUES 5
38 /* for array static allocation, it is the max of above */
39 #define RTL818X_NR_TX_QUEUES 5
41 struct rtl8180_tx_desc
{
50 __le16 frame_duration
;
58 /* rsvd for 8180/8185.
59 * valid for 8187se but we dont use it
62 /* all rsvd for 8180/8185 */
67 struct rtl818x_rx_cmd_desc
{
73 struct rtl8180_rx_desc
{
80 struct rtl8187se_rx_desc
{
88 struct rtl8180_tx_ring
{
89 struct rtl8180_tx_desc
*desc
;
93 struct sk_buff_head queue
;
97 struct ieee80211_hw
*dev
;
100 struct delayed_work beacon_work
;
104 struct rtl8180_priv
{
105 /* common between rtl818x drivers */
106 struct rtl818x_csr __iomem
*map
;
107 const struct rtl818x_rf_ops
*rf
;
108 struct ieee80211_vif
*vif
;
110 /* rtl8180 driver specific */
115 dma_addr_t rx_ring_dma
;
117 struct sk_buff
*rx_buf
[32];
118 struct rtl8180_tx_ring tx_ring
[RTL818X_NR_TX_QUEUES
];
119 struct ieee80211_channel channels
[14];
120 struct ieee80211_rate rates
[12];
121 struct ieee80211_supported_band band
;
122 struct ieee80211_tx_queue_params queue_param
[4];
123 struct pci_dev
*pdev
;
129 RTL818X_CHIP_FAMILY_RTL8180
,
130 RTL818X_CHIP_FAMILY_RTL8185
,
131 RTL818X_CHIP_FAMILY_RTL8187SE
,
136 u8 mac_addr
[ETH_ALEN
];
141 u8 thermal_meter_val
;
143 u8 antenna_diversity_en
;
144 u8 antenna_diversity_default
;
149 void rtl8180_write_phy(struct ieee80211_hw
*dev
, u8 addr
, u32 data
);
150 void rtl8180_set_anaparam(struct rtl8180_priv
*priv
, u32 anaparam
);
151 void rtl8180_set_anaparam2(struct rtl8180_priv
*priv
, u32 anaparam2
);
153 static inline u8
rtl818x_ioread8(struct rtl8180_priv
*priv
, u8 __iomem
*addr
)
155 return ioread8(addr
);
158 static inline u16
rtl818x_ioread16(struct rtl8180_priv
*priv
, __le16 __iomem
*addr
)
160 return ioread16(addr
);
163 static inline u32
rtl818x_ioread32(struct rtl8180_priv
*priv
, __le32 __iomem
*addr
)
165 return ioread32(addr
);
168 static inline void rtl818x_iowrite8(struct rtl8180_priv
*priv
,
169 u8 __iomem
*addr
, u8 val
)
174 static inline void rtl818x_iowrite16(struct rtl8180_priv
*priv
,
175 __le16 __iomem
*addr
, u16 val
)
177 iowrite16(val
, addr
);
180 static inline void rtl818x_iowrite32(struct rtl8180_priv
*priv
,
181 __le32 __iomem
*addr
, u32 val
)
183 iowrite32(val
, addr
);
186 #endif /* RTL8180_H */