From patchwork Fri Sep 24 10:07:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Krishna Potthuri X-Patchwork-Id: 12514955 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2684C433F5 for ; Fri, 24 Sep 2021 10:13:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 86D4B60EE4 for ; Fri, 24 Sep 2021 10:13:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 86D4B60EE4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZlEm/tP8YJi+rh3eky/iSlorSzE4xxSZyIx5XBnXsfc=; b=vfSg2LdUPoN8XF kx2Oh7JdC5CimpXg6azlmSZKo2HWcLmaXCVExBSA7k2JEi13otMQD+fQeCRkSmsZlp+PDCxNqT21p tqUg9wwLtY+1TBPgTPALqFz9C54H7MjP6LNfa9L/8PhubcySmrVtAcZecSQ2gjoeVYZSHH1NZIJno DWFIRHsMNEk0v3lALrMQ4yfxacXSX5FpsjKOZbE1w6h8rOi3O6rZHVPClJMcVt5KXIt5C7nvyI4VS qExuPZZ2BA+3xuUqEVgAi3UlNjxAOtcP+4vF8+GU1cpuOhYo+FlEiJFXmBgBfVPDbeYfIeUR7BQ9U swC8bx3p19lYvBTb4usA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mTiAH-00E3fz-3L; Fri, 24 Sep 2021 10:10:45 +0000 Received: from mail-bn8nam08on2086.outbound.protection.outlook.com ([40.107.100.86] helo=NAM04-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mTi9z-00E3aY-Pm for linux-arm-kernel@lists.infradead.org; Fri, 24 Sep 2021 10:10:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GUUzfH33yX/65KSeElGdZJ+agPNdlyUEwSPdPga2Y2b8HaNjfQ8PviZRNOJc7SFLbIXD2F2svObQJRHHfFgKX5QybvFDlDk8oXF4dJ2NqqpdgLtkSJYSkVbJa7FUdksHHqkSxvMGQzqfDmzLbUfSKthscmKTiZIPAiodLNoS7SbM9NETPfrQQt0/s1FMhdTK+gOpyVn35m4LoV1BRl7T+lFD60JOCLqcSrJKXEg27A4MVMP0z9ESbRy2RseOC7wbfghC6oeFBX45EQ/Yhdqg9DXxD+UpPNOzJ9YuV9HubbkkwkDf1Wf2WFoIcU4tHAIEzgsIrsYCKA9tkem1Ms9xkQ== 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; bh=D0Dkv3uiJ5+JoiZhPqd1e+U3suPX9un9OfR0l27hITg=; b=lCB4PKnU5Ghh6kRsBsOMAExzPUbmWGFMEpKDMj9izMew79j49c6MKXyJ7taHxyjym8Gxm5cwpfm26U7UnjOwztNSsguqIZO7yrR5ItyD+kZUN4Djnn4+eZk7+U+SYx+zsk0NyKq7FRnjsyDdqCCHu5IiIBR1G6+L1hO7fxft5wy/f5K5qkbw61scPXPyNfAwZxlZ1eemGGH4AOZ8FEZc502BrWcnkhqOZUX22lUL5yYje3MKc6JQkEkcdeULRMbF9/m90exkvzGy7daKlqCx/zwXeZojA/O8gc4ScgIZl0i1AJ2913hkm7RbYpSmVdSjmuya8m1EME+hr4gN16LidA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=arndb.de 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=D0Dkv3uiJ5+JoiZhPqd1e+U3suPX9un9OfR0l27hITg=; b=Q5/rwMsMhudSaL8gWGSIbRtXfwxAbTn0U/LN2+chYLmCA201VgHa0fP6RwexlHIU5ar1VRkPawt0Qp4sxXS66BlVuXcVbROl1gC37+VG9xR3FPRgVPzBRwd26Nr9QkpHpgs4gkX9cCkr8INB/aktovM0SA6h1Oqg3th6+n+NEgQ= Received: from BN8PR15CA0056.namprd15.prod.outlook.com (2603:10b6:408:80::33) by CO1PR02MB8427.namprd02.prod.outlook.com (2603:10b6:303:156::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Fri, 24 Sep 2021 10:10:19 +0000 Received: from BN1NAM02FT059.eop-nam02.prod.protection.outlook.com (2603:10b6:408:80:cafe::8c) by BN8PR15CA0056.outlook.office365.com (2603:10b6:408:80::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.15 via Frontend Transport; Fri, 24 Sep 2021 10:10:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; arndb.de; dkim=none (message not signed) header.d=none;arndb.de; 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; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by BN1NAM02FT059.mail.protection.outlook.com (10.13.2.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4544.13 via Frontend Transport; Fri, 24 Sep 2021 10:10:19 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Fri, 24 Sep 2021 03:09:58 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Fri, 24 Sep 2021 03:09:58 -0700 Received: from [172.23.63.68] (port=41314 helo=xhdvnc208.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mTi9U-0003aL-Le; Fri, 24 Sep 2021 03:09:56 -0700 Received: by xhdvnc208.xilinx.com (Postfix, from userid 14964) id 4C05F207C0; Fri, 24 Sep 2021 15:39:16 +0530 (IST) From: Sai Krishna Potthuri To: Mark Brown , Rob Herring , Pratyush Yadav , Michal Simek , "Greg Kroah-Hartman" CC: , , , , , , Arnd Bergmann , Nobuhiro Iwamatsu , Sai Krishna Potthuri Subject: [PATCH 3/4] spi: cadence-quadspi: Add OSPI support for Xilinx Versal SoC Date: Fri, 24 Sep 2021 15:37:10 +0530 Message-ID: <1632478031-12242-4-git-send-email-lakshmi.sai.krishna.potthuri@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1632478031-12242-1-git-send-email-lakshmi.sai.krishna.potthuri@xilinx.com> References: <1632478031-12242-1-git-send-email-lakshmi.sai.krishna.potthuri@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fe9c912b-ec0a-4f47-4149-08d97f438386 X-MS-TrafficTypeDiagnostic: CO1PR02MB8427: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6lZZoGsrxuIcGZwgeCNQYWG8SSZjCQ2/kEGXwaW0lWLLaJogXUwdjjRy9ml5woNzmXSvtMFZrvX4E7fcMqR/+Y4zS4CYxXK/MLibjw0AOAe8J5FdehoLrdgm/jRF/X6F0aabdG8qUOenta7tTwLddfcBju5cKriPP0q5MePETt3iv2iCcfxOZ/q62+FzwyBQVIoC1OYdm9NuzfWc1FyQP0Sa4WzS7U9O+fFww6gKgawU8N2Fz2qk/DRse4m3Al/MYSNuW1gO2v/wD3lj67C/0y2qM/mOv9Ylg8brfjcY2eGik4O1AhSdAHW2tJfWaHM38ARRsqfoYQXH9re2O7GPSrcd1Ncsdqa4otPGMkOLQG8SpsuMDgm3BmshKp+KgYrbhW5nPwRlEQ1xuaONpW7BYOLlCcT9r/4A9MrHmcbK+AOaIQfwpFd3nXICRbmjvKOcwIis9P0VB6ti6h4E+es6er6+eMAKUbYlwMUm0xUpmCsnSBUcNOh3HzaIQUQA2A8WFYYD8FRIybzLS4VUYuni4yfbdRlrO7XGHQoYFpLj7TQwPg2rdi6Dr0qFRb0FRo6/82WvT6R6B2Nb39hOICno1BNMe9AsYttk4IGc/+88Eo0EpaVknMu71QLzSzGysEywSyC5s7p+mrS59UMC+VTBqTjP7KXp/HpRvXpaP7BpYpi6zGJCuGtIylT9gNcyKoJ/zVUe9kJ8lY3Fauke/M70WUShDDcLfFHPciKDrQg+pyQ= 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:(4636009)(36840700001)(46966006)(8676002)(70206006)(42186006)(6666004)(83380400001)(7636003)(356005)(110136005)(70586007)(54906003)(508600001)(4326008)(8936002)(316002)(36906005)(7416002)(5660300002)(47076005)(2616005)(6266002)(426003)(107886003)(2906002)(336012)(36756003)(82310400003)(36860700001)(26005)(186003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2021 10:10:19.4396 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fe9c912b-ec0a-4f47-4149-08d97f438386 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: BN1NAM02FT059.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR02MB8427 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210924_031027_887916_F74CDACC X-CRM114-Status: GOOD ( 17.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add OSPI support for Xilinx Versal SoCs. Disable the Direct Access Controller for Xilinx Versal OSPI. On Xilinx Versal platform, AXI interface need to be selected as Linear mode (driven from interconnect rather than external DMA) to use Software triggered 'indirect' mode of operation. This will be achieved by calling Xilinx firmware API. Signed-off-by: Sai Krishna Potthuri --- drivers/spi/spi-cadence-quadspi.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c index 101cc71bffa7..32cba7830b58 100644 --- a/drivers/spi/spi-cadence-quadspi.c +++ b/drivers/spi/spi-cadence-quadspi.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -82,6 +83,7 @@ struct cqspi_st { u32 wr_delay; bool use_direct_mode; struct cqspi_flash_pdata f_pdata[CQSPI_MAX_CHIPSELECT]; + u32 pd_dev_id; }; struct cqspi_driver_platdata { @@ -1299,6 +1301,7 @@ static int cqspi_of_get_pdata(struct cqspi_st *cqspi) { struct device *dev = &cqspi->pdev->dev; struct device_node *np = dev->of_node; + u32 id[2]; cqspi->is_decoded_cs = of_property_read_bool(np, "cdns,is-decoded-cs"); @@ -1323,6 +1326,10 @@ static int cqspi_of_get_pdata(struct cqspi_st *cqspi) cqspi->rclk_en = of_property_read_bool(np, "cdns,rclk-en"); + if (!of_property_read_u32_array(np, "power-domains", id, + ARRAY_SIZE(id))) + cqspi->pd_dev_id = id[1]; + return 0; } @@ -1548,6 +1555,15 @@ static int cqspi_probe(struct platform_device *pdev) master->mode_bits |= SPI_RX_OCTAL | SPI_TX_OCTAL; if (!(ddata->quirks & CQSPI_DISABLE_DAC_MODE)) cqspi->use_direct_mode = true; + if (of_device_is_compatible(pdev->dev.of_node, + "xlnx,versal-ospi-1.0")) { + ret = zynqmp_pm_ospi_mux_select(cqspi->pd_dev_id, + PM_OSPI_MUX_SEL_LINEAR); + if (ret) { + dev_err(dev, "failed to select OSPI Mux.\n"); + goto probe_reset_failed; + } + } } ret = devm_request_irq(dev, irq, cqspi_irq_handler, 0, @@ -1656,6 +1672,11 @@ static const struct cqspi_driver_platdata intel_lgm_qspi = { .quirks = CQSPI_DISABLE_DAC_MODE, }; +static const struct cqspi_driver_platdata versal_ospi = { + .hwcaps_mask = CQSPI_SUPPORTS_OCTAL, + .quirks = CQSPI_DISABLE_DAC_MODE, +}; + static const struct of_device_id cqspi_dt_ids[] = { { .compatible = "cdns,qspi-nor", @@ -1673,6 +1694,10 @@ static const struct of_device_id cqspi_dt_ids[] = { .compatible = "intel,lgm-qspi", .data = &intel_lgm_qspi, }, + { + .compatible = "xlnx,versal-ospi-1.0", + .data = (void *)&versal_ospi, + }, { /* end of table */ } };