ar71xx: enable UART function for early_printk/console
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / patches-3.3 / 105-MIPS-ath79-add-a-common-PCI-registration-function.patch
1 From fbf38a9b03d0c47ed602f090ebb2d8ecc0d51d04 Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Fri, 18 Nov 2011 10:25:26 +0100
4 Subject: [PATCH 05/35] MIPS: ath79: add a common PCI registration function
5
6 The current code unconditionally registers the AR724X
7 specific PCI controller, even if the kernel is running
8 on a different SoC.
9
10 Add a common function for PCI controller registration,
11 and only register the AR724X PCI controller if the kernel
12 is running on an AR724X SoC.
13
14 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
15
16 v4: - simplify ath79_register_pci function
17 v3: - fix compile error if CONFIG_PCI is not defined
18 - add __init annotation to ath79_register_pci
19 v2: - no changes
20 ---
21 arch/mips/ath79/mach-ubnt-xm.c | 1 +
22 arch/mips/ath79/pci.c | 10 ++++++++++
23 arch/mips/ath79/pci.h | 6 ++++++
24 arch/mips/pci/pci-ath724x.c | 2 --
25 4 files changed, 17 insertions(+), 2 deletions(-)
26
27 --- a/arch/mips/ath79/mach-ubnt-xm.c
28 +++ b/arch/mips/ath79/mach-ubnt-xm.c
29 @@ -111,6 +111,7 @@ static void __init ubnt_xm_init(void)
30 ath724x_pci_add_data(ubnt_xm_pci_data, ARRAY_SIZE(ubnt_xm_pci_data));
31 #endif /* CONFIG_PCI */
32
33 + ath79_register_pci();
34 }
35
36 MIPS_MACHINE(ATH79_MACH_UBNT_XM,
37 --- a/arch/mips/ath79/pci.c
38 +++ b/arch/mips/ath79/pci.c
39 @@ -9,6 +9,8 @@
40 */
41
42 #include <linux/pci.h>
43 +#include <asm/mach-ath79/ath79.h>
44 +#include <asm/mach-ath79/pci.h>
45 #include "pci.h"
46
47 static struct ath724x_pci_data *pci_data;
48 @@ -44,3 +46,11 @@ int pcibios_plat_dev_init(struct pci_dev
49
50 return PCIBIOS_SUCCESSFUL;
51 }
52 +
53 +int __init ath79_register_pci(void)
54 +{
55 + if (soc_is_ar724x())
56 + return ath724x_pcibios_init();
57 +
58 + return -ENODEV;
59 +}
60 --- a/arch/mips/ath79/pci.h
61 +++ b/arch/mips/ath79/pci.h
62 @@ -18,4 +18,10 @@ struct ath724x_pci_data {
63
64 void ath724x_pci_add_data(struct ath724x_pci_data *data, int size);
65
66 +#ifdef CONFIG_PCI
67 +int ath79_register_pci(void);
68 +#else
69 +static inline int ath79_register_pci(void) { return 0; }
70 +#endif
71 +
72 #endif /* __ASM_MACH_ATH79_PCI_ATH724X_H */
73 --- a/arch/mips/pci/pci-ath724x.c
74 +++ b/arch/mips/pci/pci-ath724x.c
75 @@ -137,5 +137,3 @@ int __init ath724x_pcibios_init(void)
76
77 return PCIBIOS_SUCCESSFUL;
78 }
79 -
80 -arch_initcall(ath724x_pcibios_init);