From patchwork Tue Oct 11 06:20:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mahapatra, Amit Kumar" X-Patchwork-Id: 614725 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 9E0FCC4332F for ; Tue, 11 Oct 2022 06:21:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229662AbiJKGU6 (ORCPT ); Tue, 11 Oct 2022 02:20:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229628AbiJKGUz (ORCPT ); Tue, 11 Oct 2022 02:20:55 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2061.outbound.protection.outlook.com [40.107.212.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 349B92739; Mon, 10 Oct 2022 23:20:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LfPk4UEwIfwdS83VFfdLlScfJrK88E7ma1w0pkk/r7fh+3Bpl+JAWfiXdf3rfbc6Y2BL7IOClExUc4TVp6CDRI805MGLdnlegeeQxQk75iUOghOS84m8qjpLZ68eUZ3U8HEH7U62Uxx5snkpt9cRi9hD9NPSY5tsPVEH4dT3naOJknPNJN8z4xu4eEPy3b2QYyvbpEtRVX8NaS+NFfL3s9sdzQI5BizDP7sCDzOe1vqF3JkWakcblI+GRghsKnTWjaOLWv+/1GCQ/pdgFm1/AkoFfEQq9+SRgaT2068stObEXqIlFWR/8i8XeEjlbd76WTdcUnEHnXsHQSWjgWkVDA== 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=Mf5wEFOE7qzYDkEKwvAk9W63YNBva6HHOCS7K+MHbws=; b=cO8+ru4eH68x+CYL96VcMv2myNZEkQWwjvdeTCxLBQ3XjxGu0TzhlI3Qyfoe4v3v4k/3RJXuRRQsijaTuLw5HSXnBPw7GYiBBu8mg8jGkSShJAbnfUn1oeD9DrxtyUmsq0lL1Uk+7HfDHLtUg6gYlHrV1JeTblekE8BcK7BJ85l2Ag9jX7TEwEKnhGqboWlsO8OxGLAw2GQV8RezO4Q9bULHZ6lmFD7Um1iIM08Gw2H9IdCwVD7An77C1yH5Wgerwauyws6Gn2TLC6IMl35VsTL5BVNW2uYLSQ/vIoWkmeeZCwuhHspSoliIw8nyl+vlRhinxLDWhWVQS4ZdxN8L2A== 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 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=Mf5wEFOE7qzYDkEKwvAk9W63YNBva6HHOCS7K+MHbws=; b=FzMBP0fWCFIQHpbQlsWhbk9rVaiQWqVPpits1qionC8R8NjxJLPdUGVnLeb4SzZlH8dwfuTCD9CAqL3TKBgtpqVNcMEXXnh7Uz11rcabwJu1xlHXj3+XOx5+GGY7bkIAz1luqP8AhhE8ZwTNqiUwvVr0vRpKdmEX6sTjprJULu0= Received: from BN9PR03CA0415.namprd03.prod.outlook.com (2603:10b6:408:111::30) by SA0PR12MB7074.namprd12.prod.outlook.com (2603:10b6:806:2d5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.32; Tue, 11 Oct 2022 06:20:49 +0000 Received: from BN8NAM11FT004.eop-nam11.prod.protection.outlook.com (2603:10b6:408:111:cafe::95) by BN9PR03CA0415.outlook.office365.com (2603:10b6:408:111::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.21 via Frontend Transport; Tue, 11 Oct 2022 06:20:49 +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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT004.mail.protection.outlook.com (10.13.176.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5709.10 via Frontend Transport; Tue, 11 Oct 2022 06:20:49 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Tue, 11 Oct 2022 01:20:48 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Tue, 11 Oct 2022 01:20:48 -0500 Received: from xhdlakshmis40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Tue, 11 Oct 2022 01:20:45 -0500 From: Amit Kumar Mahapatra To: , , CC: , , , , , , Amit Kumar Mahapatra Subject: [PATCH v4 1/7] spi: spi-zynqmp-gqspi: Fix kernel-doc warnings Date: Tue, 11 Oct 2022 11:50:34 +0530 Message-ID: <20221011062040.12116-2-amit.kumar-mahapatra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221011062040.12116-1-amit.kumar-mahapatra@amd.com> References: <20221011062040.12116-1-amit.kumar-mahapatra@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT004:EE_|SA0PR12MB7074:EE_ X-MS-Office365-Filtering-Correlation-Id: 158eb622-e594-4893-f498-08daab50bd7c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FQiXm+D0HVkb5EGktw88DwOl74Z53WVOgNaLIUcec+6MsPX2cNn8JCNF/Jwe18SXBD0dz2hwFpFBMjA6eqdLc1jdrBgiJ4RvxPgTfe6mtdS6DaT0KEVspQZRnfhljXfil1rcBDACIot8IMsCnYGA1Q3qped+KsReJnl0j0uwEqitCP8BbmaiGj/z2184/NxlzNk1tvMPBddvjImo5H2E1SPuMG0JA7RZJGxPsnXV41KSRdhMtR3a8YKeyvQVqdAT/IHAlrYaDYr/0MFnBq2W5ocgOqRE0iZQc68bptJnaT4HAXUsc43RSaFlajQM2Buz+K3DaELlnxHVuc4WQNyB/89umjFQoq7KfTI2qsUi9y63kYa9zt8RieUl4vfY0xAoP8Vj4WMENvoOkTRTKgaWZWIFQuWfloIMMPZLVjQMv2CJmlsJuD4YsNH4P+/MlL2Qs70NYntrCEjYLwaK9Xvxwxmv1rvcMtMzjXSJDmewvmvobO0URikiNFDuuYR7SRSafhg1Pfet3xKsMs16Y+IiPoLHkE8cYSvejmYpoO+Lpt5lg4P/ue5ARAKEWKHMdKVeefwi+Vz7DRYoZ0/yUXdlTAPKqbJE8r9R6p7D3ut5d6bUwa4Hb/3lqyO6xcRjvcNoQMurzMeC6Wjm5fku4IDY5IUiwE/y/0epgPyVuJz2O50QhdHaLuFKdfraAa7j2sqgkGyTtKoyWVHaTNPP74nKSD27caGkrAkmRFIgVqV6KdfLP3lDN9vvHEEcG0Cthv7QjYzvuFUjA2vhLedgirkbY6M9lAAA8Qnliy4PKVsiT+MjWcHuQCtLAhbGyCDnPP3V X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(396003)(346002)(376002)(136003)(39860400002)(451199015)(46966006)(36840700001)(40470700004)(2906002)(70206006)(316002)(36756003)(5660300002)(41300700001)(4326008)(70586007)(8936002)(86362001)(8676002)(54906003)(82310400005)(110136005)(36860700001)(478600001)(83380400001)(82740400003)(47076005)(1076003)(426003)(81166007)(336012)(6666004)(2616005)(40480700001)(186003)(356005)(40460700003)(26005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 06:20:49.0694 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 158eb622-e594-4893-f498-08daab50bd7c 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT004.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB7074 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 c760aac070e5..973008a30a09 100644 --- a/drivers/spi/spi-zynqmp-gqspi.c +++ b/drivers/spi/spi-zynqmp-gqspi.c @@ -141,6 +141,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 @@ -157,6 +158,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; @@ -739,6 +741,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) { @@ -823,6 +827,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 Tue Oct 11 06:20:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mahapatra, Amit Kumar" X-Patchwork-Id: 614724 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 711AAC433FE for ; Tue, 11 Oct 2022 06:21:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229738AbiJKGVE (ORCPT ); Tue, 11 Oct 2022 02:21:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229577AbiJKGVC (ORCPT ); Tue, 11 Oct 2022 02:21:02 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2058.outbound.protection.outlook.com [40.107.243.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A46385FF6F; Mon, 10 Oct 2022 23:20:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mdyGAZcNTrBnW2nte9k1yQi+Lyi5r4ecG+l3JtpxAVy7OLQ3C+OSHcBcNdS1C9nIQQH/ClhrOLJVNQekeq7AYXmPiUwT/QEM7Sjp+jH97VbBJ4NV16wjmNF+0F4m8PXE4Uq4Wlr2UakX6FKy5OV1pxdkAaIsTsCuLWb8WcN+CqLXSGWY6R3ipJx1GbVucMvuG3IGYabpfMu4eV5NKcsEkOtA5Qvb3OCHJkmYpJ0+G3F0fn1r7kcefnZYYhAUDT3U07UTaJltPhGtucO9Uq/efywJOWua0irzwJw4GZfwUqM0Aols8XZdi2ws0hvWlBx69i0y/X/iZULEtC+YVhRqjg== 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=7YD45q83STiGTiA0MQuWej3uWkYVXktRm5yXX8gCdYo=; b=Mx7btrgTCuffvz8WVL6rQ/d2aMrmPAnPjKO/QZ6BFAukus2ORhiWK528Au74VW1D5f8uuNwk3z3tfHJlcSrqtnRzViBmDaq/POI1MunJvogzMz/4qks8TJZfBcKjvP68o8nbo3klzf/mu/3jqiY7pocKObjn9zEP5AygCklsTn5qFv7+KS3i7OChu7/2gQSUdJyD4zZNUVfoOKam0PP42uZkZ01u7E0rWYlgw/jHiohsrrYjOq1JJZMHoiViypH8uZskZxC/QWXDx/a9Fu/eoXYJoMJNZ9VMTk/XVSz4P5syKpvtfmpt/OBGqns1dJPSz1kK4PF0UeC6NX/Oea5C6w== 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 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=7YD45q83STiGTiA0MQuWej3uWkYVXktRm5yXX8gCdYo=; b=sMPjQHzeJba/q2NqgLE0lJqltrdqbNvjktQkwSrAdsov2tkaMoljNOyjiqqAe/wiRFtQCIvtk4srsUBdeTKzlpTm38nuvvBVTn6oX6cpeDEPLXR6fmg6ecNacpcT7tbIB9PGDPPm0YM3EFtu+JewVe+e3WDtZaOB2Nteq4xHQP4= Received: from BN9PR03CA0406.namprd03.prod.outlook.com (2603:10b6:408:111::21) by SA0PR12MB4542.namprd12.prod.outlook.com (2603:10b6:806:73::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.19; Tue, 11 Oct 2022 06:20:57 +0000 Received: from BN8NAM11FT004.eop-nam11.prod.protection.outlook.com (2603:10b6:408:111:cafe::da) by BN9PR03CA0406.outlook.office365.com (2603:10b6:408:111::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.20 via Frontend Transport; Tue, 11 Oct 2022 06:20:57 +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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT004.mail.protection.outlook.com (10.13.176.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5709.10 via Frontend Transport; Tue, 11 Oct 2022 06:20:57 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Tue, 11 Oct 2022 01:20:52 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Tue, 11 Oct 2022 01:20:51 -0500 Received: from xhdlakshmis40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Tue, 11 Oct 2022 01:20:48 -0500 From: Amit Kumar Mahapatra To: , , CC: , , , , , , Amit Kumar Mahapatra Subject: [PATCH v4 2/7] spi: spi-zynqmp-gqspi: Set CPOL and CPHA during hardware init Date: Tue, 11 Oct 2022 11:50:35 +0530 Message-ID: <20221011062040.12116-3-amit.kumar-mahapatra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221011062040.12116-1-amit.kumar-mahapatra@amd.com> References: <20221011062040.12116-1-amit.kumar-mahapatra@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT004:EE_|SA0PR12MB4542:EE_ X-MS-Office365-Filtering-Correlation-Id: 3c6444a2-7da2-4963-2db6-08daab50c25e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j8IVbn0ATNGaMX5/4SfthfLTaSTGx38JXx7gat1WV+808SMvFGqRLgPvWpzrtp8yJHAYvp+t6GvI9VjtZyiVwL4UDS6w3pfzdrUTqSEHQK/f0h1QWGR3Rgszs5qsRepSLwDpY6HZSAnlsCSxCcJnLZoO1ZAmp3rQxx8cZhjRMpMSaEouYdIUzbyVGZ4WqFYaQVZQvyx4n6GkO2xlnEgKXjMENryABD4sRpbhztgU1x0TR7TuycEj8iRacZEXXp6t8mWfBW3M2aoRlBP7odoBd099u5dI8KKoBHqLkYscPn5W0/hutN6cr4ccUtmGAtVgKE6Bz/h7csGKXCYWzc0B/jUsYaoqkNo9Wz7mhQYefD8vLZKrs4Z5UmhiE1IoBi1IaMqVshTcbAoRI3Kmdrnkv2232EEUQcsPl0dYN6u9G+m1o4zrFkBGa9fgo6K8yQuqAy7BAjxOw4IZEie575eDRIT19RGh7omxsAYaiLlrcLjlv45ANuUIrqAKr3zmG/MonnJasf573/DBlw5n66VLymzbGeOM5jP1Dyfl94kzG2ElevWOyMX+s+Eqvabj68+Npbvh5joWWO2HHlVgovyzTi5DH/LpBBGdk4ZlgjMBrk0jejA4BPH145WA6dNKMsHy6pUhUHCAAcDXMeOLoOkobDsuhZ7K+XMr7IUJ7WtNcT6CX1LzFPKwoEZxh9h0K+H0PxXOxFVVnbu3sbVUvEcCfe6uGmB4jed2A9ntmTPodZbDiBD0PQnYn605fkStlA5RnpW/Oi6MWgJ+Yj4WyFn6g10zCdmAeafE4HvBV1cHL460VYxciSqN1MkXq/BrOBys X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(136003)(376002)(39860400002)(396003)(346002)(451199015)(36840700001)(40470700004)(46966006)(5660300002)(8936002)(110136005)(86362001)(54906003)(70586007)(70206006)(8676002)(4326008)(316002)(478600001)(36756003)(356005)(26005)(6666004)(40480700001)(40460700003)(81166007)(83380400001)(82310400005)(47076005)(41300700001)(2906002)(426003)(186003)(1076003)(2616005)(36860700001)(82740400003)(336012)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 06:20:57.2719 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3c6444a2-7da2-4963-2db6-08daab50c25e 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT004.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4542 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 973008a30a09..1b56dd29057f 100644 --- a/drivers/spi/spi-zynqmp-gqspi.c +++ b/drivers/spi/spi-zynqmp-gqspi.c @@ -266,7 +266,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) @@ -305,10 +307,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 */ @@ -470,14 +479,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); @@ -1170,6 +1171,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); @@ -1207,8 +1211,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 Tue Oct 11 06:20:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mahapatra, Amit Kumar" X-Patchwork-Id: 614551 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 5F8A9C433F5 for ; Tue, 11 Oct 2022 06:21:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229761AbiJKGVB (ORCPT ); Tue, 11 Oct 2022 02:21:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229742AbiJKGU6 (ORCPT ); Tue, 11 Oct 2022 02:20:58 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2049.outbound.protection.outlook.com [40.107.223.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5014A5F7E2; Mon, 10 Oct 2022 23:20:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dfZcwYVH+i8v/6iNFFL/FkoTFtG/r6Kl9A4GDpvH3lo9RIBXLeptoDU+/MWHlnA71ogIKdxEadYEziTM4jDeCXUjWNKXlWG926CeGgIsM6aj5mP1Dxp1gYhxYq7LHlCW2DcJBaWT6C3cDcVcJQZxInkhEJ4cGz7/PlXfD86x3ldiqzz4WS5G59wFPLaPVLK93uUsniSEKCcOyey5lH/LhheSXpK0zbrXxzvmDaThRHL3m+zRsfmk3TosIVLbMEZAeslp6t99gh3L8zeow7QZslKP+opDhgorquahzOPqsfsHFh/yn/mnBH2CrfPpyrBIaBPGGgmdVq1RUfVNuFOKCA== 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=ivn3+biUXoUE/6NG65aupg0Z9GutVeq0abMh5qHoMUo=; b=Y+B8HHYFIHB0OCtEeK57mxnnAKnDFMdcMCso90J0OZttblTrtOr3p3RDYLSHXivPWQidPWh1h8jGZhfwRTAagze/qZC42Vi/TI8/FUVelyb7OBT9oI0DAnRL4NB+7Sy70g8Mp1OkUtt7+RinlH7OKez5nnoT/NcUXebGxd5mGSRbSMnJXAPWGaGw8dKkjMCB1u8rjjJvP6yZ0AjLXCnmpADLBgugqkuHWyT3yb/8F6PDAR4/+ougjRn6tNDW/sOjP/ENvo8Z+h7RuWHOHqEobSpv80wmvIaUBHTuyYPmAuXb4m33d3Ofj5/LmH0wwmdOd3+e9Il8y2FkdzHyZ50Fdg== 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 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=ivn3+biUXoUE/6NG65aupg0Z9GutVeq0abMh5qHoMUo=; b=GNs9bcabJrDgPAq4BpS1MHGS+bBGwtVLAwCUlCioj9hk35c7ef+gaLQBZ1F5hi8JWe3DH6ZalcaMvGQFXJvcc4BNj3p6c5+a5Nt8IRPKdnwH4+dVlBh/9bWzAFA5OPzH/PqDa9HCACe1/gOyzr6Ba6Fm5ayvFCDb14Zig1Khq0k= Received: from BN9PR03CA0391.namprd03.prod.outlook.com (2603:10b6:408:111::6) by DS0PR12MB6533.namprd12.prod.outlook.com (2603:10b6:8:c2::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.19; Tue, 11 Oct 2022 06:20:55 +0000 Received: from BN8NAM11FT106.eop-nam11.prod.protection.outlook.com (2603:10b6:408:111:cafe::65) by BN9PR03CA0391.outlook.office365.com (2603:10b6:408:111::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.19 via Frontend Transport; Tue, 11 Oct 2022 06:20:55 +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 BN8NAM11FT106.mail.protection.outlook.com (10.13.177.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5709.10 via Frontend Transport; Tue, 11 Oct 2022 06:20:55 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) 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.2375.28; Tue, 11 Oct 2022 01:20:55 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Tue, 11 Oct 2022 01:20:54 -0500 Received: from xhdlakshmis40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Tue, 11 Oct 2022 01:20:51 -0500 From: Amit Kumar Mahapatra To: , , CC: , , , , , , Amit Kumar Mahapatra Subject: [PATCH v4 3/7] spi: spi-zynqmp-gqspi: Avoid setting baud rate multiple times for same SPI frequency Date: Tue, 11 Oct 2022 11:50:36 +0530 Message-ID: <20221011062040.12116-4-amit.kumar-mahapatra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221011062040.12116-1-amit.kumar-mahapatra@amd.com> References: <20221011062040.12116-1-amit.kumar-mahapatra@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT106:EE_|DS0PR12MB6533:EE_ X-MS-Office365-Filtering-Correlation-Id: 93aadddb-3d3c-4618-9115-08daab50c138 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QPBT7FACp1ER6u1Mjes06EXgsYpus6GScxQEJ45ZbTqEc1dv/jj8pVNc0467P6JBGLUnvwP+w1CWT5bvEfXRNYyrGTYBUUAx5JZTpDfjyE6Cq151EATwtT/ms/AgHSglQKYZhzeS3/iZNfUHrnR+8DxrxZ2gnOFZ+pvewPT9nDAFqZe2mOkr8tYFbNdoDhrosfEc4T45bhys8jQCIWHu4N/m0PNWAhVslW5c62hBixtW0stbDUib/hwRbvjLdv8gAGLsHS/qOWvFYmPHwGPShf+FsREmXpqDlrcuJfUDu2P+AAMLUJLHBZL57I6MBDLayEPngziG+uUxp5cF2CLdpnDWdu1bure2szkdAIVrBbSbRxJt7ZKlIgq+R8s2TNIgB0VFL6W8kotAA0abLvPcRAerubfP8VwB6riDZtWhssUL6r3vKRtiyWceM8YnbjRxAQxMj88e/7uMuZoogW0w+IAyxFn7SitURMpK8Tz/4RAvVcwSEvG8z6JgL/QjJwerpF3dIb2S3C6JOIc0kp2RaIOOmc7cy1Iczc9h769tvSnCdTbCwftjpYrWKpR8rTXYJwo1ryGMzo/Rh49GnJZiuHmLoSHVJdB94zZmiBUKSj93HrNfW+LoeLgSaJqpAfhkZZYEV6JOgh1n+kF/av6/8/oFF6hviSXexYHoSfWB1Nfh54XnXZ/MpNO47obBZaLqq3MfDC1dhnkx7OeiPrwwFNiLtZTjBQJRytnTKJCxMYeeo9cQaQEaiMR1HGLXaObmgbS6QwRu81Ied5LE5dwkoANG/xv+j80jbzWsTjdQQTd3JiRJfnnEPnQcff9EHOA3 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:(13230022)(4636009)(396003)(136003)(346002)(39860400002)(376002)(451199015)(46966006)(36840700001)(40470700004)(1076003)(186003)(2616005)(336012)(47076005)(426003)(356005)(81166007)(36860700001)(82740400003)(5660300002)(83380400001)(41300700001)(2906002)(4326008)(8936002)(82310400005)(40480700001)(40460700003)(6666004)(478600001)(26005)(8676002)(316002)(70206006)(70586007)(110136005)(54906003)(36756003)(86362001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 06:20:55.3477 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 93aadddb-3d3c-4618-9115-08daab50c138 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: BN8NAM11FT106.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6533 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. Update GQSPI driver to rewrite the baud rate value if there is any 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 1b56dd29057f..0fecea338027 100644 --- a/drivers/spi/spi-zynqmp-gqspi.c +++ b/drivers/spi/spi-zynqmp-gqspi.c @@ -159,6 +159,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; @@ -179,6 +180,7 @@ struct zynqmp_qspi { enum mode_type mode; struct completion data_completion; struct mutex op_lock; + u32 speed_hz; }; /** @@ -273,7 +275,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); @@ -318,6 +321,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 */ @@ -466,22 +479,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; } @@ -1173,6 +1193,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); @@ -1209,7 +1231,6 @@ static int zynqmp_qspi_probe(struct platform_device *pdev) ctlr->bits_per_word_mask = SPI_BPW_MASK(8); 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 Tue Oct 11 06:20:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mahapatra, Amit Kumar" X-Patchwork-Id: 614550 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 B712AC433FE for ; Tue, 11 Oct 2022 06:21:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229829AbiJKGV2 (ORCPT ); Tue, 11 Oct 2022 02:21:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229766AbiJKGVW (ORCPT ); Tue, 11 Oct 2022 02:21:22 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2060.outbound.protection.outlook.com [40.107.220.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64C8A876B3; Mon, 10 Oct 2022 23:21:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DPWqnwUtYiL7HXS7UU7VE6oqF3i2wfA6rncxSpGH6mTLAy0n1rAlDJ+00tP+p+EyIv1RfeLLLryJCaEBxM48HLR3GaMWnSYZmFHCG5yhA2v/0MXrfcsbUEkXSUrswytAW6Bvy9az7UTLhWaxEE4nnriAi6w2Cf9Qfci1GAsnTLCOYkqi9ZkTP6MyRM4qFOMHOBjHnSwg8cUhmxHbiDSiXMMLwLG4Ue3IW+eBYI6pO4TKfQ5QFRCJjHsItWHq+UES07cQwjVy4QQXPtUbpBPjwhxVsv+CFGm1Gp5GVlE74Uotob0ItctrL9cIpTl7X9ITtt7SsQ0pgG/2l48MLpU0OQ== 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=VMc8HZagvV5BKBmHkLKqcigmRmskfGEWRymqfceml5I=; b=ELCxZ/Rk/jripih8TWCAEmPAeeyNSHpMxswGL8CaQMy5ZjiXTtbQ4eJE91B4CvKt/bydNer8unt0syfB2OFjhiB7LICh28avIEimJ8zYHnYc1o1N/DwwCWFIYAgTIKsXRMYGv6UzjvDdK/UITlcj83yC5fJ3FxifsVC85/pBvPWljXmlv2CKM30gCplPsPBCrp2G/dM7LLbq9d/Rt6bWlcHguYVh3FS50IfBLyFToh8jkIYkRf6r8qicxFCAC1b9x/fbk0nBmYwoH7klRk4qw90ODtFY/S5PHOlakJvT1ZMB190U8WXn0SEP50hSNwHU4Ex7lh9TnUpq2WRMlpeeOQ== 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 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=VMc8HZagvV5BKBmHkLKqcigmRmskfGEWRymqfceml5I=; b=K7HxOlgaQMZTYdM0wRJ+ts3DisgNWr6XkKQXVqWZYO6WqEVczmB/PcYtFRAtq2mc42do9G13sN++gmv6VRJ3gv2FvloRtuIMgRHp9cFEIzXSwU7OAVtirX8HEeMvlH4AFjH1j0ZW8rbA3YonpZ1jfdtRTRd8LFNiviPssS7lKvY= Received: from BN9PR03CA0405.namprd03.prod.outlook.com (2603:10b6:408:111::20) by MN0PR12MB6125.namprd12.prod.outlook.com (2603:10b6:208:3c7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15; Tue, 11 Oct 2022 06:21:01 +0000 Received: from BN8NAM11FT004.eop-nam11.prod.protection.outlook.com (2603:10b6:408:111:cafe::98) by BN9PR03CA0405.outlook.office365.com (2603:10b6:408:111::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15 via Frontend Transport; Tue, 11 Oct 2022 06:21:01 +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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT004.mail.protection.outlook.com (10.13.176.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5709.10 via Frontend Transport; Tue, 11 Oct 2022 06:21:01 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Tue, 11 Oct 2022 01:20:58 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Tue, 11 Oct 2022 01:20:57 -0500 Received: from xhdlakshmis40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Tue, 11 Oct 2022 01:20:54 -0500 From: Amit Kumar Mahapatra To: , , CC: , , , , , , Rajan Vaja , "Amit Kumar Mahapatra" Subject: [PATCH v4 4/7] firmware: xilinx: Add qspi firmware interface Date: Tue, 11 Oct 2022 11:50:37 +0530 Message-ID: <20221011062040.12116-5-amit.kumar-mahapatra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221011062040.12116-1-amit.kumar-mahapatra@amd.com> References: <20221011062040.12116-1-amit.kumar-mahapatra@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT004:EE_|MN0PR12MB6125:EE_ X-MS-Office365-Filtering-Correlation-Id: bae8acac-95ca-499a-e0c5-08daab50c4a3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M0UaVTOv2gxwu710w0aYpFeGQyNxPWupR4H8IeobZFXosBAxJ++Q0BT83wyLaFynyfGVoccYG0m5yaq3XC5FRSPz1tou8VDrmtT7o/L7T25hH8kVVaIbFfniFknpJzLqa4Vq3dtczi8q1jPiv0+579zdOC4p/2COxvAQliXbyHUuwrq2Hw55RrenMiun4eqnQC9kK3aYSKAfZxlyQzc9FD/R6tjUymF6SPHAYgCaJnZEl0IuwZkYh6cDIow+wnzAm4kvuy0AbRxcWhILbb46k3usB3N/JrdyLylVUNDqijIwhya+H4VV9kMzFtRjLNYVeTwyW4HjlC7zO0BymasYujwt9konc1a5Sf1yxS1xbuMeHVLZnEn4yehU/REPkhvEptX9VuVOOuxqY2LzjTSZJyZ8tfG7uyi4qInW7MPBxOKR+ILO8Xo4pCptVB4p2U/jx2Q6VHK8cCpZICYr7U09lzufC5dxz7Bja3IMKdngI7IGgFKJggznvdEyQwH7L/N/gmCQIEipW7QfHlpQ8490ZGzvL4O7i5UeGJe8vtXQ4dfBEqZcZOftcepUPGm6Ds9m08LbD3jDtgLXzQivltYVE9ZXnv5lf/1vVK5VOxp28MiXh2yGMqmyTq0z9qdTaJ9ucuw6MAp4MOJBdVYxkT1j1IX82LKMvpkyI0X1OObPKKrhP62AoaIP8HnONEQWkcwhap6PgtGJt3scS6mTDI+iY683vtdN58lCjETwqnYFqnIVF3yYEWkM3T7Y2Y5jv3sOJNaxh0AKdHmHy/qYuxKobqeAdlm6M5GWlscMykbpq+f8bUaLsS91xZLIqkqtE3sb X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(136003)(376002)(396003)(346002)(451199015)(36840700001)(46966006)(40470700004)(82740400003)(81166007)(356005)(36756003)(86362001)(2906002)(5660300002)(83380400001)(186003)(47076005)(426003)(40480700001)(336012)(2616005)(1076003)(36860700001)(26005)(6666004)(4326008)(8676002)(70586007)(70206006)(54906003)(110136005)(41300700001)(40460700003)(82310400005)(316002)(8936002)(478600001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 06:21:01.0841 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bae8acac-95ca-499a-e0c5-08daab50c4a3 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT004.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6125 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 d1f652802181..5d709faf9fe2 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -843,6 +843,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 9f50dacbf7d6..0a84b04af26e 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -135,6 +135,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, @@ -386,6 +387,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, @@ -457,6 +470,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); @@ -666,6 +680,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 Tue Oct 11 06:20:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mahapatra, Amit Kumar" X-Patchwork-Id: 614723 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 A0312C433F5 for ; Tue, 11 Oct 2022 06:21:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229700AbiJKGVa (ORCPT ); Tue, 11 Oct 2022 02:21:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229755AbiJKGVY (ORCPT ); Tue, 11 Oct 2022 02:21:24 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2040.outbound.protection.outlook.com [40.107.94.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAC3E87F8E; Mon, 10 Oct 2022 23:21:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I0TGVM4Vq2ch3ZLWVtqiWuFP7ygzauun4jdR7fgSHswdRE+WkWojIkwTys2Xn05+XmjGLhVM3qzy6lTaqqSl8gfEm/Z/sLn6P5Gz1mCgVCLPJzFS4MC2dFlUrH5fDweYqlc63bPvSRVEtYeXr0MnlOnf0rgKA58TsD+f3y/+2EzPTDwKvezcyEWYfjuXzQYPO2CJXniIH7zqjkxbSgmf151mn5eHtaCAcPSfcAE89mRnZ3Q5U7WxFEHnfIP4l7q74A8uN9VDY4BBMop6tFL8Y7BT39jqFqCeKwwSPOg0SjObzxnCP6eIGOplFzlXQtfJ89KmI7QDDKwqfJb6udkR8g== 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=jrYG587qA3RzBMIm00PpvSRmeRdJO+WIRFIP1bkVgqA=; b=VEKwdJodisjlXH2OPP/m56zDmgkiCKT/cab4hVOWSr124V3664jVohyWw0ZkmPdu8FyT6inqK5G6MYeitt5MFlbbkCpzcSsPeFvHYIuaO//YsGSAVKNBBR17vVMPoacTy6WLttPvHZyzmHKbHAXYKM1YvqL7gS9Yzu+TtoMab6YXElg1X65uSDnfo9NHqLna/ABDEs9LhmHswx5lBlJDpw0mwU/VHHU9VcfneSAXW2InTrZu8G3RkUH5Lh6Qko2NF6rJQNufVcvUmKzyaM5fr74SrSLP3nhe9zdxqaYWRJqgdHLhUu0zhOkE/icw3PKEEc0HAzALVjVUro8ZgUYYqw== 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 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=jrYG587qA3RzBMIm00PpvSRmeRdJO+WIRFIP1bkVgqA=; b=J44zD5qKXjAdjhqeL7kbqR2ITH860g5pUflb0f/mIMx3jtPclufAJAVCrain8N380vgiduXwnFQb8VKbBfm7W3RPRh6KSfoxFIvMjv8wRy0c4TOR0Qfqdj/P1x1Yq1KtJif9f8PQnhPafBIzNQQ5SdYp8X59t/Hw1rnwHyPfroE= Received: from BN9PR03CA0073.namprd03.prod.outlook.com (2603:10b6:408:fc::18) by DM4PR12MB5088.namprd12.prod.outlook.com (2603:10b6:5:38b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15; Tue, 11 Oct 2022 06:21:02 +0000 Received: from BN8NAM11FT048.eop-nam11.prod.protection.outlook.com (2603:10b6:408:fc:cafe::7e) by BN9PR03CA0073.outlook.office365.com (2603:10b6:408:fc::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.21 via Frontend Transport; Tue, 11 Oct 2022 06:21:02 +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 BN8NAM11FT048.mail.protection.outlook.com (10.13.177.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5709.10 via Frontend Transport; Tue, 11 Oct 2022 06:21:02 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) 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.2375.28; Tue, 11 Oct 2022 01:21:01 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 10 Oct 2022 23:21:00 -0700 Received: from xhdlakshmis40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Tue, 11 Oct 2022 01:20:58 -0500 From: Amit Kumar Mahapatra To: , , CC: , , , , , , Naga Sureshkumar Relli , Amit Kumar Mahapatra Subject: [PATCH v4 5/7] spi: spi-zynqmp-gqspi: Add tap delay support for ZynqMP GQSPI Controller Date: Tue, 11 Oct 2022 11:50:38 +0530 Message-ID: <20221011062040.12116-6-amit.kumar-mahapatra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221011062040.12116-1-amit.kumar-mahapatra@amd.com> References: <20221011062040.12116-1-amit.kumar-mahapatra@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT048:EE_|DM4PR12MB5088:EE_ X-MS-Office365-Filtering-Correlation-Id: b58b4d0e-ea4e-4b9e-18ed-08daab50c53e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ozzYWG4noA3VRcqmoMPg9i9psKgVVNIDuzaiogcgk8GXXi2san0aUAkGM/hrs9CObR3X8xYtksfLMqCkI2/SxvYMRp9lcwFF/1pg9Jw8QALarLpGXvKc7s3IJY1NSRPqoHoUDO955JIRS+OBrDlR9PGxFsXnyWD7EDqSSP+J+D3PEhLuUMK+EO1f9inKObiuens8FIKvAlMIYbdf7aX+NeAdap9eb76vFQf9so5G6ebD1ZlbWtpSUK/9dQCgZgdoVslJc+allAwVV6RaoTqYS8Ky11QnLRtRft+5GML7ouzsm/okr3/fvwXS2GJsz0wl1Zqd/GZf83TERJ4DXWEo/I/5gkKLHqARuwSJZ3O0GvoCVRVss1QsPM3Cx2FsYr91UqCL5PcHVzYoPcI0To1f31Zo9e2jyBjm9RUinPCLqOmQnHBPRdzY7Icvr7Hgha3kCxn0TUd5wcxXYjDJzlW847+8Bmz2Om0vINZO6mmyaVuoo1sxpR3NDN1BQEzP784V5BOb9G3aG/4s6z5/0dHAo3mUotl6qGoV48Y83I5Gf5RZNpQ9vWvOM239h63FnBl6h/NV/9b/oviSeNftRsowTTNCIjY2EAPRZLv9Y35SaHj0f2XSqMQsHlU6ntvEgl1GpEFXKWNdR1x2bx+cE+E5I1vLmg7j5ZrcDdzlrL3rJep+xKPLJomuiPm9uafTinDxnvln1w4cJKJ6tRpmxJl/doSVc5FV9yXu2p7Zcpwl47Z+zEaTnH6uMx002+iEVwU/ZWocdk1xmjsWwIfhVamt97PrwYKmLV639WsiDlE+AgPfDDErBL3MvNmw7yDcUto4 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:(13230022)(4636009)(346002)(376002)(39860400002)(136003)(396003)(451199015)(40470700004)(36840700001)(46966006)(356005)(82740400003)(41300700001)(83380400001)(5660300002)(426003)(8676002)(2616005)(70206006)(4326008)(1076003)(47076005)(70586007)(2906002)(36756003)(26005)(336012)(186003)(8936002)(86362001)(6666004)(36860700001)(40480700001)(82310400005)(478600001)(316002)(40460700003)(81166007)(54906003)(110136005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 06:21:02.0636 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b58b4d0e-ea4e-4b9e-18ed-08daab50c53e 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: BN8NAM11FT048.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5088 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 set the recommended tap delay values in GQSPI driver. Signed-off-by: Naga Sureshkumar Relli Signed-off-by: Michal Simek Signed-off-by: Amit Kumar Mahapatra --- drivers/spi/spi-zynqmp-gqspi.c | 50 +++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c index 0fecea338027..c11736d96f33 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 @@ -136,6 +137,16 @@ #define GQSPI_MAX_NUM_CS 2 /* Maximum 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}; @@ -253,6 +264,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 @@ -333,15 +375,14 @@ static void zynqmp_qspi_init_hw(struct zynqmp_qspi *xqspi) 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); @@ -501,6 +542,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 Tue Oct 11 06:20:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mahapatra, Amit Kumar" X-Patchwork-Id: 614549 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 DA3F0C4332F for ; Tue, 11 Oct 2022 06:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229820AbiJKGVl (ORCPT ); Tue, 11 Oct 2022 02:21:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229822AbiJKGV1 (ORCPT ); Tue, 11 Oct 2022 02:21:27 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2057.outbound.protection.outlook.com [40.107.243.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC73E88A00; Mon, 10 Oct 2022 23:21:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fjX7Y3wkgZUIba5YMEM6GfjZEZmTREHqMFtgP1kjrckZECwZFGvW/xzA2/KMZ+3FjUj4rsk9Cl0rROzV8MwlOfafL+848A2Hs7hqP+O1AMTY/XweboLRnPjcC4r/UmAw7HHNII6cJB4GHk796JwDaulsa9bjr/pB6365DH1c48Pe+ocILMHSXUV22OcdjGCltwmIdxOs0GJat+PEU1MEfRq3Am6PYTmD5Tc5jerOa/y3mdjyBHub59ReJPLU2c+bWbnTrQIDNEcwljZzjwOPABwmhprQUYY2PaQa60SDjzWg+c68BwSUYh6K17KW02TdW7vlKWBzaOeD7uQ5x1EXmA== 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=JHv4UUmmi618SqLBe+XEf59UgNdXdyQns6LLRHqU9ow=; b=AUPHSVNI6p0Bj9leWFLC3FpeDI1Lzws8WZAgEM0hahpVVBDbZeLjdDW7mTpHjEDysIbhT2DMn158jgqqKRZJ0v4bAC9PeZ5MC8HOHmTIzCWASNqGAoGh+06c9ov3lAKQxGCoaJbfaY/FjdMW1wvWxT9OMhr6PiOmwn3GJyco8asoKiKg/Hz29Ssu0oB2aRxXtpVMRqRErdXgXYFZE/X4uAGYhA8eIK65ncP3lSmAQJTC0pOU64yLa/UFD/EK4JWPIa7Kc2bwfgTnZ0dXoJY5DkbJnI2MDhmKujMKR8oeG1wBCTLELUdxX+uzn317e5jVexvms9ChfvJwGybUIexAtA== 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 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=JHv4UUmmi618SqLBe+XEf59UgNdXdyQns6LLRHqU9ow=; b=NagI6rZlQKgGxNYiOpbrxShLff8Dt8+bR9F/VBiDSth2kFy4IGt3hETJkNwhemy/vXRdBxjCh947f+/tYQ0FG9qWXqsDAL1VigzO+ldB6kDXJXEztWT89VavwD94HkXUA044xvrP3qSjzclxRnL71pdA2LObBdRYR79VNVitCVg= Received: from BN9PR03CA0218.namprd03.prod.outlook.com (2603:10b6:408:f8::13) by DM4PR12MB6446.namprd12.prod.outlook.com (2603:10b6:8:be::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.34; Tue, 11 Oct 2022 06:21:05 +0000 Received: from BN8NAM11FT057.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f8:cafe::61) by BN9PR03CA0218.outlook.office365.com (2603:10b6:408:f8::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15 via Frontend Transport; Tue, 11 Oct 2022 06:21:05 +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 BN8NAM11FT057.mail.protection.outlook.com (10.13.177.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5709.10 via Frontend Transport; Tue, 11 Oct 2022 06:21:05 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) 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.2375.28; Tue, 11 Oct 2022 01:21:04 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 10 Oct 2022 23:21:04 -0700 Received: from xhdlakshmis40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Tue, 11 Oct 2022 01:21:01 -0500 From: Amit Kumar Mahapatra To: , , CC: , , , , , , Amit Kumar Mahapatra Subject: [PATCH v4 6/7] spi: dt-bindings: zynqmp-qspi: Add support for Xilinx Versal QSPI Date: Tue, 11 Oct 2022 11:50:39 +0530 Message-ID: <20221011062040.12116-7-amit.kumar-mahapatra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221011062040.12116-1-amit.kumar-mahapatra@amd.com> References: <20221011062040.12116-1-amit.kumar-mahapatra@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT057:EE_|DM4PR12MB6446:EE_ X-MS-Office365-Filtering-Correlation-Id: 15489511-f286-40d4-40e9-08daab50c761 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UzjsqKZZudGOuZpmwxeIOD8P1QPKSwIp6tVyblpAJGwW3WKJWHupMR5G9Jd346fjXrlFqbeEDuUpXGVqP7Mcq5ASG/Qmfg3blVJcbj3Ksk3nTowK39m4PD/QILQ3Ggl84KyH3hBcY84p5rtwHRmxMyshTW8QGB2Ll2q7Jmqa7IqnSyCHMQsztmdF3CZGlUlwvSwpva4LrRl9avq1DhLoG3tIweOJfP8jU3YxBu79+btMLrdb8MHwYIQGuQhioQZ4aqWVF/RflLsMI3fEZ/90VuqYoHWs30VKTqIH5dvOjjb29MN8R6z3o1wH37Kk+dn+7ns2fETP81Oyv/ocDkGCzmKT7W69Ox6cJ/xdLjyC6Ow9t2mBNX9jJXnlO///zuGj6xJeeC5KpCEjnmuqmOyyecQnVqHd674dv9KLCTEJAJPNS0uElfIxjRBw4DSBfrnRoQXraGiBc5ayJ9zdwvT9NWIqW9nXuOlltWrPrStwaVic0YJ0AIQ1D37u11VDprQ5XJ4lS4fth9yHMeQBG/tqEriWUb9/4uXtGPnMh2ed5JYyp1pXqsGtp4kcCk9n+xdsYenpDYxc4FL7kFf2pGVSNiyV/ir4Zn4ZSEormneJvcpTni/ErgM9Bym2+YlKyYmTpbEnZQ/T3+X1bTB+ZUaWzeIum+0xb9JirvrIQiZfeR7xFUPhxz/Ul8/RXjd+1WrN/SxYyuy/Jb34gUZzfZ9t0FVsLcIJStnR8GimUyZ6gLQUgahe+PsM4eP6gFQKymwcFzxKfTsikU4wcHNmsHEh+MDSALYH2HCSoRwOJ98+pHU= 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:(13230022)(4636009)(376002)(136003)(39860400002)(396003)(346002)(451199015)(36840700001)(40470700004)(46966006)(2906002)(186003)(2616005)(47076005)(83380400001)(36756003)(8936002)(70586007)(41300700001)(4326008)(86362001)(40460700003)(40480700001)(6666004)(82310400005)(356005)(82740400003)(81166007)(426003)(336012)(110136005)(4744005)(26005)(36860700001)(70206006)(5660300002)(478600001)(316002)(54906003)(1076003)(8676002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 06:21:05.6806 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 15489511-f286-40d4-40e9-08daab50c761 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: BN8NAM11FT057.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6446 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 Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/spi/spi-zynqmp-qspi.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/spi/spi-zynqmp-qspi.yaml b/Documentation/devicetree/bindings/spi/spi-zynqmp-qspi.yaml index fafde1c06be6..5ed651084896 100644 --- a/Documentation/devicetree/bindings/spi/spi-zynqmp-qspi.yaml +++ b/Documentation/devicetree/bindings/spi/spi-zynqmp-qspi.yaml @@ -14,7 +14,9 @@ allOf: properties: compatible: - const: xlnx,zynqmp-qspi-1.0 + enum: + - xlnx,versal-qspi-1.0 + - xlnx,zynqmp-qspi-1.0 reg: maxItems: 2 From patchwork Tue Oct 11 06:20:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mahapatra, Amit Kumar" X-Patchwork-Id: 614722 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 B647AC43219 for ; Tue, 11 Oct 2022 06:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229880AbiJKGVm (ORCPT ); Tue, 11 Oct 2022 02:21:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229821AbiJKGV1 (ORCPT ); Tue, 11 Oct 2022 02:21:27 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2072.outbound.protection.outlook.com [40.107.244.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EC4F88DE3; Mon, 10 Oct 2022 23:21:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IqAp2uoH//XXVdJ9siCUIEq0ig4/LG8CqqIJG9th6WGucBfF8t5zpbHgPNJJMkbTiSN/HnfgwoDZtUCTg35rlC4QcVUQFMkHKspPbGiOzQCykZeMs3EDBvau2x1b1AZFaX+xm1Vh9VBjTdGrqwixn2noPRyWm07vOpR6/PLgvD6+KunHgXGDxGmmTsh9k1Ic8Di+RPqtAgg2Tru7JeD3wzZWJAoy0D35lq7EnW/sItJeUWf1XYLro+th8Z1rlVVagSyjPwNXm/Uh6qxpqUqgXaLz0enc/nUinZq6K0m4ZpNyOcUMM4c9Oe1W6yBFl7hpk4o9xCtMp9hQ3MWdKKF1Mg== 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=kcfZQjDxX4XdkBG74CPK2inNidp7/XDLVonjtd7Wed8=; b=CBIsNBDMFSCjRzumeE6J6xkdxR1vUmyBh2pmsgeXIF56cLv5aacm/MjCD08e1moXWk9W2kmnQNMdowDu6D1bnm96P1J1dUp0ReKObGcEMv+pOHKR6y/5U/496ISYFKAReLgXa53+++uLL4nvs7VGdzR0v0HnQBqHo8k973H+WxZASYLeTC/bn3KOAVJekTXeQ/JfPaDGGR7RnyzfWmq3XVYjWaZ1YyiNrpHDiRgtn90D+eUBqOMpocaN8feERSc+4VEFuOEkdK+A0Svwi2UD4LU2WyYfLSr94qZhIFM8PJ77H74mIgsBwOyub1BWSJ282Z+RiazpqSOifj9yK0ghtA== 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 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=kcfZQjDxX4XdkBG74CPK2inNidp7/XDLVonjtd7Wed8=; b=t6jTlhR8Ltbe8aLGcvtBQWBoq2FIyfE4BV3Qjo7epjzDNZfAPez8Yi0TnO3S3sSkmuUjbmwn+WOsvWfKTjHPp32RvOGcjaCpuarrNsrFlWHJ22SeBrfKndXIVl237sJbz8esv2qBZ87mHQ5XE95U3ZrhHZk1PiVKzrbKIgNp0Qg= Received: from BN0PR04CA0006.namprd04.prod.outlook.com (2603:10b6:408:ee::11) by CY8PR12MB7147.namprd12.prod.outlook.com (2603:10b6:930:5d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.19; Tue, 11 Oct 2022 06:21:08 +0000 Received: from BN8NAM11FT012.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ee:cafe::d2) by BN0PR04CA0006.outlook.office365.com (2603:10b6:408:ee::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.21 via Frontend Transport; Tue, 11 Oct 2022 06:21:08 +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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT012.mail.protection.outlook.com (10.13.177.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5709.10 via Frontend Transport; Tue, 11 Oct 2022 06:21:08 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Tue, 11 Oct 2022 01:21:08 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 10 Oct 2022 23:21:07 -0700 Received: from xhdlakshmis40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Tue, 11 Oct 2022 01:21:04 -0500 From: Amit Kumar Mahapatra To: , , CC: , , , , , , Amit Kumar Mahapatra , Naga Sureshkumar Relli Subject: [PATCH v4 7/7] spi: spi-zynqmp-gqspi: Add tap delay support for GQSPI controller on Versal platform Date: Tue, 11 Oct 2022 11:50:40 +0530 Message-ID: <20221011062040.12116-8-amit.kumar-mahapatra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221011062040.12116-1-amit.kumar-mahapatra@amd.com> References: <20221011062040.12116-1-amit.kumar-mahapatra@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT012:EE_|CY8PR12MB7147:EE_ X-MS-Office365-Filtering-Correlation-Id: faf42eb4-fb4e-40a3-f314-08daab50c902 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XNyFPn2AE7xsgrG8P2Ljlpyyc21rDOQ4afTWs6SgHXghntBBeHP0s9FFyHI2NUAr+D3sx3QzIFW/ZMqnT9wIRAIo9p+VX+yZC0z7HsRyxNi8/6K4BeU894Qr1ur4y7IMrYwUUQyoRveLjhC0JPZ/9+rTiE5DEDrVZmf83EzfUS6bzSMFhsTCjrmPXahcwFWbyrU9GGkCE014k/ke5Hf2vfyWg4zcSCWAbocQoOLuXItOIXNcM08fbxUd4qRzbSVutETZWWREHu3uD1+imXL7QOc4nqsFmotfpFnipEKnAPoblU0+valaQ2f8KwDDmFv2WPD9aNwoxQouBG9frUiwxfsgBCXvifqj09ZYQ5KWgxxZO8VO7RACCmlJg7UWCL3blG7ZIG/dRs+L3YEjm1gl6XA/IhBFaYlRRwwshV0VyZ/cBVXxP3Ml8X58tinXGQgr1W4jXUnCBnCd6EblV8BgDuwgx+7wyVwwNHGtktoWuf5t/4onReUwRc2X3xTaZS+4nIuDvhK9bIx+CqrttRyhc+/6eZPGu/ISg7c8KMdrlpuBPvxCRKj+5CR9aRq5ilQdtKI7V1vqC89iAUNU0yuuJMGKJvw1tolKk6JvvfK0PHB8JhOFU7anJFCWMUsPwwCDerS40hKYrrTUoqqrb0k+fKXkfQyUPb6wPZG6eZavlBmlsc9OH99t3waZEDUb5QHbbNRuht9IQS5wiGd/bJf25hyob3/l5NkJalDoYh/iYlqV6lAWp8rTuyO3CsAxMKe1YharCMe5V2cUVwk90jt1w3fLHcfq3kJRG1SB1lLOvYzTKTRVNzmuDBn770j0DsMY X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(346002)(39860400002)(136003)(396003)(376002)(451199015)(46966006)(40470700004)(36840700001)(82310400005)(47076005)(4326008)(336012)(426003)(8676002)(70206006)(70586007)(36860700001)(86362001)(110136005)(40460700003)(478600001)(356005)(316002)(107886003)(81166007)(6666004)(54906003)(40480700001)(36756003)(41300700001)(1076003)(186003)(26005)(2906002)(83380400001)(82740400003)(2616005)(5660300002)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2022 06:21:08.4024 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: faf42eb4-fb4e-40a3-f314-08daab50c902 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT012.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7147 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Add 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 | 86 ++++++++++++++++++++++++++-------- 1 file changed, 67 insertions(+), 19 deletions(-) diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c index c11736d96f33..95ff15665d44 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 @@ -141,6 +143,13 @@ #define GQSPI_USE_DATA_DLY_SHIFT 31 #define GQSPI_DATA_DLY_ADJ_VALUE 0x2 #define GQSPI_DATA_DLY_ADJ_SHIFT 28 +#define GQSPI_LPBK_DLY_ADJ_DLY_1 0x1 +#define GQSPI_LPBK_DLY_ADJ_DLY_1_SHIFT 0x3 +#define TAP_DLY_BYPASS_LQSPI_RX_VALUE 0x1 +#define TAP_DLY_BYPASS_LQSPI_RX_SHIFT 0x2 + +/* 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 @@ -150,6 +159,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 @@ -171,6 +188,7 @@ enum mode_type {GQSPI_MODE_IO, GQSPI_MODE_DMA}; * @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; @@ -192,6 +210,7 @@ struct zynqmp_qspi { struct completion data_completion; struct mutex op_lock; u32 speed_hz; + bool has_tapdelay; }; /** @@ -271,25 +290,44 @@ 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); @@ -1156,6 +1194,16 @@ 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, }; @@ -1176,6 +1224,7 @@ static int zynqmp_qspi_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; u32 num_cs; + const struct qspi_platform_data *p_data; ctlr = spi_alloc_master(&pdev->dev, sizeof(*xqspi)); if (!ctlr) @@ -1186,6 +1235,10 @@ static int zynqmp_qspi_probe(struct platform_device *pdev) xqspi->ctlr = ctlr; platform_set_drvdata(pdev, xqspi); + p_data = of_device_get_match_data(&pdev->dev); + 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); @@ -1324,11 +1377,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 = {