ar71xx: add ew-balin platform from Embedded Wireless
authorCatrinel Catrinescu <cc@80211.de>
Mon, 15 Jan 2018 15:45:16 +0000 (16:45 +0100)
committerFelix Fietkau <nbd@nbd.name>
Thu, 25 Jan 2018 15:50:08 +0000 (16:50 +0100)
Add the Embedded Wireless "Balin" platform
 SoC: QCA AR9344 or AR9350
 RAM: DDR2-RAM 64MBytes
 Flash: SPI-NOR 16MBytes
 WLAN: 2 x 2 MIMO 2.4 & 5 GHz IEEE802.11 a/b/g/n
 Ethernet: 3 x 10/100 Mb/s
 USB: 1 x USB2.0 Host/Device bootstrap-pin at power-up
 PCI-Express: 1 x lane PCIe 1.2
 UART: 1 x Normal, 1 x High-Speed
 JTAG: 1 x EJTAG
 GPIO: 10 x Input/Output multiplexed

The module comes already with the current vanilla OpenWrt firmware.
To update, use "sysupgrade" image directly in vendor firmware.

Signed-off-by: Catrinel Catrinescu <cc@80211.de>
12 files changed:
target/linux/ar71xx/base-files/etc/board.d/02_network
target/linux/ar71xx/base-files/etc/diag.sh
target/linux/ar71xx/base-files/lib/ar71xx.sh
target/linux/ar71xx/base-files/lib/upgrade/platform.sh
target/linux/ar71xx/config-4.4
target/linux/ar71xx/config-4.9
target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
target/linux/ar71xx/files/arch/mips/ath79/Makefile
target/linux/ar71xx/files/arch/mips/ath79/mach-ew-balin.c [new file with mode: 0644]
target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
target/linux/ar71xx/generic/config-default
target/linux/ar71xx/image/generic.mk

index b0755c44dd815abf216fe1f30e10c334f791803e..02eb94691c637b2a561df05ffb86519410de5621 100755 (executable)
@@ -372,6 +372,12 @@ ar71xx_setup_interfaces()
                ucidef_add_switch "switch0" \
                        "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
                ;;
+       ew-balin)
+# usb0 is RNDIS interface over USB in device mode
+               ucidef_set_interface_raw "usb2" "usb0" "static"
+               ucidef_add_switch "switch0" \
+                       "0@eth0" "5:lan:4" "4:lan:5" "3:wan"
+               ;;
        ew-dorin)
                ucidef_add_switch "switch0" \
                        "0@eth0" "1:lan" "2:lan" "3:wan"
index 4f4a73ce067ecbad5a3185ce4ab311e41dad27f8..600ff551b20ba03312e0e386922385c4a4c22e7e 100644 (file)
@@ -199,6 +199,9 @@ get_status_led() {
        el-mini)
                status_led="easylink:green:system"
                ;;
+       ew-balin)
+               status_led="balin:green:status"
+               ;;
        ew-dorin|\
        ew-dorin-router)
                status_led="dorin:green:status"
index 73bdce58531072a4962498f8d150d39947ebf2d8..2a793723d9a9cc1796fd1819bd57b83061888d6b 100755 (executable)
@@ -643,6 +643,9 @@ ar71xx_board_detect() {
        *"EL-MINI")
                name="el-mini"
                ;;
+       *"EmbWir-Balin")
+               name="ew-balin"
+               ;;
        *"EmbWir-Dorin")
                name="ew-dorin"
                ;;
index 1f9ed76fc320776ce03a5a1dce71cb95d5030b97..28f04e53d7d9c711e8b29876ca0dc41f3b929400 100755 (executable)
@@ -237,6 +237,7 @@ platform_check_image() {
        epg5000|\
        esr1750|\
        esr900|\
+       ew-balin|\
        ew-dorin|\
        ew-dorin-router|\
        gl-ar150|\
index 8ecf7e1355c4828b7c38bf3f2f01508bf9077c0b..4a8024b9a56b9c8d00c9d827ebf0a4ed4bbde500 100644 (file)
@@ -108,6 +108,7 @@ CONFIG_ATH79=y
 # CONFIG_ATH79_MACH_EPG5000 is not set
 # CONFIG_ATH79_MACH_ESR1750 is not set
 # CONFIG_ATH79_MACH_ESR900 is not set
+# CONFIG_ATH79_MACH_EW_BALIN is not set
 # CONFIG_ATH79_MACH_EW_DORIN is not set
 # CONFIG_ATH79_MACH_F9K1115V2 is not set
 # CONFIG_ATH79_MACH_FRITZ300E is not set
index 0e224ae1c443d9ebba428da4dc3d9bda3d2fd8ee..19f3541de817d59c177a8b46acfefd282c3c79c9 100644 (file)
@@ -106,6 +106,7 @@ CONFIG_ATH79=y
 # CONFIG_ATH79_MACH_EPG5000 is not set
 # CONFIG_ATH79_MACH_ESR1750 is not set
 # CONFIG_ATH79_MACH_ESR900 is not set
+# CONFIG_ATH79_MACH_EW_BALIN is not set
 # CONFIG_ATH79_MACH_EW_DORIN is not set
 # CONFIG_ATH79_MACH_F9K1115V2 is not set
 # CONFIG_ATH79_MACH_FRITZ300E is not set
index caaaf977925052caad39839924d5c95af980266e..ce54f1d4bb975ee172961c7fb7cdcae2fe2aadfa 100644 (file)
@@ -711,6 +711,17 @@ config ATH79_MACH_ESR900
        select ATH79_DEV_WMAC
        select ATH79_NVRAM
 
+config ATH79_MACH_EW_BALIN
+       bool "embedded wireless Balin Platform support"
+       select SOC_AR934X
+       select ATH79_DEV_M25P80
+       select ATH79_DEV_GPIO_BUTTONS
+       select ATH79_DEV_LEDS_GPIO
+       select ATH79_DEV_WMAC
+       select ATH79_DEV_ETH
+       select ATH79_DEV_USB
+       select ATH79_DEV_AP9X_PCI if PCI
+
 config ATH79_MACH_EW_DORIN
        bool "embedded wireless Dorin Platform support"
        select SOC_AR933X
index e9f4d9852b838a422b42556eec9d374c7dd4f56d..d09762da407650625dcb0df92c6e1d9a88181821 100644 (file)
@@ -116,6 +116,7 @@ obj-$(CONFIG_ATH79_MACH_ENS202EXT)          += mach-ens202ext.o
 obj-$(CONFIG_ATH79_MACH_EPG5000)               += mach-epg5000.o
 obj-$(CONFIG_ATH79_MACH_ESR1750)               += mach-esr1750.o
 obj-$(CONFIG_ATH79_MACH_ESR900)                        += mach-esr900.o
+obj-$(CONFIG_ATH79_MACH_EW_BALIN)              += mach-ew-balin.o
 obj-$(CONFIG_ATH79_MACH_EW_DORIN)              += mach-ew-dorin.o
 obj-$(CONFIG_ATH79_MACH_F9K1115V2)             += mach-f9k1115v2.o
 obj-$(CONFIG_ATH79_MACH_FRITZ300E)             += mach-fritz300e.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ew-balin.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ew-balin.c
new file mode 100644 (file)
index 0000000..2e82ffd
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * EW Balin board support
+ * (based on Atheros DB120 reference board support)
+ *
+ * Copyright (c) 2011 Qualcomm Atheros
+ * Copyright (c) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (C) 2017 Embedded Wireless GmbH    www.80211.de
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include <linux/pci.h>
+#include <linux/phy.h>
+#include <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+#include <linux/ar8216_platform.h>
+
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include "common.h"
+#include "dev-ap9x-pci.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-spi.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+#include "pci.h"
+
+#define BALIN_GPIO_LED_STATUS  14
+
+#define BALIN_GPIO_BTN_WPS             18
+
+#define BALIN_KEYS_POLL_INTERVAL       20      /* msecs */
+#define BALIN_KEYS_DEBOUNCE_INTERVAL   (3 * BALIN_KEYS_POLL_INTERVAL)
+
+#define BALIN_CALDATA_OFFSET           0x1000
+#define BALIN_WMAC_MAC_OFFSET          (BALIN_CALDATA_OFFSET + 0x02)
+
+static struct gpio_led balin_leds_gpio[] __initdata = {
+       {
+               .name           = "balin:green:status",
+               .gpio           = BALIN_GPIO_LED_STATUS,
+               .active_low     = 1,
+       },
+};
+
+static struct gpio_keys_button balin_gpio_keys[] __initdata = {
+       {
+               .desc           = "WPS button",
+               .type           = EV_KEY,
+               .code           = KEY_WPS_BUTTON,
+               .debounce_interval = BALIN_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = BALIN_GPIO_BTN_WPS,
+               .active_low     = 0,
+       },
+};
+
+
+static void __init balin_setup(void)
+{
+       u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+       static u8 mac[6];
+
+       ath79_register_m25p80(NULL);
+
+       ath79_register_leds_gpio(-1, ARRAY_SIZE(balin_leds_gpio),
+                                balin_leds_gpio);
+
+       ath79_register_gpio_keys_polled(-1, BALIN_KEYS_POLL_INTERVAL,
+                                       ARRAY_SIZE(balin_gpio_keys),
+                                       balin_gpio_keys);
+
+       ath79_register_usb();
+
+       ath79_register_wmac(art + BALIN_CALDATA_OFFSET, NULL);
+
+       ath79_register_pci();
+
+       ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 |
+                                  AR934X_ETH_CFG_SW_ONLY_MODE);
+
+       ath79_register_mdio(1, 0x0);
+
+       /* GMAC1 is connected to the internal switch */
+       memcpy(mac, art + BALIN_WMAC_MAC_OFFSET, sizeof(mac));
+       mac[3] |= 0x40;
+       ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
+       ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+       ath79_eth1_data.speed = SPEED_1000;
+       ath79_eth1_data.duplex = DUPLEX_FULL;
+
+       ath79_register_eth(1);
+}
+
+MIPS_MACHINE(ATH79_MACH_EW_BALIN, "EW-BALIN", "EmbWir-Balin",
+            balin_setup);
index 394be00c995ab4e5e044002188d3ae04aa2a63bf..4093c8b76d982c0287285c438168a9839c42a1d9 100644 (file)
@@ -107,6 +107,7 @@ enum ath79_mach_type {
        ATH79_MACH_EPG5000,                     /* EnGenius EPG5000 */
        ATH79_MACH_ESR1750,                     /* EnGenius ESR1750 */
        ATH79_MACH_ESR900,                      /* EnGenius ESR900 */
+       ATH79_MACH_EW_BALIN,                    /* embedded wireless Balin Platform */
        ATH79_MACH_EW_DORIN,                    /* embedded wireless Dorin Platform */
        ATH79_MACH_EW_DORIN_ROUTER,             /* embedded wireless Dorin Router Platform */
        ATH79_MACH_F9K1115V2,                   /* Belkin AC1750DB */
index cac1a27c3b28d02c093e6ca0e42b41b525433327..a212617591907aaa34136821ba69c6b6f9db7ad9 100644 (file)
@@ -79,6 +79,7 @@ CONFIG_ATH79_MACH_ENS202EXT=y
 CONFIG_ATH79_MACH_EPG5000=y
 CONFIG_ATH79_MACH_ESR1750=y
 CONFIG_ATH79_MACH_ESR900=y
+CONFIG_ATH79_MACH_EW_BALIN=y
 CONFIG_ATH79_MACH_EW_DORIN=y
 CONFIG_ATH79_MACH_F9K1115V2=y
 CONFIG_ATH79_MACH_FRITZ300E=y
index 88b9f930b6789dcf7ee5fb91bc82e9b8c0a6957e..b2e701c844a201307f9d803fb8abf35d5dcb267f 100644 (file)
@@ -272,6 +272,15 @@ define Device/dragino2
 endef
 TARGET_DEVICES += dragino2
 
+define Device/ew-balin
+  DEVICE_TITLE := Embedded Wireless Balin Platform
+  DEVICE_PACKAGES := kmod-usb-core kmod-usb-chipidea 
+  BOARDNAME = EW-BALIN
+  IMAGE_SIZE = 16000k
+  MTDPARTS = spi0.0:256k(u-boot)ro,64k(u-boot-env),16000k(firmware),64k(art)ro
+endef
+TARGET_DEVICES += ew-balin
+
 define Device/ew-dorin
   DEVICE_TITLE := Embedded Wireless Dorin Platform
   DEVICE_PACKAGES := kmod-usb-core kmod-usb-chipidea