[OpenWrt-Devel] [PATCH][ar71xx] Add support for BHU Networks BXO2000n-2S/BXO5000n-2S/BXI2000n-2/BXO2000n-2S-U

yangbo yangbo at bhunetworks.com
Tue Dec 9 21:38:32 EST 2014


Hi,
	Thank you for reply.
	I have changed the patch, using tab instead of leading space .
	For there are different boards support in one file, I think it's better to put #define 
for different boards with the board support functions.


Signed-off-by: Terry Yang <yangbo at bhunetworks.com>

Index: target/linux/ar71xx/base-files/etc/diag.sh
===================================================================
--- target/linux/ar71xx/base-files/etc/diag.sh	(revision 43488)
+++ target/linux/ar71xx/base-files/etc/diag.sh	(working copy)
@@ -37,7 +37,7 @@
	bullet-m | rocket-m | nano-m | nanostation-m | nanostation-m-xw | loco-m-xw)
		status_led="ubnt:green:link4"
		;;
-	bxu2000n-2-a1)
+	bxu2000n-2-a1 | bxo2000n-2s-u | bxo2000n-2s | bxi2000n-2 | bxo5000n-2s)
		status_led="bhu:green:status"
		;;
	cap4200ag)
Index: target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
===================================================================
--- target/linux/ar71xx/base-files/etc/uci-defaults/01_leds	(revision 43488)
+++ target/linux/ar71xx/base-files/etc/uci-defaults/01_leds	(working copy)
@@ -46,10 +46,21 @@
	ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "ubnt:green:link4" "wlan0" "76" "100" "-75" "13"
	;;
 
-bxu2000n-2-a1)
+bxu2000n-2-a1|\
+bxi2000n-2)
	ucidef_set_led_wlan "wlan" "WLAN" "bhu:green:wlan" "phy0tpt"
	;;
 
+bxo2000n-2s-u|\
+bxo2000n-2s|\
+bxo5000n-2s)
+	ucidef_set_led_wlan "wlan" "WLAN" "bhu:green:wlan" "phy0tpt"
+	ucidef_set_rssimon "wlan0" "40000" "1"
+	ucidef_set_led_rssi "rssilow" "RSSILOW" "bhu:green:rssilow" "wlan0" "1" "40" "0" "6"
+	ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "bhu:green:rssimedium" "wlan0" "30" "80" "-29" "5"
+	ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "bhu:green:rssihigh" "wlan0" "70" "100" "-69" "8"
+	;;
+
 cap4200ag)
 	ucidef_set_led_default "lan_green" "LAN_GREEN" "senao:green:lan" "1"
 	ucidef_set_led_wlan "wlan_amber" "WLAN_AMBER" "senao:amber:wlan" "phy0tpt"
Index: target/linux/ar71xx/base-files/etc/uci-defaults/02_network
===================================================================
--- target/linux/ar71xx/base-files/etc/uci-defaults/02_network	(revision 43488)
+++ target/linux/ar71xx/base-files/etc/uci-defaults/02_network	(working copy)
@@ -332,7 +332,8 @@
	ucidef_set_interface_lan "eth0"
	;;
 
-dir-505-a1)
+dir-505-a1 |\
+bxi2000n-2)
	ucidef_set_interface_lan "eth1"
	;;
 
Index: target/linux/ar71xx/base-files/lib/ar71xx.sh
===================================================================
--- target/linux/ar71xx/base-files/lib/ar71xx.sh	(revision 43488)
+++ target/linux/ar71xx/base-files/lib/ar71xx.sh	(working copy)
@@ -810,6 +810,18 @@
	*"BHU BXU2000n-2 rev. A1")
		name="bxu2000n-2-a1"
		;;
+	*"BHU BXO2000n-2S")
+		name="bxo2000n-2s"
+		;;
+	*"BHU BXO2000n-2S-U")
+		name="bxo2000n-2s-u"
+		;;
+	*"BHU BXI2000n-2")
+		name="bxi2000n-2"
+		;;
+	*"BHU BXO5000n-2S")
+		name="bxo5000n-2s"
+		;;
 	*"HiWiFi HC6361")
 		name="hiwifi-hc6361"
 		;;
Index: target/linux/ar71xx/base-files/lib/upgrade/platform.sh
===================================================================
--- target/linux/ar71xx/base-files/lib/upgrade/platform.sh	(revision 43488)
+++ target/linux/ar71xx/base-files/lib/upgrade/platform.sh	(working copy)
@@ -183,6 +183,10 @@
 	db120 | \
 	hornet-ub | \
 	bxu2000n-2-a1 | \
+	bxo2000n-2s | \
+	bxo2000n-2s-u | \
+	bxi2000n-2 | \
+	bxo5000n-2s | \
 	zcn-1523h-2 | \
 	zcn-1523h-5)
 		[ "$magic_long" != "68737173" -a "$magic_long" != "19852003" ] && {
Index: target/linux/ar71xx/config-3.14
===================================================================
--- target/linux/ar71xx/config-3.14	(revision 43488)
+++ target/linux/ar71xx/config-3.14	(working copy)
@@ -37,7 +37,7 @@
 CONFIG_ATH79_MACH_AP96=y
 CONFIG_ATH79_MACH_ARCHER_C7=y
 CONFIG_ATH79_MACH_AW_NR580=y
-CONFIG_ATH79_MACH_BHU_BXU2000N2_A=y
+CONFIG_ATH79_MACH_BHU_ATH=y
 CONFIG_ATH79_MACH_CAP4200AG=y
 CONFIG_ATH79_MACH_CARAMBOLA2=y
 CONFIG_ATH79_MACH_CPE510=y
Index: target/linux/ar71xx/files/arch/mips/ath79/mach-bhu-ath.c
===================================================================
--- target/linux/ar71xx/files/arch/mips/ath79/mach-bhu-ath.c	(revision 0)
+++ target/linux/ar71xx/files/arch/mips/ath79/mach-bhu-ath.c	(working copy)
@@ -0,0 +1,370 @@
+/*
+ *  BHU board support
+ *
+ *  Copyright (C) 2013-2014 Terry Yang <yangbo at bhunetworks.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+
+#include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include "common.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+
+static const char *bhu_ap123_part_probes[] = {
+	"cmdlinepart",
+	NULL,
+};
+
+static struct flash_platform_data bhu_ap123_flash_data = {
+	.part_probes	= bhu_ap123_part_probes,
+};
+
+static void __init bhu_ap123_setup(u8 *mac, u8 *ee)
+{
+
+	ath79_register_m25p80(&bhu_ap123_flash_data);
+
+	ath79_register_mdio(1, 0x0);
+
+	ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
+	ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1);
+
+	/* GMAC0 is connected to the PHY4 of the internal switch */
+	ath79_switch_data.phy4_mii_en = 1;
+	ath79_switch_data.phy_poll_mask = BIT(4);
+	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+	ath79_eth0_data.phy_mask = BIT(4);
+	ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
+	ath79_register_eth(0);
+
+	/* GMAC1 is connected to the internal switch. Only use PHY3 */
+	ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+	ath79_eth1_data.phy_mask = BIT(3);
+	ath79_register_eth(1);
+
+	ath79_register_wmac(ee, ee+2);
+
+	ath79_register_usb();
+}
+
+/*
+ * BHU BXU2000n-2 A1 board
+ */
+
+#define BHU_BXU2000N2_A1_GPIO_LED_WLAN		13
+#define BHU_BXU2000N2_A1_GPIO_LED_WAN		19
+#define BHU_BXU2000N2_A1_GPIO_LED_LAN		21
+#define BHU_BXU2000N2_A1_GPIO_LED_SYSTEM	14
+
+#define BHU_BXU2000N2_A1_GPIO_BTN_RESET		17
+
+#define BHU_BXU2000N2_KEYS_POLL_INTERVAL	20	/* msecs */
+#define BHU_BXU2000N2_KEYS_DEBOUNCE_INTERVAL	\
+	(3 * BHU_BXU2000N2_KEYS_POLL_INTERVAL)
+
+static struct gpio_led bhu_bxu2000n2_a1_leds_gpio[] __initdata = {
+	{
+		.name		= "bhu:green:status",
+		.gpio		= BHU_BXU2000N2_A1_GPIO_LED_SYSTEM,
+		.active_low	= 1,
+	}, {
+		.name		= "bhu:green:lan",
+		.gpio		= BHU_BXU2000N2_A1_GPIO_LED_LAN,
+		.active_low	= 1,
+	}, {
+		.name		= "bhu:green:wan",
+		.gpio		= BHU_BXU2000N2_A1_GPIO_LED_WAN,
+		.active_low	= 1,
+	}, {
+		.name		= "bhu:green:wlan",
+		.gpio		= BHU_BXU2000N2_A1_GPIO_LED_WLAN,
+		.active_low	= 1,
+	},
+};
+
+static struct gpio_keys_button bhu_bxu2000n2_a1_gpio_keys[] __initdata = {
+	{
+		.desc		= "Reset button",
+		.type		= EV_KEY,
+		.code		= KEY_RESTART,
+		.debounce_interval = BHU_BXU2000N2_KEYS_DEBOUNCE_INTERVAL,
+		.gpio		= BHU_BXU2000N2_A1_GPIO_BTN_RESET,
+		.active_low	= 1,
+	}
+};
+
+static void __init bhu_bxu2000n2_a1_setup(void)
+{
+	bhu_ap123_setup((u8 *) KSEG1ADDR(0x1fff0000), (u8 *) KSEG1ADDR(0x1fff1000));
+
+	ath79_register_leds_gpio(-1, ARRAY_SIZE(bhu_bxu2000n2_a1_leds_gpio),
+				 bhu_bxu2000n2_a1_leds_gpio);
+
+	ath79_register_gpio_keys_polled(1, BHU_BXU2000N2_KEYS_POLL_INTERVAL,
+					ARRAY_SIZE(bhu_bxu2000n2_a1_gpio_keys),
+					bhu_bxu2000n2_a1_gpio_keys);
+}
+
+MIPS_MACHINE(ATH79_MACH_BHU_BXU2000N2_A1, "BXU2000n-2-A1",
+		"BHU BXU2000n-2 rev. A1",
+		bhu_bxu2000n2_a1_setup);
+
+/*
+ * BHU BXO2000n-2S board
+ */
+
+#define BHU_BXO2000N2S_GPIO_LED_SYSTEM	14
+#define BHU_BXO2000N2S_GPIO_LED_S0		14
+#define BHU_BXO2000N2S_GPIO_LED_S1		19
+#define BHU_BXO2000N2S_GPIO_LED_S2		15
+#define BHU_BXO2000N2S_GPIO_LED_S3		21
+#define BHU_BXO2000N2S_GPIO_LED_WLAN	13
+#define BHU_BXO2000N2S_GPIO_LED_WAN	20
+#define BHU_BXO2000N2S_GPIO_LED_LAN	22
+
+#define BHU_BXO2000N2S_GPIO_BTN_RESET	17
+
+#define BHU_BXO2000N2S_KEYS_POLL_INTERVAL	20	/* msecs */
+#define BHU_BXO2000N2S_KEYS_DEBOUNCE_INTERVAL	\
+	(3 * BHU_BXO2000N2S_KEYS_POLL_INTERVAL)
+
+static struct gpio_led bhu_bxo2000n2s_leds_gpio[] __initdata = {
+	{
+		.name       = "bhu:green:status",
+		.gpio       = BHU_BXO2000N2S_GPIO_LED_SYSTEM,
+		.active_low = 1,
+	}, {
+		.name       = "bhu:green:lan",
+		.gpio       = BHU_BXO2000N2S_GPIO_LED_LAN,
+		.active_low = 1,
+	}, {
+		.name       = "bhu:green:wan",
+		.gpio       = BHU_BXO2000N2S_GPIO_LED_WAN,
+		.active_low = 1,
+	}, {
+		.name       = "bhu:green:wlan",
+		.gpio       = BHU_BXO2000N2S_GPIO_LED_WLAN,
+		.active_low = 1,
+	}, {
+		.name       = "bhu:green:rssilow",
+		.gpio       = BHU_BXO2000N2S_GPIO_LED_S1,
+		.active_low = 1,
+	}, {
+		.name       = "bhu:green:rssimedium",
+		.gpio       = BHU_BXO2000N2S_GPIO_LED_S2,
+		.active_low = 1,
+	}, {
+		.name       = "bhu:green:rssihigh",
+		.gpio       = BHU_BXO2000N2S_GPIO_LED_S3,
+		.active_low = 1,
+	},
+};
+
+static struct gpio_keys_button bhu_bxo2000n2s_gpio_keys[] __initdata = {
+	{
+		.desc       = "Reset button",
+		.type       = EV_KEY,
+		.code       = KEY_RESTART,
+		.debounce_interval = BHU_BXO2000N2S_KEYS_DEBOUNCE_INTERVAL,
+		.gpio       = BHU_BXO2000N2S_GPIO_BTN_RESET,
+		.active_low = 1,
+	}
+};
+
+static void __init bhu_bxo2000n2s_setup(void)
+{
+	bhu_ap123_setup((u8 *) KSEG1ADDR(0x1f7f0000), (u8 *) KSEG1ADDR(0x1f7f1000));
+
+	ath79_register_leds_gpio(-1, ARRAY_SIZE(bhu_bxo2000n2s_leds_gpio),
+			bhu_bxo2000n2s_leds_gpio);
+
+	ath79_register_gpio_keys_polled(1, BHU_BXO2000N2S_KEYS_POLL_INTERVAL,
+			ARRAY_SIZE(bhu_bxo2000n2s_gpio_keys),
+			bhu_bxo2000n2s_gpio_keys);
+}
+
+MIPS_MACHINE(ATH79_MACH_BHU_BXO2000N2S, "BXO2000n-2S",
+		"BHU BXO2000n-2S",
+		bhu_bxo2000n2s_setup);
+
+
+/*
+ * BHU BXO2000n-2S-U board
+ */
+
+static void __init bhu_bxo2000n2s_u_setup(void)
+{
+	bhu_ap123_setup((u8 *) KSEG1ADDR(0x1fff0000), (u8 *) KSEG1ADDR(0x1fff1000));
+
+	ath79_register_leds_gpio(-1, ARRAY_SIZE(bhu_bxo2000n2s_leds_gpio),
+			bhu_bxo2000n2s_leds_gpio);
+
+	ath79_register_gpio_keys_polled(1, BHU_BXO2000N2S_KEYS_POLL_INTERVAL,
+			ARRAY_SIZE(bhu_bxo2000n2s_gpio_keys),
+			bhu_bxo2000n2s_gpio_keys);
+}
+
+MIPS_MACHINE(ATH79_MACH_BHU_BXO2000N2SU, "BXO2000n-2S-U",
+		"BHU BXO2000n-2S-U",
+		bhu_bxo2000n2s_u_setup);
+
+/*
+ * BHU BXI2000n-2 board
+ */
+
+#define BHU_BXI2000N2_GPIO_LED_WLAN		13
+#define BHU_BXI2000N2_GPIO_LED_LAN		14
+#define BHU_BXI2000N2_GPIO_LED_SYSTEM	15
+#define BHU_BXI2000N2_GPIO_LED_RES		19
+#define BHU_BXI2000N2_GPIO_LED_5G		21
+
+#define BHU_BXI2000N2_GPIO_BTN_RESET		17
+
+#define BHU_BXI2000N2_KEYS_POLL_INTERVAL	20	/* msecs */
+#define BHU_BXI2000N2_KEYS_DEBOUNCE_INTERVAL	\
+	(3 * BHU_BXI2000N2_KEYS_POLL_INTERVAL)
+
+static struct gpio_led bhu_bxi2000n2_leds_gpio[] __initdata = {
+	{
+		.name		= "bhu:green:status",
+		.gpio		= BHU_BXI2000N2_GPIO_LED_SYSTEM,
+		.active_low	= 1,
+	}, {
+		.name		= "bhu:green:lan",
+		.gpio		= BHU_BXI2000N2_GPIO_LED_LAN,
+		.active_low	= 1,
+	}, {
+		.name		= "bhu:green:wlan",
+		.gpio		= BHU_BXI2000N2_GPIO_LED_WLAN,
+		.active_low	= 1,
+	}, {
+		.name		= "bhu:green:res",
+		.gpio		= BHU_BXI2000N2_GPIO_LED_RES,
+		.active_low	= 1,
+	}, {
+		.name		= "bhu:green:5g",
+		.gpio		= BHU_BXI2000N2_GPIO_LED_5G,
+		.active_low	= 1,
+	},
+};
+
+static struct gpio_keys_button bhu_bxi2000n2_gpio_keys[] __initdata = {
+	{
+		.desc		= "Reset button",
+		.type		= EV_KEY,
+		.code		= KEY_RESTART,
+		.debounce_interval = BHU_BXI2000N2_KEYS_DEBOUNCE_INTERVAL,
+		.gpio		= BHU_BXI2000N2_GPIO_BTN_RESET,
+		.active_low	= 1,
+	}
+};
+
+static void __init bhu_bxi2000n2_setup(void)
+{
+	bhu_ap123_setup((u8 *) KSEG1ADDR(0x1f7f0000), (u8 *) KSEG1ADDR(0x1f7f1000));
+
+	ath79_register_leds_gpio(-1, ARRAY_SIZE(bhu_bxi2000n2_leds_gpio),
+				 bhu_bxi2000n2_leds_gpio);
+
+	ath79_register_gpio_keys_polled(1, BHU_BXI2000N2_KEYS_POLL_INTERVAL,
+					ARRAY_SIZE(bhu_bxi2000n2_gpio_keys),
+					bhu_bxi2000n2_gpio_keys);
+}
+
+MIPS_MACHINE(ATH79_MACH_BHU_BXI2000N2, "BXI2000n-2",
+		"BHU BXI2000n-2",
+		bhu_bxi2000n2_setup);
+
+
+/*
+ * BHU BXO5000n-2S board
+ */
+
+#define BHU_BXO5000N2S_GPIO_LED_SYSTEM	19
+#define BHU_BXO5000N2S_GPIO_LED_S0		19
+#define BHU_BXO5000N2S_GPIO_LED_S1		20
+#define BHU_BXO5000N2S_GPIO_LED_S2		21
+#define BHU_BXO5000N2S_GPIO_LED_S3		15
+#define BHU_BXO5000N2S_GPIO_LED_WLAN	12
+#define BHU_BXO5000N2S_GPIO_LED_WAN	18
+#define BHU_BXO5000N2S_GPIO_LED_LAN	22
+
+#define BHU_BXO5000N2S_GPIO_BTN_RESET        17
+
+#define BHU_BXO5000N2S_KEYS_POLL_INTERVAL   20  /* msecs */
+#define BHU_BXO5000N2S_KEYS_DEBOUNCE_INTERVAL   \
+	(3 * BHU_BXO5000N2S_KEYS_POLL_INTERVAL)
+
+static struct gpio_led bhu_bxo5000n2s_leds_gpio[] __initdata = {
+	{
+		.name       = "bhu:green:status",
+		.gpio       = BHU_BXO5000N2S_GPIO_LED_SYSTEM,
+		.active_low = 1,
+	}, {
+		.name       = "bhu:green:lan",
+		.gpio       = BHU_BXO5000N2S_GPIO_LED_LAN,
+		.active_low = 1,
+	}, {
+		.name       = "bhu:green:wan",
+		.gpio       = BHU_BXO5000N2S_GPIO_LED_WAN,
+		.active_low = 1,
+	}, {
+		.name       = "bhu:green:wlan",
+		.gpio       = BHU_BXO5000N2S_GPIO_LED_WLAN,
+		.active_low = 1,
+	}, {
+		.name       = "bhu:green:rssilow",
+		.gpio       = BHU_BXO5000N2S_GPIO_LED_S1,
+		.active_low = 1,
+	}, {
+		.name       = "bhu:green:rssimedium",
+		.gpio       = BHU_BXO5000N2S_GPIO_LED_S2,
+		.active_low = 1,
+	}, {
+		.name       = "bhu:green:rssihigh",
+		.gpio       = BHU_BXO5000N2S_GPIO_LED_S3,
+		.active_low = 1,
+	},
+};
+
+static struct gpio_keys_button bhu_bxo5000n2s_gpio_keys[] __initdata = {
+	{
+		.desc       = "Reset button",
+		.type       = EV_KEY,
+		.code       = KEY_RESTART,
+		.debounce_interval = BHU_BXO5000N2S_KEYS_DEBOUNCE_INTERVAL,
+		.gpio       = BHU_BXO5000N2S_GPIO_BTN_RESET,
+		.active_low = 1,
+	}
+};
+
+
+static void __init bhu_bxo5000n2s_setup(void)
+{
+	bhu_ap123_setup((u8 *) KSEG1ADDR(0x1f7f0000), (u8 *) KSEG1ADDR(0x1f7f1000));
+
+	ath79_register_leds_gpio(-1, ARRAY_SIZE(bhu_bxo5000n2s_leds_gpio),
+			bhu_bxo5000n2s_leds_gpio);
+
+	ath79_register_gpio_keys_polled(1, BHU_BXO5000N2S_KEYS_POLL_INTERVAL,
+			ARRAY_SIZE(bhu_bxo5000n2s_gpio_keys),
+			bhu_bxo5000n2s_gpio_keys);
+}
+
+MIPS_MACHINE(ATH79_MACH_BHU_BXO5000N2S, "BXO5000n-2S",
+		"BHU BXO5000n-2S",
+		bhu_bxo5000n2s_setup);
+
Index: target/linux/ar71xx/files/arch/mips/ath79/mach-bhu-bxu2000n2-a.c
===================================================================
--- target/linux/ar71xx/files/arch/mips/ath79/mach-bhu-bxu2000n2-a.c	(revision 43488)
+++ target/linux/ar71xx/files/arch/mips/ath79/mach-bhu-bxu2000n2-a.c	(working copy)
@@ -1,120 +0,0 @@
-/*
- *  BHU BXU2000n-2 A1 board support
- *
- *  Copyright (C) 2013 Terry Yang <yangbo at bhunetworks.com>
- *
- *  This program is free software; you can redistribute it and/or modify it
- *  under the terms of the GNU General Public License version 2 as published
- *  by the Free Software Foundation.
- */
-
-#include <linux/gpio.h>
-#include <linux/platform_device.h>
-
-#include <asm/mach-ath79/ath79.h>
-#include <asm/mach-ath79/ar71xx_regs.h>
-
-#include "common.h"
-#include "dev-eth.h"
-#include "dev-gpio-buttons.h"
-#include "dev-leds-gpio.h"
-#include "dev-m25p80.h"
-#include "dev-usb.h"
-#include "dev-wmac.h"
-#include "machtypes.h"
-
-#define BHU_BXU2000N2_A1_GPIO_LED_WLAN		13
-#define BHU_BXU2000N2_A1_GPIO_LED_WAN		19
-#define BHU_BXU2000N2_A1_GPIO_LED_LAN		21
-#define BHU_BXU2000N2_A1_GPIO_LED_SYSTEM	14
-
-#define BHU_BXU2000N2_A1_GPIO_BTN_RESET		17
-
-#define BHU_BXU2000N2_KEYS_POLL_INTERVAL	20	/* msecs */
-#define BHU_BXU2000N2_KEYS_DEBOUNCE_INTERVAL	\
-	(3 * BHU_BXU2000N2_KEYS_POLL_INTERVAL)
-
-static const char *bhu_bxu2000n2_part_probes[] = {
-	"cmdlinepart",
-	NULL,
-};
-
-static struct flash_platform_data bhu_bxu2000n2_flash_data = {
-	.part_probes	= bhu_bxu2000n2_part_probes,
-};
-
-static struct gpio_led bhu_bxu2000n2_a1_leds_gpio[] __initdata = {
-	{
-		.name		= "bhu:green:status",
-		.gpio		= BHU_BXU2000N2_A1_GPIO_LED_SYSTEM,
-		.active_low	= 1,
-	}, {
-		.name		= "bhu:green:lan",
-		.gpio		= BHU_BXU2000N2_A1_GPIO_LED_LAN,
-		.active_low	= 1,
-	}, {
-		.name		= "bhu:green:wan",
-		.gpio		= BHU_BXU2000N2_A1_GPIO_LED_WAN,
-		.active_low	= 1,
-	}, {
-		.name		= "bhu:green:wlan",
-		.gpio		= BHU_BXU2000N2_A1_GPIO_LED_WLAN,
-		.active_low	= 1,
-	},
-};
-
-static struct gpio_keys_button bhu_bxu2000n2_a1_gpio_keys[] __initdata = {
-	{
-		.desc		= "Reset button",
-		.type		= EV_KEY,
-		.code		= KEY_RESTART,
-		.debounce_interval = BHU_BXU2000N2_KEYS_DEBOUNCE_INTERVAL,
-		.gpio		= BHU_BXU2000N2_A1_GPIO_BTN_RESET,
-		.active_low	= 1,
-	}
-};
-
-static void __init bhu_ap123_setup(void)
-{
-	u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000);
-	u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
-
-	ath79_register_m25p80(&bhu_bxu2000n2_flash_data);
-
-	ath79_register_mdio(1, 0x0);
-
-	ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
-	ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1);
-
-	/* GMAC0 is connected to the PHY4 of the internal switch */
-	ath79_switch_data.phy4_mii_en = 1;
-	ath79_switch_data.phy_poll_mask = BIT(4);
-	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
-	ath79_eth0_data.phy_mask = BIT(4);
-	ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
-	ath79_register_eth(0);
-
-	/* GMAC1 is connected to the internal switch. Only use PHY3 */
-	ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
-	ath79_eth1_data.phy_mask = BIT(3);
-	ath79_register_eth(1);
-
-	ath79_register_wmac(ee, ee+2);
-}
-
-static void __init bhu_bxu2000n2_a1_setup(void)
-{
-	bhu_ap123_setup();
-
-	ath79_register_leds_gpio(-1, ARRAY_SIZE(bhu_bxu2000n2_a1_leds_gpio),
-				 bhu_bxu2000n2_a1_leds_gpio);
-
-	ath79_register_gpio_keys_polled(1, BHU_BXU2000N2_KEYS_POLL_INTERVAL,
-					ARRAY_SIZE(bhu_bxu2000n2_a1_gpio_keys),
-					bhu_bxu2000n2_a1_gpio_keys);
-}
-
-MIPS_MACHINE(ATH79_MACH_BHU_BXU2000N2_A1, "BXU2000n-2-A1",
-	     "BHU BXU2000n-2 rev. A1",
-	     bhu_bxu2000n2_a1_setup);
-
Index: target/linux/ar71xx/generic/profiles/bhu.mk
===================================================================
--- target/linux/ar71xx/generic/profiles/bhu.mk	(revision 43488)
+++ target/linux/ar71xx/generic/profiles/bhu.mk	(working copy)
@@ -15,3 +15,47 @@
 endef
 
 $(eval $(call Profile,BXU2000N2))
+
+define Profile/BXO2000N2S
+	NAME:=BHU BXO2000n-2s
+	PACKAGES:=kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-storage
+endef
+
+define Profile/BXO2000N2S/Description
+	Package set optimized for the BHU BXO2000n-2s.
+endef
+
+$(eval $(call Profile,BXO2000N2S))
+
+define Profile/BXO2000N2SU
+	NAME:=BHU BXO2000n-2s-u
+	PACKAGES:=kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-storage
+endef
+
+define Profile/BXO2000N2SU/Description
+	Package set optimized for the BHU BXO2000n-2s-u.
+endef
+
+$(eval $(call Profile,BXO2000N2SU))
+
+define Profile/BXI2000N2
+	NAME:=BHU BXI2000n-2
+	PACKAGES:=kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-storage
+endef
+
+define Profile/BXI2000N2/Description
+	Package set optimized for the BHU BXI2000n-2.
+endef
+
+$(eval $(call Profile,BXI2000N2))
+
+define Profile/BXO5000N2S
+	NAME:=BHU BXO5000n-2s
+	PACKAGES:=kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-storage
+endef
+
+define Profile/BXO5000N2S/Description
+	Package set optimized for the BHU BXO2000n-2s.
+endef
+
+$(eval $(call Profile,BXO5000N2S))
Index: target/linux/ar71xx/image/Makefile
===================================================================
--- target/linux/ar71xx/image/Makefile	(revision 43488)
+++ target/linux/ar71xx/image/Makefile	(working copy)
@@ -267,7 +267,11 @@
 ap132_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),6400k(rootfs),64k(art),7808k at 0x50000(firmware)
 ap135_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art)ro,16000k at 0x50000(firmware)
 ap136_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1408k(kernel),64k(mib0),64k(art)ro,7744k at 0x50000(firmware)
-bxu2000n2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),8448k(rootfs),6016k(user),64k(cfg),64k(oem),64k(art)ro
+bxu2000n2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),1408k(kernel),8448k(rootfs),6016k(user),64k(cfg),64k(oem),64k(art)ro,9856k at 0x50000(firmware)
+bxo2000n2su_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),1408k(kernel),12416k(rootfs),2048k(user),64k(cfg),64k(oem),64k(art)ro,13824k at 0x50000(firmware)
+bxo2000n2s_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),6400k(rootfs),1280k(kernel),64k(cfg),64k(oem),64k(art)ro,7680k at 0x50000(firmware)
+bxi2000n2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),6400k(rootfs),1280k(kernel),64k(cfg),64k(oem),64k(art)ro,7680k at 0x50000(firmware)
+bxo5000n2s_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),6400k(rootfs),1280k(kernel),64k(cfg),64k(oem),64k(art)ro,7680k at 0x50000(firmware)
 cameo_ap81_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(config)ro,3840k(firmware),64k(art)ro
 cameo_ap91_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,3712k(firmware),64k(mac)ro,64k(art)ro
 cameo_ap99_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,3520k(firmware),64k(mac)ro,192k(lp)ro,64k(art)ro
@@ -1136,7 +1140,11 @@
 $(eval $(call SingleProfile,AthLzma,64k,AP135,ap135-020,AP135-020,ttyS0,115200,$$(ap135_mtdlayout),RKuImage))
 $(eval $(call SingleProfile,AthLzma,64k,AP136_010,ap136-010,AP136-010,ttyS0,115200,$$(ap136_mtdlayout),RKuImage))
 $(eval $(call SingleProfile,AthLzma,64k,AP136_020,ap136-020,AP136-020,ttyS0,115200,$$(ap136_mtdlayout),RKuImage))
-$(eval $(call SingleProfile,AthLzma,64k,BXU2000N2,bxu2000n-2-a1,BXU2000n-2-A1,ttyS0,115200,$$(bxu2000n2_mtdlayout),RKuImage))
+$(eval $(call SingleProfile,AthLzma,64k,BXU2000N2,bxu2000n-2-a1,BXU2000n-2-A1,ttyS0,115200,$$(bxu2000n2_mtdlayout),KRuImage))
+$(eval $(call SingleProfile,AthLzma,64k,BXO2000N2SU,bxo2000n-2s-u,BXU2000n-2-U,ttyS0,115200,$$(bxo2000n2su_mtdlayout),KRuImage))
+$(eval $(call SingleProfile,AthLzma,64k,BXO2000N2S,bxo2000n-2s,BXO2000n-2S,ttyS0,115200,$$(bxo2000n2s_mtdlayout),RKuImage))
+$(eval $(call SingleProfile,AthLzma,64k,BXI2000N2,bxi2000n-2,BXI2000n-2,ttyS0,115200,$$(bxi2000n2_mtdlayout),RKuImage))
+$(eval $(call SingleProfile,AthLzma,64k,BXO5000N2S,bxo5000n-2s,BXO5000n-2S,ttyS0,115200,$$(bxo5000n2s_mtdlayout),RKuImage))
 $(eval $(call SingleProfile,AthLzma,64k,CAP4200AG,cap4200ag,CAP4200AG,ttyS0,115200,$$(cap4200ag_mtdlayout),KRuImage))
 $(eval $(call SingleProfile,AthLzma,64k,DB120,db120,DB120,ttyS0,115200,$$(db120_mtdlayout),RKuImage))
 $(eval $(call SingleProfile,AthLzma,64k,DRAGINO2,dragino2,DRAGINO2,ttyATH0,115200,$$(dragino2_mtdlayout),KRuImage,65536))
Index: target/linux/ar71xx/patches-3.14/734-MIPS-ath79-BHU-BXO2000n2s.patch
===================================================================
--- target/linux/ar71xx/patches-3.14/734-MIPS-ath79-BHU-BXO2000n2s.patch	(revision 0)
+++ target/linux/ar71xx/patches-3.14/734-MIPS-ath79-BHU-BXO2000n2s.patch	(working copy)
@@ -0,0 +1,37 @@
+--- a/arch/mips/ath79/Kconfig
++++ b/arch/mips/ath79/Kconfig
+@@ -1095,8 +1095,8 @@ config ATH79_MACH_CARAMBOLA2
+	select ATH79_DEV_USB
+	select ATH79_DEV_WMAC
+ 
+-config ATH79_MACH_BHU_BXU2000N2_A
+-	bool "BHU BXU2000n-2 rev. A support"
++config ATH79_MACH_BHU_ATH
++	bool "BHU atheros board support"
+	select SOC_AR934X
+	select ATH79_DEV_ETH
+	select ATH79_DEV_GPIO_BUTTONS
+--- a/arch/mips/ath79/Makefile
++++ b/arch/mips/ath79/Makefile
+@@ -51,7 +51,7 @@ obj-$(CONFIG_ATH79_MACH_AP83)		+= mach-a
+ obj-$(CONFIG_ATH79_MACH_AP96)		+= mach-ap96.o
+ obj-$(CONFIG_ATH79_MACH_ARCHER_C7)	+= mach-archer-c7.o
+ obj-$(CONFIG_ATH79_MACH_AW_NR580)	+= mach-aw-nr580.o
+-obj-$(CONFIG_ATH79_MACH_BHU_BXU2000N2_A)+= mach-bhu-bxu2000n2-a.o
++obj-$(CONFIG_ATH79_MACH_BHU_ATH)	+= mach-bhu-ath.o
+ obj-$(CONFIG_ATH79_MACH_CAP4200AG)	+= mach-cap4200ag.o
+ obj-$(CONFIG_ATH79_MACH_CPE510)		+= mach-cpe510.o
+ obj-$(CONFIG_ATH79_MACH_DB120)		+= mach-db120.o
+--- a/arch/mips/ath79/machtypes.h
++++ b/arch/mips/ath79/machtypes.h
+@@ -35,6 +35,10 @@ enum ath79_mach_type {
+	ATH79_MACH_ARCHER_C7,		/* TP-LINK Archer C7 board */
+	ATH79_MACH_AW_NR580,		/* AzureWave AW-NR580 */
+ 	ATH79_MACH_BHU_BXU2000N2_A1,	/* BHU BXU2000n-2 A1 */
++	ATH79_MACH_BHU_BXO2000N2S,  /* BHU BXO2000n-2s */
++	ATH79_MACH_BHU_BXO2000N2SU, /* BHU BXO2000n-2s-u */
++	ATH79_MACH_BHU_BXI2000N2,   /* BHU BXI2000n-2 */
++	ATH79_MACH_BHU_BXO5000N2S,  /* BHU BXO5000n-2s */
+	ATH79_MACH_CAP4200AG,		/* Senao CAP4200AG */
+	ATH79_MACH_CARAMBOLA2,		/* 8devices Carambola2 */
+	ATH79_MACH_CPE510,		/* TP-LINK CPE510 */




From: John Crispin
Date: 2014-12-04 15:29
To: openwrt-devel
Subject: Re: [OpenWrt-Devel] [PATCH][ar71xx] Add support for BHU Networks BXO2000n-2S/BXO5000n-2S/BXI2000n-2/BXO2000n-2S-U
Hi,

patches for new boards are always welcome, a few comments below

On 04/12/2014 08:23, yangbo wrote:
> +/*
> + * BHU BXO2000n-2S-U board
> + */
> +
> +static void __init bhu_bxo2000n2s_u_setup(void)
> +{
> + bhu_ap123_setup((u8 *) KSEG1ADDR(0x1fff0000), (u8 *) KSEG1ADDR(0x1fff1000));
> +
> +    ath79_register_leds_gpio(-1, ARRAY_SIZE(bhu_bxo2000n2s_leds_gpio),
> +                 bhu_bxo2000n2s_leds_gpio);

     ^ the patch is full of leading space vs tab errors like this.
please fix them and resend the patch. i am not sure how the other mach
files handle it but i would prefer to have all the #defines at the start
of the file rather than have it intermingled with the code.

John


> +
> +    ath79_register_gpio_keys_polled(1, BHU_BXO2000N2S_KEYS_POLL_INTERVAL,
> +                    ARRAY_SIZE(bhu_bxo2000n2s_gpio_keys),
> +                    bhu_bxo2000n2s_gpio_keys);
> +}
> +
> +MIPS_MACHINE(ATH79_MACH_BHU_BXO2000N2SU, "BXO2000n-2S-U",
> +         "BHU BXO2000n-2S-U",
> +         bhu_bxo2000n2s_u_setup);
> +
> +/*
> + * BHU BXI2000n-2 board
> + */
> +
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list