From nobody Tue Sep 9 21:28:49 2025 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2041.outbound.protection.outlook.com [40.107.220.41]) (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 DB8A72D63F6; Fri, 5 Sep 2025 10:17:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757067438; cv=fail; b=NKnSOjOPbmypnjuzVoV3loR4w63/5W0czps2TRAoujXkdUoqJb1SwHIMDOG0KQiTo1fE5m+k4ynN5Dw4w2Y6tBGkgcMyBC8sqkYkmU4+EpQCYLtu9mEUSfhznJVMmcnBzzemuqmSpO6gaS2bv/nkPg9eyQYZ+t8eRpD1xu3gNUA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757067438; c=relaxed/simple; bh=jguEZrlkhkRTGYDjyQCC5WnBbSUCyod24CJP24hn1PU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=R2S4fGJa+MVmT2SobSGHWY23JEM1Hc9jKFhVleI2qD49CT6P2L32fDk1keNBWTrr+JUWW6hhC693xOPQtk7DdHSaTVIRkKolMTdc8fApxN1+llZHSp0VBcVBbnJrb9M/5npSeH8EJ5DdvvdvfILstiZNjmZQJThhEnuEqGWtO7k= 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=FiF5fDgg; arc=fail smtp.client-ip=40.107.220.41 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="FiF5fDgg" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OzZWlS2MqPgI7cLBG+bmsOILqYw4mMWr0indra19wy44ZwQuOh7MIk8kXx5YvN9DQ4/03HOx1GbrAKO7zmCYAgONExwdvZGOTNn5CHU/Nngph4IaM07zlmSe24zh0CmZR6lzrIlN9yW6BFTJpRgbP2V0wp8pWIQ9IFxP89/VTwWIn8IOw1YNiazZ7tWHfC8zmKoGTZY0UAlWYdZ7OBDivY4YNLEC61u82M6XWnaxWpfvzHr5S8d/8pEsWTCkc48kzB5IAw6eaU8bp0otkOnYmTkVzbtvHMwwv+A7UcEy+rR1O97v8F65PnLm+8EcoK29k4Deu7t9oCWsl32pDogz2w== 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=bHdW5QQ3ZXgcjct3hiD4G7FhkX1gxvGMKABb0eL3Jfo=; b=jtjql7EYmLerLXulR5cU3GtKRlo6FhL0ssC3IxWGF37IOIogl6c7EmJdeUR9WUba50zqWYC7dRi/+ohNdQHOxzFG1s4PSKDMFXMkIgQ7VhOKg5ssyK/rAF+je4FozkNC5okCnNyee/gQEuFzhieTIKEzgdOiFUCFah2qBs4APD0RdBmw8fs7eCb/ajtzkJ5tE1TOngpyL0wblai1Dmedk42b9bSD3zFXythsjlGQXLMNnFWp0sJWca15i19Vr2v1UF2WJB1Ym0KEN0yGnfkZhaThdIESBFvrFv18F3Gcs4D6LNJqBXU+MRPQy59GLpxn4E2YRXroi98Vw/2cXroyLQ== 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=bHdW5QQ3ZXgcjct3hiD4G7FhkX1gxvGMKABb0eL3Jfo=; b=FiF5fDgg+Y68MhEkC0ScgJj13vUXOfdZ5GCY+7RfkUXWQOvfpgT1/2Qt0yZlQrp8L6hldlAE0DfUb2zdaOV4bGCdNaH5H8UqC2eBlf7DiiJBzBPRPD/dGlaV4EOVRhuPQk9kilO0brzjfiAKSzNue/VujUXo8zHD1bbR6TDDq3M= Received: from CH0P221CA0016.NAMP221.PROD.OUTLOOK.COM (2603:10b6:610:11c::18) by IA0PR12MB9048.namprd12.prod.outlook.com (2603:10b6:208:408::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9094.18; Fri, 5 Sep 2025 10:17:09 +0000 Received: from CH2PEPF0000013F.namprd02.prod.outlook.com (2603:10b6:610:11c:cafe::34) by CH0P221CA0016.outlook.office365.com (2603:10b6:610:11c::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9094.20 via Frontend Transport; Fri, 5 Sep 2025 10:17:09 +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 CH2PEPF0000013F.mail.protection.outlook.com (10.167.244.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.9094.14 via Frontend Transport; Fri, 5 Sep 2025 10:17:09 +0000 Received: from satlexmb10.amd.com (10.181.42.219) 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; Fri, 5 Sep 2025 05:17:05 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by satlexmb10.amd.com (10.181.42.219) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1748.10; Fri, 5 Sep 2025 03:17:04 -0700 Received: from xhdapps-pcie2.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; Fri, 5 Sep 2025 05:17:03 -0500 From: Devendra K Verma To: , , CC: , , , Subject: [PATCH 1/2] dmaengine: dw-edma: Add AMD MDB Endpoint Support Date: Fri, 5 Sep 2025 15:46:58 +0530 Message-ID: <20250905101659.95700-2-devendra.verma@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250905101659.95700-1-devendra.verma@amd.com> References: <20250905101659.95700-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: CH2PEPF0000013F:EE_|IA0PR12MB9048:EE_ X-MS-Office365-Filtering-Correlation-Id: ee0a7b10-61e9-40e9-ce84-08ddec655f5b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?CtIZigHSP+ExWK9/pEJ2qOFuF0l3t2aw4KNM6aKT/YKwW4JrqstVqVKSzDQ4?= =?us-ascii?Q?wU5mapG4Lx/E1njnm5NOYKBENNFT6rM8UpDde2MvghZU10VvOHwmfprR+j03?= =?us-ascii?Q?cs14nJGM600liFaAVssrqT5ZCluidmbHgXk2UXXBzajy4beePULab9DYUEdU?= =?us-ascii?Q?kDyUWRuQ5D17W7RFxFO0jTZy4V/jIPnlTupgT1w+sP/SWpuJC0nSfMEN7p0A?= =?us-ascii?Q?eLB8KybSztBS9Pvb3heHyGHIKdo4RFaffLc5S8gD8e7mYd7OsUrLQeu4bmoJ?= =?us-ascii?Q?zTWlJfpitJdzijCW0yG8tb0APuzIi9FcjZvMmJcVDS/0xq8fDlNjfeCwwUIN?= =?us-ascii?Q?yjRKAedidfkXwvRZrgyHURYQKaHNlaGz5iQBftKP21iCVTgvuL8kCHSCOspj?= =?us-ascii?Q?X/j4JnZFwl0A3jndxGViwUIy9PIdahAysSRGHGXFKDILscN8Sv65R1KN3rRx?= =?us-ascii?Q?p/u/0ANz1e5a+ZQxzJNVG36oKQ8ovimuoykO/EMCKqHYXjdE9zZilKHUkspl?= =?us-ascii?Q?2x8ANz9RURtXQMjBE3E+wRFgIuaGfCCECxCf7CYZGCCNyr+pn7Vfa1MCscHN?= =?us-ascii?Q?Ir9ffTfJ9155gCUhPe6ZM7ySYHN/nY0VePeBDSzsGcmECUIKJS2W2/pk7VxY?= =?us-ascii?Q?5o/hzg8cwxyRpMaclWiLDXr1JEKD23oon3SdyOSBFv1Nqtqf4WB+dMpusSLD?= =?us-ascii?Q?JFIDBH7XCJj6rz1zomC6eEA78Wp7vQtI64K57GsrWDgXH4v8UWqr1cuwh4Be?= =?us-ascii?Q?D0+fCO/NQP65AgOXZNTDFslkRATy1To/PU8vk0g+OL0+ZooUUWkgReou3zvR?= =?us-ascii?Q?3Ncota8bKwA7//TKfeVYMbq/6NqoaOFKqw6ICVnnxqcQdw2OhDQPjnksbTFA?= =?us-ascii?Q?8hMfxp8l3O11qGdSbB40q7KOCNMxFOTcCk/yEohAQo0fHrSJi/+0OO6kYTz4?= =?us-ascii?Q?u+WLjVshCyZkGbKdLpaYE2E02dxqDfHpCTtqtxxReI3iKxA0ZtDtl0czPajs?= =?us-ascii?Q?TKuRgUjPob9pXjLcy2nc/4WfL0ki1ogHGvNXw0Y6znYmWXqyKF9RPrgNW5Ia?= =?us-ascii?Q?VFXh9YpoQxTAq1WbkBvYeNZze9HeOK6Effhlclu6m5iQJqZakjkyddpYtM5+?= =?us-ascii?Q?vM30zPtO4uxTzHuYWIvmAmtjAGCwqJwK0AwH++b3IRhNalM+MbwRP43zJBHv?= =?us-ascii?Q?lZGoSvrDMM9qqMIYUDCVQVCatGoDCDJHgS+nVWzxzy/f2gqKyWDy4JnZi2cm?= =?us-ascii?Q?V2VU7yS/szjy5qmSc6k8zhFp3ermX+C78qn/0PkYSj1rgZo5batj9xBSTh8S?= =?us-ascii?Q?bn8I3V46l8htAulwGTXV7L7U4qwgJfMHC2PVrwQ2nl6qd6AgF780GUubniyV?= =?us-ascii?Q?GWctBSsApbOkFwnk8uFOGimZVwGsJ7WhpDEBgTrFn+FbdFnGjCe3oM4RHWOA?= =?us-ascii?Q?Nv2SCUmoAjJev9wWJE5whv2JHg7NYJ6zy+ROrt8sAbDzFwhqYCx+En+cB0TB?= =?us-ascii?Q?gyZ3Dxmy20UstENIkYDPgO9FuC2HpheXiErK?= 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)(36860700013)(1800799024)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2025 10:17:09.1625 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ee0a7b10-61e9-40e9-ce84-08ddec655f5b 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: CH2PEPF0000013F.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB9048 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 --- drivers/dma/dw-edma/dw-edma-pcie.c | 83 ++++++++++++++++++++++++++++++++++= +++- include/linux/pci_ids.h | 1 + 2 files changed, 82 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..749067b 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -18,10 +18,12 @@ #include "dw-edma-core.h" =20 #define DW_PCIE_VSEC_DMA_ID 0x6 +#define DW_PCIE_AMD_MDB_VSEC_ID 0x20 #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) +#define DW_PCIE_AMD_MDB_INVALID_ADDR (~0ULL) =20 #define DW_BLOCK(a, b, c) \ { \ @@ -50,6 +52,7 @@ struct dw_edma_pcie_data { u8 irqs; u16 wr_ch_cnt; u16 rd_ch_cnt; + u64 phys_addr; }; =20 static const struct dw_edma_pcie_data snps_edda_data =3D { @@ -90,6 +93,44 @@ 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 int dw_edma_pcie_irq_vector(struct device *dev, unsigned int nr) { return pci_irq_vector(to_pci_dev(dev), nr); @@ -120,9 +161,14 @@ static void dw_edma_pcie_get_vsec_dma_data(struct pci_= dev *pdev, u32 val, map; u16 vsec; u64 off; + u16 vendor; =20 - vsec =3D pci_find_vsec_capability(pdev, PCI_VENDOR_ID_SYNOPSYS, - DW_PCIE_VSEC_DMA_ID); + vendor =3D pdev->vendor; + if (vendor !=3D PCI_VENDOR_ID_SYNOPSYS && + vendor !=3D PCI_VENDOR_ID_XILINX) + return; + + vsec =3D pci_find_vsec_capability(pdev, vendor, DW_PCIE_VSEC_DMA_ID); if (!vsec) return; =20 @@ -155,6 +201,27 @@ 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 */ + if (vendor !=3D PCI_VENDOR_ID_XILINX) + return; + + vsec =3D pci_find_vsec_capability(pdev, vendor, + DW_PCIE_AMD_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->phys_addr =3D off; } =20 static int dw_edma_pcie_probe(struct pci_dev *pdev, @@ -179,6 +246,7 @@ static int dw_edma_pcie_probe(struct pci_dev *pdev, } =20 memcpy(vsec_data, pdata, sizeof(struct dw_edma_pcie_data)); + vsec_data->phys_addr =3D DW_PCIE_AMD_MDB_INVALID_ADDR; =20 /* * Tries to find if exists a PCIe Vendor-Specific Extended Capability @@ -186,6 +254,15 @@ 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->phys_addr =3D=3D DW_PCIE_AMD_MDB_INVALID_ADDR) + return -EINVAL; + } + /* Mapping PCI BAR regions */ mask =3D BIT(vsec_data->rg.bar); for (i =3D 0; i < vsec_data->wr_ch_cnt; i++) { @@ -367,6 +444,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); diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 92ffc43..c15607d 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -636,6 +636,7 @@ #define PCI_DEVICE_ID_AMD_HUDSON2_SMBUS 0x780b #define PCI_DEVICE_ID_AMD_HUDSON2_IDE 0x780c #define PCI_DEVICE_ID_AMD_KERNCZ_SMBUS 0x790b +#define PCI_DEVICE_ID_AMD_MDB_B054 0xb054 =20 #define PCI_VENDOR_ID_TRIDENT 0x1023 #define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 --=20 1.8.3.1 From nobody Tue Sep 9 21:28:49 2025 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2051.outbound.protection.outlook.com [40.107.96.51]) (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 47AD42D5C76; Fri, 5 Sep 2025 10:17:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757067436; cv=fail; b=FAiaL9PpflWlrgXYxhQorr6xUXuZ2LJEsO1Z9EhfTQIy83RbgqJfg1Ff+S3bH6EdnqSFOSJ4jzq/SRseHFJvGnvYuS1JYhX3E+zPU8P1W1XceRG839HxM3lMslxdI0XuzB5fcdV3NuHFtJTccOvJlXxfmtg3Ysbj6fvZu0hBrnk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757067436; c=relaxed/simple; bh=wWD+mnRV6mCK+dcuqaiPHeA9ISGamCu3I1trsibU49s=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=e0jUWflYREVKo6Zm7DT4UX2fi9pYIvXBrFhVZCpVztQysR93TQvNN+QLNkPLII2EjFLFXp+LVQ67Mzm6byEd45zGlUNGptwWntwbifZjasZvsoAeDKK0J9ZSLTs3e2dWT9gRsPcNVoPQ9bEMH3BKrBWGGe0diXhSZbf2NK1FJdw= 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=keSpYex2; arc=fail smtp.client-ip=40.107.96.51 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="keSpYex2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jIsBwVs6iwQrvo6Wuzq0Wy8Isn824Tcz+gJ/SbnqllPH2TnBhTBZnz8adyBTZgykMmIEf0Q0GgHnwJCaVKHhkQCEQf09aRgKiMfhlnRmmyCQp8mPgXmg0Kj03Qd08EiWw05JVvEaraQlHMiYmytM5f+2XPFQbHBNYVo58y9vCo5129vKeu+g+Y3Vw8FWFlAvgQv8r7hQpbgWYWpro++Myw2THhlh2fXB5oUnbPd1VMp2LBegi8fzMqInEKk0hyGpQ9ZfM3nhZOY03sizSleiYaV6e9EaCRDyU1//0DRa0Iy7K+JWR9EOuHvdBGAAOjOm5b4NfZekWNIVF50i1CoqNQ== 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=mTxcuQTZa2pfIUImq8GnsmsgUJbHX0hjUyjdSGih3jI=; b=poZzFD0iacNkKjzlt6Hb7OnmXZ55gGNyoLmnZLQKShqrqhjeZ0prgQLtSJ7FTh9k8CRtr1uSqXNUQSeLZsZA4cEUD2+UXEkkn/DXf09fKU8J1G8HObirQDOZCjo8vO4HSvqwnyxZPBO7oSds5A2CoBuYlL3+OXDmSq+ZYlkHIgaW/caVR98ZUzBhFOVRw0mVHAGakPJniYpmSlDhFUwmMltS8tOULawBe7e26qNV6rqHH4h4/cTEUKxDbdvolI4lj46kmrvan1zJLc69m1e7GWMxtRWJTQCEUxtyIV2CAN1yn/csZnJIbeOeKWbee1JWHRuQAjZhX9ouOCEkZfpLCw== 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=mTxcuQTZa2pfIUImq8GnsmsgUJbHX0hjUyjdSGih3jI=; b=keSpYex23YpoTDL0veAsFD4Yg6VOoyHdKXePsdhBNF+TNL90ytQoSHlWa9EMdH1UZNkN9iPxW6DLkD28bB/2EPUDE4JPs9A+zfZls4t56AGxzSsNcAmUgsdjZ1q80Dhs39OEwDPWyZcGqgKHAVOzJ11cn6+Tfswxijj60fcJ/kw= Received: from MW4PR03CA0334.namprd03.prod.outlook.com (2603:10b6:303:dc::9) by MW4PR12MB6706.namprd12.prod.outlook.com (2603:10b6:303:1e2::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9094.16; Fri, 5 Sep 2025 10:17:08 +0000 Received: from CY4PEPF0000E9D7.namprd05.prod.outlook.com (2603:10b6:303:dc:cafe::6c) by MW4PR03CA0334.outlook.office365.com (2603:10b6:303:dc::9) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9094.18 via Frontend Transport; Fri, 5 Sep 2025 10:16:58 +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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CY4PEPF0000E9D7.mail.protection.outlook.com (10.167.241.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.9094.14 via Frontend Transport; Fri, 5 Sep 2025 10:17:08 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 5 Sep 2025 05:17:07 -0500 Received: from xhdapps-pcie2.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; Fri, 5 Sep 2025 05:17:05 -0500 From: Devendra K Verma To: , , CC: , , , Subject: [PATCH 2/2] dmaengine: dw-edma: Add non-LL mode Date: Fri, 5 Sep 2025 15:46:59 +0530 Message-ID: <20250905101659.95700-3-devendra.verma@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250905101659.95700-1-devendra.verma@amd.com> References: <20250905101659.95700-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 (SATLEXMB03.amd.com: devendra.verma@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D7:EE_|MW4PR12MB6706:EE_ X-MS-Office365-Filtering-Correlation-Id: f51d3bc5-db34-4779-ae8e-08ddec655eca X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?aI8MmjegsmrpKuvHHIwxpInrCXQgBacmHOqn53PKaY5XHGpNOXdO1XTiy1RN?= =?us-ascii?Q?WuxDHSdGT/1/1d3mfMO27WRNCkrxZhjh+H9Qwmh51y0J2hQGfkxo+edQAsXV?= =?us-ascii?Q?m+iiVQwrkkfHTX6NAZVt24Okl/2J5cUgLNwcTgIe2sIEubcUsN3CpSzJMP2O?= =?us-ascii?Q?AtX7gW/yZJ17XLlZh8dMRgnKC/GnCQQWNx2julCzsmh+Z30xWElUA2VavFtR?= =?us-ascii?Q?t8hVNh4ak+2Xtwim8mQ6/ugYXkGzQ7CKRYx3FGMypQhJQKvjcSaixD/0tMUm?= =?us-ascii?Q?mc3Z5LAY/SjqDFVsChsGRkIxakY1MhrD7fxVrva9IDoyBi9LuUUtm/KM7CUQ?= =?us-ascii?Q?f5TYRJlL5iVskTvgYjcuRmVoeephJkymqrZGMi2rh/4lnpf2A9081bIGrYgX?= =?us-ascii?Q?6xv8j8/e4dmx42AiVb8bzUQJnys45Zd9TnJB+0cEiLUhHxRolUA5GT+3+hq4?= =?us-ascii?Q?yWCBWGynnBsTZCTh6WrEGeGUVmyUE/7CZToXjBfdLukgpIfaY3m3gKP9hSa4?= =?us-ascii?Q?swoh4n1mUGNuClJpao6CFlA13cXzxfaJUE7/DmDgliAemhlEWaqgpT0ouquP?= =?us-ascii?Q?WukE3T+LpNOIoPjrjdzKpVDPG6rjjOKfi2FZFmGHoM5c8NFVJ+fZWVIbLnYq?= =?us-ascii?Q?EXDFqQxLgtRI9+drqoM1lsHrXRE0/AWYTk1F9yZ6tsOO7IpF5v6Axk1zlNSl?= =?us-ascii?Q?TiG7LkDN0qWD3rXZtZ8Q97qslC7Eqy/3Gi7sb7f6Je3knme7Rx/rzKivY557?= =?us-ascii?Q?TtG1wWgDv9MNDlcCHn6aDR+rkpOHWZ86NAJZaDavBL8GGuAA9f343aW6CovF?= =?us-ascii?Q?mG6JClrlutFjIT7+MWSIqnaMzD7GDKXJbfAHQ2hwlACZi5KacmVvejL6iKj/?= =?us-ascii?Q?z2nETUC+Vy1Yj9w7Wl0sktEjdBmIye/bvoiSGKwQWosXfehlaDohO3KSWc3G?= =?us-ascii?Q?ywN3OItJwY0GHeI8etV5mItrqw9XlhSB9CrEutkzibXnTEqx18Nxw2thEQSz?= =?us-ascii?Q?54PoceondG9I0nd9cdVfnjCm/yCN6TiawZ74yKmCTIW/5VrpSxld5M2kqAJU?= =?us-ascii?Q?xm7zeOoyuTQ2qmSK4cw3fTEPowQsgBsx5luyYFld/EVIqNnDy9dRMntcmiun?= =?us-ascii?Q?Zhk8LGuW1xMte4XIKuizTTKmjL3Pm8SOUK7TD+7nw6zWkfaJVZOoJVGS1BVY?= =?us-ascii?Q?qrGeymwMEml27GqnsmNPnLqU9Zvz3TxFHrmmYKGdivsDMyKgdWk1oinjUe0G?= =?us-ascii?Q?roOOZehtncp6nnS6quRUkYjNZvRL1Kq3z9pbv8l9DylTwCcBasWKJc57Wksy?= =?us-ascii?Q?C7+vmODr2PTMekFA9TlRI9hsHF9/Gi5jfI6jA45TPgpIEtqLZO8xJVr5OE3n?= =?us-ascii?Q?mBBLowX4DrSgT37LVcoVPJwgI7FYL/QTHK387fwkALRx4CYWZNyRtLcGuh0i?= =?us-ascii?Q?GTZGmcalJbnWtMUF8OZQjYzUpml6c9d8aCu7ez/oHwGjn2IKpgdXBV/iS57c?= =?us-ascii?Q?vlwQugB7NLBawK26/EWzpUG+1VvghNQnzKu1?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2025 10:17:08.1769 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f51d3bc5-db34-4779-ae8e-08ddec655eca 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9D7.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6706 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 --- 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 | 33 ++++++++++++++----- drivers/dma/dw-edma/dw-hdma-v0-core.c | 62 +++++++++++++++++++++++++++++++= +++- include/linux/dma/edma.h | 1 + 5 files changed, 121 insertions(+), 14 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-ed= ma-core.c index b43255f..dbef571 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 the 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 749067b..0d6254f 100644 --- a/drivers/dma/dw-edma/dw-edma-pcie.c +++ b/drivers/dma/dw-edma/dw-edma-pcie.c @@ -224,6 +224,15 @@ static void dw_edma_pcie_get_vsec_dma_data(struct pci_= dev *pdev, pdata->phys_addr =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->phys_addr; + return pci_bus_address(pdev, bar); +} + static int dw_edma_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *pid) { @@ -233,6 +242,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) @@ -257,10 +267,12 @@ 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->phys_addr =3D=3D DW_PCIE_AMD_MDB_INVALID_ADDR) - return -EINVAL; + nollp =3D true; } =20 /* Mapping PCI BAR regions */ @@ -308,6 +320,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; @@ -316,7 +329,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]; @@ -327,7 +340,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 @@ -336,12 +350,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]; @@ -352,7 +367,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 @@ -361,7 +377,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