From nobody Wed Dec 17 14:37:28 2025 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 AB5CDC25B47 for ; Wed, 25 Oct 2023 10:22:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234700AbjJYKWh (ORCPT ); Wed, 25 Oct 2023 06:22:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234511AbjJYKWb (ORCPT ); Wed, 25 Oct 2023 06:22:31 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A883123; Wed, 25 Oct 2023 03:22:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1698229350; x=1729765350; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rYuw1o7okKebBJNCnZT/Iov2A07t5OeBvEwPkDvAo7w=; b=PbsgyYvsZLd2KKGsJP1mdf9lS6PaiXbIr2ozapeHrynWzVCzjQDs0Q4A GofTMkCTHA8gjDxUrs7mgnkdWS3Nbrz5Mk1eXoONliMXDzGZZfw2a2M3E wOj4ZIVFemlb5rLxAWyECQ8t412wyFHbWinQKnRSK0zteRRjgi5iCOXff LY+B5RMglTdeYLzTC5gqkinVuzJy71agk+EdDA51niJNBH9FqHDhVF5/h iAhMeLmDClMkXTdridSZ4GDSw9Wzysj6UYfHkOMcBNKB6UaispESQbTz6 5Qt5szS8xMwViEraA/MJlS+A358FOjQOo8BMGHbBkxXt4iyt8bkSa9Uwd g==; X-CSE-ConnectionGUID: hCRWSLnNROWYEPYDprosFg== X-CSE-MsgGUID: FCcQ+OH0Sb2QnGb6dXeiJQ== X-ThreatScanner-Verdict: Negative X-IronPort-AV: E=Sophos;i="6.03,250,1694761200"; d="scan'208";a="10660976" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 25 Oct 2023 03:22:29 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Wed, 25 Oct 2023 03:22:06 -0700 Received: from microchip1-OptiPlex-9020.microchip.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Wed, 25 Oct 2023 03:22:01 -0700 From: shravan chippa To: , , , , , , CC: , , , , , , Subject: [PATCH v3 3/4] dmaengine: sf-pdma: add mpfs-pdma compatible name Date: Wed, 25 Oct 2023 15:52:50 +0530 Message-ID: <20231025102251.3369472-4-shravan.chippa@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231025102251.3369472-1-shravan.chippa@microchip.com> References: <20231025102251.3369472-1-shravan.chippa@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shravan Chippa Sifive platform dma does not allow out-of-order transfers, Add a PolarFire SoC specific compatible and code to support for out-of-order dma transfers Signed-off-by: Shravan Chippa Reviewed-by: Emil Renner Berthing --- drivers/dma/sf-pdma/sf-pdma.c | 27 ++++++++++++++++++++++++--- drivers/dma/sf-pdma/sf-pdma.h | 8 +++++++- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/drivers/dma/sf-pdma/sf-pdma.c b/drivers/dma/sf-pdma/sf-pdma.c index 4c456bdef882..9cc4beec40f0 100644 --- a/drivers/dma/sf-pdma/sf-pdma.c +++ b/drivers/dma/sf-pdma/sf-pdma.c @@ -25,6 +25,8 @@ =20 #include "sf-pdma.h" =20 +#define PDMA_QUIRK_NO_STRICT_ORDERING BIT(0) + #ifndef readq static inline unsigned long long readq(void __iomem *addr) { @@ -66,7 +68,7 @@ static struct sf_pdma_desc *sf_pdma_alloc_desc(struct sf_= pdma_chan *chan) static void sf_pdma_fill_desc(struct sf_pdma_desc *desc, u64 dst, u64 src, u64 size) { - desc->xfer_type =3D PDMA_FULL_SPEED; + desc->xfer_type =3D desc->chan->pdma->transfer_type; desc->xfer_size =3D size; desc->dst_addr =3D dst; desc->src_addr =3D src; @@ -520,6 +522,7 @@ static struct dma_chan *sf_pdma_of_xlate(struct of_phan= dle_args *dma_spec, =20 static int sf_pdma_probe(struct platform_device *pdev) { + const struct sf_pdma_driver_platdata *ddata; struct sf_pdma *pdma; int ret, n_chans; const enum dma_slave_buswidth widths =3D @@ -545,6 +548,14 @@ static int sf_pdma_probe(struct platform_device *pdev) =20 pdma->n_chans =3D n_chans; =20 + pdma->transfer_type =3D PDMA_FULL_SPEED | PDMA_STRICT_ORDERING; + + ddata =3D device_get_match_data(&pdev->dev); + if (ddata) { + if (ddata->quirks & PDMA_QUIRK_NO_STRICT_ORDERING) + pdma->transfer_type &=3D ~(PDMA_STRICT_ORDERING) ; + } + pdma->membase =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pdma->membase)) return PTR_ERR(pdma->membase); @@ -632,9 +643,19 @@ static int sf_pdma_remove(struct platform_device *pdev) return 0; } =20 +static const struct sf_pdma_driver_platdata mpfs_pdma =3D { + .quirks =3D PDMA_QUIRK_NO_STRICT_ORDERING, +}; + static const struct of_device_id sf_pdma_dt_ids[] =3D { - { .compatible =3D "sifive,fu540-c000-pdma" }, - { .compatible =3D "sifive,pdma0" }, + { + .compatible =3D "sifive,fu540-c000-pdma", + }, { + .compatible =3D "sifive,pdma0", + }, { + .compatible =3D "microchip,mpfs-pdma", + .data =3D &mpfs_pdma, + }, {}, }; MODULE_DEVICE_TABLE(of, sf_pdma_dt_ids); diff --git a/drivers/dma/sf-pdma/sf-pdma.h b/drivers/dma/sf-pdma/sf-pdma.h index 5c398a83b491..267e79a5e0a5 100644 --- a/drivers/dma/sf-pdma/sf-pdma.h +++ b/drivers/dma/sf-pdma/sf-pdma.h @@ -48,7 +48,8 @@ #define PDMA_ERR_STATUS_MASK GENMASK(31, 31) =20 /* Transfer Type */ -#define PDMA_FULL_SPEED 0xFF000008 +#define PDMA_FULL_SPEED 0xFF000000 +#define PDMA_STRICT_ORDERING BIT(3) =20 /* Error Recovery */ #define MAX_RETRY 1 @@ -112,8 +113,13 @@ struct sf_pdma { struct dma_device dma_dev; void __iomem *membase; void __iomem *mappedbase; + u32 transfer_type; u32 n_chans; struct sf_pdma_chan chans[]; }; =20 +struct sf_pdma_driver_platdata { + u32 quirks; +}; + #endif /* _SF_PDMA_H */ --=20 2.34.1