PCI: endpoint: Pass page size as argument to pci_epc_mem_init()
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. Link: https://lore.kernel.org/r/1588854799-13710-5-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
This commit is contained in:
parent
3282636871
commit
975cf23e3a
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue