Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp697069ybj; Thu, 7 May 2020 05:39:45 -0700 (PDT) X-Google-Smtp-Source: APiQypISFbF4crAb4nOq34Aqg4s7fw2kvJgHgSpZYGG89JKNvofu2ai4HS5LeB3JAVjOFGoeLpwd X-Received: by 2002:a17:907:118b:: with SMTP id uz11mr11446897ejb.89.1588855185141; Thu, 07 May 2020 05:39:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588855185; cv=none; d=google.com; s=arc-20160816; b=Aed6HqlWv/uhbsWY30EKO9omDMSIsZtuchF1tbHhZuPQ/QhDWY4Xg6IHwpRiJ3jmTD cTfoBipQac7FqdK9wj8ABNrpA+AJKaXp+isdGeXKjNaqdJLAu2QUNIackUcOwzSp9PfZ 9OZTVP/TZYm4lltwzSRlqzjB3017ln4vLIGy27JSx/ehQwU+q09AJxNieEpG2J4nKsVC GZk1krSA4c63HRC5xUY2oy6kt0rsBz2/wMcGG1DmU+Sw2ZWKJv8xeewYnGBnrclsADQC aNHe3OK3Ez1FXnETgoHWPaHmClGt6pbnY2AjKswG1BqecnaiTycFAgcVXYpd4NOzYS3q QNmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=1Pm4HfFSGCXHXhv6y/QLFWrt4Au4o1h1RAilLvIctFM=; b=xAbjGdUfZXu1pAYxRIvYzPsHPJpn62WRlwhjM8pXXl8LGFRaW73D0VC37CmUSY7cTj nnXPh3PmXlKTYPkO6Z8qIrW5+/628nBc55Hw0VM6XELuMXjV/7aVb2IAqjXbUlAcDCwF 8GF5gGVpXxcvw3h6YMohu5zkau/qo0oltxfEpmSURIO06z9rVJOl1sgYh1v0CS9u/kuE a8MGU6U1u8X1T13fMfE9fpyhAs9JfbV2pvNksJv8/XH12fR9XzEjI43NdIw2dZyCwBCm CPKN/tJN5U5bMCMY0QKiCzPnpaXzkOJxS461orvJ7H66GhRYvw6qbKY1VP7tPrthZ2qS uU1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u3si3282108edp.525.2020.05.07.05.39.17; Thu, 07 May 2020 05:39:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727124AbgEGMfM (ORCPT + 99 others); Thu, 7 May 2020 08:35:12 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:5168 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725939AbgEGMfM (ORCPT ); Thu, 7 May 2020 08:35:12 -0400 X-IronPort-AV: E=Sophos;i="5.73,363,1583161200"; d="scan'208";a="46285059" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 07 May 2020 21:35:11 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id B138A400C089; Thu, 7 May 2020 21:35:06 +0900 (JST) From: Lad Prabhakar To: Lorenzo Pieralisi Cc: Rob Herring , Tom Joseph , Jingoo Han , Bjorn Helgaas , Gustavo Pimentel , Marek Vasut , Yoshihiro Shimoda , Shawn Lin , Heiko Stuebner , Kishon Vijay Abraham I , Geert Uytterhoeven , linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Prabhakar , Lad Prabhakar Subject: [PATCH v10 4/8] PCI: endpoint: Pass page size as argument to pci_epc_mem_init() Date: Thu, 7 May 2020 13:33:15 +0100 Message-Id: <1588854799-13710-5-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1588854799-13710-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <1588854799-13710-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pci_epc_mem_init() internally used page size equal to *PAGE_SIZE* to manage the address space so instead just pass the page size as a argument to pci_epc_mem_init(). Also make pci_epc_mem_init() as a C function instead of a macro function in preparation for adding support for pci-epc-mem core to handle multiple windows. Signed-off-by: Lad Prabhakar Reviewed-by: Yoshihiro Shimoda Acked-by: Kishon Vijay Abraham I --- drivers/pci/controller/cadence/pcie-cadence-ep.c | 2 +- drivers/pci/controller/pcie-rockchip-ep.c | 2 +- drivers/pci/endpoint/pci-epc-mem.c | 7 +++++++ include/linux/pci-epc.h | 5 ++--- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/cadence/pcie-cadence-ep.c b/drivers/pci/controller/cadence/pcie-cadence-ep.c index 1c173dad67d1..1c15c8352125 100644 --- a/drivers/pci/controller/cadence/pcie-cadence-ep.c +++ b/drivers/pci/controller/cadence/pcie-cadence-ep.c @@ -450,7 +450,7 @@ int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep) epc->max_functions = 1; ret = pci_epc_mem_init(epc, pcie->mem_res->start, - resource_size(pcie->mem_res)); + resource_size(pcie->mem_res), PAGE_SIZE); if (ret < 0) { dev_err(dev, "failed to initialize the memory space\n"); goto err_init; diff --git a/drivers/pci/controller/pcie-rockchip-ep.c b/drivers/pci/controller/pcie-rockchip-ep.c index d743b0a48988..5eaf36629a75 100644 --- a/drivers/pci/controller/pcie-rockchip-ep.c +++ b/drivers/pci/controller/pcie-rockchip-ep.c @@ -615,7 +615,7 @@ static int rockchip_pcie_ep_probe(struct platform_device *pdev) rockchip_pcie_write(rockchip, BIT(0), PCIE_CORE_PHY_FUNC_CFG); err = pci_epc_mem_init(epc, rockchip->mem_res->start, - resource_size(rockchip->mem_res)); + resource_size(rockchip->mem_res), PAGE_SIZE); if (err < 0) { dev_err(dev, "failed to initialize the memory space\n"); goto err_uninit_port; diff --git a/drivers/pci/endpoint/pci-epc-mem.c b/drivers/pci/endpoint/pci-epc-mem.c index abfac1109a13..cdd1d3821249 100644 --- a/drivers/pci/endpoint/pci-epc-mem.c +++ b/drivers/pci/endpoint/pci-epc-mem.c @@ -93,6 +93,13 @@ return ret; } EXPORT_SYMBOL_GPL(__pci_epc_mem_init); +int pci_epc_mem_init(struct pci_epc *epc, phys_addr_t base, + size_t size, size_t page_size) +{ + return __pci_epc_mem_init(epc, base, size, page_size); +} +EXPORT_SYMBOL_GPL(pci_epc_mem_init); + /** * pci_epc_mem_exit() - cleanup the pci_epc_mem structure * @epc: the EPC device that invoked pci_epc_mem_exit diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h index e0ed9d01f6e5..5bc1de65849e 100644 --- a/include/linux/pci-epc.h +++ b/include/linux/pci-epc.h @@ -137,9 +137,6 @@ struct pci_epc_features { #define devm_pci_epc_create(dev, ops) \ __devm_pci_epc_create((dev), (ops), THIS_MODULE) -#define pci_epc_mem_init(epc, phys_addr, size) \ - __pci_epc_mem_init((epc), (phys_addr), (size), PAGE_SIZE) - static inline void epc_set_drvdata(struct pci_epc *epc, void *data) { dev_set_drvdata(&epc->dev, data); @@ -195,6 +192,8 @@ unsigned int pci_epc_get_first_free_bar(const struct pci_epc_features struct pci_epc *pci_epc_get(const char *epc_name); void pci_epc_put(struct pci_epc *epc); +int pci_epc_mem_init(struct pci_epc *epc, phys_addr_t base, + size_t size, size_t page_size); int __pci_epc_mem_init(struct pci_epc *epc, phys_addr_t phys_addr, size_t size, size_t page_size); void pci_epc_mem_exit(struct pci_epc *epc); -- 2.17.1