[source] ar71xx: add support for Aerohive AP-121

LEDE Commits lede-commits at lists.infradead.org
Mon May 15 14:03:42 PDT 2017


pepe2k pushed a commit to source.git, branch master:
https://git.lede-project.org/10d11859dfbad0b4482d1a50b20ef91eeeeca2d7

commit 10d11859dfbad0b4482d1a50b20ef91eeeeca2d7
Author: Chris Blake <chrisrblake93 at gmail.com>
AuthorDate: Wed Apr 26 22:09:27 2017 -0500

    ar71xx: add support for Aerohive AP-121
    
    This adds support for Aerohive AP-121 access point.
    
    Specification:
    - SoC: Atheros AR9344-BC2A at 560MHz
    - WiFi 1: 2.4GHz Atheros AR9340? - SoC
    - WiFi 2: 5.0GHz Atheros AR9382-AL1A
    - Memory: 128MB from 2x Nanya NT5TU32M16DG-AC
    - SPI: 1MB Macronix MX25L8006E
    - NAND: 128MB Hynix H27U1G8F2BTR-BC
    - Ethernet: Atheros AR8035-A
    - USB: 1x 2.0
    - TPM: Atmel SC3204
    
    Flashing:
    1. Hook into UART (9600 baud) and enter U-Boot. You may need to enter
    a password of administrator or AhNf?d at ta06 if prompted.
    2. Once in U-Boot, download and flash LEDE factory image over tftp:
    
    dhcp;
    setenv serverip tftp-server-ip;
    tftpboot 0x81000000 lede-ar71xx-nand-hiveap-121-squashfs-factory.bin;
    nand erase 0x800000 0x800000;
    nand write 0x81000000 0x800000 0x800000;
    reset;
    
    Signed-off-by: Chris Blake <chrisrblake93 at gmail.com>
    [minor text changes in commit subject and description, fixed
    alphabetical order in etc/diag.sh, use only model name in lib/ar71xx.sh,
    fixed code style issues in mach-hiveap-121.c, ubinized factory image]
    Signed-off-by: Piotr Dymacz <pepe2k at gmail.com>
---
 .../linux/ar71xx/base-files/etc/board.d/02_network |   1 +
 target/linux/ar71xx/base-files/etc/diag.sh         |   7 +-
 target/linux/ar71xx/base-files/lib/ar71xx.sh       |   3 +
 .../ar71xx/base-files/lib/upgrade/platform.sh      |   2 +
 target/linux/ar71xx/config-4.4                     |   1 +
 .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt   |  12 ++
 target/linux/ar71xx/files/arch/mips/ath79/Makefile |   1 +
 .../ar71xx/files/arch/mips/ath79/mach-hiveap-121.c | 153 +++++++++++++++++++++
 .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |   1 +
 target/linux/ar71xx/image/nand.mk                  |  18 +++
 target/linux/ar71xx/nand/config-default            |   1 +
 11 files changed, 197 insertions(+), 3 deletions(-)

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 2a6dfa5..2737129 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -74,6 +74,7 @@ ar71xx_setup_interfaces()
 	eap300v2|\
 	eap7660d|\
 	el-mini|\
+	hiveap-121|\
 	loco-m-xw|\
 	mr12|\
 	mr16|\
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index cea95b7..9cad899 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -196,6 +196,10 @@ get_status_led() {
 	esr900)
 		status_led="engenius:amber:power"
 		;;
+	hiveap-121|\
+	nbg6716)
+		status_led="$board:white:power"
+		;;
 	hiwifi-hc6361)
 		status_led="hiwifi:blue:system"
 		;;
@@ -248,9 +252,6 @@ get_status_led() {
 	nbg460n_550n_550nh)
 		status_led="nbg460n:green:power"
 		;;
-	nbg6716)
-		status_led="$board:white:power"
-		;;
 	om2p|\
 	om2pv2|\
 	om2pv4|\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 5c3b1a7..a751c64 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -651,6 +651,9 @@ ar71xx_board_detect() {
 	*"GL-MIFI")
 		name="gl-mifi"
 		;;
+	*"HiveAP-121")
+		name="hiveap-121"
+		;;
 	*"HiWiFi HC6361")
 		name="hiwifi-hc6361"
 		;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 8ebdea3..e246f35 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -519,6 +519,7 @@ platform_check_image() {
 		return $?
 		;;
 	c-60|\
+	hiveap-121|\
 	nbg6716|\
 	r6100|\
 	rambutan|\
@@ -662,6 +663,7 @@ platform_pre_upgrade() {
 
 	case "$board" in
 	c-60|\
+	hiveap-121|\
 	nbg6716|\
 	r6100|\
 	rambutan|\
diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4
index 380254d..0a37586 100644
--- a/target/linux/ar71xx/config-4.4
+++ b/target/linux/ar71xx/config-4.4
@@ -113,6 +113,7 @@ CONFIG_ATH79_MACH_GL_INET=y
 CONFIG_ATH79_MACH_GL_MIFI=y
 CONFIG_ATH79_MACH_GS_MINIBOX_V1=y
 CONFIG_ATH79_MACH_GS_OOLITE=y
+# CONFIG_ATH79_MACH_HIVEAP_121 is not set
 CONFIG_ATH79_MACH_HIWIFI_HC6361=y
 CONFIG_ATH79_MACH_HORNET_UB=y
 CONFIG_ATH79_MACH_JA76PF=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index eb8219e..9030954 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -796,6 +796,18 @@ config ATH79_MACH_GS_OOLITE
 	select ATH79_DEV_USB
 	select ATH79_DEV_WMAC
 
+config ATH79_MACH_HIVEAP_121
+	bool "Aerohive HiveAP-121 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_M25P80
+	select ATH79_DEV_NFC
+	select ATH79_DEV_USB
+	select ATH79_DEV_WMAC
+
 config ATH79_MACH_HIWIFI_HC6361
 	bool "HiWiFi HC6361 board support"
 	select SOC_AR933X
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
index f503002..2868adc 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -117,6 +117,7 @@ obj-$(CONFIG_ATH79_MACH_GL_INET)		+= mach-gl-inet.o
 obj-$(CONFIG_ATH79_MACH_GL_MIFI)		+= mach-gl-mifi.o
 obj-$(CONFIG_ATH79_MACH_GS_MINIBOX_V1)		+= mach-gs-minibox-v1.o
 obj-$(CONFIG_ATH79_MACH_GS_OOLITE)		+= mach-gs-oolite.o
+obj-$(CONFIG_ATH79_MACH_HIVEAP_121)		+= mach-hiveap-121.o
 obj-$(CONFIG_ATH79_MACH_HIWIFI_HC6361)		+= mach-hiwifi-hc6361.o
 obj-$(CONFIG_ATH79_MACH_HORNET_UB)		+= mach-hornet-ub.o
 obj-$(CONFIG_ATH79_MACH_JA76PF)			+= mach-ja76pf.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-hiveap-121.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-hiveap-121.c
new file mode 100644
index 0000000..363d73d
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-hiveap-121.c
@@ -0,0 +1,153 @@
+/*
+ *  Aerohive HiveAP 121 board support
+ *
+ *  Copyright (C) 2017 Chris Blake <chrisrblake93 at 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/i2c.h>
+#include <linux/i2c-gpio.h>
+#include <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+#include <linux/platform/ar934x_nfc.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-nfc.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "dev-ap9x-pci.h"
+#include "dev-m25p80.h"
+#include "machtypes.h"
+
+#define HIVEAP_121_GPIO_LED_ORANGE	14
+#define HIVEAP_121_GPIO_LED_WHITE	21
+#define HIVEAP_121_GPIO_I2C_SCL		12
+#define HIVEAP_121_GPIO_I2C_SDA		13
+#define HIVEAP_121_GPIO_XLNA0		20
+#define HIVEAP_121_GPIO_XLNA1		19
+#define HIVEAP_121_GPIO_USB_POWER	15
+
+#define HIVEAP_121_GPIO_BTN_RESET		4
+#define HIVEAP_121_KEYS_POLL_INTERVAL		20 /* msecs */
+#define HIVEAP_121_KEYS_DEBOUNCE_INTERVAL	\
+					(3 * HIVEAP_121_KEYS_POLL_INTERVAL)
+
+#define HIVEAP_121_MAC_OFFSET	0x90000
+
+#define HIVEAP_121_LAN_PHYADDR	0
+
+static struct gpio_led hiveap_121_leds_gpio[] __initdata = {
+	{
+		.name		= "hiveap-121:orange:power",
+		.gpio		= HIVEAP_121_GPIO_LED_ORANGE,
+		.active_low	= 1,
+	}, {
+		.name		= "hiveap-121:white:power",
+		.gpio		= HIVEAP_121_GPIO_LED_WHITE,
+		.active_low	= 1,
+	}
+};
+
+static struct gpio_keys_button hiveap_121_gpio_keys[] __initdata = {
+	{
+		.desc = "reset",
+		.type = EV_KEY,
+		.code = KEY_RESTART,
+		.debounce_interval = HIVEAP_121_KEYS_DEBOUNCE_INTERVAL,
+		.gpio = HIVEAP_121_GPIO_BTN_RESET,
+		.active_low  = 1,
+	},
+};
+
+static struct i2c_gpio_platform_data hiveap_121_i2c_gpio_data = {
+	.sda_pin = HIVEAP_121_GPIO_I2C_SDA,
+	.scl_pin = HIVEAP_121_GPIO_I2C_SCL,
+};
+
+static struct platform_device hiveap_121_i2c_gpio_device = {
+	.name	= "i2c-gpio",
+	.id	= 0,
+	.dev	= {
+		.platform_data = &hiveap_121_i2c_gpio_data,
+	}
+};
+
+static struct i2c_board_info tpm_i2c_info[] __initdata = {
+	{
+		I2C_BOARD_INFO("tpm_i2c_atmel", 0x29),
+	}
+};
+
+static void __init hiveap_121_setup(void)
+{
+	u8 *base = (u8 *) KSEG1ADDR(0x1f000000);
+	u8 wlan0_mac[ETH_ALEN];
+	u8 wlan1_mac[ETH_ALEN];
+
+	/* NAND */
+	ath79_nfc_set_ecc_mode(AR934X_NFC_ECC_HW);
+	ath79_register_nfc();
+
+	/* SPI */
+	ath79_register_m25p80(NULL);
+
+	/* MDIO Interface */
+	ath79_register_mdio(0, 0x0);
+	ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 |
+				   AR934X_ETH_CFG_RXD_DELAY |
+				   AR934X_ETH_CFG_RDV_DELAY);
+
+	/* GMAC0 is connected to the RGMII interface to an Atheros AR8035-A */
+	ath79_init_mac(ath79_eth0_data.mac_addr,
+		       base + HIVEAP_121_MAC_OFFSET, 0);
+	ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
+	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+	ath79_eth0_data.phy_mask = BIT(HIVEAP_121_LAN_PHYADDR);
+	ath79_eth0_pll_data.pll_1000 = 0x0e000000;
+	ath79_eth0_pll_data.pll_100 = 0x00000101;
+	ath79_eth0_pll_data.pll_10 = 0x00001313;
+	ath79_register_eth(0);
+
+	/* i2c */
+	ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE);
+	platform_device_register(&hiveap_121_i2c_gpio_device);
+
+	/* TPM */
+	i2c_register_board_info(0, tpm_i2c_info, ARRAY_SIZE(tpm_i2c_info));
+
+	/* LEDs and Buttons */
+	ath79_register_leds_gpio(-1, ARRAY_SIZE(hiveap_121_leds_gpio),
+				 hiveap_121_leds_gpio);
+	ath79_register_gpio_keys_polled(-1, HIVEAP_121_KEYS_POLL_INTERVAL,
+					ARRAY_SIZE(hiveap_121_gpio_keys),
+					hiveap_121_gpio_keys);
+
+	/* USB */
+	gpio_request_one(HIVEAP_121_GPIO_USB_POWER,
+			 GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+			 "USB power");
+	ath79_register_usb();
+
+	/* XLNA - SoC Wireless */
+	ath79_wmac_set_ext_lna_gpio(0, HIVEAP_121_GPIO_XLNA0);
+	ath79_wmac_set_ext_lna_gpio(1, HIVEAP_121_GPIO_XLNA1);
+
+	/* SoC Wireless */
+	ath79_init_mac(wlan0_mac, base + HIVEAP_121_MAC_OFFSET, 1);
+	ath79_register_wmac(NULL, wlan0_mac); /* Caldata in OTP */
+
+	/* PCIe Wireless */
+	ath79_init_mac(wlan1_mac, base + HIVEAP_121_MAC_OFFSET, 2);
+	ap91_pci_init(NULL, wlan1_mac); /* Caldata in OTP */
+}
+
+MIPS_MACHINE(ATH79_MACH_HIVEAP_121, "HiveAP-121", "Aerohive HiveAP-121",
+	     hiveap_121_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 4f0ae32..18033ac 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -109,6 +109,7 @@ enum ath79_mach_type {
 	ATH79_MACH_GL_MIFI,			/* GL-MIFI support */
 	ATH79_MACH_GS_MINIBOX_V1,		/* Gainstrong MiniBox V1.0 */
 	ATH79_MACH_GS_OOLITE,			/* GS OOLITE V1.0 */
+	ATH79_MACH_HIVEAP_121,			/* Aerohive HiveAP-121*/
 	ATH79_MACH_HIWIFI_HC6361,		/* HiWiFi HC6361 */
 	ATH79_MACH_HORNET_UB,			/* ALFA Networks Hornet-UB */
 	ATH79_MACH_JA76PF,			/* jjPlus JA76PF */
diff --git a/target/linux/ar71xx/image/nand.mk b/target/linux/ar71xx/image/nand.mk
index dfe78c2..8f84b0c 100644
--- a/target/linux/ar71xx/image/nand.mk
+++ b/target/linux/ar71xx/image/nand.mk
@@ -23,6 +23,24 @@ define Device/domywifi-dw33d
 endef
 TARGET_DEVICES += domywifi-dw33d
 
+define Device/hiveap-121
+  DEVICE_TITLE := Aerohive HiveAP-121
+  DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-i2c-gpio-custom kmod-spi-gpio kmod-ath9k kmod-tpm-i2c-atmel
+  BOARDNAME = HiveAP-121
+  BLOCKSIZE := 128k
+  PAGESIZE := 2048
+  IMAGE_SIZE := 115m
+  KERNEL_SIZE := 5120k
+  UBINIZE_OPTS := -E 5
+  CONSOLE = ttyS0,9600
+  MTDPARTS = spi0.0:512k(u-boot)ro,64k(u-boot-env),64k(hw-info)ro,64k(boot-info)ro,64k(boot-sinfo)ro;ar934x-nfc:4096k(u-boot-1),4096k(u-boot-env-1),5m(kernel),111m(ubi),4096k(wifi-info)ro
+  IMAGES := sysupgrade.tar factory.bin
+  KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma
+  IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | check-size $$$$(IMAGE_SIZE)
+  IMAGE/sysupgrade.tar := sysupgrade-tar
+endef
+TARGET_DEVICES += hiveap-121
+
 define Build/MerakiNAND
 	-$(STAGING_DIR_HOST)/bin/mkmerakifw \
 		-B $(BOARDNAME) -s \
diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default
index 9b57f90..f744da8 100644
--- a/target/linux/ar71xx/nand/config-default
+++ b/target/linux/ar71xx/nand/config-default
@@ -76,6 +76,7 @@
 # CONFIG_ATH79_MACH_GL_MIFI is not set
 # CONFIG_ATH79_MACH_GS_MINIBOX_V1 is not set
 # CONFIG_ATH79_MACH_GS_OOLITE is not set
+CONFIG_ATH79_MACH_HIVEAP_121=y
 # CONFIG_ATH79_MACH_HIWIFI_HC6361 is not set
 # CONFIG_ATH79_MACH_HORNET_UB is not set
 # CONFIG_ATH79_MACH_JA76PF is not set



More information about the lede-commits mailing list