Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1246468rbb; Mon, 26 Feb 2024 03:40:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVBeUF7cqae8Ds6W1a3sYKtVnTbRcDH96Cwl/zB+BlB+3tYjDrHnrjF5C6dB/ag3gT9c0V+x8gFMjM81KLEjgSYmnmk5Gnih8DK9rlSQg== X-Google-Smtp-Source: AGHT+IEqzq+nzUNlTjzLfV3s8OVSvfGyydqNBtxueKSPQrMLUVRHGXYAdaPE7NOXofqOXJqdMtUH X-Received: by 2002:a05:6214:194d:b0:68f:e75f:306f with SMTP id q13-20020a056214194d00b0068fe75f306fmr8027085qvk.27.1708947600973; Mon, 26 Feb 2024 03:40:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708947600; cv=pass; d=google.com; s=arc-20160816; b=JZKtVpXeOvZB4SQlpzHdYt70BqbHDZRZDaPcRElAiIKvooPVTq20tbJsFTLx1kbc7w cOB8CKRC/1wSLDG8QPyI2L4PR6fUYRNthtSOEdxmws744mLFjvhpeN4GklvjEQSe58N4 gPR4GfKWaXyb2y53mW5yg9nHZTKEtEhxJEGoYTZyXAHJrGF4XWcrOgVCRgnRxDYuVsuf 6f2/CpngF8hanFVd55PjCq+1+m705b0fWPW/v5BDyMt7HT2QMrKEq8KxS8j0D99IuJxQ 49lI2kW6FlxG8ad4cLOD/4tWT5jUS2EF/aNkNI906vFzM+n/RMNwXB6tqUJ2XGupfRbx KKvA== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81290-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id gv6-20020a056214262600b0068f1387c655si4867541qvb.187.2024.02.26.03.40.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 03:40:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81290-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81290-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id AFEF51C2498C for ; Mon, 26 Feb 2024 11:40:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 691EC1CAB8; Mon, 26 Feb 2024 11:38:10 +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 ; 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 ; 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 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: List-Subscribe: List-Unsubscribe: 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 , Gustavo Pimentel , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Marek Vasut , Yoshihiro Shimoda , Kishon Vijay Abraham I Cc: Serge Semin , 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 , Siddharth Vadapalli 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 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 Reviewed-by: Siddharth Vadapalli Signed-off-by: Manivannan Sadhasivam --- 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