From patchwork Thu Sep 1 05:47:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kumar Mahapatra X-Patchwork-Id: 602152 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EE9BECAAD2 for ; Thu, 1 Sep 2022 05:47:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233142AbiIAFrv (ORCPT ); Thu, 1 Sep 2022 01:47:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233135AbiIAFrr (ORCPT ); Thu, 1 Sep 2022 01:47:47 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2054.outbound.protection.outlook.com [40.107.92.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B42AB1166E5; Wed, 31 Aug 2022 22:47:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a96yNSzEJ79X5MXRRhEVydOUo6/eUyp4qstojTOSwlpZsyyuz/i1Rmt13jA5EHaUTK5kBmDqfIbUKy/7etuWBCm6uvS9j711+4pXECOiUM9qkYA0P28+huGKZvK+9RCck5tcoOjMQKSJq0T2hxFoD9mbh+zUCYWQR0HjR/9DpSf6OoimWv761v2dhYVeTtULC/t0Tj+sk1BNPCZOrbbT9S+1kzyXzZks89HEKMzclcakkWqiEv7E6okNr5e6CtesLyEgzNj5eXKyhpkUGHfSH88yFKeOGQxHMMBEBFmcmgNAjeOWB/eneBr3d7pmuWxGOuSVwShDNyxuIu9h07QwOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EmB6ONnzMqepefRTO24y/1dfryzwxL8VM7b188uJcPc=; b=F83eeXBw9iradirZw4trN/ByqblrAckiVNn7UMb1beYwS5qmvA5kz673GCYbirj523bSAQucfOr2/MafAGPNFLSHqqkupV78ytTQFd/0PNtIyAOJI2RnsHfQ7ZDxsMDUHaDk37iOkYGZwcq5VYVm0upfi0G0JJf4oHJrHAEjUWm/X04k78jygz22TlbQC6ktYi90zISs4S1R/nSQfYfSKO8ozkCNuqSDXHGM6s4djReDVW49V+nBh9xRNmWpQn0a+bSXxPu4XIjZP8zWBOljPm79+IVncfUi6WUA60QwSRP9vWA5+t+fL5aIBxzZxi5OAvhYudMJKZFu/NCF8MMTSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EmB6ONnzMqepefRTO24y/1dfryzwxL8VM7b188uJcPc=; b=OXnpRhHzrGOtYVobGioRSB3D7mAPfFERucNYjqbfwvVG/fTl2j0SQ/Ee0sObJsQYubbM32QmDt24cSUtcZUB/6FoGSLGuJZJODiQewvPkVNt5801Hmu+0rzmqX+edkL0/MGHKiRSTVO0DQlH4KaVUYHYlAG8EsyvCdQ/6pgRKUY= Received: from DS7PR05CA0107.namprd05.prod.outlook.com (2603:10b6:8:56::25) by SJ0PR02MB7150.namprd02.prod.outlook.com (2603:10b6:a03:29a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Thu, 1 Sep 2022 05:47:40 +0000 Received: from DM3NAM02FT008.eop-nam02.prod.protection.outlook.com (2603:10b6:8:56:cafe::44) by DS7PR05CA0107.outlook.office365.com (2603:10b6:8:56::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.5 via Frontend Transport; Thu, 1 Sep 2022 05:47:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; pr=C Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT008.mail.protection.outlook.com (10.13.5.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5588.10 via Frontend Transport; Thu, 1 Sep 2022 05:47:40 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Wed, 31 Aug 2022 22:47:39 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2507.6 via Frontend Transport; Wed, 31 Aug 2022 22:47:39 -0700 Envelope-to: broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, git@amd.com, michal.simek@amd.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, akumarma@amd.com Received: from [10.140.6.18] (port=60724 helo=xhdlakshmis40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1oTd3D-000Eqz-DB; Wed, 31 Aug 2022 22:47:39 -0700 From: Amit Kumar Mahapatra To: , , CC: , , , , , , , Amit Kumar Mahapatra Subject: [PATCH 1/7] spi: spi-zynqmp-gqspi: Fix kernel-doc warnings Date: Thu, 1 Sep 2022 11:17:25 +0530 Message-ID: <20220901054731.7705-2-amit.kumar-mahapatra@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220901054731.7705-1-amit.kumar-mahapatra@xilinx.com> References: <20220901054731.7705-1-amit.kumar-mahapatra@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4fca99d2-9988-4549-34a4-08da8bdd7bab X-MS-TrafficTypeDiagnostic: SJ0PR02MB7150:EE_ X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: squt+33lPETo/2x0pZcUwgi9+2h9aqodPuShaUtxBRP8wp5kpCDrV30U9ijACWIf7SH2l6FPbor64otBF7N870zMoxxoo8Gl5FfzUeNzZzx4cb/06bzyQqk9fhzgjyCN11i0aMne5o7tI/VB1mQ4Kp0yYMeTPDcDtjpgg1QHmPjgIO6hqnHUJ8ugAuaNPn/p/qbq2OycXSQjhueYdw+835dj9zHugeRWkuuAy5t4QNab2tRMLHJY0QmodbbG9JYaUNu+qfnsQeLqN2Ekii+dX2OyyumasQ3iHuvJdoJ8eICVGEqrc5J6aA9cl0Y8AtpqMdnAMJxtygB6wx+jx4mOjmKePjrXqbmKnKwwZhZ8atPhr/qClnY6Egk1X+i5cjfp2BhDRc4mjKfKxI6SQgiwdY/p6Abg2Gbj6qtkHgvgwQMuQ3qeRjpDm20vKI2EhBGpKb25J2OeRpZDNXPsYJPSKvASgKaVZSzbF8M1xulHiPuYXBtisD70mQQbRAvbrrBzYsAGn3C/BTXoFYWm/PfWLtRIL7RuAUHjRZF6d6StzZ59z/mNoQQzxMWshf1dZAwtQckTOUEEYw+RxEaq5Wnq4LOndEuhTP/XnYpr2tEIiqawRiw5NQ628UmYTiXPTDh2WW9fPPy223VsJk7krxEYbGog4p+bN3IdQLvrj1mj5oNdnEOVNkm0/OpN1GPmkWYGuQA0lhnbnyeGgyaxq+HZN5/KAPSPVOnFQXQv2mEdGnupP9FwETQ/K2BSFqAVi9m4FJ1ltzXmbGVXc8evGJe1z8hBJmC9Ix0fQRSfVs4ZeNg= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(13230016)(4636009)(39860400002)(396003)(136003)(346002)(376002)(36840700001)(40470700004)(46966006)(2906002)(82310400005)(40480700001)(4326008)(8676002)(70586007)(70206006)(8936002)(54906003)(26005)(7696005)(316002)(6666004)(110136005)(41300700001)(107886003)(478600001)(83380400001)(40460700003)(47076005)(336012)(2616005)(36860700001)(356005)(426003)(186003)(1076003)(36756003)(7636003)(9786002)(82740400003)(7416002)(5660300002)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2022 05:47:40.4103 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4fca99d2-9988-4549-34a4-08da8bdd7bab X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT008.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR02MB7150 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Document zynqmp_qspi ctrl and op_lock member description. It also adds return documentation for 'zynqmp_qspi_setuprxdma' and zynqmp_qspi_read_op. Fixes below kernel-doc warnings- spi-zynqmp-gqspi.c:178: warning: Function parameter or member 'ctlr' not described in 'zynqmp_qspi' spi-zynqmp-gqspi.c:178: warning: Function parameter or member 'op_lock' not described in 'zynqmp_qspi' spi-zynqmp-gqspi.c:737: warning: No description found for return value of 'zynqmp_qspi_setuprxdma' spi-zynqmp-gqspi.c:822: warning: No description found for return value of 'zynqmp_qspi_read_op' Signed-off-by: Michal Simek Signed-off-by: Amit Kumar Mahapatra --- drivers/spi/spi-zynqmp-gqspi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c index 2b5afae8ff7f..b07bb97cf874 100644 --- a/drivers/spi/spi-zynqmp-gqspi.c +++ b/drivers/spi/spi-zynqmp-gqspi.c @@ -139,6 +139,7 @@ enum mode_type {GQSPI_MODE_IO, GQSPI_MODE_DMA}; /** * struct zynqmp_qspi - Defines qspi driver instance + * @ctlr: Pointer to the spi controller information * @regs: Virtual address of the QSPI controller registers * @refclk: Pointer to the peripheral clock * @pclk: Pointer to the APB clock @@ -155,6 +156,7 @@ enum mode_type {GQSPI_MODE_IO, GQSPI_MODE_DMA}; * @genfifoentry: Used for storing the genfifoentry instruction. * @mode: Defines the mode in which QSPI is operating * @data_completion: completion structure + * @op_lock: Operational lock */ struct zynqmp_qspi { struct spi_controller *ctlr; @@ -732,6 +734,8 @@ static irqreturn_t zynqmp_qspi_irq(int irq, void *dev_id) /** * zynqmp_qspi_setuprxdma - This function sets up the RX DMA operation * @xqspi: xqspi is a pointer to the GQSPI instance. + * + * Return: 0 on success; error value otherwise. */ static int zynqmp_qspi_setuprxdma(struct zynqmp_qspi *xqspi) { @@ -816,6 +820,8 @@ static void zynqmp_qspi_write_op(struct zynqmp_qspi *xqspi, u8 tx_nbits, * @rx_nbits: Receive buswidth. * @genfifoentry: genfifoentry is pointer to the variable in which * GENFIFO mask is returned to calling function + * + * Return: 0 on success; error value otherwise. */ static int zynqmp_qspi_read_op(struct zynqmp_qspi *xqspi, u8 rx_nbits, u32 genfifoentry) From patchwork Thu Sep 1 05:47:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kumar Mahapatra X-Patchwork-Id: 602356 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C566ECAAD8 for ; Thu, 1 Sep 2022 05:47:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233146AbiIAFrw (ORCPT ); Thu, 1 Sep 2022 01:47:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233137AbiIAFru (ORCPT ); Thu, 1 Sep 2022 01:47:50 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on20602.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5b::602]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F26D11166E6; Wed, 31 Aug 2022 22:47:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WMBYCWA2VJZt8w7UVUgTW/Yggzc8JI7AnelTNpZeaOp2nuCyBJv6XuYH8sZaetwwW7/Vkrvh+onGqcQO4L92OYYqDBttXjs5E0TNU0XmXX/lk8nNxqMQl2w/PPuHU+j9RU8GEeBsNhb2nREbKWSj0pF24/bpuEqdx7FPERb9AYwK70HRgnLcin7pBU2r7XsRg6QRXN/S4CTtQWhIsN/IvToM7LJbA1dNNrLD2BdW9rRn6hvWHSpJIQvZFDFrRIBIB61gcy2BlPWkj2UOfj4OY0dsyd6+41lzF8Z/8D/VRsTll7HOmUmZ0W+h7qkBXaEUKvM0SIEa9vCm4CDnh9hYNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UgsZg/jnrHjQmMNSN9GEuuFrEMAg6JLBScz6NtXlJGs=; b=T4ie4zNvQL58u3rFr6bHtGxSOZjbxnziRCnoQgmUmRJeKttp33U5fu2Aztj/1OpxQseebnOu7yOqe+lstPxK3RtVf9LP3WbS30/hRK6BWXQuqwnMpeAy4uNU6RY9zMCQ64i9dj6rPy14iu77nOnYiLDeTLN8s/OlrfHMmmzroAzkPckdzl9Ne2a9LQIxlnBQWjOHKZYLOaoKAvmxvPMfrPqlO4esii0dFM7CSXQ+fQtxhqreo5R1j40mpAhtRnJCbrW/6X20wpmI6qSOHAPVWOSmaSws/rBWggcD4MJx+tyJsoKO04ru5fiZlTvgBVs9Jfa2Bo7fgXwMvW3+3n9XAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UgsZg/jnrHjQmMNSN9GEuuFrEMAg6JLBScz6NtXlJGs=; b=LJMQ/VLTGhnqB92qQ11OtG/GfoW9SPXoYra83U0/UoOMfE4dOTwIou/Lb58/RPNeogXCWrn0fk4pgHwoMEKJbx6UVuZMukWvKpXop8c6c8zMDCRKaY0EdBsdxfybz3m6NGK7VHx8KtNuW6mPrCVsL8YwxUIuszEk1tb7UGRVQAQ= Received: from SA1P222CA0060.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:2c1::10) by SN6PR02MB4894.namprd02.prod.outlook.com (2603:10b6:805:95::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.16; Thu, 1 Sep 2022 05:47:45 +0000 Received: from SN1NAM02FT0034.eop-nam02.prod.protection.outlook.com (2603:10b6:806:2c1:cafe::dd) by SA1P222CA0060.outlook.office365.com (2603:10b6:806:2c1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10 via Frontend Transport; Thu, 1 Sep 2022 05:47:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; pr=C Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0034.mail.protection.outlook.com (10.97.5.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5588.10 via Frontend Transport; Thu, 1 Sep 2022 05:47:45 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.6; Wed, 31 Aug 2022 22:47:42 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2507.6 via Frontend Transport; Wed, 31 Aug 2022 22:47:42 -0700 Envelope-to: broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, git@amd.com, michal.simek@amd.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, akumarma@amd.com Received: from [10.140.6.18] (port=60724 helo=xhdlakshmis40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1oTd3G-000Eqz-Gr; Wed, 31 Aug 2022 22:47:42 -0700 From: Amit Kumar Mahapatra To: , , CC: , , , , , , , Amit Kumar Mahapatra Subject: [PATCH 2/7] spi: spi-zynqmp-gqspi: Set CPOL and CPHA during hardware init Date: Thu, 1 Sep 2022 11:17:26 +0530 Message-ID: <20220901054731.7705-3-amit.kumar-mahapatra@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220901054731.7705-1-amit.kumar-mahapatra@xilinx.com> References: <20220901054731.7705-1-amit.kumar-mahapatra@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0284e752-78c6-4e7a-acd0-08da8bdd7e9f X-MS-TrafficTypeDiagnostic: SN6PR02MB4894:EE_ X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3rAacHM/2wn4PgoAJPugUQz3b946ZMxNzi/ZJhYhgXNjKYrbrvGY8nNvrW0ivX9fdMI+t/KZOggZP9kHcZPbZ16gP8+KXj+NrKMQOJMhgnR/Xz/yJF4k/cax340E7IafMJiBxcSUWzs4PLyWJ2KeQxQwy+tnlYDPxrYqxr7Xdx8BaVvXcxJMZpvBCgfcxNN10YaxEDDgoj+h92u6ns9ULr6YJz8pXZChOYsQpGSANziblNAsNAWNGUJqUOC/c3V96WlUG8EdDyAG3fi+kjA50hvbHgm/zOHPNnrMWneaKPO+4zBw4f0De0hy0sXVT8QYQeJcaassR24LAmLmqip4CnSBaGEgyshcGgLI8ZI2+g7B2CoKEgEnFiuZdFAlIc75OXkR7QYh04kqVkNUExIHG12aUTCFs/tAppTa+T3FoJnRwpDGZvZVNEtpBMMZ9yVDyRO5WXGsGwqPt0L/AbtQQTpfAIrcIW7eiaGpC41OLyjk17+s88RlSzhGbPCXF8eGGYs8JVTrq+R62JWK2qxDyb5m71A020wPFUZGNwLObjF2dooOrMDx/8pXMcopFFTuYJSkYfBW9cSUe8SVXS8beRPzarBrpjISuiqvIEg7VhGuG0acuEXU9m2DI1B+sdcRNRfxO5mbS8isfvCxLDxhLHdeliBtNKOZLwSKrkuVNGtJnULBFjY34XdaATa0yXtr0tWrwLaD9FwK4aSisK9XMR0DmSXU3nwoE+cMY9iFL1iirhsmeVla0pgh99X+/x2w/oFGFQXIZfstpqELvD6y9QFObihEszA5FWOlMxZqr4k= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(13230016)(4636009)(346002)(396003)(136003)(39860400002)(376002)(46966006)(36840700001)(40470700004)(6666004)(8936002)(8676002)(9786002)(4326008)(110136005)(47076005)(1076003)(426003)(5660300002)(36860700001)(2616005)(7416002)(70206006)(70586007)(2906002)(54906003)(316002)(36756003)(107886003)(478600001)(41300700001)(7696005)(26005)(82310400005)(7636003)(356005)(83380400001)(336012)(186003)(40480700001)(40460700003)(82740400003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2022 05:47:45.3836 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0284e752-78c6-4e7a-acd0-08da8bdd7e9f X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0034.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR02MB4894 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org During every transfer GQSPI driver writes the CPOL & CPHA values to the configuration register. But the CPOL & CPHA values do not change in between multiple transfers, so moved the CPOL & CPHA initialization to hardware init so that the values are written only once. Signed-off-by: Amit Kumar Mahapatra --- drivers/spi/spi-zynqmp-gqspi.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c index b07bb97cf874..6771496c1f86 100644 --- a/drivers/spi/spi-zynqmp-gqspi.c +++ b/drivers/spi/spi-zynqmp-gqspi.c @@ -264,7 +264,9 @@ static void zynqmp_gqspi_selectslave(struct zynqmp_qspi *instanceptr, * - Enable manual slave select * - Enable manual start * - Deselect all the chip select lines - * - Set the little endian mode of TX FIFO and + * - Set the little endian mode of TX FIFO + * - Set clock phase + * - Set clock polarity and * - Enable the QSPI controller */ static void zynqmp_qspi_init_hw(struct zynqmp_qspi *xqspi) @@ -303,10 +305,17 @@ static void zynqmp_qspi_init_hw(struct zynqmp_qspi *xqspi) config_reg |= GQSPI_CFG_WP_HOLD_MASK; /* Clear pre-scalar by default */ config_reg &= ~GQSPI_CFG_BAUD_RATE_DIV_MASK; - /* CPHA 0 */ - config_reg &= ~GQSPI_CFG_CLK_PHA_MASK; - /* CPOL 0 */ - config_reg &= ~GQSPI_CFG_CLK_POL_MASK; + /* Set CPHA */ + if (xqspi->ctlr->mode_bits & SPI_CPHA) + config_reg |= GQSPI_CFG_CLK_PHA_MASK; + else + config_reg &= ~GQSPI_CFG_CLK_PHA_MASK; + /* Set CPOL */ + if (xqspi->ctlr->mode_bits & SPI_CPOL) + config_reg |= GQSPI_CFG_CLK_POL_MASK; + else + config_reg &= ~GQSPI_CFG_CLK_POL_MASK; + zynqmp_gqspi_write(xqspi, GQSPI_CONFIG_OFST, config_reg); /* Clear the TX and RX FIFO */ @@ -463,14 +472,6 @@ static int zynqmp_qspi_config_op(struct zynqmp_qspi *xqspi, config_reg = zynqmp_gqspi_read(xqspi, GQSPI_CONFIG_OFST); - /* Set the QSPI clock phase and clock polarity */ - config_reg &= (~GQSPI_CFG_CLK_PHA_MASK) & (~GQSPI_CFG_CLK_POL_MASK); - - if (qspi->mode & SPI_CPHA) - config_reg |= GQSPI_CFG_CLK_PHA_MASK; - if (qspi->mode & SPI_CPOL) - config_reg |= GQSPI_CFG_CLK_POL_MASK; - config_reg &= ~GQSPI_CFG_BAUD_RATE_DIV_MASK; config_reg |= (baud_rate_val << GQSPI_CFG_BAUD_RATE_DIV_SHIFT); zynqmp_gqspi_write(xqspi, GQSPI_CONFIG_OFST, config_reg); @@ -1162,6 +1163,9 @@ static int zynqmp_qspi_probe(struct platform_device *pdev) goto clk_dis_all; } + ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_RX_DUAL | SPI_RX_QUAD | + SPI_TX_DUAL | SPI_TX_QUAD; + /* QSPI controller initializations */ zynqmp_qspi_init_hw(xqspi); @@ -1188,8 +1192,6 @@ static int zynqmp_qspi_probe(struct platform_device *pdev) ctlr->setup = zynqmp_qspi_setup_op; ctlr->max_speed_hz = clk_get_rate(xqspi->refclk) / 2; ctlr->bits_per_word_mask = SPI_BPW_MASK(8); - ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_RX_DUAL | SPI_RX_QUAD | - SPI_TX_DUAL | SPI_TX_QUAD; ctlr->dev.of_node = np; ctlr->auto_runtime_pm = true; From patchwork Thu Sep 1 05:47:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kumar Mahapatra X-Patchwork-Id: 602151 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 897BDECAAD8 for ; Thu, 1 Sep 2022 05:48:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233180AbiIAFsE (ORCPT ); Thu, 1 Sep 2022 01:48:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233151AbiIAFry (ORCPT ); Thu, 1 Sep 2022 01:47:54 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11FC71166ED; Wed, 31 Aug 2022 22:47:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NwjtoaEzA2vjC8peA88sTF0frK911AgtuR2icnM8d3R45rRUJjlCZ6B7IDB4ZgHskE/HjZHu7jCHePkfyyjiwcjqvRKsmcdm7nGDxv7UYCVgvWnxYOm0nKcbSzagzOJb1NxnK9ynuV75xnYhH4zb1IguDUc9aiSMXEssw1y3Fhv8rg4QL/cONz8by3vP3l5epeDvztf0OXClSWYTVH5W1yI2LLRHmi1QHKOLgWvYHI05rHz0CNOP8gatibTr5jc8M1Hs4rcTyjWg94OiwBFf/ehStKUkbPu7RzdAVmAzy5VUXlhelPqVNSq/xrzyWZThwa1k4Cn8OSVhUwCcRjW2Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HnWf26i6HRrEYTwVMWYEY+hsZPGTiFfXu/6snWcPqY8=; b=eJDkF7ckft4PapW6KwVL1pPGKo75a+fME0n/VLizF2yVpg/zRrPa8GEULfVa0cHJ9zOx3VDDzqISpdxRX9HTwa30WUzoyFo18ohKJbYB/7HsR4fE90kRcFQZY+u77l1vOI073isDrsywpaYM3/meMRSdHbMG/EHf+PkP5uN4hnyuxWyCcyTFVE/sOe32dnC39S3CXOxQRr/7UusH/PKo5GWVGmymd1zV3j7lGNTeI4gFTX4qODowKIBCjSlbco8mVhN15sqFBhPk17kjo/+fbqknBUGuZzzJOBkHP1cNnTqPb6XWmVZeJMPDzP7eNhb27tvRz6Wgqsl3+LqO3Lipkw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HnWf26i6HRrEYTwVMWYEY+hsZPGTiFfXu/6snWcPqY8=; b=LezBr6f5gqDccN6uCAjj+o2I/u4LiCT6vV67NNHAGbZdo+yauilz1AlnU/c6Xs8unNzk6A9c1kSbNWaC43TAadOkJezYLSiev1Ps2PaQc4z/uGGaKzfX7lc3E8umAZ/aO4t1D74fifOhs6dgiFiM9NuoryR0ZyLlbqXh7bioB0w= Received: from DS7PR03CA0145.namprd03.prod.outlook.com (2603:10b6:5:3b4::30) by CY4PR02MB2503.namprd02.prod.outlook.com (2603:10b6:903:73::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10; Thu, 1 Sep 2022 05:47:48 +0000 Received: from DM3NAM02FT062.eop-nam02.prod.protection.outlook.com (2603:10b6:5:3b4:cafe::94) by DS7PR03CA0145.outlook.office365.com (2603:10b6:5:3b4::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.11 via Frontend Transport; Thu, 1 Sep 2022 05:47:48 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; pr=C Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT062.mail.protection.outlook.com (10.13.5.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5588.10 via Frontend Transport; Thu, 1 Sep 2022 05:47:48 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Wed, 31 Aug 2022 22:47:46 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2507.6 via Frontend Transport; Wed, 31 Aug 2022 22:47:46 -0700 Envelope-to: broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, git@amd.com, michal.simek@amd.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, akumarma@amd.com Received: from [10.140.6.18] (port=60724 helo=xhdlakshmis40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1oTd3J-000Eqz-KZ; Wed, 31 Aug 2022 22:47:46 -0700 From: Amit Kumar Mahapatra To: , , CC: , , , , , , , Amit Kumar Mahapatra Subject: [PATCH 3/7] spi: spi-zynqmp-gqspi: Avoid setting baud rate multiple times for same SPI frequency Date: Thu, 1 Sep 2022 11:17:27 +0530 Message-ID: <20220901054731.7705-4-amit.kumar-mahapatra@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220901054731.7705-1-amit.kumar-mahapatra@xilinx.com> References: <20220901054731.7705-1-amit.kumar-mahapatra@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 790e3c20-f182-4782-5570-08da8bdd8060 X-MS-TrafficTypeDiagnostic: CY4PR02MB2503:EE_ X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: US4uZ1+kQcw4eTIXxzoBwuU+HZfcY8Iv9CMFEY7bUyqJhcibpzd8TBnEj8sZKxmXE6tIISJLuwJkuNwVgoVyxh0OFyLan0Io04NR7lt75XPr08W4IxXYv4AYbTpJ6hfK1EYT+1sjRX5diGdLn+JmWqyEYJ8fNKFclJ/zA/o0PTMuik9+8t+y0Sqk0ExYJXjnYZCpoge/bJDh6TiPN1k0/OyPzbaUu7TEgyK9m2Djusn6u2xLdt9CFGRuDvlsA7XI4mKUBcZ0l3U6EzgOOiimi1cGGuRSmguAbGy/Gapr7tEfWR5jnQH6feM7+GgkyTJpRYj29OpfbR+uQ5QI1+rYL4tromG5TEiuGEK2NQ7MgaPYmhj61utbC4xzN8gw8KgOKCP7MDXnyFrl4jOYdrlTY3A6W0var2MzDTE0d6N6+u8SR+df+jEA3Ueug1UFTtgXPs9xx9v7+NvKKQYLHmwzHZj8l02mLhgrBH99hyJu+HEILPzBefVhDeanBmSOu4bvw9wXyLUzAlbDWlmH76elh87ljiNS93SBR5g/Z6F3D9MYK2t/p/jX1AQu1YI9UU5sn0l6IS+rWTtc4yP8U5ryZItLHOQpW/Cm27hJ268OGvnqvFzOSHfOCVyqreA5iIciSkXp//6IGPFt15O6UY18XLJpwMheUUo9uLMqzEwUhRbQDteBxlu6m0Xrte0XkQYpIoDs2c/okakqjh9mR15Rgo5ypHgFVLZ+bG8mSaK82iMgoEEX+nPk8upJrq6HeBAY4HK5FlJQPRSkt/C7ANlrTR/0VPD2hAdL/yVv/IR1WAo= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(13230016)(4636009)(396003)(376002)(346002)(39860400002)(136003)(40470700004)(46966006)(36840700001)(110136005)(82310400005)(36756003)(82740400003)(2616005)(336012)(426003)(41300700001)(83380400001)(36860700001)(186003)(107886003)(7696005)(47076005)(1076003)(26005)(6666004)(54906003)(40480700001)(478600001)(4326008)(316002)(70206006)(70586007)(9786002)(40460700003)(356005)(7636003)(8676002)(7416002)(5660300002)(2906002)(8936002)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2022 05:47:48.3083 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 790e3c20-f182-4782-5570-08da8bdd8060 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT062.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR02MB2503 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org During every transfer the GQSPI driver configures the baud rate value. But when there is no change in the SPI clock frequency the driver should avoid rewriting the same baud rate value to the configuration register. With this patch the GQSPI driver rewrites the baud rate value if there is a change in SPI clock frequency. Signed-off-by: Amit Kumar Mahapatra --- drivers/spi/spi-zynqmp-gqspi.c | 49 ++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c index 6771496c1f86..024085098515 100644 --- a/drivers/spi/spi-zynqmp-gqspi.c +++ b/drivers/spi/spi-zynqmp-gqspi.c @@ -157,6 +157,7 @@ enum mode_type {GQSPI_MODE_IO, GQSPI_MODE_DMA}; * @mode: Defines the mode in which QSPI is operating * @data_completion: completion structure * @op_lock: Operational lock + * @speed_hz: Current SPI bus clock speed in hz */ struct zynqmp_qspi { struct spi_controller *ctlr; @@ -177,6 +178,7 @@ struct zynqmp_qspi { enum mode_type mode; struct completion data_completion; struct mutex op_lock; + u32 speed_hz; }; /** @@ -271,7 +273,8 @@ static void zynqmp_gqspi_selectslave(struct zynqmp_qspi *instanceptr, */ static void zynqmp_qspi_init_hw(struct zynqmp_qspi *xqspi) { - u32 config_reg; + u32 config_reg, baud_rate_val = 0; + ulong clk_rate; /* Select the GQSPI mode */ zynqmp_gqspi_write(xqspi, GQSPI_SEL_OFST, GQSPI_SEL_MASK); @@ -316,6 +319,16 @@ static void zynqmp_qspi_init_hw(struct zynqmp_qspi *xqspi) else config_reg &= ~GQSPI_CFG_CLK_POL_MASK; + /* Set the clock frequency */ + clk_rate = clk_get_rate(xqspi->refclk); + while ((baud_rate_val < GQSPI_BAUD_DIV_MAX) && + (clk_rate / + (GQSPI_BAUD_DIV_SHIFT << baud_rate_val)) > xqspi->speed_hz) + baud_rate_val++; + + config_reg &= ~GQSPI_CFG_BAUD_RATE_DIV_MASK; + config_reg |= (baud_rate_val << GQSPI_CFG_BAUD_RATE_DIV_SHIFT); + zynqmp_gqspi_write(xqspi, GQSPI_CONFIG_OFST, config_reg); /* Clear the TX and RX FIFO */ @@ -459,22 +472,29 @@ static int zynqmp_qspi_config_op(struct zynqmp_qspi *xqspi, struct spi_device *qspi) { ulong clk_rate; - u32 config_reg, baud_rate_val = 0; + u32 config_reg, req_speed_hz, baud_rate_val = 0; - /* Set the clock frequency */ - /* If req_hz == 0, default to lowest speed */ - clk_rate = clk_get_rate(xqspi->refclk); + req_speed_hz = qspi->max_speed_hz; - while ((baud_rate_val < GQSPI_BAUD_DIV_MAX) && - (clk_rate / - (GQSPI_BAUD_DIV_SHIFT << baud_rate_val)) > qspi->max_speed_hz) - baud_rate_val++; + if (xqspi->speed_hz != req_speed_hz) { + xqspi->speed_hz = req_speed_hz; - config_reg = zynqmp_gqspi_read(xqspi, GQSPI_CONFIG_OFST); + /* Set the clock frequency */ + /* If req_speed_hz == 0, default to lowest speed */ + clk_rate = clk_get_rate(xqspi->refclk); - config_reg &= ~GQSPI_CFG_BAUD_RATE_DIV_MASK; - config_reg |= (baud_rate_val << GQSPI_CFG_BAUD_RATE_DIV_SHIFT); - zynqmp_gqspi_write(xqspi, GQSPI_CONFIG_OFST, config_reg); + while ((baud_rate_val < GQSPI_BAUD_DIV_MAX) && + (clk_rate / + (GQSPI_BAUD_DIV_SHIFT << baud_rate_val)) > + req_speed_hz) + baud_rate_val++; + + config_reg = zynqmp_gqspi_read(xqspi, GQSPI_CONFIG_OFST); + + config_reg &= ~GQSPI_CFG_BAUD_RATE_DIV_MASK; + config_reg |= (baud_rate_val << GQSPI_CFG_BAUD_RATE_DIV_SHIFT); + zynqmp_gqspi_write(xqspi, GQSPI_CONFIG_OFST, config_reg); + } return 0; } @@ -1165,6 +1185,8 @@ static int zynqmp_qspi_probe(struct platform_device *pdev) ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_RX_DUAL | SPI_RX_QUAD | SPI_TX_DUAL | SPI_TX_QUAD; + ctlr->max_speed_hz = clk_get_rate(xqspi->refclk) / 2; + xqspi->speed_hz = ctlr->max_speed_hz; /* QSPI controller initializations */ zynqmp_qspi_init_hw(xqspi); @@ -1190,7 +1212,6 @@ static int zynqmp_qspi_probe(struct platform_device *pdev) ctlr->num_chipselect = GQSPI_DEFAULT_NUM_CS; ctlr->mem_ops = &zynqmp_qspi_mem_ops; ctlr->setup = zynqmp_qspi_setup_op; - ctlr->max_speed_hz = clk_get_rate(xqspi->refclk) / 2; ctlr->bits_per_word_mask = SPI_BPW_MASK(8); ctlr->dev.of_node = np; ctlr->auto_runtime_pm = true; From patchwork Thu Sep 1 05:47:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kumar Mahapatra X-Patchwork-Id: 602150 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0B54C65C0D for ; Thu, 1 Sep 2022 05:48:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233199AbiIAFsQ (ORCPT ); Thu, 1 Sep 2022 01:48:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233173AbiIAFsI (ORCPT ); Thu, 1 Sep 2022 01:48:08 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2086.outbound.protection.outlook.com [40.107.95.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BC1E1670FE; Wed, 31 Aug 2022 22:47:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MBQ2iBfUmLVyf/L54G52RXElvzrIqdG6Jl2OCEub9XJlVGXMi3hWW5XVkKk7cLobl2k1aESF0RP4bMONzJ8ZOR9k1+mH67RF9XSO9SQJidAbXWdtofoV0Cr+/oAxPeWyOxVt7WnbJBKkawecfUmCSUXgPJ0uF1sAbw7NKMkZ5Z7bnz2YipK5PJMM2oQeqEAObr6/po0p6vaYaR8UZVMUiKtSxn844ENUqY+5r/pjZ8pSkYs0Kf/NgcTdZfvXreRT/8A8F9w7EmtHAP8hSCIozEespp+hfmNhr+OtScwhKzbblg7i24MpxW+A3470Q8v+vNM3Oc4SgaFX2WQoNpQjWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=s87VHqP+2XeWHthr1d+kkQXe1eQImTy+mvdrhSHUPqM=; b=dKfTmdQoo+GULRbMllAOZ4ncfdohVHny3AQZIQcWB067sXsDKeo8zzLqxSYQIC2kj1q7JnC96HG35S4qZFPqwsu/ZrMV7wrngQI6zpvuTjPacZV4kGLOLgcUsMHuWCdlPac0EbquYndzULwE5RtAGTY59/5yMoFJQDkTp1wUt7+NGlmhTMLGXXV4uDa5iOjDZS1gfpBhdgYnz3XYYhSgjHwbWgxinMw0QD1dmiTjzqvITkclSGocbGlI4s8bU6FavCXf8EMEQTvPPFhKGBBuZ8v9A6HuWehAx8LL9y0R8+OGgmiJzovuQpXH+dNkR5nlcmX0Q7JNxtLh8zol1Cnl0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s87VHqP+2XeWHthr1d+kkQXe1eQImTy+mvdrhSHUPqM=; b=NOHNKMDpWzP5pRqyiDDQR84I7tbY9vHauL5aFdtyYjHLrO4oPixZwUBfPIGQ4XNlICYFv6M2vZBhfAjraHLorwrS28fGTbacILvZAfnVO2s/yvJrTOuVneOodM5080IzxzRCJ6WeEf+qFAcpWxZgbiqFe3vfZ8BVAPG1laH5GSE= Received: from DS7PR03CA0124.namprd03.prod.outlook.com (2603:10b6:5:3b4::9) by SN6PR02MB3936.namprd02.prod.outlook.com (2603:10b6:805:35::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.21; Thu, 1 Sep 2022 05:47:50 +0000 Received: from DM3NAM02FT062.eop-nam02.prod.protection.outlook.com (2603:10b6:5:3b4:cafe::21) by DS7PR03CA0124.outlook.office365.com (2603:10b6:5:3b4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10 via Frontend Transport; Thu, 1 Sep 2022 05:47:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; pr=C Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT062.mail.protection.outlook.com (10.13.5.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5588.10 via Frontend Transport; Thu, 1 Sep 2022 05:47:50 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Wed, 31 Aug 2022 22:47:49 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2507.6 via Frontend Transport; Wed, 31 Aug 2022 22:47:49 -0700 Envelope-to: broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, git@amd.com, michal.simek@amd.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, akumarma@amd.com Received: from [10.140.6.18] (port=60724 helo=xhdlakshmis40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1oTd3M-000Eqz-Ux; Wed, 31 Aug 2022 22:47:49 -0700 From: Amit Kumar Mahapatra To: , , CC: , , , , , , , Rajan Vaja , Amit Kumar Mahapatra Subject: [PATCH 4/7] firmware: xilinx: Add qspi firmware interface Date: Thu, 1 Sep 2022 11:17:28 +0530 Message-ID: <20220901054731.7705-5-amit.kumar-mahapatra@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220901054731.7705-1-amit.kumar-mahapatra@xilinx.com> References: <20220901054731.7705-1-amit.kumar-mahapatra@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f3040dec-3dd8-441e-a3a6-08da8bdd81b7 X-MS-TrafficTypeDiagnostic: SN6PR02MB3936:EE_ X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AxBaZnyHsnH+n29W/6EAYouvXUmNyVU5Mtn/vYXaff68lzTssFSaCgTw0gJnXdAt0h3KLWkYpMEVr0uX7pjZXoh18CIN0la9ZSwEbglCZFMLLNCg4PfYxbQzL+0nD6+oP3VCEwOBHPhdl2e3x3I5DspDt+R76f1rqBDtSKt0cTbRAfwPKoGy/VlxaZuvNgIqMoNE6D72ZhYdRNTxM8aNy4DWmmAV6gDMCvm/Jt7UtBqiz3ru7KgWbcDJ+HtPsMYKNKoxnTWG+LHaf+9FxCWCB51kbXMeK+IMX/68EJ7LUpwrEhn/TroLcDkIRGEmOm+vv5VocxLjgM21JltBKS5afgfxj+r/lyJMD+SDb6sRmIV83bpwp5DNx+1HyoMo0AGhC9f0B1kL1jQiVebYeBo6YGWRBelSMna85uRdN4sZbzMO7M399SOsDeHZ0Chi3PvvX0POtZvRxa33YmlumW+mj0oTgvmBxpPR1dr9Ns8LnH0OQDucUIkcaMSynG25cfAR0sJ/6ONcbrSJfTW1Sztv1uDuiCOW7DMXd3sN6kggy0ExnDHxH1nWDmOSxP+8qe8UCqIICfPBk3Xz7xu4N/+yzs7rICbXmKGVXC/xLVju72E4bEyOVGbXlfMqkmZW1ATeU+komxpaus4d/KMG93SQLWXZZGnZxJTxWRdL+JupTvX4jxyO40nNRluZ2zSeZHpg3eHL6d3pvWS1QDqAKPkxXR1MNtlPf6Bqvb5DJFloSvliitvibYPG2h15rrzIpFTIKnRekw8onnBYNvUYHfy1gjdABBVeNiZ+BPX1RKI3FnA= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(13230016)(4636009)(396003)(39860400002)(376002)(136003)(346002)(46966006)(40470700004)(36840700001)(336012)(7696005)(2616005)(1076003)(7636003)(186003)(47076005)(426003)(2906002)(83380400001)(36756003)(26005)(356005)(7416002)(478600001)(6666004)(41300700001)(54906003)(5660300002)(8936002)(110136005)(70206006)(36860700001)(70586007)(40460700003)(9786002)(4326008)(316002)(82310400005)(107886003)(82740400003)(8676002)(40480700001)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2022 05:47:50.5581 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f3040dec-3dd8-441e-a3a6-08da8bdd81b7 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT062.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR02MB3936 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org From: Rajan Vaja Add support for QSPI ioctl functions and enums. Signed-off-by: Rajan Vaja Signed-off-by: Michal Simek Signed-off-by: Amit Kumar Mahapatra --- drivers/firmware/xilinx/zynqmp.c | 7 +++++++ include/linux/firmware/xlnx-zynqmp.h | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index 7977a494a651..b119f170437a 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -829,6 +829,13 @@ int zynqmp_pm_read_pggs(u32 index, u32 *value) } EXPORT_SYMBOL_GPL(zynqmp_pm_read_pggs); +int zynqmp_pm_set_tapdelay_bypass(u32 index, u32 value) +{ + return zynqmp_pm_invoke_fn(PM_IOCTL, 0, IOCTL_SET_TAPDELAY_BYPASS, + index, value, NULL); +} +EXPORT_SYMBOL_GPL(zynqmp_pm_set_tapdelay_bypass); + /** * zynqmp_pm_set_boot_health_status() - PM API for setting healthy boot status * @value: Status value to be written diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index 1ec73d5352c3..b38d12b6040f 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -134,6 +134,7 @@ enum pm_ret_status { }; enum pm_ioctl_id { + IOCTL_SET_TAPDELAY_BYPASS = 4, IOCTL_SD_DLL_RESET = 6, IOCTL_SET_SD_TAPDELAY = 7, IOCTL_SET_PLL_FRAC_MODE = 8, @@ -380,6 +381,18 @@ enum zynqmp_pm_shutdown_subtype { ZYNQMP_PM_SHUTDOWN_SUBTYPE_SYSTEM = 2, }; +enum tap_delay_signal_type { + PM_TAPDELAY_NAND_DQS_IN = 0, + PM_TAPDELAY_NAND_DQS_OUT = 1, + PM_TAPDELAY_QSPI = 2, + PM_TAPDELAY_MAX = 3, +}; + +enum tap_delay_bypass_ctrl { + PM_TAPDELAY_BYPASS_DISABLE = 0, + PM_TAPDELAY_BYPASS_ENABLE = 1, +}; + enum ospi_mux_select_type { PM_OSPI_MUX_SEL_DMA = 0, PM_OSPI_MUX_SEL_LINEAR = 1, @@ -451,6 +464,7 @@ int zynqmp_pm_write_ggs(u32 index, u32 value); int zynqmp_pm_read_ggs(u32 index, u32 *value); int zynqmp_pm_write_pggs(u32 index, u32 value); int zynqmp_pm_read_pggs(u32 index, u32 *value); +int zynqmp_pm_set_tapdelay_bypass(u32 index, u32 value); int zynqmp_pm_system_shutdown(const u32 type, const u32 subtype); int zynqmp_pm_set_boot_health_status(u32 value); int zynqmp_pm_pinctrl_request(const u32 pin); @@ -659,6 +673,11 @@ static inline int zynqmp_pm_read_pggs(u32 index, u32 *value) return -ENODEV; } +static inline int zynqmp_pm_set_tapdelay_bypass(u32 index, u32 value) +{ + return -ENODEV; +} + static inline int zynqmp_pm_system_shutdown(const u32 type, const u32 subtype) { return -ENODEV; From patchwork Thu Sep 1 05:47:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kumar Mahapatra X-Patchwork-Id: 602355 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5F2EECAAD8 for ; Thu, 1 Sep 2022 05:48:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233188AbiIAFsO (ORCPT ); Thu, 1 Sep 2022 01:48:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233168AbiIAFsG (ORCPT ); Thu, 1 Sep 2022 01:48:06 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2082.outbound.protection.outlook.com [40.107.220.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E17DF1178D3; Wed, 31 Aug 2022 22:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Aq4uFnGrCTGR63oIbKYQ17G7bOcSf43EabuDrI4nIsXe/ptib/23xxnK3LRLyJ12T24V5L6SGB05XhYOcTmQuqWWYbeni/RM2y2PlkvjjokotGiguWSOrDTTKSsSf0b/FeTG/sZJ+nClphp1MAdRV3zvGpAua1ybxkkqeMvxX2RDR/uvPAIb7sqbJeBcYQvo9TZBNOqUfhmHtItWOKakrD8GLnvp7G7VIZRfaZbaaZl9sHhmk7FLqZEojxStcW+vr0o4NirCtKfrN4jiWQUmHHBH421BUVYj+lX+5wLbcuUpWZYYavKghlQ9X+t9vjWR6giWVFipOu6szHBUQabVgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tCeMWA4CCyDuL5wRSFVcjF4x5fkLEgLMENwaMQwBoE8=; b=i739KQNE0eS0cVuGJztDJ9RAtBtfzeuahoPrFDn79O6f0oFjaqdlz+kk5c7eYRefTaxjywNxCpbRpdULRo6DkjpECVpDttkbu65a4ZB2I+ZEC3eHjfwZMoCYfOThCIb+/xrMhq9R4vflVCEdZuLdwLNZhKaw7g3DzjrnKf6J0i966NSqx9yAMAgV/4kNjC9gz1AJmgPYyS5LrucfUCH9clGooy1OXX1zdnzyeL1wLuBh4Qam1Jdj9uM3p8Q2VYFhOKqfk+N2Wj8tEN3RWMydcBh5nGs2VGeTb2w+DDNDSUzsBDS1o53yrG3DCk+RVQkISvCoAPVTcw4m3eeGunPjcA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tCeMWA4CCyDuL5wRSFVcjF4x5fkLEgLMENwaMQwBoE8=; b=KMi65kT81XywDlPs+6bJH2Ecj7c8Pbe8RU33ybQ/ZbHuWzcnkLhYyK+qxQiKXPXnxrpwH+FIl4q6CIt/HlZBTxCSCGTgtL4Rx3ZIWzn3hwzDNNGmUlTNoFZzMy5sWCkyGFZIheKAH3AhL0twHwQGYOjXoQRi9uGvQ0opdtyRtwk= Received: from DS7PR03CA0122.namprd03.prod.outlook.com (2603:10b6:5:3b4::7) by SN6PR02MB4926.namprd02.prod.outlook.com (2603:10b6:805:94::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.11; Thu, 1 Sep 2022 05:47:55 +0000 Received: from DM3NAM02FT062.eop-nam02.prod.protection.outlook.com (2603:10b6:5:3b4:cafe::e4) by DS7PR03CA0122.outlook.office365.com (2603:10b6:5:3b4::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10 via Frontend Transport; Thu, 1 Sep 2022 05:47:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; pr=C Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT062.mail.protection.outlook.com (10.13.5.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5588.10 via Frontend Transport; Thu, 1 Sep 2022 05:47:54 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Wed, 31 Aug 2022 22:47:52 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2507.6 via Frontend Transport; Wed, 31 Aug 2022 22:47:52 -0700 Envelope-to: broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, git@amd.com, michal.simek@amd.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, akumarma@amd.com Received: from [10.140.6.18] (port=60724 helo=xhdlakshmis40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1oTd3Q-000Eqz-98; Wed, 31 Aug 2022 22:47:52 -0700 From: Amit Kumar Mahapatra To: , , CC: , , , , , , , Naga Sureshkumar Relli , Amit Kumar Mahapatra Subject: [PATCH 5/7] spi: spi-zynqmp-gqspi: Add tap delay support for ZynqMP GQSPI Controller Date: Thu, 1 Sep 2022 11:17:29 +0530 Message-ID: <20220901054731.7705-6-amit.kumar-mahapatra@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220901054731.7705-1-amit.kumar-mahapatra@xilinx.com> References: <20220901054731.7705-1-amit.kumar-mahapatra@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 508b1c09-0c36-43f7-ba69-08da8bdd841e X-MS-TrafficTypeDiagnostic: SN6PR02MB4926:EE_ X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J+GrrCO2UJqVbfY0pb+ewXxbalkHPDfpXm+1JGPRPCU0HGLWHYwJBmacMKFyWR7udFEVvX1AaWEjJKMQJcNVbzlqATTafelreukvTMzHcqNXQcG1x4upX4ZPmDBQHzMDCRUwKSYGdXWOCPpbJuOCfbh12RzGzmD6JWnry8kuex4SmaHQ0WrpkBRuzJu5tLUfHPdCLNcOEZMwRYwRZS8kY7WoPjNoNSNW8gN5T/IFhJnBCGU+H+8XMNy04GRXX5PUoQ1KU6WstTVv+m/X7uXII6jrsDA1++24EdF8nqbzxCczqyRjpC7wAFo5/UpVmslTOGyeakjOJySnO2wfioI8vdBLoh9aJql0LUfWULCGadSJclUI33rOjFI+pqWD1FO1IsFYpWwrx99tTWkkVsr5roagKwPa6s/qoDk4zvW+iU2HBpJKv5B9dDLi25DW1L/0DKTGaIitDAdZhJaJS11OtJ9B31iH1BdwNvkC+T4lQSDYFQYtHRUVm5DVmmcPZPz8DiA8qVYz3/1Ce5hlgqs2/DuSnkAUxyOAIylUTX8rkNqJCQjfKgVArCE80qnxsw0eDKQJnUbi4I+PuPhYcY0HVnAX8faae0lGxaXR//9h6BNzYGIZk/i3m7vI3qrhHtgdk9H93eEg8hiEVxNr2xHAr5dUAKB8au9yRaG+rVUsQEPAX07GOTDYeL3V7sG+8MoXbr/HyNoPyi5jNDehaqZRGDwj2hopB40BRCQTiKXq+zd3ksvfoCg419W8d5gvrzB/PtfGgGa0bjot+FA8Kt4s2sbHNzsLwhB0rxWSV1H3Qmw= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(13230016)(4636009)(396003)(346002)(376002)(136003)(39860400002)(40470700004)(46966006)(36840700001)(82310400005)(83380400001)(40480700001)(82740400003)(110136005)(316002)(4326008)(8676002)(478600001)(70206006)(70586007)(54906003)(36756003)(107886003)(6666004)(336012)(1076003)(8936002)(5660300002)(41300700001)(9786002)(7636003)(2616005)(47076005)(426003)(186003)(40460700003)(36860700001)(356005)(7416002)(7696005)(26005)(2906002)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2022 05:47:54.6048 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 508b1c09-0c36-43f7-ba69-08da8bdd841e X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT062.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR02MB4926 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org From: Naga Sureshkumar Relli GQSPI controller uses the internal clock for loopback mode. The loopback mode is used with the high-speed Quad SPI timing mode, where the memory interface clock needs to be greater than 40 MHz. Based on the tap delay value programmed, the internal clock is delayed and used for capturing the data. Based upon the frequency of operation this patch sets the recommended tap delay values. Signed-off-by: Naga Sureshkumar Relli Signed-off-by: Michal Simek Signed-off-by: Amit Kumar Mahapatra --- drivers/spi/spi-zynqmp-gqspi.c | 48 +++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c index 024085098515..0e6423ff33f4 100644 --- a/drivers/spi/spi-zynqmp-gqspi.c +++ b/drivers/spi/spi-zynqmp-gqspi.c @@ -48,6 +48,7 @@ #define GQSPI_QSPIDMA_DST_I_MASK_OFST 0x00000820 #define GQSPI_QSPIDMA_DST_ADDR_OFST 0x00000800 #define GQSPI_QSPIDMA_DST_ADDR_MSB_OFST 0x00000828 +#define GQSPI_DATA_DLY_ADJ_OFST 0x000001F8 /* GQSPI register bit masks */ #define GQSPI_SEL_MASK 0x00000001 @@ -133,6 +134,15 @@ #define GQSPI_SELECT_MODE_QUADSPI 0x4 #define GQSPI_DMA_UNALIGN 0x3 #define GQSPI_DEFAULT_NUM_CS 1 /* Default number of chip selects */ +#define GQSPI_USE_DATA_DLY 0x1 +#define GQSPI_USE_DATA_DLY_SHIFT 31 +#define GQSPI_DATA_DLY_ADJ_VALUE 0x2 +#define GQSPI_DATA_DLY_ADJ_SHIFT 28 + +#define GQSPI_FREQ_37_5MHZ 37500000 +#define GQSPI_FREQ_40MHZ 40000000 +#define GQSPI_FREQ_100MHZ 100000000 +#define GQSPI_FREQ_150MHZ 150000000 #define SPI_AUTOSUSPEND_TIMEOUT 3000 enum mode_type {GQSPI_MODE_IO, GQSPI_MODE_DMA}; @@ -251,6 +261,37 @@ static void zynqmp_gqspi_selectslave(struct zynqmp_qspi *instanceptr, } } +/** + * zynqmp_qspi_set_tapdelay: To configure qspi tap delays + * @xqspi: Pointer to the zynqmp_qspi structure + * @baudrateval: Buadrate to configure + */ +static void zynqmp_qspi_set_tapdelay(struct zynqmp_qspi *xqspi, u32 baudrateval) +{ + u32 lpbkdlyadj = 0, datadlyadj = 0, clk_rate; + u32 reqhz = 0; + + clk_rate = clk_get_rate(xqspi->refclk); + reqhz = (clk_rate / (GQSPI_BAUD_DIV_SHIFT << baudrateval)); + + if (reqhz <= GQSPI_FREQ_40MHZ) { + zynqmp_pm_set_tapdelay_bypass(PM_TAPDELAY_QSPI, + PM_TAPDELAY_BYPASS_ENABLE); + } else if (reqhz <= GQSPI_FREQ_100MHZ) { + zynqmp_pm_set_tapdelay_bypass(PM_TAPDELAY_QSPI, + PM_TAPDELAY_BYPASS_ENABLE); + lpbkdlyadj |= (GQSPI_LPBK_DLY_ADJ_USE_LPBK_MASK); + datadlyadj |= ((GQSPI_USE_DATA_DLY << + GQSPI_USE_DATA_DLY_SHIFT) + | (GQSPI_DATA_DLY_ADJ_VALUE << + GQSPI_DATA_DLY_ADJ_SHIFT)); + } else if (reqhz <= GQSPI_FREQ_150MHZ) { + lpbkdlyadj |= GQSPI_LPBK_DLY_ADJ_USE_LPBK_MASK; + } + zynqmp_gqspi_write(xqspi, GQSPI_LPBK_DLY_ADJ_OFST, lpbkdlyadj); + zynqmp_gqspi_write(xqspi, GQSPI_DATA_DLY_ADJ_OFST, datadlyadj); +} + /** * zynqmp_qspi_init_hw - Initialize the hardware * @xqspi: Pointer to the zynqmp_qspi structure @@ -330,16 +371,14 @@ static void zynqmp_qspi_init_hw(struct zynqmp_qspi *xqspi) config_reg |= (baud_rate_val << GQSPI_CFG_BAUD_RATE_DIV_SHIFT); zynqmp_gqspi_write(xqspi, GQSPI_CONFIG_OFST, config_reg); + /* Set the tapdelay for clock frequency */ + zynqmp_qspi_set_tapdelay(xqspi, baud_rate_val); /* Clear the TX and RX FIFO */ zynqmp_gqspi_write(xqspi, GQSPI_FIFO_CTRL_OFST, GQSPI_FIFO_CTRL_RST_RX_FIFO_MASK | GQSPI_FIFO_CTRL_RST_TX_FIFO_MASK | GQSPI_FIFO_CTRL_RST_GEN_FIFO_MASK); - /* Set by default to allow for high frequencies */ - zynqmp_gqspi_write(xqspi, GQSPI_LPBK_DLY_ADJ_OFST, - zynqmp_gqspi_read(xqspi, GQSPI_LPBK_DLY_ADJ_OFST) | - GQSPI_LPBK_DLY_ADJ_USE_LPBK_MASK); /* Reset thresholds */ zynqmp_gqspi_write(xqspi, GQSPI_TX_THRESHOLD_OFST, GQSPI_TX_FIFO_THRESHOLD_RESET_VAL); @@ -494,6 +533,7 @@ static int zynqmp_qspi_config_op(struct zynqmp_qspi *xqspi, config_reg &= ~GQSPI_CFG_BAUD_RATE_DIV_MASK; config_reg |= (baud_rate_val << GQSPI_CFG_BAUD_RATE_DIV_SHIFT); zynqmp_gqspi_write(xqspi, GQSPI_CONFIG_OFST, config_reg); + zynqmp_qspi_set_tapdelay(xqspi, baud_rate_val); } return 0; } From patchwork Thu Sep 1 05:47:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kumar Mahapatra X-Patchwork-Id: 602354 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 825A7ECAAD2 for ; Thu, 1 Sep 2022 05:48:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231754AbiIAFss (ORCPT ); Thu, 1 Sep 2022 01:48:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233214AbiIAFs2 (ORCPT ); Thu, 1 Sep 2022 01:48:28 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DE831178CA; Wed, 31 Aug 2022 22:48:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QfqvBwxs6cuz+v9OcNEw03sbPWeDiBGnx3Id5PF5IeUsJ5QGBNCEEsH3Bq5x2TmOKWG6+3Sue5DF0w1X2DLWvfRLiznYiVS/YPC7El5JLv7DJd829h2z8u/iyAzH38I3KaoUO0VuTmKcdhnKR6LPJ32sljoH7uOIu98X/IM81D8pvmXFcGfEjQBW8sNKuIDZIAe4KgC7ghoP66r5rKp4VP4TpVxcQXcHLC+8RFhSBETn7Voi5NXSCCSYsr1lz+X6LXqR4T6G8bu/Pceb9KMshUhRx6pABexmit2jZgqSNw1eq0byb6f2SKokFqtA0TIyt/fiXEdsjdQCbI3QbR5eqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1v/P2GI+FxWoV2dTYVwFeHtohiSKwMhzHD3ochidsF0=; b=B3I8VwJCU5bL7ulZ71qKvF35INHv+EM4XKboU//KPRdcS3ZZv3ZC1mdLW4H63VowveNvzv6seva9+Uvjj/AyVEL6G98mba6XtxmkM3Q9gMKNIIRrm2xOAP6aQ3KEhPm5DfbI3acZAfXaq5Bdgl+WD5naF62qmdsXE20drjSh9lr/8iq/lwk9rkLXuT9m4TNb5sz8ufNNdl56Bg3E/AJNc1jFDUNGU5Lf77dSL1vC/3v1K34Hd5Dv+3xfDmPBddGW4SJVUk3vAs+XqJEXIlu6juTb2tAZaJ835URELOlrYtT8UjYugD28W1xMWMW2ow2XL3bgPJZFmX2l3fK1OOpqkw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1v/P2GI+FxWoV2dTYVwFeHtohiSKwMhzHD3ochidsF0=; b=ELJai+r6vLVqs8JRZMwYgTAE5GJLcUK001LpPBvtSRZY4hEA19FAsCkQkhLquf8XRSBtjXEam9n4y6PX5flPoEI9jY3Jz1W44mZ+LgPpaFauWFpSlvXxEWqoBuBf41K3+vonWWdx84t1n9+YVWfzJeHUbBzVXbZQpKrkeTQWqtg= Received: from SN7PR04CA0234.namprd04.prod.outlook.com (2603:10b6:806:127::29) by MN2PR02MB6814.namprd02.prod.outlook.com (2603:10b6:208:199::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.11; Thu, 1 Sep 2022 05:48:03 +0000 Received: from SN1NAM02FT0003.eop-nam02.prod.protection.outlook.com (2603:10b6:806:127:cafe::9e) by SN7PR04CA0234.outlook.office365.com (2603:10b6:806:127::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10 via Frontend Transport; Thu, 1 Sep 2022 05:48:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; pr=C Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0003.mail.protection.outlook.com (10.97.4.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5588.10 via Frontend Transport; Thu, 1 Sep 2022 05:48:03 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.6; Wed, 31 Aug 2022 22:47:55 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2507.6 via Frontend Transport; Wed, 31 Aug 2022 22:47:55 -0700 Envelope-to: broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, git@amd.com, michal.simek@amd.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, akumarma@amd.com Received: from [10.140.6.18] (port=60724 helo=xhdlakshmis40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1oTd3T-000Eqz-Ct; Wed, 31 Aug 2022 22:47:55 -0700 From: Amit Kumar Mahapatra To: , , CC: , , , , , , , Amit Kumar Mahapatra Subject: [PATCH 6/7] dt-bindings: spi: spi-zynqmp-qspi: Add support for Xilinx Versal QSPI Date: Thu, 1 Sep 2022 11:17:30 +0530 Message-ID: <20220901054731.7705-7-amit.kumar-mahapatra@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220901054731.7705-1-amit.kumar-mahapatra@xilinx.com> References: <20220901054731.7705-1-amit.kumar-mahapatra@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 617266df-d019-4f01-ef03-08da8bdd895f X-MS-TrafficTypeDiagnostic: MN2PR02MB6814:EE_ X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8y1SxWzHohx5jwd6laTs/sQL7r4/tm7BRhNh6FUk58uXOMtPOHfDlKOouHTg5iGXIcrrMkMzRjBNs0XG2rz1sgvqsYPLCMXMGjNYi5EvYkJTVeL0bgrt9lYzUE/sjvFOl3XMo4iEEluLRg10eqVxuFi93BIF6tGpK6XlyAwi76rXzOXRO5Pua2PxAkEjPRompBkNp8VKsOZtIHImoOBse6XZpav3LXcXg/sM7wDejNnYPeIiwVf8Wb/YdqhrzXyMvwvxduQiUrc0+CmR+UCpEj8UwG8wDftdDRu6OwKkFvE3NCtGwyetVz8NYJowLRpKCHKfPCb6U9Zv/mlJkZNXX2lpswXHCClwOYKhVwq+LjjIPCE2E+ABO9q/kUysFG0HUJt09btGg5I9cSMkHOvlndpTbzajPJFZTBdBtxtTAet2DntZXAEWl8ZNZ4OErFfSwfiT2yXtsz+QJNvuTICiW/likOIUhk1Vp6l1XWaJF+7t2Mfjn9Df+gPwWe4sHrhm6oS1rnjFwPzDWRkYcp1MiQF6/PtFzkww+Bq4tgdx6eHueF/sRJAHWSyoRcC9XgyIsc776JmuiHKHi7p63SCsDeWLTPph8gM6ArqN91HxPcKzHpOGhKsZxJNgmcPMk5LnXQBXtNZufAZ9RVKe8T9uOcwM6v+H7zGChM+Ls4K0H7Z2FaHrUZAnzsXlP5BkCeK0FaAz5BSUinB5DUjWO933ZBUi+ATF0TZkWOAq/7Goanx0SdBU0YXB5V3eknpptTenV/hxD/wfljqB6C63mLMSDyRK5Ccc5wAtwi43PZ9y7Pw= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(13230016)(4636009)(39860400002)(136003)(376002)(346002)(396003)(40470700004)(46966006)(36840700001)(2616005)(7636003)(186003)(40460700003)(426003)(47076005)(336012)(1076003)(6666004)(4744005)(107886003)(41300700001)(5660300002)(8936002)(9786002)(7696005)(7416002)(356005)(2906002)(26005)(36860700001)(40480700001)(82740400003)(83380400001)(82310400005)(54906003)(36756003)(70206006)(478600001)(70586007)(8676002)(4326008)(110136005)(316002)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2022 05:48:03.4208 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 617266df-d019-4f01-ef03-08da8bdd895f X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0003.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR02MB6814 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Add new compatible to support QSPI controller on Xilinx Versal SoCs. Signed-off-by: Amit Kumar Mahapatra --- Documentation/devicetree/bindings/spi/spi-zynqmp-qspi.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/spi/spi-zynqmp-qspi.yaml b/Documentation/devicetree/bindings/spi/spi-zynqmp-qspi.yaml index ea72c8001256..b28a8c8f5e11 100644 --- a/Documentation/devicetree/bindings/spi/spi-zynqmp-qspi.yaml +++ b/Documentation/devicetree/bindings/spi/spi-zynqmp-qspi.yaml @@ -14,7 +14,11 @@ allOf: properties: compatible: - const: xlnx,zynqmp-qspi-1.0 + oneOf: + - items: + - enum: + - xlnx,zynqmp-qspi-1.0 + - xlnx,versal-qspi-1.0 reg: maxItems: 2 From patchwork Thu Sep 1 05:47:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kumar Mahapatra X-Patchwork-Id: 602149 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B9A9ECAAD8 for ; Thu, 1 Sep 2022 05:48:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233092AbiIAFst (ORCPT ); Thu, 1 Sep 2022 01:48:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233233AbiIAFse (ORCPT ); Thu, 1 Sep 2022 01:48:34 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on20622.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5b::622]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61B0611821E; Wed, 31 Aug 2022 22:48:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F2S1CCPEbqKesCHOxK0Hwwg85MZblOnV/+ISL7qPWgYtY9gRqfJPJDxSuG0VMk0mLTwoJZZBqnJiDk/Efx6Ecph7AWwbggj/giODjMDLd9eBBgpnQYIDbNhjfVXthE2+Y/ORGt9a2MFtc1KNdt6th5mB/n0m2p3PwW55KLBu7/DZhGpdheKeDZ4rJZNJjK7EtytzkWZ1Zlg4iGjYMwRd8gkFS+N7KPP25apyMHKrS7/sWQpKN3NDrdsoCI5DzhW0URtfYIqqbsbUBMp5mVdw5PX0P1Q3ootsHh7wSIkRxwLV5/bMHJXaK6lVZosHPo7fUA22gwgpvDAZ55raPr/R9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pPSSury2uzn3K5qTMHS2oI3Qb7rpTsUkGbuEh3bjL2A=; b=SpCnkQFI1TsTzJI2JGibT4mbImGbkaLbQEIGP4M57RIRsL7AFi/NAmUl2h+EeDbmbHUtEVEIHjRj5DoYGZiSAHpAHrdw4gWkqw9Dzx6yJwJgZzuDCJ1EZxz9c72lQ1oZVTtX0hNwBtOUMgVmKMFESoKMGH7uJN95Z9ksh9+GG2dnxqkY8Q8EdCuVKK1fmJZJi2Srq6OE/no9hsG9XqFCaOKeMIXVhE+xM8Rz5rox+Bif3erkG+fmVW4YffS6LxXlJEG2Yr/RMekTm7rw0JOcFlXU126jmIFpdfKWgFXSgZnNJLjtHaAsR5/SY3O56B3GgFDJotoUPUOsmk9Tnwi0Xg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pPSSury2uzn3K5qTMHS2oI3Qb7rpTsUkGbuEh3bjL2A=; b=PfAr7S19g7B6m51ql5daeZFfjAdvntcj2Kid3/YepKkKxEeKfKwnHFQLxpP6IEWOstn4bu0Rl0VT1cFNBhdACTCo6YZZwFfK6KWiwuwzXGCeM0usOJiygri2xacNEluNZnCga0/e7fC9Nc8U/EafHJi7a1y32QqQkwiKs5g4MPM= Received: from SA0PR11CA0066.namprd11.prod.outlook.com (2603:10b6:806:d2::11) by DM6PR02MB5452.namprd02.prod.outlook.com (2603:10b6:5:78::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.11; Thu, 1 Sep 2022 05:48:08 +0000 Received: from SN1NAM02FT0059.eop-nam02.prod.protection.outlook.com (2603:10b6:806:d2:cafe::e9) by SA0PR11CA0066.outlook.office365.com (2603:10b6:806:d2::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10 via Frontend Transport; Thu, 1 Sep 2022 05:48:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; pr=C Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0059.mail.protection.outlook.com (10.97.5.175) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5588.10 via Frontend Transport; Thu, 1 Sep 2022 05:48:08 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.6; Wed, 31 Aug 2022 22:47:59 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2507.6 via Frontend Transport; Wed, 31 Aug 2022 22:47:59 -0700 Envelope-to: broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, git@amd.com, michal.simek@amd.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, akumarma@amd.com Received: from [10.140.6.18] (port=60724 helo=xhdlakshmis40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1oTd3W-000Eqz-NM; Wed, 31 Aug 2022 22:47:59 -0700 From: Amit Kumar Mahapatra To: , , CC: , , , , , , , Amit Kumar Mahapatra , Naga Sureshkumar Relli Subject: [PATCH 7/7] spi: spi-zynqmp-gqspi: Add tap delay support for GQSPI controller on Versal platform Date: Thu, 1 Sep 2022 11:17:31 +0530 Message-ID: <20220901054731.7705-8-amit.kumar-mahapatra@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220901054731.7705-1-amit.kumar-mahapatra@xilinx.com> References: <20220901054731.7705-1-amit.kumar-mahapatra@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 922793f4-3812-42b6-7f29-08da8bdd8c1c X-MS-TrafficTypeDiagnostic: DM6PR02MB5452:EE_ X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3pY6JqOgy9pYIybdI5Zq2iG4ZhfbbTnalgM9KSOppqxbJLcoWVyynJSPnLq1pZ/PcpVw1qki4LQ6KBfkAFhpBnQEmD1jAaHNmF8hcicou4fe2svPZwyWrGMDJz5lVWQO+lWyY1mmeh1yficVo0qI18/aIA57k5XsxZPyPM1x9XGRxGHImFOJJj0EVxw4VnSYRYbY7kp0iOul0oMmjLLavW4dWwLn+YJynZ5FY08jhF1Bau1MXpvFM42q8vntYF/7Q3FGIk8lPlECYTuyjDwFspZi4aslufaocCWvzpHHC9OJ4hukM7P4049XGPVUq/sr2ePStGCPKy0hOcOjb+GWda1rYcTYm6MqjP88NqF5HQC34JFOcwvj9DQR1G74kS2NZQVVXT8JDghOWmY7bJEtT5FBQrmk4oz5f1YuAjRHlQcOOLOKrzuS2DGzrgkdFGR7L4XdYeAEvsPhWbEZxRVH/hBKKNWpjFKV49sl/e7B5ybcFlL0n3RKdOjoEq8TDH3fb1RjSQVza2zMJzt2gYEIohB996EpMiO2No1bSMmB9bEPV6oDPizgh8U9kABDa9tt/zQ8wRJr5rO917KzGvcEvyBKw4CjmdwmGMQ9s2HP35Fh7TI1dj1VrUtczcZEH/6EEQDM21YWMZjoh4ulDE+5eq+ikmm8jCGaJPSxgrKbhye0IA3uGXFTKae6wN9elRRG/ZCEH//U1IViSUZJCS2UOEq3grphTdqOWQCD4xY/NbyCTRz4f7rZKlmF7p4/4CtA/sVkOkR6WpIkCaPa2LymLbkMtfpwL7AP3ZYNGvmnLqQ= X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(13230016)(4636009)(39860400002)(396003)(376002)(136003)(346002)(40470700004)(46966006)(36840700001)(2616005)(7636003)(186003)(40460700003)(426003)(47076005)(336012)(1076003)(6666004)(107886003)(41300700001)(5660300002)(8936002)(9786002)(7696005)(7416002)(356005)(2906002)(26005)(36860700001)(40480700001)(82740400003)(83380400001)(82310400005)(54906003)(36756003)(70206006)(478600001)(70586007)(8676002)(4326008)(316002)(110136005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2022 05:48:08.0120 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 922793f4-3812-42b6-7f29-08da8bdd8c1c X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0059.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB5452 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org This patch adds tap delay support for GQSPI controller on Versal platform. Signed-off-by: Naga Sureshkumar Relli Signed-off-by: Michal Simek Signed-off-by: Amit Kumar Mahapatra --- drivers/spi/spi-zynqmp-gqspi.c | 90 +++++++++++++++++++++++++++------- 1 file changed, 71 insertions(+), 19 deletions(-) diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c index 0e6423ff33f4..825a2d072536 100644 --- a/drivers/spi/spi-zynqmp-gqspi.c +++ b/drivers/spi/spi-zynqmp-gqspi.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -34,6 +35,7 @@ #define GQSPI_RXD_OFST 0x00000120 #define GQSPI_TX_THRESHOLD_OFST 0x00000128 #define GQSPI_RX_THRESHOLD_OFST 0x0000012C +#define IOU_TAPDLY_BYPASS_OFST 0x0000003C #define GQSPI_LPBK_DLY_ADJ_OFST 0x00000138 #define GQSPI_GEN_FIFO_OFST 0x00000140 #define GQSPI_SEL_OFST 0x00000144 @@ -134,10 +136,17 @@ #define GQSPI_SELECT_MODE_QUADSPI 0x4 #define GQSPI_DMA_UNALIGN 0x3 #define GQSPI_DEFAULT_NUM_CS 1 /* Default number of chip selects */ +#define GQSPI_LPBK_DLY_ADJ_DLY_1 0x1 +#define GQSPI_LPBK_DLY_ADJ_DLY_1_SHIFT 3 #define GQSPI_USE_DATA_DLY 0x1 #define GQSPI_USE_DATA_DLY_SHIFT 31 #define GQSPI_DATA_DLY_ADJ_VALUE 0x2 #define GQSPI_DATA_DLY_ADJ_SHIFT 28 +#define TAP_DLY_BYPASS_LQSPI_RX_VALUE 0x1 +#define TAP_DLY_BYPASS_LQSPI_RX_SHIFT 2 + +/* set to differentiate versal from zynqmp, 1=versal, 0=zynqmp */ +#define QSPI_QUIRK_HAS_TAPDELAY BIT(0) #define GQSPI_FREQ_37_5MHZ 37500000 #define GQSPI_FREQ_40MHZ 40000000 @@ -147,6 +156,14 @@ #define SPI_AUTOSUSPEND_TIMEOUT 3000 enum mode_type {GQSPI_MODE_IO, GQSPI_MODE_DMA}; +/** + * struct qspi_platform_data - zynqmp qspi platform data structure + * @quirks: Flags is used to identify the platform + */ +struct qspi_platform_data { + u32 quirks; +}; + /** * struct zynqmp_qspi - Defines qspi driver instance * @ctlr: Pointer to the spi controller information @@ -167,7 +184,9 @@ enum mode_type {GQSPI_MODE_IO, GQSPI_MODE_DMA}; * @mode: Defines the mode in which QSPI is operating * @data_completion: completion structure * @op_lock: Operational lock + * @speed_hz: Current SPI bus clock speed in hz + * @has_tapdelay: Used for tapdelay register available in qspi */ struct zynqmp_qspi { struct spi_controller *ctlr; @@ -189,6 +208,7 @@ struct zynqmp_qspi { struct completion data_completion; struct mutex op_lock; u32 speed_hz; + bool has_tapdelay; }; /** @@ -268,26 +288,46 @@ static void zynqmp_gqspi_selectslave(struct zynqmp_qspi *instanceptr, */ static void zynqmp_qspi_set_tapdelay(struct zynqmp_qspi *xqspi, u32 baudrateval) { - u32 lpbkdlyadj = 0, datadlyadj = 0, clk_rate; + u32 tapdlybypass = 0, lpbkdlyadj = 0, datadlyadj = 0, clk_rate; u32 reqhz = 0; clk_rate = clk_get_rate(xqspi->refclk); reqhz = (clk_rate / (GQSPI_BAUD_DIV_SHIFT << baudrateval)); - if (reqhz <= GQSPI_FREQ_40MHZ) { - zynqmp_pm_set_tapdelay_bypass(PM_TAPDELAY_QSPI, - PM_TAPDELAY_BYPASS_ENABLE); - } else if (reqhz <= GQSPI_FREQ_100MHZ) { - zynqmp_pm_set_tapdelay_bypass(PM_TAPDELAY_QSPI, - PM_TAPDELAY_BYPASS_ENABLE); - lpbkdlyadj |= (GQSPI_LPBK_DLY_ADJ_USE_LPBK_MASK); - datadlyadj |= ((GQSPI_USE_DATA_DLY << - GQSPI_USE_DATA_DLY_SHIFT) - | (GQSPI_DATA_DLY_ADJ_VALUE << - GQSPI_DATA_DLY_ADJ_SHIFT)); - } else if (reqhz <= GQSPI_FREQ_150MHZ) { - lpbkdlyadj |= GQSPI_LPBK_DLY_ADJ_USE_LPBK_MASK; + if (!xqspi->has_tapdelay) { + if (reqhz <= GQSPI_FREQ_40MHZ) { + zynqmp_pm_set_tapdelay_bypass(PM_TAPDELAY_QSPI, + PM_TAPDELAY_BYPASS_ENABLE); + } else if (reqhz <= GQSPI_FREQ_100MHZ) { + zynqmp_pm_set_tapdelay_bypass(PM_TAPDELAY_QSPI, + PM_TAPDELAY_BYPASS_ENABLE); + lpbkdlyadj |= (GQSPI_LPBK_DLY_ADJ_USE_LPBK_MASK); + datadlyadj |= ((GQSPI_USE_DATA_DLY << + GQSPI_USE_DATA_DLY_SHIFT) + | (GQSPI_DATA_DLY_ADJ_VALUE << + GQSPI_DATA_DLY_ADJ_SHIFT)); + } else if (reqhz <= GQSPI_FREQ_150MHZ) { + lpbkdlyadj |= GQSPI_LPBK_DLY_ADJ_USE_LPBK_MASK; + } + } else { + if (reqhz <= GQSPI_FREQ_37_5MHZ) { + tapdlybypass |= (TAP_DLY_BYPASS_LQSPI_RX_VALUE << + TAP_DLY_BYPASS_LQSPI_RX_SHIFT); + } else if (reqhz <= GQSPI_FREQ_100MHZ) { + tapdlybypass |= (TAP_DLY_BYPASS_LQSPI_RX_VALUE << + TAP_DLY_BYPASS_LQSPI_RX_SHIFT); + lpbkdlyadj |= (GQSPI_LPBK_DLY_ADJ_USE_LPBK_MASK); + datadlyadj |= (GQSPI_USE_DATA_DLY << + GQSPI_USE_DATA_DLY_SHIFT); + } else if (reqhz <= GQSPI_FREQ_150MHZ) { + lpbkdlyadj |= (GQSPI_LPBK_DLY_ADJ_USE_LPBK_MASK + | (GQSPI_LPBK_DLY_ADJ_DLY_1 << + GQSPI_LPBK_DLY_ADJ_DLY_1_SHIFT)); + } + zynqmp_gqspi_write(xqspi, + IOU_TAPDLY_BYPASS_OFST, tapdlybypass); } + zynqmp_gqspi_write(xqspi, GQSPI_LPBK_DLY_ADJ_OFST, lpbkdlyadj); zynqmp_gqspi_write(xqspi, GQSPI_DATA_DLY_ADJ_OFST, datadlyadj); } @@ -1147,6 +1187,15 @@ static const struct dev_pm_ops zynqmp_qspi_dev_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(zynqmp_qspi_suspend, zynqmp_qspi_resume) }; +static const struct qspi_platform_data versal_qspi_def = { + .quirks = QSPI_QUIRK_HAS_TAPDELAY, +}; + +static const struct of_device_id zynqmp_qspi_of_match[] = { + { .compatible = "xlnx,zynqmp-qspi-1.0"}, + { .compatible = "xlnx,versal-qspi-1.0", .data = &versal_qspi_def }, + { /* End of table */ } +}; static const struct spi_controller_mem_ops zynqmp_qspi_mem_ops = { .exec_op = zynqmp_qspi_exec_op, }; @@ -1165,6 +1214,7 @@ static int zynqmp_qspi_probe(struct platform_device *pdev) struct spi_controller *ctlr; struct zynqmp_qspi *xqspi; struct device *dev = &pdev->dev; + const struct of_device_id *match; struct device_node *np = dev->of_node; ctlr = spi_alloc_master(&pdev->dev, sizeof(*xqspi)); @@ -1176,6 +1226,13 @@ static int zynqmp_qspi_probe(struct platform_device *pdev) xqspi->ctlr = ctlr; platform_set_drvdata(pdev, xqspi); + match = of_match_node(zynqmp_qspi_of_match, pdev->dev.of_node); + if (match) { + const struct qspi_platform_data *p_data = match->data; + + if (p_data && (p_data->quirks & QSPI_QUIRK_HAS_TAPDELAY)) + xqspi->has_tapdelay = true; + } xqspi->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(xqspi->regs)) { ret = PTR_ERR(xqspi->regs); @@ -1303,11 +1360,6 @@ static int zynqmp_qspi_remove(struct platform_device *pdev) return 0; } -static const struct of_device_id zynqmp_qspi_of_match[] = { - { .compatible = "xlnx,zynqmp-qspi-1.0", }, - { /* End of table */ } -}; - MODULE_DEVICE_TABLE(of, zynqmp_qspi_of_match); static struct platform_driver zynqmp_qspi_driver = {