From patchwork Fri Aug 3 12:16:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balakrishna Godavarthi X-Patchwork-Id: 10555049 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 46A3313AC for ; Fri, 3 Aug 2018 12:17:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B5462B8FF for ; Fri, 3 Aug 2018 12:17:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FAA32B916; Fri, 3 Aug 2018 12:17:11 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,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 C2D282B8FF for ; Fri, 3 Aug 2018 12:17:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731845AbeHCONM (ORCPT ); Fri, 3 Aug 2018 10:13:12 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:45570 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727403AbeHCONL (ORCPT ); Fri, 3 Aug 2018 10:13:11 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 045E96035F; Fri, 3 Aug 2018 12:17:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1533298627; bh=AG4B2NW23/TwoMGK86L9kgbiKZ7kdcNiIeEd0e/Hs14=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nQ+a1/SYE9/JgAoaiu8Bp7RtOPB7CeO2HMZGdlOYF/oVgGJpFKOG1fj9RF7ZRKDS8 bhX0ygrsI0LNm0ET0sM+UVFCrBAvtoIwIeAcXW1WNTu56G+ilBVzU1UYNn9XiOmSb0 cwztqt/3/znyOsqdJhnjr8BZ1NYPqx3Ogbb9YrwE= Received: from bgodavar-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: bgodavar@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 2E9BB60B73; Fri, 3 Aug 2018 12:17:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1533298625; bh=AG4B2NW23/TwoMGK86L9kgbiKZ7kdcNiIeEd0e/Hs14=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j9tDRJcy2ojUbyAgTLX3A9mY+wYN5AWP5ulAcwROMz1/4DigDv3pnAdvCaGAjkTFL YcfPdbSjInN4CnTFhxbhTA2+01USsXtJurZuDkNHixmUHl0QCktpuPGN2gotEpQB28 tBm0KnwRCyD+afByr5eul8VNj/E1mzvoD73nk+J8= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2E9BB60B73 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=bgodavar@codeaurora.org From: Balakrishna Godavarthi To: marcel@holtmann.org, johan.hedberg@gmail.com, mka@chromium.org Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-bluetooth@vger.kernel.org, thierry.escande@linaro.org, rtatiya@codeaurora.org, hemantg@codeaurora.org, linux-arm-msm@vger.kernel.org, Balakrishna Godavarthi Subject: [PATCH v15 6/7] Bluetooth: btqca: Add wcn3990 firmware download support. Date: Fri, 3 Aug 2018 17:46:31 +0530 Message-Id: <20180803121632.30689-7-bgodavar@codeaurora.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180803121632.30689-1-bgodavar@codeaurora.org> References: <20180803121632.30689-1-bgodavar@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch enables the RAM and NV patch download for wcn3990. Signed-off-by: Balakrishna Godavarthi Reviewed-by: Matthias Kaehlcke --- drivers/bluetooth/btqca.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c index 479179c54dcf..488f5e7521dd 100644 --- a/drivers/bluetooth/btqca.c +++ b/drivers/bluetooth/btqca.c @@ -336,6 +336,7 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, { struct rome_config config; int err; + u8 rom_ver; bt_dev_dbg(hdev, "QCA setup on UART"); @@ -343,8 +344,19 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, /* Download rampatch file */ config.type = TLV_TYPE_PATCH; - snprintf(config.fwname, sizeof(config.fwname), "qca/rampatch_%08x.bin", - soc_ver); + if (soc_type == QCA_WCN3990) { + /* Firmware files to download are based on ROM version. + * ROM version is derived from last two bytes of soc_ver. + */ + rom_ver = ((soc_ver & 0x00000f00) >> 0x04) | + (soc_ver & 0x0000000f); + snprintf(config.fwname, sizeof(config.fwname), + "qca/crbtfw%02x.tlv", rom_ver); + } else { + snprintf(config.fwname, sizeof(config.fwname), + "qca/rampatch_%08x.bin", soc_ver); + } + err = qca_download_firmware(hdev, &config); if (err < 0) { bt_dev_err(hdev, "QCA Failed to download patch (%d)", err); @@ -353,8 +365,13 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, /* Download NVM configuration */ config.type = TLV_TYPE_NVM; - snprintf(config.fwname, sizeof(config.fwname), "qca/nvm_%08x.bin", - soc_ver); + if (soc_type == QCA_WCN3990) + snprintf(config.fwname, sizeof(config.fwname), + "qca/crnv%02x.bin", rom_ver); + else + snprintf(config.fwname, sizeof(config.fwname), + "qca/nvm_%08x.bin", soc_ver); + err = qca_download_firmware(hdev, &config); if (err < 0) { bt_dev_err(hdev, "QCA Failed to download NVM (%d)", err);