Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
Larry Finger | a8d7606 | 2012-01-07 20:46:42 -0600 | [diff] [blame] | 3 | * Copyright(c) 2009-2012 Realtek Corporation. |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of version 2 of the GNU General Public License as |
| 7 | * published by the Free Software Foundation. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 12 | * more details. |
| 13 | * |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 14 | * The full GNU General Public License is included in this distribution in the |
| 15 | * file called LICENSE. |
| 16 | * |
| 17 | * Contact Information: |
| 18 | * wlanfae <wlanfae@realtek.com> |
| 19 | * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, |
| 20 | * Hsinchu 300, Taiwan. |
| 21 | * |
| 22 | * Larry Finger <Larry.Finger@lwfinger.net> |
| 23 | * |
| 24 | *****************************************************************************/ |
| 25 | |
| 26 | #ifndef __RTL_PCI_H__ |
| 27 | #define __RTL_PCI_H__ |
| 28 | |
| 29 | #include <linux/pci.h> |
Larry Finger | 6bc05d5 | 2017-11-01 10:29:16 -0500 | [diff] [blame^] | 30 | /* 1: MSDU packet queue, |
| 31 | * 2: Rx Command Queue |
| 32 | */ |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 33 | #define RTL_PCI_RX_MPDU_QUEUE 0 |
| 34 | #define RTL_PCI_RX_CMD_QUEUE 1 |
| 35 | #define RTL_PCI_MAX_RX_QUEUE 2 |
| 36 | |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 37 | #define RTL_PCI_MAX_RX_COUNT 512/*64*/ |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 38 | #define RTL_PCI_MAX_TX_QUEUE_COUNT 9 |
| 39 | |
| 40 | #define RT_TXDESC_NUM 128 |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 41 | #define TX_DESC_NUM_92E 512 |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 42 | #define RT_TXDESC_NUM_BE_QUEUE 256 |
| 43 | |
| 44 | #define BK_QUEUE 0 |
| 45 | #define BE_QUEUE 1 |
| 46 | #define VI_QUEUE 2 |
| 47 | #define VO_QUEUE 3 |
| 48 | #define BEACON_QUEUE 4 |
| 49 | #define TXCMD_QUEUE 5 |
| 50 | #define MGNT_QUEUE 6 |
| 51 | #define HIGH_QUEUE 7 |
| 52 | #define HCCA_QUEUE 8 |
| 53 | |
| 54 | #define RTL_PCI_DEVICE(vend, dev, cfg) \ |
| 55 | .vendor = (vend), \ |
| 56 | .device = (dev), \ |
| 57 | .subvendor = PCI_ANY_ID, \ |
| 58 | .subdevice = PCI_ANY_ID,\ |
| 59 | .driver_data = (kernel_ulong_t)&(cfg) |
| 60 | |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 61 | #define INTEL_VENDOR_ID 0x8086 |
| 62 | #define SIS_VENDOR_ID 0x1039 |
| 63 | #define ATI_VENDOR_ID 0x1002 |
| 64 | #define ATI_DEVICE_ID 0x7914 |
| 65 | #define AMD_VENDOR_ID 0x1022 |
| 66 | |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 67 | #define PCI_MAX_BRIDGE_NUMBER 255 |
| 68 | #define PCI_MAX_DEVICES 32 |
| 69 | #define PCI_MAX_FUNCTION 8 |
| 70 | |
| 71 | #define PCI_CONF_ADDRESS 0x0CF8 /*PCI Configuration Space Address */ |
| 72 | #define PCI_CONF_DATA 0x0CFC /*PCI Configuration Space Data */ |
| 73 | |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 74 | #define PCI_CLASS_BRIDGE_DEV 0x06 |
| 75 | #define PCI_SUBCLASS_BR_PCI_TO_PCI 0x04 |
| 76 | #define PCI_CAPABILITY_ID_PCI_EXPRESS 0x10 |
| 77 | #define PCI_CAP_ID_EXP 0x10 |
| 78 | |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 79 | #define U1DONTCARE 0xFF |
| 80 | #define U2DONTCARE 0xFFFF |
| 81 | #define U4DONTCARE 0xFFFFFFFF |
| 82 | |
| 83 | #define RTL_PCI_8192_DID 0x8192 /*8192 PCI-E */ |
| 84 | #define RTL_PCI_8192SE_DID 0x8192 /*8192 SE */ |
| 85 | #define RTL_PCI_8174_DID 0x8174 /*8192 SE */ |
| 86 | #define RTL_PCI_8173_DID 0x8173 /*8191 SE Crab */ |
| 87 | #define RTL_PCI_8172_DID 0x8172 /*8191 SE RE */ |
| 88 | #define RTL_PCI_8171_DID 0x8171 /*8191 SE Unicron */ |
Larry Finger | 0f01545 | 2012-10-25 13:46:46 -0500 | [diff] [blame] | 89 | #define RTL_PCI_8723AE_DID 0x8723 /*8723AE */ |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 90 | #define RTL_PCI_0045_DID 0x0045 /*8190 PCI for Ceraga */ |
| 91 | #define RTL_PCI_0046_DID 0x0046 /*8190 Cardbus for Ceraga */ |
| 92 | #define RTL_PCI_0044_DID 0x0044 /*8192e PCIE for Ceraga */ |
| 93 | #define RTL_PCI_0047_DID 0x0047 /*8192e Express Card for Ceraga */ |
| 94 | #define RTL_PCI_700F_DID 0x700F |
| 95 | #define RTL_PCI_701F_DID 0x701F |
| 96 | #define RTL_PCI_DLINK_DID 0x3304 |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 97 | #define RTL_PCI_8723AE_DID 0x8723 /*8723e */ |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 98 | #define RTL_PCI_8192CET_DID 0x8191 /*8192ce */ |
| 99 | #define RTL_PCI_8192CE_DID 0x8178 /*8192ce */ |
| 100 | #define RTL_PCI_8191CE_DID 0x8177 /*8192ce */ |
| 101 | #define RTL_PCI_8188CE_DID 0x8176 /*8192ce */ |
| 102 | #define RTL_PCI_8192CU_DID 0x8191 /*8192ce */ |
Chaoming_Li | c7cfe38 | 2011-04-25 13:23:15 -0500 | [diff] [blame] | 103 | #define RTL_PCI_8192DE_DID 0x8193 /*8192de */ |
| 104 | #define RTL_PCI_8192DE_DID2 0x002B /*92DE*/ |
Larry Finger | 5c69177 | 2013-03-24 22:06:56 -0500 | [diff] [blame] | 105 | #define RTL_PCI_8188EE_DID 0x8179 /*8188ee*/ |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 106 | #define RTL_PCI_8723BE_DID 0xB723 /*8723be*/ |
| 107 | #define RTL_PCI_8192EE_DID 0x818B /*8192ee*/ |
| 108 | #define RTL_PCI_8821AE_DID 0x8821 /*8821ae*/ |
| 109 | #define RTL_PCI_8812AE_DID 0x8812 /*8812ae*/ |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 110 | |
| 111 | /*8192 support 16 pages of IO registers*/ |
| 112 | #define RTL_MEM_MAPPED_IO_RANGE_8190PCI 0x1000 |
| 113 | #define RTL_MEM_MAPPED_IO_RANGE_8192PCIE 0x4000 |
| 114 | #define RTL_MEM_MAPPED_IO_RANGE_8192SE 0x4000 |
| 115 | #define RTL_MEM_MAPPED_IO_RANGE_8192CE 0x4000 |
| 116 | #define RTL_MEM_MAPPED_IO_RANGE_8192DE 0x4000 |
| 117 | |
| 118 | #define RTL_PCI_REVISION_ID_8190PCI 0x00 |
| 119 | #define RTL_PCI_REVISION_ID_8192PCIE 0x01 |
| 120 | #define RTL_PCI_REVISION_ID_8192SE 0x10 |
| 121 | #define RTL_PCI_REVISION_ID_8192CE 0x1 |
| 122 | #define RTL_PCI_REVISION_ID_8192DE 0x0 |
| 123 | |
| 124 | #define RTL_DEFAULT_HARDWARE_TYPE HARDWARE_TYPE_RTL8192CE |
| 125 | |
| 126 | enum pci_bridge_vendor { |
| 127 | PCI_BRIDGE_VENDOR_INTEL = 0x0, /*0b'0000,0001 */ |
| 128 | PCI_BRIDGE_VENDOR_ATI, /*0b'0000,0010*/ |
| 129 | PCI_BRIDGE_VENDOR_AMD, /*0b'0000,0100*/ |
| 130 | PCI_BRIDGE_VENDOR_SIS, /*0b'0000,1000*/ |
| 131 | PCI_BRIDGE_VENDOR_UNKNOWN, /*0b'0100,0000*/ |
| 132 | PCI_BRIDGE_VENDOR_MAX, |
| 133 | }; |
| 134 | |
Chaoming_Li | c7cfe38 | 2011-04-25 13:23:15 -0500 | [diff] [blame] | 135 | struct rtl_pci_capabilities_header { |
| 136 | u8 capability_id; |
| 137 | u8 next; |
| 138 | }; |
| 139 | |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 140 | /* In new TRX flow, Buffer_desc is new concept |
| 141 | * But TX wifi info == TX descriptor in old flow |
| 142 | * RX wifi info == RX descriptor in old flow |
| 143 | */ |
| 144 | struct rtl_tx_buffer_desc { |
Ping-Ke Shih | 0c07bd7 | 2017-09-29 14:47:53 -0500 | [diff] [blame] | 145 | u32 dword[4 * (1 << (BUFDESC_SEG_NUM + 1))]; |
John W. Linville | e137478 | 2010-12-16 09:20:16 -0500 | [diff] [blame] | 146 | } __packed; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 147 | |
| 148 | struct rtl_tx_desc { |
| 149 | u32 dword[16]; |
John W. Linville | e137478 | 2010-12-16 09:20:16 -0500 | [diff] [blame] | 150 | } __packed; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 151 | |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 152 | struct rtl_rx_buffer_desc { /*rx buffer desc*/ |
Ping-Ke Shih | 0c07bd7 | 2017-09-29 14:47:53 -0500 | [diff] [blame] | 153 | u32 dword[4]; |
John W. Linville | e137478 | 2010-12-16 09:20:16 -0500 | [diff] [blame] | 154 | } __packed; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 155 | |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 156 | struct rtl_rx_desc { /*old: rx desc new: rx wifi info*/ |
| 157 | u32 dword[8]; |
| 158 | } __packed; |
| 159 | |
| 160 | struct rtl_tx_cmd_desc { |
| 161 | u32 dword[16]; |
Larry Finger | f3355dd | 2014-03-04 16:53:47 -0600 | [diff] [blame] | 162 | } __packed; |
| 163 | |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 164 | struct rtl8192_tx_ring { |
| 165 | struct rtl_tx_desc *desc; |
| 166 | dma_addr_t dma; |
| 167 | unsigned int idx; |
| 168 | unsigned int entries; |
| 169 | struct sk_buff_head queue; |
Larry Finger | f3355dd | 2014-03-04 16:53:47 -0600 | [diff] [blame] | 170 | /*add for new trx flow*/ |
| 171 | struct rtl_tx_buffer_desc *buffer_desc; /*tx buffer descriptor*/ |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 172 | dma_addr_t buffer_desc_dma; /*tx bufferd desc dma memory*/ |
| 173 | u16 avl_desc; /* available_desc_to_write */ |
| 174 | u16 cur_tx_wp; /* current_tx_write_point */ |
| 175 | u16 cur_tx_rp; /* current_tx_read_point */ |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 176 | }; |
| 177 | |
| 178 | struct rtl8192_rx_ring { |
| 179 | struct rtl_rx_desc *desc; |
| 180 | dma_addr_t dma; |
| 181 | unsigned int idx; |
| 182 | struct sk_buff *rx_buf[RTL_PCI_MAX_RX_COUNT]; |
Larry Finger | 38506ec | 2014-09-22 09:39:19 -0500 | [diff] [blame] | 183 | /*add for new trx flow*/ |
| 184 | struct rtl_rx_buffer_desc *buffer_desc; /*rx buffer descriptor*/ |
| 185 | u16 next_rx_rp; /* next_rx_read_point */ |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 186 | }; |
| 187 | |
| 188 | struct rtl_pci { |
| 189 | struct pci_dev *pdev; |
Larry Finger | a290593 | 2012-10-25 13:46:45 -0500 | [diff] [blame] | 190 | bool irq_enabled; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 191 | |
| 192 | bool driver_is_goingto_unload; |
| 193 | bool up_first_time; |
Chaoming_Li | c7cfe38 | 2011-04-25 13:23:15 -0500 | [diff] [blame] | 194 | bool first_init; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 195 | bool being_init_adapter; |
Chaoming_Li | c7cfe38 | 2011-04-25 13:23:15 -0500 | [diff] [blame] | 196 | bool init_ready; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 197 | |
| 198 | /*Tx */ |
| 199 | struct rtl8192_tx_ring tx_ring[RTL_PCI_MAX_TX_QUEUE_COUNT]; |
| 200 | int txringcount[RTL_PCI_MAX_TX_QUEUE_COUNT]; |
| 201 | u32 transmit_config; |
| 202 | |
| 203 | /*Rx */ |
| 204 | struct rtl8192_rx_ring rx_ring[RTL_PCI_MAX_RX_QUEUE]; |
| 205 | int rxringcount; |
| 206 | u16 rxbuffersize; |
| 207 | u32 receive_config; |
| 208 | |
| 209 | /*irq */ |
| 210 | u8 irq_alloc; |
| 211 | u32 irq_mask[2]; |
Larry Finger | 26634c4 | 2013-03-24 22:06:33 -0500 | [diff] [blame] | 212 | u32 sys_irq_mask; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 213 | |
| 214 | /*Bcn control register setting */ |
| 215 | u32 reg_bcn_ctrl_val; |
| 216 | |
| 217 | /*ASPM*/ u8 const_pci_aspm; |
| 218 | u8 const_amdpci_aspm; |
| 219 | u8 const_hwsw_rfoff_d3; |
| 220 | u8 const_support_pciaspm; |
| 221 | /*pci-e bridge */ |
| 222 | u8 const_hostpci_aspm_setting; |
| 223 | /*pci-e device */ |
| 224 | u8 const_devicepci_aspm_setting; |
Larry Finger | 6bc05d5 | 2017-11-01 10:29:16 -0500 | [diff] [blame^] | 225 | /* If it supports ASPM, Offset[560h] = 0x40, |
| 226 | * otherwise Offset[560h] = 0x00. |
| 227 | */ |
Larry Finger | 3247328 | 2011-03-27 16:19:57 -0500 | [diff] [blame] | 228 | bool support_aspm; |
| 229 | bool support_backdoor; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 230 | |
| 231 | /*QOS & EDCA */ |
| 232 | enum acm_method acm_method; |
Chaoming_Li | c7cfe38 | 2011-04-25 13:23:15 -0500 | [diff] [blame] | 233 | |
| 234 | u16 shortretry_limit; |
| 235 | u16 longretry_limit; |
Larry Finger | 2cddad3 | 2014-02-28 15:16:46 -0600 | [diff] [blame] | 236 | |
| 237 | /* MSI support */ |
| 238 | bool msi_support; |
| 239 | bool using_msi; |
Larry Finger | 54328e6 | 2015-10-02 11:44:30 -0500 | [diff] [blame] | 240 | /* interrupt clear before set */ |
| 241 | bool int_clear; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 242 | }; |
| 243 | |
| 244 | struct mp_adapter { |
| 245 | u8 linkctrl_reg; |
| 246 | |
| 247 | u8 busnumber; |
| 248 | u8 devnumber; |
| 249 | u8 funcnumber; |
| 250 | |
| 251 | u8 pcibridge_busnum; |
| 252 | u8 pcibridge_devnum; |
| 253 | u8 pcibridge_funcnum; |
| 254 | |
| 255 | u8 pcibridge_vendor; |
| 256 | u16 pcibridge_vendorid; |
| 257 | u16 pcibridge_deviceid; |
| 258 | |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 259 | u8 num4bytes; |
| 260 | |
| 261 | u8 pcibridge_pciehdr_offset; |
| 262 | u8 pcibridge_linkctrlreg; |
| 263 | |
| 264 | bool amd_l1_patch; |
| 265 | }; |
| 266 | |
| 267 | struct rtl_pci_priv { |
Larry Finger | 6773386 | 2017-02-05 10:24:22 -0600 | [diff] [blame] | 268 | struct bt_coexist_info bt_coexist; |
| 269 | struct rtl_led_ctl ledctl; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 270 | struct rtl_pci dev; |
| 271 | struct mp_adapter ndis_adapter; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 272 | }; |
| 273 | |
| 274 | #define rtl_pcipriv(hw) (((struct rtl_pci_priv *)(rtl_priv(hw))->priv)) |
| 275 | #define rtl_pcidev(pcipriv) (&((pcipriv)->dev)) |
| 276 | |
| 277 | int rtl_pci_reset_trx_ring(struct ieee80211_hw *hw); |
| 278 | |
Julia Lawall | 1bfcfdc | 2016-05-01 21:57:44 +0200 | [diff] [blame] | 279 | extern const struct rtl_intf_ops rtl_pci_ops; |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 280 | |
Bill Pemberton | 9e2ff36 | 2012-12-03 09:56:43 -0500 | [diff] [blame] | 281 | int rtl_pci_probe(struct pci_dev *pdev, |
Larry Finger | 6bc05d5 | 2017-11-01 10:29:16 -0500 | [diff] [blame^] | 282 | const struct pci_device_id *id); |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 283 | void rtl_pci_disconnect(struct pci_dev *pdev); |
Hauke Mehrtens | 244a77e | 2012-11-29 23:27:17 +0100 | [diff] [blame] | 284 | #ifdef CONFIG_PM_SLEEP |
Larry Finger | 603be38 | 2011-10-11 21:28:47 -0500 | [diff] [blame] | 285 | int rtl_pci_suspend(struct device *dev); |
| 286 | int rtl_pci_resume(struct device *dev); |
Hauke Mehrtens | 244a77e | 2012-11-29 23:27:17 +0100 | [diff] [blame] | 287 | #endif /* CONFIG_PM_SLEEP */ |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 288 | static inline u8 pci_read8_sync(struct rtl_priv *rtlpriv, u32 addr) |
| 289 | { |
Larry Finger | 6bc05d5 | 2017-11-01 10:29:16 -0500 | [diff] [blame^] | 290 | return readb((u8 __iomem *)rtlpriv->io.pci_mem_start + addr); |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 291 | } |
| 292 | |
| 293 | static inline u16 pci_read16_sync(struct rtl_priv *rtlpriv, u32 addr) |
| 294 | { |
Larry Finger | 6bc05d5 | 2017-11-01 10:29:16 -0500 | [diff] [blame^] | 295 | return readw((u8 __iomem *)rtlpriv->io.pci_mem_start + addr); |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 296 | } |
| 297 | |
| 298 | static inline u32 pci_read32_sync(struct rtl_priv *rtlpriv, u32 addr) |
| 299 | { |
Larry Finger | 6bc05d5 | 2017-11-01 10:29:16 -0500 | [diff] [blame^] | 300 | return readl((u8 __iomem *)rtlpriv->io.pci_mem_start + addr); |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 301 | } |
| 302 | |
| 303 | static inline void pci_write8_async(struct rtl_priv *rtlpriv, u32 addr, u8 val) |
| 304 | { |
Larry Finger | 6bc05d5 | 2017-11-01 10:29:16 -0500 | [diff] [blame^] | 305 | writeb(val, (u8 __iomem *)rtlpriv->io.pci_mem_start + addr); |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 306 | } |
| 307 | |
| 308 | static inline void pci_write16_async(struct rtl_priv *rtlpriv, |
| 309 | u32 addr, u16 val) |
| 310 | { |
Larry Finger | 6bc05d5 | 2017-11-01 10:29:16 -0500 | [diff] [blame^] | 311 | writew(val, (u8 __iomem *)rtlpriv->io.pci_mem_start + addr); |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 312 | } |
| 313 | |
| 314 | static inline void pci_write32_async(struct rtl_priv *rtlpriv, |
| 315 | u32 addr, u32 val) |
| 316 | { |
Larry Finger | 6bc05d5 | 2017-11-01 10:29:16 -0500 | [diff] [blame^] | 317 | writel(val, (u8 __iomem *)rtlpriv->io.pci_mem_start + addr); |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 318 | } |
| 319 | |
Larry Finger | 6d4beca | 2015-02-03 11:15:18 -0600 | [diff] [blame] | 320 | static inline u16 calc_fifo_space(u16 rp, u16 wp) |
| 321 | { |
| 322 | if (rp <= wp) |
| 323 | return RTL_PCI_MAX_RX_COUNT - 1 + rp - wp; |
| 324 | return rp - wp - 1; |
| 325 | } |
| 326 | |
Larry Finger | 0c81733 | 2010-12-08 11:12:31 -0600 | [diff] [blame] | 327 | #endif |