diff options
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r-- | arch/powerpc/sysdev/fsl_pci.c | 71 | ||||
-rw-r--r-- | arch/powerpc/sysdev/fsl_pci.h | 8 |
2 files changed, 78 insertions, 1 deletions
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index edbf79465d50..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> |
@@ -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) | ||
812 | static 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 | |||
826 | struct device_node *fsl_pci_primary; | ||
827 | |||
828 | void __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 | ||
diff --git a/arch/powerpc/sysdev/fsl_pci.h b/arch/powerpc/sysdev/fsl_pci.h index a39ed5cc2c5a..baa0fd18289f 100644 --- a/arch/powerpc/sysdev/fsl_pci.h +++ b/arch/powerpc/sysdev/fsl_pci.h | |||
@@ -93,5 +93,13 @@ extern void fsl_pcibios_fixup_bus(struct pci_bus *bus); | |||
93 | extern int mpc83xx_add_bridge(struct device_node *dev); | 93 | extern int mpc83xx_add_bridge(struct device_node *dev); |
94 | u64 fsl_pci_immrbar_base(struct pci_controller *hose); | 94 | u64 fsl_pci_immrbar_base(struct pci_controller *hose); |
95 | 95 | ||
96 | extern struct device_node *fsl_pci_primary; | ||
97 | |||
98 | #ifdef CONFIG_FSL_PCI | ||
99 | void fsl_pci_init(void); | ||
100 | #else | ||
101 | static inline void fsl_pci_init(void) {} | ||
102 | #endif | ||
103 | |||
96 | #endif /* __POWERPC_FSL_PCI_H */ | 104 | #endif /* __POWERPC_FSL_PCI_H */ |
97 | #endif /* __KERNEL__ */ | 105 | #endif /* __KERNEL__ */ |