From nobody Thu Oct 2 13:00:49 2025 Received: from CY7PR03CU001.outbound.protection.outlook.com (mail-westcentralusazon11010057.outbound.protection.outlook.com [40.93.198.57]) (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 F06A9302758; Tue, 16 Sep 2025 10:43:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.198.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758019414; cv=fail; b=qUyXIG3dVK99sTMxgcUjBnf4y4i7x+CyRnwUjMUEh5DhXMoDjdCJOqSNDMzckhAIcFFwCBgBWj1Asw+9axcrOZ9R0oEjeH3h8tBX5sLC7vYu+Xl/XpLWvZhIaNPAdI4D+qh6eLiCI53TBjX2k4Mrz3vLO33bZVVE3hhxX8GwPDs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758019414; c=relaxed/simple; bh=GyNqAZ3ggVeSdwsVGrbp2FIiX0vexN5StiqXyNxoJr4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jwENpowvofD+xwto7xRhIbbmajSgJGiw7x+qY960VNDyzUvEB711O9P9J3mYZhYKWlJ1AF1RFCb+9d/KVk4vSP8LTchEDM8tmH38lLhfyInx+MZHwXP1RRyFiuY1YcJUndKiCrzJnotSalDljYRZluuojRplOu879iTwlQKp09g= 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=153Wrhsk; arc=fail smtp.client-ip=40.93.198.57 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="153Wrhsk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tz34GO6vYPGU6cdJzB6iNOm+XOe2KzcDlEqgATzfjYFZ3ePxI8ZuV+MspNC6gqZct+uPZoJh5KRsp57SEzhfZaK3P0l0/E30RuOjWj/3v4AgJzilJfXcY0knl4A7fBDz6STY5V4Q3WSUhADZ5dazjtkmquh4ZOSoQXWGOWGbCLjaAXDbFdWa+bBZHILRNjHrF68mUvFhZuE3MmAA/BV0wBw9g4Xhss3Uz3oWPR4LQLW0E/Uqw1aGpbqVsi5Af4LdJv2KvYSfFFQm1kBgkRuNNJwsNsTdebaM3xz8aU6KNSE5E5A+d8Sm84U7ssayZJh2+Ob+uUX+CKY5lCPG7a3LNQ== 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=7WJObh6/OoHgwaUDpoHNoY1a5IZxN6qlf/XU54rAKEk=; b=VhlLYHIzIGcANOlvvObWF8QO6ERghuniqD51/ymHJavp6HGtqSZBQF1rlBMhv3MsJNUYMJuOg8O68ymZftN3UN3KyCkkqHd4G+eVEucANDR3Yf1JLE3aNxQP7IrJD4oXVBUTzhDghwm0dyUIZ63SGCI06oPRUHYhW1WZYLrDoTIpWPlSZ9LYMRwUhXTTiphpueB5u5cjiVVeDOdW6EnkAIjeMEqrJmuC7TzRSOonV87586DFOfKtleL4u5kK9Es0d4oC5wCcx7O4kj/L4CApx9FLF5ax0nQ/zmlDYTbR/X8GvKNJ9ZOKOH4Zy/q1Podc+TcJxgIzw6jfeeKLJ3qWnQ== 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=7WJObh6/OoHgwaUDpoHNoY1a5IZxN6qlf/XU54rAKEk=; b=153Wrhskhp3xv1RAqeAfBwiWOdReQ1w6pmI8a+2s/9ewJDzIm9Y1oWwsqOrYn6HJ7tE/l4gMyOa0qGL7+fKkqdkoGUUvT+0fH1CJhGVzUFoJhNNtEBGTU3yxhpVQb6yVvoJ25FPMdvjbiOQQjHG8AFmmyfYwZYCKw/YQN49mZCg= Received: from BYAPR07CA0021.namprd07.prod.outlook.com (2603:10b6:a02:bc::34) by CY5PR12MB6383.namprd12.prod.outlook.com (2603:10b6:930:3d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9115.22; Tue, 16 Sep 2025 10:43:28 +0000 Received: from MWH0EPF000989E7.namprd02.prod.outlook.com (2603:10b6:a02:bc:cafe::7a) by BYAPR07CA0021.outlook.office365.com (2603:10b6:a02:bc::34) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9115.22 via Frontend Transport; Tue, 16 Sep 2025 10:43:28 +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=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by MWH0EPF000989E7.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9137.12 via Frontend Transport; Tue, 16 Sep 2025 10:43:28 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.17; Tue, 16 Sep 2025 03:43:27 -0700 Received: from satlexmb07.amd.com (10.181.42.216) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 16 Sep 2025 05:43:26 -0500 Received: from xhdapps-pcie2.xilinx.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.17 via Frontend Transport; Tue, 16 Sep 2025 03:43:24 -0700 From: Devendra K Verma To: , , CC: , , , Subject: [PATCH v2 1/2] dmaengine: dw-edma: Add AMD MDB Endpoint Support Date: Tue, 16 Sep 2025 16:13:18 +0530 Message-ID: <20250916104320.9473-2-devendra.verma@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250916104320.9473-1-devendra.verma@amd.com> References: <20250916104320.9473-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 Received-SPF: None (SATLEXMB05.amd.com: devendra.verma@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989E7:EE_|CY5PR12MB6383:EE_ X-MS-Office365-Filtering-Correlation-Id: 4fcdfb5e-0294-494f-0795-08ddf50ddf0c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?9CVy1CVDqgHuG3xYHqvDe3ARj6dYhZe/mrWqsEYzzHe6FiEhtOQTM66Kb1mu?= =?us-ascii?Q?4RUmxhiE7mPW1VIYTify+tOATTdrSOzA/Y0GoHlHKrBknaQtMvy6rSnPnBBl?= =?us-ascii?Q?cwAuiR7KX387uvK4o6FQQUVMNSti7PK+v+vs+mRr1ju7PjE1Ve832mU8AugG?= =?us-ascii?Q?CaXGEX956okauRJJQUoKWgdSwvOpA/JvRLo0SATzMtp8Fz3tVb6p5ywUzBXe?= =?us-ascii?Q?xu7IyEJkghCuGZ1SAsH3ah7GtCmc4nQmRRzgkzkSr7sA59YMhtVYDMIJCG+e?= =?us-ascii?Q?ppmyR2TrB5hkb5TxAyLi1W3qVn0X3jTs7PVP21k2Y15WbZInS4oFSb0Qy10O?= =?us-ascii?Q?4slMQ/TC3K1kFtkWNv0mhqg9qQ7y2VBHJkV0CEMPcsUAK4rz0Jw/RN+ES5La?= =?us-ascii?Q?HSa4lLUon8+ag2CsJwOv7kdXq3XT0NT1ZXHVp9CZov6MUx5rBYbSZFMD5ZZH?= =?us-ascii?Q?S1JBvyK4/wf3s65eT61FxoJPD+08uq1SXbVhUUW58GeGnzQ6fZfX96kIWTB/?= =?us-ascii?Q?TbQjxHJLpglNlOzHwt2V8OX2Q8O83PaMrwfTSsDr/dBkdyDvsGbpkrInSjEC?= =?us-ascii?Q?P7utPtCDFTBh2iLeUz4Ns2X1I11UTff3RJELtgX2LxlOOvxdHljLCxd54TWP?= =?us-ascii?Q?BXkUNK7lwYkEFohdOOmS8RGvgLlRvUwpzzcrihffIpMZuwdBezZLvdZcm/AZ?= =?us-ascii?Q?7c/8z0C6TLL4t7GFqnozD0PILue00BV7Nr/zw+AQYtGAGj+v8H7g5a9cjbg6?= =?us-ascii?Q?KMrKZ6L0fifiyZLEb4GHAtECNPtU+GSczI9IgfCLZ/QkW+Zmf8BgMABVEtRC?= =?us-ascii?Q?wIj0A1+IqlA4bNXrVFpipir5fBil9tCqsmZLcWRUvmA5imGespfKUJfWppUg?= =?us-ascii?Q?WK7mgB3WOBdf+SRdIitJ9HOI9Z/givj+xuv/T+mX0U3pflArWzU+Dw9HHtm1?= =?us-ascii?Q?GDo0OyCF++TWN0ZmDgabn4D1G6GdoNBXEL0ZIWnK91tSOncjeTEuP1M4/zDh?= =?us-ascii?Q?Lejh6sPrZ/EnMsDgFVooqQnhjtMRvS8CaLJf8pADdaFNwFtdQojt4OUF/t4A?= =?us-ascii?Q?xnaVdM20Gmmmh2VCNu7OLV8DNZEfjMCmKg01bqIvuZ+nlGCHU55JJfw0k4Va?= =?us-ascii?Q?2m/Vm9cJThHxThm2YD8S58ZlYRer9lhooo5SVTJp7RglMVg4v6XGxjZpsrr6?= =?us-ascii?Q?facwPFFKoJaoIC99Yi5RM155QidjKUwE8Rh4VBKpX0TJIIul4Cs5Wi9rakkq?= =?us-ascii?Q?I9B90O9PGbUSgAAbpaPyKrPa7+wNt9pJaGhm5fCtQC/NJqfP2cSu39ute2HK?= =?us-ascii?Q?YNP/17A/EuJa5W1UxLeV7nP7xkviVNOPep6CLLvIcsNqqEiGUCiZ3KuG54VC?= =?us-ascii?Q?XwLJPsLTtaorleMdLYFBLgRRjdX6/UgDmIzxPN4B28z6tnhbSVOMQnv/CckR?= =?us-ascii?Q?MNUuDBnfTOncnKfA49st0zNmZ/VU8t9rtMC8IBJ/IGVVoSWip1mrnvKI1dAv?= =?us-ascii?Q?v3Wlttd3JQBBZeiA84IYQBf3GrKY8LpfFLhl?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2025 10:43:28.0629 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4fcdfb5e-0294-494f-0795-08ddf50ddf0c 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6383 Content-Type: text/plain; charset="utf-8" AMD MDB PCIe endpoint support. For AMD specific support added the following - AMD supported PCIe Device IDs and Vendor ID (Xilinx). - AMD MDB specific driver data - AMD MDB specific VSEC capability to retrieve the device DDR base address. Signed-off-by: Devendra K Verma --- Changes in v2: Reverted the devmem_phys_off type to u64. Renamed the function appropriately to suit the functionality for setting the LL & data region offsets. Changes in v1: Removed the pci device id from pci_ids.h file. Added the vendor id macro as per the suggested method. Changed the type of the newly added devmem_phys_off variable. Added to logic to assign offsets for LL and data region blocks in case more number of channels are enabled than given in amd_mdb_data struct. --- drivers/dma/dw-edma/dw-edma-pcie.c | 147 +++++++++++++++++++++++++++++++++= +++- 1 file changed, 145 insertions(+), 2 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-pcie.c b/drivers/dma/dw-edma/dw-ed= ma-pcie.c index 3371e0a7..50f8002 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -17,12 +17,19 @@ =20 #include "dw-edma-core.h" =20 +/* Synopsys */ #define DW_PCIE_VSEC_DMA_ID 0x6 #define DW_PCIE_VSEC_DMA_BAR GENMASK(10, 8) #define DW_PCIE_VSEC_DMA_MAP GENMASK(2, 0) #define DW_PCIE_VSEC_DMA_WR_CH GENMASK(9, 0) #define DW_PCIE_VSEC_DMA_RD_CH GENMASK(25, 16) =20 +/* AMD MDB specific defines */ +#define DW_PCIE_XILINX_MDB_VSEC_DMA_ID 0x6 +#define DW_PCIE_XILINX_MDB_VSEC_ID 0x20 +#define PCI_DEVICE_ID_AMD_MDB_B054 0xb054 +#define DW_PCIE_AMD_MDB_INVALID_ADDR (~0ULL) + #define DW_BLOCK(a, b, c) \ { \ .bar =3D a, \ @@ -50,6 +57,7 @@ struct dw_edma_pcie_data { u8 irqs; u16 wr_ch_cnt; u16 rd_ch_cnt; + u64 devmem_phys_off; }; =20 static const struct dw_edma_pcie_data snps_edda_data =3D { @@ -90,6 +98,91 @@ struct dw_edma_pcie_data { .rd_ch_cnt =3D 2, }; =20 +static const struct dw_edma_pcie_data amd_mdb_data =3D { + /* MDB registers location */ + .rg.bar =3D BAR_0, + .rg.off =3D 0x00001000, /* 4 Kbytes */ + .rg.sz =3D 0x00002000, /* 8 Kbytes */ + /* MDB memory linked list location */ + .ll_wr =3D { + /* Channel 0 - BAR 2, offset 0 Mbytes, size 2 Kbytes */ + DW_BLOCK(BAR_2, 0x00000000, 0x00000800) + /* Channel 1 - BAR 2, offset 2 Mbytes, size 2 Kbytes */ + DW_BLOCK(BAR_2, 0x00200000, 0x00000800) + }, + .ll_rd =3D { + /* Channel 0 - BAR 2, offset 4 Mbytes, size 2 Kbytes */ + DW_BLOCK(BAR_2, 0x00400000, 0x00000800) + /* Channel 1 - BAR 2, offset 6 Mbytes, size 2 Kbytes */ + DW_BLOCK(BAR_2, 0x00600000, 0x00000800) + }, + /* MDB memory data location */ + .dt_wr =3D { + /* Channel 0 - BAR 2, offset 8 Mbytes, size 2 Kbytes */ + DW_BLOCK(BAR_2, 0x00800000, 0x00000800) + /* Channel 1 - BAR 2, offset 9 Mbytes, size 2 Kbytes */ + DW_BLOCK(BAR_2, 0x00900000, 0x00000800) + }, + .dt_rd =3D { + /* Channel 0 - BAR 2, offset 10 Mbytes, size 2 Kbytes */ + DW_BLOCK(BAR_2, 0x00a00000, 0x00000800) + /* Channel 1 - BAR 2, offset 11 Mbytes, size 2 Kbytes */ + DW_BLOCK(BAR_2, 0x00b00000, 0x00000800) + }, + /* Other */ + .mf =3D EDMA_MF_HDMA_NATIVE, + .irqs =3D 1, + .wr_ch_cnt =3D 2, + .rd_ch_cnt =3D 2, +}; + +static void dw_edma_set_chan_region_offset(struct dw_edma_pcie_data *pdata, + enum pci_barno bar, off_t start_off, + off_t off_gap, size_t size) +{ + u16 i; + off_t off; + u16 wr_ch =3D pdata->wr_ch_cnt; + u16 rd_ch =3D pdata->rd_ch_cnt; + + if (wr_ch <=3D 2 || rd_ch <=3D 2) + return; + + off =3D start_off; + + /* Write channel LL region */ + for (i =3D 0; i < wr_ch; i++) { + pdata->ll_wr[i].bar =3D bar; + pdata->ll_wr[i].off =3D off; + pdata->ll_wr[i].sz =3D size; + off +=3D off_gap + size; + } + + /* Read channel LL region */ + for (i =3D 0; i < rd_ch; i++) { + pdata->ll_rd[i].bar =3D bar; + pdata->ll_rd[i].off =3D off; + pdata->ll_rd[i].sz =3D size; + off +=3D off_gap + size; + } + + /* Write channel data region */ + for (i =3D 0; i < wr_ch; i++) { + pdata->dt_wr[i].bar =3D bar; + pdata->dt_wr[i].off =3D off; + pdata->dt_wr[i].sz =3D size; + off +=3D off_gap + size; + } + + /* Read channel data region */ + for (i =3D 0; i < rd_ch; i++) { + pdata->dt_rd[i].bar =3D bar; + pdata->dt_rd[i].off =3D off; + pdata->dt_rd[i].sz =3D size; + off +=3D off_gap + size; + } +} + static int dw_edma_pcie_irq_vector(struct device *dev, unsigned int nr) { return pci_irq_vector(to_pci_dev(dev), nr); @@ -120,9 +213,22 @@ static void dw_edma_pcie_get_vsec_dma_data(struct pci_= dev *pdev, u32 val, map; u16 vsec; u64 off; + u16 vendor =3D pdev->vendor; + int cap; =20 - vsec =3D pci_find_vsec_capability(pdev, PCI_VENDOR_ID_SYNOPSYS, - DW_PCIE_VSEC_DMA_ID); + /* + * Synopsys and AMD (Xilinx) use the same VSEC ID for the purpose + * of map, channel counts, etc. + */ + if (vendor !=3D PCI_VENDOR_ID_SYNOPSYS || + vendor !=3D PCI_VENDOR_ID_XILINX) + return; + + cap =3D DW_PCIE_VSEC_DMA_ID; + if (vendor =3D=3D PCI_VENDOR_ID_XILINX) + cap =3D DW_PCIE_XILINX_MDB_VSEC_ID; + + vsec =3D pci_find_vsec_capability(pdev, vendor, cap); if (!vsec) return; =20 @@ -155,6 +261,24 @@ static void dw_edma_pcie_get_vsec_dma_data(struct pci_= dev *pdev, off <<=3D 32; off |=3D val; pdata->rg.off =3D off; + + /* AMD specific VSEC capability */ + vsec =3D pci_find_vsec_capability(pdev, vendor, + DW_PCIE_XILINX_MDB_VSEC_ID); + if (!vsec) + return; + + pci_read_config_dword(pdev, vsec + PCI_VNDR_HEADER, &val); + if (PCI_VNDR_HEADER_ID(val) !=3D 0x20 || + PCI_VNDR_HEADER_REV(val) !=3D 0x1) + return; + + pci_read_config_dword(pdev, vsec + 0xc, &val); + off =3D val; + pci_read_config_dword(pdev, vsec + 0x8, &val); + off <<=3D 32; + off |=3D val; + pdata->devmem_phys_off =3D off; } =20 static int dw_edma_pcie_probe(struct pci_dev *pdev, @@ -179,6 +303,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, } =20 memcpy(vsec_data, pdata, sizeof(struct dw_edma_pcie_data)); + vsec_data->devmem_phys_off =3D DW_PCIE_AMD_MDB_INVALID_ADDR; =20 /* * Tries to find if exists a PCIe Vendor-Specific Extended Capability @@ -186,6 +311,22 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, */ dw_edma_pcie_get_vsec_dma_data(pdev, vsec_data); =20 + if (pdev->vendor =3D=3D PCI_VENDOR_ID_XILINX) { + /* + * There is no valid address found for the LL memory + * space on the device side. + */ + if (vsec_data->devmem_phys_off =3D=3D DW_PCIE_AMD_MDB_INVALID_ADDR) + return -EINVAL; + + /* + * 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, 0x200000, 0x800); + } + /* Mapping PCI BAR regions */ mask =3D BIT(vsec_data->rg.bar); for (i =3D 0; i < vsec_data->wr_ch_cnt; i++) { @@ -367,6 +508,8 @@ static void dw_edma_pcie_remove(struct pci_dev *pdev) =20 static const struct pci_device_id dw_edma_pcie_id_table[] =3D { { PCI_DEVICE_DATA(SYNOPSYS, EDDA, &snps_edda_data) }, + { PCI_VDEVICE(XILINX, PCI_DEVICE_ID_AMD_MDB_B054), + (kernel_ulong_t)&amd_mdb_data }, { } }; MODULE_DEVICE_TABLE(pci, dw_edma_pcie_id_table); --=20 1.8.3.1 From nobody Thu Oct 2 13:00:49 2025 Received: from CH4PR04CU002.outbound.protection.outlook.com (mail-northcentralusazon11013012.outbound.protection.outlook.com [40.107.201.12]) (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 61B9D304BBE; Tue, 16 Sep 2025 10:43:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.201.12 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758019417; cv=fail; b=iHYsFM14HWzs3QBeCUfb7OQNQclB2ujEovJ3VVSYrlpViQz+WH5M9CxflVh4wHVqSP+3eGvljEmw1QVVL7EzbbPVINYNWSVXMjhmMbOFLMbNTIBHO+vDFPGEQObh3S0wsLXntaWrRL5Hi1IA6l0mqaND/vqAAS/VJaBB05Pm1ZA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758019417; c=relaxed/simple; bh=FoMjDkXvd/oT1Sa7ZiX9+QrF1nwusjmlyLQd1dmxm1M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LwSXjHPo6fgUnWaP377bQfnFbqrx7JvhZ9xCbe2NI8dC3+ZUKJgfpG2//3G/0EZ3/26TDkUpKdm+7NYOYLeTCNKnSNcdGIVb5H6qOSvrZZV7IB0B0If3RF6Oo5Ohc07jI73CVW/EyFOx1ctAr7rYn4ozqS34/0/q0vYD6AzsRNc= 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=FkQhI2QZ; arc=fail smtp.client-ip=40.107.201.12 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="FkQhI2QZ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xa82SUI5Y27b45Tf+krq5jORJxbHyHCAliOriVso+BPOvLIviM1SioXk0zNEkO+yFu8WU4a86+1hwo15yv12yVRyt6A6GlBuNrCRQ+lHDj2HOWs6WQIOQouqiSMmM5R+aqah3i4u1SGVkPOgF3LZQuJIRV7Y0/Y8GO4dnVBEOfYKZon30igG260taVm+frArp10n5eLIbXTr7qkdldgfTotsURh1Y9LgcqROsHlaSi1cDVaURTT+aYCz3KAFqSt23W5+b0nouwrGwBrxyjELnYf+n98sx30bTsKO0e0jb+X2N16yjuzBjgyaw9BXFXivDS6MgXjxeivhjSSIr2/uaQ== 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=0V/QvXP/dRi3eYLXsSuOmHix5yehVqk3GeWRDHfHIMQ=; b=trD+bX+qVft1vMMCiee+ys4Z9wCgnqZrgQYilDXzBFQfJDHpr4wbD+lVN+Pbo1ATL68X0YM4XJcDyuQpGaqTHE+wH2jAlzlryBYxc0APDdiI5kmvUm0XJgCdKZstqixhhs9Cf+SttXdv5oITzQx0GPqT/HdagzvtYkHNlGE5GO0HqpqfDnWDo1wUyNZCq23x4a6bvkAnqNVxaeTlSVM/dw6ZjuH7DcZxXuIKVye5HXut4K8/RfhqOZyvzA6Bdlfj983/WJY3YHtUPqAWCsbM8oBu7dqhGMVgcwWdbK4KZdzYzUpVNTjF3YYU8Pygbj+jaVYkZC3VayqTfD7Y0j5Iew== 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=0V/QvXP/dRi3eYLXsSuOmHix5yehVqk3GeWRDHfHIMQ=; b=FkQhI2QZ+ErTnEFJ5F1y6nCz+FPsvA5XCrXuPJTTPV/JWCIpbwUnwZhd4I+MiDZAvfiUGWCb/W7uISznW8ZAUppjpDiywH71rPBJ0bYCxgWxyvIT3shJucRmhSR+k4NLVtD+NEmGdxZs5N/OxJjMiibveE3f94ymDoej7o2l4Xs= Received: from BYAPR07CA0020.namprd07.prod.outlook.com (2603:10b6:a02:bc::33) by DS4PR12MB9748.namprd12.prod.outlook.com (2603:10b6:8:29e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9115.22; Tue, 16 Sep 2025 10:43:31 +0000 Received: from MWH0EPF000989E7.namprd02.prod.outlook.com (2603:10b6:a02:bc:cafe::4d) by BYAPR07CA0020.outlook.office365.com (2603:10b6:a02:bc::33) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9115.21 via Frontend Transport; Tue, 16 Sep 2025 10:43:30 +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=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by MWH0EPF000989E7.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9137.12 via Frontend Transport; Tue, 16 Sep 2025 10:43:30 +0000 Received: from Satlexmb09.amd.com (10.181.42.218) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Tue, 16 Sep 2025 03:43:30 -0700 Received: from satlexmb07.amd.com (10.181.42.216) by satlexmb09.amd.com (10.181.42.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Tue, 16 Sep 2025 03:43:29 -0700 Received: from xhdapps-pcie2.xilinx.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.17 via Frontend Transport; Tue, 16 Sep 2025 03:43:27 -0700 From: Devendra K Verma To: , , CC: , , , Subject: [PATCH v2 2/2] dmaengine: dw-edma: Add non-LL mode Date: Tue, 16 Sep 2025 16:13:19 +0530 Message-ID: <20250916104320.9473-3-devendra.verma@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250916104320.9473-1-devendra.verma@amd.com> References: <20250916104320.9473-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: MWH0EPF000989E7:EE_|DS4PR12MB9748:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b132f78-d5ed-417c-bad6-08ddf50de09a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?H5Y2+qT8uFZZHpV3eACmZE0tuyVWDcBqmLln31cNUexTxCtp5sMrZ9d7PidW?= =?us-ascii?Q?cEbIHaJYUoY9dJ2f8efIKqpoUofAqctp+efClwQP46jK8ZajmwmjZY0y27zZ?= =?us-ascii?Q?2xKBaoHxxPQKMRNfRTv4Nv5EtCtOXACqjLZErizqVi4UP/2XTwQaVQ2P4Xdt?= =?us-ascii?Q?Rlz9R00mYxZQvVPKk+nLxmSffwhoBvoelpqp1YVJ5jqAmLCVT5uNBpEP9lPx?= =?us-ascii?Q?1Ekk3GMi4Vgnb3KuIWmxBCyHCie05Lq25zVUDW0ugPseMMN95PzdGQDTxry3?= =?us-ascii?Q?Xx2K42BoRjd7fYiHl8p5kDMROwzs3nZ+VSz2Y+VX+ftBs9FiLklSoU08mLX8?= =?us-ascii?Q?wCEmfSvRVxtQHaxuul+m+Z2CS6nFPSVahFzWm+U0O3vNXI6oa8q3yLyswKAo?= =?us-ascii?Q?iK2o63eFc1sZvGj5LlCoOvwstA5IXe0gZhJKoDKRCAclGr6XF5RDnDAm021/?= =?us-ascii?Q?llITi2b36KN2hoMUMxbsoCd33xITsCNW3xiQAycgx9JM1cg/G/P6gH/4pD7T?= =?us-ascii?Q?rYj7P/x4jg6A5Pav18cwoZiWplCTTnHSbisfDEw3sjpq5txIoGSNMyONltAA?= =?us-ascii?Q?kv9qA6mkB76cCiRzldjZ8WAqhbMQw1T65LV+kgh+QBCuEIWblBPeEgBn1k97?= =?us-ascii?Q?+6z7KfknmxkgiIgPTjeo4OIWdBlKx0ZcSdn/gqD2qCQWtPSoMJqWqFBY23AM?= =?us-ascii?Q?AP+4JNzsggsDiAxFkMRk3/ngjMVOsX9HE9iqq6ShS1YFFtV4Qd/g9dOaDEeA?= =?us-ascii?Q?hPUokvxYYVz5vJKhyc5NZXf01iFRvQdwnT7eqV+Mh5K9fYxRiPQyUOgegPn8?= =?us-ascii?Q?ta8erxetDT6Jfa9JFx2OlytoSWVRjoTesT9HlZYM0FDaz/r6kn762ucGofI+?= =?us-ascii?Q?Xpzwxu7sSetgmppN+MF6H/MUh+Sqq2EHBr/f3PsjcV86bOzdS2TG2iHR2UFE?= =?us-ascii?Q?rsHsAP5+JdPkgJYchm97Ykz67rNLDgeYWmBJ95yOSxcMkmFk7DOWgwa3vslN?= =?us-ascii?Q?QfBllWmTI+6XT8FfOHi2tqjZ+98bucJw7iolpUyoNRJq345slbUSRnRWyO7K?= =?us-ascii?Q?0x8Giu8W3Ux0royAiThlyd4gL6FSRC3AAfn94qMyxo9suIX2Ho54mHZOzNxM?= =?us-ascii?Q?wSEf+qnoPMLFOiN261dDIPmH2azMCJaCjBvsh3WGbqlAX59HDbPnMSO+l3M2?= =?us-ascii?Q?iO+6LkfV6zW4Q6UTBFEWH4RA56pEr6wk5rZQK5ZBuzQZt8LwKu2uyk3Lt3f+?= =?us-ascii?Q?uAQzqevqfuc39OJp3l8IFNiSgZQR2M1xhoKUDDw9y28/YXolq4lUFkLyZaSi?= =?us-ascii?Q?xISbrL6etRCeJibX+9+Y0QwVKGssCU4WqB4mmsTKVMN5oX8WrXHO2lO0lTBG?= =?us-ascii?Q?1cgXneuEm02Gb9hqCuQdbNRDO7FNd+9wtQyzgXKwdrT6aHqRx0KB0LKKL1a1?= =?us-ascii?Q?jwsk/z6ZYuognaig2yWBALCjdnCYykaW6K6pZQuDETtnp/dcVO6XHH6iLwtZ?= =?us-ascii?Q?OjZ/FyEDYyQUxv5msCSPOl2NfyKGqL4qcJOT?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2025 10:43:30.6759 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b132f78-d5ed-417c-bad6-08ddf50de09a 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS4PR12MB9748 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. Signed-off-by: Devendra K Verma --- 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 | 38 ++++++++++++++++++--- drivers/dma/dw-edma/dw-edma-core.h | 1 + drivers/dma/dw-edma/dw-edma-pcie.c | 37 ++++++++++++++++----- drivers/dma/dw-edma/dw-hdma-v0-core.c | 62 +++++++++++++++++++++++++++++++= +++- include/linux/dma/edma.h | 1 + 5 files changed, 124 insertions(+), 15 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-ed= ma-core.c index b43255f..3283ac5 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -223,8 +223,28 @@ 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 nollp =3D 0; + + if (WARN_ON(config->peripheral_config && + config->peripheral_size !=3D sizeof(int))) + 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) + nollp =3D *(int *)config->peripheral_config; + + chan->nollp =3D false; + if (chan->dw->chip->nollp || (!chan->dw->chip->nollp && nollp)) + chan->nollp =3D true; + chan->configured =3D true; =20 return 0; @@ -353,7 +373,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 +439,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->nollp) { + 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 +472,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->nollp) { 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..2a4ad45 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 nollp; }; =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 50f8002..4d367560 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -281,6 +281,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) { @@ -290,6 +299,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, struct dw_edma_chip *chip; int err, nr_irqs; int i, mask; + bool nollp =3D false; =20 vsec_data =3D kmalloc(sizeof(*vsec_data), GFP_KERNEL); if (!vsec_data) @@ -314,17 +324,21 @@ 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 -EINVAL; + nollp =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, 0x200000, 0x800); + if (!nollp) + dw_edma_set_chan_region_offset(vsec_data, BAR_2, 0, + 0x200000, 0x800); } =20 /* Mapping PCI BAR regions */ @@ -372,6 +386,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->nollp =3D nollp; =20 chip->ll_wr_cnt =3D vsec_data->wr_ch_cnt; chip->ll_rd_cnt =3D vsec_data->rd_ch_cnt; @@ -380,7 +395,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 && !nollp; 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]; @@ -391,7 +406,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 @@ -400,12 +416,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 && !nollp; 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]; @@ -416,7 +433,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 @@ -425,7 +443,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..befb9e0 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,66 @@ 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, 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->nollp) + 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/include/linux/dma/edma.h b/include/linux/dma/edma.h index 3080747..e14e16f 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 nollp; }; =20 /* Export to the platform drivers */ --=20 1.8.3.1