Message ID | 20240226-dw-hdma-v3-3-cfcb8171fc24@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-81290-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2014800dyb; Mon, 26 Feb 2024 03:46:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXC93n8+CZsQSQn5HsCuovMlCWaDwnARREf3XfX+KrdiByJXytnATu8UNCyCxsAFL6qxrgR53d2q2so7QqblsbBF3AxTg== X-Google-Smtp-Source: AGHT+IEgquhT1746Ml+eupD6MqzOPdfZpX9vUfSX/ZSn5vUb0komXDiYrtxk6Pfkvtnsx3qqmvUv X-Received: by 2002:aa7:de09:0:b0:566:13a2:3008 with SMTP id h9-20020aa7de09000000b0056613a23008mr741987edv.6.1708948002582; Mon, 26 Feb 2024 03:46:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708948002; cv=pass; d=google.com; s=arc-20160816; b=uD83qRABTcs0r8+gF/rRCJwuDkpYy46lCA+0bZrpuGIA0q9nRYbpdtIHPT9Mev44sK 3HkTW6x/s4I4TCpXBg5iDtHhi54nnDneYX0vxLn609kS4FUyuoO9NP0mZKLfz97DBAR6 aVEsESzcy9lfE/SLEEINA77c2ObV50DE8k43ShL5SkLhk6f7o6SahlWqQmn0UjiaDv+0 EN/ffnY4rnRJLsHYhjzMCSzD15a5JY2Jnkfw2yHX+QjCxqiyQ8A9Z1O/hmGFhmAssXXW 35BoxpPllD9m2nqbsuNmgjfHrRgekcFiE0UyI0wtmBT8Td4BOiWhYv3nH5BSM9B5OP1l wgwg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=4KNkTka0JljgsliYTECP2ewGRxvpOhNGNlugq+4lG+k=; fh=e5KZfqTTQSXbptI7Gx27tw4Z7PJAIdGEVReQo9Mzgmg=; b=fNtMHjVVFjDwX2QcFGKXd24O0uvc+DFVgZuZ4aFhz7bMiI5vUFDehR/xyS6Iv0EC9K deT9Tvli0RJr3y2g1EXsLWxb+mpKybR7D5hAXgRkxZ4dZtodN1nnjiPiBFYJ/fHiKMRn JIPpXAHkt+SivdQWHTXEeiUx18phnSzzHroOgeclPzHvpj52eR1+1Ny60qh/bErBXt7W oKvjbSiiGjomVV/+48PFIedby9d4c+Ly6wtkP6O3UDCWS0SG3WwZMZgq+iZfWhdDTsVf 8xVCG1EJkWLHdeEJ7FtMZys0VAOxIo0sktB5jUGzHv+SIlHd51pOLbKLyZj5c2Zjh+Au vbKA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gFgYjNmV; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-81290-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81290-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id z1-20020a05640240c100b005660b5007bdsi427719edb.109.2024.02.26.03.46.42 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 03:46:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81290-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gFgYjNmV; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-81290-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81290-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D2F921F2BAE5 for <ouuuleilei@gmail.com>; Mon, 26 Feb 2024 11:40:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 24BB14EB36; Mon, 26 Feb 2024 11:38:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="gFgYjNmV" Received: from mail-yw1-f182.google.com (mail-yw1-f182.google.com [209.85.128.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 250DD4D9E1 for <linux-kernel@vger.kernel.org>; Mon, 26 Feb 2024 11:38:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708947488; cv=none; b=NpRRxaHo876liGKHh7yPl2jEgPJrLWRf5Uz3WYYxlaMiu59nGt+yiMsCEOdI5osj5SmSJi686Rb88BioPrWQMWrJAmY1fmmEfBot7KyPTR5IRsCs7Z5mRw7WncNBf5erLV0ip8JKK558nygHANXftXnWQ+MOoxUSosMxbgNHalU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708947488; c=relaxed/simple; bh=Wy7LJuC8h0Gs3GX5VCOt1uxpsY9Nepi+sgqSN6HRB18=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EWf+9vUtimdF+xSo3i0H+bY/pprfwdbTtjXUO9UvjEKiaLuDrVhrIP7lDotGNq6yrCDOKATgLINB+mKDXbhdmCV3q0LWjxvW2PR8GTPYnZMvv12HDMDf6S4G9Hot/+Akk5sVdDGOvbePAco8lVoW/ErvtQu5khZhzLquSZt4V0M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=gFgYjNmV; arc=none smtp.client-ip=209.85.128.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yw1-f182.google.com with SMTP id 00721157ae682-608cf2e08f9so20738417b3.0 for <linux-kernel@vger.kernel.org>; Mon, 26 Feb 2024 03:38:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708947486; x=1709552286; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=4KNkTka0JljgsliYTECP2ewGRxvpOhNGNlugq+4lG+k=; b=gFgYjNmVfvkMsanBL7iuEBa9MJPmzzTOQHT/Kzar1HFeJdZmOFhNS9m80B8ncrONwh Pf6VkZIilEYSNkB7gIhUNUelrdIROPl5pwnysHlZTd0Ci1mptvsEAz72oPZ8+f7VmNuJ CPLX1pmC+O0B24ItFVSROZMJu+81m19qqEvwJt6t3JdtTjTy61PH9i1+OhzcwWUG6OvR iZvdsAb4KtW/Vwewcv4UlyOrWK3mGzaKGsq4MDQohak/c6k3VzwWw2FsFlt5L+dq76Zv PAPoTm4NcwXLhNcAdkRtWVWicU252LdRT8JV/J0qAj0sS5mVLv+Fy93GrZ7mH2e5FMd2 8LjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708947486; x=1709552286; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4KNkTka0JljgsliYTECP2ewGRxvpOhNGNlugq+4lG+k=; b=HfEpavqfNpN5t7/XfwaXqRRBZ1EEolN23Yvgp20XOnimZNWSyg5VbF3jbuIUwUt6WQ fjfI39yktF/qINEQARl8ZXAvdHQz9i1iwcGwahAeC5DfsP0xjGz3lnU9Xi/jh5YwMos7 AYYASV1JEyw8DOtZjO4iTz66XBt0wJbwN5ymVuUyS8iL41sI+zpbFGzbuObwb6luOcI0 Pscq/2xuKCNxbcEKljmwFtPigKwrNshiFX0Z8dDviNrzimywJXudaEpYQdOMkJA58rbS qlSV/ra1q+dmFXvTTDVo9sgZqWa826OCH4xr0p5Cz3dUOjqcGTbDV/FhA7PZm07YG5bB TK7A== X-Forwarded-Encrypted: i=1; AJvYcCXCNIONTgaEYVjZOVBsjdUz9T88TaAdZYuYvIoH3ezt1PLierpggT3flg24Yn0xqTLSwPhgPqrLtdP6oq3JgT2btxXVLIa5Je2b3sfH X-Gm-Message-State: AOJu0YzcPtJ4QhMvniWmakdkcGlYa/qhxCGKciB1tSpJuDJPHU8vwT9i akWYFq9LnHDZIiWjoWejCQBHmVua7lyo3tVFwWay67X7AUSvvuKp9dF90groGg== X-Received: by 2002:a81:4005:0:b0:608:d6d3:33fc with SMTP id l5-20020a814005000000b00608d6d333fcmr3975142ywn.34.1708947486073; Mon, 26 Feb 2024 03:38:06 -0800 (PST) Received: from [127.0.1.1] ([117.202.184.81]) by smtp.gmail.com with ESMTPSA id q15-20020a05620a0c8f00b007878babb96asm2341842qki.94.2024.02.26.03.38.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 03:38:05 -0800 (PST) From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Date: Mon, 26 Feb 2024 17:07:28 +0530 Subject: [PATCH v3 3/5] PCI: dwc: Pass the eDMA mapping format flag directly from glue drivers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240226-dw-hdma-v3-3-cfcb8171fc24@linaro.org> References: <20240226-dw-hdma-v3-0-cfcb8171fc24@linaro.org> In-Reply-To: <20240226-dw-hdma-v3-0-cfcb8171fc24@linaro.org> To: Jingoo Han <jingoohan1@gmail.com>, Gustavo Pimentel <gustavo.pimentel@synopsys.com>, Lorenzo Pieralisi <lpieralisi@kernel.org>, =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= <kw@linux.com>, Rob Herring <robh@kernel.org>, Bjorn Helgaas <bhelgaas@google.com>, Marek Vasut <marek.vasut+renesas@gmail.com>, Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>, Kishon Vijay Abraham I <kishon@kernel.org> Cc: Serge Semin <fancer.lancer@gmail.com>, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, mhi@lists.linux.dev, Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>, Siddharth Vadapalli <s-vadapalli@ti.com> X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=3372; i=manivannan.sadhasivam@linaro.org; h=from:subject:message-id; bh=Wy7LJuC8h0Gs3GX5VCOt1uxpsY9Nepi+sgqSN6HRB18=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBl3HgFbG62OQCkQ3VnNidmAAH0htQtC/tS8ex+O 2uHD4sYRe6JATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCZdx4BQAKCRBVnxHm/pHO 9S9CB/9MAYdgUSAUy/h0KZWWs19lAViTLux8j83QIpS/MERsfZXcfZQZ2sie4X4OgQttZjsEcMB P5NDfstxgjCk42dJuDOo2CcGMQ7lv1Kh8E4yX4+LufhRqXLlJUd6D+jSdcrmnvRfcxScvRkuQl5 +OjGmE/s6+i+bj9dWW7TrMv9FVceabxGEQCTx1ntGvkdc7taVTzoG9U6xvVuT8NwrGX8PELSJM8 h61+cg5x13hJe3Jp9TQrilsBuV/8HGm+OCI0orbl00Pz69HUF6vU73ikdJKISsluBi2hD2qDsCN fUWOIR7V0B+Ob2lxFgH5J7jNltgC6ZMa69CX7k84SFn1TgQ+ X-Developer-Key: i=manivannan.sadhasivam@linaro.org; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791961860882993191 X-GMAIL-MSGID: 1791961860882993191 |
Series |
PCI: dwc: Add support for integrating HDMA with DWC EP driver
|
|
Commit Message
Manivannan Sadhasivam
Feb. 26, 2024, 11:37 a.m. UTC
Instead of maintaining a separate capability for glue drivers that cannot support auto detection of the eDMA mapping format, let's pass the mapping format directly from them. This will simplify the code and also allow adding HDMA support that also doesn't support auto detection of mapping format. Suggested-by: Serge Semin <fancer.lancer@gmail.com> Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> --- drivers/pci/controller/dwc/pcie-designware.c | 16 +++++++++------- drivers/pci/controller/dwc/pcie-designware.h | 5 ++--- drivers/pci/controller/dwc/pcie-rcar-gen4.c | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-)
Comments
On Mon, Feb 26, 2024 at 05:07:28PM +0530, Manivannan Sadhasivam wrote: > Instead of maintaining a separate capability for glue drivers that cannot > support auto detection of the eDMA mapping format, let's pass the mapping > format directly from them. > > This will simplify the code and also allow adding HDMA support that also > doesn't support auto detection of mapping format. > > Suggested-by: Serge Semin <fancer.lancer@gmail.com> > Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Reviewed-by: Serge Semin <fancer.lancer@gmail.com> -Serge(y) > --- > drivers/pci/controller/dwc/pcie-designware.c | 16 +++++++++------- > drivers/pci/controller/dwc/pcie-designware.h | 5 ++--- > drivers/pci/controller/dwc/pcie-rcar-gen4.c | 2 +- > 3 files changed, 12 insertions(+), 11 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c > index ce273c3c5421..3e90b9947a13 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.c > +++ b/drivers/pci/controller/dwc/pcie-designware.c > @@ -894,18 +894,20 @@ static int dw_pcie_edma_find_mf(struct dw_pcie *pci) > { > u32 val; > > + /* > + * Bail out finding the mapping format if it is already set by the glue > + * driver. Also ensure that the edma.reg_base is pointing to a valid > + * memory region. > + */ > + if (pci->edma.mf != EDMA_MF_EDMA_LEGACY) > + return pci->edma.reg_base ? 0 : -ENODEV; > + > /* > * Indirect eDMA CSRs access has been completely removed since v5.40a > * thus no space is now reserved for the eDMA channels viewport and > * former DMA CTRL register is no longer fixed to FFs. > - * > - * Note that Renesas R-Car S4-8's PCIe controllers for unknown reason > - * have zeros in the eDMA CTRL register even though the HW-manual > - * explicitly states there must FFs if the unrolled mapping is enabled. > - * For such cases the low-level drivers are supposed to manually > - * activate the unrolled mapping to bypass the auto-detection procedure. > */ > - if (dw_pcie_ver_is_ge(pci, 540A) || dw_pcie_cap_is(pci, EDMA_UNROLL)) > + if (dw_pcie_ver_is_ge(pci, 540A)) > val = 0xFFFFFFFF; > else > val = dw_pcie_readl_dbi(pci, PCIE_DMA_VIEWPORT_BASE + PCIE_DMA_CTRL); > diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h > index 26dae4837462..995805279021 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.h > +++ b/drivers/pci/controller/dwc/pcie-designware.h > @@ -51,9 +51,8 @@ > > /* DWC PCIe controller capabilities */ > #define DW_PCIE_CAP_REQ_RES 0 > -#define DW_PCIE_CAP_EDMA_UNROLL 1 > -#define DW_PCIE_CAP_IATU_UNROLL 2 > -#define DW_PCIE_CAP_CDM_CHECK 3 > +#define DW_PCIE_CAP_IATU_UNROLL 1 > +#define DW_PCIE_CAP_CDM_CHECK 2 > > #define dw_pcie_cap_is(_pci, _cap) \ > test_bit(DW_PCIE_CAP_ ## _cap, &(_pci)->caps) > diff --git a/drivers/pci/controller/dwc/pcie-rcar-gen4.c b/drivers/pci/controller/dwc/pcie-rcar-gen4.c > index e9166619b1f9..3c535ef5ea91 100644 > --- a/drivers/pci/controller/dwc/pcie-rcar-gen4.c > +++ b/drivers/pci/controller/dwc/pcie-rcar-gen4.c > @@ -255,7 +255,7 @@ static struct rcar_gen4_pcie *rcar_gen4_pcie_alloc(struct platform_device *pdev) > rcar->dw.ops = &dw_pcie_ops; > rcar->dw.dev = dev; > rcar->pdev = pdev; > - dw_pcie_cap_set(&rcar->dw, EDMA_UNROLL); > + rcar->dw.edma.mf = EDMA_MF_EDMA_UNROLL; > dw_pcie_cap_set(&rcar->dw, REQ_RES); > platform_set_drvdata(pdev, rcar); > > > -- > 2.25.1 >
On Mon, Feb 26, 2024 at 05:07:28PM +0530, Manivannan Sadhasivam wrote: > Instead of maintaining a separate capability for glue drivers that cannot > support auto detection of the eDMA mapping format, let's pass the mapping > format directly from them. Sorry, what's mapping? is it register address layout? Frank > > This will simplify the code and also allow adding HDMA support that also > doesn't support auto detection of mapping format. > > Suggested-by: Serge Semin <fancer.lancer@gmail.com> > Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> > --- > drivers/pci/controller/dwc/pcie-designware.c | 16 +++++++++------- > drivers/pci/controller/dwc/pcie-designware.h | 5 ++--- > drivers/pci/controller/dwc/pcie-rcar-gen4.c | 2 +- > 3 files changed, 12 insertions(+), 11 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c > index ce273c3c5421..3e90b9947a13 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.c > +++ b/drivers/pci/controller/dwc/pcie-designware.c > @@ -894,18 +894,20 @@ static int dw_pcie_edma_find_mf(struct dw_pcie *pci) > { > u32 val; > > + /* > + * Bail out finding the mapping format if it is already set by the glue > + * driver. Also ensure that the edma.reg_base is pointing to a valid > + * memory region. > + */ > + if (pci->edma.mf != EDMA_MF_EDMA_LEGACY) > + return pci->edma.reg_base ? 0 : -ENODEV; > + > /* > * Indirect eDMA CSRs access has been completely removed since v5.40a > * thus no space is now reserved for the eDMA channels viewport and > * former DMA CTRL register is no longer fixed to FFs. > - * > - * Note that Renesas R-Car S4-8's PCIe controllers for unknown reason > - * have zeros in the eDMA CTRL register even though the HW-manual > - * explicitly states there must FFs if the unrolled mapping is enabled. > - * For such cases the low-level drivers are supposed to manually > - * activate the unrolled mapping to bypass the auto-detection procedure. > */ > - if (dw_pcie_ver_is_ge(pci, 540A) || dw_pcie_cap_is(pci, EDMA_UNROLL)) > + if (dw_pcie_ver_is_ge(pci, 540A)) > val = 0xFFFFFFFF; > else > val = dw_pcie_readl_dbi(pci, PCIE_DMA_VIEWPORT_BASE + PCIE_DMA_CTRL); > diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h > index 26dae4837462..995805279021 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.h > +++ b/drivers/pci/controller/dwc/pcie-designware.h > @@ -51,9 +51,8 @@ > > /* DWC PCIe controller capabilities */ > #define DW_PCIE_CAP_REQ_RES 0 > -#define DW_PCIE_CAP_EDMA_UNROLL 1 > -#define DW_PCIE_CAP_IATU_UNROLL 2 > -#define DW_PCIE_CAP_CDM_CHECK 3 > +#define DW_PCIE_CAP_IATU_UNROLL 1 > +#define DW_PCIE_CAP_CDM_CHECK 2 > > #define dw_pcie_cap_is(_pci, _cap) \ > test_bit(DW_PCIE_CAP_ ## _cap, &(_pci)->caps) > diff --git a/drivers/pci/controller/dwc/pcie-rcar-gen4.c b/drivers/pci/controller/dwc/pcie-rcar-gen4.c > index e9166619b1f9..3c535ef5ea91 100644 > --- a/drivers/pci/controller/dwc/pcie-rcar-gen4.c > +++ b/drivers/pci/controller/dwc/pcie-rcar-gen4.c > @@ -255,7 +255,7 @@ static struct rcar_gen4_pcie *rcar_gen4_pcie_alloc(struct platform_device *pdev) > rcar->dw.ops = &dw_pcie_ops; > rcar->dw.dev = dev; > rcar->pdev = pdev; > - dw_pcie_cap_set(&rcar->dw, EDMA_UNROLL); > + rcar->dw.edma.mf = EDMA_MF_EDMA_UNROLL; > dw_pcie_cap_set(&rcar->dw, REQ_RES); > platform_set_drvdata(pdev, rcar); > > > -- > 2.25.1 >
On Mon, Feb 26, 2024 at 11:30:13AM -0500, Frank Li wrote: > On Mon, Feb 26, 2024 at 05:07:28PM +0530, Manivannan Sadhasivam wrote: > > Instead of maintaining a separate capability for glue drivers that cannot > > support auto detection of the eDMA mapping format, let's pass the mapping > > format directly from them. > > Sorry, what's mapping? is it register address layout? > Memory map containing the register layout for iATU, DMA etc... - Mani > Frank > > > > > This will simplify the code and also allow adding HDMA support that also > > doesn't support auto detection of mapping format. > > > > Suggested-by: Serge Semin <fancer.lancer@gmail.com> > > Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com> > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> > > --- > > drivers/pci/controller/dwc/pcie-designware.c | 16 +++++++++------- > > drivers/pci/controller/dwc/pcie-designware.h | 5 ++--- > > drivers/pci/controller/dwc/pcie-rcar-gen4.c | 2 +- > > 3 files changed, 12 insertions(+), 11 deletions(-) > > > > diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c > > index ce273c3c5421..3e90b9947a13 100644 > > --- a/drivers/pci/controller/dwc/pcie-designware.c > > +++ b/drivers/pci/controller/dwc/pcie-designware.c > > @@ -894,18 +894,20 @@ static int dw_pcie_edma_find_mf(struct dw_pcie *pci) > > { > > u32 val; > > > > + /* > > + * Bail out finding the mapping format if it is already set by the glue > > + * driver. Also ensure that the edma.reg_base is pointing to a valid > > + * memory region. > > + */ > > + if (pci->edma.mf != EDMA_MF_EDMA_LEGACY) > > + return pci->edma.reg_base ? 0 : -ENODEV; > > + > > /* > > * Indirect eDMA CSRs access has been completely removed since v5.40a > > * thus no space is now reserved for the eDMA channels viewport and > > * former DMA CTRL register is no longer fixed to FFs. > > - * > > - * Note that Renesas R-Car S4-8's PCIe controllers for unknown reason > > - * have zeros in the eDMA CTRL register even though the HW-manual > > - * explicitly states there must FFs if the unrolled mapping is enabled. > > - * For such cases the low-level drivers are supposed to manually > > - * activate the unrolled mapping to bypass the auto-detection procedure. > > */ > > - if (dw_pcie_ver_is_ge(pci, 540A) || dw_pcie_cap_is(pci, EDMA_UNROLL)) > > + if (dw_pcie_ver_is_ge(pci, 540A)) > > val = 0xFFFFFFFF; > > else > > val = dw_pcie_readl_dbi(pci, PCIE_DMA_VIEWPORT_BASE + PCIE_DMA_CTRL); > > diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h > > index 26dae4837462..995805279021 100644 > > --- a/drivers/pci/controller/dwc/pcie-designware.h > > +++ b/drivers/pci/controller/dwc/pcie-designware.h > > @@ -51,9 +51,8 @@ > > > > /* DWC PCIe controller capabilities */ > > #define DW_PCIE_CAP_REQ_RES 0 > > -#define DW_PCIE_CAP_EDMA_UNROLL 1 > > -#define DW_PCIE_CAP_IATU_UNROLL 2 > > -#define DW_PCIE_CAP_CDM_CHECK 3 > > +#define DW_PCIE_CAP_IATU_UNROLL 1 > > +#define DW_PCIE_CAP_CDM_CHECK 2 > > > > #define dw_pcie_cap_is(_pci, _cap) \ > > test_bit(DW_PCIE_CAP_ ## _cap, &(_pci)->caps) > > diff --git a/drivers/pci/controller/dwc/pcie-rcar-gen4.c b/drivers/pci/controller/dwc/pcie-rcar-gen4.c > > index e9166619b1f9..3c535ef5ea91 100644 > > --- a/drivers/pci/controller/dwc/pcie-rcar-gen4.c > > +++ b/drivers/pci/controller/dwc/pcie-rcar-gen4.c > > @@ -255,7 +255,7 @@ static struct rcar_gen4_pcie *rcar_gen4_pcie_alloc(struct platform_device *pdev) > > rcar->dw.ops = &dw_pcie_ops; > > rcar->dw.dev = dev; > > rcar->pdev = pdev; > > - dw_pcie_cap_set(&rcar->dw, EDMA_UNROLL); > > + rcar->dw.edma.mf = EDMA_MF_EDMA_UNROLL; > > dw_pcie_cap_set(&rcar->dw, REQ_RES); > > platform_set_drvdata(pdev, rcar); > > > > > > -- > > 2.25.1 > >
On Tue, Feb 27, 2024 at 01:15:33PM +0530, Manivannan Sadhasivam wrote: > On Mon, Feb 26, 2024 at 11:30:13AM -0500, Frank Li wrote: > > On Mon, Feb 26, 2024 at 05:07:28PM +0530, Manivannan Sadhasivam wrote: > > > Instead of maintaining a separate capability for glue drivers that cannot > > > support auto detection of the eDMA mapping format, let's pass the mapping > > > format directly from them. > > > > Sorry, what's mapping? is it register address layout? > > > > Memory map containing the register layout for iATU, DMA etc... the world 'map' is too general. can you use 'register map' at least at one place? There are bunch 'map' related DMA, such iommu map, stream id map, memory page map. The reader need go though whole thread to figure out it is register map. Frank > > - Mani > > > Frank > > > > > > > > This will simplify the code and also allow adding HDMA support that also > > > doesn't support auto detection of mapping format. > > > > > > Suggested-by: Serge Semin <fancer.lancer@gmail.com> > > > Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com> > > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> > > > --- > > > drivers/pci/controller/dwc/pcie-designware.c | 16 +++++++++------- > > > drivers/pci/controller/dwc/pcie-designware.h | 5 ++--- > > > drivers/pci/controller/dwc/pcie-rcar-gen4.c | 2 +- > > > 3 files changed, 12 insertions(+), 11 deletions(-) > > > > > > diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c > > > index ce273c3c5421..3e90b9947a13 100644 > > > --- a/drivers/pci/controller/dwc/pcie-designware.c > > > +++ b/drivers/pci/controller/dwc/pcie-designware.c > > > @@ -894,18 +894,20 @@ static int dw_pcie_edma_find_mf(struct dw_pcie *pci) > > > { > > > u32 val; > > > > > > + /* > > > + * Bail out finding the mapping format if it is already set by the glue > > > + * driver. Also ensure that the edma.reg_base is pointing to a valid > > > + * memory region. > > > + */ > > > + if (pci->edma.mf != EDMA_MF_EDMA_LEGACY) > > > + return pci->edma.reg_base ? 0 : -ENODEV; > > > + > > > /* > > > * Indirect eDMA CSRs access has been completely removed since v5.40a > > > * thus no space is now reserved for the eDMA channels viewport and > > > * former DMA CTRL register is no longer fixed to FFs. > > > - * > > > - * Note that Renesas R-Car S4-8's PCIe controllers for unknown reason > > > - * have zeros in the eDMA CTRL register even though the HW-manual > > > - * explicitly states there must FFs if the unrolled mapping is enabled. > > > - * For such cases the low-level drivers are supposed to manually > > > - * activate the unrolled mapping to bypass the auto-detection procedure. > > > */ > > > - if (dw_pcie_ver_is_ge(pci, 540A) || dw_pcie_cap_is(pci, EDMA_UNROLL)) > > > + if (dw_pcie_ver_is_ge(pci, 540A)) > > > val = 0xFFFFFFFF; > > > else > > > val = dw_pcie_readl_dbi(pci, PCIE_DMA_VIEWPORT_BASE + PCIE_DMA_CTRL); > > > diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h > > > index 26dae4837462..995805279021 100644 > > > --- a/drivers/pci/controller/dwc/pcie-designware.h > > > +++ b/drivers/pci/controller/dwc/pcie-designware.h > > > @@ -51,9 +51,8 @@ > > > > > > /* DWC PCIe controller capabilities */ > > > #define DW_PCIE_CAP_REQ_RES 0 > > > -#define DW_PCIE_CAP_EDMA_UNROLL 1 > > > -#define DW_PCIE_CAP_IATU_UNROLL 2 > > > -#define DW_PCIE_CAP_CDM_CHECK 3 > > > +#define DW_PCIE_CAP_IATU_UNROLL 1 > > > +#define DW_PCIE_CAP_CDM_CHECK 2 > > > > > > #define dw_pcie_cap_is(_pci, _cap) \ > > > test_bit(DW_PCIE_CAP_ ## _cap, &(_pci)->caps) > > > diff --git a/drivers/pci/controller/dwc/pcie-rcar-gen4.c b/drivers/pci/controller/dwc/pcie-rcar-gen4.c > > > index e9166619b1f9..3c535ef5ea91 100644 > > > --- a/drivers/pci/controller/dwc/pcie-rcar-gen4.c > > > +++ b/drivers/pci/controller/dwc/pcie-rcar-gen4.c > > > @@ -255,7 +255,7 @@ static struct rcar_gen4_pcie *rcar_gen4_pcie_alloc(struct platform_device *pdev) > > > rcar->dw.ops = &dw_pcie_ops; > > > rcar->dw.dev = dev; > > > rcar->pdev = pdev; > > > - dw_pcie_cap_set(&rcar->dw, EDMA_UNROLL); > > > + rcar->dw.edma.mf = EDMA_MF_EDMA_UNROLL; > > > dw_pcie_cap_set(&rcar->dw, REQ_RES); > > > platform_set_drvdata(pdev, rcar); > > > > > > > > > -- > > > 2.25.1 > > > > > -- > மணிவண்ணன் சதாசிவம்
On Tue, Feb 27, 2024 at 12:38:52PM -0500, Frank Li wrote: > On Tue, Feb 27, 2024 at 01:15:33PM +0530, Manivannan Sadhasivam wrote: > > On Mon, Feb 26, 2024 at 11:30:13AM -0500, Frank Li wrote: > > > On Mon, Feb 26, 2024 at 05:07:28PM +0530, Manivannan Sadhasivam wrote: > > > > Instead of maintaining a separate capability for glue drivers that cannot > > > > support auto detection of the eDMA mapping format, let's pass the mapping > > > > format directly from them. > > > > > > Sorry, what's mapping? is it register address layout? > > > > > > > Memory map containing the register layout for iATU, DMA etc... > > the world 'map' is too general. can you use 'register map' at least at one > place? There are bunch 'map' related DMA, such iommu map, stream id map, > memory page map. The reader need go though whole thread to figure out it is > register map. > This is what used from the start and also what "mf" corresponds to. So I had to use the same terminology. - Mani
diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index ce273c3c5421..3e90b9947a13 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -894,18 +894,20 @@ static int dw_pcie_edma_find_mf(struct dw_pcie *pci) { u32 val; + /* + * Bail out finding the mapping format if it is already set by the glue + * driver. Also ensure that the edma.reg_base is pointing to a valid + * memory region. + */ + if (pci->edma.mf != EDMA_MF_EDMA_LEGACY) + return pci->edma.reg_base ? 0 : -ENODEV; + /* * Indirect eDMA CSRs access has been completely removed since v5.40a * thus no space is now reserved for the eDMA channels viewport and * former DMA CTRL register is no longer fixed to FFs. - * - * Note that Renesas R-Car S4-8's PCIe controllers for unknown reason - * have zeros in the eDMA CTRL register even though the HW-manual - * explicitly states there must FFs if the unrolled mapping is enabled. - * For such cases the low-level drivers are supposed to manually - * activate the unrolled mapping to bypass the auto-detection procedure. */ - if (dw_pcie_ver_is_ge(pci, 540A) || dw_pcie_cap_is(pci, EDMA_UNROLL)) + if (dw_pcie_ver_is_ge(pci, 540A)) val = 0xFFFFFFFF; else val = dw_pcie_readl_dbi(pci, PCIE_DMA_VIEWPORT_BASE + PCIE_DMA_CTRL); diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 26dae4837462..995805279021 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -51,9 +51,8 @@ /* DWC PCIe controller capabilities */ #define DW_PCIE_CAP_REQ_RES 0 -#define DW_PCIE_CAP_EDMA_UNROLL 1 -#define DW_PCIE_CAP_IATU_UNROLL 2 -#define DW_PCIE_CAP_CDM_CHECK 3 +#define DW_PCIE_CAP_IATU_UNROLL 1 +#define DW_PCIE_CAP_CDM_CHECK 2 #define dw_pcie_cap_is(_pci, _cap) \ test_bit(DW_PCIE_CAP_ ## _cap, &(_pci)->caps) diff --git a/drivers/pci/controller/dwc/pcie-rcar-gen4.c b/drivers/pci/controller/dwc/pcie-rcar-gen4.c index e9166619b1f9..3c535ef5ea91 100644 --- a/drivers/pci/controller/dwc/pcie-rcar-gen4.c +++ b/drivers/pci/controller/dwc/pcie-rcar-gen4.c @@ -255,7 +255,7 @@ static struct rcar_gen4_pcie *rcar_gen4_pcie_alloc(struct platform_device *pdev) rcar->dw.ops = &dw_pcie_ops; rcar->dw.dev = dev; rcar->pdev = pdev; - dw_pcie_cap_set(&rcar->dw, EDMA_UNROLL); + rcar->dw.edma.mf = EDMA_MF_EDMA_UNROLL; dw_pcie_cap_set(&rcar->dw, REQ_RES); platform_set_drvdata(pdev, rcar);