summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-12-16 10:28:42 +0000
committerGabor Juhos <juhosg@openwrt.org>2013-12-16 10:28:42 +0000
commit26ca95fefa553ed202e9a8dc0d3db5d645ec5a49 (patch)
tree7a57761bd3abc8a625c68aaf345863ee38aff2f6 /target
parent59b6cf1e7001295d4ec5fd0e106dc7140e55c2c0 (diff)
downloadmtk-20170518-26ca95fefa553ed202e9a8dc0d3db5d645ec5a49.zip
mtk-20170518-26ca95fefa553ed202e9a8dc0d3db5d645ec5a49.tar.gz
mtk-20170518-26ca95fefa553ed202e9a8dc0d3db5d645ec5a49.tar.bz2
ar71xx: rb2011: simplify setup code
Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 39095
Diffstat (limited to 'target')
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c
index 44a1aa7..c0c24a5 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c
@@ -49,6 +49,10 @@
#define RB_ART_SIZE 0x10000
+#define RB2011_FLAG_SFP BIT(0)
+#define RB2011_FLAG_USB BIT(1)
+#define RB2011_FLAG_WLAN BIT(2)
+
static struct mtd_partition rb2011_spi_partitions[] = {
{
.name = "routerboot",
@@ -230,7 +234,7 @@ static void __init rb2011_sfp_init(void)
rb2011_ar8327_data.get_port_link = rb2011_get_port_link;
}
-static int __init rb2011_setup(void)
+static int __init rb2011_setup(u32 flags)
{
const struct rb_info *info;
@@ -269,26 +273,29 @@ static int __init rb2011_setup(void)
ath79_register_eth(1);
+ if (flags & RB2011_FLAG_SFP)
+ rb2011_sfp_init();
+
+ if (flags & RB2011_FLAG_WLAN)
+ rb2011_wlan_init();
+
+ if (flags & RB2011_FLAG_USB)
+ ath79_register_usb();
+
return 0;
}
static void __init rb2011l_setup(void)
{
- rb2011_setup();
+ rb2011_setup(0);
}
-
MIPS_MACHINE(ATH79_MACH_RB_2011L, "2011L", "MikroTik RouterBOARD 2011L",
rb2011l_setup);
static void __init rb2011us_setup(void)
{
- if (rb2011_setup())
- return;
-
- rb2011_sfp_init();
-
- ath79_register_usb();
+ rb2011_setup(RB2011_FLAG_SFP | RB2011_FLAG_USB);
}
MIPS_MACHINE(ATH79_MACH_RB_2011US, "2011US", "MikroTik RouterBOARD 2011UAS",
@@ -296,13 +303,9 @@ MIPS_MACHINE(ATH79_MACH_RB_2011US, "2011US", "MikroTik RouterBOARD 2011UAS",
static void __init rb2011g_setup(void)
{
- if (rb2011_setup())
- return;
-
- rb2011_sfp_init();
- rb2011_wlan_init();
-
- ath79_register_usb();
+ rb2011_setup(RB2011_FLAG_SFP |
+ RB2011_FLAG_USB |
+ RB2011_FLAG_WLAN);
}
MIPS_MACHINE(ATH79_MACH_RB_2011G, "2011G", "MikroTik RouterBOARD 2011UAS-2HnD",