From patchwork Tue May 24 21:21:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bastian Germann X-Patchwork-Id: 12860546 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7D007C433FE for ; Tue, 24 May 2022 21:24:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:Subject:Message-ID:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jpZr4spbvsJbsurQiLFM9/6n/PCYrf34X7SairJk20M=; b=y/9oXvGT+0qCWt 48yXbBZjRrbrftdNB81ByNfSphkxM3TpGU0RVsjZ06Psj7aplKtAFblRnNrU/6SQlsqDjSjpSWGO3 tdCr5qFCbUYIsoj5UlHqrBCry7XUB5885T58s+dDKgqEMYw7fEL6MzfXO2QcpDntDYVfJDLkL5uG5 dRluqkFSEAy8wbP+AtdFvGj2s4IIImvRnlWdfvGp2XtVwMggwGSuUu0JfHl9D/0ihfuXfxpxatxyp 5JQ/G/YUe9VdTjZWx/LRdaoJZTW7A6+ov8j2eSfHyJlLL2KBL6fsLzCGOEH62eDP4q/pY4TPgrI3X LFYXp8ByxHHATlGWurvA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntbza-009Dnw-IH; Tue, 24 May 2022 21:23:02 +0000 Received: from sender11-of-o53.zoho.eu ([31.186.226.239]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntbzG-009Dk8-U7 for linux-arm-kernel@lists.infradead.org; Tue, 24 May 2022 21:22:45 +0000 ARC-Seal: i=1; a=rsa-sha256; t=1653427341; cv=none; d=zohomail.eu; s=zohoarc; b=b0vA92DoaPGCbvh5GAQDzhj1RCYG3rkzYb53XhGgWwjAavb8ZmW2JW2ea/EpUjRtgISSz5QuEO1+8hlKd9G/4tfL+vDfewikWr+8j7gOSSbUINqSkTi/9jsGQzH+pLofSmSs8Nou+zjLqPo4+gSBCIsOkGvmSwTk1uxzOV5a1bw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1653427341; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=mGz9geOh9bVL8VNTmK+t7n+LCbps3NKlP/XHOE2cdBw=; b=JEUXSn1ZMumJ6Oyn2vEVEr/EKWQljGc/Rc3dtTbq7jsdn+guzK8uhRx9fuz/Duz/PDZAuspWC7dRl/D0q3OQJ5Ej04EJ+zeOXN4yK2aByeCuXOxr5xvdPHe+nrHiPp45zgR2EjPH0C3N2PNncKDNOsdc+qPUO5Wn7ve+/oyQzio= ARC-Authentication-Results: i=1; mx.zohomail.eu; spf=pass smtp.mailfrom=hostmaster@neglo.de; dmarc=pass header.from= Received: from localhost.localdomain (port-92-194-239-176.dynamic.as20676.net [92.194.239.176]) by mx.zoho.eu with SMTPS id 1653427340856773.1976815347725; Tue, 24 May 2022 23:22:20 +0200 (CEST) From: Bastian Germann To: Rob Herring , Maxime Ripard , Chen-Yu Tsai , Marcel Holtmann , Johan Hedberg , "David S . Miller" , Jakub Kicinski , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org Cc: Vasily Khoruzhick , Bastian Germann Message-ID: <20220524212155.16944-2-bage@debian.org> Subject: [PATCH v2 1/3] Bluetooth: Add new quirk for broken local ext features max_page Date: Tue, 24 May 2022 23:21:52 +0200 X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220524212155.16944-1-bage@debian.org> References: <20220524212155.16944-1-bage@debian.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220524_142243_334402_58F0FE68 X-CRM114-Status: GOOD ( 11.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Vasily Khoruzhick Some adapters (e.g. RTL8723CS) advertise that they have more than 2 pages for local ext features, but they don't support any features declared in these pages. RTL8723CS reports max_page = 2 and declares support for sync train and secure connection, but it responds with either garbage or with error in status on corresponding commands. Signed-off-by: Vasily Khoruzhick [rebase on current tree] Signed-off-by: Bastian Germann --- include/net/bluetooth/hci.h | 7 +++++++ net/bluetooth/hci_event.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 69ef31cea582..af26e8051905 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -265,6 +265,13 @@ enum { * runtime suspend, because event filtering takes place there. */ HCI_QUIRK_BROKEN_FILTER_CLEAR_ALL, + + /* When this quirk is set, max_page for local extended features + * is set to 1, even if controller reports higher number. Some + * controllers (e.g. RTL8723CS) report more pages, but they + * don't actually support features declared there. + */ + HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE, }; /* HCI device flags */ diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 66451661283c..52b358c33344 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -837,7 +837,9 @@ static u8 hci_cc_read_local_ext_features(struct hci_dev *hdev, void *data, if (rp->status) return rp->status; - if (hdev->max_page < rp->max_page) + if (!test_bit(HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE, + &hdev->quirks) && + hdev->max_page < rp->max_page) hdev->max_page = rp->max_page; if (rp->page < HCI_MAX_PAGES) From patchwork Tue May 24 21:21:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bastian Germann X-Patchwork-Id: 12860547 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3438DC433F5 for ; Tue, 24 May 2022 21:24:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:Subject:Message-ID:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=D5zHlZQY4Mb+OoYM7WS6OmYAIdoZBPnirMpAB3VvCF8=; b=B5f/cuTG3prTDe Ep+hy0sPwXWGDC2UcYGJkQaCzQBwBI3kc627ya/OFPAq9wxga7fiGM+1FJCjIQjdmqJhNJr1FW6FZ DlgBEP89MK9wOMPu4EXK9fwz1e5Cbx1lx6w6ZfEJLzu6P1KCA0dggdtwS1ZUS3+kS0Dekn2euVI8S GF1ynJLNoG3pyDaF1XFzuxWjbon3wgN6Wmxiks8Af6fc6tFT+n+TpVKUwZr7DKq2343631yOBkDQP LKnGCN4S/ucUe/XG8O8Bw9mkMz4amCbk7kXhmmqnnJv/1Rdd48JDfN/oQ6s5/KVXfdoIm64IjWTR2 qLFa3vkwjeM9qzbeXj2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntbzi-009DoX-Mp; Tue, 24 May 2022 21:23:10 +0000 Received: from sender11-of-o53.zoho.eu ([31.186.226.239]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntbzG-009Dk6-UY for linux-arm-kernel@lists.infradead.org; Tue, 24 May 2022 21:22:46 +0000 ARC-Seal: i=1; a=rsa-sha256; t=1653427343; cv=none; d=zohomail.eu; s=zohoarc; b=iIcXL1H4EEm9Cti55VVUyEqFXv0jEE1Psm1WGoY/ZtW2L6a8KX0O2NuUD2rzNUM+RSlyhNlCmZWMi9mF86+wp5ngeSkpXm8qSLO2ZpvTJGBijWvs/DnhUX3CGGx/XOh6kaUUPy1dHZqPWIIBs0oDTx915vIXoWOf5MQNmhu4zys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1653427343; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=kfMgNN0Q1Ds1SrlZiSXNiTXOz7T/kCau2sb/z5kFqXU=; b=AeBvyDkbgworGKvFt56Hcxn16voAC0mJY8iX/uNmkvoJTYhSo1y/Big4YzCOBNGQhymbVRimLHj6jQVAAhuNqX025J+D5l6aqELEeRK4W7XfpSK4fkbtXF72kohYBScC27KRWt9kow2VXOzl6Zsuj2X5IYymLv2DoLWRAxomAwI= ARC-Authentication-Results: i=1; mx.zohomail.eu; spf=pass smtp.mailfrom=hostmaster@neglo.de; dmarc=pass header.from= Received: from localhost.localdomain (port-92-194-239-176.dynamic.as20676.net [92.194.239.176]) by mx.zoho.eu with SMTPS id 1653427341858630.0610591818537; Tue, 24 May 2022 23:22:21 +0200 (CEST) From: Bastian Germann To: Rob Herring , Maxime Ripard , Chen-Yu Tsai , Marcel Holtmann , Johan Hedberg , "David S . Miller" , Jakub Kicinski , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org Cc: Vasily Khoruzhick , Bastian Germann Message-ID: <20220524212155.16944-3-bage@debian.org> Subject: [PATCH v2 2/3] Bluetooth: btrtl: add support for the RTL8723CS Date: Tue, 24 May 2022 23:21:53 +0200 X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220524212155.16944-1-bage@debian.org> References: <20220524212155.16944-1-bage@debian.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220524_142243_356944_C8132DFA X-CRM114-Status: GOOD ( 15.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Vasily Khoruzhick The Realtek RTL8723CS is SDIO WiFi chip. It also contains a Bluetooth module which is connected via UART to the host. It shares lmp subversion with 8703B, so Realtek's userspace initialization tool (rtk_hciattach) differentiates varieties of RTL8723CS (CG, VF, XX) with RTL8703B using vendor's command to read chip type. Also this chip declares support for some features it doesn't support so add a quirk to indicate that these features are broken. Signed-off-by: Vasily Khoruzhick [move former btrtl_apply_quirks to btrtl_set_quirks] [rebase on current tree] Signed-off-by: Bastian Germann --- drivers/bluetooth/btrtl.c | 120 +++++++++++++++++++++++++++++++++++-- drivers/bluetooth/btrtl.h | 5 ++ drivers/bluetooth/hci_h5.c | 4 ++ 3 files changed, 125 insertions(+), 4 deletions(-) diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c index 481d488bca0f..4b7378a65895 100644 --- a/drivers/bluetooth/btrtl.c +++ b/drivers/bluetooth/btrtl.c @@ -17,7 +17,11 @@ #define VERSION "0.1" +#define RTL_CHIP_8723CS_CG 3 +#define RTL_CHIP_8723CS_VF 4 +#define RTL_CHIP_8723CS_XX 5 #define RTL_EPATCH_SIGNATURE "Realtech" +#define RTL_ROM_LMP_8703B 0x8703 #define RTL_ROM_LMP_8723A 0x1200 #define RTL_ROM_LMP_8723B 0x8723 #define RTL_ROM_LMP_8821A 0x8821 @@ -30,6 +34,7 @@ #define IC_MATCH_FL_HCIREV (1 << 1) #define IC_MATCH_FL_HCIVER (1 << 2) #define IC_MATCH_FL_HCIBUS (1 << 3) +#define IC_MATCH_FL_CHIP_TYPE (1 << 4) #define IC_INFO(lmps, hcir, hciv, bus) \ .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV | \ IC_MATCH_FL_HCIVER | IC_MATCH_FL_HCIBUS, \ @@ -58,6 +63,7 @@ struct id_table { __u16 hci_rev; __u8 hci_ver; __u8 hci_bus; + __u8 chip_type; bool config_needed; bool has_rom_version; bool has_msft_ext; @@ -98,6 +104,39 @@ static const struct id_table ic_id_table[] = { .fw_name = "rtl_bt/rtl8723b_fw.bin", .cfg_name = "rtl_bt/rtl8723b_config" }, + /* 8723CS-CG */ + { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE | + IC_MATCH_FL_HCIBUS, + .lmp_subver = RTL_ROM_LMP_8703B, + .chip_type = RTL_CHIP_8723CS_CG, + .hci_bus = HCI_UART, + .config_needed = true, + .has_rom_version = true, + .fw_name = "rtl_bt/rtl8723cs_cg_fw.bin", + .cfg_name = "rtl_bt/rtl8723cs_cg_config" }, + + /* 8723CS-VF */ + { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE | + IC_MATCH_FL_HCIBUS, + .lmp_subver = RTL_ROM_LMP_8703B, + .chip_type = RTL_CHIP_8723CS_VF, + .hci_bus = HCI_UART, + .config_needed = true, + .has_rom_version = true, + .fw_name = "rtl_bt/rtl8723cs_vf_fw.bin", + .cfg_name = "rtl_bt/rtl8723cs_vf_config" }, + + /* 8723CS-XX */ + { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE | + IC_MATCH_FL_HCIBUS, + .lmp_subver = RTL_ROM_LMP_8703B, + .chip_type = RTL_CHIP_8723CS_XX, + .hci_bus = HCI_UART, + .config_needed = true, + .has_rom_version = true, + .fw_name = "rtl_bt/rtl8723cs_xx_fw.bin", + .cfg_name = "rtl_bt/rtl8723cs_xx_config" }, + /* 8723D */ { IC_INFO(RTL_ROM_LMP_8723B, 0xd, 0x8, HCI_USB), .config_needed = true, @@ -199,7 +238,8 @@ static const struct id_table ic_id_table[] = { }; static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev, - u8 hci_ver, u8 hci_bus) + u8 hci_ver, u8 hci_bus, + u8 chip_type) { int i; @@ -216,6 +256,9 @@ static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev, if ((ic_id_table[i].match_flags & IC_MATCH_FL_HCIBUS) && (ic_id_table[i].hci_bus != hci_bus)) continue; + if ((ic_id_table[i].match_flags & IC_MATCH_FL_CHIP_TYPE) && + (ic_id_table[i].chip_type != chip_type)) + continue; break; } @@ -298,6 +341,7 @@ static int rtlbt_parse_firmware(struct hci_dev *hdev, { RTL_ROM_LMP_8723B, 1 }, { RTL_ROM_LMP_8821A, 2 }, { RTL_ROM_LMP_8761A, 3 }, + { RTL_ROM_LMP_8703B, 7 }, { RTL_ROM_LMP_8822B, 8 }, { RTL_ROM_LMP_8723B, 9 }, /* 8723D */ { RTL_ROM_LMP_8821A, 10 }, /* 8821C */ @@ -577,6 +621,48 @@ static int btrtl_setup_rtl8723b(struct hci_dev *hdev, return ret; } +static bool rtl_has_chip_type(u16 lmp_subver) +{ + switch (lmp_subver) { + case RTL_ROM_LMP_8703B: + return true; + default: + break; + } + + return false; +} + +static int rtl_read_chip_type(struct hci_dev *hdev, u8 *type) +{ + struct rtl_chip_type_evt *chip_type; + struct sk_buff *skb; + const unsigned char cmd_buf[] = {0x00, 0x94, 0xa0, 0x00, 0xb0}; + + /* Read RTL chip type command */ + skb = __hci_cmd_sync(hdev, 0xfc61, 5, cmd_buf, HCI_INIT_TIMEOUT); + if (IS_ERR(skb)) { + rtl_dev_err(hdev, "Read chip type failed (%ld)", + PTR_ERR(skb)); + return PTR_ERR(skb); + } + + if (skb->len != sizeof(*chip_type)) { + rtl_dev_err(hdev, "RTL chip type event length mismatch"); + kfree_skb(skb); + return -EIO; + } + + chip_type = (struct rtl_chip_type_evt *)skb->data; + rtl_dev_info(hdev, "chip_type status=%x type=%x", + chip_type->status, chip_type->type); + + *type = chip_type->type & 0x0f; + + kfree_skb(skb); + return 0; +} + void btrtl_free(struct btrtl_device_info *btrtl_dev) { kvfree(btrtl_dev->fw_data); @@ -593,7 +679,7 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, struct hci_rp_read_local_version *resp; char cfg_name[40]; u16 hci_rev, lmp_subver; - u8 hci_ver; + u8 hci_ver, chip_type = 0; int ret; u16 opcode; u8 cmd[2]; @@ -619,8 +705,14 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, hci_rev = le16_to_cpu(resp->hci_rev); lmp_subver = le16_to_cpu(resp->lmp_subver); + if (rtl_has_chip_type(lmp_subver)) { + ret = rtl_read_chip_type(hdev, &chip_type); + if (ret) + goto err_free; + } + btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver, - hdev->bus); + hdev->bus, chip_type); if (!btrtl_dev->ic_info) btrtl_dev->drop_fw = true; @@ -663,7 +755,7 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, lmp_subver = le16_to_cpu(resp->lmp_subver); btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver, - hdev->bus); + hdev->bus, chip_type); } out_free: kfree_skb(skb); @@ -745,6 +837,7 @@ int btrtl_download_firmware(struct hci_dev *hdev, case RTL_ROM_LMP_8761A: case RTL_ROM_LMP_8822B: case RTL_ROM_LMP_8852A: + case RTL_ROM_LMP_8703B: return btrtl_setup_rtl8723b(hdev, btrtl_dev); default: rtl_dev_info(hdev, "assuming no firmware upload needed"); @@ -777,6 +870,19 @@ void btrtl_set_quirks(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev) rtl_dev_dbg(hdev, "WBS supported not enabled."); break; } + + switch (btrtl_dev->ic_info->lmp_subver) { + case RTL_ROM_LMP_8703B: + /* 8723CS reports two pages for local ext features, + * but it doesn't support any features from page 2 - + * it either responds with garbage or with error status + */ + set_bit(HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE, + &hdev->quirks); + break; + default: + break; + } } EXPORT_SYMBOL_GPL(btrtl_set_quirks); @@ -935,6 +1041,12 @@ MODULE_FIRMWARE("rtl_bt/rtl8723b_fw.bin"); MODULE_FIRMWARE("rtl_bt/rtl8723b_config.bin"); MODULE_FIRMWARE("rtl_bt/rtl8723bs_fw.bin"); MODULE_FIRMWARE("rtl_bt/rtl8723bs_config.bin"); +MODULE_FIRMWARE("rtl_bt/rtl8723cs_cg_fw.bin"); +MODULE_FIRMWARE("rtl_bt/rtl8723cs_cg_config.bin"); +MODULE_FIRMWARE("rtl_bt/rtl8723cs_vf_fw.bin"); +MODULE_FIRMWARE("rtl_bt/rtl8723cs_vf_config.bin"); +MODULE_FIRMWARE("rtl_bt/rtl8723cs_xx_fw.bin"); +MODULE_FIRMWARE("rtl_bt/rtl8723cs_xx_config.bin"); MODULE_FIRMWARE("rtl_bt/rtl8723ds_fw.bin"); MODULE_FIRMWARE("rtl_bt/rtl8723ds_config.bin"); MODULE_FIRMWARE("rtl_bt/rtl8761a_fw.bin"); diff --git a/drivers/bluetooth/btrtl.h b/drivers/bluetooth/btrtl.h index 2c441bda390a..1c6282241d2d 100644 --- a/drivers/bluetooth/btrtl.h +++ b/drivers/bluetooth/btrtl.h @@ -14,6 +14,11 @@ struct btrtl_device_info; +struct rtl_chip_type_evt { + __u8 status; + __u8 type; +} __packed; + struct rtl_download_cmd { __u8 index; __u8 data[RTL_FRAG_LEN]; diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c index c5a0409ef84f..048fefd03233 100644 --- a/drivers/bluetooth/hci_h5.c +++ b/drivers/bluetooth/hci_h5.c @@ -936,6 +936,8 @@ static int h5_btrtl_setup(struct h5 *h5) err = btrtl_download_firmware(h5->hu->hdev, btrtl_dev); /* Give the device some time before the hci-core sends it a reset */ usleep_range(10000, 20000); + if (err) + goto out_free; btrtl_set_quirks(h5->hu->hdev, btrtl_dev); @@ -1100,6 +1102,8 @@ static const struct of_device_id rtl_bluetooth_of_match[] = { .data = (const void *)&h5_data_rtl8822cs }, { .compatible = "realtek,rtl8723bs-bt", .data = (const void *)&h5_data_rtl8723bs }, + { .compatible = "realtek,rtl8723cs-bt", + .data = (const void *)&h5_data_rtl8723bs }, { .compatible = "realtek,rtl8723ds-bt", .data = (const void *)&h5_data_rtl8723bs }, #endif From patchwork Tue May 24 21:21:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bastian Germann X-Patchwork-Id: 12860545 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1100EC433EF for ; Tue, 24 May 2022 21:24:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:Subject:Message-ID:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2kTpcr3sW8j+MsPVpU3yMyXxt0YeSf4SJzfJ38w/VvA=; b=aOmRF73D3va+Ka bA0nK65bTAF6Z1w3zh/098berW0YvGj6qlVCN+7ueqNtKtKjtkFB9zPAjQCCcZJ5aRV7oNXLQ7kqV L3QZ5eEGtwVl/sPTauCV8fp8BI+mqn8wigXAIAjQoV9QIkizBI5i8NVtORSN3fUzQsv9ZbEJZUUkV 2rin/Bi+Qu28clNBB83qw824W+0Ao25Iw/ZVT0/0VMgfnl10PtWXf2c5Sl6E/RD9MRLEKeTJTttii 4L+dEWAtE5wYN9d2GgN9ahVc6NeWLbSEBMHrrFoecL0u9lcO44DOmh4H7frEALYTgi+Sl1KRwUl4m GkZg+i1/39SrdYcSNttg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntbzJ-009Dlz-Si; Tue, 24 May 2022 21:22:45 +0000 Received: from sender11-of-o53.zoho.eu ([31.186.226.239]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntbzG-009Dk7-RJ for linux-arm-kernel@lists.infradead.org; Tue, 24 May 2022 21:22:44 +0000 ARC-Seal: i=1; a=rsa-sha256; t=1653427343; cv=none; d=zohomail.eu; s=zohoarc; b=kqM4+zIYq7/2DiNmY1b/2BUBM7CawdxeHcYf2GLk1PZ3EwHkzorjAsqoQa9il+fnqqrFtkHi1QLzQrdqtHUQeEeK5+bYmp2Tbw5Y0NX5Ire1Iavm4lZHDWZtcsCiMmkTpsGt4nr7cdTNAAG9LwgSSKFhKefrH6BT2poKaBKBSZg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1653427343; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=p78ImhfqTFopguatUP5w6vRv8Q5bGiDPqYuQUSvDOYo=; b=N78zQsuV7d3OmTg7HQwYpF2M6PEkJraykhYRvjXZvNGjklgzOs0FMDoOxReAN9Ia3JaisU9qFc47uE4DAwNP7EyAzckycdibreXlGIWBhv0DlOG+pQNuBzgM/zan3+VYdUFNbW3qpMXDDpPiUPBDSZDLQT+QqLTzwZo4M/orsVs= ARC-Authentication-Results: i=1; mx.zohomail.eu; spf=pass smtp.mailfrom=hostmaster@neglo.de; dmarc=pass header.from= Received: from localhost.localdomain (port-92-194-239-176.dynamic.as20676.net [92.194.239.176]) by mx.zoho.eu with SMTPS id 1653427342834591.1104242641796; Tue, 24 May 2022 23:22:22 +0200 (CEST) From: Bastian Germann To: Rob Herring , Maxime Ripard , Chen-Yu Tsai , Marcel Holtmann , Johan Hedberg , "David S . Miller" , Jakub Kicinski , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org Cc: Vasily Khoruzhick , Bastian Germann Message-ID: <20220524212155.16944-4-bage@debian.org> Subject: [PATCH v2 3/3] arm64: allwinner: a64: enable Bluetooth On Pinebook Date: Tue, 24 May 2022 23:21:54 +0200 X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220524212155.16944-1-bage@debian.org> References: <20220524212155.16944-1-bage@debian.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220524_142243_203387_C6F0604A X-CRM114-Status: UNSURE ( 9.32 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Vasily Khoruzhick Pinebook has an RTL8723CS WiFi + BT chip, BT is connected to UART1 and uses PL5 as device wake GPIO, PL6 as host wake GPIO the I2C controlling signals are connected to R_I2C bus. Enable it in the device tree. Signed-off-by: Vasily Khoruzhick [add uart-has-rtscts] Signed-off-by: Bastian Germann --- .../boot/dts/allwinner/sun50i-a64-pinebook.dts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts index 63571df24da4..70d823f8c837 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts @@ -406,6 +406,19 @@ &uart0 { status = "okay"; }; +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>; + uart-has-rtscts; + status = "okay"; + + bluetooth { + compatible = "realtek,rtl8723cs-bt"; + device-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_LOW>; /* PL5 */ + host-wake-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */ + }; +}; + &usb_otg { dr_mode = "host"; };