Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/83xx: merge PCI bridge additions

Nearly all mpc83xx-based boards have a common piece of code - one that
loops over all pci/pcie bridges and registers them. Merge that code into
a special function common to all boards.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

authored by

Dmitry Eremin-Solenikov and committed by
Kumar Gala
bede480d 7669d58c

+34 -80
+3 -4
arch/powerpc/platforms/83xx/km83xx.c
··· 51 51 */ 52 52 static void __init mpc83xx_km_setup_arch(void) 53 53 { 54 + #ifdef CONFIG_QUICC_ENGINE 54 55 struct device_node *np; 56 + #endif 55 57 56 58 if (ppc_md.progress) 57 59 ppc_md.progress("kmpbec83xx_setup_arch()", 0); 58 60 59 - #ifdef CONFIG_PCI 60 - for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") 61 - mpc83xx_add_bridge(np); 62 - #endif 61 + mpc83xx_setup_pci(); 63 62 64 63 #ifdef CONFIG_QUICC_ENGINE 65 64 qe_reset();
+14
arch/powerpc/platforms/83xx/misc.c
··· 12 12 #include <linux/stddef.h> 13 13 #include <linux/kernel.h> 14 14 #include <linux/of_platform.h> 15 + #include <linux/pci.h> 15 16 16 17 #include <asm/io.h> 17 18 #include <asm/hw_irq.h> 18 19 #include <asm/ipic.h> 19 20 #include <asm/qe_ic.h> 20 21 #include <sysdev/fsl_soc.h> 22 + #include <sysdev/fsl_pci.h> 21 23 22 24 #include "mpc83xx.h" 23 25 ··· 130 128 of_platform_bus_probe(NULL, of_bus_ids, NULL); 131 129 return 0; 132 130 } 131 + 132 + #ifdef CONFIG_PCI 133 + void __init mpc83xx_setup_pci(void) 134 + { 135 + struct device_node *np; 136 + 137 + for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") 138 + mpc83xx_add_bridge(np); 139 + for_each_compatible_node(np, "pci", "fsl,mpc8314-pcie") 140 + mpc83xx_add_bridge(np); 141 + } 142 + #endif
+1 -10
arch/powerpc/platforms/83xx/mpc831x_rdb.c
··· 28 28 */ 29 29 static void __init mpc831x_rdb_setup_arch(void) 30 30 { 31 - #ifdef CONFIG_PCI 32 - struct device_node *np; 33 - #endif 34 - 35 31 if (ppc_md.progress) 36 32 ppc_md.progress("mpc831x_rdb_setup_arch()", 0); 37 33 38 - #ifdef CONFIG_PCI 39 - for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") 40 - mpc83xx_add_bridge(np); 41 - for_each_compatible_node(np, "pci", "fsl,mpc8314-pcie") 42 - mpc83xx_add_bridge(np); 43 - #endif 34 + mpc83xx_setup_pci(); 44 35 mpc831x_usb_cfg(); 45 36 } 46 37
+1 -4
arch/powerpc/platforms/83xx/mpc832x_mds.c
··· 72 72 of_node_put(np); 73 73 } 74 74 75 - #ifdef CONFIG_PCI 76 - for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") 77 - mpc83xx_add_bridge(np); 78 - #endif 75 + mpc83xx_setup_pci(); 79 76 80 77 #ifdef CONFIG_QUICC_ENGINE 81 78 qe_reset();
+2 -5
arch/powerpc/platforms/83xx/mpc832x_rdb.c
··· 193 193 */ 194 194 static void __init mpc832x_rdb_setup_arch(void) 195 195 { 196 - #if defined(CONFIG_PCI) || defined(CONFIG_QUICC_ENGINE) 196 + #if defined(CONFIG_QUICC_ENGINE) 197 197 struct device_node *np; 198 198 #endif 199 199 200 200 if (ppc_md.progress) 201 201 ppc_md.progress("mpc832x_rdb_setup_arch()", 0); 202 202 203 - #ifdef CONFIG_PCI 204 - for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") 205 - mpc83xx_add_bridge(np); 206 - #endif 203 + mpc83xx_setup_pci(); 207 204 208 205 #ifdef CONFIG_QUICC_ENGINE 209 206 qe_reset();
+1 -8
arch/powerpc/platforms/83xx/mpc834x_itx.c
··· 58 58 */ 59 59 static void __init mpc834x_itx_setup_arch(void) 60 60 { 61 - #ifdef CONFIG_PCI 62 - struct device_node *np; 63 - #endif 64 - 65 61 if (ppc_md.progress) 66 62 ppc_md.progress("mpc834x_itx_setup_arch()", 0); 67 63 68 - #ifdef CONFIG_PCI 69 - for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") 70 - mpc83xx_add_bridge(np); 71 - #endif 64 + mpc83xx_setup_pci(); 72 65 73 66 mpc834x_usb_cfg(); 74 67 }
+1 -8
arch/powerpc/platforms/83xx/mpc834x_mds.c
··· 77 77 */ 78 78 static void __init mpc834x_mds_setup_arch(void) 79 79 { 80 - #ifdef CONFIG_PCI 81 - struct device_node *np; 82 - #endif 83 - 84 80 if (ppc_md.progress) 85 81 ppc_md.progress("mpc834x_mds_setup_arch()", 0); 86 82 87 - #ifdef CONFIG_PCI 88 - for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") 89 - mpc83xx_add_bridge(np); 90 - #endif 83 + mpc83xx_setup_pci(); 91 84 92 85 mpc834xemds_usb_cfg(); 93 86 }
+1 -4
arch/powerpc/platforms/83xx/mpc836x_mds.c
··· 80 80 of_node_put(np); 81 81 } 82 82 83 - #ifdef CONFIG_PCI 84 - for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") 85 - mpc83xx_add_bridge(np); 86 - #endif 83 + mpc83xx_setup_pci(); 87 84 88 85 #ifdef CONFIG_QUICC_ENGINE 89 86 qe_reset();
+1 -8
arch/powerpc/platforms/83xx/mpc836x_rdk.c
··· 31 31 32 32 static void __init mpc836x_rdk_setup_arch(void) 33 33 { 34 - #ifdef CONFIG_PCI 35 - struct device_node *np; 36 - #endif 37 - 38 34 if (ppc_md.progress) 39 35 ppc_md.progress("mpc836x_rdk_setup_arch()", 0); 40 36 41 - #ifdef CONFIG_PCI 42 - for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") 43 - mpc83xx_add_bridge(np); 44 - #endif 37 + mpc83xx_setup_pci(); 45 38 #ifdef CONFIG_QUICC_ENGINE 46 39 qe_reset(); 47 40 #endif
+1 -10
arch/powerpc/platforms/83xx/mpc837x_mds.c
··· 79 79 */ 80 80 static void __init mpc837x_mds_setup_arch(void) 81 81 { 82 - #ifdef CONFIG_PCI 83 - struct device_node *np; 84 - #endif 85 - 86 82 if (ppc_md.progress) 87 83 ppc_md.progress("mpc837x_mds_setup_arch()", 0); 88 84 89 - #ifdef CONFIG_PCI 90 - for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") 91 - mpc83xx_add_bridge(np); 92 - for_each_compatible_node(np, "pci", "fsl,mpc8314-pcie") 93 - mpc83xx_add_bridge(np); 94 - #endif 85 + mpc83xx_setup_pci(); 95 86 mpc837xmds_usb_cfg(); 96 87 } 97 88
+1 -10
arch/powerpc/platforms/83xx/mpc837x_rdb.c
··· 50 50 */ 51 51 static void __init mpc837x_rdb_setup_arch(void) 52 52 { 53 - #ifdef CONFIG_PCI 54 - struct device_node *np; 55 - #endif 56 - 57 53 if (ppc_md.progress) 58 54 ppc_md.progress("mpc837x_rdb_setup_arch()", 0); 59 55 60 - #ifdef CONFIG_PCI 61 - for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") 62 - mpc83xx_add_bridge(np); 63 - for_each_compatible_node(np, "pci", "fsl,mpc8314-pcie") 64 - mpc83xx_add_bridge(np); 65 - #endif 56 + mpc83xx_setup_pci(); 66 57 mpc837x_usb_cfg(); 67 58 mpc837x_rdb_sd_cfg(); 68 59 }
+6
arch/powerpc/platforms/83xx/mpc83xx.h
··· 79 79 #define mpc83xx_ipic_and_qe_init_IRQ mpc83xx_ipic_init_IRQ 80 80 #endif /* CONFIG_QUICC_ENGINE */ 81 81 82 + #ifdef CONFIG_PCI 83 + extern void mpc83xx_setup_pci(void); 84 + #else 85 + #define mpc83xx_setup_pci() do {} while (0) 86 + #endif 87 + 82 88 extern int mpc83xx_declare_of_platform_devices(void); 83 89 84 90 #endif /* __MPC83XX_H__ */
+1 -9
arch/powerpc/platforms/83xx/sbc834x.c
··· 48 48 */ 49 49 static void __init sbc834x_setup_arch(void) 50 50 { 51 - #ifdef CONFIG_PCI 52 - struct device_node *np; 53 - #endif 54 - 55 51 if (ppc_md.progress) 56 52 ppc_md.progress("sbc834x_setup_arch()", 0); 57 53 58 - #ifdef CONFIG_PCI 59 - for_each_compatible_node(np, "pci", "fsl,mpc8349-pci") 60 - mpc83xx_add_bridge(np); 61 - #endif 62 - 54 + mpc83xx_setup_pci(); 63 55 } 64 56 65 57 machine_device_initcall(sbc834x, mpc83xx_declare_of_platform_devices);