Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp977339lqs; Wed, 6 Mar 2024 02:33:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVFM5F3R19UnD/isiOenwWlLLSgp/YU3uQWlJOIj6veKU8slm6PdjZwp1b5BHgLVwsdOQHgJCE3A5me++bwk6BfoJuk/au7Qk21Yk7oQg== X-Google-Smtp-Source: AGHT+IFZykT4nsxhQEQtWtLa0xHvuSFjhsBYeah5pfXzSGDTTW3W7KC4EogYqJwKpsIaRCsXGGd0 X-Received: by 2002:a05:6808:17a4:b0:3c1:af49:222b with SMTP id bg36-20020a05680817a400b003c1af49222bmr5437167oib.37.1709721229856; Wed, 06 Mar 2024 02:33:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709721229; cv=pass; d=google.com; s=arc-20160816; b=eR/9y2vfLdSOMet1RbMtHfmeOoxBznMYAmD706+Imd3cARLRpnzRdlCx3HDDslyH/M 7QbmN3V1sgnDIaCvzkvFQ6KWvoU/jxD8qt1r1IN3gb/VTWQuNyLqaNTDCINcMHxnHxcY J1KeNtcstgCxvWN8GVRHYWW7jnfZftoF3j7NT8mOW41oJB78ONf6GXETOmIN74JmFyRn npC6D/+aPLdwuhnapcJVL1HfF6zi5sGyaYQRpakX7+iJ8WkfhIvIgj4sAY++7JQPYxyr B4sPGmCv3/EoOMF8Vsq0ez4urQKFNnewFcvrGKRfD6rc/JTlaokGwkyuGDRZ+fh/W1HH TFiQ== 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=j3vP/5bP/RBlYdf1td9wb5cvuOaEn1shwa0DYeck2dA=; fh=MlzsO1CCPvN7lem3h1lJbiR14X+BL5Pkkj3o3yxsW1U=; b=bSEQI10Xn/Fb6FZnglGsbcTHJe/CmO3FxQBWgVnew70Z88fkZr9jm9St44mBEruX1S R4haueTHT2UT29ZjmoRfwXDZVcFJd55lgOfNWBtGOuevCfS3FDN2kj/klU/LrZhO4jI9 aHs61w2T86rsUqQXUvH2QYWGtbDoT4Y5r5rrZHt2wMMYSm2Z2dDS1LRJ1bPnIPJbg2xi MnEo+mCi8e53szuUzLYEHU1NoMY/YGaxUPBI+sPqq2v1KbEa4f+TQgmCHEMeJHUJFtrN P5WgzO93WRJrBMpWvsnMzwU26optOrOrHNRMowg+ZPnzcScr27f8Qn1rUwezKlAZwDpn av6w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=woGPj7Pd; 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-93740-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93740-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y21-20020a634b15000000b005dc4e7d879csi11809830pga.66.2024.03.06.02.33.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 02:33:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93740-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=woGPj7Pd; 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-93740-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93740-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A2C632903EA for ; Wed, 6 Mar 2024 10:23:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EDD296027B; Wed, 6 Mar 2024 10:22:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="woGPj7Pd" Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (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 6E570604B5 for ; Wed, 6 Mar 2024 10:22:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709720553; cv=none; b=lXwPFNxFYbvFeGlTL2NqVaBXXRDs8u5iHdgbyKAQ9DCXzIqKT47kIJuIFpOyv2zKmj/s8m0czG5WDDQ/su7huPXhZjokeeDR29c/4qTvqhGBUnTrkefkQm77ATsaPRPpNzCJJQ93fyv5w/avz4TiBZ3VTIyChSOX8Igf5LZzLM0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709720553; c=relaxed/simple; bh=GNg1QejkcoZ5fK4swcrLBbBe1IA73m5a3pHFG5FA1Sc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fYO4xW+7F6yojZVTfT0truX0WBs99WmKV9MeMwNri7IyHwky3MHzeL+fSV2WcDgH32Wo6mwkJQ9/1TJ7rC4c3KAMriMfbzl2QerYnOtowFWbbAAXqwwOzRVxNO//QGPsXd3AYspeFhif2AY3A1/1MyAtUd0nEgtr2B6/X6LMzpo= 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=woGPj7Pd; arc=none smtp.client-ip=209.85.216.49 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-pj1-f49.google.com with SMTP id 98e67ed59e1d1-29a6dcfdd30so553541a91.0 for ; Wed, 06 Mar 2024 02:22:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709720551; x=1710325351; 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=j3vP/5bP/RBlYdf1td9wb5cvuOaEn1shwa0DYeck2dA=; b=woGPj7PdacXtpER1hOxi5q02WFZJ1uF/v2a9o7FjHAyxzodwYAlPBkXOCCIKpDLJSk p5mnDp3EnVwYF7lfxqcnoS3h5KyyN5qzMds4kNPkkNgE52OWhYG//9fI5BW25URxe91C TGQPVSrvTgsQTggo7+ACG6+OFXUqRbIYtVxU/USRcRRPOWRpeQq3PIyFeGYCJZumlhin RvYJBILw1DHTN3+CVH+rxaEmFP8HBwl7LeuEPfC0LLwupIgEtDzmF+F4CztHE+SCBIGh j3g6qns2a12WOVwYP+2EIOnrSNculpKWHhQMug0GPQTYinBdwcLq6/p1Ta6oR4TMruNh fqPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709720551; x=1710325351; 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=j3vP/5bP/RBlYdf1td9wb5cvuOaEn1shwa0DYeck2dA=; b=GjHdk1lk2+AqDEUae8DHCxnqE/hKxBI2F0p7BolojCtPrziHT/yqCP+52UmokVEmsw 4pquYaZL0wFU66fdrSoee4Z7X1jIlZX6zy/J6wNQi2mA63K+mJutZL+9OrzOmxfCMM+P edeIle1BYgnNaFqzzzK1dZozPfcUgWxsjPspYFBK+mAbAaQ10dcQEi5MplfR9sfbfxfb xk9pSaJN8ITVnEnH8muJW3W/H+VPzyBJgo0dMxDkjmazpIPveyD9DsZ4cKF1kBKluYuX K3vd/8MVwdX1YvesiP3YXlglUHdITPBCfejJGS8AsyqCth37RgyLOC5uHk/A7/j0fOdH DeZA== X-Forwarded-Encrypted: i=1; AJvYcCUghhV7PCy97Fu6Y77Rlg3IW2v2EcTA7B+Jy06EGDmfrCbucJagM34s2bRv7n4v87t3Wf1HVvHcn47pQ34v3udc+f9vEahYEFVdrL+x X-Gm-Message-State: AOJu0Yx1q2s9ki1murngmu3q71sQ/dEQ8PDrg/TkDIom6u4zp9VHRLp6 rNtaoapkA04M8yaf9+Hw88JTedn9E/K96o7+DiaGSsieA2CMDQlUB6w0yCTTsQ== X-Received: by 2002:a17:90a:dd93:b0:29a:7579:88bc with SMTP id l19-20020a17090add9300b0029a757988bcmr11410022pjv.46.1709720550661; Wed, 06 Mar 2024 02:22:30 -0800 (PST) Received: from [127.0.1.1] ([117.248.1.194]) by smtp.gmail.com with ESMTPSA id li17-20020a17090b48d100b0029ab96b13ebsm13339320pjb.40.2024.03.06.02.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 02:22:30 -0800 (PST) From: Manivannan Sadhasivam Date: Wed, 06 Mar 2024 15:51:59 +0530 Subject: [PATCH v4 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: <20240306-dw-hdma-v4-3-9fed506e95be@linaro.org> References: <20240306-dw-hdma-v4-0-9fed506e95be@linaro.org> In-Reply-To: <20240306-dw-hdma-v4-0-9fed506e95be@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=3424; i=manivannan.sadhasivam@linaro.org; h=from:subject:message-id; bh=GNg1QejkcoZ5fK4swcrLBbBe1IA73m5a3pHFG5FA1Sc=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBl6EPQdbpcSFeeqHfUcnEzcW09XZpqMwjds4rW7 ouUkY/9IMKJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCZehD0AAKCRBVnxHm/pHO 9d3JB/49m7E14UAaGxtNaUW/tGfbFfFeT7L9Hqxa5OvwPAi/pI5Oh2VrUZbziA/w+y5CL5y2uRq MfIhLMAbL4Bmiw3W+GTGLoZa1OpuxjLc8rB8nMJf8SHxRT4yrP7M6buZQ2keE1vpet7zl4IexM/ b+DbyZvsMTgRg4bCCoFb388eVZiRUTEsVtwE0MFRwaoDmtJ+a9L3Vz3S05Et39FePV+70ySWySe TjADU8T3jb7KIirsSxu6Bht3kQtDeldVIdek/NRmQd+pwRbQTc7nPQgSF8i0CCD0aOHcsJV7UEV tH/A38ghBvN2d+OceSAfnqCYrnScGl3GuIgwg0w61wycWg7H 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 Reviewed-by: Serge Semin 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 599991b7ffb2..c59b2876e5d4 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