From patchwork Thu Jan 19 03:51:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brad Larson X-Patchwork-Id: 13107385 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 A8693C00A5A for ; Thu, 19 Jan 2023 04:18:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229696AbjASERr (ORCPT ); Wed, 18 Jan 2023 23:17:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230130AbjASEJA (ORCPT ); Wed, 18 Jan 2023 23:09:00 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on20631.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eaa::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39D0169B20; Wed, 18 Jan 2023 20:03:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=En3unH6goWZNoY3SAnf4Q7CXOu7CdvXaKlV2BuVlQD9KgXOUTMaUu1V3pWRHpBluicd5BZq23ZEnfBdP/hRlK6xsS8ELtj78PJBbgscVNyUBKzBdm/L5JP/Lkc5dyT0tXyFzSPrDYY9SAwiBaBcI6coE5pympNS+0MUCdpCZy2xuOvKStBI26VFtwenA+ESuXADcBnkctoPnDhltDmWEMsJJW2zSk9Ttz29Aib+/Opy4ILU21aT6MWL1rLD6XkwQLTtxExRcoNkFE2OUeepKNvJEPILfxNkMyK1A+mlLmNVAGI3B2E/eDvxpNEybPyQAC5IS+Dz7EBU4/meTxAve4w== 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=drqNP1ReL0LAnB1bXR9V1s7ICcasOudSRqe6jqMt2bM=; b=FaIfz2W/30jLmqKBVeIGZQHiuH0F+VHPYYx+q+PwY/KlET57Hf96WA2ZAsKKWDvRWQB5il/cs/cHXlcGBbOMVOaUUO2hAoxpxEaUUjiOhWw8xcuYsJB2Kv5lsmFR3NhGRh0VnKVIUbwMPoDxU6+JtQdDH3k3UWKabvfu2RPAC3W4GPIaU8Carg/4z6umQVZ4JDLInC8rwFpiTVhvfRg+GCnVlUpOeiNUu/Uh0QLgP9KZdlehWp2ZPKMslkQ6K5GBanwDOx+Ya3SDx2P2NI9cC6U1GymMamwotWBSXM+HXxVmSxWxKSZ2bfN9jkGoqMsDhwjomzmeB00R0CKYnLKVcg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.infradead.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=drqNP1ReL0LAnB1bXR9V1s7ICcasOudSRqe6jqMt2bM=; b=LRfWgrQRuxZHSjFErIY/zCjQsJWAE91KEoED2SJVfMqriHsMAFDLAn5Qp8AUpThw2XCNxMcMkVamrMtl5vMYdPX/w1kpJLYOCMnB0/rBH1x2cqaL7qVO43FjxNOp+D8bSyPz7XWZsRR6LMN4dOW0eUf8uvphHstTchRgMofbry0= Received: from MW4PR04CA0303.namprd04.prod.outlook.com (2603:10b6:303:82::8) by IA1PR12MB8519.namprd12.prod.outlook.com (2603:10b6:208:44c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.19; Thu, 19 Jan 2023 03:52:55 +0000 Received: from CO1NAM11FT027.eop-nam11.prod.protection.outlook.com (2603:10b6:303:82:cafe::f) by MW4PR04CA0303.outlook.office365.com (2603:10b6:303:82::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.25 via Frontend Transport; Thu, 19 Jan 2023 03:52: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 CO1NAM11FT027.mail.protection.outlook.com (10.13.174.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6002.13 via Frontend Transport; Thu, 19 Jan 2023 03:52:54 +0000 Received: from platform-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 18 Jan 2023 21:52:48 -0600 From: Brad Larson To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v9 10/15] spi: cadence-quadspi: Add compatible for AMD Pensando Elba SoC Date: Wed, 18 Jan 2023 19:51:31 -0800 Message-ID: <20230119035136.21603-11-blarson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230119035136.21603-1-blarson@amd.com> References: <20230119035136.21603-1-blarson@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT027:EE_|IA1PR12MB8519:EE_ X-MS-Office365-Filtering-Correlation-Id: 29024b7a-1eb3-4428-7347-08daf9d0a55b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GbrIGNeWJjCYz93GGOL0rpN/lbrcpICbo3kxJxlGMu/ve9YXdoAl2QZqzb8MkY0H578lNgrO5SQg2kVfO0JlOf9EbVBU+JGu0a8a6L/F5WWXO7pMYkYMoHNz4q9Kx8w6ogLYWuLTHvsWXEA8SPcW1gb+oO8LbOMoO8uMDPl7ONYKtWvmbrJq4/MR8klwg11v68B8eM11AMDJUyxcdqr78U+AQZxiMJHZATjuTFUPGDg/jDGlcuX6I7eitwIVHJBh/94YAzRweCXEsB+J+zf7rZrBOGl8wkNkIUzZ/qeL4Hhl3G3h52Yi55OhmSg1AK2Yvs1CpaiAwOT8IecSfa+2jPYVr7qiT+DYVSwxh3Rv+Rws+gw1GeQYyGmMfs7+EefXTJf6VlRsCbK3L3zEWTUJygIEPLsA9vLnP+LsRh8isrz8IJAVzlKtpyNd+GmsZK6o1HW57ylTLT6eN55SRy3jfpWyLJPln3/vziM+aRUaBkCR92IYBUw9dcC67sa9EapGdLBDj3SdiU9K5RHpj40RRsCPUSxjAUI6M5kFIJP+Ex4JszsLD/XKKNN7lFuFHvrqkbriFyryQutcBBRAktQ0JBS4OPl+7ShBCgDYj8fwYoWngQ8KDZLiA9GzK8NcToIKnq5hoxrRp6Anozf55xhsaQH+MFbg65AJpcZgewM4AEaWW9APFUnN5KKfqKFkW+0DJAq16I/slGhoffyATn0vjBf4/0HG14oo0+ZRovbKj6o= 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)(39860400002)(396003)(346002)(376002)(136003)(451199015)(36840700001)(40470700004)(46966006)(40460700003)(82740400003)(81166007)(8936002)(7416002)(16526019)(5660300002)(7406005)(6666004)(36860700001)(36756003)(41300700001)(8676002)(6916009)(40480700001)(82310400005)(1076003)(70586007)(2906002)(426003)(4326008)(47076005)(336012)(70206006)(2616005)(54906003)(356005)(26005)(316002)(478600001)(186003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 03:52:54.7688 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 29024b7a-1eb3-4428-7347-08daf9d0a55b 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: CO1NAM11FT027.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8519 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org The AMD Pensando Elba SoC has the Cadence QSPI controller integrated. The quirk CQSPI_NEEDS_APB_AHB_HAZARD_WAR is added and if enabled a dummy readback from the controller is performed to ensure synchronization. Signed-off-by: Brad Larson --- Changes since v6: - Rebase to linux-next 6.2.0-rc1 --- drivers/spi/spi-cadence-quadspi.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c index 676313e1bdad..e042781d3db5 100644 --- a/drivers/spi/spi-cadence-quadspi.c +++ b/drivers/spi/spi-cadence-quadspi.c @@ -40,6 +40,7 @@ #define CQSPI_SUPPORT_EXTERNAL_DMA BIT(2) #define CQSPI_NO_SUPPORT_WR_COMPLETION BIT(3) #define CQSPI_SLOW_SRAM BIT(4) +#define CQSPI_NEEDS_APB_AHB_HAZARD_WAR BIT(5) /* Capabilities */ #define CQSPI_SUPPORTS_OCTAL BIT(0) @@ -89,6 +90,7 @@ struct cqspi_st { u32 pd_dev_id; bool wr_completion; bool slow_sram; + bool apb_ahb_hazard; }; struct cqspi_driver_platdata { @@ -978,6 +980,13 @@ static int cqspi_indirect_write_execute(struct cqspi_flash_pdata *f_pdata, if (cqspi->wr_delay) ndelay(cqspi->wr_delay); + /* + * If a hazard exists between the APB and AHB interfaces, perform a + * dummy readback from the controller to ensure synchronization. + */ + if (cqspi->apb_ahb_hazard) + readl(reg_base + CQSPI_REG_INDIRECTWR); + while (remaining > 0) { size_t write_words, mod_bytes; @@ -1700,6 +1709,8 @@ static int cqspi_probe(struct platform_device *pdev) cqspi->wr_completion = false; if (ddata->quirks & CQSPI_SLOW_SRAM) cqspi->slow_sram = true; + if (ddata->quirks & CQSPI_NEEDS_APB_AHB_HAZARD_WAR) + cqspi->apb_ahb_hazard = true; if (of_device_is_compatible(pdev->dev.of_node, "xlnx,versal-ospi-1.0")) @@ -1825,6 +1836,10 @@ static const struct cqspi_driver_platdata versal_ospi = { .get_dma_status = cqspi_get_versal_dma_status, }; +static const struct cqspi_driver_platdata pensando_cdns_qspi = { + .quirks = CQSPI_NEEDS_APB_AHB_HAZARD_WAR | CQSPI_DISABLE_DAC_MODE, +}; + static const struct of_device_id cqspi_dt_ids[] = { { .compatible = "cdns,qspi-nor", @@ -1850,6 +1865,10 @@ static const struct of_device_id cqspi_dt_ids[] = { .compatible = "intel,socfpga-qspi", .data = &socfpga_qspi, }, + { + .compatible = "amd,pensando-elba-qspi", + .data = &pensando_cdns_qspi, + }, { /* end of table */ } };