Signed-off-by: Jon Suphammer <j...@suphammer.net>
---
 target/linux/ar71xx/base-files/etc/diag.sh         |   3 +
 .../ar71xx/base-files/etc/uci-defaults/02_network  |   7 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh       |   3 +
 .../ar71xx/base-files/lib/upgrade/platform.sh      |   1 +
 target/linux/ar71xx/config-3.10                    |   3 +-
 .../ar71xx/files/arch/mips/ath79/mach-esr1750.c    | 176 +++++++++++++++++++++
 target/linux/ar71xx/generic/profiles/engenius.mk   |  16 ++
 target/linux/ar71xx/image/Makefile                 |   2 +
 .../713-MIPS-ath79-add-ESR1750-support.patch       |  45 ++++++
 9 files changed, 255 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-esr1750.c
 create mode 100644 target/linux/ar71xx/generic/profiles/engenius.mk
 create mode 100644 
target/linux/ar71xx/patches-3.10/713-MIPS-ath79-add-ESR1750-support.patch

diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
b/target/linux/ar71xx/base-files/etc/diag.sh
index ef172b4..144459b 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -69,6 +69,9 @@ get_status_led() {
        el-m150)
                status_led="EasyLink:green:system"
                ;;
+       esr1750)
+               status_led="esr1750:amber:power"
+               ;;
        hiwifi-hc6361)
                status_led="hiwifi:blue: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 646425c..17a72ff 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -30,6 +30,13 @@ wlr8100)
        ucidef_add_switch_vlan "switch0" "2" "0t 1"
        ;;
 
+esr1750)
+       ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+       ucidef_add_switch "switch0" "1" "1"
+       ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
+       ucidef_add_switch_vlan "switch0" "2" "0t 1"
+       ;;
+
 ap136-010)
        ucidef_set_interfaces_lan_wan "eth0" "eth1"
        ucidef_add_switch "switch0" "1" "1"
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index bd277ab..e37c56d 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -319,6 +319,9 @@ ar71xx_board_detect() {
        *EL-MINI)
                name="el-mini"
                ;;
+       *"EnGenius ESR1750")
+               name="esr1750"
+               ;;
        *JA76PF)
                name="ja76pf"
                ;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 8af9580..70f7fc2 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -151,6 +151,7 @@ platform_check_image() {
        dir-825-c1 | \
        dir-835-a1 | \
        dragino2 | \
+       esr1750 | \
        ew-dorin | \
        ew-dorin-router | \
        hiwifi-hc6361 | \
diff --git a/target/linux/ar71xx/config-3.10 b/target/linux/ar71xx/config-3.10
index 4e30a44..9bc6ecc 100644
--- a/target/linux/ar71xx/config-3.10
+++ b/target/linux/ar71xx/config-3.10
@@ -49,10 +49,11 @@ CONFIG_ATH79_MACH_DRAGINO2=y
 CONFIG_ATH79_MACH_EAP7660D=y
 CONFIG_ATH79_MACH_EL_M150=y
 CONFIG_ATH79_MACH_EL_MINI=y
+CONFIG_ATH79_MACH_ESR1750=y
 CONFIG_ATH79_MACH_EW_DORIN=y
 CONFIG_ATH79_MACH_GS_OOLITE=y
-CONFIG_ATH79_MACH_HORNET_UB=y
 CONFIG_ATH79_MACH_HIWIFI_HC6361=y
+CONFIG_ATH79_MACH_HORNET_UB=y
 CONFIG_ATH79_MACH_JA76PF=y
 CONFIG_ATH79_MACH_JWAP003=y
 CONFIG_ATH79_MACH_MR600=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-esr1750.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-esr1750.c
new file mode 100644
index 0000000..514a646
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-esr1750.c
@@ -0,0 +1,176 @@
+/*
+ *  EnGenius ESR1750 board support
+ *
+ *  Copyright (c) 2014 Jon Suphammer <j...@suphammer.net>
+ *
+ *  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/platform_device.h>
+#include <linux/ar8216_platform.h>
+
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include "common.h"
+#include "pci.h"
+#include "dev-ap9x-pci.h"
+#include "dev-gpio-buttons.h"
+#include "dev-eth.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+#include "nvram.h"
+
+#define ESR1750_GPIO_LED_WLAN_5G       23
+#define ESR1750_GPIO_LED_WLAN_2G       13
+#define ESR1750_GPIO_LED_POWER_AMBER   2
+#define ESR1750_GPIO_LED_WPS_AMBER     22
+#define ESR1750_GPIO_LED_WPS_BLUE      19
+
+#define ESR1750_GPIO_BTN_WPS           16
+#define ESR1750_GPIO_BTN_RESET         17
+
+#define ESR1750_KEYS_POLL_INTERVAL     20      /* msecs */
+#define ESR1750_KEYS_DEBOUNCE_INTERVAL (3 * ESR1750_KEYS_POLL_INTERVAL)
+
+#define ESR1759_CALDATA_ADDR 0x1fff0000
+#define ESR1750_WMAC_CALDATA_OFFSET    0x1000
+#define ESR1750_PCIE_CALDATA_OFFSET    0x5000
+
+#define ESR1750_NVRAM_ADDR     0x1f030000
+#define ESR1750_NVRAM_SIZE     0x10000
+
+static struct gpio_led esr1750_leds_gpio[] __initdata = {
+       {
+               .name           = "esr1750:amber:power",
+               .gpio           = ESR1750_GPIO_LED_POWER_AMBER,
+               .active_low     = 1,
+       },
+       {
+               .name           = "esr1750:blue:wps",
+               .gpio           = ESR1750_GPIO_LED_WPS_BLUE,
+               .active_low     = 1,
+       },
+       {
+               .name           = "esr1750:amber:wps",
+               .gpio           = ESR1750_GPIO_LED_WPS_AMBER,
+               .active_low     = 1,
+       },
+       {
+               .name           = "esr1750:blue:wlan-2g",
+               .gpio           = ESR1750_GPIO_LED_WLAN_2G,
+               .active_low     = 1,
+       },
+       {
+               .name           = "esr1750:blue:wlan-5g",
+               .gpio           = ESR1750_GPIO_LED_WLAN_5G,
+               .active_low     = 1,
+       }
+};
+
+static struct gpio_keys_button esr1750_gpio_keys[] __initdata = {
+       {
+               .desc           = "WPS button",
+               .type           = EV_KEY,
+               .code           = KEY_WPS_BUTTON,
+               .debounce_interval = ESR1750_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = ESR1750_GPIO_BTN_WPS,
+               .active_low     = 1,
+       },
+       {
+               .desc           = "Reset button",
+               .type           = EV_KEY,
+               .code           = KEY_RESTART,
+               .debounce_interval = ESR1750_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = ESR1750_GPIO_BTN_RESET,
+               .active_low     = 1,
+       },
+};
+
+static struct ar8327_pad_cfg esr1750_ar8327_pad0_cfg = {
+       .mode = AR8327_PAD_MAC_RGMII,
+       .txclk_delay_en = true,
+       .rxclk_delay_en = true,
+       .txclk_delay_sel = AR8327_CLK_DELAY_SEL1,
+       .rxclk_delay_sel = AR8327_CLK_DELAY_SEL2,
+};
+
+static struct ar8327_platform_data esr1750_ar8327_data = {
+       .pad0_cfg = &esr1750_ar8327_pad0_cfg,
+       .port0_cfg = {
+               .force_link = 1,
+               .speed = AR8327_PORT_SPEED_1000,
+               .duplex = 1,
+               .txpause = 1,
+               .rxpause = 1,
+       },
+};
+
+static struct mdio_board_info esr1750_mdio0_info[] = {
+       {
+               .bus_id = "ag71xx-mdio.0",
+               .phy_addr = 0,
+               .platform_data = &esr1750_ar8327_data,
+       },
+};
+
+static int esr1750_get_mac(const char *name, char *mac)
+{
+       u8 *nvram = (u8 *) KSEG1ADDR(ESR1750_NVRAM_ADDR);
+       int err;
+
+       err = ath79_nvram_parse_mac_addr(nvram, ESR1750_NVRAM_SIZE,
+                                        name, mac);
+       if (err)
+       {
+               pr_err("no MAC address found for %s\n", name);
+               return false;
+       }
+
+       return true;
+}
+
+static void __init esr1750_setup(void)
+{
+       u8 *caldata = (u8 *) KSEG1ADDR(ESR1759_CALDATA_ADDR);
+       u8 mac1[ETH_ALEN];
+
+       ath79_register_m25p80(NULL);
+
+       ath79_register_leds_gpio(-1, ARRAY_SIZE(esr1750_leds_gpio),
+                                       esr1750_leds_gpio);
+       ath79_register_gpio_keys_polled(-1, ESR1750_KEYS_POLL_INTERVAL,
+                                       ARRAY_SIZE(esr1750_gpio_keys),
+                                       esr1750_gpio_keys);
+
+       ath79_register_usb();
+
+       ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN);
+
+       ath79_register_mdio(0, 0x0);
+
+       mdiobus_register_board_info(esr1750_mdio0_info,
+                                       ARRAY_SIZE(esr1750_mdio0_info));
+
+       /* GMAC0 is connected to an QCA8327N switch */
+       ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+       ath79_eth0_data.phy_mask = BIT(0);
+       ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
+
+       ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+       if(esr1750_get_mac("ethaddr=", mac1))
+               ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
+       ath79_eth0_pll_data.pll_1000 = 0xa6000000;
+       ath79_register_eth(0);
+
+       ath79_register_wmac(caldata + ESR1750_WMAC_CALDATA_OFFSET, mac1);
+}
+
+MIPS_MACHINE(ATH79_MACH_ESR1750, "ESR1750",
+            "EnGenius ESR1750",
+            esr1750_setup);
+
diff --git a/target/linux/ar71xx/generic/profiles/engenius.mk 
b/target/linux/ar71xx/generic/profiles/engenius.mk
new file mode 100644
index 0000000..ed844e0
--- /dev/null
+++ b/target/linux/ar71xx/generic/profiles/engenius.mk
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2009-2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+define Profile/ESR1750
+        NAME:=EnGenius ESR1750
+        PACKAGES:=kmod-usb-core kmod-usb2 kmod-ledtrig-usbdev kmod-ath10k luci 
-wpad-mini wpad
+endef
+
+define Profile/ESR1750/Description
+        Package set optimized for the EnGenius ESR1750
+endef
+
+$(eval $(call Profile,ESR1750))
diff --git a/target/linux/ar71xx/image/Makefile 
b/target/linux/ar71xx/image/Makefile
index 6bc1105..d55959c 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -264,6 +264,7 @@ 
cap4200ag_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),320k(custom)ro,
 
db120_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1408k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware)
 
cameo_ap94_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,6208k(firmware),64k(caldata)ro,1600k(unknown)ro,64k@0x7f0000(caldata_copy)
 
cameo_ap94_mtdlayout_fat=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,7808k(firmware),64k(caldata)ro,64k@0x660000(caldata_orig),6208k@0x50000(firmware_orig)
+esr1750_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),13248k(rootfs),1024k(manufacture)ro,64k(backup)ro,320k(storage)ro,64k(caldata)ro,14656k@0x40000(firmware)
 
ew-dorin_mtdlayout_4M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),3712k(firmware),64k(art)
 
ew-dorin_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),16000k(firmware),64k(art)
 
dlrtdev_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,6208k(firmware),64k(caldata)ro,640k(certs),960k(unknown)ro,64k@0x7f0000(caldata_copy)
@@ -1028,6 +1029,7 @@ $(eval $(call 
SingleProfile,AthLzma,64k,BXU2000N2,bxu2000n-2-a1,BXU2000n-2-A1,tt
 $(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))
+$(eval $(call 
SingleProfile,AthLzma,64k,ESR1750,esr1750,ESR1750,ttyS0,115200,$$(esr1750_mtdlayout),KRuImage))
 $(eval $(call 
SingleProfile,AthLzma,64k,EWDORINAP,ew-dorin,EW-DORIN,ttyATH0,115200,$$(ew-dorin_mtdlayout_4M),KRuImage,65536))
 $(eval $(call 
SingleProfile,AthLzma,64k,EWDORINRT,ew-dorin-router,EW-DORIN-ROUTER,ttyATH0,115200,$$(ew-dorin_mtdlayout_4M),KRuImage,65536))
 $(eval $(call 
SingleProfile,AthLzma,64k,EWDORIN16M,ew-dorin-16M,EW-DORIN,ttyATH0,115200,$$(ew-dorin_mtdlayout_16M),KRuImage,65536))
diff --git 
a/target/linux/ar71xx/patches-3.10/713-MIPS-ath79-add-ESR1750-support.patch 
b/target/linux/ar71xx/patches-3.10/713-MIPS-ath79-add-ESR1750-support.patch
new file mode 100644
index 0000000..9289344
--- /dev/null
+++ b/target/linux/ar71xx/patches-3.10/713-MIPS-ath79-add-ESR1750-support.patch
@@ -0,0 +1,45 @@
+Index: linux-3.10.44/arch/mips/ath79/Kconfig
+===================================================================
+--- linux-3.10.44.orig/arch/mips/ath79/Kconfig
++++ linux-3.10.44/arch/mips/ath79/Kconfig
+@@ -177,6 +177,16 @@ config ATH79_MACH_AW_NR580
+       select ATH79_DEV_LEDS_GPIO
+       select ATH79_DEV_M25P80
+ 
++config ATH79_MACH_ESR1750
++      bool "EnGenius ESR1750 board support"
++      select SOC_QCA955X
++      select ATH79_DEV_ETH
++      select ATH79_DEV_GPIO_BUTTONS
++      select ATH79_DEV_LEDS_GPIO
++      select ATH79_DEV_SPI
++      select ATH79_DEV_USB
++      select ATH79_DEV_WMAC
++
+ config ATH79_MACH_WHR_HP_G300N
+       bool "Buffalo WHR-HP-G300N board support"
+       select SOC_AR724X
+Index: linux-3.10.44/arch/mips/ath79/Makefile
+===================================================================
+--- linux-3.10.44.orig/arch/mips/ath79/Makefile
++++ linux-3.10.44/arch/mips/ath79/Makefile
+@@ -64,6 +64,7 @@ obj-$(CONFIG_ATH79_MACH_EW_DORIN)    += mac
+ obj-$(CONFIG_ATH79_MACH_EAP7660D)     += mach-eap7660d.o
+ obj-$(CONFIG_ATH79_MACH_EL_M150)      += mach-el-m150.o
+ obj-$(CONFIG_ATH79_MACH_EL_MINI)      += mach-el-mini.o
++obj-$(CONFIG_ATH79_MACH_ESR1750)      += mach-esr1750.o
+ obj-$(CONFIG_ATH79_MACH_GS_OOLITE)    += mach-gs-oolite.o
+ obj-$(CONFIG_ATH79_MACH_HIWIFI_HC6361)        += mach-hiwifi-hc6361.o
+ obj-$(CONFIG_ATH79_MACH_JA76PF)               += mach-ja76pf.o
+Index: linux-3.10.44/arch/mips/ath79/machtypes.h
+===================================================================
+--- linux-3.10.44.orig/arch/mips/ath79/machtypes.h
++++ linux-3.10.44/arch/mips/ath79/machtypes.h
+@@ -52,6 +52,7 @@ enum ath79_mach_type {
+       ATH79_MACH_EAP7660D,            /* Senao EAP7660D */
+       ATH79_MACH_EL_M150,             /* EasyLink EL-M150 */
+       ATH79_MACH_EL_MINI,             /* EasyLink EL-MINI */
++      ATH79_MACH_ESR1750,             /* EnGenius ESR1750 */
+       ATH79_MACH_GS_OOLITE,           /* GS OOLITE V1.0 */
+       ATH79_MACH_HIWIFI_HC6361,       /* HiWiFi HC6361 */
+       ATH79_MACH_JA76PF,              /* jjPlus JA76PF */
-- 
2.0.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to