From patchwork Wed Sep 25 13:36:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raju Rangoju X-Patchwork-Id: 830700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2049.outbound.protection.outlook.com [40.107.244.49]) (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 3A00318E03F; Wed, 25 Sep 2024 13:40:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727271605; cv=fail; b=CMWRYYSbVM1C0yLVcktu9leWoJ0htDBjuExotSgd7WSCVo0xC+Ca75GFwyAYFeRoUPkTaJcr3PgtSKM32idi47zRcTzsvApF54gHo82P/A+Z388WD8mRR1N7YraQpDA11HMqvifS9hBDoxhwcI6i1bmNDIGoDLRX/EGdNPGH9T8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727271605; c=relaxed/simple; bh=lct+Aq2VyibkPpmL6WvSI5CAbDLzQxXh04drQ9ZXz8w=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oXbEIbxwJV7lQ9Vi4q8oaoD9R13OlGbRyD9UdoAUfrVvBmO1aZZQsEJa6KwzRMV/Ha0QFtGQ2YlUPLfEvPmil7deu2SNW9zq2BQoFP9hfuPZlNOR0REvOoRTp97hnIy9P+J3IhPJwhLTXKT3APkQzF+pglF6rTYQbn/lWUElOt8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=B4Pn68yr; arc=fail smtp.client-ip=40.107.244.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="B4Pn68yr" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YXqSXsZP3t5y4qGa8n+4Wlf3Jy6vsbHlu1iDG6B9nZzAJYE/XF3Z4HdFRSe7rOk41MmZIRqycEtWr9Z6GIBlYG/Ep0Ff2EQogz0Ptg97MMgw6VovXxniVdW8vA4crkxnfNopla8K86YkPg11YbxB4Lvfi8N0H3Ncg/RO0bpbfJxDwx4zbzVDDuOTXqCVtgh6gEs2jXks5F0/jxifX2y//P9QMOt+L8M2koAhurTTAgyGVwNW+d0dzmX9lJtCl36pvhwfEt3272OVJzha7dJfbv2CUc+avidR8GRlNYxEsd6qEA4iUHv6V4x6JPfIawtrMzNRASTjQa8SLfwsrQwxvA== 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=+mka/3NXTv+DkpmGny/3YCntHT1LUsx9/Cu05bmAiXc=; b=T+gMEUCAhboRFPbxAxEpHkYNp/nOW2JCNWVj0ctLN093TU2WtgNTBEaofEkdL+1r/Z8LtXDfgWjpP0TeKlCqjvoz4pBpJwsU0W8n1wW+YTNNOievvrrL3SrRLkwd5WKpgahF+L8bziohkHuQaS7e2ES8LlYqi3udXg3uUW4GGNf8/avWqZEqMPMYJ+OeS+EZuP38UE5qAjUwvaTgVuciZWnqrA0a+zGcukCnopg4jlb1OOLqhb5e3r0vHHkeM1hirRK43R4VIJxQAJVG+gz6wTvzpm/X211XA1J+Gh/QjbpDmjOPoxRdKrDHzJDkPaFva18g6sRScNy7xP///KhgOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+mka/3NXTv+DkpmGny/3YCntHT1LUsx9/Cu05bmAiXc=; b=B4Pn68yr/JPpm89ZlAR2dB7ieBP6mCQizdO1QykTiyem+183kd/YgcCfHQJyJzDJU3QwPOAU533kfkm6Wm2fCVj4AjC+F5u63gAPzoKKrA3na+OPiSuSjA8IBUKqB/utcSJw4GaWec/EQjfwjgGJRzbAhZVi3GuoYiDMTC9qtUY= Received: from SA1P222CA0019.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:22c::20) by IA1PR12MB7734.namprd12.prod.outlook.com (2603:10b6:208:422::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.25; Wed, 25 Sep 2024 13:40:00 +0000 Received: from SA2PEPF00003AEB.namprd02.prod.outlook.com (2603:10b6:806:22c:cafe::21) by SA1P222CA0019.outlook.office365.com (2603:10b6:806:22c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27 via Frontend Transport; Wed, 25 Sep 2024 13:39:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF00003AEB.mail.protection.outlook.com (10.167.248.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8005.15 via Frontend Transport; Wed, 25 Sep 2024 13:39:59 +0000 Received: from airavat.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 25 Sep 2024 08:39:56 -0500 From: Raju Rangoju To: , CC: , , , , Subject: [PATCH V2 1/8] spi: spi_amd: Sort headers alphabetically Date: Wed, 25 Sep 2024 19:06:37 +0530 Message-ID: <20240925133644.2922359-2-Raju.Rangoju@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240925133644.2922359-1-Raju.Rangoju@amd.com> References: <20240925133644.2922359-1-Raju.Rangoju@amd.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AEB:EE_|IA1PR12MB7734:EE_ X-MS-Office365-Filtering-Correlation-Id: 79a825d0-cc5b-4f57-57e3-08dcdd678cab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: 3OgiUBRp6CLYsP/S3rMNkR0HAXfA82uVTIFppe+lpv6jBDhH01jWKoU/Tpwi/uwbJ3k+9R22G1KvTgdxMxRhkDt2+drM00OsSQgK7ej05SxJtkEmH00zvcMGd+ZQksK/Hogz6IxCNXnTQPMh2Not3AqmBb4v/i0VpnbHt3nSfKYmHad02GdXcSgbS7YqoBCfE/7e4hXrm6d7OPqAoygrDL6qlaphJomWjyOKe/CArIO2uYKe5QJvW2qpCi0G3hERWXqaBwvSwVuvPUiIXgMdIZeuoeO/NZM32Nlnd8j6rBjfmjZfikWt087QuhV8kQ4OPSRlrtof47mGZ5hQs41hoGLzmeuXhxZ+IhUj6tlUHc+fciH4k56qiSo61ovcwlUQuPYLrTFYjvZ1rGs7uB5bYzMNx6eTJeZrTUWna6U2t1gqfjbR0fMxiXVefL49otkDXxlsS/ppATitu8mDNmCyRGb6XWb+Xhl+MnUgrELoKYIFmZdBL7brVh8baFKz02tuMabYgpDiNLZOU+BESJcaWIwemdZEXaiolVO0X2jlQxDvnG4CvbyoUlH+woOVgCYlNc7xJiYPKHgp1adcI1cPHJZoosJc997vGDGzQoWpe85K7ma4TyRnSjYz6YTo8ojhQhYpbY9jPkqY2HyY8fNxLhmu0aYcXaNI6E3U3kvn55QZU6kqp6m4Llnim/YFHfFtGvfpJ5L2Evh6I1mKh4RSqQnGgeD4jSRI62oJi303eaEnJQ9DiJuZVqA0OuVgQNwoy9q94Pt8GR4PIY7IHJcwOP958Kp9fvfPA8c9KwAiwzujoQFQYRZex4Q8nFFtbmcevPkf6GqysVfCWwTa3BxVodjI5SxeN52XJjhjm01B6LIpJQ8J4Y6C4ZOoMc5eDFHwyV7tw2jNjQ+69RV2Tj8JOUp+ic7/wBzNQqmUmcnOdS+3yLwPCIw4ELxq51NVzDXLCCzEdK0uFEOvSkH/IuUTdz/yC75Goo9J0gkrKnHvrSKjdczjGS6zJNQWYMeflKam/9UVtmu/A3Yf+I9mj/9oEosMinu9wyCdXdalwUrvK9vmTs+rCCKnnCICE9t+Ig+If0fKLEbnIuWdmsho23ZQ91u7+UstksbGRKy2USQJya0RIm67ZKbhyJXeLUqLfJWqxSicW/nKd8FpJaheA7ibSqnu/yFNAsGx1bfWpp1OvjYXx9fjdorgBgCQPmvXd96pXeOzuPIkqSVFt70kLe9O5b+0jYp+lUSSGFcYfk37EAen1/v/Gugw4mLD5fYP4oLnvMmIrFwibYVoytGesX4GfC4DF3CvsJ2rp4LbOX8B7dGVeJ6Ont40i3+ScvYKSX9ynFnqF2NSKtvH0u1S0JY9E2UyGzGr+RBB6soHqI5LaTgezwdT3lGVImsmxh/XECit X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2024 13:39:59.0239 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 79a825d0-cc5b-4f57-57e3-08dcdd678cab X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AEB.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7734 Sorting headers alphabetically helps locating duplicates, and makes it easier to figure out where to insert new headers. Co-developed-by: Akshata MukundShetty Signed-off-by: Akshata MukundShetty Signed-off-by: Raju Rangoju --- drivers/spi/spi-amd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c index 2245ad54b03a..c52066360dfe 100644 --- a/drivers/spi/spi-amd.c +++ b/drivers/spi/spi-amd.c @@ -7,12 +7,12 @@ // Author: Sanjay R Mehta #include +#include #include +#include #include #include -#include #include -#include #include #define AMD_SPI_CTRL0_REG 0x00 From patchwork Wed Sep 25 13:36:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raju Rangoju X-Patchwork-Id: 831001 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2066.outbound.protection.outlook.com [40.107.220.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 5174118E34D; Wed, 25 Sep 2024 13:40:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727271612; cv=fail; b=J7fB/lZW2jQmRrgmNB+QlRYqrrb7B3Wsij+UuAiPmMJ1OaMp1lJlwzlXSQEokhLrSJ6wCSwVlN4BytZkp4aRKvsJ42eu809NUM7lFIVxAE+hhhkz7a1srnMhTHmiIuab54kNScX6qFOr88RlotqQnP5IL7tOMB4WOWbf24yUo54= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727271612; c=relaxed/simple; bh=+XNmH5Sv0vAuT2frgcBnWcLCfBAG+ArgYcGnhBCGVpI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oBTdbJhBbdwdSyISttWU2E3nP+j0Jlpszn8ZHtQYskYR2Tm/nokBG7ayA/HrWL6Rr0nlk4oe+dEKML/f+gTDXmneBSfhe/ZmtcgZnFdJRa9Ea07K5OCZEfrNGQgpaO0K/EOmqPqJpbdAbOkPRc9RyEYv9X5mloNeveE6LjqJgeI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=GWRGj6jC; arc=fail smtp.client-ip=40.107.220.66 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="GWRGj6jC" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=o2MyU0A7EZksvI6mRd1DfHd+Z3A5V9Y+hRUFr/3SierLw9Y6n7vmgs2T/Suna7A0QtYMUq7cUGJEM791rBtbj+FP/TnZ74ZpycWxt3C3+pOMoZa4KfdRPOjvgKepFozKkd0Ym5wjFpcu5LfF5tn5yI2ibtO6PeUy4du6avO6yozFSzO0lc1PI9FC2wU2AGCWBta/EWkuodfJEAdCfHjpX4NQCAB1DIgJFi0ac6nKFvyiWfuTLGlSQiG7H0CvW6Kvlrl8hILWckGMunV0XYwSFUAoaxgHguNMNV1J2blWMBolNgWEignJWvwGfMIjBmNfD652aogYlFt56deUSvXiZg== 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=TZqSN3IPxrsnBmtMBkCl7O3zh1l0q9fEDMPDft+SvDs=; b=xQ5zZkEwJpLLfGqzZdR/p+iZiE1ckOORYRHy2MeJq3XkpjIK1eQGCPNC1oS4I3G2tvKAbKfSTeUp26OvYeCiTyw26phHbd2i8h9mFQHEYbzfbBBZlSnFZAD0I4S2nxaRYfOH0aSkGX3k2E6jTkFXaHv7dITcqudCrYYx1GbtVMoSfBEhgkKNarTUC8kTWnwPo7JCSTIVLTsG7pX+AJzMLpyYK+wnNa9d8PmU9d5Gy4l1vzJjn4mHW7Ve/yAlU4Am9OcYd/SDoIhQJXcuH02hnhTlNS0NwoZC+KZG4PsjwoW+128r4YhrivlmWN64mPjBPBnxpnVVm2v0YHVA00/WhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TZqSN3IPxrsnBmtMBkCl7O3zh1l0q9fEDMPDft+SvDs=; b=GWRGj6jCmHhz2f5B7XijD+09vClsW+7p/vRsPd78ZTAm7s9jbMwUerqhYqpQEwRUwcldg9xhAYX3AwMuKZ8NVw/Wm5ymtuK72wuvYxGm9E4C280FdPCvF+fheiZTHeauai9lSC3yeWpzrSE8ZoKmV5YAIdoA+Ulu05sKse+7W2I= Received: from SA1P222CA0128.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c2::10) by MN2PR12MB4064.namprd12.prod.outlook.com (2603:10b6:208:1d3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Wed, 25 Sep 2024 13:40:06 +0000 Received: from SA2PEPF00003AE9.namprd02.prod.outlook.com (2603:10b6:806:3c2:cafe::1e) by SA1P222CA0128.outlook.office365.com (2603:10b6:806:3c2::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.17 via Frontend Transport; Wed, 25 Sep 2024 13:40:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF00003AE9.mail.protection.outlook.com (10.167.248.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8005.15 via Frontend Transport; Wed, 25 Sep 2024 13:40:05 +0000 Received: from airavat.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 25 Sep 2024 08:40:00 -0500 From: Raju Rangoju To: , CC: , , , , Subject: [PATCH V2 2/8] spi: spi_amd: Enable dual and quad I/O modes Date: Wed, 25 Sep 2024 19:06:38 +0530 Message-ID: <20240925133644.2922359-3-Raju.Rangoju@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240925133644.2922359-1-Raju.Rangoju@amd.com> References: <20240925133644.2922359-1-Raju.Rangoju@amd.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AE9:EE_|MN2PR12MB4064:EE_ X-MS-Office365-Filtering-Correlation-Id: 81dd4577-d288-40c7-a6ea-08dcdd6790d0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: zU1bM4MTIW//Bqx408kGwfWUaX76cIxtFewaR1tMXmuuA6teSj38YD/U/0wGu2ix4l68SaaISEvp3LrX9SdHlN/Rqpn9l1SUaPsGTswtZPzBW0R6hhfqItpiFi4x2oZ709lKczvxvZs6ltO+2qq+le4qi+OQ30fLaYhChmL80XDesiP8AT6WWhhOBe2XZEk6P0+XaNdsnwdWdZ5lz05PF3HPXxhkyCYugHcPp2mVncwF/NGg0rQjDkJkl5iFNw7S1LnjX5pb4QBOpl7wIM2Re8/f92Nahum/AHRAZ4APcddVFNssy6hqrqwunT/ZhwiWaCji0aRcsgPqMPkwMdmaz5UY92hHQ9vzyOP8gdMPo6GRAv81++TVXReNqJzYyFmhuick0ULX+S68mDp7ZV41QIkr0OXPbIGpFVXU0K9pGV5gQ5Fp15byTWbulZsVbx9CZx6ZxYHd8RMj3L7ZGGkLhUbu7e3LzWZqHRRQborvBUTnZJG9VxQggBU/MhZEnSi3OawXEcpOC0BxcxtTTT1hxNELhar1HYQNzsE5ik7wowuxf0c+o0TaqGUC5MeSN2hu6f3BMY82juqe+Ns2sQCrqAqn70gvl/DgAbEG1VBpBR0bbh1xoKoeuggUVyI9tMugYanIg95jQaHr+AxIjToeXQa45LVj7r0/NTy+JUl5LT0WWEq8/fwDqXhz2xl0jI9aSXoYolztImXbdlfEhITIkFXg02+AnKo0/1cHCHCnsJiFffyEPLJzNCMZixTh6WUpzhPFVDEavD+5/XxBJKifZnzxyA+1aVZ6ufJpYuppDN+0bhGAwsrnYcXG9N1y4o5IUSLPJivdC+mQtAKsia4fjvdK/oXqCx5IvGjlLH6dZweOBRhrYxtfoH8Rzp7+oI0KTolC07NVVrC6w1UjlpPxefEuC9mceqffLG45aWQNX/v0W20Cen2g+ddLs4k/OxMHv0iq6AAGNK8rX6vUteQVl6VLW1PAC2fXFjQRns7EXnzva87T4n0Dbnjh0oSRttUfBg9HdidGhMj0+Xs/pFpNorNa/MVGit213VkM6WTdMm/t5UDUdFCfyUDtmOwimhSEsfBmAP8roO0gkyZYlo+Tz2pY0gFbBz797f7P5XXGOuKwhNfm/CpCyNBgX5WrbVD+5SwGOx6p/9OrIAMFbRIBR1zH0F51WFW0yB6rC1onU/aGRrea9FdnAk+/mtSvCdP/Ts61T1kytS/s86xq9W1co28tRSi2vT97RLY4HqW698hZFji46W4CdJgsa6YK0EcQ48mxnjhuu52QUWzvmbnMsxITALrVdddGkq6RmQsya8U0aASZXBVBTZv7hoAH+oBC0nMrXh0dQNBLEJ3FclpwwWWxVWFzM+6kVeFGHlNoLwCKJR+kGHXtyDL+yv4piOlJEViz8RxcYGbOUTm+ogKe78yvngD5ue4yzMMyIB4zjR0zt0H/tUSLnRASXBW5ynvG X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(376014)(82310400026)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2024 13:40:05.9949 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81dd4577-d288-40c7-a6ea-08dcdd6790d0 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AE9.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4064 The current spi_amd driver only supports single I/O mode, despite the AMD SPI controller's capability for dual and quad I/O modes for read operations. And AMD SPI0 controller has limited support for quad mode write operations. Update the SPI-MEM support function to reflect these hardware capabilities. Co-developed-by: Krishnamoorthi M Signed-off-by: Krishnamoorthi M Co-developed-by: Akshata MukundShetty Signed-off-by: Akshata MukundShetty Signed-off-by: Raju Rangoju --- drivers/spi/spi-amd.c | 57 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c index c52066360dfe..17a8401216e4 100644 --- a/drivers/spi/spi-amd.c +++ b/drivers/spi/spi-amd.c @@ -50,6 +50,21 @@ #define AMD_SPI_MAX_HZ 100000000 #define AMD_SPI_MIN_HZ 800000 +/* SPI read command opcodes */ +#define AMD_SPI_OP_READ 0x03 /* Read data bytes (low frequency) */ +#define AMD_SPI_OP_READ_FAST 0x0b /* Read data bytes (high frequency) */ +#define AMD_SPI_OP_READ_1_1_2 0x3b /* Read data bytes (Dual Output SPI) */ +#define AMD_SPI_OP_READ_1_2_2 0xbb /* Read data bytes (Dual I/O SPI) */ +#define AMD_SPI_OP_READ_1_1_4 0x6b /* Read data bytes (Quad Output SPI) */ +#define AMD_SPI_OP_READ_1_4_4 0xeb /* Read data bytes (Quad I/O SPI) */ + +/* SPI read command opcodes - 4B address */ +#define AMD_SPI_OP_READ_FAST_4B 0x0c /* Read data bytes (high frequency) */ +#define AMD_SPI_OP_READ_1_1_2_4B 0x3c /* Read data bytes (Dual Output SPI) */ +#define AMD_SPI_OP_READ_1_2_2_4B 0xbc /* Read data bytes (Dual I/O SPI) */ +#define AMD_SPI_OP_READ_1_1_4_4B 0x6c /* Read data bytes (Quad Output SPI) */ +#define AMD_SPI_OP_READ_1_4_4_4B 0xec /* Read data bytes (Quad I/O SPI) */ + /** * enum amd_spi_versions - SPI controller versions * @AMD_SPI_V1: AMDI0061 hardware version @@ -360,14 +375,50 @@ static inline int amd_spi_fifo_xfer(struct amd_spi *amd_spi, return message->status; } +static inline bool amd_is_spi_read_cmd_4b(const u16 op) +{ + switch (op) { + case AMD_SPI_OP_READ_FAST_4B: + case AMD_SPI_OP_READ_1_1_2_4B: + case AMD_SPI_OP_READ_1_2_2_4B: + case AMD_SPI_OP_READ_1_1_4_4B: + case AMD_SPI_OP_READ_1_4_4_4B: + return true; + default: + return false; + } +} + +static inline bool amd_is_spi_read_cmd(const u16 op) +{ + switch (op) { + case AMD_SPI_OP_READ: + case AMD_SPI_OP_READ_FAST: + case AMD_SPI_OP_READ_1_1_2: + case AMD_SPI_OP_READ_1_2_2: + case AMD_SPI_OP_READ_1_1_4: + case AMD_SPI_OP_READ_1_4_4: + return true; + default: + return amd_is_spi_read_cmd_4b(op); + } +} + static bool amd_spi_supports_op(struct spi_mem *mem, const struct spi_mem_op *op) { /* bus width is number of IO lines used to transmit */ - if (op->cmd.buswidth > 1 || op->addr.buswidth > 1 || - op->data.buswidth > 1 || op->data.nbytes > AMD_SPI_MAX_DATA) + if (op->cmd.buswidth > 1 || op->addr.buswidth > 4 || op->data.nbytes > AMD_SPI_MAX_DATA) return false; + /* AMD SPI controllers support quad mode only for read operations */ + if (amd_is_spi_read_cmd(op->cmd.opcode)) { + if (op->data.buswidth > 4) + return false; + } else if (op->data.buswidth > 1) { + return false; + } + return spi_mem_default_supports_op(mem, op); } @@ -514,7 +565,7 @@ static int amd_spi_probe(struct platform_device *pdev) /* Initialize the spi_controller fields */ host->bus_num = 0; host->num_chipselect = 4; - host->mode_bits = 0; + host->mode_bits = SPI_TX_DUAL | SPI_TX_QUAD | SPI_RX_DUAL | SPI_RX_QUAD; host->flags = SPI_CONTROLLER_HALF_DUPLEX; host->max_speed_hz = AMD_SPI_MAX_HZ; host->min_speed_hz = AMD_SPI_MIN_HZ; From patchwork Wed Sep 25 13:36:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raju Rangoju X-Patchwork-Id: 830699 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2070.outbound.protection.outlook.com [40.107.101.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 82A0818E349; Wed, 25 Sep 2024 13:40:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.101.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727271613; cv=fail; b=EHiFXnf+C3iCYiuOO61UGCJkXrjL2pmqhEBv5oaFGYX+acqTXLsb/oZAtFt5J+MBMK/RX4jPKHxbB68maeotDSmbsYNLWxRCikq+UnqjNLziionDjdGs6alWis9iO04C9/0u2IQ4sR1HA0CzTXVTGwUxWu91+OOnSyGLbqjc6lo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727271613; c=relaxed/simple; bh=tmeDs39U6rEmllj6p9zeM2GlpUukOcATFbue6sW4qwc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Phe0bTN7uIjQxfKGYFDhZJR7Ernlw3z2cpAOFUSUNTLH3u+kAs5oc80yN2t9Tdxixw3gQc2pD6E6UjQI2Lk6vBaUFd5IFkX80yL3fz5PnFkabdc5yL8pRufRMB2Yv4Gqinf8q40fSWu8VhMDAkxArNwrCm8z11jFYgQ7TWRyiBE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=p2ToFbcB; arc=fail smtp.client-ip=40.107.101.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="p2ToFbcB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ovp9JDYNzWNGCsg1jCMc7JgK7axtWmUV5oqCUSuK4135ZgZyGyU8jLrz0GsdtPVG18JSNUuUuUYBg117N2xZwrSSs5ujW9oyBrFM7ABAv+jOv3I5WFzh6VSuppG42h4vSyU/O07ETWxeY+ZwHYpFd/6sIUpVZuI9Hj36Qu1CJg7fq5QCMcKgN53DmJeOQhp7V8h/A2TXrk6IGaO+oh/9yAvJSD6OFNjSA8a1LqGghLRcye29RmGIuN+3Ux87ps1fo21XYwG9rTIZlLPOiuFunTtcTfEDnTzM2Exc6ouDZ/gU2aGRmBgJE3N7A+eTkw9jloDSp867RTK8f8HBOeFnrw== 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=boi7sB7p338EPlfmVcLVmrQA8f30jhO2Bs7zV0EInSU=; b=hzE6n7XKiseMf9IqfpXN5Wcj6XEdWFRHrnz9d4MDCSA9PRv5yA8feMQrmCREukfZkjLJTHwBwJKJfDbXxv5WGF3gMt0ARG8z3BCkh6SBE5VOQzE9iK+OzXTJn8f1msAGuqjU00gkNO5efKlVtS7VS21OHH/DLdGJkA6j2vIEdAUFecrMz0hHygHy/RJa3UdXHLOhG/4Evwt0pAu5I02Aae+gweZB0gqVKJWnnvrRwkMWj1Gv7EhUsLxvCzgaIIQv9qYImZ2fMMzp7qK8vjM6vHo7ga6ExOXd2Wa1O46lNaJ6EQW2Y5Ov3rCXJOtY4Fc5FwaOzPsWe8FVk7ur/9bjGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=boi7sB7p338EPlfmVcLVmrQA8f30jhO2Bs7zV0EInSU=; b=p2ToFbcBKyNRUfDzXLr4rRy172BiMyuMhElTM3GW0ug10MYZb5bqv4P/XRGVDh4XIyJMp28/FLDjOgx3c6lqwddjb3+NGFWHmqMWxbpK5kmnG1b6WCCVYb5W1cZl4v7KLXjBqfzH/tBJRzKctLnLjABCj/LfiFqxmIRajI1FcmY= Received: from SA1P222CA0133.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c2::18) by PH7PR12MB5593.namprd12.prod.outlook.com (2603:10b6:510:133::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.25; Wed, 25 Sep 2024 13:40:07 +0000 Received: from SA2PEPF00003AE9.namprd02.prod.outlook.com (2603:10b6:806:3c2:cafe::c9) by SA1P222CA0133.outlook.office365.com (2603:10b6:806:3c2::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.20 via Frontend Transport; Wed, 25 Sep 2024 13:40:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF00003AE9.mail.protection.outlook.com (10.167.248.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8005.15 via Frontend Transport; Wed, 25 Sep 2024 13:40:07 +0000 Received: from airavat.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 25 Sep 2024 08:40:04 -0500 From: Raju Rangoju To: , CC: , , , , Subject: [PATCH V2 3/8] spi: spi_amd: Replace ioread/iowrite calls Date: Wed, 25 Sep 2024 19:06:39 +0530 Message-ID: <20240925133644.2922359-4-Raju.Rangoju@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240925133644.2922359-1-Raju.Rangoju@amd.com> References: <20240925133644.2922359-1-Raju.Rangoju@amd.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AE9:EE_|PH7PR12MB5593:EE_ X-MS-Office365-Filtering-Correlation-Id: d1e7d708-05b5-4fa4-ffc1-08dcdd6791ab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|82310400026|376014|1800799024; X-Microsoft-Antispam-Message-Info: mS/W1ajw0UbO57cuCigRUr8hic3S7qrlMz/bdR3WhZat6FUZ+l1Q5BLbuoRRFA2+CUjLSXZED3mJxX2BhHmwEtzGK+nxm21674ZzCWNND0IjtSJcqMsPpJUnylpli/jwrvRQKmT5OkdunW1UXGG8IqxjhcAFhUPfRm+h9sxsicIPtqSIcaCjRif/AMyfXt6iviFQXF5JJmiiyxVLpAkpRWjSam7eyUL3lwL7cPU7ozOUwbpKui7+hAAVDxgAwwVqcQZkjoNrdMjqdDsnvrUZ5xAAWlySXQnbrr3tmxAjI/pA0zffi/5Y0wCCNC2IAqcja+WNok3t0LYA2a0lYlpo/f8lK/gFhDhTYqAgE1K+lw5n28TYhfwbW4Dxa12PbtSnPYPDuwRRJt1pCVVT2ms6Zl2yQmVte1L4SZPcrrDMFmPvGfl90nsk7odNaVI5Rh4VGjNob3fOKmmEJRTw7n1rhJG3/3LmmtZiqO2hksErDjn0KJ06nEw5KZ94ShN7OkaQPX/dqb+mdOJBvEkT0515/fvDa1C5/z5NiZFyLE+AcWv/veVU8j6/nbvKaI6Cd+LTuWUw12812X0dQ90Doc3kWps+YTblwHbdrQKTBw6MD5uHzgAiSS41hcdtWQ6TvOubi2/rtFKVqWOHIIvF+mmmaBiVNLzYzvM/o6wbGPxTeF2N8fiYbYNZC5ZZ9cAz43d3xnR0ceOQ7V+Eh95afPt6sBUC1huch7j00SRJmBFXKc8cBmemKcL2gpdzAZuB1Et4AmFVbFDvH+1gdd80E9KyUur7A7BCk6bGwsKw4kj+vTDoc7IeOIO0R+/OaKzKHnElA4SzUQgE3PXn8pGOx3Hy49mB9Xu2Sh5PMbuuTeshpZugAvD3bxzNaHmNbBe5lDXUlNZVlm+zM0p4aaHu7cJ1LMTk4rHmdKMminO8YMoMlDSSo384rJ3AKQQ92uZScPp/Ja057XpvLL4uqWpjJxSFsMh7MmqnVPQDVY2ZRdHf9eSG3uZyrWVDQVFDQzS2a/f4Ls3BtyeHWUPqu3xDtQX7caN2g/DkLTKfn8B3uwtChPzS/KA0IJviuxrk9qe9XGv0ljsuEFwluV2xbH+hqdYg9ngDvGDjwEZ4UeBiXgtp378muVXzroWBcktwVfQBrBO0X3ZwPAXQb8fGdc+TTWvNTrQXkQ4i8FqHgeCtrC1glzSjBVVbNbAUiQSQ80NkSyapU9xnGFVSf6Ro7qVsHYkffoX4T/+Dz+YgVFVUE0iJiTRrv2hkMrZWoS/o573SZubvwT1ZrjVPjhWk8EllJ0keEwHzmlwEujKWWn0bd1A0h7t/wSbywGLTdo2jUn1dRYSsiTZmqwZWaviEslltJx6c6bBOl11YWiVcj7AibpsqN0I= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(82310400026)(376014)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2024 13:40:07.4637 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d1e7d708-05b5-4fa4-ffc1-08dcdd6791ab X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AE9.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5593 All `ioread*` and `iowrite*` functions are better suited for architecture independent code to ensure portability across different architectures. Since AMD SoCs support only the x86 architecture, replacing all `ioread*` and `iowrite*` calls with `read*` and `write*` calls can reduce the overhead of ensuring portability and increase the speed of I/O operations. Co-developed-by: Krishnamoorthi M Signed-off-by: Krishnamoorthi M Co-developed-by: Akshata MukundShetty Signed-off-by: Akshata MukundShetty Signed-off-by: Raju Rangoju --- drivers/spi/spi-amd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c index 17a8401216e4..1d1a18ee0bb5 100644 --- a/drivers/spi/spi-amd.c +++ b/drivers/spi/spi-amd.c @@ -114,12 +114,12 @@ struct amd_spi { static inline u8 amd_spi_readreg8(struct amd_spi *amd_spi, int idx) { - return ioread8((u8 __iomem *)amd_spi->io_remap_addr + idx); + return readb((u8 __iomem *)amd_spi->io_remap_addr + idx); } static inline void amd_spi_writereg8(struct amd_spi *amd_spi, int idx, u8 val) { - iowrite8(val, ((u8 __iomem *)amd_spi->io_remap_addr + idx)); + writeb(val, ((u8 __iomem *)amd_spi->io_remap_addr + idx)); } static void amd_spi_setclear_reg8(struct amd_spi *amd_spi, int idx, u8 set, u8 clear) @@ -132,12 +132,12 @@ static void amd_spi_setclear_reg8(struct amd_spi *amd_spi, int idx, u8 set, u8 c static inline u32 amd_spi_readreg32(struct amd_spi *amd_spi, int idx) { - return ioread32((u8 __iomem *)amd_spi->io_remap_addr + idx); + return readl((u8 __iomem *)amd_spi->io_remap_addr + idx); } static inline void amd_spi_writereg32(struct amd_spi *amd_spi, int idx, u32 val) { - iowrite32(val, ((u8 __iomem *)amd_spi->io_remap_addr + idx)); + writel(val, ((u8 __iomem *)amd_spi->io_remap_addr + idx)); } static inline void amd_spi_setclear_reg32(struct amd_spi *amd_spi, int idx, u32 set, u32 clear) From patchwork Wed Sep 25 13:36:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raju Rangoju X-Patchwork-Id: 831000 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2050.outbound.protection.outlook.com [40.107.96.50]) (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 3C31818E377; Wed, 25 Sep 2024 13:40:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727271616; cv=fail; b=OOvxofnfG7B2maOe89aeSc1m22USZK4umPB7/cenfa19pUrPLathCCUt/MQMgNP0YpySV67RUVi254bU1IQxpEnhXw8hh8Dc3zLczzn5LYgE1snxj73OyOuOSrnWeSPkyYeerEpMOKZxH4DPmMb8FvK8wAVAKpXvY0dH7WlboQc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727271616; c=relaxed/simple; bh=2K+/l3uBL4iqM9ogNB5t4HhhmyeoteuSSH7CbZMvEXo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rHBQY2DXGFcn0EKq/Yfuqm2QUgT3c41sEr2NTLcQpcW0zNt+5mMcWwQyNgyFdAa20+mihdQG4RlibNIf6uZj+R6c2G+6zNx7UBhsj10aSK2YVk332zZ4ZEKZMldAUdhqeKXpyy6LhhgVBL2OORNastsjewWErmB5KifqEYGTqvo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=va0xh0B9; arc=fail smtp.client-ip=40.107.96.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="va0xh0B9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eV27uIAqgeBWjLgI39l4eztWLhU27luCL3Rv81otrUi0HqTS06NUNjvM/lX9nCWr1kaUPmQYPpb7zEhhK7goSg9nACZoFbse2NMtYCUL2VBy7oRJRCYYn8gDxUc8MBZXAupEJ58x235/s5e/JhtA/xRzO+zMckt5Z3B4qJOwXhghvGRufjguDD6Z8N8I0rcVECqeRoqVHefX9NuxazYSsQuLPAk0YfJaonwXfFOF9yY8G34CJvGL4SEaQEsc2pFW+wlCAImIFv3+gv/O04hcm1yeXvfdr6x4v/0trfHy4zkf+0qdBHLb7NMnUG+Df6IH0JaRnyi4aXCuiPTdwP2xMg== 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=xTjYNixUCu6DvvJzGZS5L6T54303fMB+vUU9SudeKBw=; b=brPH+x5q9x3VHD9QuclwMbkGq164nxNxdr2RU9IHyktDOW+ntL3UM2Ij5c6AdrwmpHE1OtxFE9W80anjW8zEDKFtozKyZMh+rTYCPijnfzvh5NTK1XWFGQeYPjhEcPEtD7jyBEtBOr3iQ0Sg05yZzEJArk2UteBaGrqkCGijzsQKkYADUTpdN1Ifhetz5/VnsqEQHa8wcYqyGjOcOnrXbrGG8HDaTOJt0a4Rt7gxj7ApiWzS7+7LWvKTshhSzkOrLsXd1ETE4JmDhCHR3zjcjjth/IKib1GT9MTvlXT40QDRsp19PIHunzGIibMQefdPAx0yBb/U+jZgkC8h3J0Zbw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xTjYNixUCu6DvvJzGZS5L6T54303fMB+vUU9SudeKBw=; b=va0xh0B9205qT4/09Otbiltzz18GfHCQEqlwHbzuLOQQ42IeopNQO5jyeO7IhaXgHBzNKGmGZrKJeG5lGtEn7BabYus+SZ+cgB68FDyMIGeh4bFkiiEIVsW3MGr1eL8Q9ZQ9buiR0H+it3bkZ+h6a2u7hSNbSkviFvSZ5RQyhGk= Received: from SA9P223CA0011.NAMP223.PROD.OUTLOOK.COM (2603:10b6:806:26::16) by PH8PR12MB7352.namprd12.prod.outlook.com (2603:10b6:510:214::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.28; Wed, 25 Sep 2024 13:40:11 +0000 Received: from SA2PEPF00003AE4.namprd02.prod.outlook.com (2603:10b6:806:26:cafe::ba) by SA9P223CA0011.outlook.office365.com (2603:10b6:806:26::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.30 via Frontend Transport; Wed, 25 Sep 2024 13:40:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF00003AE4.mail.protection.outlook.com (10.167.248.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8005.15 via Frontend Transport; Wed, 25 Sep 2024 13:40:11 +0000 Received: from airavat.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 25 Sep 2024 08:40:08 -0500 From: Raju Rangoju To: , CC: , , , , Subject: [PATCH V2 4/8] spi: spi_amd: Updates to set tx/rx count functions Date: Wed, 25 Sep 2024 19:06:40 +0530 Message-ID: <20240925133644.2922359-5-Raju.Rangoju@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240925133644.2922359-1-Raju.Rangoju@amd.com> References: <20240925133644.2922359-1-Raju.Rangoju@amd.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AE4:EE_|PH8PR12MB7352:EE_ X-MS-Office365-Filtering-Correlation-Id: 57e01273-b07f-4608-37a4-08dcdd6793ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: mNCYHNHBwukqJHh6WfYNF98ncEQFp09sEuYyvS8xy9/Ut+WQWSKZMNk4DtBUuFdOPm8BTRjyPTaXv/AyLPEYcwXCRIKrEO+Zc18zcu+v/pXz+KZHnCOL8mwdV6hbAxEcTVO2F6+sdhEKDb3NjVaeNdw7fm5n1eqKEQObB0zIBKgQBDG4WQ2sXYOSDKenuu4nCXnioJnKWoydFUT+NS531YeF4gBCTZDnbNcLTtT94o6QbhYR/oZ32ly66L25DOhhV2eosn8ZuHpaXCpxkIQtVE9hK8VfWCSpVwI5f7ac35bijetlAOSCNU2iJ9MiY2R8JTpdf9BuH/MiDEZKRtMcjTxbDaRCtyVMWZMDAvF8vi4xHpjwl2rFDQ1G8ot10SCI0Dfkx3lULQg2jUi2O3ePuElUmI5Qtxlzo3uHcfxVz0jFkTdN0BPOVwfARwet6u+7En5M1jJoTWyFpFxbAwrzcRJpfYpyvW02zklPHxKW//X3QptT1oEl3vyPjri+XRc8MESUmD9VsK5FaTmP7oXw353vcr0mBLThoqGAElLE46sx6WajmWWupm4mIzgdHA7IU/jciIIiLFhS39pS8EJajnixEDak7cyzchk2guOiTbZrL5pTXpU9nMUdIGKiVF4JfnOBd/UvwAZAaixYe8uKZLa6+FWH0trpkElrh9H8WQuWKSwOjm/OAOQxw2vC9+xh7DFmUMWeDsvaaJUY3dnTfs6DrBogd3xlhNvKRAXELMP2Waij38wTW2N8zdC3PBTpz0Qb12KUbpPg/6ntJO4Fsg5o8nBuN+0VAj2IjQ7xvtSw8q7/teK1KYNgdT5MEMkpM8imhB1J5Zb9KSZKd3eNwwRqO5Stukgl9VsrCt/zF1ODGUBTMTPt+RLpHKCG0Tp2GvvvRe/OUq/bysOz8dv7SgHqoNXHmTzPesXI/IwJ1A3/PRqcj5XRK5yVH11YabDnfGGC2vzc9vncvQ1n8dtIfQSszxlCwl8O0mFwx2urKdkATWFOoZQaW2EZKvMkAwh5DekuR5Y+TACZ3Ytmh17TeaGjCt04SxMN0kM7B1H7mmpE1Q6b0sv2SZCELVnOoK4j/u+qswryeeVVKlSPq9TGrA1lSWJ4LfdTVLMcQjOKFxDMf0vVByT+DH6HRMlJ53we5Hq1jyZ7mz5l52tWnnGMIvaXu+7kifJIMP7d5EERXNALh5M+VU2TzadnEtBImXwDjFMyyBrisC4IzNDUyjFykMFyZqdNQakYmi06+cFa47uQxHdRlEsVBXDsMDqyvc8j69A+iGaNuWxoPQjR1KPTihOPIuyr6Pt3SE3751inr81A96zruVGFoANPHc8ivpJHPoyxDg2Bhx35sIRm0vQyNYhZoCkGVA/My0yF8dKr8WaaAIYAnqSGwSSoloUdsyaUJJjVV1h8su1xjGFKqIhbA3A08mN0xWAPd21FHca6HKFZ+lSIdu6WjDhvpMTQciIL X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(376014)(82310400026)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2024 13:40:11.1956 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 57e01273-b07f-4608-37a4-08dcdd6793ea X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AE4.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7352 AMD SPI TX and RX counter registers are 1-byte length registers. The existing value will be overwritten during register write, so masking is not required. Co-developed-by: Krishnamoorthi M Signed-off-by: Krishnamoorthi M Co-developed-by: Akshata MukundShetty Signed-off-by: Akshata MukundShetty Signed-off-by: Raju Rangoju --- drivers/spi/spi-amd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c index 1d1a18ee0bb5..7841f3292a62 100644 --- a/drivers/spi/spi-amd.c +++ b/drivers/spi/spi-amd.c @@ -180,12 +180,12 @@ static int amd_spi_set_opcode(struct amd_spi *amd_spi, u8 cmd_opcode) static inline void amd_spi_set_rx_count(struct amd_spi *amd_spi, u8 rx_count) { - amd_spi_setclear_reg8(amd_spi, AMD_SPI_RX_COUNT_REG, rx_count, 0xff); + amd_spi_writereg8(amd_spi, AMD_SPI_RX_COUNT_REG, rx_count); } static inline void amd_spi_set_tx_count(struct amd_spi *amd_spi, u8 tx_count) { - amd_spi_setclear_reg8(amd_spi, AMD_SPI_TX_COUNT_REG, tx_count, 0xff); + amd_spi_writereg8(amd_spi, AMD_SPI_TX_COUNT_REG, tx_count); } static int amd_spi_busy_wait(struct amd_spi *amd_spi) From patchwork Wed Sep 25 13:36:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raju Rangoju X-Patchwork-Id: 830698 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2087.outbound.protection.outlook.com [40.107.223.87]) (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 043431AFB1F; Wed, 25 Sep 2024 13:40:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727271621; cv=fail; b=jcXq8wGPsIHkEBPem8xpks0c5dYYynDjDQyDPXVVzlTVnRmt5/zcmRN8KyQE74pQ/hCgvL2fELJec2/5+uE9Ek54J2Gt2QLRxNm4M5I0B1loQWuhqzOh1Uc6Av4GGtMZSg/I4XtruTiLcXFrcNokiEUYeuJoKEVHfImBj+JvCTU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727271621; c=relaxed/simple; bh=qyISoT5a196MS/deIEdkly1dpyxmoZ6TSBG3VGdT5mk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=argaVp7zCSRH/MSQfF2ryxmLIiVuIAetRW5NDCsJWlQDf4JgQY6y4kiAzAXoUOIjgR0PYreqhyISVXPYSKFvnpjwMB1u/PkePv0Bam8E0vmf2Y+/mvEJNUtqhBr5vsIAxVCg7f08mCpKVYC7dPzBVMjDSfZDUydS4GbgeqY4miI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=jCbKn94M; arc=fail smtp.client-ip=40.107.223.87 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="jCbKn94M" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=A0QUfSKQyPRl5nvzNKW9Ckr4hZqb9s5YtDzI0gOZ6rgz6QRNq+0KxW9YuiAbqyTZe1KUnaizMoALON79qoJBf/8tuyGaRggEDmBSRD1//+vab3bbWdivDyyv7iWxFIrmp79u2DHl/Wohqnrs0rvoyAmz8h/5xmKUH5N4425osd7anpIraJxfWUiz1M5QXuy63MCQgIOuNGoqBFtGD/swVSGrBNbwSTUn0LSf6yQTeff5VRroAKbv/OHpWBZf37mmzHaTdE47qooM2ZnRYxnnDlHxzjNH8uHxkuH4Fk+S0DYfiV2u6Fruzgul204WREorVF4p6p7Rwp3d/PXqm/Bryw== 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=xMMAjwGlAB3F1ZS0YECTi+W2XuGPAK7ihaFRpIHwCdo=; b=OqUoABOEr106vuRbnKMRpX+WOzyjtjug46l3U6hMeJY3xo1G972ugJ4f8mlBWO3PWHL5O0LN8MwE8RWdD7IOrafx1hKyWGExxBxQHBZpy1cR51DaBF89EH0PmGA3Ptg+WdhMsiSM4AQAMbS9kwUdnp1wC6MRSNTF/R5L4G8xS2agIbVIWsrfNhkIjYk1zBt400xnLqgIMnDszLvq0XAqcBbppeEJBfDXrYRZDEgvw75WZadyDp91sd0hy3qOdnSS4s9gwzq5UUeCJbPBO02SZ0T/WR8EGSiUJ4YqG8nypNSIEFigqbrUu2dTIdAVJcE51/2qDcayadWtAlrxaxXqXg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xMMAjwGlAB3F1ZS0YECTi+W2XuGPAK7ihaFRpIHwCdo=; b=jCbKn94MHYct88DLIJRQY0JaE3TlRnD0aH0zKo99rBydsEVEpbV5KCzyDYsfoBsIbynuWS/GkJ6NUBFZAwNrmeVeqSJXwBKdXZPpXzKyAgiAwN1cXyZm1iE88YKtKmbJD6lHbiIG3XXxCf2buvYFTfMWV2WhGAYyJo8Vs7neycc= Received: from SA9P223CA0010.NAMP223.PROD.OUTLOOK.COM (2603:10b6:806:26::15) by BY5PR12MB4290.namprd12.prod.outlook.com (2603:10b6:a03:20e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Wed, 25 Sep 2024 13:40:14 +0000 Received: from SA2PEPF00003AE8.namprd02.prod.outlook.com (2603:10b6:806:26:cafe::c7) by SA9P223CA0010.outlook.office365.com (2603:10b6:806:26::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27 via Frontend Transport; Wed, 25 Sep 2024 13:40:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF00003AE8.mail.protection.outlook.com (10.167.248.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8005.15 via Frontend Transport; Wed, 25 Sep 2024 13:40:14 +0000 Received: from airavat.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 25 Sep 2024 08:40:11 -0500 From: Raju Rangoju To: , CC: , , , , Subject: [PATCH V2 5/8] spi: spi_amd: Optimize IO operations Date: Wed, 25 Sep 2024 19:06:41 +0530 Message-ID: <20240925133644.2922359-6-Raju.Rangoju@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240925133644.2922359-1-Raju.Rangoju@amd.com> References: <20240925133644.2922359-1-Raju.Rangoju@amd.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AE8:EE_|BY5PR12MB4290:EE_ X-MS-Office365-Filtering-Correlation-Id: bede3a90-82aa-49a5-1a48-08dcdd6795e1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: k2HT7NLsLYKZHihmFAbgBH2itGVrDX6N0Va/P6JBLjVgmdKiBmJd8JDJDC2SUtpzyjIFenBEVxg6ab0QL68bmyVJV9O4J1RHEy0qMXF2pVBsLgRbBhVXzWMQoY1y0s/6YV+Xk3d9M6jpP2aogWu9VKdzfJ+duKQlcSATsRAATUcFV9lirG1umV11lIMDCuWtvDhfy9eWbGr4PIJW1Yz5bo1Z/pJKjdhLCn4sNwtAlo1KuK6oOszGt8IGMgS9G9ZHaCbriJuvgZPo/DdCQIeD8EF4xOLv1El/gMZiThR3VtKFj4m/wTF/YYIlf+cj03XkD2+gU/WQy69WvB5zsjMJgezzQn5jQh/YuBDtf2nFLrrphSRLhPcpb+gkni9bNCtLs7YRRsZ+T18qdA+ZkkFlKoz526D4bINks4GRSiG/HBJVMMfrNvaqdhgy1IxJ0+/YsUMCGhryv7wRyskNP5toemJgfZTnQp2P5DnEwmsi0iKQlCIRU9o9BQ+NPK1DUBCWQ1mqYHfVcZTxa23zFO/RhEw7aQ1ya2IxhJ4hl58D4Z7k8FrjuIKnMSWdPmEC5jhBl97147xN2mZv99KtDz3ZM4nIF7HPDg17YCFQ0HxVso4ro8jb1F0FSfyhAHev934ExXc5r9h1/LrCd8C/gCxQ7Zr7Jb458AJYBvg37X7i907/9Va2v6h+EQpLguMt5RiCazccY0jzi6TZXjitshg0fxS4j6sK1/ZCo5lxfFPr0FY8dOLWpb519ZYOqA4A7P1YIpLgpVUP0syTAQpPN9qFbWF9w8M2ps+VzmBmRQHbsYyRSMbY1NRQLqWkKO5bSwgeJEdwDgNZPLcjS4NjGu3uf7imfC/Bhi9+Z316CCvhsm4yuSVoq3gI1JeVbyW1dHsnfHYqD2yfZ4cIT9fVdd1KTXW0N84HPilOVFXQu0j150S9W6/UXWGWq3Jplps7vmfgT8PYiyH76IBViB5Cz+5UZSPs9U4W/8+qRHZ5cVMc+EUfRoqQNnN8caDPpzNcKuSEH3gb3dfTf7/GCguHqmFvTM5NWspH0hW7eTn5E7LCyPWfM0lLq1CdyPY+6h1FCN6BaG0aLdnvMkTcRmwK5ZC9Ta3je5o+4TKWlSVQJma6kywJDDekxNx9HWma1eEsHbYz3U9seVKyAJhJ7W9utgSd05k55vnToU9LnNXfeOt2gPeqrApMlV4TNMmWmdE6dpMdApj+hQTgJVd+fNLnJ26I2hZjcBMAnSEosLBa9fESogFfx5QV5dgnZKSMmQajRlq0/kY64BBbcUIGV38HKgVpGaH4GSsKbYVVAhlicUsskS/r0XkEREeb9tvVFkAapKWat64refGzqtypmp3UFajDZBJatx2ZpYwyRiIO7u0zTlZyeC73HCk0jeoaYWoMvs8ofoBf02cx/O2Tzh9g7+JeRiXMLY9BPGimIzxLEXiqAKUcsYNbBdsMw9z+xM/DDzRk X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(376014)(82310400026)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2024 13:40:14.4914 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bede3a90-82aa-49a5-1a48-08dcdd6795e1 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AE8.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4290 Read and write the maximum number of data bytes at once, rather than byte by byte. This improves AMD SPI controller driver performance by reducing the time required to access FIFO registers. For example, with the new changes, 64 bytes of data from the FIFO queue can be read in 8 read calls (8 bytes per call) instead of 64 read calls(1 byte per call). Co-developed-by: Krishnamoorthi M Signed-off-by: Krishnamoorthi M Co-developed-by: Akshata MukundShetty Signed-off-by: Akshata MukundShetty Signed-off-by: Raju Rangoju --- drivers/spi/spi-amd.c | 53 +++++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 12 deletions(-) diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c index 7841f3292a62..00fcec903d91 100644 --- a/drivers/spi/spi-amd.c +++ b/drivers/spi/spi-amd.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -140,6 +141,16 @@ static inline void amd_spi_writereg32(struct amd_spi *amd_spi, int idx, u32 val) writel(val, ((u8 __iomem *)amd_spi->io_remap_addr + idx)); } +static inline u64 amd_spi_readreg64(struct amd_spi *amd_spi, int idx) +{ + return readq((u8 __iomem *)amd_spi->io_remap_addr + idx); +} + +static inline void amd_spi_writereg64(struct amd_spi *amd_spi, int idx, u64 val) +{ + writeq(val, ((u8 __iomem *)amd_spi->io_remap_addr + idx)); +} + static inline void amd_spi_setclear_reg32(struct amd_spi *amd_spi, int idx, u32 set, u32 clear) { u32 tmp = amd_spi_readreg32(amd_spi, idx); @@ -448,15 +459,23 @@ static void amd_spi_mem_data_out(struct amd_spi *amd_spi, const struct spi_mem_op *op) { int base_addr = AMD_SPI_FIFO_BASE + op->addr.nbytes; - u8 *buf = (u8 *)op->data.buf.out; + u64 *buf_64 = (u64 *)op->data.buf.out; u32 nbytes = op->data.nbytes; + u32 left_data = nbytes; + u8 *buf; int i; amd_spi_set_opcode(amd_spi, op->cmd.opcode); amd_spi_set_addr(amd_spi, op); - for (i = 0; i < nbytes; i++) - amd_spi_writereg8(amd_spi, (base_addr + i), buf[i]); + for (i = 0; left_data >= 8; i++, left_data -= 8) + amd_spi_writereg64(amd_spi, base_addr + op->dummy.nbytes + (i * 8), *buf_64++); + + buf = (u8 *)buf_64; + for (i = 0; i < left_data; i++) { + amd_spi_writereg8(amd_spi, base_addr + op->dummy.nbytes + nbytes + i - left_data, + buf[i]); + } amd_spi_set_tx_count(amd_spi, op->addr.nbytes + op->data.nbytes); amd_spi_set_rx_count(amd_spi, 0); @@ -467,23 +486,33 @@ static void amd_spi_mem_data_out(struct amd_spi *amd_spi, static void amd_spi_mem_data_in(struct amd_spi *amd_spi, const struct spi_mem_op *op) { - int offset = (op->addr.nbytes == 0) ? 0 : 1; - u8 *buf = (u8 *)op->data.buf.in; + int base_addr = AMD_SPI_FIFO_BASE + op->addr.nbytes; + u64 *buf_64 = (u64 *)op->data.buf.in; u32 nbytes = op->data.nbytes; - int base_addr, i; - - base_addr = AMD_SPI_FIFO_BASE + op->addr.nbytes + offset; + u32 left_data = nbytes; + u8 *buf; + int i; amd_spi_set_opcode(amd_spi, op->cmd.opcode); amd_spi_set_addr(amd_spi, op); - amd_spi_set_tx_count(amd_spi, op->addr.nbytes); - amd_spi_set_rx_count(amd_spi, op->data.nbytes + 1); + amd_spi_set_tx_count(amd_spi, op->addr.nbytes + op->dummy.nbytes); + + for (i = 0; i < op->dummy.nbytes; i++) + amd_spi_writereg8(amd_spi, (base_addr + i), 0xff); + + amd_spi_set_rx_count(amd_spi, op->data.nbytes); amd_spi_clear_fifo_ptr(amd_spi); amd_spi_execute_opcode(amd_spi); amd_spi_busy_wait(amd_spi); - for (i = 0; i < nbytes; i++) - buf[i] = amd_spi_readreg8(amd_spi, base_addr + i); + for (i = 0; left_data >= 8; i++, left_data -= 8) + *buf_64++ = amd_spi_readreg64(amd_spi, base_addr + op->dummy.nbytes + + (i * 8)); + + buf = (u8 *)buf_64; + for (i = 0; i < left_data; i++) + buf[i] = amd_spi_readreg8(amd_spi, base_addr + op->dummy.nbytes + + nbytes + i - left_data); } static int amd_spi_exec_mem_op(struct spi_mem *mem, From patchwork Wed Sep 25 13:36:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raju Rangoju X-Patchwork-Id: 830999 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2047.outbound.protection.outlook.com [40.107.212.47]) (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 61BAC1AFB37; Wed, 25 Sep 2024 13:40:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727271624; cv=fail; b=RlZEOHGDPElEjLoEg87urupatDW3fjLYBhss6DyYJm1KaRrMxpI0tNyGYa+0VMqAtx/OmlcgHdaDClbGTmPgWJgvJ/r2iN4TM9uNsk5d8GUsGIceFru077TnsLDyBkWNxdnswSDe73FomozT9j2HzAsJCfnNRjQdRUrJGG4XV2E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727271624; c=relaxed/simple; bh=olNVMU0iaGY8AxdufEiy1r1rFrmTzsLBsIscje4I6wI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=U8XcswRDXcvQhJ0TZGkN3M+tB+DQ0YpBIhEfN9QYWFyiY+jOeSFoRvY5CjAmMOLC7rsLf0nP+sCe97/Qr9Y1kVs6A4tiNPExyPqPJMG77cYMpR3n365KoMGyPds9Lc/QlUw6bZqrKYx3E5nqt9KKm8ZjonXg9H9yzXO3GQKP758= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=Khz32QG0; arc=fail smtp.client-ip=40.107.212.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="Khz32QG0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aS7bjpCFyVrHGCsO0nW2DsQ4MdXiuq2cFGrQ5yGk6Fo6/wJ8CJHj+W763/7Wx0SH7Bmg9iWjA7mN9y4J+seaV896GvP7u3dBHCQN0MAuz3Cd69IvniVmg7EJ9gdE3ndhutmGtQpYTouWP2U+dPvH+WPVyFZa96utxTAF1A7b1MEdOczKkGJhRbCFDl8LH4icKSCtDEjD8UFX55crF8gfF5jRfSJHn76mEN6akkjOBX5ftKwN2FyKflEd+egYpvVChewaUMgwI34jaG0og43pYYf1XMPT5ZdP6gO+XroGWwLvSftL1JUmhytOCzr0kvfYNYSvPBpIwc7foopZN/EOiA== 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=H4SoZhI4P0EShjvRwWHAfmRdZ3tDIyxjCFaIKZXcgAI=; b=tU8egLUYI/eSxRuH7Da1YVZJcOYDHpx6xrzOh8zdw5i9m4+Sk6MjUDaUJ3Ye0uVLhv3WYQHBnDtWCleCeJjCXHV2skzPd1rAsRUBxyv8EKUNjnFVFQkLdRQPR9HaTObZ9w0xwfRNgXIQg9gG34JeeLjakyEwRxXh/DCSoYo57d60ROlKxa0kJQthljXGZtyDTxy3SHhCRtPWG5lwxsqqiAQoCVklxpR15AChep9UkassbqsCxUeTl56Z+DUPxK0tZMMbK8Q/gqnzYsnFy2qQntSI8fas+ISa04PcJRkniE54lmyXhxU/V97vNPUSPukO4GGs5sRfFWQttkHXhZz+aQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=H4SoZhI4P0EShjvRwWHAfmRdZ3tDIyxjCFaIKZXcgAI=; b=Khz32QG06lKerynehxrbgaDpa2b7zUSlBOu0lhAp/v+TzEPYHZPwsttaL7y0fBmtr94Ewh8H2i8Gs17WasP0mFysWjsMvoHZ8gZzCnY05F+nRgVewLkVhReIaONZLwLiMGt0zJXS9Iqj9YS4J0nODdUe99fS77+TIsSw1parXSk= Received: from SA9P223CA0022.NAMP223.PROD.OUTLOOK.COM (2603:10b6:806:26::27) by SN7PR12MB8770.namprd12.prod.outlook.com (2603:10b6:806:34b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.25; Wed, 25 Sep 2024 13:40:18 +0000 Received: from SA2PEPF00003AE8.namprd02.prod.outlook.com (2603:10b6:806:26:cafe::8a) by SA9P223CA0022.outlook.office365.com (2603:10b6:806:26::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27 via Frontend Transport; Wed, 25 Sep 2024 13:40:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF00003AE8.mail.protection.outlook.com (10.167.248.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8005.15 via Frontend Transport; Wed, 25 Sep 2024 13:40:18 +0000 Received: from airavat.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 25 Sep 2024 08:40:15 -0500 From: Raju Rangoju To: , CC: , , , , Subject: [PATCH V2 6/8] spi: spi_amd: Add support for HID2 SPI controller Date: Wed, 25 Sep 2024 19:06:42 +0530 Message-ID: <20240925133644.2922359-7-Raju.Rangoju@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240925133644.2922359-1-Raju.Rangoju@amd.com> References: <20240925133644.2922359-1-Raju.Rangoju@amd.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AE8:EE_|SN7PR12MB8770:EE_ X-MS-Office365-Filtering-Correlation-Id: 72b6025e-608b-49af-510c-08dcdd6797fe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: PSaa+FU7MLJpQsn4OvpGWatkc0v+fDc8dGz/TuCRth0nmMw3Y4sTP4imbu0S20wrBvfOO/H+bY8CQX7mhNVADZgIh5tp+rWGJ3qxIbsJmPymgdS6mwWlCr76Bs8Ws1lOcuxUiev83F5YynMvmT1gCWrmxjQ11TTlrMDbJI5CsFvAuAucND9V+RfLf2uCqzWwcu4pd5eGb1D8hzYuqVzil6UcfU6uwWO27lmbS9AZrDQta4X4OWE1R86YFcpc1gV/r0O0zexWL7EfwoUWpsjuqE/zi2XucJqycrUXytZOtwSuaCGqgEp3O9plsEXVwbLNw+wddGe2NUkhn2upof5+yWKwHWi9YZ5/69TPv/o6R/IEBrniOlmr6O+8uVjV8umZ+gEz3vB776bkyEGrIAdfoAwH7pcR+nowGEtwNDVYJJYN5KAo73pdOfLOQW8NLZ3W6j1/ODa4FtqEpnkZrHkuu5xMEP5mQYaPrYZxhmIcAdXDzpZgH8RxCHQLNMWm6CjnWOan8XWVeE4p4lm7paXgR6yrGtpHpS2ApXryJ0UsAXzTXfvtFvWfE2hlR5N236LnUE3misAA6haZsPWHm0402SLijETRwYmPM4TdWLF2cb3sqQCY0/khY0kNTAOMS4J0GGsbor32iVC/KGjNv+0/Z3ytg2L3Q+3Nt1aJZwtT1ZkZlrdsxceoK1k0mc1ntQVQDBXq8K1LaF8VbH0t15GR9ZwIew8PuLLlYML9jG6Ktmb0PUKhgcqIUmfo2TcliVH3oBaAZOGXyv/5DgnygFZdsuht2By25xAsiDjiEezFgdtam9/pGzknkTxuwqNpNLfaWYsy6Ta8FpL71EDt9MtJ5WyxPQwrpa10cuxL3PBPzECIHCxcwD6voyZCu+SWUHxbkPAD5njMTaOhEAFq/4+HcZjMRHC1NXKaZC2T3besZf/j8kv08PEt9+h3LAoTYLHE+dJDqAQVBMM7D/54ugkaK2qXhnRQqVII9zF6hhCMZxraU766Wa2ld7hB5Fgbh39UO0xXV9Qr9oKtkxhAiZEdiQXwD0HVzgv+1MVjh6RRhfDK5wGSzpLYG7QJeSF8yZXK7RSG0+BoDMLsDtWeO0+zZVGU4NK7w7VjUFjpUMvjW8v0Pa3ZwHYRshTUekJ4sOb5Dmhbd0wKTSe/+ekyyoU+dzQCOG9mlGZpOFW5d5FFo46ERv5im8EjQ9Acc7SajyZHhAVJ2PCztIpUSZP5BNKwlfoZl5YnjtO+ORgfuctOqzj/r4d/jPJZDdWd7rfbhZllXCBdk1LtJKX9Nna1t2zztPCFmCsBoMzvi7j3hN1NVmlAx8TzmhubVeXZ5kmuSLAKXQ/AOL4XBO0Bi4q0sgpRmom37YL2T7IrrGsBkigXm6Hbm6ZtQxHpYgmZfcQdnDiGlKMSyKAQL8ICfeGdXICf/tg7297xq/nQng+x9Otr02shGCsHVzLB33SvILk2p5Sq X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(376014)(82310400026)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2024 13:40:18.0226 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 72b6025e-608b-49af-510c-08dcdd6797fe X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AE8.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8770 AMD SoC has HID2 SPI controller in addition to the existing SPI0 controller(AMDI0062). Add HID2 SPI controller's ACPI ID AMDI0063 with its version ID to the list of supported devices. Use the version ID to differentiate the register offsets. And, the AMD HID2 SPI controller supports DMA read, allowing for up to 4 KB of data to be read in single transaction. Update the SPI-MEM support function to reflect this capability. Co-developed-by: Krishnamoorthi M Signed-off-by: Krishnamoorthi M Co-developed-by: Akshata MukundShetty Signed-off-by: Akshata MukundShetty Signed-off-by: Raju Rangoju --- drivers/spi/spi-amd.c | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c index 00fcec903d91..f146366a67e7 100644 --- a/drivers/spi/spi-amd.c +++ b/drivers/spi/spi-amd.c @@ -38,6 +38,7 @@ #define AMD_SPI_FIFO_SIZE 70 #define AMD_SPI_MEM_SIZE 200 #define AMD_SPI_MAX_DATA 64 +#define AMD_SPI_HID2_DMA_SIZE 4096 #define AMD_SPI_ENA_REG 0x20 #define AMD_SPI_ALT_SPD_SHIFT 20 @@ -70,10 +71,12 @@ * enum amd_spi_versions - SPI controller versions * @AMD_SPI_V1: AMDI0061 hardware version * @AMD_SPI_V2: AMDI0062 hardware version + * @AMD_HID2_SPI: AMDI0063 hardware version */ enum amd_spi_versions { AMD_SPI_V1 = 1, AMD_SPI_V2, + AMD_HID2_SPI, }; enum amd_spi_speed { @@ -182,6 +185,7 @@ static int amd_spi_set_opcode(struct amd_spi *amd_spi, u8 cmd_opcode) AMD_SPI_OPCODE_MASK); return 0; case AMD_SPI_V2: + case AMD_HID2_SPI: amd_spi_writereg8(amd_spi, AMD_SPI_OPCODE_REG, cmd_opcode); return 0; default: @@ -209,6 +213,7 @@ static int amd_spi_busy_wait(struct amd_spi *amd_spi) reg = AMD_SPI_CTRL0_REG; break; case AMD_SPI_V2: + case AMD_HID2_SPI: reg = AMD_SPI_STATUS_REG; break; default: @@ -234,6 +239,7 @@ static int amd_spi_execute_opcode(struct amd_spi *amd_spi) AMD_SPI_EXEC_CMD); return 0; case AMD_SPI_V2: + case AMD_HID2_SPI: /* Trigger the command execution */ amd_spi_setclear_reg8(amd_spi, AMD_SPI_CMD_TRIGGER_REG, AMD_SPI_TRIGGER_CMD, AMD_SPI_TRIGGER_CMD); @@ -375,6 +381,7 @@ static inline int amd_spi_fifo_xfer(struct amd_spi *amd_spi, case AMD_SPI_V1: break; case AMD_SPI_V2: + case AMD_HID2_SPI: amd_spi_clear_chip(amd_spi, spi_get_chipselect(message->spi, 0)); break; default: @@ -418,15 +425,29 @@ static inline bool amd_is_spi_read_cmd(const u16 op) static bool amd_spi_supports_op(struct spi_mem *mem, const struct spi_mem_op *op) { + struct amd_spi *amd_spi = spi_controller_get_devdata(mem->spi->controller); + /* bus width is number of IO lines used to transmit */ - if (op->cmd.buswidth > 1 || op->addr.buswidth > 4 || op->data.nbytes > AMD_SPI_MAX_DATA) + if (op->cmd.buswidth > 1 || op->addr.buswidth > 4) return false; /* AMD SPI controllers support quad mode only for read operations */ if (amd_is_spi_read_cmd(op->cmd.opcode)) { if (op->data.buswidth > 4) return false; - } else if (op->data.buswidth > 1) { + + /* + * HID2 SPI controller supports DMA read up to 4K bytes and + * doesn't support 4-byte address commands. + */ + if (amd_spi->version == AMD_HID2_SPI) { + if (amd_is_spi_read_cmd_4b(op->cmd.opcode) || + op->data.nbytes > AMD_SPI_HID2_DMA_SIZE) + return false; + } else if (op->data.nbytes > AMD_SPI_MAX_DATA) { + return false; + } + } else if (op->data.buswidth > 1 || op->data.nbytes > AMD_SPI_MAX_DATA) { return false; } @@ -435,7 +456,19 @@ static bool amd_spi_supports_op(struct spi_mem *mem, static int amd_spi_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op) { - op->data.nbytes = clamp_val(op->data.nbytes, 0, AMD_SPI_MAX_DATA); + struct amd_spi *amd_spi = spi_controller_get_devdata(mem->spi->controller); + + /* + * HID2 SPI controller DMA read mode supports reading up to 4k + * bytes in single transaction, where as SPI0 and HID2 SPI + * controller index mode supports maximum of 64 bytes in a single + * transaction. + */ + if (amd_spi->version == AMD_HID2_SPI && amd_is_spi_read_cmd(op->cmd.opcode)) + op->data.nbytes = clamp_val(op->data.nbytes, 0, AMD_SPI_HID2_DMA_SIZE); + else + op->data.nbytes = clamp_val(op->data.nbytes, 0, AMD_SPI_MAX_DATA); + return 0; } @@ -592,7 +625,7 @@ static int amd_spi_probe(struct platform_device *pdev) amd_spi->version = (uintptr_t) device_get_match_data(dev); /* Initialize the spi_controller fields */ - host->bus_num = 0; + host->bus_num = (amd_spi->version == AMD_HID2_SPI) ? 2 : 0; host->num_chipselect = 4; host->mode_bits = SPI_TX_DUAL | SPI_TX_QUAD | SPI_RX_DUAL | SPI_RX_QUAD; host->flags = SPI_CONTROLLER_HALF_DUPLEX; @@ -616,6 +649,7 @@ static int amd_spi_probe(struct platform_device *pdev) static const struct acpi_device_id spi_acpi_match[] = { { "AMDI0061", AMD_SPI_V1 }, { "AMDI0062", AMD_SPI_V2 }, + { "AMDI0063", AMD_HID2_SPI }, {}, }; MODULE_DEVICE_TABLE(acpi, spi_acpi_match); From patchwork Wed Sep 25 13:36:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raju Rangoju X-Patchwork-Id: 830998 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2047.outbound.protection.outlook.com [40.107.93.47]) (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 202151B29D9; Wed, 25 Sep 2024 13:40:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727271634; cv=fail; b=mK3o9WkJKvd0E7V+lGYFj9MjWGQxgFOFk90JkwO+wZ7dQec7PYnuhYHlFjhShx1cQN9a588Dis3XirLUC/yJmBkqc8Jsd9BCWdVy1COnPzSEoOEzdZk0ahLt3ttpvvGbIdxy/PMatUQbtYQr15H2MvobS6oBWMWWihZYDVPjV0M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727271634; c=relaxed/simple; bh=T1WBBlENekmNm1+3P0QP1VG3FxhaF37d52O3NSvRToU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=U7kZzTi4IeIddMTkr7dOpNFwtdxa/+/1z549Bbi+mBKzhq0vfQYc3DVVIOcffwljVs2F3R5B8BRLuiRfSJjfhCE6MOmjoz8WF8edVrl9c+leu4JfgcT+NKkC5Ub7oNLU8hpmez/pzM8q9P21YvAd0bG97U9IehYZkW8fWJl41Jk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=ibmInqCU; arc=fail smtp.client-ip=40.107.93.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="ibmInqCU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nmq3HvEwTGo6CB2mN9lfZIUle2X2jdc1GZqLSI5u9uLceHKYNtx10ZL0cevkM0SZVDb4VbcEai4Hwpf49Fgz/++ZUkRONe8ExByu/eCrU3BemcOe5Gz5wGfeNmw47fxhza0AS+VrauAuuQYHggIU/8PSeuYP56BmX1ztaC6HXNZjt3DQYi0DdDs4zB5RM/vB1xyBvLrKY8MxjjdnSpVFOCG7C8U35+g6EmRt8eVkE6/P7kZMN/OhmmpWv267nEhMl8qzd8rVffmTl/kuyvYMRG7J4dt0WNCZXc+5gbyX68SGEFCMh0bJzOVSglt4nPsWaRquYMh6BC9fXeHAbh0SFw== 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=/BdVuzbL2D+alHG7nUTDPxI61FWIzoKqkJ/9uIblQUU=; b=RSbhniMmcBBMUTHirGzynHqCsR572OfI7/83r51VJ+3f3z5h2UAl3Ep/OZll0Uf3KmlL515EXs6aj39vz9fPbuSaSF32vBwiyE7AJ7JDYb4NC4ZgAQ+fB8uiu2em0NDQXsma/ldhJZ0kyn1Wltpga5tyN/jlHfRHb6+6kDKM3HPHp0c5dBXxMqicEGdkZsDNOcsVqeuBS6KDpLhqOuxBoDAXxaTkq/GqHHfXa4HKhcm8sdVZFB3V5L8iT7pZw+M9DPlQsLSL8tcARTcJd9zyA0jBe5CAeIIolzTmjddXEmSVmHfNbIJGefMZa9MCM+pGouXrWz9r+0gCN3JJvTgVRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/BdVuzbL2D+alHG7nUTDPxI61FWIzoKqkJ/9uIblQUU=; b=ibmInqCU170KdqyVDxwrBCciyC4P5R89AGSdjsRY7RzPZ5aHfYwdqT+hW2VLEt1ZyhzKTd5Rt03QPeqn4+feKuNpU8Pj/y4rTlpfv39at55aCCSJgPLk470xIzdPsSZ1iW5uVFoOqNHOzks2SkpU5domH1eO4Lm0SFwMCzHAShY= Received: from SA9P223CA0016.NAMP223.PROD.OUTLOOK.COM (2603:10b6:806:26::21) by IA1PR12MB6284.namprd12.prod.outlook.com (2603:10b6:208:3e4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.28; Wed, 25 Sep 2024 13:40:21 +0000 Received: from SA2PEPF00003AE5.namprd02.prod.outlook.com (2603:10b6:806:26:cafe::1a) by SA9P223CA0016.outlook.office365.com (2603:10b6:806:26::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.17 via Frontend Transport; Wed, 25 Sep 2024 13:40:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF00003AE5.mail.protection.outlook.com (10.167.248.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8005.15 via Frontend Transport; Wed, 25 Sep 2024 13:40:21 +0000 Received: from airavat.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 25 Sep 2024 08:40:18 -0500 From: Raju Rangoju To: , CC: , , , , Subject: [PATCH V2 7/8] spi: spi_amd: Set controller address mode Date: Wed, 25 Sep 2024 19:06:43 +0530 Message-ID: <20240925133644.2922359-8-Raju.Rangoju@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240925133644.2922359-1-Raju.Rangoju@amd.com> References: <20240925133644.2922359-1-Raju.Rangoju@amd.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AE5:EE_|IA1PR12MB6284:EE_ X-MS-Office365-Filtering-Correlation-Id: f36f6f42-3547-4dac-dc44-08dcdd679a0f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: qKJgwnj7IydTdZ5Po24yAuh3yJnjLRS42leGxynLzyQUhvstT0pwCo5tioFPAGYx4d+CtRps1OtGvN+5oAlWMMqBM37AJ0TnpMKZUxr9H+wcto2b+KR/NW6cwOKAJg9KNJfxysyK0eEsXV1qdTlFJ7gBZJj8dWSkHDKFi7NpmKuBW+0g8HFNQRKX623IbbqO0AeWXg/SyMLpkn+QVnpl8ZdtLXgk2MjOqu6pm/utqD6LF2OObbHKycMlrAN3dbcJXMKiwsiKbLqtX82bmpOdKT81jepC17fA+fyEqJZx490RcQ5a/zyqqF37vN5UIRup1QpJIrAd+FYMPUdgjFBS8TegMaoPUhGnQZA8fUhnHSvlT9Vf5mEGt/EldHsiDzDGxMaQV2DTL/Pw1AvrQ120Fti5wC2x6JaEVh7uLMx1vRoyDwwcOf5earVxknRl64KvqfwhpE1lrbW4c3WjEN33xMEMhzUl4ZaebGoETKsUpY/tfvHVfMJF+8k5ryJHwwRzHz7d4iGEINQegquypbgadfQDOTcpMwbKIU2wvsilLD2APS/Tmsl6SwTLQcyJkdJpipsNuxkAEbXFpAAZOm+SmjKe/V68U7oMKekoB4e5SyklCxYfhVKjc59wQEI3zjIotD8nDA+iVlItuOUvycz3t3HN9G7Ks2UBbdor7cTyjhkKEFUX/ISUBP9X9OCKepdurT00MuJHUgu34LaIJsw+ieOp0AAwdgGmqPM6mqdR3IiOtKQyWJh2IoGVnTah5Rppe4CasSPEtlSDg/6cclVeY3avVkPixv059v2cx0ucJn461Nm/eZbUwyhCXAu5pos3eACXMoGlzwE8Alcp3E/74DHkP3rIERHbBbQmgbIJbXZUkMwQUd6a4eAwV73VQYzWjX/Iqwk5o5gjI9X7bl96uWlqej0bW5kF13+Bt53YjxUh9TULvhNttan3rWyBOQ7rA/svIwvk0/LJYCrMxyoCr+K9sZjkAUoZv6o8ZziUppZ2gXkUCrxgCALfgj63WuR1AZBunMOBphBjkoILbTG1ollctKY2nc5af4Nrnik/wGE3Zgiata9ecH7G1kpuxM8tqXDt9pW/GDHCQqLCy9Tjh8XF/GY7y7XWgjlsdIjYaa5Dl1cX7/PZsw5od8Yg8Xt0Qd0Qxr+z5sTXBlmlrIPfdCiplbd6vKI/fPZf5rsS1j2PEsDxnuqrifjtzHdkX3ak/sjxGgAdphftf8Ty3tYJt++F04wvZL2Y0ZsvwlNl9BKhmaHz/bUixOkqRXNH9JluFUrlm2WQ2i2HF9PJHGBxZAWm7C4U6rUPcLmSymH/f+hCgfvz5+wEbRjlycV8joKt9LDtqf5t/4agiSanRGZYywiPaDhtWc0h3NBwi6aN1Fi17DfUI24aBbs1NXRagvuJGRyUGxVf7z4+FDM/5zjPHRUm9kQqvTvKKEwk1apNELW52sx6jPQl5LsRZAvYFtX7 X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(376014)(82310400026)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2024 13:40:21.5087 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f36f6f42-3547-4dac-dc44-08dcdd679a0f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AE5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6284 Add changes to set the controller address mode before initiating commands. The AMD SPI0 controller(AMDI0062) supports both 24-bit and 32-bit address modes, while the HID2 SPI controller(AMDI0063) supports only the 24-bit address mode. So this change is applicable only for SPI0 controller. Co-developed-by: Krishnamoorthi M Signed-off-by: Krishnamoorthi M Co-developed-by: Akshata MukundShetty Signed-off-by: Akshata MukundShetty Signed-off-by: Raju Rangoju --- drivers/spi/spi-amd.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c index f146366a67e7..50dfdf2ab6ee 100644 --- a/drivers/spi/spi-amd.c +++ b/drivers/spi/spi-amd.c @@ -34,6 +34,7 @@ #define AMD_SPI_TX_COUNT_REG 0x48 #define AMD_SPI_RX_COUNT_REG 0x4B #define AMD_SPI_STATUS_REG 0x4C +#define AMD_SPI_ADDR32CTRL_REG 0x50 #define AMD_SPI_FIFO_SIZE 70 #define AMD_SPI_MEM_SIZE 200 @@ -548,6 +549,17 @@ static void amd_spi_mem_data_in(struct amd_spi *amd_spi, nbytes + i - left_data); } +static void amd_set_spi_addr_mode(struct amd_spi *amd_spi, + const struct spi_mem_op *op) +{ + u32 val = amd_spi_readreg32(amd_spi, AMD_SPI_ADDR32CTRL_REG); + + if (amd_is_spi_read_cmd_4b(op->cmd.opcode)) + amd_spi_writereg32(amd_spi, AMD_SPI_ADDR32CTRL_REG, val | BIT(0)); + else + amd_spi_writereg32(amd_spi, AMD_SPI_ADDR32CTRL_REG, val & ~BIT(0)); +} + static int amd_spi_exec_mem_op(struct spi_mem *mem, const struct spi_mem_op *op) { @@ -560,6 +572,9 @@ static int amd_spi_exec_mem_op(struct spi_mem *mem, if (ret) return ret; + if (amd_spi->version == AMD_SPI_V2) + amd_set_spi_addr_mode(amd_spi, op); + switch (op->data.dir) { case SPI_MEM_DATA_IN: amd_spi_mem_data_in(amd_spi, op); From patchwork Wed Sep 25 13:36:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raju Rangoju X-Patchwork-Id: 830697 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2043.outbound.protection.outlook.com [40.107.223.43]) (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 748971B29BC; Wed, 25 Sep 2024 13:40:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727271632; cv=fail; b=PadbTn8mOhjC26ErD1jeMTtvNvIE9oMxPa4xKPZo85VzAj4KqGaULXxfxJ0Yvuhrbmkaf6Xa/InKAyOsITkcLHARmmaic8qRcaG4tnEhMcqDNk7KbVrO/93JuMNrcilPg2u4CZPsbMxBC4baJYd1p7gHy5N8sJbBAaD6YoyJhGo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727271632; c=relaxed/simple; bh=BPA9CHn0C6X7L6kxzcNKvfMD6fC1h3fRo0uRdKsv/+E=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JCmp16ZRZzknTEQ98zl5aoqVpIzwoyq4uH5iwNw6FbHdhYvL+Kz0Lxe2oT0xllO23M/3tXQetVLm2kiahsVq+VZ8aba4w5YYn6t+A6WB3CorIr4ZJMdF26ThoDM/f+4eymf2DH9jflXZ0QEiSH89w4zmjZghcO/tdhBVGvQZU20= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=iSYEss4E; arc=fail smtp.client-ip=40.107.223.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="iSYEss4E" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lW7ai2MhAafzMD8Evz5YECS81pXt/bS9j/hx1qY6LjK+3VynKpJOZGzqLLqjBGxqJulq0e0+2UQWQqIh2tE3lQnh7UzwKop9KB2oJP4Dyy5D4vklOTN6FBD4V1WunsKVSkx7QrDkQknbK8JX+t3QCRvA38/vfhv3fjWdDwYpLVN3GVVhG0qQUbnsCLRt7n0Yziyty/69DrlcFhq4v+HhnZohbqSQCESePxFyIXJaVwrW4NnLEXRwMzX0Ut4mDw8i7GJ4zvtf3ypv1dAfKiiAtZePdb6ijE69yuEbV+GHVMKrhxPQw3RH4S4BVEE/irVZ5gXQ5MSKU80ow5pRbSZaZA== 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=UoB8fonxVrKxi1J80qLnO36TPR/ZpDnse3iqg2zOCsw=; b=AQFOk/SN/PKA493wuuTb3jsnkhIRHdIvduc23rRbuOVZTdyflCf0mOGD2d4J+tVTPV+07GKIpw4HnK78UUIia4VBd59tgroXHpdyX/1ZZK404nKyqMRKuWcRlh3LN46Bi49oKZBWEs0AzuNGppVj9FU7Bc0f7WSaL7+XLAgnCE0Q2jiGpypGGZii9IEtW32iUkg/MZpcC+rbygja4Tbto99KDHgy2YQ8tq7h2DMq3FzFjuv87RkPKqQ5lQ9Dcl2c8wkXWCeG58dM32BySFi6Kp6hEE9fc1296BCdiua8mdt3PlZ2fz6moaB6UlregO1o8ci4W18xAE15mt9UZ7ETuw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UoB8fonxVrKxi1J80qLnO36TPR/ZpDnse3iqg2zOCsw=; b=iSYEss4EfYLaECVEd6jdSpVbMquXMgk1q+kTuYVCFtF5IR3d6JQ7XF7PSXe0OqmlbZQBS5h/IspntEr1VYJIfObh3WwEP2Fuapmz7fWZrM2Z3gy58adCYSUX7GinuLZpGgd3R64qk48u6awRWkttC3siHlIb1VsrgWxRKwCAR+I= Received: from SA9P223CA0008.NAMP223.PROD.OUTLOOK.COM (2603:10b6:806:26::13) by SA3PR12MB9090.namprd12.prod.outlook.com (2603:10b6:806:397::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.25; Wed, 25 Sep 2024 13:40:25 +0000 Received: from SA2PEPF00003AE5.namprd02.prod.outlook.com (2603:10b6:806:26:cafe::ac) by SA9P223CA0008.outlook.office365.com (2603:10b6:806:26::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.30 via Frontend Transport; Wed, 25 Sep 2024 13:40:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SA2PEPF00003AE5.mail.protection.outlook.com (10.167.248.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8005.15 via Frontend Transport; Wed, 25 Sep 2024 13:40:25 +0000 Received: from airavat.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 25 Sep 2024 08:40:22 -0500 From: Raju Rangoju To: , CC: , , , , Subject: [PATCH V2 8/8] spi: spi_amd: Add HIDDMA basic read support Date: Wed, 25 Sep 2024 19:06:44 +0530 Message-ID: <20240925133644.2922359-9-Raju.Rangoju@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240925133644.2922359-1-Raju.Rangoju@amd.com> References: <20240925133644.2922359-1-Raju.Rangoju@amd.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003AE5:EE_|SA3PR12MB9090:EE_ X-MS-Office365-Filtering-Correlation-Id: bd6e5ee7-ce00-4806-fe26-08dcdd679c38 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|82310400026|376014|1800799024; X-Microsoft-Antispam-Message-Info: Ti/gFs9ykKY6+zxI6z6mQS6xFdPgUW6b2YSE4LLrBDsaYqFqoUO0AGc11H2dhhjMKz2oq4ymgORqMpBpnHFu/0XDs0s/qmVIzae4B4Tmw0B6qyvRZwCUXG19w4hWdq26EXhbZlpW/ej04nMDkqdNnvgvmJZhAGJV3lhRxMTrA/tjqiVA3s4rFqwFg/fxtg1qBFU57oZbSmVW+2GsOHVrzjjrrNhO1g7tokr3S+y3VJAwwO0ZfuFizGF3heHqB9SkV766fHQq6X00kQayvw7hcK1BLuIk6LMpQgcBNTJX+SGvjZ4Sh/fvwJwv/hGxC2m8MsPKK9MdRNF12xkFay7Gm35Kq/ACXo1H6zXUWF85R3u51x/fOhT6QxVNu3dvqL07A+xiqn/hOQYlZ92fgF07Fzoyzf2qH2/bRWYc/feNa5/78vHLfiEiKeorliaEJAg7rVC7nIF2oBJeGqsQQvyQA2rm6BHlLZFWzYoiFey+NFw8XXMQiihiM+Lxi4Rz7LiP2hDjTH/dbnHev/0mlphUKFgLUS3FYftkG7kE4gSQ7ZSo5HKIVAe170Yyym045hIdoUItY7VXdlsMkWThs5HtIpQCYIpqLJcY6j8LvMdxl87e7OjL4nlXixGw6HcZkpfmV9K1CIBTHNGWl84mRO0qQtH3PIZL/SI2zfSYvY7g0/HoT13xf1ZefVM/Aqtk2lHicRAr955e/G84lpz/Z2ciR5CO6yhPNsP7lu8di0Koq4qt/59UC35BQNyaEELU9MJdOGabVfNvFhtA26nRq1mYgtkfoFAUz7RG+EsK8/d7/2YunJIO5ytp1cDsnjpwZJpLTu5bLCPe8+RfCUyMmQsSPK2uWjbwvTJa1lszMUqoFowSNUcO2cVF+P6zVYFkq6VwzRw3loUneRCHCDSzxde9CHKhmmaWVeKrXpD6HAFsbzJ6eiB5f6+O0XcakiaY8m3inDRQXCdda8kD+OqzoFPk7VrCepYiUz3lyznz++ukjb6IdL4fguGoe4NXJtb4HNGxhC1IBWKeu6FLekfROXB3TQzp16mf/sbhlfwebC9utibGFPfpkGEcmMTXFZ0vtbYeoClyjqlqpJv8c2bhBemxVS1CED9q+zWKBfdI4L/1+ZSykRCzAvd0eGFBE+7CS5j9dcnOoTaRcFcOkLpHqr6SdVHYrYhDbY55TGitr/rDPxWlwg44V4HEKbhIGocXohdGLLzyezdnTNdj0Go5QqWYtJKaVGW1APoG8XxafArxrcfK5bi5a0KHB7+sw/gTIiFygAGgA3DsiH7yXTh8srUS+54Q3N1yukbTc+OHKMkqd5VFow3beaaGlAwyA1AlqsL05Kebg7vyWC6ZVzpFgVLbf/Cw7nK5NS3lsMapN8RyDBmL9g8QBlw2rxTc4j7n6+dfq3StFkpR6cfoaT/yTLXYHINIKylacsog5ub/qWoiwO7Y8cDJ3BR+0ErVUwxtI5rt X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(82310400026)(376014)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2024 13:40:25.1337 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bd6e5ee7-ce00-4806-fe26-08dcdd679c38 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003AE5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB9090 SPI index mode has hardware limitation of reading only 64 bytes per transaction due to fixed number of FIFO registers. This constraint leads to performance issues when reading data from NAND/NOR flash devices, as the controller must issue multiple requests to read 64-byte chunks, even if the slave can send up to 2 or 4 KB in single transaction. The AMD HID2 SPI controller supports DMA mode, which allows reading up to 4 KB of data in single transaction. This patch introduces changes to implement HID2 DMA read support for the HID2 SPI controller. Co-developed-by: Krishnamoorthi M Signed-off-by: Krishnamoorthi M Co-developed-by: Akshata MukundShetty Signed-off-by: Akshata MukundShetty Signed-off-by: Raju Rangoju --- drivers/spi/spi-amd.c | 176 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 156 insertions(+), 20 deletions(-) diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c index 50dfdf2ab6ee..d30a21b0b05f 100644 --- a/drivers/spi/spi-amd.c +++ b/drivers/spi/spi-amd.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -50,9 +51,21 @@ #define AMD_SPI_SPD7_SHIFT 8 #define AMD_SPI_SPD7_MASK GENMASK(13, AMD_SPI_SPD7_SHIFT) +#define AMD_SPI_HID2_INPUT_RING_BUF0 0X100 +#define AMD_SPI_HID2_CNTRL 0x150 +#define AMD_SPI_HID2_INT_STATUS 0x154 +#define AMD_SPI_HID2_CMD_START 0x156 +#define AMD_SPI_HID2_INT_MASK 0x158 +#define AMD_SPI_HID2_READ_CNTRL0 0x170 +#define AMD_SPI_HID2_READ_CNTRL1 0x174 +#define AMD_SPI_HID2_READ_CNTRL2 0x180 + #define AMD_SPI_MAX_HZ 100000000 #define AMD_SPI_MIN_HZ 800000 +#define AMD_SPI_IO_SLEEP_US 20 +#define AMD_SPI_IO_TIMEOUT_US 2000000 + /* SPI read command opcodes */ #define AMD_SPI_OP_READ 0x03 /* Read data bytes (low frequency) */ #define AMD_SPI_OP_READ_FAST 0x0b /* Read data bytes (high frequency) */ @@ -108,11 +121,15 @@ struct amd_spi_freq { /** * struct amd_spi - SPI driver instance * @io_remap_addr: Start address of the SPI controller registers + * @phy_dma_buf: Physical address of DMA buffer + * @dma_virt_addr: Virtual address of DMA buffer * @version: SPI controller hardware version * @speed_hz: Device frequency */ struct amd_spi { void __iomem *io_remap_addr; + dma_addr_t phy_dma_buf; + void *dma_virt_addr; enum amd_spi_versions version; unsigned int speed_hz; }; @@ -135,6 +152,16 @@ static void amd_spi_setclear_reg8(struct amd_spi *amd_spi, int idx, u8 set, u8 c amd_spi_writereg8(amd_spi, idx, tmp); } +static inline u16 amd_spi_readreg16(struct amd_spi *amd_spi, int idx) +{ + return readw((u8 __iomem *)amd_spi->io_remap_addr + idx); +} + +static inline void amd_spi_writereg16(struct amd_spi *amd_spi, int idx, u16 val) +{ + writew(val, ((u8 __iomem *)amd_spi->io_remap_addr + idx)); +} + static inline u32 amd_spi_readreg32(struct amd_spi *amd_spi, int idx) { return readl((u8 __iomem *)amd_spi->io_remap_addr + idx); @@ -517,6 +544,64 @@ static void amd_spi_mem_data_out(struct amd_spi *amd_spi, amd_spi_execute_opcode(amd_spi); } +static void amd_spi_hiddma_read(struct amd_spi *amd_spi, const struct spi_mem_op *op) +{ + u16 hid_cmd_start, val; + u32 hid_regval; + + /* Set the opcode in hid2_read_control0 register */ + hid_regval = amd_spi_readreg32(amd_spi, AMD_SPI_HID2_READ_CNTRL0); + hid_regval = (hid_regval & ~GENMASK(7, 0)) | op->cmd.opcode; + + /* + * Program the address in the hid2_read_control0 register [8:31]. The address should + * be written starting from the 8th bit of the register, requiring an 8-bit shift. + * Additionally, to convert a 2-byte spinand address to a 3-byte address, another + * 8-bit shift is needed. Therefore, a total shift of 16 bits is required. + */ + hid_regval = (hid_regval & ~GENMASK(31, 8)) | (op->addr.val << 16); + amd_spi_writereg32(amd_spi, AMD_SPI_HID2_READ_CNTRL0, hid_regval); + + /* Configure dummy clock cycles for fast read, dual, quad I/O commands */ + hid_regval = amd_spi_readreg32(amd_spi, AMD_SPI_HID2_READ_CNTRL2); + /* Fast read dummy cycle */ + hid_regval &= ~GENMASK(4, 0); + + /* Fast read Dual I/O dummy cycle */ + hid_regval &= ~GENMASK(12, 8); + + /* Fast read Quad I/O dummy cycle */ + hid_regval = (hid_regval & ~GENMASK(20, 16)) | BIT(17); + + /* Set no of preamble bytecount */ + hid_regval &= ~GENMASK(27, 24); + amd_spi_writereg32(amd_spi, AMD_SPI_HID2_READ_CNTRL2, hid_regval); + + /* + * Program the HID2 Input Ring Buffer0. 4k aligned buf_memory_addr[31:12], + * buf_size[4:0], end_input_ring[5]. + */ + hid_regval = amd_spi->phy_dma_buf | BIT(5) | BIT(0); + amd_spi_writereg32(amd_spi, AMD_SPI_HID2_INPUT_RING_BUF0, hid_regval); + + /* Program max read length(no of DWs) in hid2_read_control1 register */ + hid_regval = amd_spi_readreg32(amd_spi, AMD_SPI_HID2_READ_CNTRL1); + hid_regval = (hid_regval & ~GENMASK(15, 0)) | ((op->data.nbytes / 4) - 1); + amd_spi_writereg32(amd_spi, AMD_SPI_HID2_READ_CNTRL1, hid_regval); + + /* Set cmd start bit in hid2_cmd_start register to trigger HID basic read operation */ + hid_cmd_start = amd_spi_readreg16(amd_spi, AMD_SPI_HID2_CMD_START); + amd_spi_writereg16(amd_spi, AMD_SPI_HID2_CMD_START, (hid_cmd_start | BIT(3))); + + /* Check interrupt status of HIDDMA basic read operation in hid2_int_status register */ + readw_poll_timeout(amd_spi->io_remap_addr + AMD_SPI_HID2_INT_STATUS, val, + (val & BIT(3)), AMD_SPI_IO_SLEEP_US, AMD_SPI_IO_TIMEOUT_US); + + /* Clear the interrupts by writing to hid2_int_status register */ + val = amd_spi_readreg16(amd_spi, AMD_SPI_HID2_INT_STATUS); + amd_spi_writereg16(amd_spi, AMD_SPI_HID2_INT_STATUS, val); +} + static void amd_spi_mem_data_in(struct amd_spi *amd_spi, const struct spi_mem_op *op) { @@ -524,29 +609,52 @@ static void amd_spi_mem_data_in(struct amd_spi *amd_spi, u64 *buf_64 = (u64 *)op->data.buf.in; u32 nbytes = op->data.nbytes; u32 left_data = nbytes; + u32 data; u8 *buf; int i; - amd_spi_set_opcode(amd_spi, op->cmd.opcode); - amd_spi_set_addr(amd_spi, op); - amd_spi_set_tx_count(amd_spi, op->addr.nbytes + op->dummy.nbytes); - - for (i = 0; i < op->dummy.nbytes; i++) - amd_spi_writereg8(amd_spi, (base_addr + i), 0xff); - - amd_spi_set_rx_count(amd_spi, op->data.nbytes); - amd_spi_clear_fifo_ptr(amd_spi); - amd_spi_execute_opcode(amd_spi); - amd_spi_busy_wait(amd_spi); - - for (i = 0; left_data >= 8; i++, left_data -= 8) - *buf_64++ = amd_spi_readreg64(amd_spi, base_addr + op->dummy.nbytes + - (i * 8)); + /* + * Condition for using HID read mode. Only for reading complete page data, use HID read. + * Use index mode otherwise. + */ + if (amd_spi->version == AMD_HID2_SPI && amd_is_spi_read_cmd(op->cmd.opcode)) { + amd_spi_hiddma_read(amd_spi, op); + + for (i = 0; left_data >= 8; i++, left_data -= 8) + *buf_64++ = readq((u8 __iomem *)amd_spi->dma_virt_addr + (i * 8)); + + buf = (u8 *)buf_64; + for (i = 0; i < left_data; i++) + buf[i] = readb((u8 __iomem *)amd_spi->dma_virt_addr + + (nbytes - left_data + i)); + + /* Reset HID RX memory logic */ + data = amd_spi_readreg32(amd_spi, AMD_SPI_HID2_CNTRL); + amd_spi_writereg32(amd_spi, AMD_SPI_HID2_CNTRL, data | BIT(5)); + } else { + /* Index mode */ + amd_spi_set_opcode(amd_spi, op->cmd.opcode); + amd_spi_set_addr(amd_spi, op); + amd_spi_set_tx_count(amd_spi, op->addr.nbytes + op->dummy.nbytes); + + for (i = 0; i < op->dummy.nbytes; i++) + amd_spi_writereg8(amd_spi, (base_addr + i), 0xff); + + amd_spi_set_rx_count(amd_spi, op->data.nbytes); + amd_spi_clear_fifo_ptr(amd_spi); + amd_spi_execute_opcode(amd_spi); + amd_spi_busy_wait(amd_spi); + + for (i = 0; left_data >= 8; i++, left_data -= 8) + *buf_64++ = amd_spi_readreg64(amd_spi, base_addr + op->dummy.nbytes + + (i * 8)); + + buf = (u8 *)buf_64; + for (i = 0; i < left_data; i++) + buf[i] = amd_spi_readreg8(amd_spi, base_addr + op->dummy.nbytes + + nbytes + i - left_data); + } - buf = (u8 *)buf_64; - for (i = 0; i < left_data; i++) - buf[i] = amd_spi_readreg8(amd_spi, base_addr + op->dummy.nbytes + - nbytes + i - left_data); } static void amd_set_spi_addr_mode(struct amd_spi *amd_spi, @@ -617,6 +725,31 @@ static size_t amd_spi_max_transfer_size(struct spi_device *spi) return AMD_SPI_FIFO_SIZE; } +static int amd_spi_setup_hiddma(struct amd_spi *amd_spi, struct device *dev) +{ + u32 hid_regval; + + /* Allocate DMA buffer to use for HID basic read operation */ + amd_spi->dma_virt_addr = dma_alloc_coherent(dev, AMD_SPI_HID2_DMA_SIZE, + &amd_spi->phy_dma_buf, GFP_KERNEL); + if (!amd_spi->dma_virt_addr) + return -ENOMEM; + + /* + * Enable interrupts and set mask bits in hid2_int_mask register to generate interrupt + * properly for HIDDMA basic read operations. + */ + hid_regval = amd_spi_readreg32(amd_spi, AMD_SPI_HID2_INT_MASK); + hid_regval = (hid_regval & GENMASK(31, 8)) | BIT(19); + amd_spi_writereg32(amd_spi, AMD_SPI_HID2_INT_MASK, hid_regval); + + /* Configure buffer unit(4k) in hid2_control register */ + hid_regval = amd_spi_readreg32(amd_spi, AMD_SPI_HID2_CNTRL); + amd_spi_writereg32(amd_spi, AMD_SPI_HID2_CNTRL, hid_regval & ~BIT(3)); + + return 0; +} + static int amd_spi_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -657,7 +790,10 @@ static int amd_spi_probe(struct platform_device *pdev) if (err) return dev_err_probe(dev, err, "error registering SPI controller\n"); - return 0; + if (amd_spi->version == AMD_HID2_SPI) + err = amd_spi_setup_hiddma(amd_spi, dev); + + return err; } #ifdef CONFIG_ACPI