From patchwork Mon Feb 26 11:37:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 206604 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2028253dyb; Mon, 26 Feb 2024 04:14:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXycHXOb93U12jmNn3hABZIY/+ShdrPje1I+tgHFXoTlxXlgV2yX9stHOMeui6S+HGo0LWj7fr9G61tglhxnuU74+sQMA== X-Google-Smtp-Source: AGHT+IEV31il1ArzqfGzMs9RsrLGAuru1V0vfJ8sT2PCes65hufH7rtcyCvKdXuTgJHwPz8zdPQS X-Received: by 2002:a17:90a:39c8:b0:29a:98ab:a33f with SMTP id k8-20020a17090a39c800b0029a98aba33fmr4092726pjf.8.1708949671868; Mon, 26 Feb 2024 04:14:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708949671; cv=pass; d=google.com; s=arc-20160816; b=GSVkO4f3xoq3qL1Tdt2zOGdTxW8zqW7KxzpoRHIs4e0v7F36g8g0SGrA40gPmhl4a2 GuioQNGTfpxbxYOp2uvh1m8BqoGj7XUnV8kQncEexgs3/Nw193eEhhcd2UQEQSwD+3v+ I48IxxielL3ipjnu4/a0fO7q1y1YlFFMe2SfOmzX8bl8T71T3Q2Fa2M49RKAdi7O5KIo esFylTYSsc3w0ynyZGwk7btE6DiJH0FxibSC8WcM9GuaN9EU3XWH/JanyhDBsO0ZTAuE RMuy2OpuKEy3ikthmcY4ZrV31vDmQooFETmUy2nXoYKoqpOYUJxIfT9U/jjFPxKJk5os vKhQ== 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=EYL0y9tWhN7SH+jeAOGY/jbLEk1NIed7kqGutW5jR3I=; fh=lPgsShb6QXkMFPmAnV3jTeCJRNyt29SK7FvyR0dtZg0=; b=EQywyjlSrrAQm6QUGyMAP0/9bfWK0U/y4UEDCi+hxrc8kPeKc/PavywwMNwiaaYyCl 3g3ZQFvlm3xEES8/dD6jfT+nJ6Vshb9HBfJAjex+ff+gxyZWtAFiCwk7er/2EU7mzPeJ 04Oo7vXeI4G16Caf0FfF1OiBXkFf9vcwFu1RwCahRBPssfGWAvc2PxLK5XQnhQE6E7Zt pY4UY9KLq7mCQk46EhdZUyMQMUYfJ5HtKFqrVF1AEFowHiQLBXMxonmprMPx1ZIwA08l osEj+qICaEYYIZKQ6+OVeABG4mnWBQYJKKJcXid+XlVK1XX4XwEMGInYQRfeA69AJ5dS G3kA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sszqh8j4; 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-81288-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81288-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id e5-20020a17090ab38500b002964c7d3e30si5482459pjr.45.2024.02.26.04.14.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 04:14:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81288-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sszqh8j4; 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-81288-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81288-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 5F2C8B2DBE6 for ; Mon, 26 Feb 2024 11:39:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1FB2A4CB20; Mon, 26 Feb 2024 11:38:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="sszqh8j4" Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) (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 0658739856 for ; Mon, 26 Feb 2024 11:37:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708947477; cv=none; b=LQIvSLchRXKKnZ1kXZbInwRk/6HkcBTtQX03FWeGMdkBX8rjIygVS/sz/cJcWamXDJaWxAjN3sjMhOZC2ynigVlSxfEmSh1EiD94hEO6iLqZAft/6NiV1vL5HpGqYHwwrG5wz0vdB5klTcOgcvi1Nn08Go7IKrDmN+WofYyh7ro= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708947477; c=relaxed/simple; bh=WcbOX7Mto0c1BGHRXqQ6U7dCJ8afc+aUAohuOTqaRuY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Wuyx7hksg9gZDRFMn931cGA9WdMJ39n8CpePmBTghg5SlxO9hfc2mkyi6Kk8EnnehK49VsbzXunP0KXtfo4XVDtYgahUbY2EDjq4f4DYZFEy3kxEZChD4fUiKcgaOZ/vV2Xw4NpUDn9i46VpjlF69KyyR2Ed3qMD1gMXNY7nV/E= 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=sszqh8j4; arc=none smtp.client-ip=209.85.160.171 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-qt1-f171.google.com with SMTP id d75a77b69052e-42a9c21f9ecso11573961cf.0 for ; Mon, 26 Feb 2024 03:37:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708947474; x=1709552274; 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=EYL0y9tWhN7SH+jeAOGY/jbLEk1NIed7kqGutW5jR3I=; b=sszqh8j4DerttvwpHxTcjUQzBhDGiWbZmhkguBqQaYK0ub3fMWO/U3x9rUhPia6485 MWTw3UsQODCLCNO5Ji7djMTPbt42mDfxpgdQfWAliI5rvJnwnf4V5/D3M7sn2ZkrncvJ y+BxK5y9bi9nktDGABLanvR1sTapGK6SFQu2lqN4huboZhtQUH3rgvJ+g1+Bs0MkAZze ZarImE0xLnSac6sC+WaxXsDz13UFCDPjhnqqo+bxQ1euucGWgBDIrn+8J7DDJo/yzRlo tkv7aMOBNpPqush9RXtTjzvJQOl6UlK8hDMSr7okdJznq2ynvTobCd3dC2thzZRRLCNl nIBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708947474; x=1709552274; 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=EYL0y9tWhN7SH+jeAOGY/jbLEk1NIed7kqGutW5jR3I=; b=c32DxzEhO01+vQxsfLBk8wZpgUIWu0TMlXuWEZASKXm85BZCKZBF6UOOICyuCMroZP s0J8nNKrMui53Uo58QaVF5tfq/qb9RAXKYAymHxFXQZHARdMJQ7uMaKBLS/IAwh+xHqd OWwWa+YKJKGcTS5xnMOj50OlSYjpu/02oh1J57yCQv6yqztre1um62tZgu0g+r1W1Fwj 3X8WDC/W0r5K3sj2xwE/GJEhhHkHywkgBvsgrNQvAiGDSYrv1FsFcybsF2ZSbQ7936E3 C2GPwchbrCQEZXp0azadQqn9cUX6O7uCJt1ciFILekB2numDY/83sR1YztwDEwrAMcEn bTxw== X-Forwarded-Encrypted: i=1; AJvYcCX58Wca616jOb+fQlrO3HhIOnc5s/uVyedn1umeNnx05v+pgq1NE+xR2/ZO4fO6dw/UUbM8PPiJtJkqnnBF7GWqw1O7iDyPKrQEAc6N X-Gm-Message-State: AOJu0YwyQNP6obeTXf7VsWX6g9uPEmQCCiYRSKsg3v8TvumpwSNbjUIx 3uQqIVphW0Oh5q/BxTqJ/TJYrcKtqOTr9Y33si0fS5Ov334aOfv+/DtGiXYw/w== X-Received: by 2002:ac8:5701:0:b0:42e:7f29:9efc with SMTP id 1-20020ac85701000000b0042e7f299efcmr4475781qtw.39.1708947474011; Mon, 26 Feb 2024 03:37:54 -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.37.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 03:37:53 -0800 (PST) From: Manivannan Sadhasivam Date: Mon, 26 Feb 2024 17:07:26 +0530 Subject: [PATCH v3 1/5] PCI: dwc: Refactor dw_pcie_edma_find_chip() API Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240226-dw-hdma-v3-1-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=84?= =?utf-8?q?ski?= , 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 X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2890; i=manivannan.sadhasivam@linaro.org; h=from:subject:message-id; bh=WcbOX7Mto0c1BGHRXqQ6U7dCJ8afc+aUAohuOTqaRuY=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBl3HgFyYup7jym/LtqWaupNXR74OV2VbzwWJrkH tEM6mBeAL6JATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCZdx4BQAKCRBVnxHm/pHO 9R86B/958Cp/+Pz70HZ9LC1l9vbXmsJZ5PmimkFurM1/Bd9WLaQ9SIK6kpmWAQhnckUZySHX48C X75w//3ffLd1MeUhpOQNERUXyl7+SEj5Ugydpun2zp+9PMxYWxZ2gpUWII4d/O5oR1WqER5qMNi SOQ6VUSBgJ+L7cGr89i4H/vrQoPASGw1lWTYRZ10BMeyOWoSyqelXUFGCBt122rc3UiueeGKH7R kjA16aYf4z8vZedV2pfzr/cu6+AW4qb8qiP9bNDSbeDlMZbp3jqTGKHTpIIt/fdigwip67GrNkC nADoNQAZQPsD3mfgstgk1VLFQXjZch0KhwolrHK8kfTgkmi0 X-Developer-Key: i=manivannan.sadhasivam@linaro.org; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791962923931005903 X-GMAIL-MSGID: 1791963610693220637 In order to add support for Hyper DMA (HDMA), let's refactor the existing dw_pcie_edma_find_chip() API by moving the common code to separate functions. No functional change. Suggested-by: Serge Semin Signed-off-by: Manivannan Sadhasivam Reviewed-by: Frank Li --- drivers/pci/controller/dwc/pcie-designware.c | 52 +++++++++++++++++++++------- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index 250cf7f40b85..193fcd86cf93 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -880,7 +880,17 @@ static struct dw_edma_plat_ops dw_pcie_edma_ops = { .irq_vector = dw_pcie_edma_irq_vector, }; -static int dw_pcie_edma_find_chip(struct dw_pcie *pci) +static void dw_pcie_edma_init_data(struct dw_pcie *pci) +{ + pci->edma.dev = pci->dev; + + if (!pci->edma.ops) + pci->edma.ops = &dw_pcie_edma_ops; + + pci->edma.flags |= DW_EDMA_CHIP_LOCAL; +} + +static int dw_pcie_edma_find_mf(struct dw_pcie *pci) { u32 val; @@ -900,24 +910,27 @@ static int dw_pcie_edma_find_chip(struct dw_pcie *pci) else val = dw_pcie_readl_dbi(pci, PCIE_DMA_VIEWPORT_BASE + PCIE_DMA_CTRL); - if (val == 0xFFFFFFFF && pci->edma.reg_base) { - pci->edma.mf = EDMA_MF_EDMA_UNROLL; - - val = dw_pcie_readl_dma(pci, PCIE_DMA_CTRL); - } else if (val != 0xFFFFFFFF) { - pci->edma.mf = EDMA_MF_EDMA_LEGACY; + /* Set default mapping format here and update it below if needed */ + pci->edma.mf = EDMA_MF_EDMA_LEGACY; + if (val == 0xFFFFFFFF && pci->edma.reg_base) + pci->edma.mf = EDMA_MF_EDMA_UNROLL; + else if (val != 0xFFFFFFFF) pci->edma.reg_base = pci->dbi_base + PCIE_DMA_VIEWPORT_BASE; - } else { + else return -ENODEV; - } - pci->edma.dev = pci->dev; + return 0; +} - if (!pci->edma.ops) - pci->edma.ops = &dw_pcie_edma_ops; +static int dw_pcie_edma_find_channels(struct dw_pcie *pci) +{ + u32 val; - pci->edma.flags |= DW_EDMA_CHIP_LOCAL; + if (pci->edma.mf == EDMA_MF_EDMA_LEGACY) + val = dw_pcie_readl_dbi(pci, PCIE_DMA_VIEWPORT_BASE + PCIE_DMA_CTRL); + else + val = dw_pcie_readl_dma(pci, PCIE_DMA_CTRL); pci->edma.ll_wr_cnt = FIELD_GET(PCIE_DMA_NUM_WR_CHAN, val); pci->edma.ll_rd_cnt = FIELD_GET(PCIE_DMA_NUM_RD_CHAN, val); @@ -930,6 +943,19 @@ static int dw_pcie_edma_find_chip(struct dw_pcie *pci) return 0; } +static int dw_pcie_edma_find_chip(struct dw_pcie *pci) +{ + int ret; + + dw_pcie_edma_init_data(pci); + + ret = dw_pcie_edma_find_mf(pci); + if (ret) + return ret; + + return dw_pcie_edma_find_channels(pci); +} + static int dw_pcie_edma_irq_verify(struct dw_pcie *pci) { struct platform_device *pdev = to_platform_device(pci->dev); From patchwork Mon Feb 26 11:37:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 206589 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2015216dyb; Mon, 26 Feb 2024 03:47:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXrtXtOG+NS8OLishUGQmKVQm100UVDgU3NU+ySz5HCkyZ3VOHbRmRRJXqfQHBg9hqyiVtZwQDEEysSxpLHTuXQihxNYg== X-Google-Smtp-Source: AGHT+IH2zqn6xBSKc0cIV9yKg6DKLN44hP33qFeC9KN5LqKfYTVT3vM1WBgD5tvZfnT66KowOpq/ X-Received: by 2002:a17:907:bb88:b0:a43:87a3:3fe8 with SMTP id xo8-20020a170907bb8800b00a4387a33fe8mr269299ejc.72.1708948069613; Mon, 26 Feb 2024 03:47:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708948069; cv=pass; d=google.com; s=arc-20160816; b=wBkWzKCQ5eNjOfWIkh7fDipfKqf5cAbQTap61+iXCck75eyIfaEXmoAYX/BxSj7mCh tLPZBshHvkJxCqiZlQbhD4/UcxosluAZxxBIIClO1mXz2w0CtzFOzw6HGiMQxd9tVWPs wURtj9k7JI7qsosTnRmMkeuaoTBEC8RWMLijMua+ZT5r40KDx6P/JK4IG2x/7pItlGHz eALv64emnWMQmE3u6plp+jNo5AaG7HI4P39HBMuagnC3nG2/CTR4UtLuJKK3LwUN1IBo 669zu5SwWh1IA2+T/jGOYkZj5ZvfNK6wawQf3z6AQSGMZ76GtpdeQFGrd7vwcMlHfEgR nppA== 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=MkHgfdlubDIZc6YiSfjHe4pC8mX8qCcfR0RdSpyweMY=; fh=7S2INQxKjC7DMzKpLuWlOs87+kkrdeQW2DPiCn2r8t8=; b=aTS8kDI1rwUVrp0zJ4etDQGwMVuztzI3VfSrONH99W3mmNHX3wPr0ovhUHZxobh+b+ b/F7SRi+mZRztYxOPq0/CL2h8ZqE169zrYayIjFaOIJxgrRviHooFzLZQBiuWF4Fq1K0 d88HDCRV1wKwgr8eYFK9aWON1fBoRT4SoCgs2w9baYP/IwSYVu3vFUlemtZzrjJC+lEQ gUe1dSHk49UvIWfqgwzRmFCARk2m7DnwUQAZXQb3KJsEY+jbLOCI6EsKK38BSquDd+UK p6qj0PCpnAMEO9SSb6zOflIZLajWGbrAoXUAOmFGDxtrAxzqRjbQ0u5u+uKlpGfzoddC 33JQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="e9x6N/HH"; 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-81289-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81289-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id lo25-20020a170906fa1900b00a4338791320si1063945ejb.764.2024.02.26.03.47.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 03:47:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81289-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="e9x6N/HH"; 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-81289-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81289-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 31CAA1F2B163 for ; Mon, 26 Feb 2024 11:39:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 471C94D5A0; Mon, 26 Feb 2024 11:38:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="e9x6N/HH" Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (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 EAB714CDE0 for ; Mon, 26 Feb 2024 11:38:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708947483; cv=none; b=GtsBis4J1Qb/3M26+YaOC3cdMsWlEqZ7EFZEvZndz8R83vqqy/HX5Hs3tQm+IQYx/hLjasTPHW9v7Oyk/Wq/3o8xHwZb1j1gyI6nW2LvJtNrWgryM7aWoeljAi3nVgxwT1SbwKPsWI/vN+tq9mG2uWunWFaSwAu8RqG4pF0NP8c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708947483; c=relaxed/simple; bh=nHkU+s/hofqacaD6DKpKZMYQycR1YXGCRfONZEYjupQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NyEMV/1n85rBFiCPgU6ZfL+lPmErfGku28gJky2BsjcjEHyBcnbAg5FEER9wH+wdOy5FQ/jykQ63yN8TbFISX28cy7XTG1uYQsJlpdYlVEswHFWxia8Bgd4kyGwBrL3PjQcfMqbIfbqJUkqSPBflXjyK3ocPX2MaIxr0QIoE9q4= 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=e9x6N/HH; arc=none smtp.client-ip=209.85.222.174 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-qk1-f174.google.com with SMTP id af79cd13be357-787c900af02so110414485a.1 for ; Mon, 26 Feb 2024 03:38:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708947480; x=1709552280; 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=MkHgfdlubDIZc6YiSfjHe4pC8mX8qCcfR0RdSpyweMY=; b=e9x6N/HHyDD5xyrpxDu4iUy9+q/O1p16MCtq8/zd2tu4MyanxwBuojWO2/7NogTpdH QuGZuVhhCMn4GstDH31mW70Ort3c0doBWVS0fTbnExhUX176YHI5h2XZ21R1lJLnUA0T UsV/ZqtyZ40PIXgdFUCcigRdPsYSt/6/KWjRTeiMxXwdBIBJQqKuLFdB+lJdQUp58Qkt ynAxbjm0J0O3e2Px3Uy70cnyRnIP+nqWqlwLGm/w6Ayfmi62Xqu8Wibtysj1tp11GTq7 8WMRUsVI6kLhE8dp7BQt+VF3cPmwslhNHy5vZ6S8GzdZWAf6PQyysUQnzST8TVVXi70/ 33MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708947480; x=1709552280; 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=MkHgfdlubDIZc6YiSfjHe4pC8mX8qCcfR0RdSpyweMY=; b=bBzGmnHiF0V1uIVTC7BpRvImHCB1/AmOKCUo61BUh8Y2xrU5tHPo9Ua8UAuAhMMR2A jYegPhyL1u/LUvC8aXA36nWCIM2LM52TVPiFeDaRZQPW5WWwOacMsnlZmCwZDiI2j8LI hoLu7RX/hCUJhDMXw5iuHT7GmOOFHkJbVhByn7rGTBMgKPRaN/bQoRGGp3DVfvmgymSY s95hls86fhxtovb5SpI3JlSMbZCX7v3w+69nglVXri7c/vuKWgkW2xcupK88LBt9hRz8 aaCZBJzcw2rzg1J1harKjnFwe66/VjwXwc4/N/c5c94i53NMZ3bFEmsM+OcBmBTb3KMP 1spw== X-Forwarded-Encrypted: i=1; AJvYcCW/eHLpVA6F8X7Xh3o7ZEmSULlyVn9ORRS4SykREqrlt6OnCNDHm7i1kYGeBpGy0hfCyHDaKyuvMqaNgK2/xsfJXCouF7KtJiTOlcgB X-Gm-Message-State: AOJu0YzR57ijfGkxGbO+d32UOF3nLq7crMrQQmNv46y9mRPgPaGG2gUc 94VhxhzQFQZGkkNioL509tkOU04mqMiPNF7G5hNghrbQ/sK5WKuoybEL6qcF7LLHlv+vKQ6CTH8 = X-Received: by 2002:a05:620a:a09:b0:787:bd2f:e30d with SMTP id i9-20020a05620a0a0900b00787bd2fe30dmr12995662qka.19.1708947479856; Mon, 26 Feb 2024 03:37:59 -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.37.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 03:37:59 -0800 (PST) From: Manivannan Sadhasivam Date: Mon, 26 Feb 2024 17:07:27 +0530 Subject: [PATCH v3 2/5] PCI: dwc: Skip finding eDMA channels count if glue drivers have passed them Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240226-dw-hdma-v3-2-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=84?= =?utf-8?q?ski?= , 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=1982; i=manivannan.sadhasivam@linaro.org; h=from:subject:message-id; bh=nHkU+s/hofqacaD6DKpKZMYQycR1YXGCRfONZEYjupQ=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBl3HgF/rASIKBtYR+ctXJQGfZnVs/PLtISbbelP 4j25M3FMvCJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCZdx4BQAKCRBVnxHm/pHO 9RAEB/0f+JgPn81KF1QoksP35fTFnUOaahH5T1Ggq54hdmm83UwdirBwQRPYJoo83ttnBr0g+tG mBgVdFOBCPSBv1ccH+TL3DJy1AEXKyLh3cZ8Kdaf79ZoEGpjrjCDQvj2qcRfD5yEeXjMgvjREpJ nmB3ENkWrQsx71qOeeXlq+zoAswDcGaM27iZr01yxP2xOKJyudftYZoINsGwVzqcAqf/WZ7RUtd /57hoXRwB8kDATQEWBFlAMlchTcTixFAgyeUw8iFxaJoRzziT/eyIFaLDEoHPU1cz7hlnx3bD1K P4UN5LN+i9ZoS+zGOWUkRM6SnJR1Ttljmp7hBiKlzj4fJogF X-Developer-Key: i=manivannan.sadhasivam@linaro.org; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791961930927289261 X-GMAIL-MSGID: 1791961930927289261 In the case of Hyper DMA (HDMA) present in DWC controllers, there is no way the drivers can auto detect the number of read/write channels as like its predecessor embedded DMA (eDMA). So the glue drivers making use of HDMA have to pass the channels count during probe. To accommodate that, let's skip finding the channels if the channels count were already passed by glue drivers. If the channels count passed were wrong in any form, then the existing sanity check will catch it. Suggested-by: Serge Semin Reviewed-by: Siddharth Vadapalli Signed-off-by: Manivannan Sadhasivam Reviewed-by: Frank Li --- drivers/pci/controller/dwc/pcie-designware.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index 193fcd86cf93..ce273c3c5421 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -927,13 +927,15 @@ static int dw_pcie_edma_find_channels(struct dw_pcie *pci) { u32 val; - if (pci->edma.mf == EDMA_MF_EDMA_LEGACY) - val = dw_pcie_readl_dbi(pci, PCIE_DMA_VIEWPORT_BASE + PCIE_DMA_CTRL); - else - val = dw_pcie_readl_dma(pci, PCIE_DMA_CTRL); - - pci->edma.ll_wr_cnt = FIELD_GET(PCIE_DMA_NUM_WR_CHAN, val); - pci->edma.ll_rd_cnt = FIELD_GET(PCIE_DMA_NUM_RD_CHAN, val); + if (!pci->edma.ll_wr_cnt || !pci->edma.ll_rd_cnt) { + if (pci->edma.mf == EDMA_MF_EDMA_LEGACY) + val = dw_pcie_readl_dbi(pci, PCIE_DMA_VIEWPORT_BASE + PCIE_DMA_CTRL); + else + val = dw_pcie_readl_dma(pci, PCIE_DMA_CTRL); + + pci->edma.ll_wr_cnt = FIELD_GET(PCIE_DMA_NUM_WR_CHAN, val); + pci->edma.ll_rd_cnt = FIELD_GET(PCIE_DMA_NUM_RD_CHAN, val); + } /* Sanity check the channels count if the mapping was incorrect */ if (!pci->edma.ll_wr_cnt || pci->edma.ll_wr_cnt > EDMA_MAX_WR_CH || From patchwork Mon Feb 26 11:37:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 206588 Return-Path: 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 (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 ; 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 ; 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 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=84?= =?utf-8?q?ski?= , 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791961860882993191 X-GMAIL-MSGID: 1791961860882993191 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 Reviewed-by: Serge Semin --- 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); From patchwork Mon Feb 26 11:37:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 206586 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2012588dyb; Mon, 26 Feb 2024 03:41:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV6BUMspuW1HvaSeliJZjr0RJVp5EIKD9c2122D+klWw0nY5Zw1Xdo2LPc3R9kK9wFCPge4LS7UuGT3NVDhNf0hOs4wGA== X-Google-Smtp-Source: AGHT+IHbjS9if7K+wbI1uDq/2IDV/hzSVch0uIRbO7NhUJ74ZaZ8F2xIdyOXPxdlHiDPtVOQxRn2 X-Received: by 2002:a05:6a20:9f03:b0:1a0:a61d:1230 with SMTP id mk3-20020a056a209f0300b001a0a61d1230mr5942830pzb.23.1708947665193; Mon, 26 Feb 2024 03:41:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708947665; cv=pass; d=google.com; s=arc-20160816; b=qiflsrITa4TWcGKC2pxPKODDUi9NQGtsUbQS3MZmOz8x/DKyXPZHCwaZEaZT9aMECh eHcczWDF2BdWpZVqVWI6v5I6bmTvJXdnSzKBEYPR5ts1ogRkVo2AluPL+iPc4x8jES+F hPrvZZ4SyZNNjA/qtXpnQXmrhNLyXDn1tSyp5800F6fXqCz2Iw2eGURgQilpNQJDeMMl FByiiy5yiCQoNY2rTEfliwXB2U23uqfx2LACGGiLIXBjGmZo+xzQ9Fp6FtgdYo29G5y7 ic/oVavo1LMxGpWP5MjkSygrHvqUS1eZ7aK7gABhekL4RtsNM+ChmaapzUSo37P5Unu+ txYQ== 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=JxUlcjtwrOcaTenBbb8UJnxm67jDgNWVYtF4cGu05o8=; fh=UOojoCVI4+Yb+fP9RY1my2oig+8jp9hnVh7jiO0xOsk=; b=cOAcw8kCZFYu60BDCMB/JmNftbI+MdkNoXFY/PDf9iUKR51Onj5jOdsDwP+jSdFAmZ ChZPfnjnJ+zXTqhA5eZHWqXc9KfI1Gbetg3bZvs5CZILxd5IZenope420p79qyI62s9v mHgImAJYeG0rsYQZPbdpdwhOn0WQsO4tBJsvOYtpgPh76xmYHskALLT+0sC+/RZraJX8 J4Ifl4Ns+fKterF4uUWaL3QcVbkUFUEDC8qXpHtjCMp5/UykP1zxwiq1Gm3xOHoT5Jmu IMcgFe56awf1SCdfihOSw019j+JmAc/uutPInmfzCgkQOxGW4moAFz++32jwgH5nw+of ptpg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HJgwBfj+; 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-81291-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81291-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id lr16-20020a17090b4b9000b0029ad97ca5fdsi66133pjb.80.2024.02.26.03.41.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 03:41:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81291-ouuuleilei=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=HJgwBfj+; 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-81291-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81291-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 0FF6D28B79D for ; Mon, 26 Feb 2024 11:40:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D700C381BB; Mon, 26 Feb 2024 11:38:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HJgwBfj+" Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) (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 27E5D4EB3A for ; Mon, 26 Feb 2024 11:38:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708947496; cv=none; b=VeulTuyYLxlaO8uMZLu+ZvJbUGNFWZ1t+kTyWUSfm35PK5Y7DWADTJhSX7L0TC2F6eDx8+5EyAlzxlPwfif7FbaqvT66YRdVlskeEImJb1Iln5amJU8Fadge/dlmygGoywrPowZGETLS+48pD/rGvMnyyx/sD1Uh0xs9hMc7TIM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708947496; c=relaxed/simple; bh=LfWfeRToUlscmv4bOnNxzBmnBmixoxu2nS+JFrpB7yA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A+p79mm0BzYplSj4Z6WBT6WX3ZHnStJdNTH8dz6t2Jebt/Un/pECwBo9Bt84XQZ7VBls5C+vgVSPsXpNulQ5+O1l7PMoLWjINJ/WBOTLaUwjAUWmFDVGXGmfpyZvidPznxCi0pUlmPeuQhjB3lpFt9Onel/2HphV+rtyW2nYQXA= 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=HJgwBfj+; arc=none smtp.client-ip=209.85.222.169 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-qk1-f169.google.com with SMTP id af79cd13be357-787a8430006so200690385a.3 for ; Mon, 26 Feb 2024 03:38:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708947492; x=1709552292; 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=JxUlcjtwrOcaTenBbb8UJnxm67jDgNWVYtF4cGu05o8=; b=HJgwBfj+yFkMeMZTMX0U5mkMjcsjUvprZyVfTpY8eUhF14cxiAkBuzVVbiQwS/BPUi 97mucV6g8Lo3SOk7Lh2ARFWefsrmGQila/7BI1xd1x+Kg7rgHwvKZYizAOCgeqMrID9S Usutkc0HmMH1scrmn41vcZgXGp06P/u4tvnSVqY+ByNPrOQBewRaiwyrrvoWH54iG35D F8apba0gSNyTIKrLxGUHw7miPfnko9XsQNChkCiaQOIsseyD56BfQoP1IIcFdUGQB9eR jkGTRnm7Me06bqA9d4Mcy+WAeFBfUcrVV/AFOESolKfIkMLBsmOarwJDBxMtMvYW1ZMq CbQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708947492; x=1709552292; 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=JxUlcjtwrOcaTenBbb8UJnxm67jDgNWVYtF4cGu05o8=; b=BVencZbeseYs/FMgeqrRH7yb5AIyC6GP2O05mXwvAzANz3pM2hcyHjlqmlvkREchl5 ASlcznFXLjaNB+C3EdXSDy/ntRWD+VgFjNIl6vSDDwq+JLcBTe7a/NvcU5tqYXfBLvfN HKbBsW1MyBKp+Vq83JJG46//3A4ZxLsU2ApdKTHgUX7PpRHRbt8hepzLrn8dMDo0jtXw oUhxGggerDfEx8pLjQ+3bC3ePMfNgUO1/CEhlxq1S9HvKab0FDjnfZuEc1fLLlZigcKq kO3ljA/0KwRH4kbDe7mIB/p0xLCYhV71wOA1J+/kYXW8OUwbY69UjMH+WYI17+qT4uoV kh4g== X-Forwarded-Encrypted: i=1; AJvYcCVML0RDBak4lmktsvuVCFC20avSmjrxz/3xCN2TXtmYymjdUj8zZgRXRbAqKvSRenbxJEH2aPQi0ptd4CR47eex1oxL30K3M56wGxgJ X-Gm-Message-State: AOJu0YwG+0z8a901ihw/7/smn/7e5piqm2E6E4yT9AeFEz+wSvReApfn FAOC0BjPx3CxhuO/i5EpFTzfIDwJitcvySSgt/bQhzXm83PSF2MCUdMQiwpH9g== X-Received: by 2002:ac8:7d12:0:b0:42e:5f70:f17a with SMTP id g18-20020ac87d12000000b0042e5f70f17amr8687103qtb.11.1708947492124; Mon, 26 Feb 2024 03:38:12 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 03:38:11 -0800 (PST) From: Manivannan Sadhasivam Date: Mon, 26 Feb 2024 17:07:29 +0530 Subject: [PATCH v3 4/5] PCI: qcom-ep: Add HDMA support for SA8775P SoC Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240226-dw-hdma-v3-4-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=84?= =?utf-8?q?ski?= , 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 , Mrinmay Sarkar , Siddharth Vadapalli X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2794; i=manivannan.sadhasivam@linaro.org; h=from:subject:message-id; bh=K4+v7NtEJKfx2pgrszooW5RqKHWkxdFvG2huKB8ULNg=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBl3HgGPMff0pTdqV0ne8r2AzpEGIe63FIvUfDcN Xzg1Te64IqJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCZdx4BgAKCRBVnxHm/pHO 9XY2B/9AGY6k/obyeFs957a00oxYiEUi14PCBQ9NzkUgCpKquGGO9hJ45G1L6CGZCVLynNyjbug DGUFDhCTH8ouXGXzoZ3XUAgaZzP6zv1h+1UfnzMFamf06Yx5sqogYNWD96mrAPDBZO75bTjdslK FeCvBXoNNwnLXev8l0t4/dQ47hlMvQFFHa3VjxnAThDC4/utBdYRdmhFwVJTig/n5FqH3sw0iZ6 lAEkNd6cPL1d6s19AQkxPBXlQeBp61XMcELjtgsKU2rrfaRoP7QqX9jdDtFxxFCZ2nfSqu90LKZ Xzp/zYbgbFhrou8RhwOVC2RNUz5eWznE+Aq9Vu0OqFCq1GQD X-Developer-Key: i=manivannan.sadhasivam@linaro.org; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791961506784989795 X-GMAIL-MSGID: 1791961506784989795 From: Mrinmay Sarkar SA8775P SoC supports the new Hyper DMA (HDMA) DMA Engine inside the DWC IP. Let's add support for it by passing the mapping format and the number of read/write channels count. The PCIe EP controller used on this SoC is of version 1.34.0, so a separate config struct is introduced for the sake of enabling HDMA conditionally. It should be noted that for the eDMA support (predecessor of HDMA), there are no mapping format and channels count specified. That is because eDMA supports auto detection of both parameters, whereas HDMA doesn't. Signed-off-by: Mrinmay Sarkar [mani: Reworded commit message, added kdoc, and minor cleanups] Reviewed-by: Siddharth Vadapalli Signed-off-by: Manivannan Sadhasivam Reviewed-by: Frank Li --- drivers/pci/controller/dwc/pcie-qcom-ep.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c index 45008e054e31..89d06a3e6e06 100644 --- a/drivers/pci/controller/dwc/pcie-qcom-ep.c +++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c @@ -149,6 +149,14 @@ enum qcom_pcie_ep_link_status { QCOM_PCIE_EP_LINK_DOWN, }; +/** + * struct qcom_pcie_ep_cfg - Per SoC config struct + * @hdma_support: HDMA support on this SoC + */ +struct qcom_pcie_ep_cfg { + bool hdma_support; +}; + /** * struct qcom_pcie_ep - Qualcomm PCIe Endpoint Controller * @pci: Designware PCIe controller struct @@ -803,6 +811,7 @@ static const struct dw_pcie_ep_ops pci_ep_ops = { static int qcom_pcie_ep_probe(struct platform_device *pdev) { + const struct qcom_pcie_ep_cfg *cfg; struct device *dev = &pdev->dev; struct qcom_pcie_ep *pcie_ep; char *name; @@ -816,6 +825,14 @@ static int qcom_pcie_ep_probe(struct platform_device *pdev) pcie_ep->pci.ops = &pci_ops; pcie_ep->pci.ep.ops = &pci_ep_ops; pcie_ep->pci.edma.nr_irqs = 1; + + cfg = of_device_get_match_data(dev); + if (cfg && cfg->hdma_support) { + pcie_ep->pci.edma.ll_wr_cnt = 8; + pcie_ep->pci.edma.ll_rd_cnt = 8; + pcie_ep->pci.edma.mf = EDMA_MF_HDMA_NATIVE; + } + platform_set_drvdata(pdev, pcie_ep); ret = qcom_pcie_ep_get_resources(pdev, pcie_ep); @@ -874,8 +891,12 @@ static void qcom_pcie_ep_remove(struct platform_device *pdev) qcom_pcie_disable_resources(pcie_ep); } +static const struct qcom_pcie_ep_cfg cfg_1_34_0 = { + .hdma_support = true, +}; + static const struct of_device_id qcom_pcie_ep_match[] = { - { .compatible = "qcom,sa8775p-pcie-ep", }, + { .compatible = "qcom,sa8775p-pcie-ep", .data = &cfg_1_34_0}, { .compatible = "qcom,sdx55-pcie-ep", }, { .compatible = "qcom,sm8450-pcie-ep", }, { } From patchwork Mon Feb 26 11:37:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 206585 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2012538dyb; Mon, 26 Feb 2024 03:40:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWxVW5M+iWfLekgZER7PTh9plTkuky9ml4BZKBfUf2Uisjvsa6P2BX0GSlMhzIaxkNIday/URvSHXxkOdWxJ+kK63g8nQ== X-Google-Smtp-Source: AGHT+IEzBwC7KHB1BlHRQHVp4nuuci+WrXyxoUtBkVhe9tLsOYTU9LsgizJsfNfynCUpmeKzTrIZ X-Received: by 2002:a05:6214:d6f:b0:690:696:6031 with SMTP id 15-20020a0562140d6f00b0069006966031mr4120703qvs.57.1708947654776; Mon, 26 Feb 2024 03:40:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708947654; cv=pass; d=google.com; s=arc-20160816; b=zx+WnloiFjp7t0pLPBgr3qGLwEQRTl2iMiu8UWMhvKvI6a3NLAYdb1EXUQ9C26Di3N xCKIeH0zb32VZIL/UIKqKm084ttyb6vK9g+L7IESGfMMjoDYeHJ1iaU2vNG6lz6dJbHd GjfPKiKgE119O7930FbdMVJWYBXVRDiNfZzVA66rdo0NYjX5i+Xt1o67OXcE773fOyEH 8m7hRlybhUjgvxy6Qcm7vhMbfbYyWt+S6jc7vrLO19zQrGyP13I5cWVH8S4+EAwDvH3V BNGCZRIHyB2qaddfT53+uHoLNB4Wz+ZReB9/F3L1npWRx71OoQU+4QuvVkLSST0THKsd 9CRA== 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=+w+dz2LhhxLyj9g/T/Ynx7ET7ucJXKJT/WmnsqQcygw=; fh=c0Lhd38wNYav5HNTVfvLUQeiAKEa08WNjr10hYghD+8=; b=xRWhDAyuHEQMtwtP8X6+QCC24Qg6d8dMo83byayJd2gUyJlMwh69OAa776uDPu827H AawfTxF1rwyYJsQVRnUgAlBa6QKaeXlwvdBe8e7qoEnJLn6LMtD9XZ9MxY6Jj3QLl4BJ OQfhZxP0T9JtHif2RWGlFYAClThN89drf0AztayLBB2MACY1xvnvB3smlAy28CT9aFYt ks2GsESNMoaNXbAWLzor6b7C8Rn+vYC+7qZCkL4Ys96gJLy0VPbeBiW4thrHsuVfqbcx GvTe6KKTGHUdPb0MhBfrzfj5t6j8nC+/tTJEc67VbpfjfF+0J4jJXITh0NWDiQs1eSbS BegQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o7NmKcXs; 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-81292-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81292-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id kj16-20020a056214529000b0068fd097e461si4734782qvb.487.2024.02.26.03.40.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 03:40:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81292-ouuuleilei=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=o7NmKcXs; 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-81292-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81292-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 908F91C24B37 for ; Mon, 26 Feb 2024 11:40:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F09E4F615; Mon, 26 Feb 2024 11:38:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="o7NmKcXs" Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (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 4B6224F1EB for ; Mon, 26 Feb 2024 11:38:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708947501; cv=none; b=M70Q4rTEFOYWQflgpPIstXdrznPVqXSBeWMQ+hLPMQsageQSByTFtJOyveWaUZFIxgug6RSzaVKC2lxin6BY5OWPWJHgjM/Nq0QfWh5yGQryhBdUtItMSvk9njXTCiUiNozlY3GEttqmRsh8cd38oJJ0IxBst3CcLIx28GePPg8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708947501; c=relaxed/simple; bh=rySUPOYrv9T+HZDbsprHAcPFbuAMziJaAQnsy9yh8Qw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AjoosNCI+mwEj4tW79bFF6bI60QIVCGNCpFu3NpTxmkNNx2hHmogtjdgOl8beiTFHyDNdq7oKideZOJYsbbnaXoTLDZN7+khwJy2QE6DxzWOh/2C5p5CQyYTD1RxcSBVu14A3rn9HCGe5uB21EUodllPrViLGfx3UIFoDuef+RA= 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=o7NmKcXs; arc=none smtp.client-ip=209.85.222.178 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-qk1-f178.google.com with SMTP id af79cd13be357-7810827e54eso244519185a.2 for ; Mon, 26 Feb 2024 03:38:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708947498; x=1709552298; 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=+w+dz2LhhxLyj9g/T/Ynx7ET7ucJXKJT/WmnsqQcygw=; b=o7NmKcXszo+BqMNkU9Yb3xrTXkDX4fAEdnEZQ//UJo/OzdBqck2rYONAcgwvM+/09N cJLtfzO3Mzij4Cu0GxRVeIKtVNYqISFky24J+yLyJNbHk2hRA52qPMe+3pgH3G879nxE OA+mz8uQHU6IZfJWTALqVsYN6Gj1UlArV1mhdIRm35GKTF19Ljsih9QuDIWsCLD2J+o4 JSBblX61IwUySiMuFveSy6pFiUCXH7uhWYyMek8nizWa27xoWPbMfLYcN+tGJMQiT3p1 UboOwcvt73CmDcmpkiLglqwZzxmauIL2VTCLJzipwPj7HjPcJ3rnSo6JLLOkG0qOJEXj N8MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708947498; x=1709552298; 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=+w+dz2LhhxLyj9g/T/Ynx7ET7ucJXKJT/WmnsqQcygw=; b=UZvcRJyxel4OwyBgx7C78l1t9OOcRTzvBjQ22a6idb8rwp02zBVSB0s/cEZph7L6va OEH1sQq/VEoqzZCQydR8jDFKdOx7t7maWm8BvRwNtSZ1NYHLsDW2PGTPEgUo+A28b0zJ a6X7JKkhwKiOkjGjeuXiMDdkBn3VwgdIPf1XAc8BO6ioh4yt7ufMrDsJKDZDeN/pwL7f BPZQu1Etw0whWlyK45dh3AvgHtjRN3jwTdPRjLqCbig8S3fJkHtE+giX264BEoLuY+C1 sZ27eS2TAy1EVemhC4dfUN4/H1xLX8B7ERFhZkQxUGxhuQqLDgqlzE55C/y6YeRxAaWZ xH6g== X-Forwarded-Encrypted: i=1; AJvYcCUQqjiWJ8Zgu7SMvHrmy0bHX+SJqdekbtOayj2nWKRwnN7QjHehOuH4Sb8oQuywu20hvYnNwr2HCigwH4LTs5HKUwa9QJsacRfpYkPT X-Gm-Message-State: AOJu0YwHQpkvyHIBSXQ5RYqnFP6HDLVPdZ3jg7A26xgqfsFuodqHlnTl Wi7qBdJMVRZ0pMgFCKnKMJ2TGYLZYzxZW4K6qRQ4lKgR9UwIPCQQtGrQxbFL8g== X-Received: by 2002:a05:620a:2014:b0:787:3769:d747 with SMTP id c20-20020a05620a201400b007873769d747mr6779105qka.59.1708947498204; Mon, 26 Feb 2024 03:38:18 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 03:38:17 -0800 (PST) From: Manivannan Sadhasivam Date: Mon, 26 Feb 2024 17:07:30 +0530 Subject: [PATCH v3 5/5] PCI: epf-mhi: Enable HDMA for SA8775P SoC Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240226-dw-hdma-v3-5-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=84?= =?utf-8?q?ski?= , 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 , Mrinmay Sarkar , Siddharth Vadapalli X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=974; i=manivannan.sadhasivam@linaro.org; h=from:subject:message-id; bh=isUh7Dyx4QOFqnRUN5haG5ZOvquZ4WskKD+PqeTLyJ8=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBl3HgGRFaIIukjpQ+MlVp1t7r1KyH4o9t0giPf0 ecjdOvjr4+JATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCZdx4BgAKCRBVnxHm/pHO 9T0gB/wJn/wKQ4SsV6Ave0iIOFHg8ILRsYljtotpgZCkHh/5Kj1edf/8JHtagUfbFRpAG79lmH2 O1MojHHi2V9sIKmQmUmcpuOTMRDxwbdCebgoSKNoHPArCydW0NeU4pzCKz9EE81+RlUR12fPoS/ ZGPPGrolyRh6QD9wXY5iFzg3Yl3RNCEAC4lx3D4bFD3xbujKklIHTBHNUApv+5z8th9yggp7DRd sBP0G7dSjLssbgvE9DAsWGoXqVaz4aTH+jTEs9w1V1EuwHzla3+MJc2Sy0FL95Ga5Kdw3ZPRcLb k071qmHaETAfzo4PIDsL3SeyXE9Ic3T3xa5XDj6Fh1otg3tt X-Developer-Key: i=manivannan.sadhasivam@linaro.org; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791961496387693210 X-GMAIL-MSGID: 1791961496387693210 From: Mrinmay Sarkar SA8775P SoC supports Hyper DMA (HDMA) DMA Engine present in the DWC IP. So, let's enable it in the EPF driver so that the DMA Engine APIs can be used for data transfer. Signed-off-by: Mrinmay Sarkar [mani: reworded commit message] Reviewed-by: Siddharth Vadapalli Signed-off-by: Manivannan Sadhasivam Reviewed-by: Frank Li --- drivers/pci/endpoint/functions/pci-epf-mhi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/endpoint/functions/pci-epf-mhi.c b/drivers/pci/endpoint/functions/pci-epf-mhi.c index 2c54d80107cf..570c1d1fb12e 100644 --- a/drivers/pci/endpoint/functions/pci-epf-mhi.c +++ b/drivers/pci/endpoint/functions/pci-epf-mhi.c @@ -137,6 +137,7 @@ static const struct pci_epf_mhi_ep_info sa8775p_info = { .epf_flags = PCI_BASE_ADDRESS_MEM_TYPE_32, .msi_count = 32, .mru = 0x8000, + .flags = MHI_EPF_USE_DMA, }; struct pci_epf_mhi {