ar71xx: add support for the devolo dLAN Hotspot
authorJohn Crispin <john@openwrt.org>
Sat, 21 Nov 2015 21:24:18 +0000 (21:24 +0000)
committerJohn Crispin <john@openwrt.org>
Sat, 21 Nov 2015 21:24:18 +0000 (21:24 +0000)
Signed-off-by: Günther Kelleter <guenther.kelleter@devolo.de>
SVN-Revision: 47554

target/linux/ar71xx/base-files/etc/board.d/01_leds
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.1
target/linux/ar71xx/files/arch/mips/ath79/mach-dlan-hotspot.c [new file with mode: 0644]
target/linux/ar71xx/generic/profiles/devolo-dlan.mk
target/linux/ar71xx/image/Makefile
target/linux/ar71xx/patches-4.1/700-MIPS-ath79-openwrt-machines.patch

index 952e7b88d5bad7fd2c77c435918b4b0ea7b9fd13..e5683c037782d39d97f58490e5163ebe2bbabdb4 100755 (executable)
@@ -200,6 +200,10 @@ dir-825-c1)
        ucidef_set_led_wlan "wlan2g" "WLAN 2.4 GHz" "d-link:blue:wlan2g" "phy0tpt"
        ;;
 
+dlan-hotspot)
+       ucidef_set_led_wlan "wlan" "WLAN" "devolo:green:wifi" "phy0tpt"
+       ;;
+
 dlan-pro-500-wp)
        ucidef_set_led_default "power" "System Power" "devolo:green:status" "1"
        ucidef_set_led_netdev "lan" "Ethernet Activity" "devolo:green:eth" "br-lan"
index fffe06b7a0fbfe9c7e015024dab0519e582243ca..64f2054b6217ec970b3e823d77a501d5c1279bea 100755 (executable)
@@ -329,6 +329,7 @@ esr900)
        [ -n "$mac" ] && ucidef_set_interface_macaddr "wan" "$mac"
        ;;
 
+dlan-hotspot |\
 dlan-pro-500-wp)
        ucidef_set_interface_lan "eth0 eth1"
        ;;
index 8eb35120549900614746f0f937dbe0ccde5f9244..a8e1721b7cf869302135229e195d5a1bfa61af28 100644 (file)
@@ -86,6 +86,9 @@ get_status_led() {
        dir-835-a1)
                status_led="d-link:amber:power"
                ;;
+       dlan-hotspot)
+               status_led="devolo:green:wifi"
+               ;;
        dlan-pro-500-wp)
                status_led="devolo:green:wlan-2g"
                ;;
index af2df8e06866b64a6d54c8b354e0d83f671fbd0e..5b3e76f993127eccac7cd1a6b90a88d76974f188 100755 (executable)
@@ -454,6 +454,9 @@ ar71xx_board_detect() {
        *"DIR-835 rev. A1")
                name="dir-835-a1"
                ;;
+       *"dLAN Hotspot")
+               name="dlan-hotspot"
+               ;;
        *"dLAN pro 500 Wireless+")
                name="dlan-pro-500-wp"
                ;;
index b97c076519d50ebe97e24becbcb996b33daffb84..5b154052634adbe1c6b1e7efe2fa3a7b49f50b60 100755 (executable)
@@ -211,6 +211,7 @@ platform_check_image() {
        dir-615-i1 | \
        dir-825-c1 | \
        dir-835-a1 | \
+       dlan-hotspot | \
        dlan-pro-500-wp | \
        dlan-pro-1200-ac | \
        dragino2 | \
index 08e252df449d221cbd7113748b36931616d116da..1d790b6b998db82756fba24b2f68c7dfb665c2f3 100644 (file)
@@ -63,6 +63,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_HOTSPOT=y
 CONFIG_ATH79_MACH_DLAN_PRO_1200_AC=y
 CONFIG_ATH79_MACH_DLAN_PRO_500_WP=y
 CONFIG_ATH79_MACH_DRAGINO2=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-dlan-hotspot.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dlan-hotspot.c
new file mode 100644 (file)
index 0000000..3ae4651
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ *  devolo dLAN Hotspot board support
+ *
+ *  Copyright (C) 2015 Torsten Schnuis <torsten.schnuis@gik.de>
+ *  Copyright (C) 2015 devolo AG
+ *
+ *  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 "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 DLAN_HOTSPOT_GPIO_LED_WIFI                0
+
+#define DLAN_HOTSPOT_GPIO_BTN_RESET              11
+#define DLAN_HOTSPOT_GPIO_BTN_PLC_PAIRING        12
+#define DLAN_HOTSPOT_GPIO_BTN_WIFI               21
+
+#define DLAN_HOTSPOT_GPIO_PLC_POWER              22
+#define DLAN_HOTSPOT_GPIO_PLC_RESET              20
+#define DLAN_HOTSPOT_GPIO_PLC_DISABLE_LEDS       18
+
+#define DLAN_HOTSPOT_KEYS_POLL_INTERVAL          20    /* msecs */
+#define DLAN_HOTSPOT_KEYS_DEBOUNCE_INTERVAL      (3 * DLAN_HOTSPOT_KEYS_POLL_INTERVAL)
+
+#define DLAN_HOTSPOT_ART_ADDRESS                 0x1fff0000
+#define DLAN_HOTSPOT_CALDATA_OFFSET              0x00001000
+#define DLAN_HOTSPOT_MAC_ADDRESS_OFFSET          0x00001002
+
+static struct gpio_led dlan_hotspot_leds_gpio[] __initdata = {
+       {
+               .name           = "devolo:green:wifi",
+               .gpio           = DLAN_HOTSPOT_GPIO_LED_WIFI,
+               .active_low     = 0,
+       }
+};
+
+static struct gpio_keys_button dlan_hotspot_gpio_keys[] __initdata = {
+       {
+               .desc           = "Reset button",
+               .type           = EV_KEY,
+               .code           = KEY_RESTART,
+               .debounce_interval = DLAN_HOTSPOT_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = DLAN_HOTSPOT_GPIO_BTN_RESET,
+               .active_low     = 0,
+       },
+       {
+               .desc           = "Pairing button",
+               .type           = EV_KEY,
+               .code           = BTN_0,
+               .debounce_interval = DLAN_HOTSPOT_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = DLAN_HOTSPOT_GPIO_BTN_PLC_PAIRING,
+               .active_low     = 0,
+       },
+       {
+               .desc           = "WLAN button",
+               .type           = EV_KEY,
+               .code           = KEY_WPS_BUTTON,
+               .debounce_interval = DLAN_HOTSPOT_KEYS_DEBOUNCE_INTERVAL,
+               .gpio           = DLAN_HOTSPOT_GPIO_BTN_WIFI,
+               .active_low     = 0,
+       }
+};
+
+static void __init dlan_hotspot_setup(void)
+{
+       u8 *art = (u8 *) KSEG1ADDR(DLAN_HOTSPOT_ART_ADDRESS);
+       u8 *cal = art + DLAN_HOTSPOT_CALDATA_OFFSET;
+       u8 *wifi_mac = art + DLAN_HOTSPOT_MAC_ADDRESS_OFFSET;
+
+       /* disable PHY_SWAP and PHY_ADDR_SWAP bits */
+       ath79_setup_ar933x_phy4_switch(false, false);
+
+       ath79_register_leds_gpio(-1, ARRAY_SIZE(dlan_hotspot_leds_gpio),
+                                dlan_hotspot_leds_gpio);
+
+       ath79_register_gpio_keys_polled(-1, DLAN_HOTSPOT_KEYS_POLL_INTERVAL,
+                                       ARRAY_SIZE(dlan_hotspot_gpio_keys),
+                                       dlan_hotspot_gpio_keys);
+
+       gpio_request_one(DLAN_HOTSPOT_GPIO_PLC_POWER,
+                        GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+                        "PLC power");
+       gpio_request_one(DLAN_HOTSPOT_GPIO_PLC_RESET,
+                        GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED,
+                        "PLC reset");
+       gpio_request_one(DLAN_HOTSPOT_GPIO_PLC_DISABLE_LEDS,
+                        GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED,
+                        "PLC LEDs");
+
+       ath79_register_usb();
+
+       ath79_register_m25p80(NULL);
+
+       ath79_init_mac(ath79_eth0_data.mac_addr, wifi_mac, 1);
+       ath79_init_mac(ath79_eth1_data.mac_addr, wifi_mac, 2);
+
+       ath79_register_mdio(0, 0x0);
+       ath79_register_eth(0);
+       ath79_register_eth(1);
+
+       ath79_register_wmac(cal, wifi_mac);
+}
+
+MIPS_MACHINE(ATH79_MACH_DLAN_HOTSPOT, "dLAN-Hotspot",
+            "dLAN Hotspot", dlan_hotspot_setup);
index 741f5d547b39e9f6e407fac85e52a222758627f8..44a6869f0ebb1c0c0033bd2ddab115b81da0a027 100644 (file)
@@ -5,6 +5,19 @@
 # See /LICENSE for more information.
 #
 
+define Profile/dLAN_Hotspot
+       NAME:=devolo dLAN Hotspot
+       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
+endef
+
+define Profile/dLAN_Hotspot/Description
+       Package set optimized for the devolo dLAN Hotspot.
+endef
+$(eval $(call Profile,dLAN_Hotspot))
+
 define Profile/dLAN_pro_500_wp
        NAME:=devolo dLAN pro 500 Wireless+
        PACKAGES:=open-plc-utils open-plc-utils-chkpib open-plc-utils-getpib open-plc-utils-modpib \
index 0484f0700c14b1991b6f467dce2b7237702f4223..d2091a9b72202dfd5e12543ddc879c779634a186 100644 (file)
@@ -1452,6 +1452,7 @@ cpe510_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(pation-table)ro,64k(product-
 eap300v2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),320k(custom),13632k(firmware),2048k(failsafe),64k(art)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)
 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_hotspot_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(Config1)ro,64k(Config2)ro,7872k@0x40000(firmware),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,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,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)
@@ -2292,6 +2293,7 @@ $(eval $(call SingleProfile,CameoAP94,64kraw,DIR825B1,dir-825-b1,DIR-825-B1,ttyS
 $(eval $(call SingleProfile,CameoAP94,64kraw,TEW673GRU,tew-673gru,TEW-673GRU,ttyS0,115200,$$(cameo_ap94_mtdlayout),$$(cameo_ap94_mtdlayout_fat),01AP94-AR7161-RT-080619-01,00AP94-AR7161-RT-080619-01))
 $(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_Hotspot,dlan-hotspot,dLAN-Hotspot,ttyATH0,115200,$$(dlan_hotspot_mtdlayout) mem=64M,KRuImage,65536))
 $(eval $(call SingleProfile,dLANLzma,64k,dLAN_pro_500_wp,dlan-pro-500-wp,dLAN-pro-500-wp,ttyS0,115200,$$(dlan_pro_500_wp_mtdlayout) mem=128M,KRuImage,64k))
 $(eval $(call SingleProfile,dLANLzma,64k,dLAN_pro_1200_ac,dlan-pro-1200-ac,dLAN-pro-1200-ac,ttyS0,115200,$$(dlan_pro_1200_ac_mtdlayout) mem=128M,KRuImage,64k))
 
index 66a339107639d5d35bf42cc50d43576122d3a596..ecba79fa65c619322eafd9a416ffa8201c8f70b6 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/ath79/machtypes.h
 +++ b/arch/mips/ath79/machtypes.h
-@@ -16,24 +16,212 @@
+@@ -16,24 +16,213 @@
  
  enum ath79_mach_type {
        ATH79_MACH_GENERIC = 0,
@@ -43,6 +43,7 @@
 +      ATH79_MACH_DIR_825_B1,          /* D-Link DIR-825 rev. B1 */
 +      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_HOTSPOT,        /* devolo dLAN Hotspot */
 +      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 */
  config ATH79_MACH_AP121
        bool "Atheros AP121 reference board"
        select SOC_AR933X
-@@ -11,62 +95,1116 @@ config ATH79_MACH_AP121
+@@ -11,62 +95,1125 @@ config ATH79_MACH_AP121
        select ATH79_DEV_M25P80
        select ATH79_DEV_USB
        select ATH79_DEV_WMAC
 +      select ATH79_DEV_USB
 +      select ATH79_DEV_WMAC
 +
++config ATH79_MACH_DLAN_HOTSPOT
++      bool "devolo dLAN Hotspot support"
++      select SOC_AR933X
++      select ATH79_DEV_ETH
++      select ATH79_DEV_GPIO_BUTTONS
++      select ATH79_DEV_LEDS_GPIO
++      select ATH79_DEV_M25P80
++      select ATH79_DEV_WMAC
++
 +config ATH79_MACH_DLAN_PRO_500_WP
 +      bool "devolo dLAN pro 500 Wireless+ support"
 +      select SOC_AR934X
  
  config ATH79_MACH_UBNT_XM
        bool "Ubiquiti Networks XM/UniFi boards"
-@@ -83,6 +1221,116 @@ config ATH79_MACH_UBNT_XM
+@@ -83,6 +1230,116 @@ 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
-@@ -134,7 +1382,10 @@ config ATH79_DEV_DSA
+@@ -134,7 +1391,10 @@ config ATH79_DEV_DSA
  config ATH79_DEV_ETH
        def_bool n
  
        def_bool n
  
  config ATH79_DEV_GPIO_BUTTONS
-@@ -164,6 +1415,11 @@ config ATH79_PCI_ATH9K_FIXUP
+@@ -164,6 +1424,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,136 @@ obj-$(CONFIG_ATH79_ROUTERBOOT)             += route
+@@ -38,9 +38,137 @@ obj-$(CONFIG_ATH79_ROUTERBOOT)             += route
  #
  # Machines
  #
 +obj-$(CONFIG_ATH79_MACH_CF_E316N_V2)  += mach-cf-e316n-v2.o
 +obj-$(CONFIG_ATH79_MACH_CPE510)               += mach-cpe510.o
  obj-$(CONFIG_ATH79_MACH_DB120)                += mach-db120.o
++obj-$(CONFIG_ATH79_MACH_DLAN_HOTSPOT) += mach-dlan-hotspot.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