diff options
author | Kishon Vijay Abraham I <kishon@ti.com> | 2019-03-25 05:39:25 -0400 |
---|---|---|
committer | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 2019-04-11 05:58:02 -0400 |
commit | f3560a9f88ae3aa2b2976a1a0175478f6fd32fe8 (patch) | |
tree | d710426dc2bb5f2073312764d275883f63bd2f54 | |
parent | 47fe944138a6e34697e1778a74eff00ed9472b2a (diff) |
PCI: keystone: Perform host initialization in a single function
No functional change. Instead of having two functions
ks_pcie_add_pcie_port() and ks_pcie_dw_host_init() for initializing
host, have a single function to perform all the host initialization.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
-rw-r--r-- | drivers/pci/controller/dwc/pci-keystone.c | 63 |
1 files changed, 23 insertions, 40 deletions
diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c index e50f8773e768..566718ea7ebf 100644 --- a/drivers/pci/controller/dwc/pci-keystone.c +++ b/drivers/pci/controller/dwc/pci-keystone.c | |||
@@ -487,45 +487,6 @@ static int ks_pcie_start_link(struct dw_pcie *pci) | |||
487 | return 0; | 487 | return 0; |
488 | } | 488 | } |
489 | 489 | ||
490 | /** | ||
491 | * ks_pcie_dw_host_init() - initialize host for v3_65 dw hardware | ||
492 | * | ||
493 | * Ioremap the register resources, initialize legacy irq domain | ||
494 | * and call dw_pcie_v3_65_host_init() API to initialize the Keystone | ||
495 | * PCI host controller. | ||
496 | */ | ||
497 | static int __init ks_pcie_dw_host_init(struct keystone_pcie *ks_pcie) | ||
498 | { | ||
499 | struct dw_pcie *pci = ks_pcie->pci; | ||
500 | struct pcie_port *pp = &pci->pp; | ||
501 | struct device *dev = pci->dev; | ||
502 | struct platform_device *pdev = to_platform_device(dev); | ||
503 | struct resource *res; | ||
504 | |||
505 | /* Index 0 is the config reg. space address */ | ||
506 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
507 | pci->dbi_base = devm_pci_remap_cfg_resource(dev, res); | ||
508 | if (IS_ERR(pci->dbi_base)) | ||
509 | return PTR_ERR(pci->dbi_base); | ||
510 | |||
511 | /* | ||
512 | * We set these same and is used in pcie rd/wr_other_conf | ||
513 | * functions | ||
514 | */ | ||
515 | pp->va_cfg0_base = pci->dbi_base + SPACE0_REMOTE_CFG_OFFSET; | ||
516 | pp->va_cfg1_base = pp->va_cfg0_base; | ||
517 | |||
518 | /* Index 1 is the application reg. space address */ | ||
519 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | ||
520 | ks_pcie->va_app_base = devm_ioremap_resource(dev, res); | ||
521 | if (IS_ERR(ks_pcie->va_app_base)) | ||
522 | return PTR_ERR(ks_pcie->va_app_base); | ||
523 | |||
524 | ks_pcie->app = *res; | ||
525 | |||
526 | return dw_pcie_host_init(pp); | ||
527 | } | ||
528 | |||
529 | static void ks_pcie_quirk(struct pci_dev *dev) | 490 | static void ks_pcie_quirk(struct pci_dev *dev) |
530 | { | 491 | { |
531 | struct pci_bus *bus = dev->bus; | 492 | struct pci_bus *bus = dev->bus; |
@@ -843,10 +804,32 @@ static int __init ks_pcie_add_pcie_port(struct keystone_pcie *ks_pcie, | |||
843 | struct dw_pcie *pci = ks_pcie->pci; | 804 | struct dw_pcie *pci = ks_pcie->pci; |
844 | struct pcie_port *pp = &pci->pp; | 805 | struct pcie_port *pp = &pci->pp; |
845 | struct device *dev = &pdev->dev; | 806 | struct device *dev = &pdev->dev; |
807 | struct resource *res; | ||
846 | int ret; | 808 | int ret; |
847 | 809 | ||
810 | /* Index 0 is the config reg. space address */ | ||
811 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
812 | pci->dbi_base = devm_pci_remap_cfg_resource(dev, res); | ||
813 | if (IS_ERR(pci->dbi_base)) | ||
814 | return PTR_ERR(pci->dbi_base); | ||
815 | |||
816 | /* | ||
817 | * We set these same and is used in pcie rd/wr_other_conf | ||
818 | * functions | ||
819 | */ | ||
820 | pp->va_cfg0_base = pci->dbi_base + SPACE0_REMOTE_CFG_OFFSET; | ||
821 | pp->va_cfg1_base = pp->va_cfg0_base; | ||
822 | |||
823 | /* Index 1 is the application reg. space address */ | ||
824 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | ||
825 | ks_pcie->va_app_base = devm_ioremap_resource(dev, res); | ||
826 | if (IS_ERR(ks_pcie->va_app_base)) | ||
827 | return PTR_ERR(ks_pcie->va_app_base); | ||
828 | |||
829 | ks_pcie->app = *res; | ||
830 | |||
848 | pp->ops = &ks_pcie_host_ops; | 831 | pp->ops = &ks_pcie_host_ops; |
849 | ret = ks_pcie_dw_host_init(ks_pcie); | 832 | ret = dw_pcie_host_init(pp); |
850 | if (ret) { | 833 | if (ret) { |
851 | dev_err(dev, "failed to initialize host\n"); | 834 | dev_err(dev, "failed to initialize host\n"); |
852 | return ret; | 835 | return ret; |