[OpenWrt-Devel] [PATCH] Ar71xx: Add Minibox v1.0 support

Stijn Segers francesco.borromini at inventati.org
Sun Aug 9 16:47:58 EDT 2015


Hello,

The patch below adds support for the Gainstrong Minibox v1.0 mini 
router into trunk. This is based off the Barrier Breaker based source 
code at http://ooioe.com/miniboxv1/Sourcecode/.

Patch applies cleanly, has been compile-tested on a 15.05 tree (the 
patch below is for the trunk ar17xx target with kernel 4.1). For those 
interested, I can provide the 15.05 patch as well.

Any questions, let me know.

Thank you

Stijn




Index: openwrt/trunk/target/linux/ar71xx/base-files/etc/diag.sh
===================================================================
--- openwrt.orig/trunk/target/linux/ar71xx/base-files/etc/diag.sh
+++ openwrt/trunk/target/linux/ar71xx/base-files/etc/diag.sh
@@ -222,6 +222,9 @@ get_status_led() {
 	qihoo-c301)
 		status_led="qihoo:green:status"
 		;;
+	minibox-v1)
+		status_led="minibox-v1:green:system"
+		;;
 	tew-632brp)
 		status_led="tew-632brp:green:status"
 		;;
@@ -366,7 +369,7 @@ set_state() {
 		status_led_blink_preinit_regular
 		;;
 	done)
-		status_led_on
+		status_led_off
 		case $(ar71xx_board_name) in
 		qihoo-c301)
 			local n=$(fw_printenv activeregion | cut -d = -f 2)
Index: 
openwrt/trunk/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
===================================================================
--- 
openwrt.orig/trunk/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ 
openwrt/trunk/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -419,6 +419,7 @@ ja76pf |\
 mc-mac1200r|\
 mynet-n600 |\
 oolite |\
+minibox-v1 |\
 qihoo-c301 |\
 rb-750 |\
 rb-751 |\
Index: openwrt/trunk/target/linux/ar71xx/base-files/lib/ar71xx.sh
===================================================================
--- openwrt.orig/trunk/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ openwrt/trunk/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -119,6 +119,9 @@ tplink_board_detect() {
 	"3C0001"*)
 		model="OOLITE"
 		;;
+	"3C0002"*)
+		model="MINIBOX_V1"
+		;;
 	"070300"*)
 		model="TP-Link TL-WR703N"
 		;;
@@ -320,6 +323,9 @@ ar71xx_board_detect() {
 	*"AC1750DB")
 		name="f9k1115v2"
 		;;
+	*"MiniBox V1.0")
+		name="minibox-v1"
+		;;
 	*"AirGateway")
 		name="airgateway"
 		;;
Index: 
openwrt/trunk/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
===================================================================
--- 
openwrt.orig/trunk/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ openwrt/trunk/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -315,6 +315,7 @@ platform_check_image() {
 	mc-mac1200r | \
 	onion-omega | \
 	oolite | \
+	minibox-v1 |\
 	smart-300 | \
 	tl-mr10u | \
 	tl-mr11u | \
Index: openwrt/trunk/target/linux/ar71xx/config-4.1
===================================================================
--- openwrt.orig/trunk/target/linux/ar71xx/config-4.1
+++ openwrt/trunk/target/linux/ar71xx/config-4.1
@@ -73,6 +73,7 @@ CONFIG_ATH79_MACH_EW_DORIN=y
 CONFIG_ATH79_MACH_F9K1115V2=y
 CONFIG_ATH79_MACH_GL_INET=y
 CONFIG_ATH79_MACH_GS_OOLITE=y
+CONFIG_ATH79_MACH_MINIBOX_V1=y
 CONFIG_ATH79_MACH_HIWIFI_HC6361=y
 CONFIG_ATH79_MACH_HORNET_UB=y
 CONFIG_ATH79_MACH_JA76PF=y
Index: 
openwrt/trunk/target/linux/ar71xx/files/arch/mips/ath79/mach-minibox-v1.c
===================================================================
--- /dev/null
+++ 
openwrt/trunk/target/linux/ar71xx/files/arch/mips/ath79/mach-minibox-v1.c
@@ -0,0 +1,85 @@
+/*
+ *  Oolite board support
+ *
+ *
+ *  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 <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-wmac.h"
+#include "machtypes.h"
+#include "dev-usb.h"
+
+#define MINIBOX_V1_GPIO_BTN_RESET	11
+
+#define MINIBOX_V1_GPIO_LED_SYSTEM	1
+
+#define MINIBOX_V1_KEYS_POLL_INTERVAL	20	/* msecs */
+#define MINIBOX_V1_KEYS_DEBOUNCE_INTERVAL (3 * 
MINIBOX_V1_KEYS_POLL_INTERVAL)
+
+static const char *MINIBOX_V1_part_probes[] = {
+	"tp-link",
+	NULL,
+};
+
+static struct flash_platform_data MINIBOX_V1_flash_data = {
+	.part_probes	= MINIBOX_V1_part_probes,
+};
+
+static struct gpio_led MINIBOX_V1_leds_gpio[] __initdata = {
+	{
+		.name		= "minibox-v1:green:system",
+		.gpio		= MINIBOX_V1_GPIO_LED_SYSTEM,
+		.active_low	= 0,
+	},
+};
+
+static struct gpio_keys_button MINIBOX_V1_gpio_keys[] __initdata = {
+	{
+		.desc		= "reset",
+		.type		= EV_KEY,
+		.code		= KEY_RESTART,
+		.debounce_interval = MINIBOX_V1_KEYS_DEBOUNCE_INTERVAL,
+		.gpio		= MINIBOX_V1_GPIO_BTN_RESET,
+		.active_low	= 0,
+	},
+};
+
+static void __init MINIBOX_V1_setup(void)
+{
+	u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
+	u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
+
+	ath79_register_leds_gpio(-1, ARRAY_SIZE(MINIBOX_V1_leds_gpio),
+				 MINIBOX_V1_leds_gpio);
+
+	ath79_register_gpio_keys_polled(-1, MINIBOX_V1_KEYS_POLL_INTERVAL,
+					ARRAY_SIZE(MINIBOX_V1_gpio_keys),
+					MINIBOX_V1_gpio_keys);
+
+	ath79_register_usb();
+
+	ath79_register_m25p80(&MINIBOX_V1_flash_data);
+	ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
+	ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1);
+
+	ath79_register_mdio(0, 0x0);
+	ath79_register_eth(1);
+	ath79_register_eth(0);
+
+	ath79_register_wmac(ee, mac);
+}
+
+MIPS_MACHINE(ATH79_MACH_MINIBOX_V1, "MINIBOX-V1",
+	     "MiniBox V1.0", MINIBOX_V1_setup);
Index: openwrt/trunk/target/linux/ar71xx/generic/profiles/minibox-v1.mk
===================================================================
--- /dev/null
+++ openwrt/trunk/target/linux/ar71xx/generic/profiles/minibox-v1.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License 
v2.
+# See /LICENSE for more information.
+#
+
+define Profile/MINIBOXV1
+	NAME:=MINIBOX V1.0
+	PACKAGES:=kmod-usb-core kmod-usb2  kmod-ledtrig-usbdev
+endef
+
+
+define Profile/MINIBOXV1/Description
+	Package set optimized for the MINIBOX V1.0
+endef
+$(eval $(call Profile,MINIBOXV1))
Index: openwrt/trunk/target/linux/ar71xx/image/Makefile
===================================================================
--- openwrt.orig/trunk/target/linux/ar71xx/image/Makefile
+++ openwrt/trunk/target/linux/ar71xx/image/Makefile
@@ -902,6 +902,15 @@ endef

 TARGET_DEVICES += ubnt-uap-pro ubnt-unifi-outdoor-plus

+define Device/minibox-v1
+    $(Device/tplink-16mlzma)
+    BOARDNAME := MINIBOX-V1
+    DEVICE_PROFILE := MINIBOXV1
+    TPLINK_HWID := 0x3C000201
+    CONSOLE := ttyATH0,115200
+endef
+TARGET_DEVICES += minibox-v1
+
 rootfs_type=$(patsubst jffs2-%,jffs2,$(patsubst 
squashfs-%,squashfs,$(1)))

 # $(1): rootfs type.
Index: 
openwrt/trunk/target/linux/ar71xx/patches-4.1/799-MIPS-ath79-add-minibox-v1-support.patch
===================================================================
--- /dev/null
+++ 
openwrt/trunk/target/linux/ar71xx/patches-4.1/799-MIPS-ath79-add-minibox-v1-support.patch
@@ -0,0 +1,39 @@
+--- a/arch/mips/ath79/machtypes.h
++++ b/arch/mips/ath79/machtypes.h
+@@ -61,6 +61,7 @@ enum ath79_mach_type {
+	ATH79_MACH_ESR1750,		/* EnGenius ESR1750 */
+	ATH79_MACH_GL_INET,		/* GL-CONNECT GL-INET */
+	ATH79_MACH_GS_OOLITE,           /* GS OOLITE V1.0 */
++	ATH79_MACH_MINIBOX_V1,           /* MINIBOX V1.0 */
+	ATH79_MACH_HIWIFI_HC6361,	/* HiWiFi HC6361 */
+	ATH79_MACH_JA76PF,		/* jjPlus JA76PF */
+	ATH79_MACH_JA76PF2,		/* jjPlus JA76PF2 */
+--- a/arch/mips/ath79/Kconfig
++++ b/arch/mips/ath79/Kconfig
+@@ -446,6 +446,16 @@ config ATH79_MACH_GS_OOLITE
+       select ATH79_DEV_USB
+       select ATH79_DEV_WMAC
+
++config ATH79_MACH_MINIBOX_V1
++       bool "OOLITE BOX V1.0 support"
++       select SOC_AR933X
++       select ARH79_DEV_ETH
++       select ARH79_DEV_GPIO_BUTTONS
++       select ATH79_DEV_LEDS_GPIO
++       select ATH79_DEV_M25P80
++       select ATH79_DEV_USB
++       select ATH79_DEV_WMAC
++
+ config ATH79_MACH_HIWIFI_HC6361
+	bool "HiWiFi HC6361 board support"
+	select SOC_AR933X
+--- a/arch/mips/ath79/Makefile
++++ b/arch/mips/ath79/Makefile
+@@ -72,6 +72,7 @@ obj-$(CONFIG_ATH79_MACH_DIR_825_C1)	+= m
+ obj-$(CONFIG_ATH79_MACH_ESR1750)	+= mach-esr1750.o
+ obj-$(CONFIG_ATH79_MACH_GL_INET)	+= mach-gl-inet.o
+ obj-$(CONFIG_ATH79_MACH_GS_OOLITE)	+= mach-gs-oolite.o
++obj-$(CONFIG_ATH79_MACH_MINIBOX_V1)	+= mach-minibox-v1.o
+ obj-$(CONFIG_ATH79_MACH_HIWIFI_HC6361)	+= mach-hiwifi-hc6361.o
+ obj-$(CONFIG_ATH79_MACH_JA76PF)		+= mach-ja76pf.o
+ obj-$(CONFIG_ATH79_MACH_JWAP003)	+= mach-jwap003.o


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20150809/9743e001/attachment.htm>
-------------- next part --------------
_______________________________________________
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