From patchwork Mon Sep 26 06:33:21 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: 12988261 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 E5A19C6FA82 for ; Mon, 26 Sep 2022 06:34:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233680AbiIZGef (ORCPT ); Mon, 26 Sep 2022 02:34:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233584AbiIZGe1 (ORCPT ); Mon, 26 Sep 2022 02:34:27 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2052.outbound.protection.outlook.com [40.107.94.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05CA032D82; Sun, 25 Sep 2022 23:34:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lAoZDk93e4f+dy5KzIZ7DlPlATNBLIdxT04ZfjmOzokvaxqg2WIySfmn1gn8SUoXj+0zObPE/h7MQxHTAoq5SWXh/S2/Oa9HC7d7H9VMzOxzZDbuE8m1lHSdOMIl7C0cqdjhvVkoNwA29CU1n7+V+cxpG9gpdiDvNBPum47O/FLjeQzNeIyvxSEqvMv5EpBw8ecwdBbIocycOTg1ut+ADdXqLxiG63JojpAFBx5/AAgVwKH2CVINNphmvK71wIxDYX/Y5mRNb+T6UJt94Ly6uuN1gdu+x7Sci3K2XCwDSB05xc00fp4TXVPEwG3tFlCGAu72jotrBqmH/iqE5Qu8CA== 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=tTVvvZzu8JCMGsL/wzE9d/zHikByTOy/N+nAeETMTpU=; b=lI7K9bqW3SHQzW5Df17vuiKpFkPy4T1zv5obuPUddf24khkmeG+RUNbW8X8dxhnnkxyBzRvfIi7x2C94PXB1RGYys2NOGrfbv722XQsugP///0F7jOO1ChiDqxeKcWylwRfngnLACS9l94O8JenvOEk2jfsCeU3HP/4GAdSkSXaApakd49uVNMoftBV6bjagOal4YcD6MWIkKph8YPtmeWXvnmMxAUcd9bVK0oDME6GILxHjP0QY5Kwe2BjrVYAEAqyOWwcJOj8OMeu3m54eYWx9uJGAY+wj8yQY28yrrcz5M8eEgL5B3g1AlvBtJOMhtR+ath8A1XoBv3sEIXlSTA== 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=tTVvvZzu8JCMGsL/wzE9d/zHikByTOy/N+nAeETMTpU=; b=jZ+6mGPKqrygj26D56AKO3jig3x+PbbF9g3AzxWUgz0U788TE88S2BSGR/Zzd2aHS70Kik/urjF9zUusO2KYZrvU5rjOQiG4mC6MrE89e3EBb683zvw1zl0U6Ek01NA/DYpEDBuLbhhFrlPCUclZ5pBpKD5x8pPgyMEuQ4mczd0= Received: from SN7P222CA0003.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:124::21) by SJ0PR02MB8609.namprd02.prod.outlook.com (2603:10b6:a03:3e4::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.19; Mon, 26 Sep 2022 06:34:04 +0000 Received: from SN1NAM02FT0023.eop-nam02.prod.protection.outlook.com (2603:10b6:806:124:cafe::2f) by SN7P222CA0003.outlook.office365.com (2603:10b6:806:124::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17 via Frontend Transport; Mon, 26 Sep 2022 06:34:04 +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 SN1NAM02FT0023.mail.protection.outlook.com (10.97.4.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5654.14 via Frontend Transport; Mon, 26 Sep 2022 06:34:04 +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.9; Sun, 25 Sep 2022 23:33:36 -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.9 via Frontend Transport; Sun, 25 Sep 2022 23:33:36 -0700 Envelope-to: broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, akumarma@amd.com, git@amd.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, amit.kumar-mahapatra@amd.com, michal.simek@amd.com Received: from [10.140.6.18] (port=46254 helo=xhdlakshmis40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1ochgO-000GAg-5p; Sun, 25 Sep 2022 23:33:36 -0700 From: Amit Kumar Mahapatra To: , , CC: , , , , , , , , Amit Kumar Mahapatra , Michal Simek Subject: [RESEND PATCH v3 1/7] spi: spi-zynqmp-gqspi: Fix kernel-doc warnings Date: Mon, 26 Sep 2022 12:03:21 +0530 Message-ID: <20220926063327.20753-2-amit.kumar-mahapatra@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220926063327.20753-1-amit.kumar-mahapatra@xilinx.com> References: <20220926063327.20753-1-amit.kumar-mahapatra@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1NAM02FT0023:EE_|SJ0PR02MB8609:EE_ X-MS-Office365-Filtering-Correlation-Id: 9fe9c12b-6810-4a0a-561c-08da9f891b51 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: 3kJcs2PjxtxNOAECylCIk3xALlTeCO4+q44b8pJ1zcj0GfXZTTgmZxX2r3oGuFGULMP+09zho6hE1FMU2BE7a/m/eUdhua9YgPRJB6OTI7CJH+xwG7beNQsKPFd2lmPqKtTXH6yagiGot3PLzkvtjrJpq+DK7K5Cv34/enjWZw6A/lIOnvwsAqdbxKfDJCirVvlqj0E8ZcdOlwvojKuYjap/uOZlIl/+a9f+FXRyKx3ZCVV1gOE4btAnNVBy0cGEj5kmvt6IACk9GdL5K2Kjl2wTXSAId5enjVpWLgkaEACfMXox6/P16kwL89caeMwdcuxU3WfkvHOUqHm77HHRtl1xoTUihZY3YVUFtOgPAHe6/Wumox5unXyck3UghO8MZYdEmBVf3Wy8xVaebWqyfy/2WgiqUrOrpgocBn/Ngu3G/cjmbLRZ0h4BB+T86N9LDXnLKwps8+Q8rhZLZgsGNfPN4JswUUuXt5DWWXI52Ntuy9FlbWHaWzGaaEH61lFk+48h1e6b+ESB+25Vll6qXbQLwqlm589O9iJAcgW78sjMA8HNRrvlUd9SK6Xl16r0CwL3MKpL7J7I3FBRUpNTqCHUj778I1/7cqyD17TtccanMiZ9eX0gSKusrqfbjjoxgb6Sa/SXHmQjmsPw4T7rYY/FGASVVp89DlzLrd6fmatuSg9bqE5HTuH6IcgAaufFHGD3H5MJvjat+ZT4n+3aS1kimXUGt+wa71gIPPRD9EUi02dLJQWWgNW6/QpGsTDnqfBHA5rJgiXSN2OzqtNi0JczpFfapAP8clYM8tYe6sI= 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:(13230022)(4636009)(136003)(39860400002)(376002)(346002)(396003)(451199015)(40470700004)(36840700001)(46966006)(82740400003)(316002)(2906002)(7416002)(36756003)(41300700001)(70586007)(9786002)(2616005)(26005)(7696005)(1076003)(6666004)(83380400001)(478600001)(40460700003)(40480700001)(426003)(336012)(5660300002)(82310400005)(70206006)(4326008)(186003)(8676002)(356005)(7636003)(47076005)(110136005)(36860700001)(8936002)(54906003)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2022 06:34:04.3060 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9fe9c12b-6810-4a0a-561c-08da9f891b51 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: SN1NAM02FT0023.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR02MB8609 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 Mon Sep 26 06:33:22 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: 12988257 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 0302BC32771 for ; Mon, 26 Sep 2022 06:33:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233071AbiIZGd5 (ORCPT ); Mon, 26 Sep 2022 02:33:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232357AbiIZGd4 (ORCPT ); Mon, 26 Sep 2022 02:33:56 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54A7F31230; Sun, 25 Sep 2022 23:33:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NDM+qS9uPTSJU1eY/O+QSeRI+bB19ohupGYGrnxrV4vqqgUR+qAy34kEaTMDI6uXjYdJoydDN3gJIH4TZ+YWpktcgRaFMd6l7tjrQLRxE1B8YP7i4eyCJUfQgTvwRCAnS//x8+71kyAlf4RHOLBYnuEIYY1GlpoR63J55ZgHDaOtZOoQNeF3lj9optvJ33kPzHpDIKv+B/8nUXZwTiyTrQuvqoZLroDZOhbCDDL1UIO83voDhj2oXWeEXrhf/qy2PBwy2RI4mRojjVHKbSkPupDbBg0AIGBmtdNsKuh0KxivqzCELouavjmYxEmrl+D5WzmC989InJnkjJPkHqKX7A== 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=e0XSmwsYhzBzkLphw6Dkc/Poa9iVIJtLOAXsA3sEI8g=; b=Hi31IwaQxJXx6ZcoYQsfVwcAQIdsVQ1YkrzBQqXKplLoLIDIgJe3bCcz3hRdNGgMOzaYj+HMughanDvT7fGyweqtHw/+PIcc2x1P50Tp3bcLSYR7A7aq5ctxbNFdAfZG77Qokeh1+5u67UUuxQZUj/UTxqJCA+HFGLs/CU1xtFl9qZHy7hryeF5dtEKttoweqtVbB/ftyRnp+zFRg2wx17H5scbpUSaOr3g/WMA9YBW/TZ4cYYvXleN/IqsP8jU2jnusiTpfJFDFWfPpiszHH/UwneuztOto1FI/mpHVYfKbGMOofC/zNe/cmkqQioGYsnbUxAnbj0jcXI8JlNJwtg== 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=e0XSmwsYhzBzkLphw6Dkc/Poa9iVIJtLOAXsA3sEI8g=; b=EE5jq6+CS3OfzmBV4TJDVyhfPLWe67f6ILd8AW3yhJj44kKG9G3Eube7lL1Sz3R2MJdbqVeIhUPVekMzXamNWiDsgL1r4bZekWGzwUK3SMtrOUxs3srqlAabJ4Nsy1VnssHdgbgjU9X9bMVKrAhf7u4e5zwmlKrccIx6xE1k0sE= Received: from SN4PR0501CA0124.namprd05.prod.outlook.com (2603:10b6:803:42::41) by MN2PR02MB7069.namprd02.prod.outlook.com (2603:10b6:208:20e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.24; Mon, 26 Sep 2022 06:33:52 +0000 Received: from SN1NAM02FT0057.eop-nam02.prod.protection.outlook.com (2603:10b6:803:42:cafe::1b) by SN4PR0501CA0124.outlook.office365.com (2603:10b6:803:42::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.9 via Frontend Transport; Mon, 26 Sep 2022 06:33:51 +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 SN1NAM02FT0057.mail.protection.outlook.com (10.97.4.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5654.14 via Frontend Transport; Mon, 26 Sep 2022 06:33:51 +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.2375.24; Sun, 25 Sep 2022 23:33:40 -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.9 via Frontend Transport; Sun, 25 Sep 2022 23:33:39 -0700 Envelope-to: broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, akumarma@amd.com, git@amd.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, amit.kumar-mahapatra@amd.com Received: from [10.140.6.18] (port=46254 helo=xhdlakshmis40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1ochgR-000GAg-H9; Sun, 25 Sep 2022 23:33:39 -0700 From: Amit Kumar Mahapatra To: , , CC: , , , , , , , , Amit Kumar Mahapatra Subject: [RESEND PATCH v3 2/7] spi: spi-zynqmp-gqspi: Set CPOL and CPHA during hardware init Date: Mon, 26 Sep 2022 12:03:22 +0530 Message-ID: <20220926063327.20753-3-amit.kumar-mahapatra@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220926063327.20753-1-amit.kumar-mahapatra@xilinx.com> References: <20220926063327.20753-1-amit.kumar-mahapatra@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1NAM02FT0057:EE_|MN2PR02MB7069:EE_ X-MS-Office365-Filtering-Correlation-Id: d7ccbe5d-489b-40e9-65c5-08da9f8913be 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: CqG5rXyDTKUfmBed0V1SCpUEtjq7+9NzmlBxVR5PU1/fT77o0m03uh9xlqkKNZRLVz5zSN9nPzfPgBaYWvUbbkTl6zbC4oxuRkohFQiSp0yuK1/rn1FdOpZS2vGsq9VDLRChtFUWQ5t01xgWpQYAjRGFuWimcWPdJBPOu9eA2+BZeruT+HBIaQFxKktijRuGZ715YOqONHtUKXtffH7LzMd4LJKxeGqKg8iwXnrYNoZiH3nErPcpaIkif44M3f3QRFbI4eyHtltZtEeta0ax5KOO+n55bFjbIJIiwuEoq9BSTpo2PliwJG9Fbe7SgAz+dyDWF1WyGZQZoTZ38xr583U/RBJGl8aoyUCDaL+4ITOnNLRqGROjPSyNn0hnG4Iw3f9WarX7BfouRMVLCxeErevmQ3UEmqpcZ+GtQnAK2dw/wmjxePmXeDgUnoUY8kURS0TaXi2gKc2fVBzmn3tEMBGYFGfeAiJByX554EeaZAGmQTGtKAXCyzCAiv9dmAy4XmrqmGSIIeH36lQIGS8BaM6soY3H2UY5PC1T5OkzOyRUOIsFxnxMV6qUCBXj5RFYFbncPHwsqtSkDncKF4rD4k9lJWlsT+tOaUZMWrOoELzgzqKdp2qOYvScuZv5naxwURd23Kw1nrxHKjZK2MMR8gQ66mqZ3dUXpHefSy9PbdWIBrvTwLMY9am0pVQ95hOQzn4LIwBToKSHo6I819ZJ0S6nYDWMVDT7rvCJgqqTd9QSBLNTUv5qhYtVuawnjoMVVD5/ATwUV+enh6BRvnWSjQ8sepcPVVZpVGLSVZ6oscA= 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:(13230022)(4636009)(39860400002)(346002)(136003)(396003)(376002)(451199015)(36840700001)(46966006)(40470700004)(36860700001)(83380400001)(8676002)(4326008)(70206006)(5660300002)(70586007)(7696005)(9786002)(8936002)(7416002)(47076005)(426003)(7636003)(336012)(54906003)(110136005)(186003)(1076003)(356005)(316002)(478600001)(2616005)(82310400005)(36756003)(2906002)(40460700003)(41300700001)(26005)(82740400003)(6666004)(107886003)(40480700001)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2022 06:33:51.5989 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d7ccbe5d-489b-40e9-65c5-08da9f8913be 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: SN1NAM02FT0057.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR02MB7069 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 Mon Sep 26 06:33:23 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: 12988258 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 084CCC07E9D for ; Mon, 26 Sep 2022 06:34:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233372AbiIZGd6 (ORCPT ); Mon, 26 Sep 2022 02:33:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233074AbiIZGd5 (ORCPT ); Mon, 26 Sep 2022 02:33:57 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2078.outbound.protection.outlook.com [40.107.101.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 761D8326CB; Sun, 25 Sep 2022 23:33:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CxUtNaQDXl7XcjPPZJxzdF+9/AVsUf5OrGda8B7DN2rfeOWQXG41aUmAw9TMc93ImEiXsG6E3aqBOwfVCmZf1GnNidfXF7Ym+zQjBtOPbyNTsjG19lprF0E5/SzVqURvTSgo/G7Ym0+Ll/htSD/yLk+MoX9jf7wr1Ynf9pQOTGgbxQ25bpjzkApUif6KHRG9Lgq4H0NSL03tG4YaqY7pXZGJbpcU4viWuC9SQaX4QkagT3ay+KIT5bn66fLN0siswS4tY900I0NVQHukGVIKkMxxmpL3QqrU8VOH/Xzxq1OdxfQmC081v0wnYIFc4pm+hX0ufXrHq/WmS/4vJiFFDA== 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=n62TMUhbtw7CZp6V4FfxOA4/3OrlBP2cy/grjGanfkM=; b=gpxD8EwhcaUSRn8D9mPRaFFYPpy+j/JP2pac08v4Fn316xxQ7OeHWWE0LKlUGBICFmZZ6p3Xb9LavX/+2q/liKUb2UDSmnK0Orn8KrRmleTDyrO0o9GRcvnNpG6JtMWTZVm9JKg3alt/THsJWQRBfHf9B+yBDtBEls1iI/Bea8ubgKHragFEH+aTSa3ZVcyIXfrdof6FfyonI+N83vEPGDqo5VFsO4gwr/xw/+Juvfp5b2zbhgAYmhz6J2pmICVJh4tHISu9jm0dt3IdMH4NW1uQ5DS2o63yax6G5cD///gOeE10UH18a4qZu4ARrvh7zYG4g+VToiTaz4HKrnmElA== 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=n62TMUhbtw7CZp6V4FfxOA4/3OrlBP2cy/grjGanfkM=; b=NjnDahIZRWjKR4MeT6FV43A+bsl6/L96UNoFdOw0y5trLrP6ipMU4X45lQ419E7U8nLiJ23RlgdpdO/5qd3o0Drt8KgPVl5EZ4ua/YNIEcZsvindRJepnKL0Mvdu81p1p9o/EiwlvLdx1rgPREratiKcwNLObzCKUw/BwL8Bkis= Received: from SN4PR0501CA0130.namprd05.prod.outlook.com (2603:10b6:803:42::47) by CH0PR02MB8027.namprd02.prod.outlook.com (2603:10b6:610:108::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.25; Mon, 26 Sep 2022 06:33:52 +0000 Received: from SN1NAM02FT0057.eop-nam02.prod.protection.outlook.com (2603:10b6:803:42:cafe::7f) by SN4PR0501CA0130.outlook.office365.com (2603:10b6:803:42::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.9 via Frontend Transport; Mon, 26 Sep 2022 06:33:52 +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 SN1NAM02FT0057.mail.protection.outlook.com (10.97.4.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5654.14 via Frontend Transport; Mon, 26 Sep 2022 06:33:52 +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.2375.24; Sun, 25 Sep 2022 23:33:43 -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.9 via Frontend Transport; Sun, 25 Sep 2022 23:33:43 -0700 Envelope-to: broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, akumarma@amd.com, git@amd.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, amit.kumar-mahapatra@amd.com Received: from [10.140.6.18] (port=46254 helo=xhdlakshmis40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1ochgU-000GAg-SU; Sun, 25 Sep 2022 23:33:43 -0700 From: Amit Kumar Mahapatra To: , , CC: , , , , , , , , Amit Kumar Mahapatra Subject: [RESEND PATCH v3 3/7] spi: spi-zynqmp-gqspi: Avoid setting baud rate multiple times for same SPI frequency Date: Mon, 26 Sep 2022 12:03:23 +0530 Message-ID: <20220926063327.20753-4-amit.kumar-mahapatra@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220926063327.20753-1-amit.kumar-mahapatra@xilinx.com> References: <20220926063327.20753-1-amit.kumar-mahapatra@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1NAM02FT0057:EE_|CH0PR02MB8027:EE_ X-MS-Office365-Filtering-Correlation-Id: 4dbb073a-80ee-41e8-fb75-08da9f891437 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: gJ0GUJ+3hL8UBZBzNVgT2yDNJr3lHInv5efjkkDTnosY5G9OZhtC5Aav21gysdTaD/m+7HxmVs4mzWNvt0pBzZtw5PugRXP3pyXW81NZvyWOo5nw2PjQbDHWPvwT/OzH5fg6p4MaHGALybLKDSSgDChdtQuQne5RHz+kkspDu9H6gffst3JT99GcMaV9gkalu61jkqtLQWw/Lv0D3X2l6l2YJR/mIY9SZxZC6fNGdGZK2y6/A5KWkfR56q0RQi2ccr42ajuK4tfHDDSPn8RHgvOEMmT2W3fBKcG3bwUhpeNySgGH7sEpXyDVpmms9ePtOsuy1yuO3X/oCxw/5ei5KUo/g3pYsFxZEBOQqZhh2EYMwXXmjh0SFcaOA5jhiW6Ryn5H/oiI7LAyTyBFiSwdwiFzrl1Ur0C46Xc+pPPGb6vGjaLbz66SchvE0kRpnElOGn7bLXICyKsk5LN2oJM6SnRjyvkbGMWOMxM38Yc5Jm2GJK3iPgla0aPOuzRAuZDTouu20gwWWeSHKE1K1Ms6ExeQe2aBxezWok2KNmqqCIdlq39PucZJmrhzpUFeOFaxU5fR3a4Rec3Qr2Pf0pZFZM9K8+RuYAov2qwyrvUHCSaEaqx/K0FXGS3fsaybmX9ACYpeBnPr3vLM+3Fr6gYxXNi93mOXXFmLUZs14Exc9JvPL3Epw0ziK1BY5870WIjwJ/HvEm7ibk6lxJZThE8e7+6gamhGvp1VEajlwWTsAFHcq2eOx+aumCbZpKp/JTdJ+NVL89MG8IRABxo8066YHa7AsV2VH/JEY3aLFpKOx78= 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:(13230022)(4636009)(376002)(346002)(136003)(396003)(39860400002)(451199015)(46966006)(40470700004)(36840700001)(478600001)(36756003)(83380400001)(36860700001)(47076005)(356005)(82740400003)(336012)(426003)(2616005)(1076003)(186003)(5660300002)(7636003)(6666004)(7416002)(7696005)(26005)(41300700001)(40460700003)(110136005)(8936002)(316002)(107886003)(54906003)(40480700001)(8676002)(4326008)(70206006)(70586007)(9786002)(2906002)(82310400005)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2022 06:33:52.3958 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4dbb073a-80ee-41e8-fb75-08da9f891437 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: SN1NAM02FT0057.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR02MB8027 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 Mon Sep 26 06:33:24 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: 12988259 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 E1C0EC07E9D for ; Mon, 26 Sep 2022 06:34:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233507AbiIZGeD (ORCPT ); Mon, 26 Sep 2022 02:34:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233463AbiIZGeA (ORCPT ); Mon, 26 Sep 2022 02:34:00 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2042.outbound.protection.outlook.com [40.107.94.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 097B6326FD; Sun, 25 Sep 2022 23:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OXVPMVbARrsR9xqfJaPSMlyV79lkPrAnxwZFP2M2M5X3K0Hxs0Ai+HcXsY1MtcH7TFiE4xM3+7ZsSaPM0EhF57f5t4owqLBfDGp06+m0MHWKQg3TNTIXojdI6UqPukfrFp6Ygi9Netl9n3kiQCNjbVERq4qPzHHmEIKCfIDfW809W55QNpoVRM03nor9gFUhM2QqmK/WucdRrIhhWuKheEmC2gSPbbaAyCfXVesku6tOjGBS+ek0843F0yOOyxE1eOR+ZVT17n9ngZMg4Ux2mN01X18IfXMt6Z1cCh2j5L1SQfhTSoBhJWQg8iL01TeoC+swms25E8vU0nMkGZcW/Q== 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=IAtzvWg+6CXBl8PBikL3Su6pEExcj4paQx7JXJoUAbk=; b=Ced0U4HbEXu7KN+dlRkzeSmQlPn2wFpsvdHF6YjJwR4vpsGeLG2BCnpcn1iWkFoAk3AxT3ld1Sw2RQISopqRNPQw+uWrAy3Do/J1oAi8oFAqPIzk+fXwP6gzk944zckpmV6qspPigXMFAh9cRPdvU2mBzLJmlpX8GYiHy6Lu2/00KNvKOE6tld58u6F5xucKu8u0SKsb4qhoRNRqFw5h+p3b/0byYGh74GOTv1WOGn8pTZDIyomocF5mGs0s8sC3Pp8O7ZvllNLAhH8/endoi5dFLuFUdxIJyJ20/x+mr5/WS25HCfDaJgoMrVl1peRISgUn0rUqcl8VJwhBa89JJQ== 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=IAtzvWg+6CXBl8PBikL3Su6pEExcj4paQx7JXJoUAbk=; b=pZT3+akPIP3ccyD+DH4VprppjUlUHaK1i5Sw0kXiNR9dt6TYG5B5+4L+43FcU+SHXNrJLC1s2X0aPLPGQQwjU0eY2Pfgzl4BYqo2WWFnTLgh6cfTmqU2fEYjVpveSJ17jlCLgC7x40xjLZRISAkvWM+5xf1jyB5/SjeEJyMHpNM= Received: from SN4PR0501CA0106.namprd05.prod.outlook.com (2603:10b6:803:42::23) by SA1PR02MB8351.namprd02.prod.outlook.com (2603:10b6:806:1e6::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.25; Mon, 26 Sep 2022 06:33:57 +0000 Received: from SN1NAM02FT0057.eop-nam02.prod.protection.outlook.com (2603:10b6:803:42:cafe::a5) by SN4PR0501CA0106.outlook.office365.com (2603:10b6:803:42::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.8 via Frontend Transport; Mon, 26 Sep 2022 06:33:56 +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 SN1NAM02FT0057.mail.protection.outlook.com (10.97.4.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5654.14 via Frontend Transport; Mon, 26 Sep 2022 06:33:56 +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.2375.24; Sun, 25 Sep 2022 23:33:47 -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.9 via Frontend Transport; Sun, 25 Sep 2022 23:33:47 -0700 Envelope-to: broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, akumarma@amd.com, git@amd.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, amit.kumar-mahapatra@amd.com, michal.simek@amd.com Received: from [10.140.6.18] (port=46254 helo=xhdlakshmis40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1ochgY-000GAg-Kz; Sun, 25 Sep 2022 23:33:47 -0700 From: Amit Kumar Mahapatra To: , , CC: , , , , , , , , Rajan Vaja , Michal Simek , Amit Kumar Mahapatra Subject: [RESEND PATCH v3 4/7] firmware: xilinx: Add qspi firmware interface Date: Mon, 26 Sep 2022 12:03:24 +0530 Message-ID: <20220926063327.20753-5-amit.kumar-mahapatra@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220926063327.20753-1-amit.kumar-mahapatra@xilinx.com> References: <20220926063327.20753-1-amit.kumar-mahapatra@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1NAM02FT0057:EE_|SA1PR02MB8351:EE_ X-MS-Office365-Filtering-Correlation-Id: 7a9da39a-7101-4cee-6d2a-08da9f8916df 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: oyfPVR1gl+VXWwLB//zJpyJju+QU/PtV5lZQB06u0OHFkWUdkvqV49Fdh0CbyjTXujfKHUtwM+biEhUbJ1dc/GGZt7+ZI/KOw6J7MAQKk/DVYJnJHrC3WGMjauvQliYEUXBj5Fpt33kMxDJaDcK3e3iR0766qxtpX5yuienwU/3VzWNZWkTVMWh84p6ywZXBvkqTRX5yJMBqZ9BeZ8eW5CCJxYJW3BH4hGfffSeA0GPNRRgnUIbmkJMxD1h3rdNYBxZ2RmWIO5dGNfkSw8taA9Vw76mkqdOnv1avsZDThFc2A/qFNvTa6yAzS10oUk3PqPp8Qn8fHzBrF2QWtZfC0GZU49qsxIoeR5SK/I8vqbULFP9ee5WJyJAV0d7k5qDwQwNiRdJlgHcDXjw+cjZTuc72jQy6HZGWLirVvhw+lxv9YwaQWB7qWsx9/CDn56o8t7Ps7XegJ/Z6qF4+LgMgfFTA8BQie2i6TxxT+aa92zEpenASqB5RQ/DypMwrCPOR6mzgswg6CBPxoVKXKW1WOLE1kR8ASFylVCKmmlPfDHFSVtowryvpnBsSMt+h64yF1YTNW69IFX45oexw/csAWh7iZQIn/akAGH0syMlXMqYKwrSTL4zTpgqKATFsU1XZyiBQ4jFMbBnSP0FJOsOWLSUU+9av9OPTor5yeFdX1v7i8Gw5opqjg+lW4/fULsmv66Xyq7iLusBbXbWBnBrO73pJprmQFu85Qdb3fwIybHQkZV6Hs2aY4WsZXhm4pBOgDoWifzfOv82toM2gV9SU7pUTjT1jeJcIp4KaGR3pNio= 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:(13230022)(4636009)(346002)(376002)(136003)(396003)(39860400002)(451199015)(36840700001)(46966006)(40470700004)(82310400005)(7416002)(5660300002)(41300700001)(2906002)(36756003)(8936002)(9786002)(356005)(7636003)(36860700001)(70586007)(110136005)(4326008)(70206006)(40480700001)(8676002)(54906003)(478600001)(316002)(47076005)(186003)(336012)(107886003)(1076003)(82740400003)(2616005)(426003)(6666004)(7696005)(83380400001)(26005)(40460700003)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2022 06:33:56.8329 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7a9da39a-7101-4cee-6d2a-08da9f8916df 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: SN1NAM02FT0057.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR02MB8351 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 Mon Sep 26 06:33: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: 12988260 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 D8875C07E9D for ; Mon, 26 Sep 2022 06:34:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233661AbiIZGee (ORCPT ); Mon, 26 Sep 2022 02:34:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233552AbiIZGe1 (ORCPT ); Mon, 26 Sep 2022 02:34:27 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2061.outbound.protection.outlook.com [40.107.93.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E837932BB8; Sun, 25 Sep 2022 23:34:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F1u0TH1wzWrElu9M0oO6EQDhFmL1YRJiWRGURldhQrAVRl++5wPc1FU6B5hdRv84feD9uuBB4WAV/RBMBCeDiCuayprkou1SPzw2DZh2zQlkv3+LMKMEw4I9E89eZzZ3oAtsQg0P0dCvZ4GgVBNfIAVX4QhvN/EpRyO79DmlhIUJUAjpw6CahUdMWguzQwQsSu6Cs1KlKcpBMd5C3uGYU3tXiGukcJ5Gt4gH5yBIsHFYPBLBacUs0LThiuZoQRHZlmcujT5RQ3AbykoDPq5D4jtYTYfnK7tUQ5U8XzyOGaHWZpZ0BDe75Yq20B1jOdEFwImyvUoenyWIJBXT5IsZig== 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=m00rNN/YwIzivhjuanyITfAsQ4WuBb+pG1kK9IBNtpo=; b=KGxLZeihofi/cd6AqtReQ8U7IL5ebe/fYeptefSrxSUAoev1QdPBGCQGfh2z9sRPf+rVzkbbOs4W+r9AWYnlVvPFKm01a65nhHdiSZmktT5rlMkIyP4Hl3K3pDngXpo1d1rxlXA30e7NCCDatk8jARILxk6cjoGZVFWhEMYPpdPmMo6fpPJh1I7fs6ysToD2EBGLYAfAro2mp+ZO16m+IJ4B5d/1QWCnkyvsU2bBf+k+gtOitD0CGDlOtpSTqtaFDsKKsZ2fPaqjRvvl2/oAII+9v60RCrwQQoRW5JKKPlUPuQAMntLk+cGEoMZRJFnSVoAAAcpG4me/HfYqypPS5w== 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=m00rNN/YwIzivhjuanyITfAsQ4WuBb+pG1kK9IBNtpo=; b=Kn0i93yXZE46gfc9nweN+W5ADAiU7gLj04/7Q8/bVL4YVHt8tNiQiEL99lvmUgehA8ZWZB2wflZeRxYIXUp4j3ll21PaxPWPYa1vb5vUGa2G+ryzc4pPQ3vya15iEztN1pzG/C8yNnAcIdOipxSUzKPwnV8rHCmNwHUEdmM/7Y8= Received: from SA1P222CA0049.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:2d0::26) by PH0PR02MB8504.namprd02.prod.outlook.com (2603:10b6:510:105::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.24; Mon, 26 Sep 2022 06:34:06 +0000 Received: from SN1NAM02FT0037.eop-nam02.prod.protection.outlook.com (2603:10b6:806:2d0:cafe::6e) by SA1P222CA0049.outlook.office365.com (2603:10b6:806:2d0::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.21 via Frontend Transport; Mon, 26 Sep 2022 06:34:05 +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 SN1NAM02FT0037.mail.protection.outlook.com (10.97.4.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5654.14 via Frontend Transport; Mon, 26 Sep 2022 06:34:05 +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.2375.24; Sun, 25 Sep 2022 23:33:50 -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.9 via Frontend Transport; Sun, 25 Sep 2022 23:33:50 -0700 Envelope-to: broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, akumarma@amd.com, git@amd.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, amit.kumar-mahapatra@amd.com, michal.simek@amd.com Received: from [10.140.6.18] (port=46254 helo=xhdlakshmis40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1ochgc-000GAg-Du; Sun, 25 Sep 2022 23:33:50 -0700 From: Amit Kumar Mahapatra To: , , CC: , , , , , , , , Naga Sureshkumar Relli , Michal Simek , Amit Kumar Mahapatra Subject: [RESEND PATCH v3 5/7] spi: spi-zynqmp-gqspi: Add tap delay support for ZynqMP GQSPI Controller Date: Mon, 26 Sep 2022 12:03:25 +0530 Message-ID: <20220926063327.20753-6-amit.kumar-mahapatra@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220926063327.20753-1-amit.kumar-mahapatra@xilinx.com> References: <20220926063327.20753-1-amit.kumar-mahapatra@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1NAM02FT0037:EE_|PH0PR02MB8504:EE_ X-MS-Office365-Filtering-Correlation-Id: e84ee22d-0624-4ce5-552a-08da9f891c28 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: PdScvESMjC5tvQuPYJJCasg1m6AP6tIF27fkRGcQiq+jCkXzCZvm3RJ3zqPgDc5TgnLgKmyuboM45eAN5GxezhEBY8ulHr4Pm8O5EZJKvEvfqXADGJXSozlxlzYNudEtBkV03+SFzslrAuudTxUkcP6zMZvQPP0lugPbEyjs4joIeVWT9xA8SDwnewjVGgjva8PHiHmFZ2Czk+p6yIml13tasWjZ+UFFt2bh/Z8JSxAt9rPF+b6N9shlm0mUu65FySgXn/ZGPLI8CDyWECsKAaDyZU3zQW+cZTbV/Lu02DbkjsZ1emchVTpre5tpRcY14+BSde/j+lofw0jv8t6EGrkGocx6VuhV3j4VNs1dpq0oA9Z4UaKJzE6s4ApJ+JEKiWYy8TFNFr2LQIh46eAxlSo+6zSHCzb0xPAAL/PWchyf1RRbgCJ0kF82Fvoc2ux0uf9xqAOVrdaalHWVasY7gntCbWQJqQS8Z+Ih1aYMZqjgc4mXmRawmWpvBrrxtStr0z8eBCU+dedOdO3Q4Qk7zSfeJGG0+PnBko4AF1YQw58vgmoeNlcAd5I7wSLUlOP5GV94ETB8CTnBVxInzhbORLFz2shiK+lIm2yWYYwVO9LQC7M624Rerf02MsmrG6FLpWMsTT8keiMMcEesVjL3C4DDE0miVS7GtJMyz7XAog2UI37Q5igw0iSsltkkZUU9Ddc6IthITy1ZXw76VFqRHi3ixlTwTzgKzsQg7CuuoVfCyBpqLehKpopd/w5MzS0BL/b9a2SYf/ISAWq/gvaGujJyT0tMFICJSU8xEAl3yG0= 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:(13230022)(4636009)(39860400002)(136003)(396003)(346002)(376002)(451199015)(40470700004)(36840700001)(46966006)(1076003)(316002)(8676002)(40480700001)(356005)(4326008)(7636003)(336012)(82740400003)(70206006)(82310400005)(70586007)(186003)(478600001)(426003)(47076005)(26005)(7696005)(107886003)(6666004)(2616005)(36756003)(36860700001)(110136005)(54906003)(83380400001)(5660300002)(7416002)(40460700003)(2906002)(8936002)(41300700001)(9786002)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2022 06:34:05.7150 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e84ee22d-0624-4ce5-552a-08da9f891c28 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: SN1NAM02FT0037.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB8504 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 Mon Sep 26 06:33: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: 12988262 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 25791C07E9D for ; Mon, 26 Sep 2022 06:34:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233716AbiIZGeq (ORCPT ); Mon, 26 Sep 2022 02:34:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233614AbiIZGeb (ORCPT ); Mon, 26 Sep 2022 02:34:31 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2079.outbound.protection.outlook.com [40.107.244.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACEED32AA5; Sun, 25 Sep 2022 23:34:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XUT2LYd++0v6AAs6ia6yLOmSd0rep7o0OdUOKyd6O0gjcDOTLaArMz9fQ2TvVAV5U+lev9nIlR3ORglby6sGidqyEKbK2Z+QK1pPu8RibiZg7MSm87Bm2c62JNCw7E5y0w7/UiCwBzycw6zrZ+errcsaIeCrYNnzkx97eGHHK0YE1uIkbSpRiSQFvvpg5QO8EQ8PsszEdVt1wEK3HQhG59+3j/8xyS1rQNrPuWiLhB4WbSdSMygNoMZoTW0HV2DaqwXO54tlgU1Z28a/XIwGTHZ6aRv0zW147vZKxu9KvfzIzMIODr3qI4l40qHw4g7TEokhFGvpTm6zm+CKcxElJA== 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=nOuA1Bd28TiwObR6fOE205MHSHl7NkFLm06amo8rbi8=; b=BAwY9HQ2qhy7zSFe9Q28HmRgYXHkFz2/WupyXjuxWDYX8f8QjnGkCfpSlz2Y/5+2vm3dacREXTGMu+hFVIOl690/bui3ulh42Klylo+MdYrjcWqnckuL4czI/CuqxwjRhCO1eVDq7dkUs3Zes8AKcrF4KT5IbXInKCkX9Z18thAkZyBMIhT1JgOVdSA6IY/h2jYvgIp9bMDFyjssy5EhllxXpTbEIu5J5dtV2wAz1jK7oobLfsYFLJvlz0NcJLkFakoADPeLH2fdpJAOe3GfDAInbfXn3uy30U/riBg1igSxf2h53m9XalaAwFehliDEjxhpXPLXoPw5aE1oobHnUw== 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=nOuA1Bd28TiwObR6fOE205MHSHl7NkFLm06amo8rbi8=; b=oXFbNhfwgsbV07jDyoDoVmvsr5py4QnPVmpIz4ZOpWNy0jo/6o2UR+HoIf7Mf9bUqU/MlPBURx+G7gecG9n1EV5ma+47mOEB+/oOJeXND4ObYVrx6OwCn5Uw6PufmxqfFfVQEL+iIqB3Jef8Tvl2tFjSDtgmUQ/UoMlNv69syvI= Received: from SA1P222CA0036.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:2d0::21) by CO6PR02MB8819.namprd02.prod.outlook.com (2603:10b6:303:143::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.25; Mon, 26 Sep 2022 06:34:07 +0000 Received: from SN1NAM02FT0037.eop-nam02.prod.protection.outlook.com (2603:10b6:806:2d0:cafe::6a) by SA1P222CA0036.outlook.office365.com (2603:10b6:806:2d0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10 via Frontend Transport; Mon, 26 Sep 2022 06:34:06 +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 SN1NAM02FT0037.mail.protection.outlook.com (10.97.4.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5654.14 via Frontend Transport; Mon, 26 Sep 2022 06:34:06 +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.2375.24; Sun, 25 Sep 2022 23:33:54 -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.9 via Frontend Transport; Sun, 25 Sep 2022 23:33:54 -0700 Envelope-to: broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, akumarma@amd.com, git@amd.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, amit.kumar-mahapatra@amd.com Received: from [10.140.6.18] (port=46254 helo=xhdlakshmis40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1ochgf-000GAg-Q2; Sun, 25 Sep 2022 23:33:54 -0700 From: Amit Kumar Mahapatra To: , , CC: , , , , , , , , Amit Kumar Mahapatra Subject: [RESEND PATCH v3 6/7] dt-bindings: spi: spi-zynqmp-qspi: Add support for Xilinx Versal QSPI Date: Mon, 26 Sep 2022 12:03:26 +0530 Message-ID: <20220926063327.20753-7-amit.kumar-mahapatra@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220926063327.20753-1-amit.kumar-mahapatra@xilinx.com> References: <20220926063327.20753-1-amit.kumar-mahapatra@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1NAM02FT0037:EE_|CO6PR02MB8819:EE_ X-MS-Office365-Filtering-Correlation-Id: a5e0adc3-da58-4088-0fe2-08da9f891cc8 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: P2C1uVYK3TvyQgFfGu/KaUYZAxkNsoGQQ2rpdGIC7vr388BEl1SLU1gGBF+t0mrjjoTEQVeX5jJfemM4V/7eo3Ot3sZ1lkMAyXNXzftvL/GzBO3JUQ50ZiLCv8HMASF0hgY+7iXpfHWJhAQiTdndHgM1kirWX/JGX4E/bNIfFGZSUtrWFvss6lhAj4L/g2x7WZR16/eWfW8wN4u42EsZnoyjhACHdzq8yBeYOKnwkUqKJfRVeEqubeY4EV3opoaYicrP4Zrc4PjkM/rFkCcl2+MT1au3oSj0MsdRmhNZbZo6cBuYI+iE0g/SYFfp9ciMESirx2rvZMR/d4wZo09yuyxjYpomfFm8QWZLofBRfbIyYcolxkHvpekKlxXMtxiq+m0XHOo0SZzcPsG0kEs7XcDTEpdlYQfL8aREZ7Qm8UW32wAPaB48EribwEUMd0irADVr5pfqxAXOQT0WFPfAmCJ+y8gxwUJlIfSf4L/WmaJfy4LLPVmgOfoejkBkqzBO25/tDbZlgAA3cXCWofACKmpN06FpVVeOUweo4yNBlbwFFoLVO1ffIr82Fwd9+xW60MsarsPR40daOfD+CdObb4lC0AeJfCXIt/0gxmtCKOjdxMYf0aJ4M+VIY73USG9/4zS8ScuUJWXRmFvoJzNzk03WSMeIcSf9Q+IL4RBhF4XZ7NxpUMAEqHh0qCjx/fnzB6Vc9dDDrzyG1DWI5W20ZnyVnIcI3UOKJ5JwfW6iH8kThHyVm+0qVdULf6+8PEhI5Eyhq5+pSVAkrw3XYrrvHBHYfLIH9ArafXgqm98+5E4= 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:(13230022)(4636009)(136003)(396003)(376002)(39860400002)(346002)(451199015)(46966006)(40470700004)(36840700001)(8676002)(478600001)(40480700001)(4326008)(70586007)(70206006)(316002)(110136005)(54906003)(36860700001)(356005)(7636003)(82740400003)(2616005)(107886003)(1076003)(426003)(336012)(186003)(26005)(40460700003)(6666004)(7696005)(83380400001)(47076005)(82310400005)(9786002)(36756003)(8936002)(4744005)(7416002)(2906002)(5660300002)(41300700001)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2022 06:34:06.7618 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5e0adc3-da58-4088-0fe2-08da9f891cc8 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: SN1NAM02FT0037.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR02MB8819 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 Mon Sep 26 06:33: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: 12988263 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 3F894C6FA82 for ; Mon, 26 Sep 2022 06:35:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233754AbiIZGfA (ORCPT ); Mon, 26 Sep 2022 02:35:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233630AbiIZGec (ORCPT ); Mon, 26 Sep 2022 02:34:32 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2072.outbound.protection.outlook.com [40.107.223.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1A1732DBA; Sun, 25 Sep 2022 23:34:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dt8ATNqIAYpKbWIt3pP3rRird+KhXiXOWNeApi7ssNmHiDQcgu7xp9BBeZl5nbQGSrWIqw0GOkf1OEfMPUbPfAeNzPzN6kLq9lysv5o2/HzD6N1uut4RxQXbr/hHcu7VzXqiMlB+tMhpjWoYCMfavU3aZIV7GcGGE0eeU6o6DL9aABHly1o4Im1ZKuiGtA0enFHXON3csjauAy6g/o+hfWL7FexBm+zTvSXyi3EtMFrQodiOvv6mTVAK0QhqSlbKJYi7VeM4Pl7ly9IMSkybtwVocdTYsWdkQj90jFsVV/V5Kn83MJ9nRvnSzJmmyZvOFf5SA0eryem20pFuyYreoA== 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=LGqIpgJBImhJ+mHTOMmzHGzkCtd7M31gAbipbXAqlhc=; b=RUCJAcV15rh29pXIHceeq0vNQ411ljdaDUEBzYHJ1Z372RZntYrf7MMVFEX55G2/QMVaPrSD6xlS43rF4kollda4MFsvZdJQamBfEaMfh3KsJ3yFKia6tLdVF3cad2Dba/2f4oLGry+oxaDugJNCqNBaE1m5C6BhxlR8mUAyRl3quZlgDYFSuKVPIS5wfaVKpDahgiXPKKCMpsa5igGrzAuBJZm4jZBqvoFGzrbzkbjbrfQ92R8DBIyigQitNax/sdidVkXFxPtUFLTJd9ZJ2wtsYnw9+UuxzahUbzZifgSs8vrj/qAONlnPvd0fnrWG81/Wmw4294tZ4qu914xWmw== 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=LGqIpgJBImhJ+mHTOMmzHGzkCtd7M31gAbipbXAqlhc=; b=Dc/FVzqGUofJPOioDWRw+VlEh40OTKvHF9b0CaCt8zR/ZUR5nwJN9mfcxEEVBuQdDBJ2TcFddH60+oI7868clpEpUNpsEkDpL2pp25ECI/ViP5/vINUsub6IEECcsARBXcGJrbEiDEe1q9E5Xh/HyX7pm+foGV9fy79Og6UdAkk= Received: from SA1P222CA0036.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:2d0::21) by BY5PR02MB6770.namprd02.prod.outlook.com (2603:10b6:a03:20c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.25; Mon, 26 Sep 2022 06:34:09 +0000 Received: from SN1NAM02FT0037.eop-nam02.prod.protection.outlook.com (2603:10b6:806:2d0:cafe::69) by SA1P222CA0036.outlook.office365.com (2603:10b6:806:2d0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10 via Frontend Transport; Mon, 26 Sep 2022 06:34:09 +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 SN1NAM02FT0037.mail.protection.outlook.com (10.97.4.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5654.14 via Frontend Transport; Mon, 26 Sep 2022 06:34:09 +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.2375.24; Sun, 25 Sep 2022 23:33:58 -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.9 via Frontend Transport; Sun, 25 Sep 2022 23:33:58 -0700 Envelope-to: broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, akumarma@amd.com, git@amd.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, amit.kumar-mahapatra@amd.com, michal.simek@amd.com Received: from [10.140.6.18] (port=46254 helo=xhdlakshmis40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1ochgj-000GAg-IU; Sun, 25 Sep 2022 23:33:57 -0700 From: Amit Kumar Mahapatra To: , , CC: , , , , , , , , Amit Kumar Mahapatra , Naga Sureshkumar Relli , Michal Simek Subject: [RESEND PATCH v3 7/7] spi: spi-zynqmp-gqspi: Add tap delay support for GQSPI controller on Versal platform Date: Mon, 26 Sep 2022 12:03:27 +0530 Message-ID: <20220926063327.20753-8-amit.kumar-mahapatra@xilinx.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220926063327.20753-1-amit.kumar-mahapatra@xilinx.com> References: <20220926063327.20753-1-amit.kumar-mahapatra@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1NAM02FT0037:EE_|BY5PR02MB6770:EE_ X-MS-Office365-Filtering-Correlation-Id: 17795e37-2364-4632-93cd-08da9f891e58 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: BgQ0Z9z5UdTNG/9swnaiVxbzx5v350r30y+nofjZMr6RVt3J5lC8mhRLcp8ZCgtjB4/MKkbuRK8jhN6QiAq5me7CCVy4CsyhbA3rfpe4RO1avsvDzQA4Iwcd8jG706Chw6MmEuVrQbDiAbfTQ6WVWiJlzatJVLcYaXFOI4NkCoWmdBFRDAgSnTo1T4JHpW44wD/v6v5InllP7G4B5fWnQl37haDxTo62b/w2rS3Q5UbqTSbnmrfKpf8K7tD3sYhdv33cIZDDCkLURz+lMgYfMMeBbSi8t4yvD3B/9r2PQmZio6nx4emP224pXeJ5XbCTwRIAh6WZyKZP+a3qbic2VBEeAHmDFx3Vk+Z+tdhEmPbxf0F7KLUdvAcGuP3qCYe98KDD1YW1Oqi3qsiKZ3xM9b4mtzTyV/9M1fGknjuIcWYFtVFeed0tjZiNsyuze7eFm5RTsgYccvOziuLOKEjP98b+6yfwKmRAoeh3/dP1WWDX3ybzbWW0/Ta0zuu9YbU4vtWpxenvx0omZJHrkxOIoh9Rrd7XlzwELWVgARP4e/UwKEQjDZViwi4lh/7s1FBO7peC5RXXCdAfjfSUZ7MeCzdULOmrN8Rn/46YD44ggoNREXbRlNTpCgMaAoDbSdkr5iROkSkL95OQsLbTjPSMUUeKd+SMxgbraWfyAJAjPiUMDYTRYIfiDFoZo2MgxwX7EiEoPZKJ3/UGcx4BArG52B49X2xHevcna0KXXpL7cGBHNOFbk2ucpRkDOKwomYCbPDoxAUTCQzvnQTszW10WmIHEWCd6WRkqUgP9udogBeI= 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:(13230022)(4636009)(346002)(376002)(136003)(396003)(39860400002)(451199015)(36840700001)(40470700004)(46966006)(36756003)(110136005)(54906003)(7636003)(356005)(7416002)(5660300002)(36860700001)(82740400003)(2616005)(47076005)(83380400001)(336012)(186003)(426003)(1076003)(6666004)(26005)(41300700001)(478600001)(4326008)(70206006)(70586007)(316002)(7696005)(8676002)(40480700001)(8936002)(2906002)(9786002)(40460700003)(82310400005)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2022 06:34:09.3866 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 17795e37-2364-4632-93cd-08da9f891e58 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: SN1NAM02FT0037.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB6770 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 = {