Skip to content

Commit

Permalink
ath10k-ct: Improve register-override API
Browse files Browse the repository at this point in the history
Take mode into account so 2-modal and 4-modal register settings work
as expected.
  • Loading branch information
greearb committed May 28, 2019
1 parent 75f447e commit 762ed5b
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 35 deletions.
24 changes: 19 additions & 5 deletions ath10k-4.13/core.c
Expand Up @@ -2874,15 +2874,29 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
ath10k_wmi_pdev_set_fwtest(ar, 20,
ar->eeprom_overrides.rc_txbf_probe);

for (i = 0; i<ARRAY_SIZE(ar->eeprom_configAddrs); i += 2) {
for (i = 0; i<ARRAY_SIZE(ar->eeprom_configAddrs); ) {
if (ar->eeprom_configAddrs[i]) {
ath10k_dbg(ar, ATH10K_DBG_BOOT, "Applying eeprom configAddr[%i]: 0x%08x 0x%08x\n",
i, ar->eeprom_configAddrs[i], ar->eeprom_configAddrs[i+1]);
#define CONFIG_ADDR_MODE_SHIFT 20
int mode = (ar->eeprom_configAddrs[i] >> CONFIG_ADDR_MODE_SHIFT) & 0x3;
int count = 1; // one setting applied to both 2G and 5G
int q;

if (mode == 2) // 2G, 5G value tuple
count = 2;
else if (mode == 3) // 2G_VHT20, 2G_VHT40, 5G_VHT20, 5G_VHT40, 5G_VHT80
count = 4;
ath10k_dbg(ar, ATH10K_DBG_BOOT, "Applying eeprom configAddr[%i]: mode: %d count: %d 0x%08x 0x%08x 0x%08x\n",
i, mode, count, ar->eeprom_configAddrs[i], ar->eeprom_configAddrs[i+1],
(count >= 2) ? ar->eeprom_configAddrs[i+2] : 0);

ath10k_wmi_pdev_set_special(ar, SET_SPECIAL_ID_EEPROM_CFG_ADDR_A,
ar->eeprom_configAddrs[i]);
ath10k_wmi_pdev_set_special(ar, SET_SPECIAL_ID_EEPROM_CFG_ADDR_V,
ar->eeprom_configAddrs[i+1]);
for (q = 0; q<count; q++) {
ath10k_wmi_pdev_set_special(ar, SET_SPECIAL_ID_EEPROM_CFG_ADDR_V,
ar->eeprom_configAddrs[i + q + 1]);
}

i += (count + 1);
}
else {
break;
Expand Down
9 changes: 7 additions & 2 deletions ath10k-4.13/wmi.h
Expand Up @@ -6839,8 +6839,13 @@ struct wmi_pdev_set_special_cmd {
* (see 'peers' debugfs for peer id listing)
* val = peer_id << 16 | ant-mask-value
*/
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_A 0x14 /* Append an address to the configAddr in the eeprom. */
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_V 0x15 /* Append an value to the configAddr in the eeprom. */
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_A 0x14 /* Append an address to the configAddr in the eeprom.
* The mode should normally be OR'd in to the address.
*/
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_V 0x15 /* Append an value to the configAddr in the eeprom. Multiple values may
* be appended if the mode supports it.
*/
#define SET_SPECIAL_ID_PEER_STATS_PN 0x16 /* Report PN in peer-stats object */

/* Requires specially compiled firmware (-T option) to have any useful effect. */
#define SET_SPECIAL_ID_TX_DBG 0x99 /* 0x1 == enable, 0x2 == pkt-dbg, 0x0 == disable (default). */
Expand Down
24 changes: 19 additions & 5 deletions ath10k-4.16/core.c
Expand Up @@ -3053,15 +3053,29 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
ath10k_wmi_pdev_set_fwtest(ar, 20,
ar->eeprom_overrides.rc_txbf_probe);

for (i = 0; i<ARRAY_SIZE(ar->eeprom_configAddrs); i += 2) {
for (i = 0; i<ARRAY_SIZE(ar->eeprom_configAddrs); ) {
if (ar->eeprom_configAddrs[i]) {
ath10k_dbg(ar, ATH10K_DBG_BOOT, "Applying eeprom configAddr[%i]: 0x%08x 0x%08x\n",
i, ar->eeprom_configAddrs[i], ar->eeprom_configAddrs[i+1]);
#define CONFIG_ADDR_MODE_SHIFT 20
int mode = (ar->eeprom_configAddrs[i] >> CONFIG_ADDR_MODE_SHIFT) & 0x3;
int count = 1; // one setting applied to both 2G and 5G
int q;

if (mode == 2) // 2G, 5G value tuple
count = 2;
else if (mode == 3) // 2G_VHT20, 2G_VHT40, 5G_VHT20, 5G_VHT40, 5G_VHT80
count = 4;
ath10k_dbg(ar, ATH10K_DBG_BOOT, "Applying eeprom configAddr[%i]: mode: %d count: %d 0x%08x 0x%08x 0x%08x\n",
i, mode, count, ar->eeprom_configAddrs[i], ar->eeprom_configAddrs[i+1],
(count >= 2) ? ar->eeprom_configAddrs[i+2] : 0);

ath10k_wmi_pdev_set_special(ar, SET_SPECIAL_ID_EEPROM_CFG_ADDR_A,
ar->eeprom_configAddrs[i]);
ath10k_wmi_pdev_set_special(ar, SET_SPECIAL_ID_EEPROM_CFG_ADDR_V,
ar->eeprom_configAddrs[i+1]);
for (q = 0; q<count; q++) {
ath10k_wmi_pdev_set_special(ar, SET_SPECIAL_ID_EEPROM_CFG_ADDR_V,
ar->eeprom_configAddrs[i + q + 1]);
}

i += (count + 1);
}
else {
break;
Expand Down
8 changes: 6 additions & 2 deletions ath10k-4.16/wmi.h
Expand Up @@ -7049,8 +7049,12 @@ struct wmi_pdev_set_special_cmd {
* (see 'peers' debugfs for peer id listing)
* val = peer_id << 16 | ant-mask-value
*/
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_A 0x14 /* Append an address to the configAddr in the eeprom. */
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_V 0x15 /* Append an value to the configAddr in the eeprom. */
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_A 0x14 /* Append an address to the configAddr in the eeprom.
* The mode should normally be OR'd in to the address.
*/
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_V 0x15 /* Append an value to the configAddr in the eeprom. Multiple values may
* be appended if the mode supports it.
*/
#define SET_SPECIAL_ID_PEER_STATS_PN 0x16 /* Report PN in peer-stats object */

/* Requires specially compiled firmware (-T option) to have any useful effect. */
Expand Down
24 changes: 19 additions & 5 deletions ath10k-4.19/core.c
Expand Up @@ -3128,15 +3128,29 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
ath10k_wmi_pdev_set_fwtest(ar, 20,
ar->eeprom_overrides.rc_txbf_probe);

for (i = 0; i<ARRAY_SIZE(ar->eeprom_configAddrs); i += 2) {
for (i = 0; i<ARRAY_SIZE(ar->eeprom_configAddrs); ) {
if (ar->eeprom_configAddrs[i]) {
ath10k_dbg(ar, ATH10K_DBG_BOOT, "Applying eeprom configAddr[%i]: 0x%08x 0x%08x\n",
i, ar->eeprom_configAddrs[i], ar->eeprom_configAddrs[i+1]);
#define CONFIG_ADDR_MODE_SHIFT 20
int mode = (ar->eeprom_configAddrs[i] >> CONFIG_ADDR_MODE_SHIFT) & 0x3;
int count = 1; // one setting applied to both 2G and 5G
int q;

if (mode == 2) // 2G, 5G value tuple
count = 2;
else if (mode == 3) // 2G_VHT20, 2G_VHT40, 5G_VHT20, 5G_VHT40, 5G_VHT80
count = 4;
ath10k_dbg(ar, ATH10K_DBG_BOOT, "Applying eeprom configAddr[%i]: mode: %d count: %d 0x%08x 0x%08x 0x%08x\n",
i, mode, count, ar->eeprom_configAddrs[i], ar->eeprom_configAddrs[i+1],
(count >= 2) ? ar->eeprom_configAddrs[i+2] : 0);

ath10k_wmi_pdev_set_special(ar, SET_SPECIAL_ID_EEPROM_CFG_ADDR_A,
ar->eeprom_configAddrs[i]);
ath10k_wmi_pdev_set_special(ar, SET_SPECIAL_ID_EEPROM_CFG_ADDR_V,
ar->eeprom_configAddrs[i+1]);
for (q = 0; q<count; q++) {
ath10k_wmi_pdev_set_special(ar, SET_SPECIAL_ID_EEPROM_CFG_ADDR_V,
ar->eeprom_configAddrs[i + q + 1]);
}

i += (count + 1);
}
else {
break;
Expand Down
8 changes: 6 additions & 2 deletions ath10k-4.19/wmi.h
Expand Up @@ -7199,8 +7199,12 @@ struct wmi_pdev_set_special_cmd {
* (see 'peers' debugfs for peer id listing)
* val = peer_id << 16 | ant-mask-value
*/
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_A 0x14 /* Append an address to the configAddr in the eeprom. */
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_V 0x15 /* Append an value to the configAddr in the eeprom. */
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_A 0x14 /* Append an address to the configAddr in the eeprom.
* The mode should normally be OR'd in to the address.
*/
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_V 0x15 /* Append an value to the configAddr in the eeprom. Multiple values may
* be appended if the mode supports it.
*/
#define SET_SPECIAL_ID_PEER_STATS_PN 0x16 /* Report PN in peer-stats object */

/* Requires specially compiled firmware (-T option) to have any useful effect. */
Expand Down
24 changes: 19 additions & 5 deletions ath10k-4.20/core.c
Expand Up @@ -3388,15 +3388,29 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
ath10k_wmi_pdev_set_fwtest(ar, 20,
ar->eeprom_overrides.rc_txbf_probe);

for (i = 0; i<ARRAY_SIZE(ar->eeprom_configAddrs); i += 2) {
for (i = 0; i<ARRAY_SIZE(ar->eeprom_configAddrs); ) {
if (ar->eeprom_configAddrs[i]) {
ath10k_dbg(ar, ATH10K_DBG_BOOT, "Applying eeprom configAddr[%i]: 0x%08x 0x%08x\n",
i, ar->eeprom_configAddrs[i], ar->eeprom_configAddrs[i+1]);
#define CONFIG_ADDR_MODE_SHIFT 20
int mode = (ar->eeprom_configAddrs[i] >> CONFIG_ADDR_MODE_SHIFT) & 0x3;
int count = 1; // one setting applied to both 2G and 5G
int q;

if (mode == 2) // 2G, 5G value tuple
count = 2;
else if (mode == 3) // 2G_VHT20, 2G_VHT40, 5G_VHT20, 5G_VHT40, 5G_VHT80
count = 4;
ath10k_dbg(ar, ATH10K_DBG_BOOT, "Applying eeprom configAddr[%i]: mode: %d count: %d 0x%08x 0x%08x 0x%08x\n",
i, mode, count, ar->eeprom_configAddrs[i], ar->eeprom_configAddrs[i+1],
(count >= 2) ? ar->eeprom_configAddrs[i+2] : 0);

ath10k_wmi_pdev_set_special(ar, SET_SPECIAL_ID_EEPROM_CFG_ADDR_A,
ar->eeprom_configAddrs[i]);
ath10k_wmi_pdev_set_special(ar, SET_SPECIAL_ID_EEPROM_CFG_ADDR_V,
ar->eeprom_configAddrs[i+1]);
for (q = 0; q<count; q++) {
ath10k_wmi_pdev_set_special(ar, SET_SPECIAL_ID_EEPROM_CFG_ADDR_V,
ar->eeprom_configAddrs[i + q + 1]);
}

i += (count + 1);
}
else {
break;
Expand Down
8 changes: 6 additions & 2 deletions ath10k-4.20/wmi.h
Expand Up @@ -7239,8 +7239,12 @@ struct wmi_pdev_set_special_cmd {
* (see 'peers' debugfs for peer id listing)
* val = peer_id << 16 | ant-mask-value
*/
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_A 0x14 /* Append an address to the configAddr in the eeprom. */
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_V 0x15 /* Append an value to the configAddr in the eeprom. */
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_A 0x14 /* Append an address to the configAddr in the eeprom.
* The mode should normally be OR'd in to the address.
*/
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_V 0x15 /* Append an value to the configAddr in the eeprom. Multiple values may
* be appended if the mode supports it.
*/
#define SET_SPECIAL_ID_PEER_STATS_PN 0x16 /* Report PN in peer-stats object */

/* Requires specially compiled firmware (-T option) to have any useful effect. */
Expand Down
24 changes: 19 additions & 5 deletions ath10k-4.9/core.c
Expand Up @@ -2737,15 +2737,29 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
ath10k_wmi_pdev_set_fwtest(ar, 20,
ar->eeprom_overrides.rc_txbf_probe);

for (i = 0; i<ARRAY_SIZE(ar->eeprom_configAddrs); i += 2) {
for (i = 0; i<ARRAY_SIZE(ar->eeprom_configAddrs); ) {
if (ar->eeprom_configAddrs[i]) {
ath10k_dbg(ar, ATH10K_DBG_BOOT, "Applying eeprom configAddr[%i]: 0x%08x 0x%08x\n",
i, ar->eeprom_configAddrs[i], ar->eeprom_configAddrs[i+1]);
#define CONFIG_ADDR_MODE_SHIFT 20
int mode = (ar->eeprom_configAddrs[i] >> CONFIG_ADDR_MODE_SHIFT) & 0x3;
int count = 1; // one setting applied to both 2G and 5G
int q;

if (mode == 2) // 2G, 5G value tuple
count = 2;
else if (mode == 3) // 2G_VHT20, 2G_VHT40, 5G_VHT20, 5G_VHT40, 5G_VHT80
count = 4;
ath10k_dbg(ar, ATH10K_DBG_BOOT, "Applying eeprom configAddr[%i]: mode: %d count: %d 0x%08x 0x%08x 0x%08x\n",
i, mode, count, ar->eeprom_configAddrs[i], ar->eeprom_configAddrs[i+1],
(count >= 2) ? ar->eeprom_configAddrs[i+2] : 0);

ath10k_wmi_pdev_set_special(ar, SET_SPECIAL_ID_EEPROM_CFG_ADDR_A,
ar->eeprom_configAddrs[i]);
ath10k_wmi_pdev_set_special(ar, SET_SPECIAL_ID_EEPROM_CFG_ADDR_V,
ar->eeprom_configAddrs[i+1]);
for (q = 0; q<count; q++) {
ath10k_wmi_pdev_set_special(ar, SET_SPECIAL_ID_EEPROM_CFG_ADDR_V,
ar->eeprom_configAddrs[i + q + 1]);
}

i += (count + 1);
}
else {
break;
Expand Down
9 changes: 7 additions & 2 deletions ath10k-4.9/wmi.h
Expand Up @@ -6792,8 +6792,13 @@ struct wmi_pdev_set_special_cmd {
* (see 'peers' debugfs for peer id listing)
* val = peer_id << 16 | ant-mask-value
*/
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_A 0x14 /* Append an address to the configAddr in the eeprom. */
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_V 0x15 /* Append an value to the configAddr in the eeprom. */
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_A 0x14 /* Append an address to the configAddr in the eeprom.
* The mode should normally be OR'd in to the address.
*/
#define SET_SPECIAL_ID_EEPROM_CFG_ADDR_V 0x15 /* Append an value to the configAddr in the eeprom. Multiple values may
* be appended if the mode supports it.
*/
#define SET_SPECIAL_ID_PEER_STATS_PN 0x16 /* Report PN in peer-stats object */

/* Requires specially compiled firmware (-T option) to have any useful effect. */
#define SET_SPECIAL_ID_TX_DBG 0x99 /* 0x1 == enable, 0x2 == pkt-dbg, 0x0 == disable (default). */
Expand Down

0 comments on commit 762ed5b

Please sign in to comment.