From patchwork Thu Jul 27 13:33:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neeraj Sanjay Kale X-Patchwork-Id: 707621 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 90E70C001DC for ; Thu, 27 Jul 2023 13:33:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231429AbjG0Ndg (ORCPT ); Thu, 27 Jul 2023 09:33:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231407AbjG0Nde (ORCPT ); Thu, 27 Jul 2023 09:33:34 -0400 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2086.outbound.protection.outlook.com [40.107.249.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 980B72D67; Thu, 27 Jul 2023 06:33:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NN39Y/jNxh9qm+QR1EfakfWvIVnt4lNwzFQU+UeVKzzFTLvh/s+0MyY7CiDYZZ8booZr/vDOT4GY3mVNSOe81lWc649U1Y4rS/Ig2O1MDYv51x62Qp+1NyoVeMx84lHPrLiT95JXJMuxMw92sWnH0bV/nni4mFM9g31i/WUiWhoMB39IBVhCV5AXEa2iwlIMnde8TejFVHfXuJMrPK5fQKXSjH3EeW9qM1OlIgkn7DUOsaiB4HbHMhQUgNQEutmL4Y64OW6wjAGz/E5tViFaXyqgjvI0YibSkv/kUOKcjWCUTUImbLeon6gt7Cv7aJU4JjQfUmOXu89Olve0Jj+xBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hpRz66U+FgS9nr6pLUbOu1o4zpeDyndcdMwjq03AovM=; b=MrVt6Mjz+BxjcWJ+Cq/Mtw2Czsd7gCbR58FcaKWIS5zIGHVOrQhHRg7bPQQt3X0gPt5H6uh5m+jJG2+PHvKjplbBE04zHhyt+rmufZ3kQ//Hmw4mrsNJsdk0/XUjmPdaZBceZ511pCVDk+h9gUme0UE49FNsFlY//6CdSNW8CC0wpPvuvBUQpzLni9LHiuVRKdyy3g0nBVvEFd+FwavSz2XWnj5jCWSKjiuV0AKeAxm//PAtwG0SmLbTYevryH2CydeXvuwT7zO65SPIc1XPofP6j/sO4IzZDOkmbQgaX43lE/3GnxSvFh+6HuGY3PrDEgyh1Up6ZdRjP0qtpv01dg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hpRz66U+FgS9nr6pLUbOu1o4zpeDyndcdMwjq03AovM=; b=B5X+VApioJPmtvS3qoy+Xd/pEDESBR1MxR/W0itlesXX8M2iMJ93cb4b7XnPYZLxtUv6AFf4kdeERzHYl4pSSz79WPFitNiZjLJu+lGJZT20iq4myuT4jJkYdS2izgsKuw9USZxf7UuwwqTrMMAUcmgvMXbRxoCkb71xYONFVD4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8603.eurprd04.prod.outlook.com (2603:10a6:20b:43a::10) by DB9PR04MB8411.eurprd04.prod.outlook.com (2603:10a6:10:24c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Thu, 27 Jul 2023 13:33:19 +0000 Received: from AM9PR04MB8603.eurprd04.prod.outlook.com ([fe80::7504:9897:4e5d:df25]) by AM9PR04MB8603.eurprd04.prod.outlook.com ([fe80::7504:9897:4e5d:df25%4]) with mapi id 15.20.6631.026; Thu, 27 Jul 2023 13:33:19 +0000 From: Neeraj Sanjay Kale To: marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com, amitkumar.karwar@nxp.com, rohit.fule@nxp.com, sherry.sun@nxp.com Cc: neeraj.sanjaykale@nxp.com, linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1] Bluetooth: btnxpuart: Add support for AW693 chipset Date: Thu, 27 Jul 2023 19:03:17 +0530 Message-Id: <20230727133317.297014-1-neeraj.sanjaykale@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI2PR02CA0001.apcprd02.prod.outlook.com (2603:1096:4:194::10) To AM9PR04MB8603.eurprd04.prod.outlook.com (2603:10a6:20b:43a::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8603:EE_|DB9PR04MB8411:EE_ X-MS-Office365-Filtering-Correlation-Id: dea81d75-9f8e-49ad-85b7-08db8ea60a36 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1iKz15h2pmkNNWxq53qZkAMuhFvK3mk5va/BkijcCJq69tje6MsgB37nRjmZGLrb3OmvlzeQMYQiBF03+eSU2pxop5gzOy3lGXPT6HXaRPdAO9tbYcUn0jVvCNTaBioETcDZtZeceFzAdoj3b47Yu9jmKJpd39tjtwar7NcNiJ7ZUaVE1JhEhEdLlpTEu+JEK/0nXLVNiyC63DLVigv6wBQ3oB28k60w/46vPQtLFbq1vKObK0l9PRfWy8PIQzW/l7tgDB4S9XbnOlzwkp4PHJXn1GtZ3mpjr4jTuFNyPYwQsH+rKGgyfNn05drWWQNPjx6FULBDWQXUsD2+c3IvqbXZs4rpMPqg4+5e9h4QU5tCLy6HeNGAlBpAV/q+HQ7/ZAxXkXkviJFd7u2LA7i0WcdVjrxvyxz4+f2r8/T2JAD4Qn6M5gXsRlqqzn64S4FlxBFjZZQMJAs/kJ9M/DDejRnckzOAOtU2yd3avLsrSvKRmhFWJ3PKsgPVY+KTQU0Kg9W+PkgVlBgxcd5Y1RIMO+zVc/jD1wvNww7pOdNpuX7AGvGfHzm51gbNMPnHtZ2RndYRyTnFtTdw70zzyfFaASvj+QO6xDrLoU1ZHzyAIhY/oIaFnREAbe9UT/PFQXUW X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8603.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(346002)(396003)(376002)(39860400002)(136003)(366004)(451199021)(52116002)(6486002)(6512007)(478600001)(36756003)(83380400001)(86362001)(2906002)(66556008)(66476007)(2616005)(26005)(6506007)(1076003)(186003)(38100700002)(38350700002)(6636002)(316002)(8936002)(4326008)(66946007)(8676002)(5660300002)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: virPWU/kGGiD219kTM+dWlUxxEX0srXr9k6jjXPzla+IubpL8LCkIKpJPbmyNu1zhA7yf6Gcrp6uP1X7f3ldxIdAuuxXpal37izJn0b4hknQOU6bu7+PCy0oU2DwaGvYvQ5o7AEkaTtPKrF6AbVS5ZWfs1fY8MuWay24ay8xfLz09tLhcuuheedtlsZCskS5paMacxxrPSsioL7/pSBLB0nT2k7GWhz26b1ZLaaLqt5ZKX9PQKlG7PgRXpUstM6pj3MkpcppCP0IIIR17pgH6Qng4Xbz5d8ZlbennM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px/PacoMmKt/xw+7icS1LqEPVm69NsSFjFKy2B5aXPbcv1yG+0umMoBccy8T6HtwEBBSrE9WIYsFhVNrvs3NwYGcWSzxSb6BauauZPT2JGVfAbI564frW+BIRmZXSP8oJeO6nXvwcpaR8koMRCjt4eMR5ieEK9fJ9Q5MyIGsO+o1t45hZsY1bu07NmTE3z7zl0SgKClarsTydINprJvv5zjVKY/xzQxK1aDm9CQcuybXYuFd2chNjMT/a8hQLl2oxC4+g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dea81d75-9f8e-49ad-85b7-08db8ea60a36 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8603.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2023 13:33:19.1839 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ywRvDzGKZAx0qUFHmdRgWOxLbvPNF1KuKEIvEMwXTrfE/1p37m/6m1Mmzq2ChJBFfk0vTCMlpdfjz2GU17TPipylgbdJrpbOtE3aI9qy8Zo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8411 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This adds support for NXP AW693 chipset in btnxpuart driver by adding FW name and bootloader signature. Based on the loader version bits 7:6 of the bootloader signature, the driver can choose between selecting secure and non-secure FW files. Signed-off-by: Neeraj Sanjay Kale --- drivers/bluetooth/btnxpuart.c | 39 ++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c index 52ef44688d38..ee6f6c872a34 100644 --- a/drivers/bluetooth/btnxpuart.c +++ b/drivers/bluetooth/btnxpuart.c @@ -29,16 +29,25 @@ #define BTNXPUART_CHECK_BOOT_SIGNATURE 3 #define BTNXPUART_SERDEV_OPEN 4 -#define FIRMWARE_W8987 "nxp/uartuart8987_bt.bin" -#define FIRMWARE_W8997 "nxp/uartuart8997_bt_v4.bin" -#define FIRMWARE_W9098 "nxp/uartuart9098_bt_v1.bin" -#define FIRMWARE_IW416 "nxp/uartiw416_bt_v0.bin" -#define FIRMWARE_IW612 "nxp/uartspi_n61x_v1.bin.se" -#define FIRMWARE_HELPER "nxp/helper_uart_3000000.bin" +#define FIRMWARE_W8987 "nxp/uartuart8987_bt.bin" +#define FIRMWARE_W8997 "nxp/uartuart8997_bt_v4.bin" +#define FIRMWARE_W9098 "nxp/uartuart9098_bt_v1.bin" +#define FIRMWARE_IW416 "nxp/uartiw416_bt_v0.bin" +#define FIRMWARE_IW612 "nxp/uartspi_n61x_v1.bin.se" +#define FIRMWARE_AW693 "nxp/uartaw693_bt.bin" +#define FIRMWARE_SECURE_AW693 "nxp/uartaw693_bt.bin.se" +#define FIRMWARE_HELPER "nxp/helper_uart_3000000.bin" #define CHIP_ID_W9098 0x5c03 #define CHIP_ID_IW416 0x7201 #define CHIP_ID_IW612 0x7601 +#define CHIP_ID_AW693 0x8200 + +#define FW_SECURE_MASK 0xc0 +#define FW_OPEN 0x00 +#define FW_AUTH_ILLEGAL 0x40 +#define FW_AUTH_PLAIN 0x80 +#define FW_AUTH_ENC 0xc0 #define HCI_NXP_PRI_BAUDRATE 115200 #define HCI_NXP_SEC_BAUDRATE 3000000 @@ -665,6 +674,9 @@ static int nxp_request_firmware(struct hci_dev *hdev, const char *fw_name) struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev); int err = 0; + if (!fw_name) + return -ENOENT; + if (!strlen(nxpdev->fw_name)) { snprintf(nxpdev->fw_name, MAX_FW_FILE_NAME_LEN, "%s", fw_name); @@ -812,7 +824,8 @@ static int nxp_recv_fw_req_v1(struct hci_dev *hdev, struct sk_buff *skb) return 0; } -static char *nxp_get_fw_name_from_chipid(struct hci_dev *hdev, u16 chipid) +static char *nxp_get_fw_name_from_chipid(struct hci_dev *hdev, u16 chipid, + u8 loader_ver) { char *fw_name = NULL; @@ -826,6 +839,14 @@ static char *nxp_get_fw_name_from_chipid(struct hci_dev *hdev, u16 chipid) case CHIP_ID_IW612: fw_name = FIRMWARE_IW612; break; + case CHIP_ID_AW693: + if ((loader_ver & FW_SECURE_MASK) == FW_OPEN) + fw_name = FIRMWARE_AW693; + else if ((loader_ver & FW_SECURE_MASK) != FW_AUTH_ILLEGAL) + fw_name = FIRMWARE_SECURE_AW693; + else + bt_dev_err(hdev, "Illegal loader version %02x", loader_ver); + break; default: bt_dev_err(hdev, "Unknown chip signature %04x", chipid); break; @@ -838,13 +859,15 @@ static int nxp_recv_chip_ver_v3(struct hci_dev *hdev, struct sk_buff *skb) struct v3_start_ind *req = skb_pull_data(skb, sizeof(*req)); struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev); u16 chip_id; + u8 loader_ver; if (!process_boot_signature(nxpdev)) goto free_skb; chip_id = le16_to_cpu(req->chip_id); + loader_ver = req->loader_ver; if (!nxp_request_firmware(hdev, nxp_get_fw_name_from_chipid(hdev, - chip_id))) + chip_id, loader_ver))) nxp_send_ack(NXP_ACK_V3, hdev); free_skb: