]> git.baikalelectronics.ru Git - kernel.git/commitdiff
Bluetooth: btqca: sequential validation
authorSai Teja Aluvala <quic_saluvala@quicinc.com>
Fri, 7 Jan 2022 06:20:53 +0000 (11:50 +0530)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 7 Jan 2022 07:32:55 +0000 (08:32 +0100)
Added Sequential validation support & patch command config

Signed-off-by: Sai Teja Aluvala <quic_saluvala@quicinc.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/btqca.c
drivers/bluetooth/btqca.h

index f7bf311d79102048ddecdedc23e9725d744cb3fb..c9064d34d8308f29e725929d31238366d8d8f3aa 100644 (file)
@@ -142,6 +142,50 @@ out:
        return err;
 }
 
+static int qca_send_patch_config_cmd(struct hci_dev *hdev)
+{
+       const u8 cmd[] = { EDL_PATCH_CONFIG_CMD, 0x01, 0, 0, 0 };
+       struct sk_buff *skb;
+       struct edl_event_hdr *edl;
+       int err;
+
+       bt_dev_dbg(hdev, "QCA Patch config");
+
+       skb = __hci_cmd_sync_ev(hdev, EDL_PATCH_CMD_OPCODE, sizeof(cmd),
+                               cmd, HCI_EV_VENDOR, HCI_INIT_TIMEOUT);
+       if (IS_ERR(skb)) {
+               err = PTR_ERR(skb);
+               bt_dev_err(hdev, "Sending QCA Patch config failed (%d)", err);
+               return err;
+       }
+
+       if (skb->len != 2) {
+               bt_dev_err(hdev, "QCA Patch config cmd size mismatch len %d", skb->len);
+               err = -EILSEQ;
+               goto out;
+       }
+
+       edl = (struct edl_event_hdr *)(skb->data);
+       if (!edl) {
+               bt_dev_err(hdev, "QCA Patch config with no header");
+               err = -EILSEQ;
+               goto out;
+       }
+
+       if (edl->cresp != EDL_PATCH_CONFIG_RES_EVT || edl->rtype != EDL_PATCH_CONFIG_CMD) {
+               bt_dev_err(hdev, "QCA Wrong packet received %d %d", edl->cresp,
+                          edl->rtype);
+               err = -EIO;
+               goto out;
+       }
+
+       err = 0;
+
+out:
+       kfree_skb(skb);
+       return err;
+}
+
 static int qca_send_reset(struct hci_dev *hdev)
 {
        struct sk_buff *skb;
@@ -552,6 +596,9 @@ int qca_uart_setup(struct hci_dev *hdev, uint8_t baudrate,
         */
        rom_ver = ((soc_ver & 0x00000f00) >> 0x04) | (soc_ver & 0x0000000f);
 
+       if (soc_type == QCA_WCN6750)
+               qca_send_patch_config_cmd(hdev);
+
        /* Download rampatch file */
        config.type = TLV_TYPE_PATCH;
        if (qca_is_wcn399x(soc_type)) {
index 30afa7703afd3a0c636df5d2fe8652f43020213a..61e9a50e66ae1f7687d9f0968247b01b87d6d5d4 100644 (file)
@@ -13,6 +13,7 @@
 #define EDL_PATCH_TLV_REQ_CMD          (0x1E)
 #define EDL_GET_BUILD_INFO_CMD         (0x20)
 #define EDL_NVM_ACCESS_SET_REQ_CMD     (0x01)
+#define EDL_PATCH_CONFIG_CMD           (0x28)
 #define MAX_SIZE_PER_TLV_SEGMENT       (243)
 #define QCA_PRE_SHUTDOWN_CMD           (0xFC08)
 #define QCA_DISABLE_LOGGING            (0xFC17)
@@ -24,6 +25,7 @@
 #define EDL_CMD_EXE_STATUS_EVT         (0x00)
 #define EDL_SET_BAUDRATE_RSP_EVT       (0x92)
 #define EDL_NVM_ACCESS_CODE_EVT                (0x0B)
+#define EDL_PATCH_CONFIG_RES_EVT       (0x00)
 #define QCA_DISABLE_LOGGING_SUB_OP     (0x14)
 
 #define EDL_TAG_ID_HCI                 (17)