Last active
August 7, 2024 09:57
-
-
Save qosmio/ce616f0b0d3380626880ea60eaf495a1 to your computer and use it in GitHub Desktop.
package/kernel/mac80211/patches/nss/ath11k/999-818-ath11k-bdf-removeregdomain.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/drivers/net/wireless/ath/ath11k/core.c | |
+++ b/drivers/net/wireless/ath/ath11k/core.c | |
@@ -1436,6 +1436,96 @@ int ath11k_core_fetch_board_data_api_1(s | |
return 0; | |
} | |
+static void calcchecksum(void *caldata, int size) | |
+{ | |
+ int i; | |
+ u16 *cdata = (u16 *)caldata; | |
+ u16 *ptr_eeprom = (u16 *)caldata; | |
+ u16 crc = 0; | |
+ cdata[0x5] = 0; | |
+ for (i = 0; i < size; i += 2) { | |
+ crc ^= le16_to_cpu(*ptr_eeprom); | |
+ ptr_eeprom++; | |
+ } | |
+ crc = ~crc; | |
+ cdata[0x5] = cpu_to_le16(crc); | |
+} | |
+ | |
+static void removeregdomain(struct ath11k_base *ab, const void *data, int type) | |
+{ | |
+ u16 *s = (u16 *)data; | |
+ ath11k_info(ab, "remove regdomain0 0x%02x\n", s[52 / 2]); | |
+ s[52 / 2] = 0; | |
+ if (type == 0) { | |
+ ath11k_info(ab, "remove regdomain1 0x%02x\n", s[1104 / 2]); | |
+ s[1104 / 2] = 0; | |
+ } else { | |
+ ath11k_info(ab, "remove regdomain1 0x%02x\n", s[1112 / 2]); | |
+ s[1112 / 2] = 0; | |
+ ath11k_info(ab, "remove regdomain2 0x%02x\n", s[1280 / 2]); | |
+ s[1280 / 2] = 0; | |
+ ath11k_info(ab, "remove regdomain3 0x%02x\n", s[1448 / 2]); | |
+ s[1448 / 2] = 0; | |
+ } | |
+} | |
+ | |
+void show_bdf_version(struct ath11k_base *ab, const void *bd) | |
+{ | |
+ u8 *data = (u8 *)bd; | |
+ u32 offset; | |
+ u8 patch[3]; | |
+ u32 size = 0x10000; | |
+ switch (ab->hw_rev) { | |
+ case ATH11K_HW_IPQ8074: | |
+ patch[0] = 7; | |
+ patch[1] = 2; | |
+ patch[2] = 3; | |
+ offset = 559; | |
+ size = 0x20000; | |
+ removeregdomain(ab, bd, 1); | |
+ break; | |
+ case ATH11K_HW_IPQ6018_HW10: | |
+ patch[0] = 1; | |
+ patch[1] = 4; | |
+ patch[2] = 3; | |
+ offset = 495; | |
+ size = 0x10000; | |
+ removeregdomain(ab, bd, 0); | |
+ break; | |
+ case ATH11K_HW_QCN9074_HW10: | |
+ patch[0] = 4; | |
+ patch[1] = 2; | |
+ patch[2] = 0; | |
+ offset = 555; | |
+ size = 0x20000; | |
+ removeregdomain(ab, bd, 0); | |
+ break; | |
+ case ATH11K_HW_IPQ5018_HW10: | |
+ patch[0] = 3; | |
+ patch[1] = 4; | |
+ patch[2] = 0; | |
+ offset = 0x1eb; | |
+ size = 0x20000; | |
+ removeregdomain(ab, bd, 0); | |
+ break; | |
+ default: | |
+ return; | |
+ } | |
+ | |
+ if (data) { | |
+ { | |
+ ath11k_info( | |
+ ab, | |
+ "bdf template revision v%d.%d.%d, boardrev %d, patch to v%d.%d.%d\n", | |
+ data[offset], data[offset + 1], | |
+ data[offset + 2], data[59], patch[0], patch[1], | |
+ patch[2]); | |
+ memcpy(&data[offset], patch, 3); | |
+ calcchecksum(data, size); | |
+ } | |
+ } | |
+} | |
+ | |
#define BOARD_NAME_SIZE 200 | |
int ath11k_core_fetch_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd) | |
{ | |
@@ -1462,8 +1552,10 @@ int ath11k_core_fetch_bdf(struct ath11k_ | |
ATH11K_BD_IE_BOARD, | |
ATH11K_BD_IE_BOARD_NAME, | |
ATH11K_BD_IE_BOARD_DATA); | |
- if (!ret) | |
+ if (!ret) { | |
+ show_bdf_version(ab, bd->data); | |
goto exit; | |
+ } | |
fallback_boardname = kzalloc(BOARD_NAME_SIZE, GFP_KERNEL); | |
if (!fallback_boardname) { | |
@@ -1482,8 +1574,10 @@ int ath11k_core_fetch_bdf(struct ath11k_ | |
ATH11K_BD_IE_BOARD, | |
ATH11K_BD_IE_BOARD_NAME, | |
ATH11K_BD_IE_BOARD_DATA); | |
- if (!ret) | |
+ if (!ret) { | |
+ show_bdf_version(ab, bd->data); | |
goto exit; | |
+ } | |
chip_id_boardname = kzalloc(BOARD_NAME_SIZE, GFP_KERNEL); | |
if (!chip_id_boardname) { | |
@@ -1503,8 +1597,10 @@ int ath11k_core_fetch_bdf(struct ath11k_ | |
ATH11K_BD_IE_BOARD_NAME, | |
ATH11K_BD_IE_BOARD_DATA); | |
- if (!ret) | |
+ if (!ret) { | |
+ show_bdf_version(ab, bd->data); | |
goto exit; | |
+ } | |
bd_api = 1; | |
ret = ath11k_core_fetch_board_data_api_1(ab, bd, ATH11K_DEFAULT_BOARD_FILE); | |
--- a/drivers/net/wireless/ath/ath11k/core.h | |
+++ b/drivers/net/wireless/ath/ath11k/core.h | |
@@ -1333,6 +1333,7 @@ int ath11k_core_fetch_board_data_api_1(s | |
struct ath11k_board_data *bd, | |
const char *name); | |
void ath11k_core_free_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd); | |
+void show_bdf_version(struct ath11k_base *ab, const void *data); | |
int ath11k_core_check_dt(struct ath11k_base *ath11k); | |
int ath11k_core_check_smbios(struct ath11k_base *ab); | |
void ath11k_core_halt(struct ath11k *ar); | |
--- a/drivers/net/wireless/ath/ath11k/qmi.c | |
+++ b/drivers/net/wireless/ath/ath11k/qmi.c | |
@@ -2483,6 +2483,7 @@ static int ath11k_qmi_load_bdf_qmi(struc | |
success: | |
fw_size = min_t(u32, ab->hw_params.fw.board_size, fw_entry->size); | |
tmp = fw_entry->data; | |
+ show_bdf_version(ab, tmp); | |
} | |
ret = ath11k_qmi_load_file_target_mem(ab, tmp, fw_size, file_type); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment