From nobody Tue Nov 11 13:06:23 2025 Received: from CO1PR03CU002.outbound.protection.outlook.com (mail-westus2azon11010046.outbound.protection.outlook.com [52.101.46.46]) (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 37DFA3557E3; Tue, 11 Nov 2025 07:05:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.46.46 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762844747; cv=fail; b=fu750eEbDWvIhcclOp0KSej1cjporqeWvxwPeHaGe16K9rvz6+bPijrQh79Focffb+l48iPIXCF5p/o5ZCwP2fJbLRryiHi2d1qRsYPDbB4OBppeuYWlVU7P6albglevjmHAXestAsGtnk7rVqRqpnIm+k37C/5gvpCDy5vUvTM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762844747; c=relaxed/simple; bh=FlnavPYSETihk8gUzTBC49yc3pUQR57XuZ7loNhqJUo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kbHu2XccOtRfwq8kbZe+ZifS4fbaVE3exH4+P3YGH1QcR0h2+JgaynwkthdrYHBlRI3jPTnvSUzGW+G3H3HUKkNMHTIFraX3/XMYrS2k7vHIxamRU8KMghci6jS4e7nlpqyTyUgP9/iFuZPvN4HgMxUwaLdLBCkoQQVgwe9n3ZA= 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=IKSsjqj6; arc=fail smtp.client-ip=52.101.46.46 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="IKSsjqj6" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vDd5seQAkuc2hjpgveBw/TwAJfXpBs40uIklZI4zi7h/gdf/TYFbn6rsyc+epJnk+6JikkyYcZ8ZHPkMe1mooYmOtv5sSxsfmlggMWxqjy0z3JxUZYG7K8TSlriWdnlvKbm+lwi3saCNt4YMzZ8SAvgh+js+Aa9QLv4boohqoXuIynOgBl8k0XWArkZxW/4FgOTe7ISInhw7/A/DS5OtG1MaFv+58NtDoQXJ+c88IAfeTVxaxB5dqhPKB6naCYVV7AZcRu2oyk2XHiO/rb+1byKWSYpXYGXAYHQD/2yO27UEygJOX9euvqM8KHuk56lpyaGGbEReY+uwzm+bIhSoDQ== 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=ER5RVZfHRUhwDhGFD8g3Lu5NcYprNJZGO7ijbgkkS+g=; b=Rfz07uFC8dzbD0gWnjuQGRKrWMKQt5bNeDXb9aV58/PjucBcNSE78m/0B1ubIfu6zCq1Xe1477+V5sEf0QvQNRRlGlBI2UezrpatS2CiIT797xz4KKRsvQmAwrucZYL89VjOnGec5ICDLuQnSaIME5f38GzWmiDsOpbH2ohr0GGMUGRUcbORPAyf1xQCGaHas42dZKrNlKIAR6moYPDDUuud1CqSnRM+Ahr2ACwoul2pUxZc+9TRjHydqw/Si70E7ZoT5b+pp+7gS0eBqgl9SQfuPGDEUGSboXjHSY9RYqhwfMM4R0uNJ4EoHAw878oLo0ELzkqOlH3V+Egpa2anOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=google.com 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=ER5RVZfHRUhwDhGFD8g3Lu5NcYprNJZGO7ijbgkkS+g=; b=IKSsjqj6jOx/XGNtg6UmCGdfa2gVmrn5sl0+N4+Qv3+K+/OZ9J1fmmfLw3VKTY4DbI+nNsyWuetNlZqJzpDFTqCpg87xCNRmCEF6Y4pQAgZ/uv6zx8pgU6YkAv/qLM1Pl5OQaBw4z1AhKdnauoKW7rUOVswFSn1VFIgZjj/6SI0= Received: from CH2PR02CA0008.namprd02.prod.outlook.com (2603:10b6:610:4e::18) by IA1PR12MB8360.namprd12.prod.outlook.com (2603:10b6:208:3d8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9298.16; Tue, 11 Nov 2025 07:05:41 +0000 Received: from CH2PEPF0000013B.namprd02.prod.outlook.com (2603:10b6:610:4e:cafe::38) by CH2PR02CA0008.outlook.office365.com (2603:10b6:610:4e::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9298.16 via Frontend Transport; Tue, 11 Nov 2025 07:05:41 +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=satlexmb08.amd.com; pr=C Received: from satlexmb08.amd.com (165.204.84.17) by CH2PEPF0000013B.mail.protection.outlook.com (10.167.244.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9320.13 via Frontend Transport; Tue, 11 Nov 2025 07:05:41 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.17; Mon, 10 Nov 2025 23:05:40 -0800 Received: from satlexmb08.amd.com (10.181.42.217) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 11 Nov 2025 01:05:39 -0600 Received: from xhdapps-pcie2.xilinx.com (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.17 via Frontend Transport; Mon, 10 Nov 2025 23:05:37 -0800 From: Devendra K Verma To: , , CC: , , , , Subject: [PATCH RESEND v6 2/2] dmaengine: dw-edma: Add non-LL mode Date: Tue, 11 Nov 2025 12:35:31 +0530 Message-ID: <20251111070531.6808-3-devendra.verma@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251111070531.6808-1-devendra.verma@amd.com> References: <20251111070531.6808-1-devendra.verma@amd.com> 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 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF0000013B:EE_|IA1PR12MB8360:EE_ X-MS-Office365-Filtering-Correlation-Id: dd10994c-994c-4fa7-a9dd-08de20f0b98e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ytWdSj/n0ny1xMB2QcggqgUGJcjrqnz6dbso9S42t3UXyV51x+coyWpES4Ok?= =?us-ascii?Q?kiXz4BrsS6fEugLVHud5OA2djqgQ7DoQb8gCiSaqKs9mvNT1eQQi/YNUUe2G?= =?us-ascii?Q?yIQJlCaSfTmYVRslVJfOBpYzaTtQMqUZpamdCgCP3+CGnfMlQq83u+/SqqRm?= =?us-ascii?Q?A2lxll4zqoHWKflnDClGW+KIghJC0WFd8RqaWpjp13q4BGHmk5MuAZM78O5h?= =?us-ascii?Q?G0XbhUsRLiwjqFUK0mEgPwt9dJymlUM/o7qRadH40qvbUgc8z5Mqk9+l7W/x?= =?us-ascii?Q?RL7FY1Q/q5EOBPmPDwYCTS53BdRJxaEXGH2oZygsUCutPD93BDmey9bpjIr4?= =?us-ascii?Q?UnlQ+DdNyE4wKha2C8iwbRIuiX7auS+ef6wenx5caxmfdwZlHhYHpO8chEAT?= =?us-ascii?Q?RJ3u2UBNRVCxnwL+TEA+OUuYCDlERGPcR47PVo1lvYZk98Tg3Ef/IgKTyc4c?= =?us-ascii?Q?oyJwbi4lLggaPym//fS3xSltu5PcT6v1HLtr7Bb9yvsGjIwCHK8w4NlQfjC0?= =?us-ascii?Q?VVRe+etGWSjNh3gm9Oqmlr/BvxovlWARZm0F1NPGaXO9/7pCTVToVRBp/dog?= =?us-ascii?Q?onO//TSXhuPXVt0slQN3wAcouPCxLVAJmaykvSbyHHx7aoPiroMHFewjWjlN?= =?us-ascii?Q?DrlGfj6fxoYSoNgC7HBW5j2cdY0f5VWxwBbsTATJi00KlSw8qLz3ppav8qM9?= =?us-ascii?Q?P36Iu5WXcl4XE8ExY1xT/dTvzhUWBaZ+M5+Snv/KK7B2sxBpAck/v7i4JdYe?= =?us-ascii?Q?KV6CPjiv3UGrZEgwg/NdnpEpuThhxAa9Ol1MXs+fadrItVceZX7KQ9UMq4fM?= =?us-ascii?Q?SR7PxFqiN40mt39fepf9cyOfZKDnnG3rw2xEZdGIASZ/7CPwAi1h0FbmCWjV?= =?us-ascii?Q?NSY2ex3rqqBq/G6ghHkjDyQAnnr+S33ZF+DINeykP6Y+ZgkXHi+PSTtdZUc8?= =?us-ascii?Q?D1LejsjRFahAPx+hzNX3XbSCZ5nuGeqobAh+w+/Zf1dLYURrF/T7iBbHz46K?= =?us-ascii?Q?jBRVTwavcQ1ohQJmf9FDNwB8wIq+Q+Q0Mbt2WrSfxomTKmhennH1RQgqLzqo?= =?us-ascii?Q?e7QHVKQlT+1b18ii4gW+SmP62t7pWQOGGYFRieZ+zPFlbmHHtWOHQi4+DB+R?= =?us-ascii?Q?pwC70MxDbhWOu/cO6qbVRoxD1KauhhjnPFlk3XtqBpxXkYEdq1+/RkwNgavU?= =?us-ascii?Q?k7eL0N9UtuCAkwrkONrzFuoQrlXyMwe0cCgSSfmtGdPyg/I9v3ASAK0pSEzT?= =?us-ascii?Q?YLeU33/mM38s2nR7WcgzloPmNEeO1pWSJ8XAsx2Msf6uY6yIKwiMFGqx/0EW?= =?us-ascii?Q?T0/K0OTz5nNNFsDK41lDLiaZ1jVL6flafKkLnsSwPxKyxqo/7lKJirLbezny?= =?us-ascii?Q?rHzNBp6cmcQZoyn/dBh7KGmo2zBPAj5vxJ7f+U/kuICIyPuICAMWhEgRO9ir?= =?us-ascii?Q?RBQK5euWGXvcKMMDVi9I3MOQlym07UFka85RKhSquTGiLWmqPvsWp8oCwNPT?= =?us-ascii?Q?PY6sB6IwU7bBgtwPPWMDiSB/uRHwIHCwTg96Kf1L8zhGsiqPIedgZLx9XyMR?= =?us-ascii?Q?lKK6A19PsON3/oodVos=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:satlexmb08.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(376014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2025 07:05:41.0037 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd10994c-994c-4fa7-a9dd-08de20f0b98e 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=[satlexmb08.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH2PEPF0000013B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8360 Content-Type: text/plain; charset="utf-8" AMD MDB IP supports Linked List (LL) mode as well as non-LL mode. The current code does not have the mechanisms to enable the DMA transactions using the non-LL mode. The following two cases are added with this patch: - When a valid physical base address is not configured via the Xilinx VSEC capability then the IP can still be used in non-LL mode. The default mode for all the DMA transactions and for all the DMA channels then is non-LL mode. - When a valid physical base address is configured but the client wants to use the non-LL mode for DMA transactions then also the flexibility is provided via the peripheral_config struct member of dma_slave_config. In this case the channels can be individually configured in non-LL mode. This use case is desirable for single DMA transfer of a chunk, this saves the effort of preparing the Link List. This particular scenario is applicable to AMD as well as Synopsys IP. Signed-off-by: Devendra K Verma --- Changes in v6 Gave definition to bits used for channel configuration. Removed the comment related to doorbell. Changes in v5 Variable name 'nollp' changed to 'non_ll'. In the dw_edma_device_config() WARN_ON replaced with dev_err(). Comments follow the 80-column guideline. Changes in v4 No change Changes in v3 No change Changes in v2 Reverted the function return type to u64 for dw_edma_get_phys_addr(). Changes in v1 Changed the function return type for dw_edma_get_phys_addr(). Corrected the typo raised in review. --- drivers/dma/dw-edma/dw-edma-core.c | 41 ++++++++++++++++++++--- drivers/dma/dw-edma/dw-edma-core.h | 1 + drivers/dma/dw-edma/dw-edma-pcie.c | 44 +++++++++++++++++-------- drivers/dma/dw-edma/dw-hdma-v0-core.c | 61 +++++++++++++++++++++++++++++++= +++- drivers/dma/dw-edma/dw-hdma-v0-regs.h | 1 + include/linux/dma/edma.h | 1 + 6 files changed, 130 insertions(+), 19 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-ed= ma-core.c index b43255f..60a3279 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -223,8 +223,31 @@ 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); + int non_ll =3D 0; + + if (config->peripheral_config && + config->peripheral_size !=3D sizeof(int)) { + dev_err(dchan->device->dev, + "config param peripheral size mismatch\n"); + return -EINVAL; + } =20 memcpy(&chan->config, config, sizeof(*config)); + + /* + * When there is no valid LLP base address available then the default + * DMA ops will use the non-LL mode. + * Cases where LL mode is enabled and client wants to use the non-LL + * mode then also client can do so via providing the peripheral_config + * param. + */ + if (config->peripheral_config) + non_ll =3D *(int *)config->peripheral_config; + + chan->non_ll =3D false; + if (chan->dw->chip->non_ll || (!chan->dw->chip->non_ll && non_ll)) + chan->non_ll =3D true; + chan->configured =3D true; =20 return 0; @@ -353,7 +376,7 @@ static void dw_edma_device_issue_pending(struct dma_cha= n *dchan) struct dw_edma_chan *chan =3D dchan2dw_edma_chan(xfer->dchan); enum dma_transfer_direction dir =3D xfer->direction; struct scatterlist *sg =3D NULL; - struct dw_edma_chunk *chunk; + struct dw_edma_chunk *chunk =3D NULL; struct dw_edma_burst *burst; struct dw_edma_desc *desc; u64 src_addr, dst_addr; @@ -419,9 +442,11 @@ static void dw_edma_device_issue_pending(struct dma_ch= an *dchan) if (unlikely(!desc)) goto err_alloc; =20 - chunk =3D dw_edma_alloc_chunk(desc); - if (unlikely(!chunk)) - goto err_alloc; + if (!chan->non_ll) { + chunk =3D dw_edma_alloc_chunk(desc); + if (unlikely(!chunk)) + goto err_alloc; + } =20 if (xfer->type =3D=3D EDMA_XFER_INTERLEAVED) { src_addr =3D xfer->xfer.il->src_start; @@ -450,7 +475,13 @@ static void dw_edma_device_issue_pending(struct dma_ch= an *dchan) if (xfer->type =3D=3D EDMA_XFER_SCATTER_GATHER && !sg) break; =20 - if (chunk->bursts_alloc =3D=3D chan->ll_max) { + /* + * For non-LL mode, only a single burst can be handled + * in a single chunk unlike LL mode where multiple bursts + * can be configured in a single chunk. + */ + if ((chunk && chunk->bursts_alloc =3D=3D chan->ll_max) || + chan->non_ll) { chunk =3D dw_edma_alloc_chunk(desc); if (unlikely(!chunk)) goto err_alloc; diff --git a/drivers/dma/dw-edma/dw-edma-core.h b/drivers/dma/dw-edma/dw-ed= ma-core.h index 71894b9..c8e3d19 100644 --- a/drivers/dma/dw-edma/dw-edma-core.h +++ b/drivers/dma/dw-edma/dw-edma-core.h @@ -86,6 +86,7 @@ struct dw_edma_chan { u8 configured; =20 struct dma_slave_config config; + bool non_ll; }; =20 struct dw_edma_irq { diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-ed= ma-pcie.c index 3d7247c..e7e95df 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -269,6 +269,15 @@ static void dw_edma_pcie_get_vsec_dma_data(struct pci_= dev *pdev, pdata->devmem_phys_off =3D off; } =20 +static u64 dw_edma_get_phys_addr(struct pci_dev *pdev, + struct dw_edma_pcie_data *pdata, + enum pci_barno bar) +{ + if (pdev->vendor =3D=3D PCI_VENDOR_ID_XILINX) + return pdata->devmem_phys_off; + return pci_bus_address(pdev, bar); +} + static int dw_edma_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *pid) { @@ -278,6 +287,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, struct dw_edma_chip *chip; int err, nr_irqs; int i, mask; + bool non_ll =3D false; =20 vsec_data =3D kmalloc(sizeof(*vsec_data), GFP_KERNEL); if (!vsec_data) @@ -302,21 +312,24 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, if (pdev->vendor =3D=3D PCI_VENDOR_ID_XILINX) { /* * There is no valid address found for the LL memory - * space on the device side. + * space on the device side. In the absence of LL base + * address use the non-LL mode or simple mode supported by + * the HDMA IP. */ if (vsec_data->devmem_phys_off =3D=3D DW_PCIE_AMD_MDB_INVALID_ADDR) - return -ENOMEM; + non_ll =3D true; =20 /* * Configure the channel LL and data blocks if number of * channels enabled in VSEC capability are more than the * channels configured in amd_mdb_data. */ - dw_edma_set_chan_region_offset(vsec_data, BAR_2, 0, - DW_PCIE_XILINX_LL_OFF_GAP, - DW_PCIE_XILINX_LL_SIZE, - DW_PCIE_XILINX_DT_OFF_GAP, - DW_PCIE_XILINX_DT_SIZE); + if (!non_ll) + dw_edma_set_chan_region_offset(vsec_data, BAR_2, 0, + DW_PCIE_XILINX_LL_OFF_GAP, + DW_PCIE_XILINX_LL_SIZE, + DW_PCIE_XILINX_DT_OFF_GAP, + DW_PCIE_XILINX_DT_SIZE); } =20 /* Mapping PCI BAR regions */ @@ -364,6 +377,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, chip->mf =3D vsec_data->mf; chip->nr_irqs =3D nr_irqs; chip->ops =3D &dw_edma_pcie_plat_ops; + chip->non_ll =3D non_ll; =20 chip->ll_wr_cnt =3D vsec_data->wr_ch_cnt; chip->ll_rd_cnt =3D vsec_data->rd_ch_cnt; @@ -372,7 +386,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, if (!chip->reg_base) return -ENOMEM; =20 - for (i =3D 0; i < chip->ll_wr_cnt; i++) { + for (i =3D 0; i < chip->ll_wr_cnt && !non_ll; i++) { struct dw_edma_region *ll_region =3D &chip->ll_region_wr[i]; struct dw_edma_region *dt_region =3D &chip->dt_region_wr[i]; struct dw_edma_block *ll_block =3D &vsec_data->ll_wr[i]; @@ -383,7 +397,8 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, return -ENOMEM; =20 ll_region->vaddr.io +=3D ll_block->off; - ll_region->paddr =3D pci_bus_address(pdev, ll_block->bar); + ll_region->paddr =3D dw_edma_get_phys_addr(pdev, vsec_data, + ll_block->bar); ll_region->paddr +=3D ll_block->off; ll_region->sz =3D ll_block->sz; =20 @@ -392,12 +407,13 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, return -ENOMEM; =20 dt_region->vaddr.io +=3D dt_block->off; - dt_region->paddr =3D pci_bus_address(pdev, dt_block->bar); + dt_region->paddr =3D dw_edma_get_phys_addr(pdev, vsec_data, + dt_block->bar); dt_region->paddr +=3D dt_block->off; dt_region->sz =3D dt_block->sz; } =20 - for (i =3D 0; i < chip->ll_rd_cnt; i++) { + for (i =3D 0; i < chip->ll_rd_cnt && !non_ll; i++) { struct dw_edma_region *ll_region =3D &chip->ll_region_rd[i]; struct dw_edma_region *dt_region =3D &chip->dt_region_rd[i]; struct dw_edma_block *ll_block =3D &vsec_data->ll_rd[i]; @@ -408,7 +424,8 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, return -ENOMEM; =20 ll_region->vaddr.io +=3D ll_block->off; - ll_region->paddr =3D pci_bus_address(pdev, ll_block->bar); + ll_region->paddr =3D dw_edma_get_phys_addr(pdev, vsec_data, + ll_block->bar); ll_region->paddr +=3D ll_block->off; ll_region->sz =3D ll_block->sz; =20 @@ -417,7 +434,8 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, return -ENOMEM; =20 dt_region->vaddr.io +=3D dt_block->off; - dt_region->paddr =3D pci_bus_address(pdev, dt_block->bar); + dt_region->paddr =3D dw_edma_get_phys_addr(pdev, vsec_data, + dt_block->bar); dt_region->paddr +=3D dt_block->off; dt_region->sz =3D dt_block->sz; } diff --git a/drivers/dma/dw-edma/dw-hdma-v0-core.c b/drivers/dma/dw-edma/dw= -hdma-v0-core.c index e3f8db4..ee31c9a 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_core_ll_start(struct dw_edma_chunk *chunk, bool fir= st) { struct dw_edma_chan *chan =3D chunk->chan; struct dw_edma *dw =3D chan->dw; @@ -263,6 +263,65 @@ 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_core_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, HDMA_V0_CH_EN); + + /* 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); + + 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) + dw_hdma_v0_core_ll_start(chunk, first); + else + dw_hdma_v0_core_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/drivers/dma/dw-edma/dw-hdma-v0-regs.h b/drivers/dma/dw-edma/dw= -hdma-v0-regs.h index eab5fd7..7759ba9 100644 --- a/drivers/dma/dw-edma/dw-hdma-v0-regs.h +++ b/drivers/dma/dw-edma/dw-hdma-v0-regs.h @@ -12,6 +12,7 @@ #include =20 #define HDMA_V0_MAX_NR_CH 8 +#define HDMA_V0_CH_EN BIT(0) #define HDMA_V0_LOCAL_ABORT_INT_EN BIT(6) #define HDMA_V0_REMOTE_ABORT_INT_EN BIT(5) #define HDMA_V0_LOCAL_STOP_INT_EN BIT(4) diff --git a/include/linux/dma/edma.h b/include/linux/dma/edma.h index 3080747..78ce31b 100644 --- a/include/linux/dma/edma.h +++ b/include/linux/dma/edma.h @@ -99,6 +99,7 @@ struct dw_edma_chip { enum dw_edma_map_format mf; =20 struct dw_edma *dw; + bool non_ll; }; =20 /* Export to the platform drivers */ --=20 1.8.3.1