1 From e3edaac2e967f07ae3b726e64e1c290233361bc7 Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Wed, 14 Mar 2012 10:29:24 +0100
4 Subject: [PATCH 08/47] MIPS: ath79: add a common PCI registration function
6 The current code unconditionally registers the AR724X
7 specific PCI controller, even if the kernel is running
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.
14 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
15 Cc: linux-mips@linux-mips.org
16 Patchwork: https://patchwork.linux-mips.org/patch/3488/
17 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
19 arch/mips/ath79/mach-ubnt-xm.c | 1 +
20 arch/mips/ath79/pci.c | 10 ++++++++++
21 arch/mips/ath79/pci.h | 6 ++++++
22 arch/mips/pci/pci-ath724x.c | 2 --
23 4 files changed, 17 insertions(+), 2 deletions(-)
25 --- a/arch/mips/ath79/mach-ubnt-xm.c
26 +++ b/arch/mips/ath79/mach-ubnt-xm.c
27 @@ -111,6 +111,7 @@ static void __init ubnt_xm_init(void)
28 ath724x_pci_add_data(ubnt_xm_pci_data, ARRAY_SIZE(ubnt_xm_pci_data));
29 #endif /* CONFIG_PCI */
31 + ath79_register_pci();
34 MIPS_MACHINE(ATH79_MACH_UBNT_XM,
35 --- a/arch/mips/ath79/pci.c
36 +++ b/arch/mips/ath79/pci.c
40 #include <linux/pci.h>
41 +#include <asm/mach-ath79/ath79.h>
42 +#include <asm/mach-ath79/pci.h>
45 static struct ath724x_pci_data *pci_data;
46 @@ -44,3 +46,11 @@ int pcibios_plat_dev_init(struct pci_dev
48 return PCIBIOS_SUCCESSFUL;
51 +int __init ath79_register_pci(void)
53 + if (soc_is_ar724x())
54 + return ath724x_pcibios_init();
58 --- a/arch/mips/ath79/pci.h
59 +++ b/arch/mips/ath79/pci.h
60 @@ -18,4 +18,10 @@ struct ath724x_pci_data {
62 void ath724x_pci_add_data(struct ath724x_pci_data *data, int size);
65 +int ath79_register_pci(void);
67 +static inline int ath79_register_pci(void) { return 0; }
70 #endif /* __ASM_MACH_ATH79_PCI_ATH724X_H */
71 --- a/arch/mips/pci/pci-ath724x.c
72 +++ b/arch/mips/pci/pci-ath724x.c
73 @@ -137,5 +137,3 @@ int __init ath724x_pcibios_init(void)
75 return PCIBIOS_SUCCESSFUL;
78 -arch_initcall(ath724x_pcibios_init);