summaryrefslogtreecommitdiffstats
path: root/arch/mips/ath79
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-03-14 10:29:24 +0100
committerRalf Baechle <ralf@linux-mips.org>2012-05-15 17:49:01 +0200
commit6335aef59c55f50e6d8017a28c0ee985b533ea29 (patch)
treea1014ca9517a7df6e51f1f709b6b0f033a105b58 /arch/mips/ath79
parent659243ccaf296ae122c159d4c573f93561e1b8d6 (diff)
downloadlinux-6335aef59c55f50e6d8017a28c0ee985b533ea29.tar.gz
linux-6335aef59c55f50e6d8017a28c0ee985b533ea29.tar.xz
linux-6335aef59c55f50e6d8017a28c0ee985b533ea29.zip
MIPS: ath79: add a common PCI registration function
The current code unconditionally registers the AR724X specific PCI controller, even if the kernel is running on a different SoC. Add a common function for PCI controller registration, and only register the AR724X PCI controller if the kernel is running on an AR724X SoC. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/3488/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/ath79')
-rw-r--r--arch/mips/ath79/mach-ubnt-xm.c1
-rw-r--r--arch/mips/ath79/pci.c10
-rw-r--r--arch/mips/ath79/pci.h6
3 files changed, 17 insertions, 0 deletions
diff --git a/arch/mips/ath79/mach-ubnt-xm.c b/arch/mips/ath79/mach-ubnt-xm.c
index a0435003b2e7..edbc093bf665 100644
--- a/arch/mips/ath79/mach-ubnt-xm.c
+++ b/arch/mips/ath79/mach-ubnt-xm.c
@@ -111,6 +111,7 @@ static void __init ubnt_xm_init(void)
ath724x_pci_add_data(ubnt_xm_pci_data, ARRAY_SIZE(ubnt_xm_pci_data));
#endif /* CONFIG_PCI */
+ ath79_register_pci();
}
MIPS_MACHINE(ATH79_MACH_UBNT_XM,
diff --git a/arch/mips/ath79/pci.c b/arch/mips/ath79/pci.c
index 49574284b755..855a69dcc86e 100644
--- a/arch/mips/ath79/pci.c
+++ b/arch/mips/ath79/pci.c
@@ -9,6 +9,8 @@
*/
#include <linux/pci.h>
+#include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/pci.h>
#include "pci.h"
static struct ath724x_pci_data *pci_data;
@@ -44,3 +46,11 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
return PCIBIOS_SUCCESSFUL;
}
+
+int __init ath79_register_pci(void)
+{
+ if (soc_is_ar724x())
+ return ath724x_pcibios_init();
+
+ return -ENODEV;
+}
diff --git a/arch/mips/ath79/pci.h b/arch/mips/ath79/pci.h
index 454885fa30c3..787fac2c08f0 100644
--- a/arch/mips/ath79/pci.h
+++ b/arch/mips/ath79/pci.h
@@ -18,4 +18,10 @@ struct ath724x_pci_data {
void ath724x_pci_add_data(struct ath724x_pci_data *data, int size);
+#ifdef CONFIG_PCI
+int ath79_register_pci(void);
+#else
+static inline int ath79_register_pci(void) { return 0; }
+#endif
+
#endif /* __ASM_MACH_ATH79_PCI_ATH724X_H */