Commit 639d0b89 authored by Kalle Valo's avatar Kalle Valo

ath6kl: read firmware start address from hardware

It's actually possible to read the firmware start address from hardware,
that way there's no need to hardcode the address in hardware.

Thanks to Chilam Ng for the idea.
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 991b27ea
...@@ -1146,9 +1146,21 @@ static int ath6kl_upload_otp(struct ath6kl *ar) ...@@ -1146,9 +1146,21 @@ static int ath6kl_upload_otp(struct ath6kl *ar)
return ret; return ret;
} }
/* read firmware start address */
ret = ath6kl_bmi_read(ar,
ath6kl_get_hi_item_addr(ar,
HI_ITEM(hi_app_start)),
(u8 *) &address, sizeof(address));
if (ret) {
ath6kl_err("Failed to read hi_app_start: %d\n", ret);
return ret;
}
ar->hw.app_start_override_addr = address;
/* execute the OTP code */ /* execute the OTP code */
param = 0; param = 0;
address = ar->hw.app_start_override_addr;
ath6kl_bmi_execute(ar, address, &param); ath6kl_bmi_execute(ar, address, &param);
return ret; return ret;
...@@ -1343,21 +1355,18 @@ static int ath6kl_init_hw_params(struct ath6kl *ar) ...@@ -1343,21 +1355,18 @@ static int ath6kl_init_hw_params(struct ath6kl *ar)
case AR6003_REV2_VERSION: case AR6003_REV2_VERSION:
ar->hw.dataset_patch_addr = AR6003_REV2_DATASET_PATCH_ADDRESS; ar->hw.dataset_patch_addr = AR6003_REV2_DATASET_PATCH_ADDRESS;
ar->hw.app_load_addr = AR6003_REV2_APP_LOAD_ADDRESS; ar->hw.app_load_addr = AR6003_REV2_APP_LOAD_ADDRESS;
ar->hw.app_start_override_addr = AR6003_REV2_APP_START_OVERRIDE;
ar->hw.board_ext_data_addr = AR6003_REV2_BOARD_EXT_DATA_ADDRESS; ar->hw.board_ext_data_addr = AR6003_REV2_BOARD_EXT_DATA_ADDRESS;
ar->hw.reserved_ram_size = AR6003_REV2_RAM_RESERVE_SIZE; ar->hw.reserved_ram_size = AR6003_REV2_RAM_RESERVE_SIZE;
break; break;
case AR6003_REV3_VERSION: case AR6003_REV3_VERSION:
ar->hw.dataset_patch_addr = AR6003_REV3_DATASET_PATCH_ADDRESS; ar->hw.dataset_patch_addr = AR6003_REV3_DATASET_PATCH_ADDRESS;
ar->hw.app_load_addr = 0x1234; ar->hw.app_load_addr = 0x1234;
ar->hw.app_start_override_addr = AR6003_REV3_APP_START_OVERRIDE;
ar->hw.board_ext_data_addr = AR6003_REV3_BOARD_EXT_DATA_ADDRESS; ar->hw.board_ext_data_addr = AR6003_REV3_BOARD_EXT_DATA_ADDRESS;
ar->hw.reserved_ram_size = AR6003_REV3_RAM_RESERVE_SIZE; ar->hw.reserved_ram_size = AR6003_REV3_RAM_RESERVE_SIZE;
break; break;
case AR6004_REV1_VERSION: case AR6004_REV1_VERSION:
ar->hw.dataset_patch_addr = AR6003_REV2_DATASET_PATCH_ADDRESS; ar->hw.dataset_patch_addr = AR6003_REV2_DATASET_PATCH_ADDRESS;
ar->hw.app_load_addr = AR6003_REV3_APP_LOAD_ADDRESS; ar->hw.app_load_addr = AR6003_REV3_APP_LOAD_ADDRESS;
ar->hw.app_start_override_addr = AR6003_REV3_APP_START_OVERRIDE;
ar->hw.board_ext_data_addr = AR6004_REV1_BOARD_EXT_DATA_ADDRESS; ar->hw.board_ext_data_addr = AR6004_REV1_BOARD_EXT_DATA_ADDRESS;
ar->hw.reserved_ram_size = AR6004_REV1_RAM_RESERVE_SIZE; ar->hw.reserved_ram_size = AR6004_REV1_RAM_RESERVE_SIZE;
break; break;
......
...@@ -331,13 +331,11 @@ struct host_interest { ...@@ -331,13 +331,11 @@ struct host_interest {
(((target_type) == TARGET_TYPE_AR6003) ? AR6003_VTOP(vaddr) : \ (((target_type) == TARGET_TYPE_AR6003) ? AR6003_VTOP(vaddr) : \
(((target_type) == TARGET_TYPE_AR6004) ? AR6004_VTOP(vaddr) : 0)) (((target_type) == TARGET_TYPE_AR6004) ? AR6004_VTOP(vaddr) : 0))
#define AR6003_REV2_APP_START_OVERRIDE 0x944C00
#define AR6003_REV2_APP_LOAD_ADDRESS 0x543180 #define AR6003_REV2_APP_LOAD_ADDRESS 0x543180
#define AR6003_REV2_BOARD_EXT_DATA_ADDRESS 0x57E500 #define AR6003_REV2_BOARD_EXT_DATA_ADDRESS 0x57E500
#define AR6003_REV2_DATASET_PATCH_ADDRESS 0x57e884 #define AR6003_REV2_DATASET_PATCH_ADDRESS 0x57e884
#define AR6003_REV2_RAM_RESERVE_SIZE 6912 #define AR6003_REV2_RAM_RESERVE_SIZE 6912
#define AR6003_REV3_APP_START_OVERRIDE 0x945d00
#define AR6003_REV3_APP_LOAD_ADDRESS 0x545000 #define AR6003_REV3_APP_LOAD_ADDRESS 0x545000
#define AR6003_REV3_BOARD_EXT_DATA_ADDRESS 0x542330 #define AR6003_REV3_BOARD_EXT_DATA_ADDRESS 0x542330
#define AR6003_REV3_DATASET_PATCH_ADDRESS 0x57FF74 #define AR6003_REV3_DATASET_PATCH_ADDRESS 0x57FF74
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment