diff options
author | Sebastian Kinne <contact@sebkinne.com> | 2018-02-13 13:26:33 +1100 |
---|---|---|
committer | Piotr Dymacz <pepe2k@gmail.com> | 2018-02-22 18:53:22 +0100 |
commit | 950b278c81cb380df869b0dadc02fa8258a91a6a (patch) | |
tree | b00daa6a85bd2e8cbe5cfdc125afca92fe1fd4bd /target/linux | |
parent | 2ea98fc39b21392c1556d6768604f54a578278d4 (diff) | |
download | upstream-950b278c81cb380df869b0dadc02fa8258a91a6a.tar.gz upstream-950b278c81cb380df869b0dadc02fa8258a91a6a.tar.bz2 upstream-950b278c81cb380df869b0dadc02fa8258a91a6a.zip |
ar71xx: add support for AR9331 based Hak5 devices
This adds support for AR9331 based Hak5 penetration testing tools:
- WiFi Pineapple NANO
- LAN Turtle
- Packet Squirrel
WiFi Pineapple NANO specifications:
- SoC: Atheros AR9331 (400 MHz)
- RAM: 64 MB (DDR2)
- FLASH: 16 MB
- WiFi: 1T1R AR9331 (built-in), 1T1R AR9271 (built-in via USB bus)
- Ethernet: 1x FE over USB (ASIX AX88772A)
- Ports: 2x RP-SMA for antennas, 1x USB 2.0 (host), 1x micro SD
- Power: USB 5 V, 1.5 A
- Other: status LED, reset button
LAN Turtle specifications:
- SoC: Atheros AR9331 (400 MHz)
- RAM: 64 MB (DDR2)
- FLASH: 16 MB
- WiFi: none
- Ethernet: 1x FE (AR9331), 1x FE over USB (Realtek RTL8152B)
- Ports: 1x RJ45, version dependent: micro SD or 3G SIM slot
- Power: USB 5 V, 0.5 A
- Other: status LED, reset button (inside, on PCB)
Packet Squirrel specifications:
- SoC: Atheros AR9331 (400 MHz)
- RAM: 64 MB (DDR2)
- FLASH: 16 MB
- WiFi: none
- Ethernet: 2x FE (AR9331)
- Ports: 2x RJ45, 1x USB 2.0
- Power: USB 5 V, 0.12 A
- Other: status LED, reset button, 4-way switch
Flash instructions for all 3 devices:
Original firmware is based on OpenWrt.
Use sysupgrade via SSH to flash.
Signed-off-by: Sebastian Kinne <contact@sebkinne.com>
[squashed commits, combined and reworked mach files, aligned board
naming with general convention, fixed minor issues, tested on real
hardware, reworded commit subject and description]
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
Diffstat (limited to 'target/linux')
-rwxr-xr-x | target/linux/ar71xx/base-files/etc/board.d/01_leds | 6 | ||||
-rwxr-xr-x | target/linux/ar71xx/base-files/etc/board.d/02_network | 1 | ||||
-rw-r--r-- | target/linux/ar71xx/base-files/etc/diag.sh | 7 | ||||
-rwxr-xr-x | target/linux/ar71xx/base-files/lib/ar71xx.sh | 9 | ||||
-rwxr-xr-x | target/linux/ar71xx/base-files/lib/upgrade/platform.sh | 5 | ||||
-rw-r--r-- | target/linux/ar71xx/config-4.4 | 2 | ||||
-rw-r--r-- | target/linux/ar71xx/config-4.9 | 2 | ||||
-rw-r--r-- | target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt | 19 | ||||
-rw-r--r-- | target/linux/ar71xx/files/arch/mips/ath79/Makefile | 2 | ||||
-rw-r--r-- | target/linux/ar71xx/files/arch/mips/ath79/mach-lan-turtle.c | 178 | ||||
-rw-r--r-- | target/linux/ar71xx/files/arch/mips/ath79/mach-wifi-pineapple-nano.c | 107 | ||||
-rw-r--r-- | target/linux/ar71xx/files/arch/mips/ath79/machtypes.h | 3 | ||||
-rw-r--r-- | target/linux/ar71xx/generic/config-default | 2 | ||||
-rw-r--r-- | target/linux/ar71xx/image/generic.mk | 39 |
14 files changed, 380 insertions, 2 deletions
diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds index fa47461f64..00954dfaa4 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds @@ -405,6 +405,9 @@ hornet-ub-x2) ucidef_set_led_wlan "wlan" "WLAN" "alfa:blue:wlan" "phy0tpt" ucidef_set_led_usbdev "usb" "USB" "alfa:blue:usb" "1-1" ;; +lan-turtle) + ucidef_set_led_netdev "wan" "WAN" "$board:orange:system" "eth1" + ;; mc-mac1200r) ucidef_set_led_wlan "wlan2g" "WLAN2G" "mercury:green:wlan2g" "phy1tpt" ucidef_set_led_wlan "wlan5g" "WLAN5G" "mercury:green:wlan5g" "phy0tpt" @@ -951,6 +954,9 @@ whr-hp-gn) ucidef_set_led_switch "lan3" "LAN3" "buffalo:green:lan3" "switch0" "0x08" ucidef_set_led_switch "lan4" "LAN4" "buffalo:green:lan4" "switch0" "0x10" ;; +wifi-pineapple-nano) + ucidef_set_led_wlan "wlan0" "WLAN0" "$board:blue:system" "phy0tpt" + ;; wlae-ag300n) ucidef_set_led_netdev "wireless" "WIRELESS" "buffalo:green:wireless" "wlan0" ;; diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network index 6beb8fbfdb..46599058c4 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/02_network +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network @@ -140,6 +140,7 @@ ar71xx_setup_interfaces() unifi|\ unifiac-lite|\ wi2a-ac200i|\ + wifi-pineapple-nano|\ wndap360|\ wp543) ucidef_set_interface_lan "eth0" diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index 41b6f09304..3550f7dc65 100644 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -27,6 +27,7 @@ get_status_led() { e600gac-v2|\ eap120|\ minibox-v1|\ + packet-squirrel|\ som9331|\ sr3200|\ tl-wr802n-v2|\ @@ -203,7 +204,8 @@ get_status_led() { r36a) status_led="$board:blue:status" ;; - e600g-v2) + e600g-v2|\ + wifi-pineapple-nano) status_led="$board:blue:system" ;; eap300v2) @@ -254,6 +256,9 @@ get_status_led() { jwap230) status_led="$board:green:led1" ;; + lan-turtle) + status_led="$board:orange:system" + ;; ls-sr71) status_led="ubnt:green:d22" ;; diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index a041255c90..fda135072c 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -741,6 +741,9 @@ ar71xx_board_detect() { *"JWAP230") name="jwap230" ;; + *"LAN Turtle") + name="lan-turtle" + ;; *"Lima"*) name="lima" ;; @@ -865,6 +868,9 @@ ar71xx_board_detect() { *"Oolite V1.0") name="oolite" ;; + *"Packet Squirrel") + name="packet-squirrel" + ;; *"PB42") name="pb42" ;; @@ -1327,6 +1333,9 @@ ar71xx_board_detect() { *"WHR-HP-GN") name="whr-hp-gn" ;; + *"WiFi Pineapple NANO") + name="wifi-pineapple-nano" + ;; *"WLAE-AG300N") name="wlae-ag300n" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index d7b4c63848..adc325b34c 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -392,12 +392,14 @@ platform_check_image() { el-m150|\ el-mini|\ gl-inet|\ + lan-turtle|\ mc-mac1200r|\ minibox-v1|\ omy-g1|\ omy-x1|\ onion-omega|\ oolite|\ + packet-squirrel|\ re355|\ re450|\ rut900|\ @@ -466,7 +468,8 @@ platform_check_image() { tl-wr940n-v4|\ tl-wr941nd|\ tl-wr941nd-v5|\ - tl-wr941nd-v6) + tl-wr941nd-v6|\ + wifi-pineapple-nano) local magic_ver="0100" case "$board" in diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4 index 99e4419272..dbfe6d7cb4 100644 --- a/target/linux/ar71xx/config-4.4 +++ b/target/linux/ar71xx/config-4.4 @@ -131,6 +131,7 @@ CONFIG_ATH79=y # CONFIG_ATH79_MACH_JA76PF is not set # CONFIG_ATH79_MACH_JWAP003 is not set # CONFIG_ATH79_MACH_JWAP230 is not set +# CONFIG_ATH79_MACH_LAN_TURTLE is not set # CONFIG_ATH79_MACH_LIMA is not set # CONFIG_ATH79_MACH_MC_MAC1200R is not set # CONFIG_ATH79_MACH_MR12 is not set @@ -239,6 +240,7 @@ CONFIG_ATH79=y # CONFIG_ATH79_MACH_WEIO is not set # CONFIG_ATH79_MACH_WHR_HP_G300N is not set # CONFIG_ATH79_MACH_WI2A_AC200I is not set +# CONFIG_ATH79_MACH_WIFI_PINEAPPLE_NANO is not set # CONFIG_ATH79_MACH_WLAE_AG300N is not set # CONFIG_ATH79_MACH_WLR8100 is not set # CONFIG_ATH79_MACH_WNDAP360 is not set diff --git a/target/linux/ar71xx/config-4.9 b/target/linux/ar71xx/config-4.9 index 64603daada..ccc6d43662 100644 --- a/target/linux/ar71xx/config-4.9 +++ b/target/linux/ar71xx/config-4.9 @@ -129,6 +129,7 @@ CONFIG_ATH79=y # CONFIG_ATH79_MACH_JA76PF is not set # CONFIG_ATH79_MACH_JWAP003 is not set # CONFIG_ATH79_MACH_JWAP230 is not set +# CONFIG_ATH79_MACH_LAN_TURTLE is not set # CONFIG_ATH79_MACH_LIMA is not set # CONFIG_ATH79_MACH_MC_MAC1200R is not set # CONFIG_ATH79_MACH_MR12 is not set @@ -237,6 +238,7 @@ CONFIG_ATH79=y # CONFIG_ATH79_MACH_WEIO is not set # CONFIG_ATH79_MACH_WHR_HP_G300N is not set # CONFIG_ATH79_MACH_WI2A_AC200I is not set +# CONFIG_ATH79_MACH_WIFI_PINEAPPLE_NANO is not set # CONFIG_ATH79_MACH_WLAE_AG300N is not set # CONFIG_ATH79_MACH_WLR8100 is not set # CONFIG_ATH79_MACH_WNDAP360 is not set diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt index a9e235fa75..50cc00dca9 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt @@ -958,6 +958,16 @@ config ATH79_MACH_WAM250 select ATH79_DEV_USB select ATH79_DEV_WMAC +config ATH79_MACH_WIFI_PINEAPPLE_NANO + bool "Hak5 WiFi Pineapple NANO 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_USB + select ATH79_DEV_WMAC + config ATH79_MACH_WRT160NL bool "Linksys WRT160NL board support" select SOC_AR913X @@ -2154,6 +2164,15 @@ config ATH79_MACH_CARAMBOLA2 select ATH79_DEV_USB select ATH79_DEV_WMAC +config ATH79_MACH_LAN_TURTLE + bool "Hak5 LAN Turtle and Packet Squirrel 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_USB + config ATH79_MACH_LIMA bool "8devices Lima board" select SOC_QCA953X diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile index 181e23a37a..2e63f25399 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile +++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile @@ -139,6 +139,7 @@ obj-$(CONFIG_ATH79_MACH_HORNET_UB) += mach-hornet-ub.o obj-$(CONFIG_ATH79_MACH_JA76PF) += mach-ja76pf.o obj-$(CONFIG_ATH79_MACH_JWAP003) += mach-jwap003.o obj-$(CONFIG_ATH79_MACH_JWAP230) += mach-jwap230.o +obj-$(CONFIG_ATH79_MACH_LAN_TURTLE) += mach-lan-turtle.o obj-$(CONFIG_ATH79_MACH_LIMA) += mach-lima.o obj-$(CONFIG_ATH79_MACH_MC_MAC1200R) += mach-mc-mac1200r.o obj-$(CONFIG_ATH79_MACH_MR12) += mach-mr12.o @@ -246,6 +247,7 @@ obj-$(CONFIG_ATH79_MACH_UBNT_XM) += mach-ubnt-xm.o obj-$(CONFIG_ATH79_MACH_WAM250) += mach-wam250.o obj-$(CONFIG_ATH79_MACH_WEIO) += mach-weio.o obj-$(CONFIG_ATH79_MACH_WHR_HP_G300N) += mach-whr-hp-g300n.o +obj-$(CONFIG_ATH79_MACH_WIFI_PINEAPPLE_NANO) += mach-wifi-pineapple-nano.o obj-$(CONFIG_ATH79_MACH_WLAE_AG300N) += mach-wlae-ag300n.o obj-$(CONFIG_ATH79_MACH_WLR8100) += mach-wlr8100.o obj-$(CONFIG_ATH79_MACH_WNDAP360) += mach-wndap360.o diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-lan-turtle.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-lan-turtle.c new file mode 100644 index 0000000000..d2faa2c740 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-lan-turtle.c @@ -0,0 +1,178 @@ +/* + * Hak5 LAN Turtle and Packet Squirrel boards support + * + * Copyright (C) 2018 Sebastian Kinne <seb@hak5.org> + * Copyright (C) 2018 Piotr Dymacz <pepe2k@gmail.com> + * + * 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 "machtypes.h" + +#define LAN_TURTLE_GPIO_BTN_RESET 11 +#define LAN_TURTLE_GPIO_LED_SYS 13 + +#define PACKET_SQUIRREL_GPIO_BTN_SW1 18 +#define PACKET_SQUIRREL_GPIO_BTN_SW2 20 +#define PACKET_SQUIRREL_GPIO_BTN_SW3 21 +#define PACKET_SQUIRREL_GPIO_BTN_SW4 24 +#define PACKET_SQUIRREL_GPIO_BTN_RESET 11 +#define PACKET_SQUIRREL_GPIO_LED_B 23 +#define PACKET_SQUIRREL_GPIO_LED_G 22 +#define PACKET_SQUIRREL_GPIO_LED_R 19 + +#define HAK5_KEYS_POLL_INTERVAL 20 /* msecs */ +#define HAK5_KEYS_DEBOUNCE_INTERVAL (3 * HAK5_KEYS_POLL_INTERVAL) + +static const char *hak5_part_probes[] = { + "tp-link", + NULL, +}; + +static struct flash_platform_data hak5_flash_data = { + .part_probes = hak5_part_probes, +}; + +/* LAN Turtle */ +static struct gpio_led lan_turtle_leds_gpio[] __initdata = { + { + .name = "lan-turtle:orange:system", + .gpio = LAN_TURTLE_GPIO_LED_SYS, + .active_low = 1, + }, +}; + +static struct gpio_keys_button lan_turtle_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = HAK5_KEYS_DEBOUNCE_INTERVAL, + .gpio = LAN_TURTLE_GPIO_BTN_RESET, + .active_low = 1, + }, +}; + +/* Packet Squirrel */ +static struct gpio_led packet_squirrel_leds_gpio[] __initdata = { + { + .name = "packet-squirrel:blue:system", + .gpio = PACKET_SQUIRREL_GPIO_LED_B, + .active_low = 1, + }, { + .name = "packet-squirrel:green:system", + .gpio = PACKET_SQUIRREL_GPIO_LED_G, + .active_low = 1, + }, { + .name = "packet-squirrel:red:system", + .gpio = PACKET_SQUIRREL_GPIO_LED_R, + .active_low = 1, + }, +}; + +static struct gpio_keys_button packet_squirrel_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = HAK5_KEYS_DEBOUNCE_INTERVAL, + .gpio = PACKET_SQUIRREL_GPIO_BTN_RESET, + .active_low = 1, + }, { + .desc = "sw1", + .type = EV_KEY, + .code = BTN_0, + .debounce_interval = HAK5_KEYS_DEBOUNCE_INTERVAL, + .gpio = PACKET_SQUIRREL_GPIO_BTN_SW1, + .active_low = 1, + }, { + .desc = "sw2", + .type = EV_KEY, + .code = BTN_1, + .debounce_interval = HAK5_KEYS_DEBOUNCE_INTERVAL, + .gpio = PACKET_SQUIRREL_GPIO_BTN_SW2, + .active_low = 1, + }, { + .desc = "sw3", + .type = EV_KEY, + .code = BTN_2, + .debounce_interval = HAK5_KEYS_DEBOUNCE_INTERVAL, + .gpio = PACKET_SQUIRREL_GPIO_BTN_SW3, + .active_low = 1, + }, { + .desc = "sw4", + .type = EV_KEY, + .code = BTN_3, + .debounce_interval = HAK5_KEYS_DEBOUNCE_INTERVAL, + .gpio = PACKET_SQUIRREL_GPIO_BTN_SW4, + .active_low = 1, + }, +}; + +static void __init hak5_common_setup(void) +{ + u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00); + + ath79_register_m25p80(&hak5_flash_data); + + ath79_register_mdio(0, 0x0); + + ath79_switch_data.phy_poll_mask = 0xfe; + + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1); + ath79_register_eth(0); + + ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1); + ath79_register_eth(1); + + ath79_register_usb(); + + /* GPIO11/12 */ + ath79_gpio_function_disable(AR933X_GPIO_FUNC_UART_RTS_CTS_EN); +} + +static void __init lan_turtle_setup(void) +{ + hak5_common_setup(); + + /* GPIO13 */ + ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(lan_turtle_leds_gpio), + lan_turtle_leds_gpio); + + ath79_register_gpio_keys_polled(-1, HAK5_KEYS_POLL_INTERVAL, + ARRAY_SIZE(lan_turtle_gpio_keys), + lan_turtle_gpio_keys); +} + +static void __init packet_squirrel_setup(void) +{ + hak5_common_setup(); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(packet_squirrel_leds_gpio), + packet_squirrel_leds_gpio); + + ath79_register_gpio_keys_polled(-1, HAK5_KEYS_POLL_INTERVAL, + ARRAY_SIZE(packet_squirrel_gpio_keys), + packet_squirrel_gpio_keys); +} + +MIPS_MACHINE(ATH79_MACH_LAN_TURTLE, "LAN-TURTLE", + "Hak5 LAN Turtle", lan_turtle_setup); + +MIPS_MACHINE(ATH79_MACH_PACKET_SQUIRREL, "PACKET-SQUIRREL", + "Hak5 Packet Squirrel", packet_squirrel_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wifi-pineapple-nano.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wifi-pineapple-nano.c new file mode 100644 index 0000000000..645f367f6c --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wifi-pineapple-nano.c @@ -0,0 +1,107 @@ +/* + * Hak5 WiFi Pineapple NANO board support + * + * Copyright (C) 2018 Sebastian Kinne <seb@hak5.org> + * Copyright (C) 2018 Piotr Dymacz <pepe2k@gmail.com> + * + * 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 WIFI_PINEAPPLE_NANO_GPIO_LED_SYSTEM 18 + +#define WIFI_PINEAPPLE_NANO_GPIO_BTN_RESET 12 +#define WIFI_PINEAPPLE_NANO_GPIO_SD_DET 19 +#define WIFI_PINEAPPLE_NANO_GPIO_USB_ALARM 20 +#define WIFI_PINEAPPLE_NANO_GPIO_USB_POWER 23 + +#define HAK5_KEYS_POLL_INTERVAL 20 /* msecs */ +#define HAK5_KEYS_DEBOUNCE_INTERVAL (3 * HAK5_KEYS_POLL_INTERVAL) + +#define WIFI_PINEAPPLE_NANO_MAC1_OFFSET 0x0006 +#define WIFI_PINEAPPLE_NANO_CALDATA_OFFSET 0x1000 + +static const char *hak5_part_probes[] = { + "tp-link", + NULL, +}; + +static struct flash_platform_data hak5_flash_data = { + .part_probes = hak5_part_probes, +}; + +static struct gpio_led wifi_pineapple_nano_leds_gpio[] __initdata = { + { + .name = "wifi-pineapple-nano:blue:system", + .gpio = WIFI_PINEAPPLE_NANO_GPIO_LED_SYSTEM, + .active_low = 1, + }, +}; + +static struct gpio_keys_button wifi_pineapple_nano_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = HAK5_KEYS_DEBOUNCE_INTERVAL, + .gpio = WIFI_PINEAPPLE_NANO_GPIO_BTN_RESET, + .active_low = 1, + } +}; + +static void __init wifi_pineapple_nano_setup(void) +{ + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); + + ath79_register_m25p80(&hak5_flash_data); + + ath79_setup_ar933x_phy4_switch(false, false); + ath79_register_mdio(0, 0x0); + + ath79_init_mac(ath79_eth0_data.mac_addr, + art + WIFI_PINEAPPLE_NANO_MAC1_OFFSET, 0); + ath79_register_eth(0); + + /* GPIO11/12 */ + ath79_gpio_function_disable(AR933X_GPIO_FUNC_UART_RTS_CTS_EN); + + gpio_request_one(WIFI_PINEAPPLE_NANO_GPIO_SD_DET, + GPIOF_IN | GPIOF_EXPORT_DIR_FIXED | GPIOF_ACTIVE_LOW, + "SD card present"); + + gpio_request_one(WIFI_PINEAPPLE_NANO_GPIO_USB_ALARM, + GPIOF_IN | GPIOF_EXPORT_DIR_FIXED | GPIOF_ACTIVE_LOW, + "USB alarm"); + + gpio_request_one(WIFI_PINEAPPLE_NANO_GPIO_USB_POWER, + GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED | + GPIOF_ACTIVE_LOW, "USB power"); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(wifi_pineapple_nano_leds_gpio), + wifi_pineapple_nano_leds_gpio); + + ath79_register_gpio_keys_polled(-1, HAK5_KEYS_POLL_INTERVAL, + ARRAY_SIZE(wifi_pineapple_nano_gpio_keys), + wifi_pineapple_nano_gpio_keys); + + ath79_register_usb(); + ath79_register_wmac(art + WIFI_PINEAPPLE_NANO_CALDATA_OFFSET, NULL); +} + +MIPS_MACHINE(ATH79_MACH_WIFI_PINEAPPLE_NANO, "WIFI-PINEAPPLE-NANO", + "Hak5 WiFi Pineapple NANO", wifi_pineapple_nano_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h index 9127d3fe92..03020f889e 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h @@ -135,6 +135,7 @@ enum ath79_mach_type { ATH79_MACH_JA76PF2, /* jjPlus JA76PF2 */ ATH79_MACH_JWAP003, /* jjPlus JWAP003 */ ATH79_MACH_JWAP230, /* jjPlus JWAP230 */ + ATH79_MACH_LAN_TURTLE, /* Hak5 LAN Turtle */ ATH79_MACH_LIMA, /* 8devices Lima */ ATH79_MACH_MC_MAC1200R, /* MERCURY MAC1200R */ ATH79_MACH_MR12, /* Cisco Meraki MR12 */ @@ -170,6 +171,7 @@ enum ath79_mach_type { ATH79_MACH_OMY_G1, /* OMYlink OMY-G1 */ ATH79_MACH_OMY_X1, /* OMYlink OMY-X1 */ ATH79_MACH_ONION_OMEGA, /* ONION OMEGA */ + ATH79_MACH_PACKET_SQUIRREL, /* Hak5 Packet Squirrel */ ATH79_MACH_PB42, /* Atheros PB42 */ ATH79_MACH_PB44, /* Atheros PB44 reference board */ ATH79_MACH_PQI_AIR_PEN, /* PQI Air Pen */ @@ -323,6 +325,7 @@ enum ath79_mach_type { ATH79_MACH_WHR_G301N, /* Buffalo WHR-G301N */ ATH79_MACH_WHR_HP_G300N, /* Buffalo WHR-HP-G300N */ ATH79_MACH_WHR_HP_GN, /* Buffalo WHR-HP-GN */ + ATH79_MACH_WIFI_PINEAPPLE_NANO, /* Hak5 WiFi Pineapple NANO */ ATH79_MACH_WLAE_AG300N, /* Buffalo WLAE-AG300N */ ATH79_MACH_WLR8100, /* SITECOM WLR-8100 */ ATH79_MACH_WNDAP360, /* NETGEAR WNDAP360 */ diff --git a/target/linux/ar71xx/generic/config-default b/target/linux/ar71xx/generic/config-default index b3d2df7509..789e94d69f 100644 --- a/target/linux/ar71xx/generic/config-default +++ b/target/linux/ar71xx/generic/config-default @@ -101,6 +101,7 @@ CONFIG_ATH79_MACH_HORNET_UB=y CONFIG_ATH79_MACH_JA76PF=y CONFIG_ATH79_MACH_JWAP003=y CONFIG_ATH79_MACH_JWAP230=y +CONFIG_ATH79_MACH_LAN_TURTLE=y CONFIG_ATH79_MACH_LIMA=y CONFIG_ATH79_MACH_MC_MAC1200R=y CONFIG_ATH79_MACH_MR12=y @@ -169,6 +170,7 @@ CONFIG_ATH79_MACH_UBNT_XM=y CONFIG_ATH79_MACH_WAM250=y CONFIG_ATH79_MACH_WEIO=y CONFIG_ATH79_MACH_WHR_HP_G300N=y +CONFIG_ATH79_MACH_WIFI_PINEAPPLE_NANO=y CONFIG_ATH79_MACH_WLAE_AG300N=y CONFIG_ATH79_MACH_WLR8100=y CONFIG_ATH79_MACH_WNDAP360=y diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk index 137716d439..539fd3c1fe 100644 --- a/target/linux/ar71xx/image/generic.mk +++ b/target/linux/ar71xx/image/generic.mk @@ -484,6 +484,19 @@ define Device/gl-usb150 endef TARGET_DEVICES += gl-usb150 +define Device/lan-turtle + $(Device/tplink-16mlzma) + DEVICE_TITLE := Hak5 LAN Turtle + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage \ + -kmod-ath9k -swconfig -uboot-envtools -wpad-mini + BOARDNAME := LAN-TURTLE + DEVICE_PROFILE := LANTURTLE + TPLINK_HWID := 0x5348334c + CONSOLE := ttyATH0,115200 + IMAGES := sysupgrade.bin +endef +TARGET_DEVICES += lan-turtle + define Device/lima DEVICE_TITLE := 8devices Lima DEVICE_PACKAGES := kmod-usb-core kmod-usb2 @@ -656,6 +669,19 @@ define Device/cr5000-nocloud endef TARGET_DEVICES += cr5000-nocloud +define Device/packet-squirrel + $(Device/tplink-16mlzma) + DEVICE_TITLE := Hak5 Packet Squirrel + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 \ + -kmod-ath9k -swconfig -uboot-envtools -wpad-mini + BOARDNAME := PACKET-SQUIRREL + DEVICE_PROFILE := PACKETSQUIRREL + TPLINK_HWID := 0x5351524c + CONSOLE := ttyATH0,115200 + IMAGES := sysupgrade.bin +endef +TARGET_DEVICES += packet-squirrel + define Device/pqi-air-pen DEVICE_TITLE := PQI Air Pen DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-storage @@ -1125,6 +1151,19 @@ define Device/wam250 endef TARGET_DEVICES += wam250 +define Device/wifi-pineapple-nano + $(Device/tplink-16mlzma) + DEVICE_TITLE := Hak5 WiFi Pineapple NANO + DEVICE_PACKAGES := kmod-ath9k-htc kmod-usb-core kmod-usb2 kmod-usb-storage \ + -swconfig -uboot-envtools + BOARDNAME := WIFI-PINEAPPLE-NANO + DEVICE_PROFILE := WIFIPINEAPPLENANO + TPLINK_HWID := 0x4e414e4f + CONSOLE := ttyATH0,115200 + IMAGES := sysupgrade.bin +endef +TARGET_DEVICES += wifi-pineapple-nano + define Device/wlr8100 DEVICE_TITLE := Sitecom WLR-8100 DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport kmod-usb3 \ |