From patchwork Fri Mar 2 00:16:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Zachlod X-Patchwork-Id: 880187 X-Patchwork-Delegate: lynxis@fe80.eu 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=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=nerdkeller.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sE+xXYwZ"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::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 3zsqcb6Mqjz9s7F for ; Fri, 2 Mar 2018 11:17:19 +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=+V89Q9ODYILlM3PXF49LC1j7DelKO6AoKOKfXyilUyA=; b=sE+xXYwZ6K4tgl MRm11yn5BrCjHU/S46CQDUGrc9aL/dBQXEviYA77/klziyl3E+G7c9zwnuEBE3Rqm8d3yRJPAAVA+ g0kza9tgcUckMn3qnT6z+0nbsLjjMh0uEEEhwemmbhC6V3Y0mTeA6d0eiXRo9Pn2jfXcAHHe3aFam Gx+f9N9l0Wn5ZbMbEd4jMIpCPw/nKh0C5Uxzv/rKmmTcgWL5mldgjaUnVmV7zj/QRyVynIZ+5HPwT 4zrj8VbaDEa2sIGGb7iuR/cFJBDZK8oRkZ7EGl1QEz9/S98FyK7JNRi6ZVE0WreKYqKrX9wW9WLFl VkBCkVsCdfTaziEIzSIQ==; 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 1erYNg-0003vO-9I; Fri, 02 Mar 2018 00:17:00 +0000 Received: from mail.someserver.de ([31.15.66.35]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1erYNZ-0003sG-AR for lede-dev@lists.infradead.org; Fri, 02 Mar 2018 00:16:57 +0000 Received: from genie.lan (mue-88-130-100-229.dsl.tropolys.de [88.130.100.229]) by mail.someserver.de (Postfix) with ESMTPSA id 477D8F2F7A; Fri, 2 Mar 2018 01:16:39 +0100 (CET) From: Arne Zachlod To: lede-dev@lists.infradead.org Date: Fri, 2 Mar 2018 01:16:34 +0100 Message-Id: <20180302001634.23018-1-arne@nerdkeller.org> X-Mailer: git-send-email 2.16.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180301_161653_784194_649CBC44 X-CRM114-Status: GOOD ( 10.56 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Subject: [LEDE-DEV] [PATCH v3] 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/generic-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 00954dfaa4..7a8ed9afe5 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds @@ -408,6 +408,10 @@ hornet-ub-x2) lan-turtle) ucidef_set_led_netdev "wan" "WAN" "$board:orange:system" "eth1" ;; +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 8f492cbf02..560112756a 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/02_network +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network @@ -82,6 +82,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 6b53ad03c7..6ea4fb085c 100644 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -260,6 +260,9 @@ get_status_led() { lan-turtle) status_led="$board:orange:system" ;; + 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 01ac29601d..a7c2ccb52e 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() { *"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 7738db33a7..2b15dec5be 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -256,6 +256,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 46bc49458b..de7298f41c 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h @@ -303,6 +303,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/generic-ubnt.mk b/target/linux/ar71xx/image/generic-ubnt.mk index 66d7c52496..478ac3ea8b 100644 --- a/target/linux/ar71xx/image/generic-ubnt.mk +++ b/target/linux/ar71xx/image/generic-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