e70ef9675bfd79eaa30b4ceccdb82ec849b37ffe
[openwrt/staging/mkresin.git] / target / linux / cns3xxx / patches-3.3 / 055-cns3xxx_pci_iospace_init.patch
1 --- a/arch/arm/mach-cns3xxx/cns3420vb.c
2 +++ b/arch/arm/mach-cns3xxx/cns3420vb.c
3 @@ -32,6 +32,7 @@
4 #include <asm/mach/time.h>
5 #include <mach/cns3xxx.h>
6 #include <mach/irqs.h>
7 +#include <mach/platform.h>
8 #include "core.h"
9 #include "devices.h"
10
11 @@ -199,6 +200,8 @@ static void __init cns3420_init(void)
12 cns3xxx_ahci_init();
13 cns3xxx_sdhci_init();
14
15 + cns3xxx_pcie_init(0x3);
16 +
17 pm_power_off = cns3xxx_power_off;
18 }
19
20 --- a/arch/arm/mach-cns3xxx/core.h
21 +++ b/arch/arm/mach-cns3xxx/core.h
22 @@ -12,6 +12,8 @@
23 #define __CNS3XXX_CORE_H
24
25 extern struct sys_timer cns3xxx_timer;
26 +extern int cns3xxx_pcie_init(u8 bitmap);
27 +extern void cns3xxx_pcie_iotable_init(u8 bitmap);
28
29 #ifdef CONFIG_CACHE_L2X0
30 void __init cns3xxx_l2x0_init(void);
31 --- a/arch/arm/mach-cns3xxx/pcie.c
32 +++ b/arch/arm/mach-cns3xxx/pcie.c
33 @@ -365,7 +365,23 @@ static int cns3xxx_pcie_abort_handler(un
34 return 0;
35 }
36
37 -static int __init cns3xxx_pcie_init(void)
38 +void __init cns3xxx_pcie_iotable_init(u8 bitmap)
39 +{
40 + static int _iotable_init = 0;
41 + int i;
42 +
43 + bitmap &= ~_iotable_init;
44 + for (i = 0; i < ARRAY_SIZE(cns3xxx_pcie); i++) {
45 + if (!(bitmap & (1 << i)))
46 + continue;
47 +
48 + iotable_init(cns3xxx_pcie[i].cfg_bases,
49 + ARRAY_SIZE(cns3xxx_pcie[i].cfg_bases));
50 + }
51 + _iotable_init |= bitmap;
52 +}
53 +
54 +int __init cns3xxx_pcie_init(u8 bitmap)
55 {
56 int i;
57
58 @@ -375,9 +391,11 @@ static int __init cns3xxx_pcie_init(void
59 hook_fault_code(16 + 6, cns3xxx_pcie_abort_handler, SIGBUS, 0,
60 "imprecise external abort");
61
62 + cns3xxx_pcie_iotable_init(bitmap);
63 for (i = 0; i < ARRAY_SIZE(cns3xxx_pcie); i++) {
64 - iotable_init(cns3xxx_pcie[i].cfg_bases,
65 - ARRAY_SIZE(cns3xxx_pcie[i].cfg_bases));
66 + if (!(bitmap & (1 << i)))
67 + continue;
68 +
69 cns3xxx_pcie_check_link(&cns3xxx_pcie[i]);
70 cns3xxx_pcie_hw_init(&cns3xxx_pcie[i]);
71 pci_common_init(&cns3xxx_pcie[i].hw_pci);
72 @@ -387,4 +405,3 @@ static int __init cns3xxx_pcie_init(void
73
74 return 0;
75 }
76 -device_initcall(cns3xxx_pcie_init);