From patchwork Mon Feb 13 12:09:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 13138369 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63C61C6379F for ; Mon, 13 Feb 2023 12:10:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231396AbjBMMKa (ORCPT ); Mon, 13 Feb 2023 07:10:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231226AbjBMMKY (ORCPT ); Mon, 13 Feb 2023 07:10:24 -0500 Received: from smtp-out-12.comm2000.it (smtp-out-12.comm2000.it [212.97.32.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3266E5FD3; Mon, 13 Feb 2023 04:10:10 -0800 (PST) Received: from francesco-nb.pivistrello.it (93-49-2-63.ip317.fastwebnet.it [93.49.2.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: francesco@dolcini.it) by smtp-out-12.comm2000.it (Postfix) with ESMTPSA id 8F51BBA1889; Mon, 13 Feb 2023 13:09:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailserver.it; s=mailsrv; t=1676290172; bh=5IFF+MAeEg7aqa9/TtrzCHtylps+zzbsIxIw3e0+S6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RnFEKeh0rJwNdYqYkK/mXnCDcB0yVR9qo9ttiQ4fXutgA74PmrVAzra15tgxJiTVQ i1J+8X4tsYYOkU9eJnChMefV3PO3cza7QnIj1ArR3g96fsFVSKM/PiP2W73DrVdDxw 4NSd6l5KkQBLrjhKVStWmsxvLFPxLzfiXI+pLI6gP9Jrg7Cf7qiLtOtQfCD4z/iemJ cTsCeAOfsXyFnRnsEMG95wHFoGF5oilERnypOPFb12PCunk5UAHkvUBww+Qb7Ic9iz FU15sVEmzmDvbxSKqFBcsGmamWEDOBsddJOFHpnyxMzlsmiE3U7qRC9BTEffU0o80q jnvQ5oXh0TPCA== From: Francesco Dolcini To: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, Marcel Holtmann , Luiz Augusto von Dentz Cc: Stefan Eichenberger , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Johan Hedberg , Sascha Hauer , Krzysztof Kozlowski , Francesco Dolcini Subject: [PATCH v3 1/5] dt-bindings: bluetooth: marvell: add 88W8997 Date: Mon, 13 Feb 2023 13:09:22 +0100 Message-Id: <20230213120926.8166-2-francesco@dolcini.it> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230213120926.8166-1-francesco@dolcini.it> References: <20230213120926.8166-1-francesco@dolcini.it> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Stefan Eichenberger Update the documentation with the device tree binding for the Marvell 88W8997 bluetooth device. Signed-off-by: Stefan Eichenberger Acked-by: Krzysztof Kozlowski Signed-off-by: Francesco Dolcini --- v3: no changes v2: - removed redundant "DT binding" from commit message title - add acked-by Krzysztof --- Documentation/devicetree/bindings/net/marvell-bluetooth.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/net/marvell-bluetooth.yaml b/Documentation/devicetree/bindings/net/marvell-bluetooth.yaml index 309ef21a1e37..83b64ed730f5 100644 --- a/Documentation/devicetree/bindings/net/marvell-bluetooth.yaml +++ b/Documentation/devicetree/bindings/net/marvell-bluetooth.yaml @@ -15,7 +15,9 @@ maintainers: properties: compatible: - const: mrvl,88w8897 + enum: + - mrvl,88w8897 + - mrvl,88w8997 required: - compatible From patchwork Mon Feb 13 12:09:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 13138370 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9321FC64EC7 for ; Mon, 13 Feb 2023 12:10:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231407AbjBMMKr (ORCPT ); Mon, 13 Feb 2023 07:10:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230464AbjBMMKc (ORCPT ); Mon, 13 Feb 2023 07:10:32 -0500 Received: from smtp-out-12.comm2000.it (smtp-out-12.comm2000.it [212.97.32.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92F35C65B; Mon, 13 Feb 2023 04:10:20 -0800 (PST) Received: from francesco-nb.pivistrello.it (93-49-2-63.ip317.fastwebnet.it [93.49.2.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: francesco@dolcini.it) by smtp-out-12.comm2000.it (Postfix) with ESMTPSA id E2E69BA18AA; Mon, 13 Feb 2023 13:09:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailserver.it; s=mailsrv; t=1676290173; bh=ZBdd6jReF6OGzDkpDCBEFnRQ9Nb4Kiy4J3ULuyTX7jY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=f55vHz1ax0tmhIrCkpjDnVCpoUnpTgbqOZPVRXyRp4O0FW8ruGEZGZZd8vBBp9WO6 4c5OpytwGmmEM15H+SQlyOJl0dYH+qp6ELo3yA1oMGw6QwC84f8EKUbYej1qG5XOL1 1M99jCtCmWRp8vWfidd26DDt/CN/K8J78U+8M89ZtjcSBHtxGwoFksdw+B5W/JFNX5 2BaTgrIwIVfvL3Y2kKhG45TYwraCndbOQiAVVC+0VubfyuHsLf1sGBva96rcUDSSgk 453gcXU3LfAbrADOMvQC2/V/SluKAuMXdb1oEAj9IUjwiQ3fJTEooYp5I/09oTK/gl z4NM6W1HEmRLQ== From: Francesco Dolcini To: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, Marcel Holtmann , Luiz Augusto von Dentz Cc: Stefan Eichenberger , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Johan Hedberg , Sascha Hauer , Francesco Dolcini , Krzysztof Kozlowski Subject: [PATCH v3 2/5] dt-bindings: bluetooth: marvell: add max-speed property Date: Mon, 13 Feb 2023 13:09:23 +0100 Message-Id: <20230213120926.8166-3-francesco@dolcini.it> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230213120926.8166-1-francesco@dolcini.it> References: <20230213120926.8166-1-francesco@dolcini.it> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Stefan Eichenberger The 88W8997 bluetooth module supports setting the max-speed property. Signed-off-by: Stefan Eichenberger Signed-off-by: Francesco Dolcini Reviewed-by: Krzysztof Kozlowski --- v3: add Reviewed-by Krzysztof v2: fixed indentation --- .../bindings/net/marvell-bluetooth.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Documentation/devicetree/bindings/net/marvell-bluetooth.yaml b/Documentation/devicetree/bindings/net/marvell-bluetooth.yaml index 83b64ed730f5..516c63ad165a 100644 --- a/Documentation/devicetree/bindings/net/marvell-bluetooth.yaml +++ b/Documentation/devicetree/bindings/net/marvell-bluetooth.yaml @@ -19,9 +19,25 @@ properties: - mrvl,88w8897 - mrvl,88w8997 + max-speed: + description: see Documentation/devicetree/bindings/serial/serial.yaml + required: - compatible +allOf: + - if: + properties: + compatible: + contains: + const: mrvl,88w8997 + then: + properties: + max-speed: true + else: + properties: + max-speed: false + additionalProperties: false examples: From patchwork Mon Feb 13 12:09:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 13138371 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B225C636CC for ; Mon, 13 Feb 2023 12:11:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230425AbjBMML6 (ORCPT ); Mon, 13 Feb 2023 07:11:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231453AbjBMMLI (ORCPT ); Mon, 13 Feb 2023 07:11:08 -0500 Received: from smtp-out-12.comm2000.it (smtp-out-12.comm2000.it [212.97.32.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 657671BE; Mon, 13 Feb 2023 04:10:42 -0800 (PST) Received: from francesco-nb.pivistrello.it (93-49-2-63.ip317.fastwebnet.it [93.49.2.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: francesco@dolcini.it) by smtp-out-12.comm2000.it (Postfix) with ESMTPSA id 73B2ABA18BF; Mon, 13 Feb 2023 13:09:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailserver.it; s=mailsrv; t=1676290173; bh=XI7gUu/J8R03sEmkggazfxi5UIEjFaUpF2GfWUJIa30=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=jM4Uj1FbHfEXciIJZpCdIV2AavqGCPG6vTSaTDvwiSPIlb73f4+AYu0D++td5J3rs 4PqtjSt+er1OxqJfpUUKNy/zk962tTAPsjv+gnO/Pegmt1solnGtWB87bkEu6TgkJ8 UQ07a1RKbREeK5jljJQEMBCvBWAuS5CCsbjEvDOwnRXfUYMFiPJwcMbktH24BZ8Fld eqj8b5claZPKTrW2ElCg4Um1P9JWHh5wxuTuH8YXNXIgFEY/dXCDjKX7pMclCwLH/y SDLTfyFOHHmF6apXHnyxviinUU1qZkHF9DDAZ8ImfeBdCCNz0Ex5kjC4AuVDPO3jhk E1MrOe8vO64Mw== From: Francesco Dolcini To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, Marcel Holtmann , Luiz Augusto von Dentz Cc: Stefan Eichenberger , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Johan Hedberg , Sascha Hauer , Francesco Dolcini Subject: [PATCH v3 3/5] Bluetooth: hci_mrvl: use maybe_unused macro for device tree ids Date: Mon, 13 Feb 2023 13:09:24 +0100 Message-Id: <20230213120926.8166-4-francesco@dolcini.it> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230213120926.8166-1-francesco@dolcini.it> References: <20230213120926.8166-1-francesco@dolcini.it> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Stefan Eichenberger Use the maybe_unused macro for the device tree ids instead of #ifdef CONFIG_OF. This makes it easier to add support for new devices. Signed-off-by: Stefan Eichenberger Signed-off-by: Francesco Dolcini --- v3: no changes v2: new patch --- drivers/bluetooth/hci_mrvl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/bluetooth/hci_mrvl.c b/drivers/bluetooth/hci_mrvl.c index fbc3f7c3a5c7..eaa9c51cacfa 100644 --- a/drivers/bluetooth/hci_mrvl.c +++ b/drivers/bluetooth/hci_mrvl.c @@ -414,13 +414,11 @@ static void mrvl_serdev_remove(struct serdev_device *serdev) hci_uart_unregister_device(&mrvldev->hu); } -#ifdef CONFIG_OF -static const struct of_device_id mrvl_bluetooth_of_match[] = { +static const struct of_device_id __maybe_unused mrvl_bluetooth_of_match[] = { { .compatible = "mrvl,88w8897" }, { }, }; MODULE_DEVICE_TABLE(of, mrvl_bluetooth_of_match); -#endif static struct serdev_device_driver mrvl_serdev_driver = { .probe = mrvl_serdev_probe, From patchwork Mon Feb 13 12:09:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 13138372 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5026DC636CC for ; Mon, 13 Feb 2023 12:13:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231191AbjBMMM6 (ORCPT ); Mon, 13 Feb 2023 07:12:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230180AbjBMMMf (ORCPT ); Mon, 13 Feb 2023 07:12:35 -0500 Received: from smtp-out-12.comm2000.it (smtp-out-12.comm2000.it [212.97.32.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A33011B57C; Mon, 13 Feb 2023 04:11:39 -0800 (PST) Received: from francesco-nb.pivistrello.it (93-49-2-63.ip317.fastwebnet.it [93.49.2.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: francesco@dolcini.it) by smtp-out-12.comm2000.it (Postfix) with ESMTPSA id BF370BA18C1; Mon, 13 Feb 2023 13:09:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailserver.it; s=mailsrv; t=1676290174; bh=YgXe/MvmOjDr+arNFK+ExgUEcK38ebeIBX/GvSFUpak=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LRskN2GfmWs8HIa9ZilaKMKFu952h7x8+xklUkKqxUsiO6RI1004XVRzxrlXGyg42 XYEoRwlZK7PXV6Be553qe3iyexBq93rbMMB9cnpPeChN6NVxTBM70z44SyPwmZ8qaF B7KA3+znI7XyWy5dUz4g3SJxZ96xkT4hp2S+RO+Ba6mK8WyQB/yJGoK78YG7h1JXL2 pIm0obI5iPch2ZxXjcok8BoDf+ay/SxfF2CPu4L2l6wXmrhb2wKW3OZ7dzeWI1P2e0 o1nAajcC9VrOWlDuuI33fQ7aZW60nRXgYVviG//hsz2sf6mB31RJMjV9UrsJIFW49N P7ebGnw/GC55w== From: Francesco Dolcini To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, Marcel Holtmann , Luiz Augusto von Dentz Cc: Stefan Eichenberger , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Johan Hedberg , Sascha Hauer , Francesco Dolcini Subject: [PATCH v3 4/5] Bluetooth: hci_mrvl: Add serdev support for 88W8997 Date: Mon, 13 Feb 2023 13:09:25 +0100 Message-Id: <20230213120926.8166-5-francesco@dolcini.it> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230213120926.8166-1-francesco@dolcini.it> References: <20230213120926.8166-1-francesco@dolcini.it> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Stefan Eichenberger Add serdev support for the 88W8997 from NXP (previously Marvell). It includes support for changing the baud rate. The command to change the baud rate is taken from the user manual UM11483 Rev. 9 in section 7 (Bring-up of Bluetooth interfaces) from NXP. Signed-off-by: Stefan Eichenberger Signed-off-by: Francesco Dolcini --- v3: use __hci_cmd_sync_status instead of __hci_cmd_sync v2: no changes --- drivers/bluetooth/hci_mrvl.c | 86 +++++++++++++++++++++++++++++++++--- 1 file changed, 79 insertions(+), 7 deletions(-) diff --git a/drivers/bluetooth/hci_mrvl.c b/drivers/bluetooth/hci_mrvl.c index eaa9c51cacfa..e08222395772 100644 --- a/drivers/bluetooth/hci_mrvl.c +++ b/drivers/bluetooth/hci_mrvl.c @@ -27,10 +27,12 @@ #define MRVL_ACK 0x5A #define MRVL_NAK 0xBF #define MRVL_RAW_DATA 0x1F +#define MRVL_SET_BAUDRATE 0xFC09 enum { STATE_CHIP_VER_PENDING, STATE_FW_REQ_PENDING, + STATE_FW_LOADED, }; struct mrvl_data { @@ -254,6 +256,14 @@ static int mrvl_recv(struct hci_uart *hu, const void *data, int count) if (!test_bit(HCI_UART_REGISTERED, &hu->flags)) return -EUNATCH; + /* We might receive some noise when there is no firmware loaded. Therefore, + * we drop data if the firmware is not loaded yet and if there is no fw load + * request pending. + */ + if (!test_bit(STATE_FW_REQ_PENDING, &mrvl->flags) && + !test_bit(STATE_FW_LOADED, &mrvl->flags)) + return count; + mrvl->rx_skb = h4_recv_buf(hu->hdev, mrvl->rx_skb, data, count, mrvl_recv_pkts, ARRAY_SIZE(mrvl_recv_pkts)); @@ -354,6 +364,7 @@ static int mrvl_load_firmware(struct hci_dev *hdev, const char *name) static int mrvl_setup(struct hci_uart *hu) { int err; + struct mrvl_data *mrvl = hu->priv; hci_uart_set_flow_control(hu, true); @@ -367,9 +378,9 @@ static int mrvl_setup(struct hci_uart *hu) hci_uart_wait_until_sent(hu); if (hu->serdev) - serdev_device_set_baudrate(hu->serdev, 3000000); + serdev_device_set_baudrate(hu->serdev, hu->oper_speed); else - hci_uart_set_baudrate(hu, 3000000); + hci_uart_set_baudrate(hu, hu->oper_speed); hci_uart_set_flow_control(hu, false); @@ -377,13 +388,54 @@ static int mrvl_setup(struct hci_uart *hu) if (err) return err; + set_bit(STATE_FW_LOADED, &mrvl->flags); + + return 0; +} + +static int mrvl_set_baudrate(struct hci_uart *hu, unsigned int speed) +{ + int err; + struct mrvl_data *mrvl = hu->priv; + __le32 speed_le = cpu_to_le32(speed); + + /* The firmware might be loaded by the Wifi driver over SDIO. We wait + * up to 10s for the CTS to go up. Afterward, we know that the firmware + * is ready. + */ + err = serdev_device_wait_for_cts(hu->serdev, true, 10000); + if (err) { + bt_dev_err(hu->hdev, "Wait for CTS failed with %d\n", err); + return err; + } + + set_bit(STATE_FW_LOADED, &mrvl->flags); + + err = __hci_cmd_sync_status(hu->hdev, MRVL_SET_BAUDRATE, + sizeof(speed_le), &speed_le, + HCI_INIT_TIMEOUT); + if (err) { + bt_dev_err(hu->hdev, "send command failed: %d", err); + return err; + } + + serdev_device_set_baudrate(hu->serdev, speed); + + /* We forcefully have to send a command to the bluetooth module so that + * the driver detects it after a baudrate change. This is foreseen by + * hci_serdev by setting HCI_UART_VND_DETECT which then causes a dummy + * local version read. + */ + set_bit(HCI_UART_VND_DETECT, &hu->hdev_flags); + return 0; } -static const struct hci_uart_proto mrvl_proto = { +static const struct hci_uart_proto mrvl_proto_8897 = { .id = HCI_UART_MRVL, .name = "Marvell", .init_speed = 115200, + .oper_speed = 3000000, .open = mrvl_open, .close = mrvl_close, .flush = mrvl_flush, @@ -393,18 +445,37 @@ static const struct hci_uart_proto mrvl_proto = { .dequeue = mrvl_dequeue, }; +static const struct hci_uart_proto mrvl_proto_8997 = { + .id = HCI_UART_MRVL, + .name = "Marvell 8997", + .init_speed = 115200, + .oper_speed = 3000000, + .open = mrvl_open, + .close = mrvl_close, + .flush = mrvl_flush, + .set_baudrate = mrvl_set_baudrate, + .recv = mrvl_recv, + .enqueue = mrvl_enqueue, + .dequeue = mrvl_dequeue, +}; + static int mrvl_serdev_probe(struct serdev_device *serdev) { struct mrvl_serdev *mrvldev; + const struct hci_uart_proto *mrvl_proto = device_get_match_data(&serdev->dev); mrvldev = devm_kzalloc(&serdev->dev, sizeof(*mrvldev), GFP_KERNEL); if (!mrvldev) return -ENOMEM; + mrvldev->hu.oper_speed = mrvl_proto->oper_speed; + if (mrvl_proto->set_baudrate) + of_property_read_u32(serdev->dev.of_node, "max-speed", &mrvldev->hu.oper_speed); + mrvldev->hu.serdev = serdev; serdev_device_set_drvdata(serdev, mrvldev); - return hci_uart_register_device(&mrvldev->hu, &mrvl_proto); + return hci_uart_register_device(&mrvldev->hu, mrvl_proto); } static void mrvl_serdev_remove(struct serdev_device *serdev) @@ -415,7 +486,8 @@ static void mrvl_serdev_remove(struct serdev_device *serdev) } static const struct of_device_id __maybe_unused mrvl_bluetooth_of_match[] = { - { .compatible = "mrvl,88w8897" }, + { .compatible = "mrvl,88w8897", .data = &mrvl_proto_8897}, + { .compatible = "mrvl,88w8997", .data = &mrvl_proto_8997}, { }, }; MODULE_DEVICE_TABLE(of, mrvl_bluetooth_of_match); @@ -433,12 +505,12 @@ int __init mrvl_init(void) { serdev_device_driver_register(&mrvl_serdev_driver); - return hci_uart_register_proto(&mrvl_proto); + return hci_uart_register_proto(&mrvl_proto_8897); } int __exit mrvl_deinit(void) { serdev_device_driver_unregister(&mrvl_serdev_driver); - return hci_uart_unregister_proto(&mrvl_proto); + return hci_uart_unregister_proto(&mrvl_proto_8897); }