From patchwork Thu Oct 6 10:48:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 4547 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 580A323DEE for ; Thu, 6 Oct 2011 10:50:36 +0000 (UTC) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 37B6CA18CF3 for ; Thu, 6 Oct 2011 10:50:36 +0000 (UTC) Received: by bke5 with SMTP id 5so4264139bke.11 for ; Thu, 06 Oct 2011 03:50:36 -0700 (PDT) Received: by 10.223.61.146 with SMTP id t18mr2827901fah.34.1317898235488; Thu, 06 Oct 2011 03:50:35 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.23.170 with SMTP id n10cs123981laf; Thu, 6 Oct 2011 03:50:34 -0700 (PDT) Received: by 10.68.34.226 with SMTP id c2mr4696283pbj.99.1317898232206; Thu, 06 Oct 2011 03:50:32 -0700 (PDT) Received: from wolverine01.qualcomm.com (wolverine01.qualcomm.com. [199.106.114.254]) by mx.google.com with ESMTPS id m2si5855781pbd.100.2011.10.06.03.50.31 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 06 Oct 2011 03:50:32 -0700 (PDT) Received-SPF: pass (google.com: domain of kvalo@qca.qualcomm.com designates 199.106.114.254 as permitted sender) client-ip=199.106.114.254; Authentication-Results: mx.google.com; spf=pass (google.com: domain of kvalo@qca.qualcomm.com designates 199.106.114.254 as permitted sender) smtp.mail=kvalo@qca.qualcomm.com; dkim=pass header.i=kvalo@qca.qualcomm.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=kvalo@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1317898231; x=1349434231; h=message-id:date:from:mime-version:to:cc:subject: references:in-reply-to; z=Message-ID:=20<4E8D8766.1030809@qca.qualcomm.com>|Date: =20Thu,=206=20Oct=202011=2013:48:06=20+0300|From:=20Kalle =20Valo=20|MIME-Version:=201.0 |To:=20Sangwook=20Lee=20|CC:=20< linux-wireless@vger.kernel.org>,=20 |Subject:=20Re:=20[PATCH]=20ath6kl:Fix=20execution=20addr ess=20of=20OTP=20AR6003=20HW2.0|References:=20<1317824077 -13476-1-git-send-email-sangwook.lee@linaro.org> |In-Reply-To:=20<1317824077-13476-1-git-send-email-sangwo ok.lee@linaro.org>; bh=nWdp0nbxEUAUU3VhUuMXsWApYl8y7XSCZ6JuH0Rpi4s=; b=GuW68vsFAbQ50hFOxGIQC3AIH+Wi4Z6JpDzxUZlA2ZiuB1gwwEwMWq1l wRXy/fiwu57A4rZLjuuXiIubNZZwlvAvBv3LkUNbYYv2rYd9t4AlM82FZ +rYMSVMWIaFHDSuxYAW145wX2rAwOPZsT4JUwWuxd1GWnkpEUGK6iWUNM M=; X-IronPort-AV: E=McAfee;i="5400,1158,6490"; a="125234331" Received: from ironmsg02-r.qualcomm.com ([172.30.46.16]) by wolverine01.qualcomm.com with ESMTP; 06 Oct 2011 03:50:15 -0700 X-IronPort-AV: E=Sophos;i="4.68,495,1312182000"; d="scan'208,223";a="155939588" Received: from nasanexhc05.na.qualcomm.com ([172.30.48.2]) by ironmsg02-R.qualcomm.com with ESMTP/TLS/AES128-SHA; 06 Oct 2011 03:50:15 -0700 Received: from NASJOEXHC01.na.qualcomm.com (172.30.48.1) by nasanexhc05.na.qualcomm.com (172.30.48.2) with Microsoft SMTP Server (TLS) id 14.1.339.1; Thu, 6 Oct 2011 03:48:13 -0700 Received: from [10.64.131.240] (10.64.131.240) by qcamail1.atheros.com (10.234.56.15) with Microsoft SMTP Server (TLS) id 14.1.339.1; Thu, 6 Oct 2011 03:48:12 -0700 Message-ID: <4E8D8766.1030809@qca.qualcomm.com> Date: Thu, 6 Oct 2011 13:48:06 +0300 From: Kalle Valo User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110922 Thunderbird/3.1.15 MIME-Version: 1.0 To: Sangwook Lee CC: , Subject: Re: [PATCH] ath6kl:Fix execution address of OTP AR6003 HW2.0 References: <1317824077-13476-1-git-send-email-sangwook.lee@linaro.org> In-Reply-To: <1317824077-13476-1-git-send-email-sangwook.lee@linaro.org> X-Originating-IP: [10.64.131.240] 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 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 >From e982bc13435b3f5dca76c77d472dcd2cfcba2b66 Mon Sep 17 00:00:00 2001 From: Kalle Valo 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 Signed-off-by: Kalle Valo --- 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