From nobody Thu Oct 9 00:36:04 2025 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2040.outbound.protection.outlook.com [40.107.94.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D955C3C30; Mon, 23 Jun 2025 06:17:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750659463; cv=fail; b=kCSgvbJVe47D2m2CY5K1hXUX+mvP48Oc0ZobCxHLm3Y9yIV7Cnv+pO6YNvICoKa1XXJcOywaaYQF4MNPVcV++V6euYeu8v3+BaTizz28F4s5yUYjzhI7/EzI/iguNt/cv92xeLjiObmBmLgmX9DRdwMWh9WXnurW8CltG8FQ8X4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750659463; c=relaxed/simple; bh=0EVw5iEaORvrShqCWJi9bKWYiL7z4yBzXjHFFVnmrLY=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=arK2XT789V8pZ4J0tT8f5a1h//hUfbGXaPUc+Q/TQFyUZ+Ix8sW2xXGfjGMx7CsKdP7sR1FKP8A33J8y+xpT+GJ8qHV/+xn4DVRnJX/8oOPYeOJRsVkisInxvUkWXf2ZhrzjbSsVAIlaq3+ghuumMcFcOgVhAAiRPXZ1jlTT6+Y= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=gItqbjmp; arc=fail smtp.client-ip=40.107.94.40 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="gItqbjmp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gaCj3rLqs7Br9LqfEqMyND5wyyQgS2tD8tpeyoZFgUm3qw+x6QssdENvAaMZyV9n7dADY+Gxl+l7beKLQx/W8ZNxip+17j7tI/X7KoLKZEwNoLi9egzMN1UHH83tUJgtz9iYOm9ZLkOvKaGRFo1uGo6gqZVm5suGTKcBPTaEbHTcIAThJXmn/PW3uoLlyfbvM6ZPHfBtJYAkq/3BpwykNxuHgBLYxY2mzpIIPZEowo/F80Gn0DN5GNfu1v/3eAKL3L5eY691vxRF3uaCsUgMhfTWpTvvdAY2b31hqFYcmaMJ61aFHyfL2QPZD+0MGJpx9qj1ZMdIhC9rK1AXtWmWBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=4gOgozVtpOCSn2Pi7L9sAfxZS/xQb4q/SbhlxKF3dnU=; b=Ls7lahnIf4EYJ0+hIo9pw0pJiyLt78OWwJo6nZYEVdY7bagAUjLN44dkH/f4bgJGemeilSMdUY6ob57m0wF2W5q++w3Qr9CHBxP5ZqFXSwUJkYvOoNHjA64qMvzxPmImlrcdW1Xi+E/j7cFRdr/Jtbd/NrOn/aKIuapq0vhByy+QHJVl9Z+AayQPzAq5kiP7lkwtQJ4gia05pDWeX1/xl9iyafwxaYsAJW3XyKPmh+St9oaADQG0LkVWPYnfW052/iQPCFGPL2gFBaKCfEMTHxIYKVBplSAdyHDRv7kQmACeD4U+PL0uSmgrTX8gdVGh1voBYWYXJmvEZCMZwJFGPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) 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=4gOgozVtpOCSn2Pi7L9sAfxZS/xQb4q/SbhlxKF3dnU=; b=gItqbjmptuOtDqmOMloRsSKeyXhTyEI/0XLD4T+XkNTAaXK9QBx5CmSZ8gHNRq9VcHEY353ETOTnre9zxXBOy0dHYfh09ZzpecnXo72DmH9OpIQnlIza0DMMk0/+Jf4ub88ErlQEIbQ1r6DNkKZmxd0mR1NYlpLhM/4qXGeySv4= Received: from SA9PR11CA0006.namprd11.prod.outlook.com (2603:10b6:806:6e::11) by MN2PR12MB4127.namprd12.prod.outlook.com (2603:10b6:208:1d1::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8857.26; Mon, 23 Jun 2025 06:17:39 +0000 Received: from SN1PEPF00026368.namprd02.prod.outlook.com (2603:10b6:806:6e:cafe::f9) by SA9PR11CA0006.outlook.office365.com (2603:10b6:806:6e::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8857.28 via Frontend Transport; Mon, 23 Jun 2025 06:17:38 +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 SN1PEPF00026368.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8880.14 via Frontend Transport; Mon, 23 Jun 2025 06:17:38 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2507.39; Mon, 23 Jun 2025 01:17:37 -0500 Received: from xhdthippesw40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 23 Jun 2025 01:17:35 -0500 From: Devendra K Verma To: CC: , , , Subject: [RESEND PATCH] dmaengine: dw-edma: Add Simple Mode Support Date: Mon, 23 Jun 2025 11:47:33 +0530 Message-ID: <20250623061733.1864392-1-devverma@amd.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: None (SATLEXMB04.amd.com: devverma@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF00026368:EE_|MN2PR12MB4127:EE_ X-MS-Office365-Filtering-Correlation-Id: 5a559591-d18e-46ae-24d6-08ddb21da6f8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Ivw+0naQXhn7tGTqabp9JEZkD7YM8LoI9XkwE8wAFWw6qwp2bSGdHbUiNcch?= =?us-ascii?Q?l/s7PTtL8D8ox0N6fq5N20ja4FJKSVQwqQenhvVDyNm+bZP84F8DOzNldVFe?= =?us-ascii?Q?Frm/Vrb1i124FfxWVvgTO4M9xVaMm42XPVx6PtCHR+KxoHy6Z1Zk/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w7sJD1Kvz42vHcgOBijShP7M80jcXCqXCusBp6zY?= =?us-ascii?Q?a9cdqVFZEo4AVabBzKt0wfx9fhKQVXu/M4akbIKWsqrqGqLHnZIzHnuSNEc4?= =?us-ascii?Q?BKdoL1ioV/WXk5WW/5zhOU/HW37IowA9rPhA1Bct3WU4uqdzGomATqtKPsIJ?= =?us-ascii?Q?MRvlMSvonmBX3ATuAcTt/j3y8LSCVx4xffVUhf1vmk1KfHIzOvQlHMf7hEOx?= =?us-ascii?Q?DKBz7nPq5tm6dRkw3L8zCGnat0xTyTS2RWBPfh6AFR9NFDDma0LW20Cp0rPI?= =?us-ascii?Q?K57QI474RJSsO6imbamU7hCwdNY1OmU5nfZux6+9xLzdCVJVtiGnundoYwK9?= =?us-ascii?Q?SHvBOIOTxh9AWdFWvfzZQ+b+VMsnuylJG/yuhM6nss9pzlieo49hZDSc3G+r?= =?us-ascii?Q?9p0J2DdmxTCY6LTwFiKibpZBaSqLPk3PX418/Re0a7YRFV1cZWPpvDlCioHZ?= =?us-ascii?Q?m95Qn8Uuved4tL0mbezRgAnkNt9q1NWqu3+T?= 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:(13230040)(1800799024)(376014)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2025 06:17:38.0821 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5a559591-d18e-46ae-24d6-08ddb21da6f8 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: SN1PEPF00026368.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4127 Content-Type: text/plain; charset="utf-8" The HDMA IP supports the simple mode (non-linked list). In this mode the channel registers are configured to initiate a single DMA data transfer. The channel can be configured in simple mode via peripheral param of dma_slave_config param. Signed-off-by: Devendra K Verma --- drivers/dma/dw-edma/dw-edma-core.c | 10 +++++ drivers/dma/dw-edma/dw-edma-core.h | 2 + drivers/dma/dw-edma/dw-hdma-v0-core.c | 53 ++++++++++++++++++++++++++- include/linux/dma/edma.h | 8 ++++ 4 files changed, 72 insertions(+), 1 deletion(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-ed= ma-core.c index c2b88cc99e5d..4dafd6554277 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -235,9 +235,19 @@ static int dw_edma_device_config(struct dma_chan *dcha= n, struct dma_slave_config *config) { struct dw_edma_chan *chan =3D dchan2dw_edma_chan(dchan); + struct dw_edma_peripheral_config *pconfig =3D config->peripheral_config; + unsigned long flags; + + if (WARN_ON(config->peripheral_config && + config->peripheral_size !=3D sizeof(*pconfig))) + return -EINVAL; =20 + spin_lock_irqsave(&chan->vc.lock, flags); memcpy(&chan->config, config, sizeof(*config)); + + chan->non_ll_en =3D pconfig ? pconfig->non_ll_en : false; chan->configured =3D true; + spin_unlock_irqrestore(&chan->vc.lock, flags); =20 return 0; } diff --git a/drivers/dma/dw-edma/dw-edma-core.h b/drivers/dma/dw-edma/dw-ed= ma-core.h index 71894b9e0b15..c0266976aa22 100644 --- a/drivers/dma/dw-edma/dw-edma-core.h +++ b/drivers/dma/dw-edma/dw-edma-core.h @@ -86,6 +86,8 @@ struct dw_edma_chan { u8 configured; =20 struct dma_slave_config config; + + bool non_ll_en; }; =20 struct dw_edma_irq { diff --git a/drivers/dma/dw-edma/dw-hdma-v0-core.c b/drivers/dma/dw-edma/dw= -hdma-v0-core.c index e3f8db4fe909..3237c807a18e 100644 --- a/drivers/dma/dw-edma/dw-hdma-v0-core.c +++ b/drivers/dma/dw-edma/dw-hdma-v0-core.c @@ -225,7 +225,7 @@ static void dw_hdma_v0_sync_ll_data(struct dw_edma_chun= k *chunk) readl(chunk->ll_region.vaddr.io); } =20 -static void dw_hdma_v0_core_start(struct dw_edma_chunk *chunk, bool first) +static void dw_hdma_v0_ll_start(struct dw_edma_chunk *chunk, bool first) { struct dw_edma_chan *chan =3D chunk->chan; struct dw_edma *dw =3D chan->dw; @@ -263,6 +263,57 @@ static void dw_hdma_v0_core_start(struct dw_edma_chunk= *chunk, bool first) SET_CH_32(dw, chan->dir, chan->id, doorbell, HDMA_V0_DOORBELL_START); } =20 +static void dw_hdma_v0_non_ll_start(struct dw_edma_chunk *chunk) +{ + struct dw_edma_chan *chan =3D chunk->chan; + struct dw_edma *dw =3D chan->dw; + struct dw_edma_burst *child; + u32 val; + + list_for_each_entry(child, &chunk->burst->list, list) { + SET_CH_32(dw, chan->dir, chan->id, ch_en, BIT(0)); + + /* Source address */ + SET_CH_32(dw, chan->dir, chan->id, sar.lsb, lower_32_bits(child->sar)); + SET_CH_32(dw, chan->dir, chan->id, sar.msb, upper_32_bits(child->sar)); + + /* Destination address */ + SET_CH_32(dw, chan->dir, chan->id, dar.lsb, lower_32_bits(child->dar)); + SET_CH_32(dw, chan->dir, chan->id, dar.msb, upper_32_bits(child->dar)); + + /* Transfer size */ + SET_CH_32(dw, chan->dir, chan->id, transfer_size, child->sz); + + /* Interrupt setup */ + val =3D GET_CH_32(dw, chan->dir, chan->id, int_setup) | + HDMA_V0_STOP_INT_MASK | HDMA_V0_ABORT_INT_MASK | + HDMA_V0_LOCAL_STOP_INT_EN | HDMA_V0_LOCAL_ABORT_INT_EN; + + if (!(dw->chip->flags & DW_EDMA_CHIP_LOCAL)) + val |=3D HDMA_V0_REMOTE_STOP_INT_EN | HDMA_V0_REMOTE_ABORT_INT_EN; + + SET_CH_32(dw, chan->dir, chan->id, int_setup, val); + + /* Channel control setup */ + val =3D GET_CH_32(dw, chan->dir, chan->id, control1); + val &=3D ~HDMA_V0_LINKLIST_EN; + SET_CH_32(dw, chan->dir, chan->id, control1, val); + + /* Ring the doorbell */ + SET_CH_32(dw, chan->dir, chan->id, doorbell, HDMA_V0_DOORBELL_START); + } +} + +static void dw_hdma_v0_core_start(struct dw_edma_chunk *chunk, bool first) +{ + struct dw_edma_chan *chan =3D chunk->chan; + + if (!chan->non_ll_en) + dw_hdma_v0_ll_start(chunk, first); + else + dw_hdma_v0_non_ll_start(chunk); +} + static void dw_hdma_v0_core_ch_config(struct dw_edma_chan *chan) { struct dw_edma *dw =3D chan->dw; diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index 3080747689f6..82d808013a66 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -101,6 +101,14 @@ struct dw_edma_chip { struct dw_edma *dw; }; =20 +/** + * struct dw_edma_peripheral_config - peripheral spicific configurations + * @non_ll_en: enable non-linked list mode of operations + */ +struct dw_edma_peripheral_config { + bool non_ll_en; +}; + /* Export to the platform drivers */ #if IS_REACHABLE(CONFIG_DW_EDMA) int dw_edma_probe(struct dw_edma_chip *chip); --=20 2.43.0