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

Stijn Segers francesco.borromini at inventati.org
Tue Aug 18 15:44:29 EDT 2015


This patch adds Gainstrong Minibox v1.0 into trunk. I have addressed the
following issues:
- all caps prefix
- added vendor

I have built images and asked for testing on the forums, the image has
been confirmed working but the LED is off during normal operation (I assume
this is the possible LED polarity issue Karl Palsson was talking about?)

Questions:

- Can I simply set gpio_led minibox_v1_leds_gpio to active.low = 1 or isn't
  that how it works?
- Should I give the 799 minibox kernel support patch a number that follows
  the existing patches more closely (e.g. 750) or doesn't that matter?

Thanks

Signed-off by: Stijn Segers <francesco.borromini at inventati.org>

---
 target/linux/ar71xx/base-files/etc/diag.sh         |  3 +
 .../ar71xx/base-files/etc/uci-defaults/02_network  |  1 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh       |  6 ++
 .../ar71xx/base-files/lib/upgrade/platform.sh      |  1 +
 target/linux/ar71xx/config-4.1                     |  1 +
 .../ar71xx/files/arch/mips/ath79/mach-minibox-v1.c | 84 ++++++++++++++++++++++
 target/linux/ar71xx/generic/profiles/minibox-v1.mk | 17 +++++
 target/linux/ar71xx/image/Makefile                 |  9 +++
 .../799-MIPS-ath79-add-minibox-v1-support.patch    | 39 ++++++++++
 9 files changed, 161 insertions(+)
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-minibox-v1.c
 create mode 100644 target/linux/ar71xx/generic/profiles/minibox-v1.mk
 create mode 100644 target/linux/ar71xx/patches-4.1/799-MIPS-ath79-add-minibox-v1-support.patch

diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 36de775..342c68c 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -219,6 +219,9 @@ get_status_led() {
 	smart-300)
 		status_led="nc-link:green:system"
 		;;
+	minibox-v1)
+		status_led="minibox-v1:green:system"
+		;;
 	oolite)
 		status_led="oolite:red:system"
 		;;
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index 686fce9..49f6b55 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -425,6 +425,7 @@ dir-615-e4 |\
 hiwifi-hc6361 |\
 ja76pf |\
 mc-mac1200r|\
+minibox-v1 |\
 mynet-n600 |\
 oolite |\
 qihoo-c301 |\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index e1f345e..4f9735f 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/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"
 		;;
@@ -502,6 +505,9 @@ ar71xx_board_detect() {
 	*"MAC1200R")
 		name="mc-mac1200r"
 		;;
+	*"Minibox v1.0")
+		name="minibox-v1"
+		;;
 	*MR12)
 		name="mr12"
 		;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index c1962e4..0b7b84c 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -314,6 +314,7 @@ platform_check_image() {
 	el-mini | \
 	gl-inet | \
 	mc-mac1200r | \
+	minibox-v1 |\
 	onion-omega | \
 	oolite | \
 	smart-300 | \
diff --git a/target/linux/ar71xx/config-4.1 b/target/linux/ar71xx/config-4.1
index 21c4601..49f2ac1 100644
--- a/target/linux/ar71xx/config-4.1
+++ b/target/linux/ar71xx/config-4.1
@@ -79,6 +79,7 @@ CONFIG_ATH79_MACH_HORNET_UB=y
 CONFIG_ATH79_MACH_JA76PF=y
 CONFIG_ATH79_MACH_JWAP003=y
 CONFIG_ATH79_MACH_MC_MAC1200R=y
+CONFIG_ATH79_MACH_MINIBOX_V1=y
 CONFIG_ATH79_MACH_MR12=y
 CONFIG_ATH79_MACH_MR16=y
 CONFIG_ATH79_MACH_MR600=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-minibox-v1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-minibox-v1.c
new file mode 100644
index 0000000..7c26cab
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-minibox-v1.c
@@ -0,0 +1,84 @@
+/*
+ *  Minibox v1.0 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-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.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);
diff --git a/target/linux/ar71xx/generic/profiles/minibox-v1.mk b/target/linux/ar71xx/generic/profiles/minibox-v1.mk
new file mode 100644
index 0000000..cbdb123
--- /dev/null
+++ b/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 Gainstrong Minibox v1.0
+endef
+$(eval $(call Profile,Miniboxv1))
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 8f609de..4a2a45e 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -397,6 +397,15 @@ define Device/mc-mac1200r
 endef
 TARGET_DEVICES += mc-mac1200r
 
+define Device/minibox-v1
+    $(Device/tplink-16mlzma)
+    BOARDNAME := Minibox-v1
+    DEVICE_PROFILE := Miniboxv1
+    TPLINK_HWID := 0x3C000201
+    CONSOLE := ttyATH0,115200
+endef
+TARGET_DEVICES += minibox-v1
+
 define Device/onion-omega
     $(Device/tplink-16mlzma)
     BOARDNAME := ONION-OMEGA
diff --git a/target/linux/ar71xx/patches-4.1/799-MIPS-ath79-add-minibox-v1-support.patch b/target/linux/ar71xx/patches-4.1/799-MIPS-ath79-add-minibox-v1-support.patch
new file mode 100644
index 0000000..75be5fe
--- /dev/null
+++ b/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
+@@ -74,6 +74,7 @@ enum ath79_mach_type {
+	ATH79_MACH_JA76PF2,		/* jjPlus JA76PF2 */
+	ATH79_MACH_JWAP003,		/* jjPlus JWAP003 */
+	ATH79_MACH_HORNET_UB,		/* ALFA Networks Hornet-UB */
++	ATH79_MACH_MINIBOX_V1,		/* Gainstrong Minibox v1.0 */
+	ATH79_MACH_MR12,		/* Cisco Meraki MR12 */
+	ATH79_MACH_MR16,		/* Cisco Meraki MR16 */
+	ATH79_MACH_MR600V2,		/* OpenMesh MR600v2 */
+--- a/arch/mips/ath79/Kconfig
++++ b/arch/mips/ath79/Kconfig
+@@ -596,6 +596,16 @@
+	select ATH79_DEV_M25P80
+	select ATH79_DEV_USB
+
++config ATH79_MACH_MINIBOX_V1
++	bool "Minibox 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_WRT160NL
+	bool "Linksys WRT160NL board support"
+	select SOC_AR913X
+--- a/arch/mips/ath79/Makefile	2015-08-10 23:27:44.599500173 +0200
++++ b/arch/mips/ath79/Makefile	2015-08-10 23:29:25.090929262 +0200
+@@ -85,6 +85,7 @@
+ obj-$(CONFIG_ATH79_MACH_JWAP003)	+= mach-jwap003.o
+ obj-$(CONFIG_ATH79_MACH_HORNET_UB)	+= mach-hornet-ub.o
+ obj-$(CONFIG_ATH79_MACH_MC_MAC1200R)     += mach-mc-mac1200r.o
++obj-$(CONFIG_ATH79_MACH_MINIBOX_V1)	+= mach-minibox-v1.o
+ obj-$(CONFIG_ATH79_MACH_MR12)		+= mach-mr12.o
+ obj-$(CONFIG_ATH79_MACH_MR16)		+= mach-mr16.o
+ obj-$(CONFIG_ATH79_MACH_MR600)		+= mach-mr600.o
-- 
2.1.4
_______________________________________________
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