diff options
Diffstat (limited to 'target/linux/ar71xx/files')
5 files changed, 309 insertions, 0 deletions
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 */ |