Greg Kroah-Hartman | d7c4308 | 2017-11-07 21:07:53 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. |
| 4 | * All rights reserved. |
| 5 | * |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 6 | * File: card.c |
| 7 | * Purpose: Provide functions to setup NIC operation mode |
| 8 | * Functions: |
| 9 | * s_vSafeResetTx - Rest Tx |
| 10 | * CARDvSetRSPINF - Set RSPINF |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 11 | * CARDvUpdateBasicTopRate - Update BasicTopRate |
| 12 | * CARDbAddBasicRate - Add to BasicRateSet |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 13 | * CARDbIsOFDMinBasicRate - Check if any OFDM rate is in BasicRateSet |
Justin P. Mattock | 7664ec8 | 2012-08-20 08:43:15 -0700 | [diff] [blame] | 14 | * CARDqGetTSFOffset - Calculate TSFOffset |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 15 | * CARDbGetCurrentTSF - Read Current NIC TSF counter |
Justin P. Mattock | 7664ec8 | 2012-08-20 08:43:15 -0700 | [diff] [blame] | 16 | * CARDqGetNextTBTT - Calculate Next Beacon TSF counter |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 17 | * CARDvSetFirstNextTBTT - Set NIC Beacon time |
| 18 | * CARDvUpdateNextTBTT - Sync. NIC Beacon time |
| 19 | * CARDbRadioPowerOff - Turn Off NIC Radio Power |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 20 | * |
| 21 | * Revision History: |
| 22 | * 06-10-2003 Bryan YC Fan: Re-write codes to support VT3253 spec. |
Varsha Rao | 26f64a6 | 2016-10-15 16:02:58 +0530 | [diff] [blame] | 23 | * 08-26-2003 Kyle Hsu: Modify the defination type of iobase. |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 24 | * 09-01-2003 Bryan YC Fan: Add vUpdateIFS(). |
| 25 | * |
| 26 | */ |
| 27 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 28 | #include "tmacro.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 29 | #include "card.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 30 | #include "baseband.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 31 | #include "mac.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 32 | #include "desc.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 33 | #include "rf.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 34 | #include "power.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 35 | |
| 36 | /*--------------------- Static Definitions -------------------------*/ |
| 37 | |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 38 | #define C_SIFS_A 16 /* micro sec. */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 39 | #define C_SIFS_BG 10 |
| 40 | |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 41 | #define C_EIFS 80 /* micro sec. */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 42 | |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 43 | #define C_SLOT_SHORT 9 /* micro sec. */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 44 | #define C_SLOT_LONG 20 |
| 45 | |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 46 | #define C_CWMIN_A 15 /* slot time */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 47 | #define C_CWMIN_B 31 |
| 48 | |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 49 | #define C_CWMAX 1023 /* slot time */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 50 | |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 51 | #define WAIT_BEACON_TX_DOWN_TMO 3 /* Times */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 52 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 53 | /*--------------------- Static Variables --------------------------*/ |
| 54 | |
Mariam Mohamed Fawzy | 1167ff9 | 2015-01-26 11:24:36 +0200 | [diff] [blame] | 55 | static const unsigned short cwRXBCNTSFOff[MAX_RATE] = { |
| 56 | 17, 17, 17, 17, 34, 23, 17, 11, 8, 5, 4, 3}; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 57 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 58 | /*--------------------- Static Functions --------------------------*/ |
| 59 | |
Madhumitha Prabakaran | 9ae38b8 | 2019-02-28 15:14:22 -0600 | [diff] [blame] | 60 | static void s_vCalculateOFDMRParameter(unsigned char byRate, u8 bb_type, |
| 61 | unsigned char *pbyTxRate, |
| 62 | unsigned char *pbyRsvTime); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 63 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 64 | /*--------------------- Export Functions --------------------------*/ |
| 65 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 66 | /* |
Justin P. Mattock | 7664ec8 | 2012-08-20 08:43:15 -0700 | [diff] [blame] | 67 | * Description: Calculate TxRate and RsvTime fields for RSPINF in OFDM mode. |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 68 | * |
| 69 | * Parameters: |
| 70 | * In: |
| 71 | * wRate - Tx Rate |
| 72 | * byPktType - Tx Packet type |
| 73 | * Out: |
| 74 | * pbyTxRate - pointer to RSPINF TxRate field |
| 75 | * pbyRsvTime - pointer to RSPINF RsvTime field |
| 76 | * |
| 77 | * Return Value: none |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 78 | */ |
Cristiane Naves | 6e0afa3 | 2019-10-29 18:09:17 -0300 | [diff] [blame] | 79 | static void s_vCalculateOFDMRParameter(unsigned char byRate, |
| 80 | u8 bb_type, |
| 81 | unsigned char *pbyTxRate, |
| 82 | unsigned char *pbyRsvTime) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 83 | { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 84 | switch (byRate) { |
| 85 | case RATE_6M: |
Malcolm Priestley | d1ab520 | 2014-11-07 19:06:04 +0000 | [diff] [blame] | 86 | if (bb_type == BB_TYPE_11A) { /* 5GHZ */ |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 87 | *pbyTxRate = 0x9B; |
| 88 | *pbyRsvTime = 44; |
Joe Perches | 5e0cc8a | 2013-03-18 20:55:37 -0700 | [diff] [blame] | 89 | } else { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 90 | *pbyTxRate = 0x8B; |
| 91 | *pbyRsvTime = 50; |
| 92 | } |
| 93 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 94 | |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 95 | case RATE_9M: |
Malcolm Priestley | d1ab520 | 2014-11-07 19:06:04 +0000 | [diff] [blame] | 96 | if (bb_type == BB_TYPE_11A) { /* 5GHZ */ |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 97 | *pbyTxRate = 0x9F; |
| 98 | *pbyRsvTime = 36; |
Joe Perches | 5e0cc8a | 2013-03-18 20:55:37 -0700 | [diff] [blame] | 99 | } else { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 100 | *pbyTxRate = 0x8F; |
| 101 | *pbyRsvTime = 42; |
| 102 | } |
| 103 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 104 | |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 105 | case RATE_12M: |
Malcolm Priestley | d1ab520 | 2014-11-07 19:06:04 +0000 | [diff] [blame] | 106 | if (bb_type == BB_TYPE_11A) { /* 5GHZ */ |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 107 | *pbyTxRate = 0x9A; |
| 108 | *pbyRsvTime = 32; |
Joe Perches | 5e0cc8a | 2013-03-18 20:55:37 -0700 | [diff] [blame] | 109 | } else { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 110 | *pbyTxRate = 0x8A; |
| 111 | *pbyRsvTime = 38; |
| 112 | } |
| 113 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 114 | |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 115 | case RATE_18M: |
Malcolm Priestley | d1ab520 | 2014-11-07 19:06:04 +0000 | [diff] [blame] | 116 | if (bb_type == BB_TYPE_11A) { /* 5GHZ */ |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 117 | *pbyTxRate = 0x9E; |
| 118 | *pbyRsvTime = 28; |
Joe Perches | 5e0cc8a | 2013-03-18 20:55:37 -0700 | [diff] [blame] | 119 | } else { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 120 | *pbyTxRate = 0x8E; |
| 121 | *pbyRsvTime = 34; |
| 122 | } |
| 123 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 124 | |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 125 | case RATE_36M: |
Malcolm Priestley | d1ab520 | 2014-11-07 19:06:04 +0000 | [diff] [blame] | 126 | if (bb_type == BB_TYPE_11A) { /* 5GHZ */ |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 127 | *pbyTxRate = 0x9D; |
| 128 | *pbyRsvTime = 24; |
Joe Perches | 5e0cc8a | 2013-03-18 20:55:37 -0700 | [diff] [blame] | 129 | } else { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 130 | *pbyTxRate = 0x8D; |
| 131 | *pbyRsvTime = 30; |
| 132 | } |
| 133 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 134 | |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 135 | case RATE_48M: |
Malcolm Priestley | d1ab520 | 2014-11-07 19:06:04 +0000 | [diff] [blame] | 136 | if (bb_type == BB_TYPE_11A) { /* 5GHZ */ |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 137 | *pbyTxRate = 0x98; |
| 138 | *pbyRsvTime = 24; |
Joe Perches | 5e0cc8a | 2013-03-18 20:55:37 -0700 | [diff] [blame] | 139 | } else { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 140 | *pbyTxRate = 0x88; |
| 141 | *pbyRsvTime = 30; |
| 142 | } |
| 143 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 144 | |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 145 | case RATE_54M: |
Malcolm Priestley | d1ab520 | 2014-11-07 19:06:04 +0000 | [diff] [blame] | 146 | if (bb_type == BB_TYPE_11A) { /* 5GHZ */ |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 147 | *pbyTxRate = 0x9C; |
| 148 | *pbyRsvTime = 24; |
Joe Perches | 5e0cc8a | 2013-03-18 20:55:37 -0700 | [diff] [blame] | 149 | } else { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 150 | *pbyTxRate = 0x8C; |
| 151 | *pbyRsvTime = 30; |
| 152 | } |
| 153 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 154 | |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 155 | case RATE_24M: |
| 156 | default: |
Malcolm Priestley | d1ab520 | 2014-11-07 19:06:04 +0000 | [diff] [blame] | 157 | if (bb_type == BB_TYPE_11A) { /* 5GHZ */ |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 158 | *pbyTxRate = 0x99; |
| 159 | *pbyRsvTime = 28; |
Joe Perches | 5e0cc8a | 2013-03-18 20:55:37 -0700 | [diff] [blame] | 160 | } else { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 161 | *pbyTxRate = 0x89; |
| 162 | *pbyRsvTime = 34; |
| 163 | } |
| 164 | break; |
| 165 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 166 | } |
| 167 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 168 | /*--------------------- Export Functions --------------------------*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 169 | |
| 170 | /* |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 171 | * Description: Update IFS |
| 172 | * |
| 173 | * Parameters: |
| 174 | * In: |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 175 | * priv - The adapter to be set |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 176 | * Out: |
| 177 | * none |
| 178 | * |
| 179 | * Return Value: None. |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 180 | */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 181 | bool CARDbSetPhyParameter(struct vnt_private *priv, u8 bb_type) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 182 | { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 183 | unsigned char byCWMaxMin = 0; |
| 184 | unsigned char bySlot = 0; |
| 185 | unsigned char bySIFS = 0; |
| 186 | unsigned char byDIFS = 0; |
| 187 | unsigned char byData; |
Malcolm Priestley | 0614a0e | 2014-10-29 17:43:51 +0000 | [diff] [blame] | 188 | int i; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 189 | |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 190 | /* Set SIFS, DIFS, EIFS, SlotTime, CwMin */ |
Malcolm Priestley | a558e3d | 2014-11-07 19:06:02 +0000 | [diff] [blame] | 191 | if (bb_type == BB_TYPE_11A) { |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 192 | if (priv->byRFType == RF_AIROHA7230) { |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 193 | /* AL7230 use single PAPE and connect to PAPE_2.4G */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 194 | MACvSetBBType(priv->PortOffset, BB_TYPE_11G); |
| 195 | priv->abyBBVGA[0] = 0x20; |
| 196 | priv->abyBBVGA[2] = 0x10; |
| 197 | priv->abyBBVGA[3] = 0x10; |
Briana Oursler | af93096 | 2020-04-03 10:18:05 -0700 | [diff] [blame] | 198 | bb_read_embedded(priv, 0xE7, &byData); |
Guido MartĂnez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 199 | if (byData == 0x1C) |
Briana Oursler | af93096 | 2020-04-03 10:18:05 -0700 | [diff] [blame] | 200 | bb_write_embedded(priv, 0xE7, priv->abyBBVGA[0]); |
Guido MartĂnez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 201 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 202 | } else if (priv->byRFType == RF_UW2452) { |
| 203 | MACvSetBBType(priv->PortOffset, BB_TYPE_11A); |
| 204 | priv->abyBBVGA[0] = 0x18; |
Briana Oursler | af93096 | 2020-04-03 10:18:05 -0700 | [diff] [blame] | 205 | bb_read_embedded(priv, 0xE7, &byData); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 206 | if (byData == 0x14) { |
Briana Oursler | af93096 | 2020-04-03 10:18:05 -0700 | [diff] [blame] | 207 | bb_write_embedded(priv, 0xE7, priv->abyBBVGA[0]); |
| 208 | bb_write_embedded(priv, 0xE1, 0x57); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 209 | } |
| 210 | } else { |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 211 | MACvSetBBType(priv->PortOffset, BB_TYPE_11A); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 212 | } |
Briana Oursler | af93096 | 2020-04-03 10:18:05 -0700 | [diff] [blame] | 213 | bb_write_embedded(priv, 0x88, 0x03); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 214 | bySlot = C_SLOT_SHORT; |
| 215 | bySIFS = C_SIFS_A; |
Burcin Akalin | 0cddeac | 2015-10-22 00:48:29 +0300 | [diff] [blame] | 216 | byDIFS = C_SIFS_A + 2 * C_SLOT_SHORT; |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 217 | byCWMaxMin = 0xA4; |
Malcolm Priestley | a558e3d | 2014-11-07 19:06:02 +0000 | [diff] [blame] | 218 | } else if (bb_type == BB_TYPE_11B) { |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 219 | MACvSetBBType(priv->PortOffset, BB_TYPE_11B); |
| 220 | if (priv->byRFType == RF_AIROHA7230) { |
| 221 | priv->abyBBVGA[0] = 0x1C; |
| 222 | priv->abyBBVGA[2] = 0x00; |
| 223 | priv->abyBBVGA[3] = 0x00; |
Briana Oursler | af93096 | 2020-04-03 10:18:05 -0700 | [diff] [blame] | 224 | bb_read_embedded(priv, 0xE7, &byData); |
Guido MartĂnez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 225 | if (byData == 0x20) |
Briana Oursler | af93096 | 2020-04-03 10:18:05 -0700 | [diff] [blame] | 226 | bb_write_embedded(priv, 0xE7, priv->abyBBVGA[0]); |
Guido MartĂnez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 227 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 228 | } else if (priv->byRFType == RF_UW2452) { |
| 229 | priv->abyBBVGA[0] = 0x14; |
Briana Oursler | af93096 | 2020-04-03 10:18:05 -0700 | [diff] [blame] | 230 | bb_read_embedded(priv, 0xE7, &byData); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 231 | if (byData == 0x18) { |
Briana Oursler | af93096 | 2020-04-03 10:18:05 -0700 | [diff] [blame] | 232 | bb_write_embedded(priv, 0xE7, priv->abyBBVGA[0]); |
| 233 | bb_write_embedded(priv, 0xE1, 0xD3); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 234 | } |
| 235 | } |
Briana Oursler | af93096 | 2020-04-03 10:18:05 -0700 | [diff] [blame] | 236 | bb_write_embedded(priv, 0x88, 0x02); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 237 | bySlot = C_SLOT_LONG; |
| 238 | bySIFS = C_SIFS_BG; |
Varsha Rao | f9d033c | 2016-10-12 10:06:46 +0530 | [diff] [blame] | 239 | byDIFS = C_SIFS_BG + 2 * C_SLOT_LONG; |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 240 | byCWMaxMin = 0xA5; |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 241 | } else { /* PK_TYPE_11GA & PK_TYPE_11GB */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 242 | MACvSetBBType(priv->PortOffset, BB_TYPE_11G); |
| 243 | if (priv->byRFType == RF_AIROHA7230) { |
| 244 | priv->abyBBVGA[0] = 0x1C; |
| 245 | priv->abyBBVGA[2] = 0x00; |
| 246 | priv->abyBBVGA[3] = 0x00; |
Briana Oursler | af93096 | 2020-04-03 10:18:05 -0700 | [diff] [blame] | 247 | bb_read_embedded(priv, 0xE7, &byData); |
Guido MartĂnez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 248 | if (byData == 0x20) |
Briana Oursler | af93096 | 2020-04-03 10:18:05 -0700 | [diff] [blame] | 249 | bb_write_embedded(priv, 0xE7, priv->abyBBVGA[0]); |
Guido MartĂnez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 250 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 251 | } else if (priv->byRFType == RF_UW2452) { |
| 252 | priv->abyBBVGA[0] = 0x14; |
Briana Oursler | af93096 | 2020-04-03 10:18:05 -0700 | [diff] [blame] | 253 | bb_read_embedded(priv, 0xE7, &byData); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 254 | if (byData == 0x18) { |
Briana Oursler | af93096 | 2020-04-03 10:18:05 -0700 | [diff] [blame] | 255 | bb_write_embedded(priv, 0xE7, priv->abyBBVGA[0]); |
| 256 | bb_write_embedded(priv, 0xE1, 0xD3); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 257 | } |
| 258 | } |
Briana Oursler | af93096 | 2020-04-03 10:18:05 -0700 | [diff] [blame] | 259 | bb_write_embedded(priv, 0x88, 0x08); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 260 | bySIFS = C_SIFS_BG; |
Malcolm Priestley | 0614a0e | 2014-10-29 17:43:51 +0000 | [diff] [blame] | 261 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 262 | if (priv->bShortSlotTime) { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 263 | bySlot = C_SLOT_SHORT; |
Burcin Akalin | 68535a1 | 2015-10-22 15:15:39 +0300 | [diff] [blame] | 264 | byDIFS = C_SIFS_BG + 2 * C_SLOT_SHORT; |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 265 | } else { |
| 266 | bySlot = C_SLOT_LONG; |
Varsha Rao | f9d033c | 2016-10-12 10:06:46 +0530 | [diff] [blame] | 267 | byDIFS = C_SIFS_BG + 2 * C_SLOT_LONG; |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 268 | } |
Guido MartĂnez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 269 | |
Malcolm Priestley | 0614a0e | 2014-10-29 17:43:51 +0000 | [diff] [blame] | 270 | byCWMaxMin = 0xa4; |
Guido MartĂnez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 271 | |
Malcolm Priestley | 0614a0e | 2014-10-29 17:43:51 +0000 | [diff] [blame] | 272 | for (i = RATE_54M; i >= RATE_6M; i--) { |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 273 | if (priv->basic_rates & ((u32)(0x1 << i))) { |
Malcolm Priestley | 0614a0e | 2014-10-29 17:43:51 +0000 | [diff] [blame] | 274 | byCWMaxMin |= 0x1; |
| 275 | break; |
| 276 | } |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 277 | } |
| 278 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 279 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 280 | if (priv->byRFType == RF_RFMD2959) { |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 281 | /* |
| 282 | * bcs TX_PE will reserve 3 us hardware's processing |
| 283 | * time here is 2 us. |
| 284 | */ |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 285 | bySIFS -= 3; |
| 286 | byDIFS -= 3; |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 287 | /* |
| 288 | * TX_PE will reserve 3 us for MAX2829 A mode only, it is for |
| 289 | * better TX throughput; MAC will need 2 us to process, so the |
| 290 | * SIFS, DIFS can be shorter by 2 us. |
| 291 | */ |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 292 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 293 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 294 | if (priv->bySIFS != bySIFS) { |
| 295 | priv->bySIFS = bySIFS; |
| 296 | VNSvOutPortB(priv->PortOffset + MAC_REG_SIFS, priv->bySIFS); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 297 | } |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 298 | if (priv->byDIFS != byDIFS) { |
| 299 | priv->byDIFS = byDIFS; |
| 300 | VNSvOutPortB(priv->PortOffset + MAC_REG_DIFS, priv->byDIFS); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 301 | } |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 302 | if (priv->byEIFS != C_EIFS) { |
| 303 | priv->byEIFS = C_EIFS; |
| 304 | VNSvOutPortB(priv->PortOffset + MAC_REG_EIFS, priv->byEIFS); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 305 | } |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 306 | if (priv->bySlot != bySlot) { |
| 307 | priv->bySlot = bySlot; |
| 308 | VNSvOutPortB(priv->PortOffset + MAC_REG_SLOT, priv->bySlot); |
Guido MartĂnez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 309 | |
Briana Oursler | af93096 | 2020-04-03 10:18:05 -0700 | [diff] [blame] | 310 | bb_set_short_slot_time(priv); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 311 | } |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 312 | if (priv->byCWMaxMin != byCWMaxMin) { |
| 313 | priv->byCWMaxMin = byCWMaxMin; |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 314 | VNSvOutPortB(priv->PortOffset + MAC_REG_CWMAXMIN0, |
| 315 | priv->byCWMaxMin); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 316 | } |
Guido MartĂnez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 317 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 318 | priv->byPacketType = CARDbyGetPktType(priv); |
Malcolm Priestley | 61b9099 | 2014-11-06 20:02:05 +0000 | [diff] [blame] | 319 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 320 | CARDvSetRSPINF(priv, bb_type); |
Malcolm Priestley | 0614a0e | 2014-10-29 17:43:51 +0000 | [diff] [blame] | 321 | |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 322 | return true; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 323 | } |
| 324 | |
| 325 | /* |
| 326 | * Description: Sync. TSF counter to BSS |
| 327 | * Get TSF offset and write to HW |
| 328 | * |
| 329 | * Parameters: |
| 330 | * In: |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 331 | * priv - The adapter to be sync. |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 332 | * byRxRate - data rate of receive beacon |
| 333 | * qwBSSTimestamp - Rx BCN's TSF |
| 334 | * qwLocalTSF - Local TSF |
| 335 | * Out: |
| 336 | * none |
| 337 | * |
| 338 | * Return Value: none |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 339 | */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 340 | bool CARDbUpdateTSF(struct vnt_private *priv, unsigned char byRxRate, |
Malcolm Priestley | 032ed34 | 2015-04-21 22:33:01 +0100 | [diff] [blame] | 341 | u64 qwBSSTimestamp) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 342 | { |
Malcolm Priestley | 032ed34 | 2015-04-21 22:33:01 +0100 | [diff] [blame] | 343 | u64 local_tsf; |
Malcolm Priestley | 0fc2a76 | 2014-08-10 12:21:58 +0100 | [diff] [blame] | 344 | u64 qwTSFOffset = 0; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 345 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 346 | CARDbGetCurrentTSF(priv, &local_tsf); |
Malcolm Priestley | 032ed34 | 2015-04-21 22:33:01 +0100 | [diff] [blame] | 347 | |
| 348 | if (qwBSSTimestamp != local_tsf) { |
| 349 | qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp, |
| 350 | local_tsf); |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 351 | /* adjust TSF, HW's TSF add TSF Offset reg */ |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 352 | VNSvOutPortD(priv->PortOffset + MAC_REG_TSFOFST, |
| 353 | (u32)qwTSFOffset); |
| 354 | VNSvOutPortD(priv->PortOffset + MAC_REG_TSFOFST + 4, |
| 355 | (u32)(qwTSFOffset >> 32)); |
| 356 | MACvRegBitsOn(priv->PortOffset, MAC_REG_TFTCTL, |
| 357 | TFTCTL_TSFSYNCEN); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 358 | } |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 359 | return true; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 360 | } |
| 361 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 362 | /* |
| 363 | * Description: Set NIC TSF counter for first Beacon time |
| 364 | * Get NEXTTBTT from adjusted TSF and Beacon Interval |
| 365 | * |
| 366 | * Parameters: |
| 367 | * In: |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 368 | * priv - The adapter to be set. |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 369 | * wBeaconInterval - Beacon Interval |
| 370 | * Out: |
| 371 | * none |
| 372 | * |
Charles Clément | 5a5a2a6 | 2010-08-01 17:15:49 +0200 | [diff] [blame] | 373 | * Return Value: true if succeed; otherwise false |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 374 | */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 375 | bool CARDbSetBeaconPeriod(struct vnt_private *priv, |
Malcolm Priestley | d052270 | 2014-08-10 15:46:57 +0100 | [diff] [blame] | 376 | unsigned short wBeaconInterval) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 377 | { |
Malcolm Priestley | 0fc2a76 | 2014-08-10 12:21:58 +0100 | [diff] [blame] | 378 | u64 qwNextTBTT = 0; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 379 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 380 | CARDbGetCurrentTSF(priv, &qwNextTBTT); /* Get Local TSF counter */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 381 | |
Malcolm Priestley | 4a5f718 | 2014-08-10 12:22:00 +0100 | [diff] [blame] | 382 | qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 383 | |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 384 | /* set HW beacon interval */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 385 | VNSvOutPortW(priv->PortOffset + MAC_REG_BI, wBeaconInterval); |
| 386 | priv->wBeaconInterval = wBeaconInterval; |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 387 | /* Set NextTBTT */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 388 | VNSvOutPortD(priv->PortOffset + MAC_REG_NEXTTBTT, (u32)qwNextTBTT); |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 389 | VNSvOutPortD(priv->PortOffset + MAC_REG_NEXTTBTT + 4, |
| 390 | (u32)(qwNextTBTT >> 32)); |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 391 | MACvRegBitsOn(priv->PortOffset, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 392 | |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 393 | return true; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 394 | } |
| 395 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 396 | /* |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 397 | * Description: Turn off Radio power |
| 398 | * |
| 399 | * Parameters: |
| 400 | * In: |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 401 | * priv - The adapter to be turned off |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 402 | * Out: |
| 403 | * none |
| 404 | * |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 405 | */ |
Nishka Dasgupta | d7255ba | 2019-05-31 23:02:26 +0530 | [diff] [blame] | 406 | void CARDbRadioPowerOff(struct vnt_private *priv) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 407 | { |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 408 | if (priv->bRadioOff) |
Nishka Dasgupta | d7255ba | 2019-05-31 23:02:26 +0530 | [diff] [blame] | 409 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 410 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 411 | switch (priv->byRFType) { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 412 | case RF_RFMD2959: |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 413 | MACvWordRegBitsOff(priv->PortOffset, MAC_REG_SOFTPWRCTL, |
| 414 | SOFTPWRCTL_TXPEINV); |
| 415 | MACvWordRegBitsOn(priv->PortOffset, MAC_REG_SOFTPWRCTL, |
| 416 | SOFTPWRCTL_SWPE1); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 417 | break; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 418 | |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 419 | case RF_AIROHA: |
| 420 | case RF_AL2230S: |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 421 | case RF_AIROHA7230: |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 422 | MACvWordRegBitsOff(priv->PortOffset, MAC_REG_SOFTPWRCTL, |
| 423 | SOFTPWRCTL_SWPE2); |
| 424 | MACvWordRegBitsOff(priv->PortOffset, MAC_REG_SOFTPWRCTL, |
| 425 | SOFTPWRCTL_SWPE3); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 426 | break; |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 427 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 428 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 429 | MACvRegBitsOff(priv->PortOffset, MAC_REG_HOSTCR, HOSTCR_RXON); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 430 | |
Briana Oursler | af93096 | 2020-04-03 10:18:05 -0700 | [diff] [blame] | 431 | bb_set_deep_sleep(priv, priv->byLocalID); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 432 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 433 | priv->bRadioOff = true; |
Guillaume Clement | 941ead9 | 2014-07-25 01:06:21 +0200 | [diff] [blame] | 434 | pr_debug("chester power off\n"); |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 435 | MACvRegBitsOn(priv->PortOffset, MAC_REG_GPIOCTL0, |
| 436 | LED_ACTSET); /* LED issue */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 437 | } |
| 438 | |
Madhumitha Prabakaran | a248ca3 | 2019-02-27 14:50:40 -0600 | [diff] [blame] | 439 | void CARDvSafeResetTx(struct vnt_private *priv) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 440 | { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 441 | unsigned int uu; |
Malcolm Priestley | e235727 | 2015-08-14 22:58:51 +0100 | [diff] [blame] | 442 | struct vnt_tx_desc *pCurrTD; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 443 | |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 444 | /* initialize TD index */ |
Sreya Mittal | 6c9769c | 2017-03-05 17:42:28 +0530 | [diff] [blame] | 445 | priv->apTailTD[0] = &priv->apTD0Rings[0]; |
| 446 | priv->apCurrTD[0] = &priv->apTD0Rings[0]; |
Nick Rosbrook | ffbad99 | 2016-11-01 21:15:07 -0400 | [diff] [blame] | 447 | |
Sreya Mittal | 6c9769c | 2017-03-05 17:42:28 +0530 | [diff] [blame] | 448 | priv->apTailTD[1] = &priv->apTD1Rings[0]; |
| 449 | priv->apCurrTD[1] = &priv->apTD1Rings[0]; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 450 | |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 451 | for (uu = 0; uu < TYPE_MAXTD; uu++) |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 452 | priv->iTDUsed[uu] = 0; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 453 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 454 | for (uu = 0; uu < priv->opts.tx_descs[0]; uu++) { |
Sreya Mittal | 6c9769c | 2017-03-05 17:42:28 +0530 | [diff] [blame] | 455 | pCurrTD = &priv->apTD0Rings[uu]; |
Malcolm Priestley | 5235ff6 | 2015-08-14 22:58:46 +0100 | [diff] [blame] | 456 | pCurrTD->td0.owner = OWNED_BY_HOST; |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 457 | /* init all Tx Packet pointer to NULL */ |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 458 | } |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 459 | for (uu = 0; uu < priv->opts.tx_descs[1]; uu++) { |
Sreya Mittal | 6c9769c | 2017-03-05 17:42:28 +0530 | [diff] [blame] | 460 | pCurrTD = &priv->apTD1Rings[uu]; |
Malcolm Priestley | 5235ff6 | 2015-08-14 22:58:46 +0100 | [diff] [blame] | 461 | pCurrTD->td0.owner = OWNED_BY_HOST; |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 462 | /* init all Tx Packet pointer to NULL */ |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 463 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 464 | |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 465 | /* set MAC TD pointer */ |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 466 | MACvSetCurrTXDescAddr(TYPE_TXDMA0, priv, priv->td0_pool_dma); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 467 | |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 468 | MACvSetCurrTXDescAddr(TYPE_AC0DMA, priv, priv->td1_pool_dma); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 469 | |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 470 | /* set MAC Beacon TX pointer */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 471 | MACvSetCurrBCNTxDescAddr(priv->PortOffset, |
| 472 | (priv->tx_beacon_dma)); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 473 | } |
| 474 | |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 475 | /* |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 476 | * Description: |
| 477 | * Reset Rx |
| 478 | * |
| 479 | * Parameters: |
| 480 | * In: |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 481 | * priv - Pointer to the adapter |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 482 | * Out: |
| 483 | * none |
| 484 | * |
| 485 | * Return Value: none |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 486 | */ |
Danilo Alves | 009bdc1 | 2018-04-07 11:55:15 -0300 | [diff] [blame] | 487 | void CARDvSafeResetRx(struct vnt_private *priv) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 488 | { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 489 | unsigned int uu; |
Malcolm Priestley | 9cb693f | 2015-08-15 21:57:35 +0100 | [diff] [blame] | 490 | struct vnt_rx_desc *pDesc; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 491 | |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 492 | /* initialize RD index */ |
Sreya Mittal | 6c9769c | 2017-03-05 17:42:28 +0530 | [diff] [blame] | 493 | priv->pCurrRD[0] = &priv->aRD0Ring[0]; |
| 494 | priv->pCurrRD[1] = &priv->aRD1Ring[0]; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 495 | |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 496 | /* init state, all RD is chip's */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 497 | for (uu = 0; uu < priv->opts.rx_descs0; uu++) { |
Sreya Mittal | 6c9769c | 2017-03-05 17:42:28 +0530 | [diff] [blame] | 498 | pDesc = &priv->aRD0Ring[uu]; |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 499 | pDesc->rd0.res_count = cpu_to_le16(priv->rx_buf_sz); |
Malcolm Priestley | de1c186 | 2015-08-15 21:57:32 +0100 | [diff] [blame] | 500 | pDesc->rd0.owner = OWNED_BY_NIC; |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 501 | pDesc->rd1.req_count = cpu_to_le16(priv->rx_buf_sz); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 502 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 503 | |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 504 | /* init state, all RD is chip's */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 505 | for (uu = 0; uu < priv->opts.rx_descs1; uu++) { |
Sreya Mittal | 6c9769c | 2017-03-05 17:42:28 +0530 | [diff] [blame] | 506 | pDesc = &priv->aRD1Ring[uu]; |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 507 | pDesc->rd0.res_count = cpu_to_le16(priv->rx_buf_sz); |
Malcolm Priestley | de1c186 | 2015-08-15 21:57:32 +0100 | [diff] [blame] | 508 | pDesc->rd0.owner = OWNED_BY_NIC; |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 509 | pDesc->rd1.req_count = cpu_to_le16(priv->rx_buf_sz); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 510 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 511 | |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 512 | /* set perPkt mode */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 513 | MACvRx0PerPktMode(priv->PortOffset); |
| 514 | MACvRx1PerPktMode(priv->PortOffset); |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 515 | /* set MAC RD pointer */ |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 516 | MACvSetCurrRx0DescAddr(priv, priv->rd0_pool_dma); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 517 | |
Malcolm Priestley | f9f853a | 2015-11-22 09:07:22 +0000 | [diff] [blame] | 518 | MACvSetCurrRx1DescAddr(priv, priv->rd1_pool_dma); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 519 | } |
| 520 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 521 | /* |
| 522 | * Description: Get response Control frame rate in CCK mode |
| 523 | * |
| 524 | * Parameters: |
| 525 | * In: |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 526 | * priv - The adapter to be set |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 527 | * wRateIdx - Receiving data rate |
| 528 | * Out: |
| 529 | * none |
| 530 | * |
| 531 | * Return Value: response Control frame rate |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 532 | */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 533 | static unsigned short CARDwGetCCKControlRate(struct vnt_private *priv, |
Malcolm Priestley | d052270 | 2014-08-10 15:46:57 +0100 | [diff] [blame] | 534 | unsigned short wRateIdx) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 535 | { |
Sandhya Bankar | 58d4474 | 2016-09-19 17:47:21 +0530 | [diff] [blame] | 536 | unsigned int ui = (unsigned int)wRateIdx; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 537 | |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 538 | while (ui > RATE_1M) { |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 539 | if (priv->basic_rates & ((u32)0x1 << ui)) |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 540 | return (unsigned short)ui; |
Guido MartĂnez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 541 | |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 542 | ui--; |
| 543 | } |
| 544 | return (unsigned short)RATE_1M; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 545 | } |
| 546 | |
| 547 | /* |
| 548 | * Description: Get response Control frame rate in OFDM mode |
| 549 | * |
| 550 | * Parameters: |
| 551 | * In: |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 552 | * priv - The adapter to be set |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 553 | * wRateIdx - Receiving data rate |
| 554 | * Out: |
| 555 | * none |
| 556 | * |
| 557 | * Return Value: response Control frame rate |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 558 | */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 559 | static unsigned short CARDwGetOFDMControlRate(struct vnt_private *priv, |
Malcolm Priestley | d052270 | 2014-08-10 15:46:57 +0100 | [diff] [blame] | 560 | unsigned short wRateIdx) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 561 | { |
Sandhya Bankar | 58d4474 | 2016-09-19 17:47:21 +0530 | [diff] [blame] | 562 | unsigned int ui = (unsigned int)wRateIdx; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 563 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 564 | pr_debug("BASIC RATE: %X\n", priv->basic_rates); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 565 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 566 | if (!CARDbIsOFDMinBasicRate((void *)priv)) { |
Simo Koskinen | 6f67526 | 2017-07-17 14:59:05 +0200 | [diff] [blame] | 567 | pr_debug("%s:(NO OFDM) %d\n", __func__, wRateIdx); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 568 | if (wRateIdx > RATE_24M) |
| 569 | wRateIdx = RATE_24M; |
| 570 | return wRateIdx; |
| 571 | } |
| 572 | while (ui > RATE_11M) { |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 573 | if (priv->basic_rates & ((u32)0x1 << ui)) { |
Simo Koskinen | 6f67526 | 2017-07-17 14:59:05 +0200 | [diff] [blame] | 574 | pr_debug("%s : %d\n", __func__, ui); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 575 | return (unsigned short)ui; |
| 576 | } |
| 577 | ui--; |
| 578 | } |
Simo Koskinen | 6f67526 | 2017-07-17 14:59:05 +0200 | [diff] [blame] | 579 | pr_debug("%s: 6M\n", __func__); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 580 | return (unsigned short)RATE_24M; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 581 | } |
| 582 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 583 | /* |
| 584 | * Description: Set RSPINF |
| 585 | * |
| 586 | * Parameters: |
| 587 | * In: |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 588 | * priv - The adapter to be set |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 589 | * Out: |
| 590 | * none |
| 591 | * |
| 592 | * Return Value: None. |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 593 | */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 594 | void CARDvSetRSPINF(struct vnt_private *priv, u8 bb_type) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 595 | { |
Malcolm Priestley | 864a5a3 | 2014-08-20 22:30:30 +0100 | [diff] [blame] | 596 | union vnt_phy_field_swap phy; |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 597 | unsigned char byTxRate, byRsvTime; /* For OFDM */ |
Malcolm Priestley | 95775d1 | 2015-01-11 10:26:12 +0000 | [diff] [blame] | 598 | unsigned long flags; |
| 599 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 600 | spin_lock_irqsave(&priv->lock, flags); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 601 | |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 602 | /* Set to Page1 */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 603 | MACvSelectPage1(priv->PortOffset); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 604 | |
Malcolm Priestley | 864a5a3 | 2014-08-20 22:30:30 +0100 | [diff] [blame] | 605 | /* RSPINF_b_1 */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 606 | vnt_get_phy_field(priv, 14, |
| 607 | CARDwGetCCKControlRate(priv, RATE_1M), |
Malcolm Priestley | 864a5a3 | 2014-08-20 22:30:30 +0100 | [diff] [blame] | 608 | PK_TYPE_11B, &phy.field_read); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 609 | |
Malcolm Priestley | 864a5a3 | 2014-08-20 22:30:30 +0100 | [diff] [blame] | 610 | /* swap over to get correct write order */ |
| 611 | swap(phy.swap[0], phy.swap[1]); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 612 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 613 | VNSvOutPortD(priv->PortOffset + MAC_REG_RSPINF_B_1, phy.field_write); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 614 | |
Malcolm Priestley | 864a5a3 | 2014-08-20 22:30:30 +0100 | [diff] [blame] | 615 | /* RSPINF_b_2 */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 616 | vnt_get_phy_field(priv, 14, |
| 617 | CARDwGetCCKControlRate(priv, RATE_2M), |
Malcolm Priestley | 864a5a3 | 2014-08-20 22:30:30 +0100 | [diff] [blame] | 618 | PK_TYPE_11B, &phy.field_read); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 619 | |
Malcolm Priestley | 864a5a3 | 2014-08-20 22:30:30 +0100 | [diff] [blame] | 620 | swap(phy.swap[0], phy.swap[1]); |
| 621 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 622 | VNSvOutPortD(priv->PortOffset + MAC_REG_RSPINF_B_2, phy.field_write); |
Malcolm Priestley | 864a5a3 | 2014-08-20 22:30:30 +0100 | [diff] [blame] | 623 | |
| 624 | /* RSPINF_b_5 */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 625 | vnt_get_phy_field(priv, 14, |
| 626 | CARDwGetCCKControlRate(priv, RATE_5M), |
Malcolm Priestley | 864a5a3 | 2014-08-20 22:30:30 +0100 | [diff] [blame] | 627 | PK_TYPE_11B, &phy.field_read); |
| 628 | |
| 629 | swap(phy.swap[0], phy.swap[1]); |
| 630 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 631 | VNSvOutPortD(priv->PortOffset + MAC_REG_RSPINF_B_5, phy.field_write); |
Malcolm Priestley | 864a5a3 | 2014-08-20 22:30:30 +0100 | [diff] [blame] | 632 | |
| 633 | /* RSPINF_b_11 */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 634 | vnt_get_phy_field(priv, 14, |
| 635 | CARDwGetCCKControlRate(priv, RATE_11M), |
Malcolm Priestley | 864a5a3 | 2014-08-20 22:30:30 +0100 | [diff] [blame] | 636 | PK_TYPE_11B, &phy.field_read); |
| 637 | |
| 638 | swap(phy.swap[0], phy.swap[1]); |
| 639 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 640 | VNSvOutPortD(priv->PortOffset + MAC_REG_RSPINF_B_11, phy.field_write); |
Malcolm Priestley | 864a5a3 | 2014-08-20 22:30:30 +0100 | [diff] [blame] | 641 | |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 642 | /* RSPINF_a_6 */ |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 643 | s_vCalculateOFDMRParameter(RATE_6M, |
Malcolm Priestley | 6e1d14a | 2014-11-07 19:06:03 +0000 | [diff] [blame] | 644 | bb_type, |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 645 | &byTxRate, |
| 646 | &byRsvTime); |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 647 | VNSvOutPortW(priv->PortOffset + MAC_REG_RSPINF_A_6, |
| 648 | MAKEWORD(byTxRate, byRsvTime)); |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 649 | /* RSPINF_a_9 */ |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 650 | s_vCalculateOFDMRParameter(RATE_9M, |
Malcolm Priestley | 6e1d14a | 2014-11-07 19:06:03 +0000 | [diff] [blame] | 651 | bb_type, |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 652 | &byTxRate, |
| 653 | &byRsvTime); |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 654 | VNSvOutPortW(priv->PortOffset + MAC_REG_RSPINF_A_9, |
| 655 | MAKEWORD(byTxRate, byRsvTime)); |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 656 | /* RSPINF_a_12 */ |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 657 | s_vCalculateOFDMRParameter(RATE_12M, |
Malcolm Priestley | 6e1d14a | 2014-11-07 19:06:03 +0000 | [diff] [blame] | 658 | bb_type, |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 659 | &byTxRate, |
| 660 | &byRsvTime); |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 661 | VNSvOutPortW(priv->PortOffset + MAC_REG_RSPINF_A_12, |
| 662 | MAKEWORD(byTxRate, byRsvTime)); |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 663 | /* RSPINF_a_18 */ |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 664 | s_vCalculateOFDMRParameter(RATE_18M, |
Malcolm Priestley | 6e1d14a | 2014-11-07 19:06:03 +0000 | [diff] [blame] | 665 | bb_type, |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 666 | &byTxRate, |
| 667 | &byRsvTime); |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 668 | VNSvOutPortW(priv->PortOffset + MAC_REG_RSPINF_A_18, |
| 669 | MAKEWORD(byTxRate, byRsvTime)); |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 670 | /* RSPINF_a_24 */ |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 671 | s_vCalculateOFDMRParameter(RATE_24M, |
Malcolm Priestley | 6e1d14a | 2014-11-07 19:06:03 +0000 | [diff] [blame] | 672 | bb_type, |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 673 | &byTxRate, |
| 674 | &byRsvTime); |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 675 | VNSvOutPortW(priv->PortOffset + MAC_REG_RSPINF_A_24, |
| 676 | MAKEWORD(byTxRate, byRsvTime)); |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 677 | /* RSPINF_a_36 */ |
Cristiane Naves | 6e0afa3 | 2019-10-29 18:09:17 -0300 | [diff] [blame] | 678 | s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)priv, |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 679 | RATE_36M), |
Malcolm Priestley | 6e1d14a | 2014-11-07 19:06:03 +0000 | [diff] [blame] | 680 | bb_type, |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 681 | &byTxRate, |
| 682 | &byRsvTime); |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 683 | VNSvOutPortW(priv->PortOffset + MAC_REG_RSPINF_A_36, |
| 684 | MAKEWORD(byTxRate, byRsvTime)); |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 685 | /* RSPINF_a_48 */ |
Cristiane Naves | 6e0afa3 | 2019-10-29 18:09:17 -0300 | [diff] [blame] | 686 | s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)priv, |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 687 | RATE_48M), |
Malcolm Priestley | 6e1d14a | 2014-11-07 19:06:03 +0000 | [diff] [blame] | 688 | bb_type, |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 689 | &byTxRate, |
| 690 | &byRsvTime); |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 691 | VNSvOutPortW(priv->PortOffset + MAC_REG_RSPINF_A_48, |
| 692 | MAKEWORD(byTxRate, byRsvTime)); |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 693 | /* RSPINF_a_54 */ |
Cristiane Naves | 6e0afa3 | 2019-10-29 18:09:17 -0300 | [diff] [blame] | 694 | s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)priv, |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 695 | RATE_54M), |
Malcolm Priestley | 6e1d14a | 2014-11-07 19:06:03 +0000 | [diff] [blame] | 696 | bb_type, |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 697 | &byTxRate, |
| 698 | &byRsvTime); |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 699 | VNSvOutPortW(priv->PortOffset + MAC_REG_RSPINF_A_54, |
| 700 | MAKEWORD(byTxRate, byRsvTime)); |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 701 | /* RSPINF_a_72 */ |
Cristiane Naves | 6e0afa3 | 2019-10-29 18:09:17 -0300 | [diff] [blame] | 702 | s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)priv, |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 703 | RATE_54M), |
Malcolm Priestley | 6e1d14a | 2014-11-07 19:06:03 +0000 | [diff] [blame] | 704 | bb_type, |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 705 | &byTxRate, |
| 706 | &byRsvTime); |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 707 | VNSvOutPortW(priv->PortOffset + MAC_REG_RSPINF_A_72, |
| 708 | MAKEWORD(byTxRate, byRsvTime)); |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 709 | /* Set to Page0 */ |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 710 | MACvSelectPage0(priv->PortOffset); |
Malcolm Priestley | 95775d1 | 2015-01-11 10:26:12 +0000 | [diff] [blame] | 711 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 712 | spin_unlock_irqrestore(&priv->lock, flags); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 713 | } |
| 714 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 715 | void CARDvUpdateBasicTopRate(struct vnt_private *priv) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 716 | { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 717 | unsigned char byTopOFDM = RATE_24M, byTopCCK = RATE_1M; |
| 718 | unsigned char ii; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 719 | |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 720 | /* Determines the highest basic rate. */ |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 721 | for (ii = RATE_54M; ii >= RATE_6M; ii--) { |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 722 | if ((priv->basic_rates) & ((u32)(1 << ii))) { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 723 | byTopOFDM = ii; |
| 724 | break; |
| 725 | } |
| 726 | } |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 727 | priv->byTopOFDMBasicRate = byTopOFDM; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 728 | |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 729 | for (ii = RATE_11M;; ii--) { |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 730 | if ((priv->basic_rates) & ((u32)(1 << ii))) { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 731 | byTopCCK = ii; |
| 732 | break; |
| 733 | } |
| 734 | if (ii == RATE_1M) |
| 735 | break; |
| 736 | } |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 737 | priv->byTopCCKBasicRate = byTopCCK; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 738 | } |
| 739 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 740 | bool CARDbIsOFDMinBasicRate(struct vnt_private *priv) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 741 | { |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 742 | int ii; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 743 | |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 744 | for (ii = RATE_54M; ii >= RATE_6M; ii--) { |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 745 | if ((priv->basic_rates) & ((u32)BIT(ii))) |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 746 | return true; |
| 747 | } |
| 748 | return false; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 749 | } |
| 750 | |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 751 | unsigned char CARDbyGetPktType(struct vnt_private *priv) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 752 | { |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 753 | if (priv->byBBType == BB_TYPE_11A || priv->byBBType == BB_TYPE_11B) |
| 754 | return (unsigned char)priv->byBBType; |
| 755 | else if (CARDbIsOFDMinBasicRate((void *)priv)) |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 756 | return PK_TYPE_11GA; |
Guido MartĂnez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 757 | else |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 758 | return PK_TYPE_11GB; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 759 | } |
| 760 | |
| 761 | /* |
Justin P. Mattock | 7664ec8 | 2012-08-20 08:43:15 -0700 | [diff] [blame] | 762 | * Description: Calculate TSF offset of two TSF input |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 763 | * Get TSF Offset from RxBCN's TSF and local TSF |
| 764 | * |
| 765 | * Parameters: |
| 766 | * In: |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 767 | * priv - The adapter to be sync. |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 768 | * qwTSF1 - Rx BCN's TSF |
| 769 | * qwTSF2 - Local TSF |
| 770 | * Out: |
| 771 | * none |
| 772 | * |
| 773 | * Return Value: TSF Offset value |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 774 | */ |
Malcolm Priestley | 0fc2a76 | 2014-08-10 12:21:58 +0100 | [diff] [blame] | 775 | u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 776 | { |
Amitoj Kaur Chawla | 5309c5b | 2015-10-15 13:45:39 +0530 | [diff] [blame] | 777 | unsigned short wRxBcnTSFOffst; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 778 | |
Marko Stankovic | 5b5d636 | 2017-05-20 18:50:37 +0200 | [diff] [blame] | 779 | wRxBcnTSFOffst = cwRXBCNTSFOff[byRxRate % MAX_RATE]; |
Guido MartĂnez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 780 | |
Malcolm Priestley | 0fc2a76 | 2014-08-10 12:21:58 +0100 | [diff] [blame] | 781 | qwTSF2 += (u64)wRxBcnTSFOffst; |
| 782 | |
simran singhal | 57ce4df | 2017-02-19 02:52:07 +0530 | [diff] [blame] | 783 | return qwTSF1 - qwTSF2; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 784 | } |
| 785 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 786 | /* |
| 787 | * Description: Read NIC TSF counter |
| 788 | * Get local TSF counter |
| 789 | * |
| 790 | * Parameters: |
| 791 | * In: |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 792 | * priv - The adapter to be read |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 793 | * Out: |
| 794 | * qwCurrTSF - Current TSF counter |
| 795 | * |
Charles Clément | 5a5a2a6 | 2010-08-01 17:15:49 +0200 | [diff] [blame] | 796 | * Return Value: true if success; otherwise false |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 797 | */ |
Malcolm Priestley | 738487f | 2014-11-12 21:11:09 +0000 | [diff] [blame] | 798 | bool CARDbGetCurrentTSF(struct vnt_private *priv, u64 *pqwCurrTSF) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 799 | { |
Varsha Rao | 26f64a6 | 2016-10-15 16:02:58 +0530 | [diff] [blame] | 800 | void __iomem *iobase = priv->PortOffset; |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 801 | unsigned short ww; |
| 802 | unsigned char byData; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 803 | |
Varsha Rao | 26f64a6 | 2016-10-15 16:02:58 +0530 | [diff] [blame] | 804 | MACvRegBitsOn(iobase, MAC_REG_TFTCTL, TFTCTL_TSFCNTRRD); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 805 | for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { |
Varsha Rao | 26f64a6 | 2016-10-15 16:02:58 +0530 | [diff] [blame] | 806 | VNSvInPortB(iobase + MAC_REG_TFTCTL, &byData); |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 807 | if (!(byData & TFTCTL_TSFCNTRRD)) |
| 808 | break; |
| 809 | } |
| 810 | if (ww == W_MAX_TIMEOUT) |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 811 | return false; |
Varsha Rao | 26f64a6 | 2016-10-15 16:02:58 +0530 | [diff] [blame] | 812 | VNSvInPortD(iobase + MAC_REG_TSFCNTR, (u32 *)pqwCurrTSF); |
| 813 | VNSvInPortD(iobase + MAC_REG_TSFCNTR + 4, (u32 *)pqwCurrTSF + 1); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 814 | |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 815 | return true; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 816 | } |
| 817 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 818 | /* |
| 819 | * Description: Read NIC TSF counter |
| 820 | * Get NEXTTBTT from adjusted TSF and Beacon Interval |
| 821 | * |
| 822 | * Parameters: |
| 823 | * In: |
| 824 | * qwTSF - Current TSF counter |
| 825 | * wbeaconInterval - Beacon Interval |
| 826 | * Out: |
| 827 | * qwCurrTSF - Current TSF counter |
| 828 | * |
| 829 | * Return Value: TSF value of next Beacon |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 830 | */ |
Malcolm Priestley | 0fc2a76 | 2014-08-10 12:21:58 +0100 | [diff] [blame] | 831 | u64 CARDqGetNextTBTT(u64 qwTSF, unsigned short wBeaconInterval) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 832 | { |
Malcolm Priestley | 989ae86 | 2014-08-10 12:21:59 +0100 | [diff] [blame] | 833 | u32 beacon_int; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 834 | |
Malcolm Priestley | 989ae86 | 2014-08-10 12:21:59 +0100 | [diff] [blame] | 835 | beacon_int = wBeaconInterval * 1024; |
Malcolm Priestley | 989ae86 | 2014-08-10 12:21:59 +0100 | [diff] [blame] | 836 | if (beacon_int) { |
| 837 | do_div(qwTSF, beacon_int); |
| 838 | qwTSF += 1; |
| 839 | qwTSF *= beacon_int; |
| 840 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 841 | |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 842 | return qwTSF; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 843 | } |
| 844 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 845 | /* |
| 846 | * Description: Set NIC TSF counter for first Beacon time |
| 847 | * Get NEXTTBTT from adjusted TSF and Beacon Interval |
| 848 | * |
| 849 | * Parameters: |
| 850 | * In: |
Varsha Rao | 26f64a6 | 2016-10-15 16:02:58 +0530 | [diff] [blame] | 851 | * iobase - IO Base |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 852 | * wBeaconInterval - Beacon Interval |
| 853 | * Out: |
| 854 | * none |
| 855 | * |
| 856 | * Return Value: none |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 857 | */ |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 858 | void CARDvSetFirstNextTBTT(struct vnt_private *priv, |
| 859 | unsigned short wBeaconInterval) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 860 | { |
Varsha Rao | 26f64a6 | 2016-10-15 16:02:58 +0530 | [diff] [blame] | 861 | void __iomem *iobase = priv->PortOffset; |
Malcolm Priestley | 0fc2a76 | 2014-08-10 12:21:58 +0100 | [diff] [blame] | 862 | u64 qwNextTBTT = 0; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 863 | |
Malcolm Priestley | 738487f | 2014-11-12 21:11:09 +0000 | [diff] [blame] | 864 | CARDbGetCurrentTSF(priv, &qwNextTBTT); /* Get Local TSF counter */ |
Malcolm Priestley | 0fc2a76 | 2014-08-10 12:21:58 +0100 | [diff] [blame] | 865 | |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 866 | qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval); |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 867 | /* Set NextTBTT */ |
Varsha Rao | 26f64a6 | 2016-10-15 16:02:58 +0530 | [diff] [blame] | 868 | VNSvOutPortD(iobase + MAC_REG_NEXTTBTT, (u32)qwNextTBTT); |
| 869 | VNSvOutPortD(iobase + MAC_REG_NEXTTBTT + 4, (u32)(qwNextTBTT >> 32)); |
| 870 | MACvRegBitsOn(iobase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 871 | } |
| 872 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 873 | /* |
| 874 | * Description: Sync NIC TSF counter for Beacon time |
| 875 | * Get NEXTTBTT and write to HW |
| 876 | * |
| 877 | * Parameters: |
| 878 | * In: |
Malcolm Priestley | 9196124 | 2015-10-17 11:33:02 +0100 | [diff] [blame] | 879 | * priv - The adapter to be set |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 880 | * qwTSF - Current TSF counter |
| 881 | * wBeaconInterval - Beacon Interval |
| 882 | * Out: |
| 883 | * none |
| 884 | * |
| 885 | * Return Value: none |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 886 | */ |
Kathryn Hampton | 5150d01 | 2016-03-15 18:16:24 -0700 | [diff] [blame] | 887 | void CARDvUpdateNextTBTT(struct vnt_private *priv, u64 qwTSF, |
| 888 | unsigned short wBeaconInterval) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 889 | { |
Varsha Rao | 26f64a6 | 2016-10-15 16:02:58 +0530 | [diff] [blame] | 890 | void __iomem *iobase = priv->PortOffset; |
Malcolm Priestley | 738487f | 2014-11-12 21:11:09 +0000 | [diff] [blame] | 891 | |
Joe Perches | d4945f0 | 2013-03-18 10:44:40 -0700 | [diff] [blame] | 892 | qwTSF = CARDqGetNextTBTT(qwTSF, wBeaconInterval); |
Veronika Kabatova | 77b6a6a | 2014-10-25 22:34:38 +0200 | [diff] [blame] | 893 | /* Set NextTBTT */ |
Varsha Rao | 26f64a6 | 2016-10-15 16:02:58 +0530 | [diff] [blame] | 894 | VNSvOutPortD(iobase + MAC_REG_NEXTTBTT, (u32)qwTSF); |
| 895 | VNSvOutPortD(iobase + MAC_REG_NEXTTBTT + 4, (u32)(qwTSF >> 32)); |
| 896 | MACvRegBitsOn(iobase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN); |
Joe Perches | 48caf5a | 2014-08-17 09:17:04 -0700 | [diff] [blame] | 897 | pr_debug("Card:Update Next TBTT[%8llx]\n", qwTSF); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 898 | } |