* [PATCH] ath6kl:Fix execution address of OTP AR6003 HW2.0
@ 2011-10-05 14:14 Sangwook Lee
2011-10-06 10:48 ` Kalle Valo
0 siblings, 1 reply; 3+ messages in thread
From: Sangwook Lee @ 2011-10-05 14:14 UTC (permalink / raw)
To: kvalo; +Cc: linux-wireless, patches, Sangwook Lee
Fix OTP execution address for AR6003 HW2.0
ath6kl: writing otp to 0x543180 (3689 B)
ath6kl: bmi LZ stream start: addr: 0x543180)
ath6kl: bmi send LZ data: len: 3688)
ath6kl: bmi send LZ data: len: 4)
ath6kl: bmi LZ stream start: addr: 0x0)
ath6kl: bmi read memory: device: addr: 0x54061c, len: 4
ath6kl: app_start_override_addr 0x0
ath6kl: executing OTP at 0x0
ath6kl: bmi execute: addr: 0x0, param: 0)
ath6kl: bmi_recv_buf FIFO empty
ath6kl: Unable to read from the device: -22
Signed-off-by: Sangwook Lee <sangwook.lee@linaro.org>
---
drivers/net/wireless/ath/ath6kl/init.c | 3 +++
drivers/net/wireless/ath/ath6kl/target.h | 1 +
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index b277111..bfe802b 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -1211,6 +1211,9 @@ static int ath6kl_upload_otp(struct ath6kl *ar)
return ret;
}
+ if (ar->version.target_ver == AR6003_REV2_VERSION)
+ address = AR6003_REV2_APP_START_OVERRIDE;
+
ar->hw.app_start_override_addr = address;
ath6kl_dbg(ATH6KL_DBG_BOOT, "app_start_override_addr 0x%x\n",
diff --git a/drivers/net/wireless/ath/ath6kl/target.h b/drivers/net/wireless/ath/ath6kl/target.h
index c9a7605..253c489 100644
--- a/drivers/net/wireless/ath/ath6kl/target.h
+++ b/drivers/net/wireless/ath/ath6kl/target.h
@@ -331,6 +331,7 @@ struct host_interest {
(((target_type) == TARGET_TYPE_AR6003) ? AR6003_VTOP(vaddr) : \
(((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_BOARD_EXT_DATA_ADDRESS 0x57E500
#define AR6003_REV2_DATASET_PATCH_ADDRESS 0x57e884
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ath6kl:Fix execution address of OTP AR6003 HW2.0
2011-10-05 14:14 [PATCH] ath6kl:Fix execution address of OTP AR6003 HW2.0 Sangwook Lee
@ 2011-10-06 10:48 ` Kalle Valo
2011-10-06 11:03 ` Sangwook Lee
0 siblings, 1 reply; 3+ messages in thread
From: Kalle Valo @ 2011-10-06 10:48 UTC (permalink / raw)
To: Sangwook Lee; +Cc: linux-wireless, patches
[-- Attachment #1: Type: text/plain, Size: 1257 bytes --]
On 10/05/2011 05:14 PM, Sangwook Lee wrote:
> Fix OTP execution address for AR6003 HW2.0
>
> ath6kl: writing otp to 0x543180 (3689 B)
> ath6kl: bmi LZ stream start: addr: 0x543180)
> ath6kl: bmi send LZ data: len: 3688)
> ath6kl: bmi send LZ data: len: 4)
> ath6kl: bmi LZ stream start: addr: 0x0)
> ath6kl: bmi read memory: device: addr: 0x54061c, len: 4
> ath6kl: app_start_override_addr 0x0
> ath6kl: executing OTP at 0x0
> ath6kl: bmi execute: addr: 0x0, param: 0)
> ath6kl: bmi_recv_buf FIFO empty
> ath6kl: Unable to read from the device: -22
Ah, now I understand. So this patch broke it:
commit 639d0b8996aa5913402b846932d57a51a23a40c9
Author: Kalle Valo <kvalo@qca.qualcomm.com>
Date: Mon Sep 12 12:48:09 2011 +0300
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.
So the firmware start address detections doesn't actually work with hw
2.0, too bad.
Actually I would like to fix this a bit differently, can you please try
the attached patch? Compile tested only. If it works, please send me a
Tested-by tag.
BTW, do you still need to enable debug logs to get hw2.0 working properly?
Kalle
[-- Attachment #2: 0001-ath6kl-fix-firmware-start-address-for-ar6003-hw2.0.patch --]
[-- Type: text/x-patch, Size: 2891 bytes --]
>From e982bc13435b3f5dca76c77d472dcd2cfcba2b66 Mon Sep 17 00:00:00 2001
From: Kalle Valo <kvalo@qca.qualcomm.com>
Date: Thu, 6 Oct 2011 13:26:58 +0300
Subject: [PATCH] ath6kl: fix firmware start address for ar6003 hw2.0
Sangwook found out that commit 639d0b89 ("ath6kl: read firmware start
address from hardware") broke firmware boot on ar6003 hw2.0 as it seems
it's not posible to automatically query the address from hardware. So
we need to hardcode the address for hw2.0.
Reported-by: Sangwook Lee <sangwook.lee@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath6kl/init.c | 34 ++++++++++++++++++++-----------
1 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 8466f3d..d52c925 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -1182,6 +1182,7 @@ static int ath6kl_upload_board_file(struct ath6kl *ar)
static int ath6kl_upload_otp(struct ath6kl *ar)
{
u32 address, param;
+ bool from_hw = false;
int ret;
if (WARN_ON(ar->fw_otp == NULL))
@@ -1199,24 +1200,29 @@ static int ath6kl_upload_otp(struct ath6kl *ar)
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 (ar->hw.app_start_override_addr == 0) {
+ /* 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;
- }
+ if (ret) {
+ ath6kl_err("Failed to read hi_app_start: %d\n", ret);
+ return ret;
+ }
- ar->hw.app_start_override_addr = address;
+ ar->hw.app_start_override_addr = address;
+ from_hw = true;
+ }
- ath6kl_dbg(ATH6KL_DBG_BOOT, "app_start_override_addr 0x%x\n",
+ ath6kl_dbg(ATH6KL_DBG_BOOT, "app_start_override_addr%s 0x%x\n",
+ from_hw ? " (from hw)" : "",
ar->hw.app_start_override_addr);
/* execute the OTP code */
- ath6kl_dbg(ATH6KL_DBG_BOOT, "executing OTP at 0x%x\n", address);
+ ath6kl_dbg(ATH6KL_DBG_BOOT, "executing OTP at 0x%x\n",
+ ar->hw.app_start_override_addr);
param = 0;
ath6kl_bmi_execute(ar, address, ¶m);
@@ -1420,6 +1426,10 @@ static int ath6kl_init_hw_params(struct ath6kl *ar)
ar->hw.app_load_addr = AR6003_REV2_APP_LOAD_ADDRESS;
ar->hw.board_ext_data_addr = AR6003_REV2_BOARD_EXT_DATA_ADDRESS;
ar->hw.reserved_ram_size = AR6003_REV2_RAM_RESERVE_SIZE;
+
+ /* hw2.0 needs override address hardcoded */
+ ar->hw.app_start_override_addr = 0x944C00;
+
break;
case AR6003_REV3_VERSION:
ar->hw.dataset_patch_addr = AR6003_REV3_DATASET_PATCH_ADDRESS;
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ath6kl:Fix execution address of OTP AR6003 HW2.0
2011-10-06 10:48 ` Kalle Valo
@ 2011-10-06 11:03 ` Sangwook Lee
0 siblings, 0 replies; 3+ messages in thread
From: Sangwook Lee @ 2011-10-06 11:03 UTC (permalink / raw)
To: Kalle Valo; +Cc: linux-wireless, patches
Hi Kalle
On 6 October 2011 11:48, Kalle Valo <kvalo@qca.qualcomm.com> wrote:
> On 10/05/2011 05:14 PM, Sangwook Lee wrote:
>> Fix OTP execution address for AR6003 HW2.0
>>
>> ath6kl: writing otp to 0x543180 (3689 B)
>> ath6kl: bmi LZ stream start: addr: 0x543180)
>> ath6kl: bmi send LZ data: len: 3688)
>> ath6kl: bmi send LZ data: len: 4)
>> ath6kl: bmi LZ stream start: addr: 0x0)
>> ath6kl: bmi read memory: device: addr: 0x54061c, len: 4
>> ath6kl: app_start_override_addr 0x0
>> ath6kl: executing OTP at 0x0
>> ath6kl: bmi execute: addr: 0x0, param: 0)
>> ath6kl: bmi_recv_buf FIFO empty
>> ath6kl: Unable to read from the device: -22
>
> Ah, now I understand. So this patch broke it:
>
> commit 639d0b8996aa5913402b846932d57a51a23a40c9
> Author: Kalle Valo <kvalo@qca.qualcomm.com>
> Date: Mon Sep 12 12:48:09 2011 +0300
>
> 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.
>
>
> So the firmware start address detections doesn't actually work with hw
> 2.0, too bad.
>
> Actually I would like to fix this a bit differently, can you please try
> the attached patch? Compile tested only. If it works, please send me a
> Tested-by tag.
Yes I will do it.
>
> BTW, do you still need to enable debug logs to get hw2.0 working properly?
Yes, I still have to use debug but want to fix it now, so please let me debug
as based on your last advice and then report to you.
>
> Kalle
>
Sangwook
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-06 11:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-05 14:14 [PATCH] ath6kl:Fix execution address of OTP AR6003 HW2.0 Sangwook Lee
2011-10-06 10:48 ` Kalle Valo
2011-10-06 11:03 ` Sangwook Lee
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.