This patch adds Gainstrong Minibox V1.0 into trunk.

Don't have the device myself, so can't check on a possible
LED polarity issue, but I have built images and asked for testing
on the forum.

Signed-off by: Stijn Segers <[email protected]>
---
 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 | 85 ++++++++++++++++++++++
 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, 162 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 561c5da..8820609 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -216,6 +216,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 2893e62..5506e3f 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -417,6 +417,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 256bd10..13324c3 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"
                ;;
@@ -499,6 +502,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 76d8c5b..228b2df 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -313,6 +313,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 1e31a01..2ff4a66 100644
--- a/target/linux/ar71xx/config-4.1
+++ b/target/linux/ar71xx/config-4.1
@@ -78,6 +78,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..c9fbbe5
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-minibox-v1.c
@@ -0,0 +1,85 @@
+/*
+ *  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..ee103fa
--- /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 MINIBOX V1.0
+endef
+$(eval $(call Profile,MINIBOXV1))
diff --git a/target/linux/ar71xx/image/Makefile 
b/target/linux/ar71xx/image/Makefile
index e894d78..8d5b376 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -389,6 +389,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..c17b313
--- /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,  /* 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
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to