aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/fsl_pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/sysdev/fsl_pci.c')
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c73
1 files changed, 71 insertions, 2 deletions
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 6073288fed29..a7b2a600d0a4 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * MPC83xx/85xx/86xx PCI/PCIE support routing. 2 * MPC83xx/85xx/86xx PCI/PCIE support routing.
3 * 3 *
4 * Copyright 2007-2011 Freescale Semiconductor, Inc. 4 * Copyright 2007-2012 Freescale Semiconductor, Inc.
5 * Copyright 2008-2009 MontaVista Software, Inc. 5 * Copyright 2008-2009 MontaVista Software, Inc.
6 * 6 *
7 * Initial author: Xianghua Xiao <x.xiao@freescale.com> 7 * Initial author: Xianghua Xiao <x.xiao@freescale.com>
@@ -36,7 +36,7 @@
36 36
37static int fsl_pcie_bus_fixup, is_mpc83xx_pci; 37static int fsl_pcie_bus_fixup, is_mpc83xx_pci;
38 38
39static void __init quirk_fsl_pcie_header(struct pci_dev *dev) 39static void __devinit quirk_fsl_pcie_header(struct pci_dev *dev)
40{ 40{
41 u8 progif; 41 u8 progif;
42 42
@@ -807,3 +807,72 @@ u64 fsl_pci_immrbar_base(struct pci_controller *hose)
807 807
808 return 0; 808 return 0;
809} 809}
810
811#if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx)
812static const struct of_device_id pci_ids[] = {
813 { .compatible = "fsl,mpc8540-pci", },
814 { .compatible = "fsl,mpc8548-pcie", },
815 { .compatible = "fsl,mpc8610-pci", },
816 { .compatible = "fsl,mpc8641-pcie", },
817 { .compatible = "fsl,p1022-pcie", },
818 { .compatible = "fsl,p1010-pcie", },
819 { .compatible = "fsl,p1023-pcie", },
820 { .compatible = "fsl,p4080-pcie", },
821 { .compatible = "fsl,qoriq-pcie-v2.3", },
822 { .compatible = "fsl,qoriq-pcie-v2.2", },
823 {},
824};
825
826struct device_node *fsl_pci_primary;
827
828void __devinit fsl_pci_init(void)
829{
830 struct device_node *node;
831 struct pci_controller *hose;
832 dma_addr_t max = 0xffffffff;
833
834 /* Callers can specify the primary bus using other means. */
835 if (!fsl_pci_primary) {
836 /* If a PCI host bridge contains an ISA node, it's primary. */
837 node = of_find_node_by_type(NULL, "isa");
838 while ((fsl_pci_primary = of_get_parent(node))) {
839 of_node_put(node);
840 node = fsl_pci_primary;
841
842 if (of_match_node(pci_ids, node))
843 break;
844 }
845 }
846
847 node = NULL;
848 for_each_node_by_type(node, "pci") {
849 if (of_match_node(pci_ids, node)) {
850 /*
851 * If there's no PCI host bridge with ISA, arbitrarily
852 * designate one as primary. This can go away once
853 * various bugs with primary-less systems are fixed.
854 */
855 if (!fsl_pci_primary)
856 fsl_pci_primary = node;
857
858 fsl_add_bridge(node, fsl_pci_primary == node);
859 hose = pci_find_hose_for_OF_device(node);
860 max = min(max, hose->dma_window_base_cur +
861 hose->dma_window_size);
862 }
863 }
864
865#ifdef CONFIG_SWIOTLB
866 /*
867 * if we couldn't map all of DRAM via the dma windows
868 * we need SWIOTLB to handle buffers located outside of
869 * dma capable memory region
870 */
871 if (memblock_end_of_DRAM() - 1 > max) {
872 ppc_swiotlb_enable = 1;
873 set_pci_dma_ops(&swiotlb_dma_ops);
874 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
875 }
876#endif
877}
878#endif