From patchwork Wed Jan 17 13:23:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Zachlod X-Patchwork-Id: 862262 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IYQeB3Ha"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="t9XOisTi"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zM78R5gVmz9s7h for ; Thu, 18 Jan 2018 00:23:51 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:Message-Id: Date:To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=NEYAvJ9N2oA0I4hmiTP3UeqWNRH8My0NzefZAohCRBA=; b=IYQeB3HaXQPFM0 LEpj9yBZUO6/x8fUKZDG+vfPDqJKg1eH79xf2TWtJXzt8gjfWq/lCWqp2LEgVpynLr5+n0by/INex OJwYYQXoJ63bSBloP9rVj1LhywmAXLVfFYTjCewi0m0tLi4PcuVnco3arDHyh+sXyWU3cabNOOPmB vFFna/7dty/fnDoZd251Rv0hIQAlb0tcGAn0/DSdkkYh0olFb7eQsLabXlDU4AihFzw4F8d8IJoqw ZNR77T7KLaOA/nOPVmzYY2kxWEHvTNirUTVmfNZDSax5Q5mZOffHtGCVRnNEWLXR4QVRsCCEuK8HF W+nX7c8bgVZACKhJqiTA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ebngz-0002hn-Jm; Wed, 17 Jan 2018 13:23:49 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ebngy-0002hf-6S for lede-dev@bombadil.infradead.org; Wed, 17 Jan 2018 13:23:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=mquEPb4aJeI2JdsghD2kXxeRqwL/QqwY+F6iFx4VEkE=; b=t9XOisTiCjqgkS9o8oagR585F khZtcc30dgCdhlqGsACafIh2C5nH9ER7RTN4pmE+6pqQpXd7iv4LJ+oaugoMv+RZqUrBKYMrSor9r 54GcWTRYIydVvFzDEpdJJ5tft5JUQ7gP6PNFhgXPQD9gcXbRMNgSeK45AxewlhB79N3pmFnWsDXHW 8siqsT10vYOPJ0h2xyP8b13DHZbgzHTBGe+XTMjU4TChGZnurCUeXVPQMtge6xlvtm2bdl2EWDRrW iEsbmFqtxRuE3AnuYrhuPEtksRtBYXPpN+gxHPKpU45vxGzOmQ5gXGmIhxB4KPDwMMUuiQ7+NmzPM x7gsJTRKg==; Received: from mail.someserver.de ([31.15.66.35]) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ebngu-0007Gx-O8 for lede-dev@lists.infradead.org; Wed, 17 Jan 2018 13:23:46 +0000 Received: from genie.lan (p57AB4A90.dip0.t-ipconnect.de [87.171.74.144]) by mail.someserver.de (Postfix) with ESMTPSA id D09A0DDB2F; Wed, 17 Jan 2018 14:23:19 +0100 (CET) From: Arne Zachlod To: lede-dev@lists.infradead.org Date: Wed, 17 Jan 2018 14:23:14 +0100 Message-Id: <20180117132314.15786-1-arne@nerdkeller.org> X-Mailer: git-send-email 2.15.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180117_132344_811261_73E1B0BD X-CRM114-Status: GOOD ( 10.59 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Subject: [LEDE-DEV] [PATCH v2] ar71xx: add support for Ubiquiti Litebeam M5 X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arne Zachlod MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Specification: - SoC: Atheros AR9342 - Flash: 8 MiB - RAM: 64 MiB - UART: 1x UART on PCB - 115200 8N1 - Ethernet: 1 x 100 Mbit with passive PoE (24V/0.2A) Doesn't work: * Flash via TFTP with Uiquiti Uboot Installation via vendor firmware: - upload factory image via webinterface Signed-off-by: Arne Zachlod --- target/linux/ar71xx/base-files/etc/board.d/01_leds | 4 ++ .../linux/ar71xx/base-files/etc/board.d/02_network | 1 + target/linux/ar71xx/base-files/etc/diag.sh | 3 ++ target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 ++ .../ar71xx/base-files/lib/upgrade/platform.sh | 1 + .../ar71xx/files/arch/mips/ath79/mach-ubnt-xm.c | 58 ++++++++++++++++++++++ .../linux/ar71xx/files/arch/mips/ath79/machtypes.h | 1 + target/linux/ar71xx/image/ubnt.mk | 7 +++ 8 files changed, 78 insertions(+) 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 150ef91b48..ebdfb142d4 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds @@ -363,6 +363,10 @@ hornet-ub-x2) ucidef_set_led_wlan "wlan" "WLAN" "alfa:blue:wlan" "phy0tpt" ucidef_set_led_usbdev "usb" "USB" "alfa:blue:usb" "1-1" ;; +lbe-m5) + ucidef_set_led_netdev "lan" "LAN" "ubnt:green:lan" "eth0" + ucidef_set_led_wlan "wlan" "WLAN" "ubnt:green:wlan" "phy0tpt" + ;; mc-mac1200r) ucidef_set_led_wlan "wlan2g" "WLAN2G" "mercury:green:wlan2g" "phy1tpt" ucidef_set_led_wlan "wlan5g" "WLAN5G" "mercury:green:wlan5g" "phy0tpt" 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 fb61792bf4..86d6ffd91d 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/02_network +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network @@ -78,6 +78,7 @@ ar71xx_setup_interfaces() fritz300e|\ gl-usb150|\ hiveap-121|\ + lbe-m5|\ 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 5c60ebd6a8..5042e7a008 100644 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -236,6 +236,9 @@ get_status_led() { jwap230) status_led="$board:green:led1" ;; + lbe-m5) + status_led="ubnt:green:sys" + ;; 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 b5440230a5..00a4acc6e0 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -711,6 +711,9 @@ ar71xx_board_detect() { *"Lima"*) name="lima" ;; + *"Litebeam M5"*) + name="lbe-m5" + ;; *"Loco M XW") name="loco-m-xw" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index ecf6820a2b..4e839f12c1 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -248,6 +248,7 @@ platform_check_image() { hiwifi-hc6361|\ hornet-ub-x2|\ jwap230|\ + lbe-m5|\ lima|\ loco-m-xw|\ mzk-w04nu|\ diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-xm.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-xm.c index 55cf52d19e..8afb3ad054 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-xm.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-ubnt-xm.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -503,6 +504,60 @@ static void __init ubnt_loco_m_xw_setup(void) ath79_register_eth(0); } +#define UBNT_LBE_M5_GPIO_LED_LAN 13 +#define UBNT_LBE_M5_GPIO_LED_WLAN 14 +#define UBNT_LBE_M5_GPIO_LED_SYS 16 + +static struct gpio_led ubnt_lbe_m5_leds_gpio[] __initdata = { + { + .name = "ubnt:green:lan", + .gpio = UBNT_LBE_M5_GPIO_LED_LAN, + .active_low = 1, + }, { + .name = "ubnt:green:wlan", + .gpio = UBNT_LBE_M5_GPIO_LED_WLAN, + .active_low = 1, + }, { + .name = "ubnt:green:sys", + .gpio = UBNT_LBE_M5_GPIO_LED_SYS, + .active_low = 1, + }, +}; + +static void __init ubnt_lbe_m5_setup(void) +{ + u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); + + ath79_register_m25p80(NULL); + + ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL); + ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_lbe_m5_leds_gpio), + ubnt_lbe_m5_leds_gpio); + ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL, + ARRAY_SIZE(ubnt_xm_gpio_keys), + ubnt_xm_gpio_keys); + + ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_MII_GMAC0 | + AR934X_ETH_CFG_MII_GMAC0_SLAVE); + ath79_init_mac(ath79_eth0_data.mac_addr, + eeprom + UAP_PRO_MAC0_OFFSET, 0); + + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; + + gpio_request_one(0, GPIOF_OUT_INIT_LOW | GPIOF_ACTIVE_LOW | + GPIOF_EXPORT_DIR_FIXED, "SPI nWP"); + + mdiobus_register_board_info(ubnt_loco_m_xw_mdio_info, + ARRAY_SIZE(ubnt_loco_m_xw_mdio_info)); + + ath79_register_mdio(0, ~BIT(1)); + ath79_eth0_data.phy_mask = BIT(1); + ath79_register_eth(0); +} + static void __init ubnt_rocket_m_xw_setup(void) { u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000); @@ -590,6 +645,9 @@ static void __init ubnt_rocket_m_ti_setup(void) MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M_XW, "UBNT-NM-XW", "Ubiquiti Nanostation M XW", ubnt_nano_m_xw_setup); +MIPS_MACHINE(ATH79_MACH_UBNT_LBE_M5, "UBNT-LBE-M5", "Ubiquiti Litebeam M5", + ubnt_lbe_m5_setup); + MIPS_MACHINE(ATH79_MACH_UBNT_LOCO_M_XW, "UBNT-LOCO-XW", "Ubiquiti Loco M XW", ubnt_loco_m_xw_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..18604c7d00 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h @@ -282,6 +282,7 @@ enum ath79_mach_type { ATH79_MACH_UBNT_AIRGWP, /* Ubiquiti AirGateway Pro */ ATH79_MACH_UBNT_AIRROUTER, /* Ubiquiti AirRouter */ ATH79_MACH_UBNT_BULLET_M, /* Ubiquiti Bullet M */ + ATH79_MACH_UBNT_LBE_M5, /* Ubiquiti Litebeam M5 */ ATH79_MACH_UBNT_LOCO_M_XW, /* Ubiquiti Loco M XW */ ATH79_MACH_UBNT_LSSR71, /* Ubiquiti LS-SR71 */ ATH79_MACH_UBNT_LSX, /* Ubiquiti LSX */ diff --git a/target/linux/ar71xx/image/ubnt.mk b/target/linux/ar71xx/image/ubnt.mk index 2735c7491d..d24afc21be 100644 --- a/target/linux/ar71xx/image/ubnt.mk +++ b/target/linux/ar71xx/image/ubnt.mk @@ -157,6 +157,13 @@ define Device/ubnt-nano-m-xw endef TARGET_DEVICES += ubnt-nano-m-xw +define Device/ubnt-lbe-m5 + $(Device/ubnt-xw) + DEVICE_TITLE := Ubiquiti Litebeam M5 + BOARDNAME := UBNT-LBE-M5 +endef +TARGET_DEVICES += ubnt-lbe-m5 + define Device/ubnt-loco-m-xw $(Device/ubnt-xw) DEVICE_TITLE := Ubiquiti Loco XW