From patchwork Fri Aug 11 10:12:31 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: 713221 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 09F81C0015E for ; Fri, 11 Aug 2023 10:14:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233260AbjHKKOb (ORCPT ); Fri, 11 Aug 2023 06:14:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229592AbjHKKOT (ORCPT ); Fri, 11 Aug 2023 06:14:19 -0400 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2047.outbound.protection.outlook.com [40.107.249.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 643645247; Fri, 11 Aug 2023 03:13:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QNreWm3vGHrrAep+nshJNdXtqRPoA89jBc5yZc5o2ey6WB6NHbfRdyE1QChFuXSpkAk83maXnx019xyZI/ZFzfV/+OPEEky9ifib5bK3ZT60KTDGtwt2aKej26k4lasMyH1G7aGgpyHbtK8moh7nLfnUNaBP23GBIDRwqOVVEymzHAtDjmXImZSX75cynAnVu9wOpVtj8e7NXF2DbQy+HaFKm2vM8Vr6JqGHDkXzw7+Nxpq7euhjqKSz9mAH+JLIhTJLLKgS4f6PCtNUn9Ct7G1t0lA6J0zf6pQdocBsBa3616tfQOVCRILlZJ/ZoV1uhKfBzGKKlhkSt4I66VKPkQ== 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=rycIkm4I/eQtJoiXewSPV9qcJ8yPGak3fOOIKP18G80=; b=IsdpetNkgdqlveiZ3OT/+OguD19sL4CgZwSITE3ddRiz3ANxCXsKrw6cJgL2v5I+E9PMDwQiqkTYgpDEEfhCCpKmWm7LxwqEP0vHFShYuZEqaTAT0pJfz58whYmBC0X91skCdGliwq7eB8mzXBRKUxItuJYxjY1A2AcHIhTWKVguZHL7oeSCLH/rbx0f1I2pC7Drh98lFVl/iw64PfJYdDvsPJpEo2oJQAQigoccu2RIAnmkH0HIG/pL2vhJ4Nv64R5PPRXaJsK5CJ8C5EJcr4VYPbzIqT6r/dQCD+l35x2vlUbR8YtIFTn5xKYLlP2gE3FZ5m7DwMXDKUuob/dlmg== 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=rycIkm4I/eQtJoiXewSPV9qcJ8yPGak3fOOIKP18G80=; b=ZFqXfS2dufg4Dfvrp/Iqs/bVkwFofXQnAD4wBirMg1iTGt+86xzcdGvYAwA2FgndCbjr0BIB1TQ16KVEUZP4/0ke4ZKFbLJAMHvA0oO9n7W8QRsewviFCW2V+OkreiNaOKRKLVcMn77my7Ehf0IH4amHRAvy7SrPYWein+nbpdA= 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 PAXPR04MB8441.eurprd04.prod.outlook.com (2603:10a6:102:1d8::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.30; Fri, 11 Aug 2023 10:12: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.6678.019; Fri, 11 Aug 2023 10:12: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 v2 1/2] Bluetooth: btnxpuart: Remove check for CTS low after FW download Date: Fri, 11 Aug 2023 15:42:31 +0530 Message-Id: <20230811101232.844769-2-neeraj.sanjaykale@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230811101232.844769-1-neeraj.sanjaykale@nxp.com> References: <20230811101232.844769-1-neeraj.sanjaykale@nxp.com> X-ClientProxiedBy: SI2P153CA0010.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::13) To AM9PR04MB8603.eurprd04.prod.outlook.com (2603:10a6:20b:43a::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8603:EE_|PAXPR04MB8441:EE_ X-MS-Office365-Filtering-Correlation-Id: e0e7ed39-8ba7-4d75-49c2-08db9a537252 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: agZEbx+9C+Lts44dof0JYM1HRuK++ZuTmUrT7W2PaJ9U98pDDC8KlKmeOXoM5xh4Vs1EpWZpwo8jRlqqQEE3XQsp0aTCQzcYFrsZbmvRO7AkLyt0jVURdz4HlkqYypYSu7P9VfJUOkyeprblvO2Vo8FV+ptTCHglMZermHDMGOcQ9MFokJ4+Gn9DeFS8bU55ptI8j/ilMrnE3brIWuj936Ozu1JOW+3/wV817mIPt03Y6ctxtQ2cFwh40OERIYo3eEd0lIZNpjWMuLpnLQYkfRh1OOjiVHa18XFM1xP+1d2FkM64ubR+NTpLgj2B+FDycXSSOY6HCInO6hXFlL/MUs6sXrvDfneChFjrGTash/i1hZQCQbLuPkL7tKCOKjvff7g+NaqD4LPdjLfbMdmVHHPvHm6ltiD8MGY1hhSmIn84KndFLhlWI697vmSn1Ca0IP193mzcgv3hZtV4rb86Zv7RJ5FzQYltaocGQtf0UEZ+tbB62jryd7wyw56CmJjfM9LRPErPNjelgosAWpDgYc6AvYpseThyiDPsa5z7t0iSVdg3BoXtEbZIpBHLz7d8FqiVf5ugQZsmTxmhUVO5atVamzKq0QjOfFb7AU0nrDX3NHAHcF40q+35jD3L6XkW 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)(366004)(136003)(396003)(39860400002)(376002)(346002)(186006)(451199021)(1800799006)(6666004)(83380400001)(2616005)(2906002)(478600001)(41300700001)(6512007)(26005)(316002)(1076003)(4326008)(6506007)(36756003)(66946007)(66556008)(66476007)(6636002)(38350700002)(38100700002)(52116002)(86362001)(8676002)(8936002)(5660300002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vKtVOGm4KUThJPu6oNy6IXQRH2zmi1T4UzY2cgChS/59c3YzUFVy53jZ2+kaAfdBUsjXJY519eRtO1+qjgXX+kvSEDfi+eLH44HMTGKPOcGP+RCCxmsQJ0aqv/dG8phGwM8WZqGS1w5NrBEs281UtFPjQkz5CsWrnYGyxsVpVSudD6uzxJSTskumovuXE8wxRARG+rWzFwH0JcnIvlchNf9JlZE6EvSpwBo6bSaEx7HNhIWXvSrsDcn1eL91AyWPQBCFkOYKD9XhLbwRN42pvArWpkolKp1Lsr/Tg6hKkejhHskGOCMLw+8xCisi1g2oMr/7tem1ovrViN7ljoH7HMRZb/19ahecrnMKqOMcoyLQKsCYTKQ+wgBYnqUe3f7VqG3uVM9hYlEn7Ny+fTGIXj+vj2rMaUymq3PejDI8XjclueYdsvvZQ3DkMkfuPsHgw0BifTNNrIsywrau2udiiG3asdurryZs//LaaBlGv6TIenNRRM29SANWM7ElWsojiaIJ3OmEoqd4hSyPhUWdbTB7URuH7IaOzwsaXsi+U+qru5zHyu8dLHvL5fMheTJEkTmu91+RhWhzMzxLD4Rtxh/pUeJRaOdCdfgLt8vQwoc3EgclkFcms6wGggaOsnBUPaOYYW0poBju9a6/LiGhNL5xwfBuJLQNufEHjN/YHIMMWRNIiAUeJUe24yn88h5q6/QQI318qaVCeIyGsfdqfxXZNlcik3UYNyc/qVV+cij+J8plLSYjwd8mOIk+OxEGx8EUv4L95J/L6O0pOpfW2GHXZ0mgS1aIpkZRP+WONkUPTJheE5ZaVHqKQZ4XirM+74OhJVcQAnc4zBCX0s/Fs+ZYL7xELG42fv2x20xqEJn3Kt7kz61/4A2wa4ZKrG3IDqhM7KMYWTh1UHg6pUdoE4uZ8Np+OeZsI6040I+n+ZSnWS/7cOAws1iHrOdIbJRJ1iLWO3J0bA3gN8skNgtt9U+oqqpo2Dn13vTq3r/c8WQi9GZYr2/nAiMSlY3CMj8Fh41XWe7qZzWtiNu3H2zgCyiMp7QvBXqjxm2aj08mUKNsa7KQRqAAFsd955iHyT0gniB6OyCnz0K8h9o1bh1yPIUqWwZNJfUE88kfBHrxHJXq/fDZq/1v26l3g2AzI0ml/+BgZf1OSm/93BBLAZRcbKivevbFkKbLVJX/GeX9xMtCBr8cmpIdDggKMZOC3MTmle1ktz+YUkf0m6Ju057Zrh7rSkJt/pzOP5emXBAic3XrrgioPkZvU1DuP41aT3g3rv6QFhXzylUmKy+/vGKuPHI+3JlbfkaYTwL/nQK7YQ7PB5eVbHuJE8rE/vsAjCy3CL5KYG6/0gXaaaTSl3TZnnDzHQuOmCZPU7W711QngaYbLxb8zthOIdFtUL2GrzLC/dUY6rSlpglgu0gySObrlKiwtKXHKPeoICNmlYFmS9pJU01gsupjXDlrCA0BAGQ3mogMGNiZVkGNxnV3UfokHeXNtXUH4EjVCyPcl29D52/LQkMLbV7t6PQB1frv5K5Mm7Tpc8C3SQqZtUeUZaX5MN2HMJbwd0cX1A5z1wyrcYdWxAScE1VHg2QDc5gbo7+A/ovNy7oemcHHQYiYCh2t/Q== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0e7ed39-8ba7-4d75-49c2-08db9a537252 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8603.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2023 10:12:19.5695 (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: 8iIukwsOHGupMtLmrFVSKbA0tHVkqS8SfV5VKZDHsyb6RxASQSBWDPGe3ENP8vuEo/rowUocAmitp6LblgWtMwv0bQW6p6I+f5xD4mb9Xx4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8441 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This removes the unnecessary check for CTS low after FW download. After FW download is complete, the CTS line is already seen low. It becomes high after 2 msec, and low again after FW initialization is complete. This makes the current check for CTS low redundant. This removes the wait for CTS low section and increase delay to 1200msec instead, which is sufficiant for all NXP chipsets to initialize FW. Signed-off-by: Neeraj Sanjay Kale --- v2: Remove wait_for_cts low check in a separate commit (Francesco Dolcini) --- drivers/bluetooth/btnxpuart.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c index ee6f6c872a34..1dd60c7e6fe0 100644 --- a/drivers/bluetooth/btnxpuart.c +++ b/drivers/bluetooth/btnxpuart.c @@ -558,16 +558,11 @@ static int nxp_download_firmware(struct hci_dev *hdev) } serdev_device_set_flow_control(nxpdev->serdev, true); - err = serdev_device_wait_for_cts(nxpdev->serdev, 1, 60000); - if (err < 0) { - bt_dev_err(hdev, "CTS is still high. FW Download failed."); - return err; - } release_firmware(nxpdev->fw); memset(nxpdev->fw_name, 0, sizeof(nxpdev->fw_name)); /* Allow the downloaded FW to initialize */ - usleep_range(800 * USEC_PER_MSEC, 1 * USEC_PER_SEC); + msleep(1200); return 0; } From patchwork Fri Aug 11 10:12:32 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: 712908 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 2C119C0015E for ; Fri, 11 Aug 2023 10:23:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235015AbjHKKXE (ORCPT ); Fri, 11 Aug 2023 06:23:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234914AbjHKKXB (ORCPT ); Fri, 11 Aug 2023 06:23:01 -0400 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2077.outbound.protection.outlook.com [40.107.249.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06D3A423B; Fri, 11 Aug 2023 03:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cu97XXFuNim9Ry3/QqFMuDvuWQxu4IGF+FaOXiYBjZsV6QeHHdYyVZfHKOV2+k4ecsvMKZRajimftvZ+bEAzYkeXqsWH2J94RUiM/Wa5tjD7YB8V9EcPnlT6Q6rFuI53d50LqSAG06spb7P1ck0R0tKgj51BP8G/470PdwkhEj2+yxFlC1oAc7OrjBGNQ+Z6Bpwpcw+hnpk3J39bArlfyhwpcAhavW01/q1eJOYfgWjTk0iB0yIE6Y7tZv6I7gkhDxwnTuf2tO5m6+QqD3QFYjqNR1eZw42xpj+qBCfhP0hnSxL9mFHmF3eXFhBQhTqPiZL5MJNbH8i2oCFMosqg7w== 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=EkfSc4XAeCD9PsGhKSlf3NOVTPDp9ikanJU4IiVIT5Y=; b=LBuJxOyi+4hvIQy1ywLV5+OLYzRfdnbu2i9MH6MAVE+YzvtluCfZYiLMpa/rqLNuXVJHD2GjwrNU5hZTdgzISr5Ifr2Pg9iRPv/zexYjPNnldIgzPSOTiM1CCx3kVuqJdDoqJK8dZrXyoLJ+DFoB4EkfWH9xIIE+azycpLg7uqyzOxWxLahr+ACsbkj3UZQD3km7lX+LbNDpnnb21zIiJe2XUJ4D3kb4zZp6VArpRrH7BSNXgSeY6v8rJrzL56YgK6UopeF/BXceIT75FvxMi/noLNOZ3u/FGenr+gUqgG2bSLWqYlRcEwIeNjFlOMmpkWVwdubAJpMB6u23RpK8Vw== 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=EkfSc4XAeCD9PsGhKSlf3NOVTPDp9ikanJU4IiVIT5Y=; b=qbgLiD/qP1J+skWqq4CXZOKc1ISSRvEcpsRKcXBhPqF4fHeXuEnI8oXX+FwAHdcBhXnQUOzzBj2bMmdUG1mMsfkU7s4IticNUocBGzFdX2MxJrlnqEHQNJoTTrxjiv7U9nI4OFkKKSCE9K3/fO1U8aNwbwc9gJZKvHI+PNpmzwk= 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 PAXPR04MB8441.eurprd04.prod.outlook.com (2603:10a6:102:1d8::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.30; Fri, 11 Aug 2023 10:12:25 +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.6678.019; Fri, 11 Aug 2023 10:12:25 +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 v2 2/2] Bluetooth: btnxpuart: Add support for IW624 chipset Date: Fri, 11 Aug 2023 15:42:32 +0530 Message-Id: <20230811101232.844769-3-neeraj.sanjaykale@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230811101232.844769-1-neeraj.sanjaykale@nxp.com> References: <20230811101232.844769-1-neeraj.sanjaykale@nxp.com> X-ClientProxiedBy: SI2P153CA0010.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::13) To AM9PR04MB8603.eurprd04.prod.outlook.com (2603:10a6:20b:43a::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8603:EE_|PAXPR04MB8441:EE_ X-MS-Office365-Filtering-Correlation-Id: 8bea5dd8-8bb2-4238-0696-08db9a5375e8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JTodfSQ7I7sndIRIjr7R/ZyRc2xQf3Dt6s66qQG+Y6nRGt2Uq+csXHsG3owz7D4cZQ4jeXmGSvMScbzsNbpFyBZz6UNuJAAZNbt8YZdAabfbd4kmnlxEfpgCWLwYtOCDeb7fHf/jZOZtA2f4T7yFEAwVUw0cmPhVulHW3JsewHGYk9AzhZ68B2rHTwKTBR13EdtSlLOXuQvZb1rliuoWUX2Zq2JgeR8x/BTGQa5L5djtJh6UJ1l9RbCoWlcJr1nCnluwVAOaRQ9LZke3ZZbipMU/bA1LJNvUs9hx62kpI2AzFqJvjShpOa7GgNUkqyP/DSaTNJtAT2jdLrhg/jxe2TbsOBm10FuSNEvBhx+a5R0JzEisY1rS9sW+w5l65FPmAtUOIgB2Fg+PvP2O247UVJgKJjjRHVt9qAcrzowhpJ14Jkn/E4qTw50k7Ur27bAFcl7SAj0TX+iow5x1sDFIQJaNvbreNOt3A8OFIb9lIt+MWlD2EBvx14tsVrpq7IctJE/M8tFIcfyvAGkJCtLZLWlztK7K4l6EbzK+3IHPsUls7Fit/I1NI2NnME7Ty6alVFkC2dluqhCzvk7w1EX29kyYs9eOVSUekWuuhuuYgsIg3r1MFXN8aQr0SB05qTMT 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)(366004)(136003)(396003)(39860400002)(376002)(346002)(186006)(451199021)(1800799006)(6666004)(83380400001)(2616005)(2906002)(478600001)(41300700001)(6512007)(26005)(316002)(1076003)(4326008)(6506007)(36756003)(66946007)(66556008)(66476007)(6636002)(38350700002)(38100700002)(52116002)(86362001)(8676002)(8936002)(5660300002)(6486002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MfAdk5AUM2gqbGKbL/l1+prjhyqkVIPp5IHxsxDfwOhv+9HHMXfErfzXJ+hdRxfqQ9d0vwV8kNJNhwKfew1Gau1CrrqP3pspr/ywVD38xx+Zss5OT79C07rG2C3vZ0EGhAPuEljYdyldwzTYp9skmkPlmiLV/ulhjrGkeWPN1992Mbj0o09U6QXXZT1le39VXNU8WaTCnltTQv6S9ULSpm+WJ82eGn0X4e5K5zQh1b8qe9ECdqxqwOwEVezdIIh8nZAaLxhuI8Ri1nvBJJ9ues9PW9fODRH4e09mqdYT0OTMxyus3050s5V10IV0oyAKoaKaF/XsWg/mJoxVTdyX351bScT7+z42tr2M7hUvcGruJYNmVfzeKsP7TUa2Ats4a+MuEqrTluzCZKIiUHU97Rf3xQ5BleTWecJyF0U5zNBmSPcwyHghP6JuZ58ERR2mG707LTK2aAyjGpbwm5JiYFVHJ4TcaUaCZf10R0lBNddZR+8EfWCRB3y9xKEh+eTRIASmDtgF5s2+UL6+z1bCETX9TVSPCyj3bHXThvv2ucA+YC2khI1ZAGdSjh/pueD86mI6dKJPpPQadJo28gw7ki8DUB7ihYvI4m6lMuVbIWDtIl/ru+aaqKUDbC0bBoFVtNK/R/qZrVwMe02Pqkm8yjcXeZdpAp1y1eOd/fpr6rJVLveYLwtMi8B3nZuaAqyRSW9KnTdQwoFohSd8PNnIAX4FJG/yymaVf82PFZ5XDGWzAr5Hr71pzg60AMlPHNb0uK2VvZjWiln0H/tIqhtzscO3E8yvZIR5aJajJQ+P4R6ZvaghxT8GWbb4a1o7XAnhItsCKSFCmLOtIZkpMIbJfmLHpbxYrvtVVld0UlKVeVexGTrYj98ujZ0NwMC52eUxrhfILCTe5q7qWB4PHTnACI5z5j61bOjf7DaObII/Gofjmwx0w6EM+L6aFTDoXGXZ+CrQh8YEfKlMZYpD6P9LeEAovDy8rWEq0eTmdsSBsN/WQj41CqNwEKMw0BR3ABz3lcE7g+maNTki48AAhyCtrICGIkL0ZjZY3hF0kIXYiYQdgNJpdLGRorv7oARxJf1MAAo2z0IznwDFkNYxIzBERvh2yVPTbxfFGtwOx3Hw7clZv7AUdRt15e9STbN79ZOejprTI1V60IMAPHF586xESo88bls2vsE+ezEpAiGqr+dXz7yQcgJgeJT7lDhOA9L08uT1yxjkOtezlCCGqfpGQOpcIDLec+xbznRaFWCCdD1FQHyx+kPKnsYkdE8rDjps1hxAW1HrCnNqZlO6GJuzp5YdSaMrW0W75FKofdLd+vIQ4mhpIrm1IqnOC7Fg/u9TBvZ7X1vYV8gq5mm5Btk3g+n9QQnEvgCU73+skKT7m0hktCH9za8vI6YOTMWKRr7Djgc8ukTtsF0JJsSqXMJ5JHYoJFaZAGehzTaT6SAPR1vnvzrxmqTkucb41oRIVWJkdgHTFPTJ+TuZYXJXPckmpzJR8TVr3gmZVy8f0ipaS5ORtfQHEtipeHJYoR1ZBAcyYoiN3Xo3+ycFemNDmMRE/HTJiLlHtRauBTGo6LBnWALQz6LdHlFHFcq3Q8FHx35y4eQ5nJgCRAk+Z1dhapc/0w== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8bea5dd8-8bb2-4238-0696-08db9a5375e8 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8603.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2023 10:12:25.5723 (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: 89ftwDPGEnw++WWTe4PZX6vay930Zse+UD6NyUa+/ui92XGPmDKn1SkcuQaTd+6/wsZcNjIhhrVYf/K8lOgrZtHvSktX67DkqRNQ5bzCOAo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8441 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This adds support for NXP IW624 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. For cmd5 payload during FW download, this chip has addresses of few registers offset by 1, so added boot_reg_offset to handle the chip specific offset. Signed-off-by: Neeraj Sanjay Kale --- v2: Remove wait_for_cts low check in a separate commit (Francesco Dolcini) --- drivers/bluetooth/btnxpuart.c | 37 ++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c index 1dd60c7e6fe0..b42572ca63af 100644 --- a/drivers/bluetooth/btnxpuart.c +++ b/drivers/bluetooth/btnxpuart.c @@ -34,6 +34,8 @@ #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_IW624 "nxp/uartiw624_bt.bin" +#define FIRMWARE_SECURE_IW624 "nxp/uartiw624_bt.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" @@ -41,6 +43,8 @@ #define CHIP_ID_W9098 0x5c03 #define CHIP_ID_IW416 0x7201 #define CHIP_ID_IW612 0x7601 +#define CHIP_ID_IW624a 0x8000 +#define CHIP_ID_IW624c 0x8001 #define CHIP_ID_AW693 0x8200 #define FW_SECURE_MASK 0xc0 @@ -152,6 +156,7 @@ struct btnxpuart_dev { u32 fw_v1_sent_bytes; u32 fw_v3_offset_correction; u32 fw_v1_expected_len; + u32 boot_reg_offset; wait_queue_head_t fw_dnld_done_wait_q; wait_queue_head_t check_boot_sign_wait_q; @@ -538,6 +543,7 @@ static int nxp_download_firmware(struct hci_dev *hdev) nxpdev->fw_dnld_v1_offset = 0; nxpdev->fw_v1_sent_bytes = 0; nxpdev->fw_v1_expected_len = HDR_LEN; + nxpdev->boot_reg_offset = 0; nxpdev->fw_v3_offset_correction = 0; nxpdev->baudrate_changed = false; nxpdev->timeout_changed = false; @@ -547,7 +553,7 @@ static int nxp_download_firmware(struct hci_dev *hdev) serdev_device_set_flow_control(nxpdev->serdev, false); nxpdev->current_baudrate = HCI_NXP_PRI_BAUDRATE; - /* Wait till FW is downloaded and CTS becomes low */ + /* Wait till FW is downloaded */ err = wait_event_interruptible_timeout(nxpdev->fw_dnld_done_wait_q, !test_bit(BTNXPUART_FW_DOWNLOADING, &nxpdev->tx_state), @@ -586,6 +592,12 @@ static bool nxp_fw_change_baudrate(struct hci_dev *hdev, u16 req_len) struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev); struct nxp_bootloader_cmd nxp_cmd5; struct uart_config uart_config; + u32 clkdivaddr = CLKDIVADDR - nxpdev->boot_reg_offset; + u32 uartdivaddr = UARTDIVADDR - nxpdev->boot_reg_offset; + u32 uartmcraddr = UARTMCRADDR - nxpdev->boot_reg_offset; + u32 uartreinitaddr = UARTREINITADDR - nxpdev->boot_reg_offset; + u32 uarticraddr = UARTICRADDR - nxpdev->boot_reg_offset; + u32 uartfcraddr = UARTFCRADDR - nxpdev->boot_reg_offset; if (req_len == sizeof(nxp_cmd5)) { nxp_cmd5.header = __cpu_to_le32(5); @@ -598,17 +610,17 @@ static bool nxp_fw_change_baudrate(struct hci_dev *hdev, u16 req_len) serdev_device_write_buf(nxpdev->serdev, (u8 *)&nxp_cmd5, sizeof(nxp_cmd5)); nxpdev->fw_v3_offset_correction += req_len; } else if (req_len == sizeof(uart_config)) { - uart_config.clkdiv.address = __cpu_to_le32(CLKDIVADDR); + uart_config.clkdiv.address = __cpu_to_le32(clkdivaddr); uart_config.clkdiv.value = __cpu_to_le32(0x00c00000); - uart_config.uartdiv.address = __cpu_to_le32(UARTDIVADDR); + uart_config.uartdiv.address = __cpu_to_le32(uartdivaddr); uart_config.uartdiv.value = __cpu_to_le32(1); - uart_config.mcr.address = __cpu_to_le32(UARTMCRADDR); + uart_config.mcr.address = __cpu_to_le32(uartmcraddr); uart_config.mcr.value = __cpu_to_le32(MCR); - uart_config.re_init.address = __cpu_to_le32(UARTREINITADDR); + uart_config.re_init.address = __cpu_to_le32(uartreinitaddr); uart_config.re_init.value = __cpu_to_le32(INIT); - uart_config.icr.address = __cpu_to_le32(UARTICRADDR); + uart_config.icr.address = __cpu_to_le32(uarticraddr); uart_config.icr.value = __cpu_to_le32(ICR); - uart_config.fcr.address = __cpu_to_le32(UARTFCRADDR); + uart_config.fcr.address = __cpu_to_le32(uartfcraddr); uart_config.fcr.value = __cpu_to_le32(FCR); /* FW expects swapped CRC bytes */ uart_config.crc = __cpu_to_be32(crc32_be(0UL, (char *)&uart_config, @@ -822,6 +834,7 @@ static int nxp_recv_fw_req_v1(struct hci_dev *hdev, struct sk_buff *skb) static char *nxp_get_fw_name_from_chipid(struct hci_dev *hdev, u16 chipid, u8 loader_ver) { + struct btnxpuart_dev *nxpdev = hci_get_drvdata(hdev); char *fw_name = NULL; switch (chipid) { @@ -834,6 +847,16 @@ 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_IW624a: + case CHIP_ID_IW624c: + nxpdev->boot_reg_offset = 1; + if ((loader_ver & FW_SECURE_MASK) == FW_OPEN) + fw_name = FIRMWARE_IW624; + else if ((loader_ver & FW_SECURE_MASK) != FW_AUTH_ILLEGAL) + fw_name = FIRMWARE_SECURE_IW624; + else + bt_dev_err(hdev, "Illegal loader version %02x", loader_ver); + break; case CHIP_ID_AW693: if ((loader_ver & FW_SECURE_MASK) == FW_OPEN) fw_name = FIRMWARE_AW693;