1 --- a/arch/arm/mach-cns3xxx/cns3420vb.c
2 +++ b/arch/arm/mach-cns3xxx/cns3420vb.c
3 @@ -203,7 +203,6 @@ static void __init cns3420_init(void)
5 cns3xxx_gpio_init(32, 32, CNS3XXX_GPIOB_BASE_VIRT, IRQ_CNS3XXX_GPIOB,
7 - cns3xxx_pcie_init(0x3);
9 pm_power_off = cns3xxx_power_off;
11 @@ -220,11 +219,21 @@ static struct map_desc cns3420_io_desc[]
12 static void __init cns3420_map_io(void)
14 cns3xxx_common_init();
15 + cns3xxx_pcie_iotable_init();
16 iotable_init(cns3420_io_desc, ARRAY_SIZE(cns3420_io_desc));
18 cns3420_early_serial_setup();
21 +static int __init cns3420vb_pcie_init(void)
23 + if (!machine_is_cns3420vb())
26 + return cns3xxx_pcie_init();
28 +subsys_initcall(cns3420vb_pcie_init);
30 MACHINE_START(CNS3420VB, "Cavium Networks CNS3420 Validation Board")
32 .map_io = cns3420_map_io,
33 --- a/arch/arm/mach-cns3xxx/core.h
34 +++ b/arch/arm/mach-cns3xxx/core.h
36 #define __CNS3XXX_CORE_H
38 extern struct sys_timer cns3xxx_timer;
39 -extern int cns3xxx_pcie_init(u8 bitmap);
40 -extern void cns3xxx_pcie_iotable_init(u8 bitmap);
41 +extern void cns3xxx_pcie_iotable_init(void);
44 #ifdef CONFIG_CACHE_L2X0
45 void __init cns3xxx_l2x0_init(void);
46 @@ -23,6 +23,7 @@ static inline void cns3xxx_l2x0_init(voi
48 void __init cns3xxx_common_init(void);
49 void __init cns3xxx_init_irq(void);
50 +int __init cns3xxx_pcie_init(void);
51 void cns3xxx_power_off(void);
52 void cns3xxx_restart(char, const char *);
54 --- a/arch/arm/mach-cns3xxx/laguna.c
55 +++ b/arch/arm/mach-cns3xxx/laguna.c
56 @@ -729,7 +731,7 @@ static struct map_desc laguna_io_desc[]
57 static void __init laguna_map_io(void)
59 cns3xxx_common_init();
60 - cns3xxx_pcie_iotable_init(0x3);
61 + cns3xxx_pcie_iotable_init();
62 iotable_init(ARRAY_AND_SIZE(laguna_io_desc));
63 laguna_early_serial_setup();
65 @@ -753,11 +755,19 @@ static int laguna_register_gpio(struct g
69 +static int __init laguna_pcie_init(void)
71 + if (!machine_is_gw2388())
74 + return cns3xxx_pcie_init();
76 +subsys_initcall(laguna_pcie_init);
78 static int __init laguna_model_setup(void)
84 printk("Running on Gateworks Laguna %s\n", laguna_info.model);
85 cns3xxx_gpio_init( 0, 32, CNS3XXX_GPIOA_BASE_VIRT, IRQ_CNS3XXX_GPIOA,
86 @@ -779,14 +789,6 @@ static int __init laguna_model_setup(voi
87 (laguna_info.config_bitmap & SATA1_LOAD))
90 - if (laguna_info.config_bitmap & (PCIE0_LOAD))
93 - if (laguna_info.config_bitmap & (PCIE1_LOAD))
96 - cns3xxx_pcie_init(pcie_bitmap);
98 if (laguna_info.config_bitmap & (USB0_LOAD)) {
99 cns3xxx_pwr_power_up(1 << PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_USB);
101 @@ -926,7 +928,6 @@ static int __init laguna_model_setup(voi
106 late_initcall(laguna_model_setup);
108 MACHINE_START(GW2388, "Gateworks Corporation Laguna Platform")
109 --- a/arch/arm/mach-cns3xxx/pcie.c
110 +++ b/arch/arm/mach-cns3xxx/pcie.c
111 @@ -456,23 +456,18 @@ static int cns3xxx_pcie_abort_handler(un
115 -void __init cns3xxx_pcie_iotable_init(u8 bitmap)
117 +void __init cns3xxx_pcie_iotable_init()
119 - static int _iotable_init = 0;
122 - bitmap &= ~_iotable_init;
123 for (i = 0; i < ARRAY_SIZE(cns3xxx_pcie); i++) {
124 - if (!(bitmap & (1 << i)))
127 iotable_init(cns3xxx_pcie[i].cfg_bases,
128 ARRAY_SIZE(cns3xxx_pcie[i].cfg_bases));
130 - _iotable_init |= bitmap;
133 -int __init cns3xxx_pcie_init(u8 bitmap)
134 +int __init cns3xxx_pcie_init(void)
138 @@ -482,14 +477,12 @@ int __init cns3xxx_pcie_init(u8 bitmap)
139 hook_fault_code(16 + 6, cns3xxx_pcie_abort_handler, SIGBUS, 0,
140 "imprecise external abort");
142 - cns3xxx_pcie_iotable_init(bitmap);
143 for (i = 0; i < ARRAY_SIZE(cns3xxx_pcie); i++) {
144 - if (!(bitmap & (1 << i)))
147 cns3xxx_pcie_check_link(&cns3xxx_pcie[i]);
148 - cns3xxx_pcie_hw_init(&cns3xxx_pcie[i]);
149 - pci_common_init(&cns3xxx_pcie[i].hw_pci);
150 + if (cns3xxx_pcie[i].linked) {
151 + cns3xxx_pcie_hw_init(&cns3xxx_pcie[i]);
152 + pci_common_init(&cns3xxx_pcie[i].hw_pci);
156 pci_assign_unassigned_resources();