Root/target/linux/ar71xx/patches-3.3/103-MIPS-ath79-add-a-common-PCI-registration-function.patch

1From e3edaac2e967f07ae3b726e64e1c290233361bc7 Mon Sep 17 00:00:00 2001
2From: Gabor Juhos <juhosg@openwrt.org>
3Date: Wed, 14 Mar 2012 10:29:24 +0100
4Subject: [PATCH 08/47] MIPS: ath79: add a common PCI registration function
5
6The current code unconditionally registers the AR724X
7specific PCI controller, even if the kernel is running
8on a different SoC.
9
10Add a common function for PCI controller registration,
11and only register the AR724X PCI controller if the kernel
12is running on an AR724X SoC.
13
14Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
15Cc: linux-mips@linux-mips.org
16Patchwork: https://patchwork.linux-mips.org/patch/3488/
17Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
18---
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(-)
24
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 */
30 
31+ ath79_register_pci();
32 }
33 
34 MIPS_MACHINE(ATH79_MACH_UBNT_XM,
35--- a/arch/mips/ath79/pci.c
36+++ b/arch/mips/ath79/pci.c
37@@ -9,6 +9,8 @@
38  */
39 
40 #include <linux/pci.h>
41+#include <asm/mach-ath79/ath79.h>
42+#include <asm/mach-ath79/pci.h>
43 #include "pci.h"
44 
45 static struct ath724x_pci_data *pci_data;
46@@ -44,3 +46,11 @@ int pcibios_plat_dev_init(struct pci_dev
47 
48     return PCIBIOS_SUCCESSFUL;
49 }
50+
51+int __init ath79_register_pci(void)
52+{
53+ if (soc_is_ar724x())
54+ return ath724x_pcibios_init();
55+
56+ return -ENODEV;
57+}
58--- a/arch/mips/ath79/pci.h
59+++ b/arch/mips/ath79/pci.h
60@@ -18,4 +18,10 @@ struct ath724x_pci_data {
61 
62 void ath724x_pci_add_data(struct ath724x_pci_data *data, int size);
63 
64+#ifdef CONFIG_PCI
65+int ath79_register_pci(void);
66+#else
67+static inline int ath79_register_pci(void) { return 0; }
68+#endif
69+
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)
74 
75     return PCIBIOS_SUCCESSFUL;
76 }
77-
78-arch_initcall(ath724x_pcibios_init);
79

Archive Download this file



interactive