Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp293986pxb; Wed, 18 Nov 2020 04:54:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJz0tGfB37pBi6z/HX7+xA+YKExBhIziOwPpgWzV2KctF8qWukYzg17gg5fk6uS9tyAaW7BU X-Received: by 2002:a50:fe02:: with SMTP id f2mr25543177edt.97.1605704055792; Wed, 18 Nov 2020 04:54:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605704055; cv=none; d=google.com; s=arc-20160816; b=ztCxj5ZjofrjUM/HXWw0aQYXARiPFRwaW18VoonVxecJ3IcXHTwrJ5TAnQC/57TJwb fQtir69GdYmur+CHVTCTw3SSmKXnjMUs0QoEDx2iLBMJdz8PRaXEbo9go67Rb2xB4/3R TEMEsMpYt88OwSK+KPw1/PkF4bEoLsAhtOhIRh2rbniQZ/fNIw605tKAcOA6wcf/JG9k rNsF0ExicQhAofZAB15ivjHHwbHxomh1o1M87XNdXpLjZLhVYgxa9F5lQvOVHGvH9qDS J87KtODOC+RSWCK+Ve3Y7LXw8myylYsemjeBaTeLfpAR+ncYXWIULz0HoVPM4XOsEwud SuCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=Ezzb71P/z53WE9c3e0DOL4tWmr9wOnoaE0eK1ZiMkZs=; b=kGUvmYnIeI1CQSTsPElSgqCt79t1MOikNReGnnJKVK2+gd3TsMYye77YLnpJIwjR7g qkcgKcloMZqn/2hmgkLk0xOwtIah+EGbpGrL8gK4zu5K9mg82H4rNK+T5svKNjL0YZNY N2AAXxqlz3BGYL6JFwDkCzVLb9U7rpO++IOFnSUv4JAltIJF1a5zeNsRq0xKQkc41GJ7 tPIl/A/cvKlzIWLLfRVauOD76ox9nMe+sZe6SEyOPc6+wbrxD9tmSRhezsecMsCzjJ94 MFoY63cE45VpvU5sT4BiPbJyhfSNrf3+injnZYetQLWq50Dx85VjpCKfuySYq57DVJ3X 40ig== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x24si15100452ejb.695.2020.11.18.04.53.21; Wed, 18 Nov 2020 04:54:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726339AbgKRMwx (ORCPT + 99 others); Wed, 18 Nov 2020 07:52:53 -0500 Received: from alexa-out.qualcomm.com ([129.46.98.28]:23005 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725767AbgKRMwx (ORCPT ); Wed, 18 Nov 2020 07:52:53 -0500 Received: from ironmsg07-lv.qualcomm.com (HELO ironmsg07-lv.qulacomm.com) ([10.47.202.151]) by alexa-out.qualcomm.com with ESMTP; 18 Nov 2020 04:52:52 -0800 X-QCInternal: smtphost Received: from ironmsg01-blr.qualcomm.com ([10.86.208.130]) by ironmsg07-lv.qulacomm.com with ESMTP/TLS/AES256-SHA; 18 Nov 2020 04:52:50 -0800 X-QCInternal: smtphost Received: from gubbaven-linux.qualcomm.com ([10.206.64.32]) by ironmsg01-blr.qualcomm.com with ESMTP; 18 Nov 2020 18:22:26 +0530 Received: by gubbaven-linux.qualcomm.com (Postfix, from userid 2365015) id 4184A21D6E; Wed, 18 Nov 2020 18:22:25 +0530 (IST) From: Venkata Lakshmi Narayana Gubba To: marcel@holtmann.org, johan.hedberg@gmail.com Cc: mka@chromium.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, hemantg@codeaurora.org, linux-arm-msm@vger.kernel.org, bgodavar@codeaurora.org, rjliao@codeaurora.org, hbandi@codeaurora.org, abhishekpandit@chromium.org, Venkata Lakshmi Narayana Gubba Subject: [PATCH v2] Bluetooth: btqca: Add support to read FW build version for WCN3991 BTSoC Date: Wed, 18 Nov 2020 18:22:23 +0530 Message-Id: <1605703943-25980-1-git-send-email-gubbaven@codeaurora.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Add support to read FW build version for WCN3991 BTSoC Signed-off-by: Venkata Lakshmi Narayana Gubba --- drivers/bluetooth/btqca.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++ drivers/bluetooth/btqca.h | 3 +++ 2 files changed, 60 insertions(+) diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c index ce9dcff..dfd7ff7 100644 --- a/drivers/bluetooth/btqca.c +++ b/drivers/bluetooth/btqca.c @@ -101,6 +101,56 @@ int qca_read_soc_version(struct hci_dev *hdev, u32 *soc_version, } EXPORT_SYMBOL_GPL(qca_read_soc_version); +static int qca_read_fw_build_info(struct hci_dev *hdev) +{ + struct sk_buff *skb; + struct edl_event_hdr *edl; + char cmd; + int err = 0; + char build_label[QCA_FW_BUILD_VER_LEN]; + int build_lbl_len; + + bt_dev_dbg(hdev, "QCA read fw build info"); + + cmd = EDL_GET_BUILD_INFO_CMD; + skb = __hci_cmd_sync_ev(hdev, EDL_PATCH_CMD_OPCODE, EDL_PATCH_CMD_LEN, + &cmd, HCI_EV_VENDOR, HCI_INIT_TIMEOUT); + if (IS_ERR(skb)) { + err = PTR_ERR(skb); + bt_dev_err(hdev, "Reading QCA fw build info failed (%d)", + err); + return err; + } + + edl = (struct edl_event_hdr *)(skb->data); + if (!edl) { + bt_dev_err(hdev, "QCA read fw build info with no header"); + err = -EILSEQ; + goto out; + } + + if (edl->cresp != EDL_CMD_REQ_RES_EVT || + edl->rtype != EDL_GET_BUILD_INFO_CMD) { + bt_dev_err(hdev, "QCA Wrong packet received %d %d", edl->cresp, + edl->rtype); + err = -EIO; + goto out; + } + + build_lbl_len = edl->data[0]; + memcpy(build_label, &edl->data[1], build_lbl_len); + *(build_label + build_lbl_len) = '\0'; + + bt_dev_info(hdev, "BT SoC FW Build info: %s", build_label); + +out: + kfree_skb(skb); + if (err) + bt_dev_err(hdev, "QCA read fw build info failed (%d)", err); + + return err; +} + static int qca_send_reset(struct hci_dev *hdev) { struct sk_buff *skb; @@ -520,6 +570,13 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate, return err; } + if (soc_type == QCA_WCN3991) { + /* get fw build info */ + err = qca_read_fw_build_info(hdev); + if (err < 0) + return err; + } + bt_dev_info(hdev, "QCA setup on UART is completed"); return 0; diff --git a/drivers/bluetooth/btqca.h b/drivers/bluetooth/btqca.h index d81b74c..375c7fc 100644 --- a/drivers/bluetooth/btqca.h +++ b/drivers/bluetooth/btqca.h @@ -11,6 +11,7 @@ #define EDL_PATCH_CMD_LEN (1) #define EDL_PATCH_VER_REQ_CMD (0x19) #define EDL_PATCH_TLV_REQ_CMD (0x1E) +#define EDL_GET_BUILD_INFO_CMD (0x20) #define EDL_NVM_ACCESS_SET_REQ_CMD (0x01) #define MAX_SIZE_PER_TLV_SEGMENT (243) #define QCA_PRE_SHUTDOWN_CMD (0xFC08) @@ -34,6 +35,8 @@ #define QCA_HCI_CC_OPCODE 0xFC00 #define QCA_HCI_CC_SUCCESS 0x00 +#define QCA_FW_BUILD_VER_LEN 255 + enum qca_baudrate { QCA_BAUDRATE_115200 = 0, QCA_BAUDRATE_57600, -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation