diff options
Diffstat (limited to 'target/linux/ar71xx/files')
4 files changed, 129 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 1198fcb74b..f2717e86e9 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt @@ -225,6 +225,15 @@ config ATH79_MACH_AP90Q select ATH79_DEV_M25P80 select ATH79_DEV_WMAC +config ATH79_MACH_AP91_5G + bool "ALFA Network AP91-5G support" + select SOC_AR724X + select ATH79_DEV_AP9X_PCI if PCI + select ATH79_DEV_ETH + select ATH79_DEV_GPIO_BUTTONS + select ATH79_DEV_LEDS_GPIO + select ATH79_DEV_M25P80 + config ATH79_MACH_AP96 bool "Atheros AP96 board support" select SOC_AR71XX diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile index 455af762e3..0e581005d7 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile +++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile @@ -57,6 +57,7 @@ obj-$(CONFIG_ATH79_MACH_AP147) += mach-ap147.o obj-$(CONFIG_ATH79_MACH_AP152) += mach-ap152.o obj-$(CONFIG_ATH79_MACH_AP531B0) += mach-ap531b0.o obj-$(CONFIG_ATH79_MACH_AP90Q) += mach-ap90q.o +obj-$(CONFIG_ATH79_MACH_AP91_5G) += mach-ap91-5g.o obj-$(CONFIG_ATH79_MACH_AP96) += mach-ap96.o obj-$(CONFIG_ATH79_MACH_ARCHER_C25_V1) += mach-archer-c25-v1.o obj-$(CONFIG_ATH79_MACH_ARCHER_C58_V1) += mach-archer-c59-v1.o diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ap91-5g.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ap91-5g.c new file mode 100644 index 0000000000..64b9430381 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ap91-5g.c @@ -0,0 +1,118 @@ +/* + * ALFA Network AP91-5G board support + * + * 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 <linux/platform_device.h> + +#include <asm/mach-ath79/ath79.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 "machtypes.h" + +#define AP91_5G_GPIO_LED_LAN 17 +#define AP91_5G_GPIO_LED_SIGNAL1 12 +#define AP91_5G_GPIO_LED_SIGNAL2 8 +#define AP91_5G_GPIO_LED_SIGNAL3 6 +#define AP91_5G_GPIO_LED_SIGNAL4 7 + +#define AP91_5G_GPIO_WDT_EN 1 +#define AP91_5G_GPIO_WDT_IN 0 + +#define AP91_5G_GPIO_BTN_RESET 11 + +#define AP91_5G_KEYS_POLL_INTERVAL 20 +#define AP91_5G_KEYS_DEBOUNCE_INTERVAL (3 * AP91_5G_KEYS_POLL_INTERVAL) + +#define AP91_5G_WMAC_CALDATA_OFFSET 0x1000 + +static struct gpio_led ap91_5g_leds_gpio[] __initdata = { + { + .name = "ap91-5g:green:lan", + .gpio = AP91_5G_GPIO_LED_LAN, + .active_low = 1, + }, { + .name = "ap91-5g:red:signal1", + .gpio = AP91_5G_GPIO_LED_SIGNAL1, + .active_low = 1, + }, { + .name = "ap91-5g:orange:signal2", + .gpio = AP91_5G_GPIO_LED_SIGNAL2, + .active_low = 1, + }, { + .name = "ap91-5g:green:signal3", + .gpio = AP91_5G_GPIO_LED_SIGNAL3, + .active_low = 1, + }, { + .name = "ap91-5g:green:signal4", + .gpio = AP91_5G_GPIO_LED_SIGNAL4, + .active_low = 1, + }, +}; + +static struct gpio_keys_button ap91_5g_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = AP91_5G_KEYS_DEBOUNCE_INTERVAL, + .gpio = AP91_5G_GPIO_BTN_RESET, + .active_low = 1, + }, +}; + +static void __init ap91_5g_setup(void) +{ + u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); + + ath79_gpio_function_setup(AR724X_GPIO_FUNC_JTAG_DISABLE, + AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); + + gpio_set_value(AP91_5G_GPIO_LED_LAN, 1); + gpio_set_value(AP91_5G_GPIO_LED_SIGNAL3, 1); + gpio_set_value(AP91_5G_GPIO_LED_SIGNAL4, 1); + + ath79_register_m25p80(NULL); + + ath79_register_mdio(0, 0x0); + + /* LAN */ + ath79_eth0_data.duplex = DUPLEX_FULL; + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; + ath79_eth0_data.phy_mask = BIT(4); + ath79_eth0_data.speed = SPEED_100; + ath79_init_mac(ath79_eth0_data.mac_addr, art, 0); + ath79_register_eth(0); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(ap91_5g_leds_gpio), + ap91_5g_leds_gpio); + + ath79_register_gpio_keys_polled(-1, AP91_5G_KEYS_POLL_INTERVAL, + ARRAY_SIZE(ap91_5g_gpio_keys), + ap91_5g_gpio_keys); + + gpio_request_one(AP91_5G_GPIO_WDT_IN, + GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, + "WDT input"); + + gpio_request_one(AP91_5G_GPIO_WDT_EN, + GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED, + "WDT enable"); + + ap91_pci_init(art + AP91_5G_WMAC_CALDATA_OFFSET, NULL); +} + +MIPS_MACHINE(ATH79_MACH_AP91_5G, "AP91-5G", "ALFA Network AP91-5G", + ap91_5g_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h index 0f536f0ec5..c2cb8b6126 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h @@ -41,6 +41,7 @@ enum ath79_mach_type { ATH79_MACH_AP152, /* Atheros AP152 reference board */ ATH79_MACH_AP531B0, /* Rockeetech AP531B0 */ ATH79_MACH_AP90Q, /* YunCore AP90Q */ + ATH79_MACH_AP91_5G, /* ALFA Network AP91-5G */ ATH79_MACH_AP96, /* Atheros AP96 */ ATH79_MACH_ARCHER_C25_V1, /* TP-LINK Archer C25 V1 board */ ATH79_MACH_ARCHER_C5, /* TP-LINK Archer C5 board */ |