From patchwork Sat Jun 4 13:26:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 9154699 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AEC5860751 for ; Sat, 4 Jun 2016 13:26:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 886D92824A for ; Sat, 4 Jun 2016 13:26:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B50A28331; Sat, 4 Jun 2016 13:26:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7B912824A for ; Sat, 4 Jun 2016 13:26:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750911AbcFDN0r (ORCPT ); Sat, 4 Jun 2016 09:26:47 -0400 Received: from wolverine02.qualcomm.com ([199.106.114.251]:42185 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750874AbcFDN0p convert rfc822-to-8bit (ORCPT ); Sat, 4 Jun 2016 09:26:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1465046805; x=1496582805; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=UDT+IvkhJaoftrMHPwyHDux/uBIoq76Fr/PUMOHcyDE=; b=sjkwzGuTNv8Cnj0jlGBObBsuOe8N8eq9OjPZp1nysuQUGl6UIWa3u5Im svEt3yV4+MBJQG1urrRg2zW2oQZRUFri9CEH8pnbr4viLq8mMkjdjWIDn TDRBehjfHnwOQegrup3OoF6uqA7p20Z2IzpmeGaO5y7AjQJlOmq1v3KJG I=; X-IronPort-AV: E=Sophos;i="5.26,417,1459839600"; d="scan'208";a="293355892" Received: from ironmsg04-r-new.qualcomm.com (HELO Ironmsg04-R.qualcomm.com) ([10.53.140.108]) by wolverine02.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Jun 2016 06:26:45 -0700 X-IronPort-AV: E=McAfee;i="5700,7163,8185"; a="1209522145" Received: from nasanexm02b.na.qualcomm.com ([10.85.0.42]) by Ironmsg04-R.qualcomm.com with ESMTP/TLS/RC4-SHA; 04 Jun 2016 06:26:44 -0700 Received: from euamsexm01b.eu.qualcomm.com (10.251.127.41) by nasanexm02b.na.qualcomm.com (10.85.0.42) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Sat, 4 Jun 2016 06:26:43 -0700 Received: from euamsexm01a.eu.qualcomm.com (10.251.127.40) by euamsexm01b.eu.qualcomm.com (10.251.127.41) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Sat, 4 Jun 2016 15:26:40 +0200 Received: from euamsexm01a.eu.qualcomm.com ([10.251.127.40]) by euamsexm01a.eu.qualcomm.com ([10.251.127.40]) with mapi id 15.00.1178.000; Sat, 4 Jun 2016 15:26:40 +0200 From: "Valo, Kalle" To: Sven Eckelmann CC: "ath10k@lists.infradead.org" , "linux-wireless@vger.kernel.org" Subject: Re: [PATCH 2/2] ath10k: Add board data download from target Thread-Topic: [PATCH 2/2] ath10k: Add board data download from target Thread-Index: AQHRvmS6gp+OAbBjIkCXA7DPf3JjSQ== Date: Sat, 4 Jun 2016 13:26:39 +0000 Message-ID: <87porxt78w.fsf@kamboji.qca.qualcomm.com> References: <1568876.Six5hABE57@bentobox> <1463755272-12912-2-git-send-email-sven.eckelmann@open-mesh.com> In-Reply-To: <1463755272-12912-2-git-send-email-sven.eckelmann@open-mesh.com> (Sven Eckelmann's message of "Fri, 20 May 2016 16:41:12 +0200") Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.251.52.12] Content-ID: MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Sven Eckelmann writes: > The QCA9887 stores its calibration data (board.bin) inside the EEPROM of > the target. This has to be downloaded manually to allow the device to > initialize correctly. > > Signed-off-by: Sven Eckelmann [...] > --- a/drivers/net/wireless/ath/ath10k/core.c > +++ b/drivers/net/wireless/ath/ath10k/core.c > @@ -18,6 +18,7 @@ > #include > #include > #include > +#include > > #include "core.h" > #include "mac.h" > @@ -550,6 +551,34 @@ out: > return ret; > } > > +static int ath10k_download_cal_eeprom(struct ath10k *ar) > +{ > + size_t data_len; > + void *data = NULL; > + int ret; > + > + ret = ath10k_hif_fetch_target_board_data(ar, &data, &data_len); > + if (ret) { > + ath10k_warn(ar, "failed to read calibration data from EEPROM: %d\n", > + ret); > + goto out_free; > + } Looking at this again I noticed that we issue this warning even if EEPROM is not supported, which I think is wrong. I fixed this in the pending branch, the diff is below. I also renamed target_board_data to cal_eeprom because, at least to my understanding, the eeprom actually contains the real calibration data, not the board data file. Please review so that I didn't break anything. https://git.kernel.org/cgit/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=4f79bdf2db7bcfa9c7c093fd423af801b9797c63 diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 10a1b620a68b..1e88251ca6d0 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -580,10 +580,11 @@ static int ath10k_download_cal_eeprom(struct ath10k *ar) void *data = NULL; int ret; - ret = ath10k_hif_fetch_target_board_data(ar, &data, &data_len); + ret = ath10k_hif_fetch_cal_eeprom(ar, &data, &data_len); if (ret) { - ath10k_warn(ar, "failed to read calibration data from EEPROM: %d\n", - ret); + if (ret != -EOPNOTSUPP) + ath10k_warn(ar, "failed to read calibration data from EEPROM: %d\n", + ret); goto out_free; } diff --git a/drivers/net/wireless/ath/ath10k/hif.h b/drivers/net/wireless/ath/ath10k/hif.h index c18b8c81bde4..b2566b06e1e1 100644 --- a/drivers/net/wireless/ath/ath10k/hif.h +++ b/drivers/net/wireless/ath/ath10k/hif.h @@ -88,9 +88,9 @@ struct ath10k_hif_ops { int (*suspend)(struct ath10k *ar); int (*resume)(struct ath10k *ar); - /* fetch board data from target eeprom */ - int (*fetch_target_board_data)(struct ath10k *ar, void **data, - size_t *data_len); + /* fetch calibration data from target eeprom */ + int (*fetch_cal_eeprom)(struct ath10k *ar, void **data, + size_t *data_len); }; static inline int ath10k_hif_tx_sg(struct ath10k *ar, u8 pipe_id, @@ -206,14 +206,14 @@ static inline void ath10k_hif_write32(struct ath10k *ar, ar->hif.ops->write32(ar, address, data); } -static inline int ath10k_hif_fetch_target_board_data(struct ath10k *ar, - void **data, - size_t *data_len) +static inline int ath10k_hif_fetch_cal_eeprom(struct ath10k *ar, + void **data, + size_t *data_len) { - if (!ar->hif.ops->fetch_target_board_data) + if (!ar->hif.ops->fetch_cal_eeprom) return -EOPNOTSUPP; - return ar->hif.ops->fetch_target_board_data(ar, data, data_len); + return ar->hif.ops->fetch_cal_eeprom(ar, data, data_len); } #endif /* _HIF_H_ */ diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index fb53f8846efd..f06dd3941bac 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -2678,8 +2678,8 @@ static int ath10k_pci_read_eeprom(struct ath10k *ar, u16 addr, u8 *out) return 0; } -static int ath10k_pci_fetch_target_board_data(struct ath10k *ar, void **data, - size_t *data_len) +static int ath10k_pci_hif_fetch_cal_eeprom(struct ath10k *ar, void **data, + size_t *data_len) { u8 *caldata = NULL; size_t calsize, i; @@ -2734,7 +2734,7 @@ static const struct ath10k_hif_ops ath10k_pci_hif_ops = { .suspend = ath10k_pci_hif_suspend, .resume = ath10k_pci_hif_resume, #endif - .fetch_target_board_data = ath10k_pci_fetch_target_board_data, + .fetch_cal_eeprom = ath10k_pci_hif_fetch_cal_eeprom, }; /*