From patchwork Fri Jan 3 06:04:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishwaroop A X-Patchwork-Id: 13925187 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2076.outbound.protection.outlook.com [40.107.102.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41C1A29CA; Fri, 3 Jan 2025 06:04:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735884286; cv=fail; b=mWYw1Rd+cKrt+5W4wFJ6P4q8KeLoAXr2FkcAiVbwIADjc0Kzmf9EDY7JcDNlTE49LZHYH6cKnOj7w9xf8zr98/TPsaskFRlMiqoWj+Jt3pbd9pba8a05t38qY+Wbyjn7D6pHVmL11FlRtJlUPyRU7Vj4dff119MKptBV3AxKFnY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735884286; c=relaxed/simple; bh=l6byfwutzIZXUtv33qMBQXJxRIkqc/hHhkXuy8jo2gA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YT5OzFQCNxfSqqj4+jzuk2OxrFqq7KJv2oI71bH2mxu/Rod3jAJjjb5Zst73w8Lxl6JnAD+7c0wQhDL1ngI0rNAcV1EPV+I4vb0FnBKTMN9JGZADv1ayguIxg0b2q0BKvmN2utJYoMfvFmNXarqgE5qpzN7LNLk4m600itMtFgE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=A4kwS86g; arc=fail smtp.client-ip=40.107.102.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="A4kwS86g" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=P7AshGpxtfsWcVsJyXfimNJknybi0rk4XoGgPkGsIZKh5eKql+kOGX0LdQ+w/dhQDYv3BcRKRKGY9Y4IWwiij+cI6CpQCHa0zuSNxloi7QLt+5hlnDu50/CrdmB0KAnC89CCLkJ+54SQn8UwtEnn2eaHd6Ykr+8JMUsux2GrMjGcihZzeaIMzWoZahRVAsYedcqrk6/YVJMoGEs0YQqVYQ1U05l84LTr9laEfafWXZYh+tYuzGVu4gQ4NSiHozVCtAk2Hxwf+b9lVMr3UiBiLDU+CqEnuC7GyXsyu6oqH8uw4PMXmi7SV7ls9hTHb0QFL8UYH75Ob7yoPCfwDbuXZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=6qWI/uoUZgNb+87E/+VEQkoS3R34YkqmicsFyyG6ynQ=; b=dxGAY0Qbqe8Tt5dH5UmIURMh8EkwpdutJKPuJdlbIDML5ZCXaJmUE3As+vjq7JUeselYvj4tiScAKXLKiATnt7+iaknNQ5vPbssCErCM0/IcNSKCphbZSrx/GHui93SOCPWSdK0nmMK8DsyH66xOhKrQZpNvJv56XfjeM2nI9CE+iPpOZoxcGvcIt05fBwoos75sl7rrDv7tnS4zlFQFWYqCCybnu7gEQAuODHbPapdF3BaTvm+X+3BXLGlBezQStFFoDty7hYRYBBpsieRvfCwBdcayjgNNMg7oVtfkITEAxIJY3vp8ZaOhtSoc90oS65Ekk3Eq1kPSztOkzaFcHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6qWI/uoUZgNb+87E/+VEQkoS3R34YkqmicsFyyG6ynQ=; b=A4kwS86g44KH3QmeCcd+xhIVOyM9yF2t1gI2spKbfEPPLyI/PsTIS7/xbDux/MelHHAWx7y3yZ8RH1oUYpyiqpP+9eODzyi+n32dLIzw+GLzwWXQpAwAaAtVWiidVw7GECz2SuT0X6yj5jLgHFIrLKwcyIfxVRaH+AAEeFxw30q7EBhRzdH6bYLzjRYW84HfaCPVsLmSnZUwmCZyqUtElpoVncZxYBQ7VLqk+43R2U3YKnifeYJAGZJiR1XxgiYUCWt1HP2e8qkMhYyGeM3lzysugcKw+jCEGbosdLS3WwLjgPv+AdBOtzx3Io9z/ZF2A2f4q90pCPfuQPr0Cg56ng== Received: from BN0PR04CA0189.namprd04.prod.outlook.com (2603:10b6:408:e9::14) by IA0PR12MB7750.namprd12.prod.outlook.com (2603:10b6:208:431::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.19; Fri, 3 Jan 2025 06:04:38 +0000 Received: from MN1PEPF0000F0E5.namprd04.prod.outlook.com (2603:10b6:408:e9:cafe::a0) by BN0PR04CA0189.outlook.office365.com (2603:10b6:408:e9::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8314.14 via Frontend Transport; Fri, 3 Jan 2025 06:04:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by MN1PEPF0000F0E5.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.11 via Frontend Transport; Fri, 3 Jan 2025 06:04:37 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 2 Jan 2025 22:04:22 -0800 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 2 Jan 2025 22:04:22 -0800 Received: from build-va-bionic-20241022.nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 2 Jan 2025 22:04:18 -0800 From: Vishwaroop A To: , , , , , , , , , CC: Subject: [PATCH V1 1/6] arm64: tegra: Configure QSPI clocks and add DMA Date: Fri, 3 Jan 2025 06:04:02 +0000 Message-ID: <20250103060407.1064107-2-va@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20250103060407.1064107-1-va@nvidia.com> References: <20250103060407.1064107-1-va@nvidia.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E5:EE_|IA0PR12MB7750:EE_ X-MS-Office365-Filtering-Correlation-Id: 71c3ae69-9038-4249-a10b-08dd2bbc8146 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|1800799024|82310400026|921020; X-Microsoft-Antispam-Message-Info: vgwVXboTw1jp8/XwoO63ithqPkoEWN5FaeEmOyZES8d11kUZ6a8As7wRWY6xI+A2mKc1Amwhm6RV1CzOfu1eJYRR0HAMqQ84rtFVjNNQ1oH7pJX/sxltT7r71bOlJUsPqo4Ghu0rWRp5y2xVXSgww8yXjJTE0OOr5icGWaTX2BkCmAASzSZ+5IIUHAXM7cBT/M0cYsKaaBUmXaoh5mluqBcM7gFTCnwwCu5NemgQ9EtyQdQrNRalVOPk6lMDIaZjaEDUg+wuk+4RlUBRZLLpBlK5GqL/xfElcUWwh1Ll3JwYZcbXatDKmGLkJe9SmiicbJV5HqH8iCRN5QfYh2WnKqsemfPbd4Loo+OOel6yzdnnfp9lq7ay1RRBgglzN/O/ax7SnuD265iLbVFIHnYTEzDgCntKkaktyY8vFVn4Y5MEl/Nd+IYp9IZBex7vmr8TcFNgBtPAwi9kQdIeHKhMXeNlYzogkZa8PuyrqEfQbwwiZu8DjiUuFG9kZlRDygxLeBs4vX5c91e/m4vVyiv+Ljd3Q0B11T1OtObOTchUkvCoCRMfEbRMYLbuFtMriwQe3AMfvuk3eiXoJb5AHEJ9BeM/B6lI+pD9HCob9jVQ7GMTTB2aqC2zWdTSsleB4eRoG4HLK/nWXbHzf+5LMUNcfXQ1b5Q1chSTX+x7J9OkYPwUrU0YbBDdeRN1ZKuNwiG/71ossgfLBQ+auvMIRdQNCrNrGspsfCSfd9LzAVmrb8jEDFNFF602JNKQEaRYSjupKd0hqL9DjvufHObPNY2Ld/pLc7q5+AHyr/hjUxsWMkcAtyHs1GiM070zjHUL1Vw4nMmcWLZ18TvpbP5Pss8DqsLNdS2SzXP3liUBY2WKPDWDmifc92FOFIWzZ/N88zVak4aWa7dTW+SU/4gXyo40aRaRHjePnABvGXFMF7ILtgBljTnsg06zO25Eksu4iSTVw+ZWylMkOqz/W0v344og8gkyiNOCWAzTnKsYp9NM0lq2YOwvc3zZKcy/q6CKv3NtWhHeSbf+od4IU5MDUGl6aZP+7NRqB3kcuLdINflWgXQU4DyayY3rPDnzr5wWZDss68LvV8wdrS1AQy9k2Hb8Lwhtbx3t24cEenEFXUCVRlUjErx2/IFWvC7cOpnvlY91NchwIMd6CleqYi4gUofTuWxH/VUdQrvR+nePEVuXOTIc/E9RfXpLQEHnd6NidgmbbZnYTrHceqLpTR3uUUxVJkw2ZMgsGUFqw4WD3+1PQuwiwLdG02qg1qIs6penppbCo5buL8JFHj8oGcn5KECDmWLZFOo5B1KUK68QRt2Ij+4OOA+N0gYxdUu0cbRoV7T8nMqZk44OKPKqcaWRxMglmYGYbZIPBCMICyPtyDpfjZr7I89dKSuGS4w1Vq5ZpmMCEaTBfH1VmNlgPVi55k89j0oP3jzxzU0rnEoSX847iCOrRIjAgKFGTQi9Ind02VIB7/PezEDUt1SW0yt4DQWH3st2QFqmK4S9M310Alcy6qI= X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(376014)(36860700013)(1800799024)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2025 06:04:37.7182 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71c3ae69-9038-4249-a10b-08dd2bbc8146 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000F0E5.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7750 Set QSPI0_2X_PM to 199.99 MHz and QSPI0_PM to 99.99 MHz using PLLC as the parent clock. These frequencies allow Quad IO DT reads up to 99.99 MHz, which is the fastest that can be achieved considering various PLL and clock divider constraints. Populate the DMA and IOMMU properties for the Tegra234 QSPI devices to enable DMA support. Change-Id: I1dded904aa8e0f278c89998481e829f1ce474e8c Signed-off-by: Vishwaroop A --- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi index 984c85eab41a..96d0f13390ae 100644 --- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi @@ -2948,6 +2948,13 @@ <&bpmp TEGRA234_CLK_QSPI0_PM>; clock-names = "qspi", "qspi_out"; resets = <&bpmp TEGRA234_RESET_QSPI0>; + assigned-clocks = <&bpmp TEGRA234_CLK_QSPI0_2X_PM>, + <&bpmp TEGRA234_CLK_QSPI0_PM>; + assigned-clock-rates = <199999999 99999999>; + assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLC>; + dma-names = "rx", "tx"; + dma-coherent; + iommus = <&smmu_niso1 TEGRA234_SID_QSPI0>; status = "disabled"; }; @@ -3031,6 +3038,13 @@ <&bpmp TEGRA234_CLK_QSPI1_PM>; clock-names = "qspi", "qspi_out"; resets = <&bpmp TEGRA234_RESET_QSPI1>; + assigned-clocks = <&bpmp TEGRA234_CLK_QSPI1_2X_PM>, + <&bpmp TEGRA234_CLK_QSPI1_PM>; + assigned-clock-rates = <199999999 99999999>; + assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLC>; + dma-names = "rx", "tx"; + dma-coherent; + iommus = <&smmu_niso1 TEGRA234_SID_QSPI1>; status = "disabled"; }; From patchwork Fri Jan 3 06:04:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishwaroop A X-Patchwork-Id: 13925188 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2070.outbound.protection.outlook.com [40.107.212.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B09A813B2A4; Fri, 3 Jan 2025 06:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735884289; cv=fail; b=M1ruiVLg0PtgOCEh7YtJXZ4jIZ5jauzka/R00FMt92sgi8eet3/e5yFG4MmvUFwZJO0s24o7nhqzUe84zyn4HJyRPoL1FoZGW+YS5iTu4h++Zi544Ezu1aAe/aW/15zSawvI+9niO3xaEjHqPf/76DYlp/30egzKft8++jfBGq0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735884289; c=relaxed/simple; bh=4kaJY8q9FAhBZcx/7L5l123mY5sYYEKau5kVSxHaRR8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jXW19NVljRNzdH7VDg6644N63RvOKs5cl1eclKlRkulF+Ktz+I00rVtguOhmx+2EGI/uRQgXACx4KwnUd0ZzIAEuN9/V5RvC98sE7/X0joa8HJqHcJGL1JJYSo1ziH8+Eb9h/poNwVppgGQHBlsOVaEEkxVwWlxt75Iwx6uPBHM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=ajeNiJ7f; arc=fail smtp.client-ip=40.107.212.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="ajeNiJ7f" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Pi/BwosY2+g5GJuzHPXyW3WYsB2ECzyZSDAjjUpsiF1+qVV2cuSMUbnOzNOjOMeNrnB456Uf+HDYXoWxz4MRAjAcC01852v9wA0TjpKd+gwQj+W0QfjEmCm03ZldeXR/VasSmAPwKvRgxJA++jfepOik85kkrIwIPxS+R5HfAoHK3mvBL+h/S7XK38xZTcPI6+Jv8C+tcmtirWeg8B/vzT5iwtrBGJr4JhReSJhZUC58j0smD0v3TL2oeWfqGeZD+zXeeD0NDntHkS0QIegpnFLkiuhVcnH7nGPphJloFO8Q31upOt9RRCP6OszQYlp9uC9Y1mWiKw7oJupb3NHadQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=d6UpUd9yyKwF5dVgltUuKkugUuKM24a5sAlTMF8TBE0=; b=sTlnDgQ6QWA9U3hkkC3IgMtprUfNS8MeD3Z3cucEGQJGWFlGAhRZvmeKYUJ0cPvnv+/NkSSLOzEtiCXLkVww21hpAm36lmq2PyGmFpFleidnR/Wqa0dvdjAkG/+HsHR1W56UztMd8sjbs8f7fjPdDJGLUMzPa0u1IYStu+QFLnGiXMiVKwAM1v0ZR6BWps8/GZt+aVhClD/A7qh4v3VjnoVH2RPpXGXKxTfI0GGB3I9m9eCyTDm7IC9hVhYbEN8b1tP2vaOkCJC5MTlUMKNbo13+Qj4QubWuqpzEosuxObOpppxjzQ75iex/95KCqhpfVubVVROEWotnRSIk3RZviA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=d6UpUd9yyKwF5dVgltUuKkugUuKM24a5sAlTMF8TBE0=; b=ajeNiJ7fFOYYFo9Q5BcTsNR/+TCKhfVFM52uCtEdN/gRPePuJik3pDQpfbkXMXIYcvFotiBcc87BVY8YwVrVKphWYsIpi8Tzxfr8W3hOz4Gc0hJz/eVB4igfM3+GspnJ92OZeKtIUAojz0zIUwkirL7GYFEzEbfkti9CmHKzXhmUPHMO77iAbnRHEhbqEAk++772gH0sp4vPICI5IEq+bvfm3mgq8w5SwY4TWYe85V151uZJxBzk840cl99uVHvpmNYuiXYaaUwF8XxwbQFVL428CkN9IEA31VO9LgAojgP6Wv90dDwFU1NAHQlzvr9zcQF75U2JEArlY7Bbon1NPQ== Received: from SN7PR18CA0010.namprd18.prod.outlook.com (2603:10b6:806:f3::9) by BL3PR12MB6402.namprd12.prod.outlook.com (2603:10b6:208:3b2::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.14; Fri, 3 Jan 2025 06:04:37 +0000 Received: from SN1PEPF0002636C.namprd02.prod.outlook.com (2603:10b6:806:f3:cafe::5e) by SN7PR18CA0010.outlook.office365.com (2603:10b6:806:f3::9) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8314.14 via Frontend Transport; Fri, 3 Jan 2025 06:04:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SN1PEPF0002636C.mail.protection.outlook.com (10.167.241.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.11 via Frontend Transport; Fri, 3 Jan 2025 06:04:36 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 2 Jan 2025 22:04:28 -0800 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 2 Jan 2025 22:04:27 -0800 Received: from build-va-bionic-20241022.nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 2 Jan 2025 22:04:24 -0800 From: Vishwaroop A To: , , , , , , , , , CC: Subject: [PATCH V1 2/6] spi: tegra210-quad: Update dummy sequence configuration Date: Fri, 3 Jan 2025 06:04:03 +0000 Message-ID: <20250103060407.1064107-3-va@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20250103060407.1064107-1-va@nvidia.com> References: <20250103060407.1064107-1-va@nvidia.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002636C:EE_|BL3PR12MB6402:EE_ X-MS-Office365-Filtering-Correlation-Id: 74809e57-8ac4-4806-1576-08dd2bbc8091 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|376014|921020; X-Microsoft-Antispam-Message-Info: Tx8jC+ZumRFkmcBTfqctk1Sfii3jSl4n4pusxiYIEvsqxfPYQvOcMDq/f/Te9xhJtajP/1HHqZcuwSczY6UjAzT1l94uz8P4P86zoyjrLaVlrldGG+5hHSJsTk9M17NFZlzKEBRmjYMK49fbBXHzucSSK5gVxpxQgmAlyWXPSROakt8iyqmvBnYdHW1j2I8gDXYlC7VY4JHMoWrXNeNN1NjaqRlaFkVbU+iiRDNf+Yp1j1f/bz856CX9FZ+AluTz7fC7oXg7S2qD8gqgtZiEjFG5LhsqqEsOYTn9+YDtgNXO6QGL1PdoMK3DsR70ph0biIkJZXZ8xkUtNhYweu52WnNqSRlgBAhFTYlklPeF0XA07mGVq6+nlDyhRYmP8a3y696B24RMbunAjIRtku/FK8GgPjoXNZO110q6mlA8Y2fbtJQWu3Ox+j3pmtQ2Pm4sK6nPYRQwZgS+jgBzevM2kxJoMAbMW82YVeSP4csiVMOafVZPuuMYQYsgLe18Ywx2wrFnhxQquTXzWDPasc+ZyvziaW+57dPUDepQBfIUFxKPxEljOCKG1d1cg8kLoGXooEBUEVlfpIj6lJyoXODRtPsS+g3EbSYEgxM65/B4kwEkhFJrDUdDeE8YQN4L5vLM4/nbzgLQ87ie1DhKUAo5eRTqzg06I+p31URHmzpAWF5meoxc8YDKlAu+TLSFDpQri50rOPAQD0KpAV8gRgaTj4PbMtVtfYYFtIlnV/L8cpHtW2lIYzHv8JooMe213/QG1/tlBjJEJaEjgJ6aC/hsIAaW/U4A0AFBTKhotxFAklC4jTW4y5d1wEo/Z+e5IKNuDyTxnVjTAuQPuUNq24Mja7qT46kYBQdkNkU1JSwURMf8LgmxDw/QNqWWCdFsYGAdx+xmcmFa7jdZPs5slYhKvF3E4rHef6Whk/Re9/6DCWHwfbuSEQzectDwGO5gsx70vwMMv2UK9/IT3zKND0cbWBDCRCVGoo+i6DXCBmG01OssJnJe6CFJQkojjqBGVhzr2HBYpcljjoh6XxqzCKPumByhANyo2w8I17HKIYUt12HUlYI0tSr5aHH112rOgqAqfeGCRjbYVPRWzPhpmO1xWq8udEiJQo1lR02yALUwO2t18HBeob+pFQMRtDrTl3t4cyXDk3ZUL8M9CMy/lVljUbm1JasvXZzYlL5xukR7UA8FADU4Td/6yUTk8+wbVEVpsisj+c5fpiD9+ZrzQmGZFWQx9mWc6wi9zvHyiY1xJcluEAjJdKNUyOer9UAptYrQKutAQ2gGi0wgQFS9ANdFrohDrkg7p4ka1SZpM4ch6s2e80pkUfDd39Dd9OzioGtTwKmhFGYUlKZ6Q89VYJ1WhdB9U2QxZeVDDOGLEjRFoY2DlYdPBKWG7EA7gUJ1CUt/EAzGWVGfZrFEd8fqvZX20foQWA5Rrp5rpFQtius38sBCzrxgw25k/jxwyMh/ZX7gBzIf/fdM3O11aGd2RMmrh07CFG6cmlx5SoywKmUuiUQ= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(82310400026)(376014)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2025 06:04:36.6066 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 74809e57-8ac4-4806-1576-08dd2bbc8091 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002636C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6402 Adding support for the dummy sequence configuration. The dummy sequence introduces a delay between the command and the data phases of a transfer. This delay, measured in clock cycles, allows the slave device to prepare for data transmission, ensuring data integrity and proper synchronization. Change-Id: I4dc347a247830452754f83e88aa95a7d231722cd Signed-off-by: Vishwaroop A --- drivers/spi/spi-tegra210-quad.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c index 08e49a876894..02478e8efc8f 100644 --- a/drivers/spi/spi-tegra210-quad.c +++ b/drivers/spi/spi-tegra210-quad.c @@ -22,6 +22,7 @@ #include #include #include +#include #define QSPI_COMMAND1 0x000 #define QSPI_BIT_LENGTH(x) (((x) & 0x1f) << 0) @@ -156,10 +157,14 @@ #define DATA_DIR_RX BIT(1) #define QSPI_DMA_TIMEOUT (msecs_to_jiffies(1000)) -#define DEFAULT_QSPI_DMA_BUF_LEN (64 * 1024) -#define CMD_TRANSFER 0 -#define ADDR_TRANSFER 1 -#define DATA_TRANSFER 2 +#define DEFAULT_QSPI_DMA_BUF_LEN SZ_64K + +enum tegra_qspi_transfer_type { + CMD_TRANSFER = 0, + ADDR_TRANSFER = 1, + DUMMY_TRANSFER = 2, + DATA_TRANSFER = 3 +}; struct tegra_qspi_soc_data { bool has_dma; @@ -1089,6 +1094,13 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi, xfer->len); address_value = *((const u32 *)(xfer->tx_buf)); break; + case DUMMY_TRANSFER: + if (xfer->dummy_data) { + tqspi->dummy_cycles = xfer->len * 8 / xfer->tx_nbits; + break; + } + transfer_phase++; + fallthrough; case DATA_TRANSFER: /* Program Command, Address value in register */ tegra_qspi_writel(tqspi, cmd_value, QSPI_CMB_SEQ_CMD); @@ -1300,7 +1312,9 @@ static bool tegra_qspi_validate_cmb_seq(struct tegra_qspi *tqspi, list_for_each_entry(xfer, &msg->transfers, transfer_list) { transfer_count++; } - if (!tqspi->soc_data->cmb_xfer_capable || transfer_count != 3) + if (!tqspi->soc_data->cmb_xfer_capable) + return false; + if (transfer_count > 4 || transfer_count < 3) return false; xfer = list_first_entry(&msg->transfers, typeof(*xfer), transfer_list); @@ -1310,6 +1324,13 @@ static bool tegra_qspi_validate_cmb_seq(struct tegra_qspi *tqspi, if (xfer->len > 4 || xfer->len < 3) return false; xfer = list_next_entry(xfer, transfer_list); + if (transfer_count == 4) { + if (xfer->dummy_data != 1) + return false; + if ((xfer->len * 8 / xfer->tx_nbits) > QSPI_DUMMY_CYCLES_MAX) + return false; + xfer = list_next_entry(xfer, transfer_list); + } if (!tqspi->soc_data->has_dma && xfer->len > (QSPI_FIFO_DEPTH << 2)) return false; From patchwork Fri Jan 3 06:04:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishwaroop A X-Patchwork-Id: 13925189 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2066.outbound.protection.outlook.com [40.107.93.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 141FF1B4124; Fri, 3 Jan 2025 06:04:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735884290; cv=fail; b=SaHREp6AH9ERY4DBxZ0aJhGqv+LMLKYRL+3TK/RUZAyahwTeDI9BI56tvzIB9vAwt+fcDaQ2qHZLwUSNjjebOJCpdzStLhBmIHqZzKh/KFT3DMCVZpK/slxDnhzcHkZIJxqmbvJdab5ga88iHZkw3ae7FMbO+4pvYLJDk8ya6gg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735884290; c=relaxed/simple; bh=KOH9o5FYZ3j/lwFhcwvmtGP1MCMkiLSCap3GZOxnc5g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dZS1YzfqZ0U2/XesYbkTC+Rnj53Vxn1bZsoh/Zrkw5dgE+kr+y3wriNb3O5SJqtlQ6X8K8MqcPHcGLybg1v45Rx9fdubJuFux9CGeMuuh/1q6ziRlFF+dMXA5i6PFrOPanv0ckd0kREvsXPNFtTrkI4sDKZtoQyao2prKuEA4aw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=L+clIyrb; arc=fail smtp.client-ip=40.107.93.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="L+clIyrb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=M9garhJXdz7taDCQZLq45nOQS43M57liYZjQU47zLiEJ3RHI3oCDvAg7dYakWbt/K7LqeDP/zgnRSbRcESZyx571OckQL886SoqPkel3A9fZWwa7n3gzGI3UnKvxZ74gBhgaHV6LlWHs51ckT5oDOgrbqY4yIGOE3c+nlVhojCaaLQhbjsb0L2zX8e0iHN6h+8hkcmxinblaVxjU/g5pk79dB9XTk88lNmQIIkWQdJRP+WxtCF3ULK3RIAUQRySXNecavZqjp7BunqlF9igDd9JTkrgM42WXhZj0+lTI1M5EgKQTdqAZJ7EJYxa/f/IenMmX5PeocjLYE/Kqoh0pIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=EB51yNRAkrPt03eMcukh6xKxNS9Q17pKsiplGGNdpvc=; b=NA6/9A5Uam/FQ3niBp35jBzxw8bhSqUu8EMSv9AtXC4CvKqNGrTii+VPGYzrzBk2cIV5Qff/FqcJy0j/LszDVN+vUIaB/2KPLAD/QNdHYPwJ//rQqtN7Vawd17OCi+Pf1gn3jdG7OCLIL0Kz9YjUbnYJUnXKHNlo/OFOTg5hvAmLYxKp3fyJ9/NKnpaeZP2ysALWKxvOE1/HpF4GDcKqzcDj2nwbeFrKZPnspNmoDTV0Cesyo+xiszwJDrZI5tnzNeYYCB2isUJPK9inpq8JvpRWY9MJvP2EjHcxYg1IddWQb5wCx/uL47exSrjCoHHBFckkYwDPTS5TH4P+Vs8bvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EB51yNRAkrPt03eMcukh6xKxNS9Q17pKsiplGGNdpvc=; b=L+clIyrburfslp0YM2lw4jWX6KFdqHtPHxHWVDmT8rMfUwRTFTRglfUISBVehtcms1eJMiDwY9Dn9Fb1/emNi7WZvlLXTteM8C95wLKTLelYosKgePHTJ7un76cRgkP8JZkQbfh8Otgnwmum0uVSlqZGu4Rm0ElpXACPTw4n2wqt7KwGT3I0Z+jQbOvN2V9P+Zfyc060GcoCZ4ROTxH5Ph8upfFsGvPpQUwLthZKaxHzZv3V2DzHjJ6xSku5RZB3G2qubXKJwtWeT2522wsAti6+wF47Ge6UKCZx9mjQHLN1b6PSKmmShkXXPw1mFNlpa1uR8pC8uF6ZAsiP0HEoiQ== Received: from SA9PR13CA0019.namprd13.prod.outlook.com (2603:10b6:806:21::24) by DM4PR12MB5937.namprd12.prod.outlook.com (2603:10b6:8:68::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.12; Fri, 3 Jan 2025 06:04:42 +0000 Received: from SN1PEPF0002636D.namprd02.prod.outlook.com (2603:10b6:806:21:cafe::da) by SA9PR13CA0019.outlook.office365.com (2603:10b6:806:21::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.14 via Frontend Transport; Fri, 3 Jan 2025 06:04:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SN1PEPF0002636D.mail.protection.outlook.com (10.167.241.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.11 via Frontend Transport; Fri, 3 Jan 2025 06:04:41 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 2 Jan 2025 22:04:35 -0800 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 2 Jan 2025 22:04:34 -0800 Received: from build-va-bionic-20241022.nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 2 Jan 2025 22:04:31 -0800 From: Vishwaroop A To: , , , , , , , , , CC: Subject: [PATCH V1 3/6] spi: tegra210-quad: Fix X1_X2_X4 encoding and support x4 transfers Date: Fri, 3 Jan 2025 06:04:04 +0000 Message-ID: <20250103060407.1064107-4-va@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20250103060407.1064107-1-va@nvidia.com> References: <20250103060407.1064107-1-va@nvidia.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002636D:EE_|DM4PR12MB5937:EE_ X-MS-Office365-Filtering-Correlation-Id: 20a0e492-0892-47b5-ce4d-08dd2bbc83ac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|82310400026|36860700013|921020; X-Microsoft-Antispam-Message-Info: bcOcTbwh220Ku3JmUsjyJgHZVlpsHSPQ0PjLuvbc9U1AwD+GxgA+hM1mzbSOuaccTiEK0xiNtSY9Vqi2MBWfFpo36+NogN1CTHeF7QflBI6cMsdQvG/8FRwAniBiCM1s88VZY94j5UOBqS+Ocp8eW83gsXEhK8gFqJSW9rQSsH6V1pJKbE0wMi6IAle+bqOCSaKA5i9PR9x+B1TBAfE3FloKjYhTEbA/XMWJfuPZA9VD0Q9fJxVdL1wtsWLK37TFGowFgKU1BltITq4L6l1lzdqd/y9fIKtQnGYdpapDIAnldPl1iWXzRxAjd5hGK7U8QLxrV1frDL+S39ZallD+GV4gusj8XgNvNVo2KmQ7OOIpALkck7NrvlbhoFNa3FN9k2UF2rTX//Rx4P3vfTWx8oKhz+xNGaMoB4Js3APV1lP2Qdu25SxrYpOMfqvkU2XrnqESq83U5brpt6j7vb9CeFTTqWxZTG5WGf+sC4LpEFGA2sfXxLKIQt1olUl50eI/jruY33O8h0Rhr4fJv9+pcniMXJSNMe1yocBm9BsiuhzMDnHemjeHmF6U76bbk1C+f8p6vCd72mPTf9bOYfKaLgEwpR/uAAmtt64QMUBnRp4WYW67bSwp+0MF1mo62GMIqTfduumxMpoSSfR0+FGtRHIcOurWHPVyh9/AB8dWVzP1V+XjWn4+KVpoY/tTAyZdINq26xWDL6s0RZN8aXQbaH2oiHaPI681HsliE8zaEzH0STGpdKSSUW4QrpgFrkrDVFtglZd6XShv3d53UfB4ErNGyqV+sgp6U+nfqQKZQ1GRFkEuar5IAFzjt5km99AjDJe3uWzSkSz5eM72ZdP2FhuT0mPqTlS65vbGc3T3qtTfIFVQ/d2Gd2s+0RKzMNlxSSeG0+R7ZGhYDoaGDUJJlORdxMsYf8lAvEXpVnOOTXbjFC7TAV/sF5GH7UXl7wgxg+PNkeNCVQ1Ii3YUwloRKiudKZEydr572NMKP21WUitbk1Uo1iB3Chql6XUF+ajhjDjkqXJiz0uIzoWzwrY/+/YshVxCqyLQFYqg37E+jvfmGWHE2YUOp92LbmmMi0JlQG/tjiss/EzAleiD9JvftqgcGYEU19ErAMeHZyQJPevwAoBLi9dF9XbXxfukMMtiJIkur49JBAmFiIrktB+XcnmwxklaGjGXeuDFXIkRVxaTJhJw4x5jxTaWktAMHeWKbWu2nXV7+V4H0P0oe4uCtT/f6oIRa5fzij/E3LPgndF5/PS1VJt/81gsojkv3Y2c3lRWaKzda/6WXbr9wMvvKsoelBJL7vbL1HCN5vQIIlaPkPQbLLDRAvjUq9DKXXWCtihC38wC/mwOGWmADMFHGbxNvWDf1zQJeMx+zGb/aHi2nIFGnQTxCGdr9uLVdJWpgC9KdBDBEL87GPXotrjM5XcVMXA5vsf6/U6HxROeftmo3klx7JZ82Fa5KllRlWFkYBOxGCjz0Ouv8uFlESS7K5I9wgMNZ4lZHPNMmMxId2k= X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(1800799024)(376014)(82310400026)(36860700013)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2025 06:04:41.8214 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 20a0e492-0892-47b5-ce4d-08dd2bbc83ac X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002636D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5937 This patch corrects the QSPI_COMMAND_X1_X2_X4 and QSPI_ADDRESS_X1_X2_X4 macros to properly encode the bus width for x1, x2, and x4 transfers. Although these macros were previously incorrect, they were not being used in the driver, so no functionality was affected. The patch updates tegra_qspi_cmd_config() and tegra_qspi_addr_config() function calls to use the actual bus width from the transfer, instead of hardcoding it to 0 (which implied x1 mode). This change enables proper support for x1, x2, and x4 data transfers by correctly configuring the interface width for commands and addresses. These modifications improve the QSPI driver's flexibility and prepare it for future use cases that may require different bus widths for commands and addresses. Fixes: 1b8342cc4a38 ("spi: tegra210-quad: combined sequence mode") Change-Id: Ic650c919535a99aa02f52c25e2a200d1b301381e Signed-off-by: Vishwaroop A --- drivers/spi/spi-tegra210-quad.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c index 02478e8efc8f..43d6587fad09 100644 --- a/drivers/spi/spi-tegra210-quad.c +++ b/drivers/spi/spi-tegra210-quad.c @@ -135,7 +135,7 @@ #define QSPI_COMMAND_VALUE_SET(X) (((x) & 0xFF) << 0) #define QSPI_CMB_SEQ_CMD_CFG 0x1a0 -#define QSPI_COMMAND_X1_X2_X4(x) (((x) & 0x3) << 13) +#define QSPI_COMMAND_X1_X2_X4(x) ((((x) >> 1) & 0x3) << 13) #define QSPI_COMMAND_X1_X2_X4_MASK (0x03 << 13) #define QSPI_COMMAND_SDR_DDR BIT(12) #define QSPI_COMMAND_SIZE_SET(x) (((x) & 0xFF) << 0) @@ -148,7 +148,7 @@ #define QSPI_ADDRESS_VALUE_SET(X) (((x) & 0xFFFF) << 0) #define QSPI_CMB_SEQ_ADDR_CFG 0x1ac -#define QSPI_ADDRESS_X1_X2_X4(x) (((x) & 0x3) << 13) +#define QSPI_ADDRESS_X1_X2_X4(x) ((((x) >> 1) & 0x3) << 13) #define QSPI_ADDRESS_X1_X2_X4_MASK (0x03 << 13) #define QSPI_ADDRESS_SDR_DDR BIT(12) #define QSPI_ADDRESS_SIZE_SET(x) (((x) & 0xFF) << 0) @@ -1041,10 +1041,6 @@ static u32 tegra_qspi_addr_config(bool is_ddr, u8 bus_width, u8 len) { u32 addr_config = 0; - /* Extract Address configuration and value */ - is_ddr = 0; //Only SDR mode supported - bus_width = 0; //X1 mode - if (is_ddr) addr_config |= QSPI_ADDRESS_SDR_DDR; else @@ -1084,13 +1080,13 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi, switch (transfer_phase) { case CMD_TRANSFER: /* X1 SDR mode */ - cmd_config = tegra_qspi_cmd_config(false, 0, + cmd_config = tegra_qspi_cmd_config(false, xfer->tx_nbits, xfer->len); cmd_value = *((const u8 *)(xfer->tx_buf)); break; case ADDR_TRANSFER: /* X1 SDR mode */ - addr_config = tegra_qspi_addr_config(false, 0, + addr_config = tegra_qspi_addr_config(false, xfer->tx_nbits, xfer->len); address_value = *((const u32 *)(xfer->tx_buf)); break; From patchwork Fri Jan 3 06:04:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishwaroop A X-Patchwork-Id: 13925190 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2062.outbound.protection.outlook.com [40.107.92.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66B571B140D; Fri, 3 Jan 2025 06:05:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735884305; cv=fail; b=bAt6JMl3pp5bAvCB0O9NkxxV18Ewr6x72VT5KxRGKV9JvNUTLLhCDeHng+7e4sYzZSYUICMPDJMRLqN6Rk6uTUPC2jFioZVD0/OB3IyTd3xY3VyHat16iAJnGvZMRjPPgUazPWWBf8EAFOhJ9wZL7Wzu9P58VeUQK2IzbuDSM+8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735884305; c=relaxed/simple; bh=fjFZXacRjlO46ED7wsWdDLW3BUe4m8VXI4rQx6OOkOE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pGzxY89SpYPJ7WKn4xGwqZkuGe5kQTwZIrM82MRr3+k4hoLcFttfo6iizQuqemt2TSlJ8IRKibWTkVByH73Uf2Y1W0+byYGltxXHNlHR0zmmCPoFlVifliigPN0F4KBLcJBgm2WTxUlHc+V+wNMseXKr7QQnn9dpgtkw8rcl+SI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=Tkk/VZlb; arc=fail smtp.client-ip=40.107.92.62 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Tkk/VZlb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LefkAeqckosZBNYhkAfA7iHroiftvpaMkx+NPNZE1HMo3agFR3KeWQ5o/+lQZwODIbiDrs4ZHCMNvhkF1zoq+XWGZvcxVB8iEWFpgXeCc/niUC6mkt2xIiEdG1rOdbjknhjfhXYEmyUTnzXczxAEty2fF97xLsHqR2XnO5XuG5JXS6vHNpBVAfVloSuqrs8PCYtClo/ewp6mEIG300jWdyinQDHuPWYVz6ZxHVuc2fhD99XnNSmaHuvuZfA9PFoLAHc8jyx2x2GHpxpSGHZeGtVRkjoJatfb6lV5hCGewC1Y038Qsdo95mmBVsx5bZusUQEuV28B/cH5L01owQ44uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=1TKqPKRKHFV1ybDnw3fWZCMmtWrBHiBlzsYqDrfmAws=; b=RV5ZuiUaRLLeiv/GbW8lpIsI+9vhwiSLLoNK4usWoE8Z0FIZN8OHu9xH+G41e/vxhAvFrc9BY9v1RtNLirHFk/S/fyytOt32vTALrX0OYcQGyeu2ZRDYkkogkOyBLfLX0Se0IhXQZOIRv6twzMpUiDjYLR617Xq8VIbqyYuADqjnKK7pmyyZaFwWiS8Mg0YYD2LtsebU/zeqi8euEOFYRyYYHN//0X8KJUoqMW0YDNSS6me+a27EftH6E5o0ZVvgZ9ql7BgJrTFscdgZJ8/Btb33PZOsWnnH6nuXdGNDImPjodEjfKK2zAk52VzMY7HnNIv55jCs86IRJqqghCM6tg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1TKqPKRKHFV1ybDnw3fWZCMmtWrBHiBlzsYqDrfmAws=; b=Tkk/VZlbHX7vReUtubeELHRZTqm3SvWWUtEQS+Qt5UZIn8mkeXtDJbKPubT7d/dFTus9QtHJike7KQCffWIzbMa26XD3u6KZwRZDK2trdgE3/M9Ow7g1b0ZDtzstr7Bl02Rjhn9JCgTOtTZPfPfmDBpF+q89qp3bZ/Xyhgwrn03+xymHjm+LAhf53iTHrL7EfjD6qROYfcworJzbQzEiTl54tyOgiLSHNudshjj+f+LUGAvjAHTpZnhB0XIqPvYS73/noHVyDZhT93MI/PXMRq1mwQiLf/0scQWmkxnLiXJOvm3sFsThlyHfKYmdM02ATPc7QS6NtNy356Lxy31dmQ== Received: from LV3P220CA0009.NAMP220.PROD.OUTLOOK.COM (2603:10b6:408:234::18) by BL3PR12MB6545.namprd12.prod.outlook.com (2603:10b6:208:38c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.20; Fri, 3 Jan 2025 06:04:55 +0000 Received: from MN1PEPF0000F0E4.namprd04.prod.outlook.com (2603:10b6:408:234:cafe::fe) by LV3P220CA0009.outlook.office365.com (2603:10b6:408:234::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.16 via Frontend Transport; Fri, 3 Jan 2025 06:04:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by MN1PEPF0000F0E4.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.11 via Frontend Transport; Fri, 3 Jan 2025 06:04:55 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 2 Jan 2025 22:04:40 -0800 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 2 Jan 2025 22:04:39 -0800 Received: from build-va-bionic-20241022.nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 2 Jan 2025 22:04:36 -0800 From: Vishwaroop A To: , , , , , , , , , CC: Subject: [PATCH V1 4/6] spi: tegra210-quad: remove redundant error handling code Date: Fri, 3 Jan 2025 06:04:05 +0000 Message-ID: <20250103060407.1064107-5-va@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20250103060407.1064107-1-va@nvidia.com> References: <20250103060407.1064107-1-va@nvidia.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E4:EE_|BL3PR12MB6545:EE_ X-MS-Office365-Filtering-Correlation-Id: 9957d9db-8809-4229-40af-08dd2bbc8b94 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|36860700013|82310400026|921020; X-Microsoft-Antispam-Message-Info: SC2s1dzawXLpZRnS+TjsBMh0JzPJqNd/qPjj0xOiRwyhzyx9ib0QPYDCXY0+zh/5JzmbsLT4nHhUZ0rivI4eTMIsIA5taZhH1mkiZccnMR2Wy1Z3rNnld6qUKFELdLJAj5XCT6djX5tttXJzdiWk6zbjiuH3RQBlg/++FEdVj0K32CnaEN49mRiiSCGcqQnC8N6DJq4fs6xI2jAMONm0Z7NSMkdUlo2koTbMXH/W/yqJ1iEjoZqApfSyOMlUnT/XOKHFrueQlCaEGlPFkhfDPVoyimPBxMTT+3lAaNwO0UVH2MbTrHKDeV+kG/qMaXTgrcFqJfoocGK5FOu+i0PvoWaKlCMUibOG7LPZGAZ52YTUcYxo7syqvBmEpsokpKx+QrTsS+OLO9gQmSGHowREtPUFOcaUT9ar8s+GPU+Ft3Sc2F/N+xZIWekeqUCRAXYppSVmE3wksDTvntZlGGHUfN8GkZDelWADzJ2pIfDCi/VFQyV/q0cUTdFFDiIaAGfSbKzkcGDqgpUEJOobAKrGUvkmuCBQxLsObuDRlFvLyx1+nJurw1E3caxxsh7cvEzRi74Cem0j0manHnE1SPh9bimug8ZmmFHpev99cj32FwkOLqB/A4OdrKKF0odUIBxJ7cJzKrQalYDLz6cpoTJjB1uqTOA+svEg4xiWMWyCoPEU7WPUuPUUHgZwmHj44AFrKvftJ7blS9dsiFVEzrek2nnQb0eDY6Fty9hQJV33cdlCLXFwuFud12SNeoaThEEdeQwaRNFPpH+pu1XuLzOqRMB0pygA82Y+8BIJ1RDzkERCF++a9VOEMww2yoYfectfzkTGLSA1PDY4ibsXA671dlIdmOqmHCbfsfoJrO2/V6CnZd0DbRrstRmcShmmDzkbWUvZ02iIUaQ1WVRA5+AHjzBq6EI4se3SFpNWoK1SxaKIlZ1OREEUfrx/MJ5GwbJMwLtZrZ7k0DIPbQrW1SMRFrcpqR4lCYdU/9N1i4mTZwrPWEvCXuHRoQzqk56MZdhE27Gi3SrqQnyIGG9MmdSA5qSkRhjBF9XMcGJwtuq/8281za14rrv6la8lWLPPRl2tnJaAMxYLuAHP5kYyKkuNd20VHoMxaai87hXEJW9oObTuOlLvsB7BsW4omD/dUe8b7Oye4Eem+zKhJTRWSrM9jrnV8gS0u9sASOtQnPhkvVdkKz4QPT8ObWD/+g09L86RFm/dEPmgKJhhx4UWbrg1I1j8DXA983LFB+K6xOLxwph2Lf8vSUFoEcEDLXy5O1tKzHHnD3BHDP5yRBEyVVwWR9d7kh0rS6sZaCXurJTr23E/EgioZOQaLVVXLskgOSBkEbBugOE6I6bJwVpwIG0OlVxP7BdnRdvjrahM8JcWdhR215DEjrgHFDo2b0SRDNp7tyEZ1fQeWHfuzj3wXzF2/hTgPvYqzbo1UfJ4N/6wVKvUxtm2nIfffhIrg2KyEfGH8ULSlOBT3xD1xaIlRfJc7mx72j1IbIqfLjhjF0XAVRk5wcOx8AAZxIYg+r7Th+0F X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(376014)(1800799024)(36860700013)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2025 06:04:55.0042 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9957d9db-8809-4229-40af-08dd2bbc8b94 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000F0E4.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6545 Remove unnecessary error handling code that terminated transfers and executed delay on errors. This code was redundant as error handling is already done at a higher level in the SPI core. Fixes: 1b8342cc4a38 ("spi: tegra210-quad: combined sequence mode") Change-Id: I9e77732db64d7a1674b7e87048c7b59d8dbab645 Signed-off-by: Vishwaroop A --- drivers/spi/spi-tegra210-quad.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c index 43d6587fad09..2d7a2e3da337 100644 --- a/drivers/spi/spi-tegra210-quad.c +++ b/drivers/spi/spi-tegra210-quad.c @@ -1187,10 +1187,6 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi, exit: msg->status = ret; - if (ret < 0) { - tegra_qspi_transfer_end(spi); - spi_transfer_delay_exec(xfer); - } return ret; } From patchwork Fri Jan 3 06:04:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishwaroop A X-Patchwork-Id: 13925191 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2061.outbound.protection.outlook.com [40.107.102.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 358001B3930; Fri, 3 Jan 2025 06:05:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735884311; cv=fail; b=NYoZLHslLxeU7bjbJHjqLRdCACcjqkpzqonzMTwR/YJTKIoKbzFrysLDhm43rrv7VV0CA7XxSpF7YJMEq+XuwBjr39/GttUiQ8TB4/XiLQcSnux1lr1TxHSy8mul9X4IDw9mh/Cm94OeY2qJ9sp52bFH1lELWl0EPSOaOzWT13s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735884311; c=relaxed/simple; bh=eGSKwWH0gK+SWfM/cKFHxW8nmCht+Kb1D9ADG3gAPj4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JK5dFbs/QU6YJVbL1dtyPzYkGzWUrIi7bEDZoNeUdczV0sfGDVvnk44waAMefAV5cUvdKX00b/iW743bAt7RuMcsTdXlqxsrTFmHoOEjG569OcwwTpSm8z4qtzldJg0sK05wlYaa8FPro0/R/2PK9vLATQDa+chiXklpPvVTr3A= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=DJN4w1bN; arc=fail smtp.client-ip=40.107.102.61 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="DJN4w1bN" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sEhqGNvLkA+hgzf7M6YuIb5+rcdWISeBlLmnYrFXh5mViVaugvsAiUyxTkc55JcmHvjRcJFg5A57ry2o1bLjR5TbyR9jqBflvwnKOyQYx//Jiwj7QPAvKkkRyLHu0o6COgSDUx5PeNaclFPdgqG1mIzyqQa8+qyB6LsALeqHjaXw+Xy4rCIskE+TPJhjpe5iesUnPLEbDu+7g44X9dZvgM0kUMFSkKU4xFTcwuW48qEaayDcvuQAkrIwvQkuhkCIsGFVQfs/dTtueSHwlKwIW4GyH748nJgmjXSz82odVBQJysCQ9nzNJ1s4U0ZhzyONKLRL1aUIIV3YyX/BP6h1Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=fygm+Bx9ew+rJAmIl57Div+wMoH33N9OM+SZQZH5hqU=; b=f+KJM1XpZGpikbU20bgdttoAUUT/54wgtQuTQSNSzAwtG4jBRQIxcn35pH0E/4VrxwiPI8xtZF1b2bKQQeqDfwbfH2VFHv5QtqdDFNULdWufEqIqw3a/ZqwQ8a9eiQS1Xuhi3Xp6OQjOq7TjzCuLjP8LLnX+dIGcEeVnlhk6ESX01ERk/TyWQB0cXZeFh2e2br3Id+OFAgw0xcqPf9EFI3KZv+xQecfqHwqk8mvMOeyl94lg8+1LLPSqcgLoNn+4JAZmV3rrO/Xnp0nAbn8CNGdZ7nBdcOTIa9xruHA7VK8lBSExrLqXMSiw+1Efqo1ZWr0IICxvX8VL5zevqONM3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fygm+Bx9ew+rJAmIl57Div+wMoH33N9OM+SZQZH5hqU=; b=DJN4w1bNM4AjKgedbc2ZJteGea8WgD5Y4BIU9wAGPoa5UF7KI81720qRvjK5aMuuVk7YtL2naRF7nWCFCYmlSAMgzXcRXxlE/AMBVNTjZ2oSgEDY+S3Lsj0+W0kR+d/fk0c8n5Yl4kxPH5g7DMrrdy7/fgmEKj7gxfw4TNcB9EGCQOupjg5pllLTjwMIXRsx+256XSiu1hvLETLuQce7y9GMx1ETpHk7MBl3B+v+GVtsck+h9V2QSfvRUwkvzgF44+mAA6lQbGSAfxXEEBB2T05VHbig90r/2rpZLhWkUklTZeZGKfktCM56UcTZJng9brW2dx0HYisZ9eZn37Sppw== Received: from LV3P220CA0012.NAMP220.PROD.OUTLOOK.COM (2603:10b6:408:234::17) by PH0PR12MB7888.namprd12.prod.outlook.com (2603:10b6:510:28b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.14; Fri, 3 Jan 2025 06:04:59 +0000 Received: from MN1PEPF0000F0E4.namprd04.prod.outlook.com (2603:10b6:408:234:cafe::e8) by LV3P220CA0012.outlook.office365.com (2603:10b6:408:234::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8293.16 via Frontend Transport; Fri, 3 Jan 2025 06:04:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by MN1PEPF0000F0E4.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.11 via Frontend Transport; Fri, 3 Jan 2025 06:04:58 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 2 Jan 2025 22:04:45 -0800 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 2 Jan 2025 22:04:45 -0800 Received: from build-va-bionic-20241022.nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 2 Jan 2025 22:04:41 -0800 From: Vishwaroop A To: , , , , , , , , , CC: Subject: [PATCH V1 5/6] spi: tegra210-quad: modify chip select (CS) deactivation Date: Fri, 3 Jan 2025 06:04:06 +0000 Message-ID: <20250103060407.1064107-6-va@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20250103060407.1064107-1-va@nvidia.com> References: <20250103060407.1064107-1-va@nvidia.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E4:EE_|PH0PR12MB7888:EE_ X-MS-Office365-Filtering-Correlation-Id: c4bfc7b7-9df1-435e-779c-08dd2bbc8db1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|82310400026|921020; X-Microsoft-Antispam-Message-Info: sOanVymH8b1PYgmxQNx3jET7Zr/m2D3wqvp8OX/w070rJvsToHm/cWHClcW28xSqebBfqtLR9kJ5s2avIUV0URbAr9TFhJBs6Mp+kdNn2Ndb4mBn5FkZbuWllw0CrYkP24A5c/tCW+BdUhPLvh5Ef51TigZZbDGpb0rhedOIE3LIJSh0hrPfWOclCN2TiTuKi2hjvEzdETna6fXqhlv/29y3DD0qOJgGRk8xaR+wLRwhQjhc1Eo+8rcqFnbzTYWaBWLLV8PvTdV8wS5VEIM3ALuLedZs+S85fG0uf1dKfd9P9v6sVto5/qM6VVP+uLTr9MVir/EjSQ8aVWuMd6SPcYiSugCDm9p0FgxlmvEpP6/m75u87ZyT4g9TcQpR+JbMxVKTsEHP2ix6M1gj6ZGBQ1beTTah6JXysURHOFl3LkjBfU3aZ1qltohedDbQG4qKGpVWHRAtz3UN9aDgCzI1EBpDeD4+0o8iYOu5S88GhhL89jqcAYeVkqPlktYLFIn5HN4KFcASGB1U65M9vkkzzKLGiHol/cPTEqD70Tge6lZqATfMtrjvano1xoJJqIuE58MWg92MyMtiXpfkWkDHDG4P069TocWcwwhxmp1jKDtPidLQfGvoHAfvHfwwbutISGJWF8EpfIBqUzdE/NO9A3si8gS1l6WplJiFX0UPQIvwHBanm8YIQtsw1+MwZti3fSTzN5uD9ucSdqXw3bGU2E7qEazRoiMMO0b+xo8P5sRNa/790PXoHJ1U4CbOAVeIgVctf1CNBqluRSml/E0jgcSnRL3WIap1a9Ik3mzf94VUoa6hvH5KxIG6jUU6cUqSHi/lEM3nRSK7zr9aZUaY9N41WUvH1VNtFcBGoHDH7Hs8KGXyLv3EntgjYgaTXWMXJdH0ohpQPtu58agxav6YZDCon5L0vRKkZduo6JYIYFrGb5qoV9rwQCjBr8dTyIgvA1uxkFBUg7V6rsTpmzmvKCSRJrZ2/2J+z80qe//JuZLP5FbwwD9PltFktXlnFAkzybICI9MeS2w9iQaz814FP4s6yfIbKwGWwcDx70ezuO6b9rBhZ5gHuqRQ4ojXzpybsBE+hfgJ0z7eacC17q5L2cBhrQoM0K8PLXE1/Bq4QJqOz9O8xgDCYL1VLpish2q1jEkQLV60YjVIzmcKbf2WetAXJcOw5gIGoVBoJ+GWmH6jCLdVqox9w25bOr4hcIAnlGe/5k7qxrOIW3jPL1+pTbvhvwZDxrqWn0CyF0IhOEx8Kxo/hmROveF4ytgCiJvTYflojSK08DHGWHByIpkEd47AgMdf30PU5+JLzNaP5zuUtuFL3ip+OhSVxRZcODKuMQX8Z2sHYQl+ePREfn/p4Mqnjbit1ngjmh6/cpHaDYqall+QDSbWDVciSQ4hFXgnaCRFtYKjfUWhld6U+E57F8entkmfEE5YiC1I/XAMROlpnTD1G+5WhIDxZF3O9ceUv+rjz9AQQTGW0qipeIuVYHjlICtWNePdTp6d1YhrQO0j/AOXHRUb+d/VqnOXV/5i X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(1800799024)(376014)(36860700013)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2025 06:04:58.5511 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c4bfc7b7-9df1-435e-779c-08dd2bbc8db1 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000F0E4.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7888 Modify the chip select (CS) deactivation and inter-transfer delay execution to be performed only during the DATA_TRANSFER phase when the cs_change flag is not set. This ensures proper CS handling and timing between transfers while eliminating redundant operations. Fixes: 1b8342cc4a38 ("spi: tegra210-quad: combined sequence mode") Change-Id: I58670873bee222311e3c2251fad98d7f28cdca14 Signed-off-by: Vishwaroop A --- drivers/spi/spi-tegra210-quad.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c index 2d7a2e3da337..04f41e92c1e2 100644 --- a/drivers/spi/spi-tegra210-quad.c +++ b/drivers/spi/spi-tegra210-quad.c @@ -1171,16 +1171,16 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi, ret = -EIO; goto exit; } - if (!xfer->cs_change) { - tegra_qspi_transfer_end(spi); - spi_transfer_delay_exec(xfer); - } break; default: ret = -EINVAL; goto exit; } msg->actual_length += xfer->len; + if (!xfer->cs_change && transfer_phase == DATA_TRANSFER) { + tegra_qspi_transfer_end(spi); + spi_transfer_delay_exec(xfer); + } transfer_phase++; } ret = 0; From patchwork Fri Jan 3 06:04:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishwaroop A X-Patchwork-Id: 13925192 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2083.outbound.protection.outlook.com [40.107.100.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B38931B3930; Fri, 3 Jan 2025 06:05:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735884320; cv=fail; b=oCL4pnRyRVxp9T0scZ8vpvQVU/JKPyvwVci5zEgXvUieOaapr0K6Kdq715jPP3pXbBDeoeTKVvJ4MoQRRiTGeCtBWjJwl5lFb1kf/XdV5QqC8kpHwNxqVUpBoQXOtMeU5gIh35xEqhDYPHlA6sx9k96uzQN+S6IyceI5m3knvaU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735884320; c=relaxed/simple; bh=7fsVUHTnB9ufRAf1frFjvio3iWosoZajJE6m4uy6Tc8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mGFNz3JZDiKx1dS6VzCZ9s6oEAHKClCAsfdJAPmJS/TjTpjPZkzOLNU3dlSX5QZ+A22JBYoloNJvZGpH4h09PivqQHaCqdGb9dUq1oXW4lr9oigrmVo8f1bCW61btwFL6so/9sb7FpODt2to3BJGytTxoK9XWwlRQbTJsOD/G5E= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=tgHkgq5g; arc=fail smtp.client-ip=40.107.100.83 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="tgHkgq5g" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oZwct2NXHmB/bbDVM1Q2dCDQXOkpufWPrMhHEr7oWKYK6NfmsSOguSSxGOLb7+zhb/WbgchywlP4ejfMtZSRGsX1UhRYz9cyFk//d+UJzTEW3KWHRd8a06TCmRncIm7vBd+lW07iwO5niF7nRMhLHUGHXh+5GsD0dMEE+2JLUN5gfU4c+wGC496xPLvqZ2/0U8D6ZTO3N4SlStMD9TSm/jGcdyd8XbDH5oUY4R2ErVY0O9zmZDIC90hsBT3LaznafS4SkjsLMKvJA70retk6zFQh4nywbiPTf5QR8VZdV1QdJ1jokIzTFF+Ff+qgIFm3xPSng8tSHoNr5uN0BMNblw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=S6qVPy9nXDFZQ91ewpMGHL+gGXO9Upb0TeG2tGeBwaA=; b=w/YvdMui/G+tZDJswbgxj0b5k983/q3SkXxTOzgF3xlrYGH7UUghQTj5R2M6J9AKvYgfvs5y06aeG2nrTcOT8pkcrFkFMZCab1ID42bdgMxA9fNes/sirivDLDAP/lK7AqCoj9sYgBEmd+tBLZw2URXcJGb8i3MD+elnPOH6xxFYeQsuQueuecPu/KfiW9O4offUuQACFgrnhlxr4AX1HW3H6PnAb3MyLt4RK7nHeFQmEQf/yJR8S6qiXenssKqqYmnNeacehKdenmq6M8R0C3bI21DpQO2FETRwBHpY8Za8mB7qveiLSkB0jesUKjZqzUAAb91shRnA+z/BKPkEvg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=S6qVPy9nXDFZQ91ewpMGHL+gGXO9Upb0TeG2tGeBwaA=; b=tgHkgq5gk4EGTo+Iy8lV4mdBIc9J2uBeKwfdF6kI77sImuPV0UWB+dGXDyao/kenRv6NpV9E9YSgjLTloz7xQ1b9GrPy3qvNesZLoQKCDa1rCqWDl2HBzAKGMfLqP4kCFUISPcSMxFmfsgHl0HeX15pFRuhmQ4sBrC/p3e02dT/IpTASuHR9Ln3B1eEG5qcYUEfe4xEYupVtPNv9GOmf/3Bi2vpsBKvebI/N11xFt4xaRtXn9j6X89C2xZdx46PXneqJa/bgv1lWbdgPL+VEawqqcd+JGOJB9WLMP0WpN3ykbRjNG4Ezext9Gt/C0TmCRjjpFfAOn4xx6Ed/ntPW/Q== Received: from LV3P220CA0004.NAMP220.PROD.OUTLOOK.COM (2603:10b6:408:234::16) by BY5PR12MB4178.namprd12.prod.outlook.com (2603:10b6:a03:20e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.14; Fri, 3 Jan 2025 06:05:05 +0000 Received: from MN1PEPF0000F0E4.namprd04.prod.outlook.com (2603:10b6:408:234:cafe::25) by LV3P220CA0004.outlook.office365.com (2603:10b6:408:234::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8314.13 via Frontend Transport; Fri, 3 Jan 2025 06:05:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by MN1PEPF0000F0E4.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.11 via Frontend Transport; Fri, 3 Jan 2025 06:05:04 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 2 Jan 2025 22:04:50 -0800 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 2 Jan 2025 22:04:50 -0800 Received: from build-va-bionic-20241022.nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 2 Jan 2025 22:04:46 -0800 From: Vishwaroop A To: , , , , , , , , , CC: Subject: [PATCH V1 6/6] spi: tegra210-quad: Introduce native DMA support Date: Fri, 3 Jan 2025 06:04:07 +0000 Message-ID: <20250103060407.1064107-7-va@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20250103060407.1064107-1-va@nvidia.com> References: <20250103060407.1064107-1-va@nvidia.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: AnonymousSubmission X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E4:EE_|BY5PR12MB4178:EE_ X-MS-Office365-Filtering-Correlation-Id: afbe2ff1-5f19-461a-9e03-08dd2bbc9142 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|82310400026|921020; X-Microsoft-Antispam-Message-Info: J3B1V8ExPztcu5PlRo4/SLY9BcAOtp1ttWFvwgRwvGFOoA2kiqBd3sC0Zu5eotjdw4B+vJXf5Q2nzvxpk30xku7UVkjbxVGpWdSp2SjlRHrnPmn6e2/ea3jw039u7OJcVgWfPMTX8UuLwj04OsRnw8OR71wuOrxAteZo4M8AmdTRXEN8/mtTx+Hb41sp4fQgK80ZNIhLylG3REiud7NNhITdPbZ2cQ4SlChjX+M62g1LYnCUshpltHfRVxvs5PcKFPllxYbrYv0KC6nv6SkAGWRqYoJiMOcykg79SySGlwWXcl822U+S1LI9vw5X6rsUL6NnzotPxq2tKQBpuUa0EVL34vbSuAI5Z/XT2lelfMHqOILWixPfUDZ18b1dXtS+I6vhfJMINwsXbD3pn11GBatQaaT/ZdeT84iFNKsCdwVTzrX9lA0r2Nq1/wQ0EfiVAwvFx4+lRjFYCo033D2Fde++9iMXRQs56I2BYSnDuf5hEKNeimGZNxUoprlXpIp39c/X/0C6Y7LhkyUtGgFlTiJ8wfEqh5UD+tU0+lTcjcuclNR0V8pCpePUfQhgMa6hIhb2y6qMBTy45TcGON5xbgft/+a0jrsWduI7IWiF595bKg2Inv0EGqzvMxUQg6CYuikknsA4NXkVoQGr07/A2SrdK580g7f6i0XUSzXbet7lJMB7xrQ/qGUAdT4IHxZxLJ6VKJNw1AB/SSp3yVyzPOaf3nb1iY+fl6vQjFUbDYaEdviZYbDLlNcuauGYmijNiJbquImTSN2rfM73Nf6H8q8CJRxBG7lI/oY0XeOxN+RZLUJadsQpWWHxMbu8pJwn1z2fELlP1Aef44Wyzjcv1yXnl+7xk3SVe8hK2VBA6lIOLftWRfPPmPm0hJoTmufREJVDehvMg9PTgw6kd2DwVM9GUIDj7YYZBQNCQNu+cCT7t4uIjlHzCjN/6wDOoUuws8Ftyu8vZdFA7/hxxo81HqIW4nIODrwHn+CzuEOnRRdy67xhJ1Lxa35hFvuXXunvqUKLO09RnKPHOAV2KfCmqo3aUpaZCADnq3Is0cF8e1+7lMqE1Chq9kxGPpZnVDVkXK6ebSnPMvpwzRrhvz4FZmylg+3vG+3DVnML5XXIHFAVM+wiDK0bx2qKz7v9UzrGP2ocvcNZ7Lw/q7Bfj6BUjT8FKqsFNHxVGCP2AnyR8ljyd0c1Lb9Z9teh+9XR2/8zm6OLvY0+J5VSmKEt7rsPtuCBarhuS+QGKT6ZL2W7RmZkzI7cjugg2Bc/33y+TKBEI35MMmRthhA4nJ25UzRDoCAUXBe5dHSuTpXubooyDPECx34E9Mo+giyvw7UleCdxs4jylLRmnQG5pWhByelb9sYV+S0GkyjwiFbBWw3ij4YC1QS3QP76tCM63/Pk/Q/FHnrEJrqOEH0ux/3dBr0WxfQrGN0GTRlrr23n0wGiRLpa5/cO6F3oqlPfvkQigpf3Tui6CLxO0lbamiZIoE8gR2QkIIKeuzJM2XnLGMOWFCtI6sEfwPG2P+AmkpH+m51q X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(1800799024)(376014)(36860700013)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jan 2025 06:05:04.5355 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: afbe2ff1-5f19-461a-9e03-08dd2bbc9142 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000F0E4.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4178 Previous generations of Tegra supported DMA operations by an external DMA controller, but the QSPI on Tegra234 devices now have an internal DMA controller. Internal DMA: Uses the QSPI controller's built-in DMA engine, which is limited in capabilities and tied directly to the QSPI module. External DMA: Utilizes a separate, GPCDMA DMA controller that can transfer data between QSPI and any memory location. Native DMA Initialization: Introduce routines to initialize and configure native DMA channels for both transmit and receive paths. Set up DMA mapping functions to manage buffer addresses effectively. Enhance Transfer Logic: Implement logic to choose between CPU-based and DMA-based transfers based on data size. Change-Id: Icf3ef4767947cef67821c092ecd9ea6bccb2a4e4 Signed-off-by: Vishwaroop A --- drivers/spi/spi-tegra210-quad.c | 218 ++++++++++++++++++-------------- 1 file changed, 126 insertions(+), 92 deletions(-) diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c index 04f41e92c1e2..066caee85c52 100644 --- a/drivers/spi/spi-tegra210-quad.c +++ b/drivers/spi/spi-tegra210-quad.c @@ -111,6 +111,9 @@ #define QSPI_DMA_BLK 0x024 #define QSPI_DMA_BLK_SET(x) (((x) & 0xffff) << 0) +#define QSPI_DMA_MEM_ADDRESS_REG 0x028 +#define QSPI_DMA_HI_ADDRESS_REG 0x02c + #define QSPI_TX_FIFO 0x108 #define QSPI_RX_FIFO 0x188 @@ -167,9 +170,9 @@ enum tegra_qspi_transfer_type { }; struct tegra_qspi_soc_data { - bool has_dma; bool cmb_xfer_capable; bool supports_tpm; + bool has_ext_dma; unsigned int cs_count; }; @@ -605,17 +608,21 @@ static void tegra_qspi_dma_unmap_xfer(struct tegra_qspi *tqspi, struct spi_trans len = DIV_ROUND_UP(tqspi->curr_dma_words * tqspi->bytes_per_word, 4) * 4; - dma_unmap_single(tqspi->dev, t->tx_dma, len, DMA_TO_DEVICE); - dma_unmap_single(tqspi->dev, t->rx_dma, len, DMA_FROM_DEVICE); + if (t->tx_buf) + dma_unmap_single(tqspi->dev, t->tx_dma, len, DMA_TO_DEVICE); + if (t->rx_buf) + dma_unmap_single(tqspi->dev, t->rx_dma, len, DMA_FROM_DEVICE); } static int tegra_qspi_start_dma_based_transfer(struct tegra_qspi *tqspi, struct spi_transfer *t) { struct dma_slave_config dma_sconfig = { 0 }; + dma_addr_t rx_dma_phys, tx_dma_phys; unsigned int len; u8 dma_burst; int ret = 0; u32 val; + bool has_ext_dma = tqspi->soc_data->has_ext_dma; if (tqspi->is_packed) { ret = tegra_qspi_dma_map_xfer(tqspi, t); @@ -634,60 +641,85 @@ static int tegra_qspi_start_dma_based_transfer(struct tegra_qspi *tqspi, struct len = tqspi->curr_dma_words * 4; /* set attention level based on length of transfer */ - val = 0; - if (len & 0xf) { - val |= QSPI_TX_TRIG_1 | QSPI_RX_TRIG_1; - dma_burst = 1; - } else if (((len) >> 4) & 0x1) { - val |= QSPI_TX_TRIG_4 | QSPI_RX_TRIG_4; - dma_burst = 4; - } else { - val |= QSPI_TX_TRIG_8 | QSPI_RX_TRIG_8; - dma_burst = 8; + if (has_ext_dma) { + val = 0; + if (len & 0xf) { + val |= QSPI_TX_TRIG_1 | QSPI_RX_TRIG_1; + dma_burst = 1; + } else if (((len) >> 4) & 0x1) { + val |= QSPI_TX_TRIG_4 | QSPI_RX_TRIG_4; + dma_burst = 4; + } else { + val |= QSPI_TX_TRIG_8 | QSPI_RX_TRIG_8; + dma_burst = 8; + } + + tegra_qspi_writel(tqspi, val, QSPI_DMA_CTL); } - tegra_qspi_writel(tqspi, val, QSPI_DMA_CTL); tqspi->dma_control_reg = val; dma_sconfig.device_fc = true; - if (tqspi->cur_direction & DATA_DIR_TX) { - dma_sconfig.dst_addr = tqspi->phys + QSPI_TX_FIFO; - dma_sconfig.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; - dma_sconfig.dst_maxburst = dma_burst; - ret = dmaengine_slave_config(tqspi->tx_dma_chan, &dma_sconfig); - if (ret < 0) { - dev_err(tqspi->dev, "failed DMA slave config: %d\n", ret); - return ret; - } - tegra_qspi_copy_client_txbuf_to_qspi_txbuf(tqspi, t); - ret = tegra_qspi_start_tx_dma(tqspi, t, len); - if (ret < 0) { - dev_err(tqspi->dev, "failed to starting TX DMA: %d\n", ret); - return ret; + if ((tqspi->cur_direction & DATA_DIR_TX)) { + if (has_ext_dma) { + dma_sconfig.dst_addr = tqspi->phys + QSPI_TX_FIFO; + dma_sconfig.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + dma_sconfig.dst_maxburst = dma_burst; + ret = dmaengine_slave_config(tqspi->tx_dma_chan, &dma_sconfig); + if (ret < 0) { + dev_err(tqspi->dev, "failed DMA slave config: %d\n", ret); + return ret; + } + + tegra_qspi_copy_client_txbuf_to_qspi_txbuf(tqspi, t); + ret = tegra_qspi_start_tx_dma(tqspi, t, len); + if (ret < 0) { + dev_err(tqspi->dev, "failed to starting TX DMA: %d\n", ret); + return ret; + } + } else { + if (tqspi->is_packed) + tx_dma_phys = t->tx_dma; + else + tx_dma_phys = tqspi->tx_dma_phys; + tegra_qspi_copy_client_txbuf_to_qspi_txbuf(tqspi, t); + tegra_qspi_writel(tqspi, lower_32_bits(tx_dma_phys), + QSPI_DMA_MEM_ADDRESS_REG); + tegra_qspi_writel(tqspi, (upper_32_bits(tx_dma_phys) & 0xff), + QSPI_DMA_HI_ADDRESS_REG); } } if (tqspi->cur_direction & DATA_DIR_RX) { - dma_sconfig.src_addr = tqspi->phys + QSPI_RX_FIFO; - dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; - dma_sconfig.src_maxburst = dma_burst; - ret = dmaengine_slave_config(tqspi->rx_dma_chan, &dma_sconfig); - if (ret < 0) { - dev_err(tqspi->dev, "failed DMA slave config: %d\n", ret); - return ret; - } - - dma_sync_single_for_device(tqspi->dev, tqspi->rx_dma_phys, - tqspi->dma_buf_size, - DMA_FROM_DEVICE); - - ret = tegra_qspi_start_rx_dma(tqspi, t, len); - if (ret < 0) { - dev_err(tqspi->dev, "failed to start RX DMA: %d\n", ret); - if (tqspi->cur_direction & DATA_DIR_TX) - dmaengine_terminate_all(tqspi->tx_dma_chan); - return ret; + if (has_ext_dma) { + dma_sconfig.src_addr = tqspi->phys + QSPI_RX_FIFO; + dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + dma_sconfig.src_maxburst = dma_burst; + ret = dmaengine_slave_config(tqspi->rx_dma_chan, &dma_sconfig); + if (ret < 0) { + dev_err(tqspi->dev, "failed DMA slave config: %d\n", ret); + return ret; + } + dma_sync_single_for_device(tqspi->dev, tqspi->rx_dma_phys, + tqspi->dma_buf_size, DMA_FROM_DEVICE); + ret = tegra_qspi_start_rx_dma(tqspi, t, len); + if (ret < 0) { + dev_err(tqspi->dev, "failed to start RX DMA: %d\n", ret); + if (tqspi->cur_direction & DATA_DIR_TX) + dmaengine_terminate_all(tqspi->tx_dma_chan); + return ret; + } + } else { + if (tqspi->is_packed) + rx_dma_phys = t->rx_dma; + else + rx_dma_phys = tqspi->rx_dma_phys; + + tegra_qspi_writel(tqspi, (rx_dma_phys & 0xffffffff), + QSPI_DMA_MEM_ADDRESS_REG); + tegra_qspi_writel(tqspi, ((rx_dma_phys >> 32) & 0xff), + QSPI_DMA_HI_ADDRESS_REG); } } @@ -726,9 +758,6 @@ static int tegra_qspi_start_cpu_based_transfer(struct tegra_qspi *qspi, struct s static void tegra_qspi_deinit_dma(struct tegra_qspi *tqspi) { - if (!tqspi->soc_data->has_dma) - return; - if (tqspi->tx_dma_buf) { dma_free_coherent(tqspi->dev, tqspi->dma_buf_size, tqspi->tx_dma_buf, tqspi->tx_dma_phys); @@ -759,16 +788,26 @@ static int tegra_qspi_init_dma(struct tegra_qspi *tqspi) u32 *dma_buf; int err; - if (!tqspi->soc_data->has_dma) - return 0; + if (tqspi->soc_data->has_ext_dma) { + dma_chan = dma_request_chan(tqspi->dev, "rx"); + if (IS_ERR(dma_chan)) { + err = PTR_ERR(dma_chan); + goto err_out; + } - dma_chan = dma_request_chan(tqspi->dev, "rx"); - if (IS_ERR(dma_chan)) { - err = PTR_ERR(dma_chan); - goto err_out; - } + tqspi->rx_dma_chan = dma_chan; - tqspi->rx_dma_chan = dma_chan; + dma_chan = dma_request_chan(tqspi->dev, "tx"); + if (IS_ERR(dma_chan)) { + err = PTR_ERR(dma_chan); + goto err_out; + } + + tqspi->tx_dma_chan = dma_chan; + } else { + tqspi->rx_dma_chan = NULL; + tqspi->tx_dma_chan = NULL; + } dma_buf = dma_alloc_coherent(tqspi->dev, tqspi->dma_buf_size, &dma_phys, GFP_KERNEL); if (!dma_buf) { @@ -779,14 +818,6 @@ static int tegra_qspi_init_dma(struct tegra_qspi *tqspi) tqspi->rx_dma_buf = dma_buf; tqspi->rx_dma_phys = dma_phys; - dma_chan = dma_request_chan(tqspi->dev, "tx"); - if (IS_ERR(dma_chan)) { - err = PTR_ERR(dma_chan); - goto err_out; - } - - tqspi->tx_dma_chan = dma_chan; - dma_buf = dma_alloc_coherent(tqspi->dev, tqspi->dma_buf_size, &dma_phys, GFP_KERNEL); if (!dma_buf) { err = -ENOMEM; @@ -1056,6 +1087,7 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi, struct spi_message *msg) { bool is_first_msg = true; + bool has_ext_dma = tqspi->soc_data->has_ext_dma; struct spi_transfer *xfer; struct spi_device *spi = msg->spi; u8 transfer_phase = 0; @@ -1128,15 +1160,12 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi, if (WARN_ON(ret == 0)) { dev_err(tqspi->dev, "QSPI Transfer failed with timeout: %d\n", ret); - if (tqspi->is_curr_dma_xfer && - (tqspi->cur_direction & DATA_DIR_TX)) - dmaengine_terminate_all - (tqspi->tx_dma_chan); - - if (tqspi->is_curr_dma_xfer && - (tqspi->cur_direction & DATA_DIR_RX)) - dmaengine_terminate_all - (tqspi->rx_dma_chan); + if (tqspi->is_curr_dma_xfer && has_ext_dma) { + if (tqspi->cur_direction & DATA_DIR_TX) + dmaengine_terminate_all(tqspi->tx_dma_chan); + if (tqspi->cur_direction & DATA_DIR_RX) + dmaengine_terminate_all(tqspi->rx_dma_chan); + } /* Abort transfer by resetting pio/dma bit */ if (!tqspi->is_curr_dma_xfer) { @@ -1197,6 +1226,7 @@ static int tegra_qspi_non_combined_seq_xfer(struct tegra_qspi *tqspi, struct spi_device *spi = msg->spi; struct spi_transfer *transfer; bool is_first_msg = true; + bool has_ext_dma = tqspi->soc_data->has_ext_dma; int ret = 0, val = 0; msg->status = 0; @@ -1251,10 +1281,12 @@ static int tegra_qspi_non_combined_seq_xfer(struct tegra_qspi *tqspi, QSPI_DMA_TIMEOUT); if (WARN_ON(ret == 0)) { dev_err(tqspi->dev, "transfer timeout\n"); - if (tqspi->is_curr_dma_xfer && (tqspi->cur_direction & DATA_DIR_TX)) - dmaengine_terminate_all(tqspi->tx_dma_chan); - if (tqspi->is_curr_dma_xfer && (tqspi->cur_direction & DATA_DIR_RX)) - dmaengine_terminate_all(tqspi->rx_dma_chan); + if (tqspi->is_curr_dma_xfer && has_ext_dma) { + if (tqspi->cur_direction & DATA_DIR_TX) + dmaengine_terminate_all(tqspi->tx_dma_chan); + if (tqspi->cur_direction & DATA_DIR_RX) + dmaengine_terminate_all(tqspi->rx_dma_chan); + } tegra_qspi_handle_error(tqspi); ret = -EIO; goto complete_xfer; @@ -1323,7 +1355,7 @@ static bool tegra_qspi_validate_cmb_seq(struct tegra_qspi *tqspi, return false; xfer = list_next_entry(xfer, transfer_list); } - if (!tqspi->soc_data->has_dma && xfer->len > (QSPI_FIFO_DEPTH << 2)) + if (!tqspi->soc_data->has_ext_dma && xfer->len > (QSPI_FIFO_DEPTH << 2)) return false; return true; @@ -1388,30 +1420,32 @@ static irqreturn_t handle_dma_based_xfer(struct tegra_qspi *tqspi) if (tqspi->cur_direction & DATA_DIR_TX) { if (tqspi->tx_status) { - dmaengine_terminate_all(tqspi->tx_dma_chan); - err += 1; - } else { + if (tqspi->tx_dma_chan) + dmaengine_terminate_all(tqspi->tx_dma_chan); + err++; + } else if (tqspi->tx_dma_chan) { wait_status = wait_for_completion_interruptible_timeout( &tqspi->tx_dma_complete, QSPI_DMA_TIMEOUT); if (wait_status <= 0) { dmaengine_terminate_all(tqspi->tx_dma_chan); dev_err(tqspi->dev, "failed TX DMA transfer\n"); - err += 1; + err++; } } } if (tqspi->cur_direction & DATA_DIR_RX) { if (tqspi->rx_status) { - dmaengine_terminate_all(tqspi->rx_dma_chan); - err += 2; - } else { + if (tqspi->rx_dma_chan) + dmaengine_terminate_all(tqspi->rx_dma_chan); + err++; + } else if (tqspi->rx_dma_chan) { wait_status = wait_for_completion_interruptible_timeout( &tqspi->rx_dma_complete, QSPI_DMA_TIMEOUT); if (wait_status <= 0) { dmaengine_terminate_all(tqspi->rx_dma_chan); dev_err(tqspi->dev, "failed RX DMA transfer\n"); - err += 2; + err++; } } } @@ -1474,28 +1508,28 @@ static irqreturn_t tegra_qspi_isr_thread(int irq, void *context_data) } static struct tegra_qspi_soc_data tegra210_qspi_soc_data = { - .has_dma = true, + .has_ext_dma = true, .cmb_xfer_capable = false, .supports_tpm = false, .cs_count = 1, }; static struct tegra_qspi_soc_data tegra186_qspi_soc_data = { - .has_dma = true, + .has_ext_dma = true, .cmb_xfer_capable = true, .supports_tpm = false, .cs_count = 1, }; static struct tegra_qspi_soc_data tegra234_qspi_soc_data = { - .has_dma = false, + .has_ext_dma = false, .cmb_xfer_capable = true, .supports_tpm = true, .cs_count = 1, }; static struct tegra_qspi_soc_data tegra241_qspi_soc_data = { - .has_dma = false, + .has_ext_dma = true, .cmb_xfer_capable = true, .supports_tpm = true, .cs_count = 4,