ar71xx: add support for the devolo dLAN pro 1200+ WiFi ac
authorJohn Crispin <john@openwrt.org>
Tue, 14 Jul 2015 07:37:03 +0000 (07:37 +0000)
committerJohn Crispin <john@openwrt.org>
Tue, 14 Jul 2015 07:37:03 +0000 (07:37 +0000)
Signed-off-by: G√ľnther Kelleter <guenther.kelleter@devolo.de>
SVN-Revision: 46342

target/linux/ar71xx/base-files/etc/diag.sh
target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
target/linux/ar71xx/base-files/etc/uci-defaults/02_network
target/linux/ar71xx/base-files/lib/ar71xx.sh
target/linux/ar71xx/base-files/lib/upgrade/platform.sh
target/linux/ar71xx/config-3.18
target/linux/ar71xx/files/arch/mips/ath79/mach-dlan-pro-1200-ac.c [new file with mode: 0644]
target/linux/ar71xx/generic/profiles/devolo-dlan.mk
target/linux/ar71xx/image/Makefile
target/linux/ar71xx/patches-3.18/610-MIPS-ath79-openwrt-machines.patch

index cb5d963..f3bd142 100644 (file)
@@ -78,6 +78,9 @@ get_status_led() {
        dlan-pro-500-wp)
                status_led="devolo:green:wlan-2g"
                ;;
+       dlan-pro-1200-ac)
+               status_led="devolo:status:wlan"
+               ;;
        dragino2)
                status_led="dragino2:red:system"
                ;;
index 50f7425..fbbfbd7 100644 (file)
@@ -47,6 +47,9 @@ board=$(ar71xx_board_name)
 case "$FIRMWARE" in
 "ath10k/cal-pci-0000:00:00.0.bin")
        case $board in
+       dlan-pro-1200-ac)
+               ath10kcal_extract "art" 20480 2116
+               ;;
        mc-mac1200r)
                ath10kcal_extract "art" 20480 2116
                ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -1)
index cf5c735..d6f7d1a 100644 (file)
@@ -180,6 +180,12 @@ dlan-pro-500-wp)
        ucidef_set_led_wlan "wlan5g" "WLAN 5 GHz" "devolo:blue:wlan-5g" "none"
        ;;
 
+dlan-pro-1200-ac)
+       ucidef_set_led_wlan "wlan" "WLAN" "devolo:status:wlan" "phy0radio"
+       ucidef_set_led_trigger_gpio "plcw" "dLAN" "devolo:status:dlan" "17" "0"
+       ucidef_set_led_trigger_gpio "plcr" "dLAN" "devolo:error:dlan" "16" "0"
+       ;;
+
 gl-inet)
        ucidef_set_led_netdev "lan" "LAN" "gl-connect:green:lan" "eth1"
        ucidef_set_led_wlan "wlan" "WLAN" "gl-connect:red:wlan" "phy0tpt"
index 615dbc4..9a0d0a3 100755 (executable)
@@ -305,6 +305,12 @@ dlan-pro-500-wp)
        ucidef_set_interface_lan "eth0 eth1"
        ;;
 
+dlan-pro-1200-ac)
+       ucidef_set_interface_lan "eth0"
+       ucidef_add_switch "switch0" "1" "0"
+       ucidef_add_switch_vlan "switch0" "0" "0 2 3 4"
+       ;;
+
 all0305 |\
 aw-nr580 |\
 bullet-m |\
index f323ec3..9d3d2cb 100755 (executable)
@@ -426,6 +426,9 @@ ar71xx_board_detect() {
        *"dLAN pro 500 Wireless+")
                name="dlan-pro-500-wp"
                ;;
+       *"dLAN pro 1200+ WiFi ac")
+               name="dlan-pro-1200-ac"
+               ;;
        *"Dragino v2")
                name="dragino2"
                ;;
index 8b27b6d..41e344c 100755 (executable)
@@ -209,6 +209,7 @@ platform_check_image() {
        dir-825-c1 | \
        dir-835-a1 | \
        dlan-pro-500-wp | \
+       dlan-pro-1200-ac | \
        dragino2 | \
        epg5000 | \
        esr1750 | \
index 353c10a..0de176e 100644 (file)
@@ -56,6 +56,7 @@ CONFIG_ATH79_MACH_DIR_615_C1=y
 CONFIG_ATH79_MACH_DIR_615_I1=y
 CONFIG_ATH79_MACH_DIR_825_B1=y
 CONFIG_ATH79_MACH_DIR_825_C1=y
+CONFIG_ATH79_MACH_DLAN_PRO_1200_AC=y
 CONFIG_ATH79_MACH_DLAN_PRO_500_WP=y
 CONFIG_ATH79_MACH_DRAGINO2=y
 CONFIG_ATH79_MACH_EAP300V2=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-dlan-pro-1200-ac.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dlan-pro-1200-ac.c
new file mode 100644 (file)
index 0000000..03b9f19
--- /dev/null
@@ -0,0 +1,189 @@
+/*
+ * devolo dLAN pro 500 Wireless+ support
+ *
+ * Copyright (c) 2013-2015 devolo AG
+ * Copyright (c) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * 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 <linux/gpio.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-nfc.h"
+#include "dev-spi.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+
+#define DLAN_PRO_1200_AC_GPIO_DLAN_POWER_ENABLE                13
+#define DLAN_PRO_1200_AC_GPIO_WLAN_POWER_ENABLE                21
+#define DLAN_PRO_1200_AC_GPIO_LED_WLAN         12
+#define DLAN_PRO_1200_AC_GPIO_LED_DLAN                 14
+#define DLAN_PRO_1200_AC_GPIO_LED_DLAN_ERR                     15
+
+#define DLAN_PRO_1200_AC_GPIO_BTN_WLAN                 20
+#define DLAN_PRO_1200_AC_GPIO_BTN_DLAN                 22
+#define DLAN_PRO_1200_AC_GPIO_BTN_RESET                        4
+#define DLAN_PRO_1200_AC_GPIO_DLAN_IND          17
+#define DLAN_PRO_1200_AC_GPIO_DLAN_ERR_IND      16
+
+#define DLAN_PRO_1200_AC_KEYS_POLL_INTERVAL            20      /* msecs */
+#define DLAN_PRO_1200_AC_KEYS_DEBOUNCE_INTERVAL                (3 * DLAN_PRO_1200_AC_KEYS_POLL_INTERVAL)
+
+#define DLAN_PRO_1200_AC_ART_ADDRESS                   0x1fff0000
+#define DLAN_PRO_1200_AC_CALDATA_OFFSET                        0x1000
+#define DLAN_PRO_1200_AC_WIFIMAC_OFFSET                        0x1002
+#define DLAN_PRO_1200_AC_PCIE_CALDATA_OFFSET   0x5000
+
+static struct gpio_led dlan_pro_1200_ac_leds_gpio[] __initdata = {
+       {
+               .name                   = "devolo:status:wlan",
+               .gpio                   = DLAN_PRO_1200_AC_GPIO_LED_WLAN,
+               .active_low             = 1,
+       },
+       {
+               .name                   = "devolo:status:dlan",
+               .gpio                   = DLAN_PRO_1200_AC_GPIO_LED_DLAN,
+               .active_low             = 1,
+       },
+       {
+               .name                   = "devolo:error:dlan",
+               .gpio                   = DLAN_PRO_1200_AC_GPIO_LED_DLAN_ERR,
+               .active_low             = 0,
+       }
+};
+
+static struct gpio_keys_button dlan_pro_1200_ac_gpio_keys[] __initdata = {
+       {
+               .desc           = "dLAN button",
+               .type           = EV_KEY,
+               .code           = BTN_0,
+               .debounce_interval = DLAN_PRO_1200_AC_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = DLAN_PRO_1200_AC_GPIO_BTN_DLAN,
+               .active_low     = 1,
+       },
+       {
+               .desc           = "WLAN button",
+               .type           = EV_KEY,
+               .code           = KEY_WPS_BUTTON,
+               .debounce_interval = DLAN_PRO_1200_AC_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = DLAN_PRO_1200_AC_GPIO_BTN_WLAN,
+               .active_low     = 0,
+       },
+       {
+               .desc           = "Reset button",
+               .type           = EV_KEY,
+               .code           = KEY_RESTART,
+               .debounce_interval = DLAN_PRO_1200_AC_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = DLAN_PRO_1200_AC_GPIO_BTN_RESET,
+               .active_low     = 1,
+       }
+};
+
+static struct ar8327_pad_cfg dlan_pro_1200_ac_ar8327_pad0_cfg = {
+       .mode = AR8327_PAD_MAC_RGMII,
+       .txclk_delay_en = true,
+       .rxclk_delay_en = false,
+       .txclk_delay_sel = AR8327_CLK_DELAY_SEL1,
+       .rxclk_delay_sel = AR8327_CLK_DELAY_SEL0,
+};
+
+static struct ar8327_pad_cfg dlan_pro_1200_ac_ar8327_pad5_cfg = {
+       .mode = 0,
+       .txclk_delay_en = 0,
+       .rxclk_delay_en = 0,
+       .txclk_delay_sel = 0,
+       .rxclk_delay_sel = 0,
+};
+
+static struct ar8327_platform_data dlan_pro_1200_ac_ar8327_data = {
+       .pad0_cfg = &dlan_pro_1200_ac_ar8327_pad0_cfg,
+       .pad5_cfg = &dlan_pro_1200_ac_ar8327_pad5_cfg,
+       .port0_cfg = {
+               .force_link = 1,
+               .speed = AR8327_PORT_SPEED_1000,
+               .duplex = 1,
+               .txpause = 1,
+               .rxpause = 1,
+       },
+};
+
+static struct mdio_board_info dlan_pro_1200_ac_mdio0_info[] = {
+       {
+               .bus_id = "ag71xx-mdio.0",
+               .phy_addr = 0,
+               .platform_data = &dlan_pro_1200_ac_ar8327_data,
+       },
+};
+
+static void __init dlan_pro_1200_ac_setup(void)
+{
+       u8 *art = (u8 *) KSEG1ADDR(DLAN_PRO_1200_AC_ART_ADDRESS);
+       u8 *cal = art + DLAN_PRO_1200_AC_CALDATA_OFFSET;
+       u8 *wifi_mac = art + DLAN_PRO_1200_AC_WIFIMAC_OFFSET;
+
+       ath79_register_m25p80(NULL);
+
+       ath79_register_leds_gpio(-1, ARRAY_SIZE(dlan_pro_1200_ac_leds_gpio),
+                                dlan_pro_1200_ac_leds_gpio);
+
+       ath79_register_gpio_keys_polled(-1, DLAN_PRO_1200_AC_KEYS_POLL_INTERVAL,
+                                       ARRAY_SIZE(dlan_pro_1200_ac_gpio_keys),
+                                       dlan_pro_1200_ac_gpio_keys);
+
+       /* dLAN power must be enabled from user-space as soon as the boot-from-host daemon is running */
+       gpio_request_one(DLAN_PRO_1200_AC_GPIO_DLAN_POWER_ENABLE,
+                        GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED,
+                        "dLAN power");
+
+       /* WLAN power is turned on initially to allow the PCI bus scan to succeed */
+       gpio_request_one(DLAN_PRO_1200_AC_GPIO_WLAN_POWER_ENABLE,
+                        GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+                        "WLAN power");
+
+       ath79_register_wmac(cal, wifi_mac);
+       ap91_pci_init(art + DLAN_PRO_1200_AC_PCIE_CALDATA_OFFSET, NULL);
+
+       ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | AR934X_ETH_CFG_SW_ONLY_MODE);
+
+       ath79_register_mdio(1, 0x0);
+       ath79_register_mdio(0, 0x0);
+
+       ath79_init_mac(ath79_eth0_data.mac_addr, wifi_mac, 2);
+
+       mdiobus_register_board_info(dlan_pro_1200_ac_mdio0_info,
+                                   ARRAY_SIZE(dlan_pro_1200_ac_mdio0_info));
+
+       /* GMAC0 is connected to an AR8337 */
+       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_eth0_pll_data.pll_1000 = 0x02000000;
+       ath79_register_eth(0);
+}
+
+MIPS_MACHINE(ATH79_MACH_DLAN_PRO_1200_AC, "dLAN-pro-1200-ac", "devolo dLAN pro 1200+ WiFi ac",
+            dlan_pro_1200_ac_setup);
index 281c04c..741f5d5 100644 (file)
@@ -17,3 +17,17 @@ define Profile/dLAN_pro_500_wp/Description
        Package set optimized for the devolo dLAN pro 500 Wireless+.
 endef
 $(eval $(call Profile,dLAN_pro_500_wp))
+
+define Profile/dLAN_pro_1200_ac
+       NAME:=devolo dLAN pro 1200+ WiFi ac
+       PACKAGES:=open-plc-utils open-plc-utils-chkpib open-plc-utils-getpib open-plc-utils-modpib \
+               open-plc-utils-setpib open-plc-utils-hpavkey open-plc-utils-plchost \
+               open-plc-utils-plctool open-plc-utils-pibdump open-plc-utils-plcstat \
+               ebtables hostapd-utils wifitoggle wpad ip-full kmod-ath10k kmod-leds-gpio \
+               kmod-ledtrig-gpio
+endef
+
+define Profile/dLAN_pro_1200_ac/Description
+       Package set optimized for the devolo dLAN pro 1200+ WiFi ac.
+endef
+$(eval $(call Profile,dLAN_pro_1200_ac))
index 81e100f..5d16c06 100644 (file)
@@ -1186,6 +1186,7 @@ eap300v2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),320k(custom),1
 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)
 dgl_5500_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,15296k(firmware),192k(lang)ro,512k(my-dlink)ro,64k(mac)ro,64k(art)ro
 dlan_pro_500_wp_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(Config1)ro,64k(Config2)ro,1152k@0x70000(kernel),6528k(rootfs),7680k@0x70000(firmware),64k(art)ro
+dlan_pro_1200_ac_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(Config1)ro,64k(Config2)ro,1152k@0x70000(kernel),14720k(rootfs),15872k@0x70000(firmware),64k(art)ro
 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)
 esr900_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)
@@ -2081,6 +2082,7 @@ $(eval $(call SingleProfile,CameoAP94,64kraw,TEW673GRU,tew-673gru,TEW-673GRU,tty
 $(eval $(call SingleProfile,CameoAP94,64kraw,DLRTDEV01,dlrtdev01,DIR-825-B1,ttyS0,115200,$$(dlrtdev_mtdlayout),$$(dlrtdev_mtdlayout_fat),01AP94-AR7161-RT-080619-00,00AP94-AR7161-RT-080619-00))
 
 $(eval $(call SingleProfile,dLANLzma,64k,dLAN_pro_500_wp,dlan-pro-500-wp,dLAN-pro-500-wp,ttyS0,115200,$$(dlan_pro_500_wp_mtdlayout) root=31:5 mem=128M,KRuImage))
+$(eval $(call SingleProfile,dLANLzma,64k,dLAN_pro_1200_ac,dlan-pro-1200-ac,dLAN-pro-1200-ac,ttyS0,115200,$$(dlan_pro_1200_ac_mtdlayout) root=31:5 mem=128M,KRuImage))
 
 $(eval $(call SingleProfile,EnGenius,64k,ESR900,esr900,ESR900,ttyS0,115200,$$(esr900_mtdlayout),KRuImage,,0x4e))
 $(eval $(call SingleProfile,EnGenius,64k,ESR1750,esr1750,ESR1750,ttyS0,115200,$$(esr1750_mtdlayout),KRuImage,,0x61))
index 01d7224..2056508 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/ath79/machtypes.h
 +++ b/arch/mips/ath79/machtypes.h
-@@ -16,22 +16,194 @@
+@@ -16,22 +16,195 @@
  
  enum ath79_mach_type {
        ATH79_MACH_GENERIC = 0,
@@ -40,6 +40,7 @@
 +      ATH79_MACH_DIR_825_C1,          /* D-Link DIR-825 rev. C1 */
 +      ATH79_MACH_DIR_835_A1,          /* D-Link DIR-835 rev. A1 */
 +      ATH79_MACH_DLAN_PRO_500_WP,     /* devolo dLAN pro 500 Wireless+ */
++      ATH79_MACH_DLAN_PRO_1200_AC,    /* devolo dLAN pro 1200+ WiFi ac*/
 +      ATH79_MACH_DRAGINO2,            /* Dragino Version 2 */
 +      ATH79_MACH_ESR900,              /* EnGenius ESR900 */
 +      ATH79_MACH_EW_DORIN,            /* embedded wireless Dorin Platform */
  config ATH79_MACH_AP121
        bool "Atheros AP121 reference board"
        select SOC_AR933X
-@@ -11,62 +75,1018 @@ config ATH79_MACH_AP121
+@@ -11,62 +75,1031 @@ config ATH79_MACH_AP121
        select ATH79_DEV_M25P80
        select ATH79_DEV_USB
        select ATH79_DEV_WMAC
 +      select ATH79_DEV_WMAC
 +      select ATH79_DEV_USB
 +
++config ATH79_MACH_DLAN_PRO_1200_AC
++      bool "devolo dLAN pro 1200+ WiFi ac support"
++      select SOC_AR934X
++      select ATH79_DEV_AP9X_PCI if PCI
++      select ATH79_DEV_ETH
++      select ATH79_DEV_GPIO_BUTTONS
++      select ATH79_DEV_LEDS_GPIO
++      select ATH79_DEV_SPI
++      select ATH79_DEV_M25P80
++      select ATH79_DEV_WMAC
++      select ATH79_DEV_NFC
++      select ATH79_DEV_USB
++
 +config ATH79_MACH_DRAGINO2
 +      bool "DRAGINO V2 support"
 +      select SOC_AR933X
  
  config ATH79_MACH_UBNT_XM
        bool "Ubiquiti Networks XM/UniFi boards"
-@@ -83,6 +1103,97 @@ config ATH79_MACH_UBNT_XM
+@@ -83,6 +1116,97 @@ config ATH79_MACH_UBNT_XM
          Say 'Y' here if you want your kernel to support the
          Ubiquiti Networks XM (rev 1.0) board.
  
  endmenu
  
  config SOC_AR71XX
-@@ -124,7 +1235,10 @@ config ATH79_DEV_DSA
+@@ -124,7 +1248,10 @@ config ATH79_DEV_DSA
  config ATH79_DEV_ETH
        def_bool n
  
        def_bool n
  
  config ATH79_DEV_GPIO_BUTTONS
-@@ -154,6 +1268,11 @@ config ATH79_PCI_ATH9K_FIXUP
+@@ -154,6 +1281,11 @@ config ATH79_PCI_ATH9K_FIXUP
        def_bool n
  
  config ATH79_ROUTERBOOT
  endif
 --- a/arch/mips/ath79/Makefile
 +++ b/arch/mips/ath79/Makefile
-@@ -38,9 +38,123 @@ obj-$(CONFIG_ATH79_ROUTERBOOT)             += route
+@@ -38,9 +38,124 @@ obj-$(CONFIG_ATH79_ROUTERBOOT)             += route
  #
  # Machines
  #
 +obj-$(CONFIG_ATH79_MACH_CPE510)               += mach-cpe510.o
  obj-$(CONFIG_ATH79_MACH_DB120)                += mach-db120.o
 +obj-$(CONFIG_ATH79_MACH_DLAN_PRO_500_WP)      += mach-dlan-pro-500-wp.o
++obj-$(CONFIG_ATH79_MACH_DLAN_PRO_1200_AC)     += mach-dlan-pro-1200-ac.o
 +obj-$(CONFIG_ATH79_MACH_DGL_5500_A1)  += mach-dgl-5500-a1.o
 +obj-$(CONFIG_ATH79_MACH_DHP_1565_A1)  += mach-dhp-1565-a1.o
 +obj-$(CONFIG_ATH79_MACH_DIR_505_A1)   += mach-dir-505-a1.o