From patchwork Tue Dec 26 11:34:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Kuzov X-Patchwork-Id: 852959 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="XUZF0B02"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="RfVwVV4U"; 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 3z5Yp32RtRz9s75 for ; Tue, 26 Dec 2017 22:35:55 +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:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=glTiyJOrSK+r8pIzAAKxk1cwIq87ysTPtJlvBBILToQ=; b=XUZF0B02LvXHEJ oZsi/FmIiTLeDr7u5uFXVHMQNK4EDp2qQB9KtmJM8myWkd1Vp37biR9ziq9ZoT2MBoEMiJmTZxcsg J8qLsd4MWbTXw/zaxTCi9+5Lrq01+qN3T53Cv+IGHYwLcFIPT6eeaVXYEhKi0LAfbO6iR+3sk6VIh pda6m44UwH5f2vEMNsXlc4M204BtDolnGzCRJlCFiZyDyC4xwN2dLbLM86IzVz2rD0oBzPRhsjlhJ SehUtS5E2C3pScQBkGvd5tb1I8V3hYNkTNyKU62ocC/gve+WTI++KRznUYZCTstDKt1eMKH4g7Ajy tiE90q5WgdPFVNMLqhqQ==; 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 1eTnWR-0008W8-B4; Tue, 26 Dec 2017 11:35:51 +0000 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eTnVw-0007hT-7B for lede-dev@lists.infradead.org; Tue, 26 Dec 2017 11:35:23 +0000 Received: by mail-lf0-x244.google.com with SMTP id f3so3227436lfe.4 for ; Tue, 26 Dec 2017 03:35:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cctBQkxjzvXPNc+EVFIartPuSOW2uW67mptuQb9e5aY=; b=RfVwVV4UkL17pK5g9AWM6Kb1plZBC43Qce/a6ISFgRonWShGFREuilBG5s/lKkAhSt UIB+yjx8Buqnhzf+Pv9JM0ytTsY6P25v9KHFlPplcfL9wpmjba9GBIvSLM+e6fUy6H6w 4+AaZEAJOAapqL1ARMP0ave9YkoVYQaKZhS/P70AU9I8gJ3nzowUsMEi7qWFhRYeaeYd EG8GBK6b5Hhcv0BHCLwJ2ffiaZkd4awzSI2vTRcA37Sfe92u0ED8BcgsEDeCkNBSPXa9 aZekmWCzzNJdXZS9PpspTfAbG2G9LUGjUiuR7bZ8FxhpA4gyOhA1yB8W2oEKHniRrT1S 5lVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cctBQkxjzvXPNc+EVFIartPuSOW2uW67mptuQb9e5aY=; b=VKKUglULcKKvPbPlFi7JNUA8zdvFKB0eGJByPRrU8RjqRgrV5qHWT7Xa3bSexrnBoC 6ncKqJd6kpWzXxtKZy9LN8zBtqr0/OnVsdq2Tl3GG4Gsfl01ohqsfyRP5YwUodH08vMM CfpyrL9m6bbJCZmjc5fcY9Lu/bc21MAPt2XBBQbIH0vBCQkqh4OAuFwJ4aeYRdOwcJ2t Zto/DHvrgEIf2REdPkm9Uyrh0CzXDGv0Qz7lsI7eNG4vC1dI7ib7HfFPhPg+5iqhpk7M A8COAl5jkafcqoxgsXuFCRcInNA6RiODkncriQkjO+eamFK58X5DhcZ51zhnII09+NJV yWTQ== X-Gm-Message-State: AKGB3mJKpsFTNoERrU6eyZcTfLtOf1RfVQoquPviHqLdEmS197pd0LjJ SsU6gCg1vj2Hxo/5IG2dau/G6A== X-Google-Smtp-Source: ACJfBouB1+RTmxqLnwTsE5csjPfN0jDe4JQ06v2E2wLMqiUxtiTvlyLNWmdAZMbQqmuwWzB1mI/A9A== X-Received: by 10.46.82.89 with SMTP id g86mr14616962ljb.131.1514288107744; Tue, 26 Dec 2017 03:35:07 -0800 (PST) Received: from work.g0x.ru ([37.44.44.156]) by smtp.gmail.com with ESMTPSA id 72sm5975624ljz.31.2017.12.26.03.35.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Dec 2017 03:35:07 -0800 (PST) From: Konstantin Kuzov To: lede-dev@lists.infradead.org Date: Tue, 26 Dec 2017 14:34:35 +0300 Message-Id: <20171226113435.19263-2-master.nosferatu@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171226113435.19263-1-master.nosferatu@gmail.com> References: <20171226113435.19263-1-master.nosferatu@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171226_033520_332502_126C4024 X-CRM114-Status: GOOD ( 19.76 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:4010:c07:0:0:0:244 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (master.nosferatu[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Subject: [LEDE-DEV] [PATCH 2/2] ar71xx: add support for D-Link DIR-632 A1 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: Konstantin Kuzov MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Also enable second mdio bus with internal switch for AR7242 in ag71xx. It is required for this board's wan to function properly. Hardware specification: CPU: AR7242 RAM: 32MB Storage: 8MB Switch: RTL8309G Switch2: S26, internal Ethernet: 9 x 100Mb USB: 1 x 2.0 WiSoC: AR9287 Signed-off-by: Konstantin Kuzov --- target/linux/ar71xx/base-files/etc/board.d/01_leds | 5 + .../linux/ar71xx/base-files/etc/board.d/02_network | 7 + target/linux/ar71xx/base-files/etc/diag.sh | 1 + .../etc/uci-defaults/03_network-switchX-migration | 1 + target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 + .../ar71xx/base-files/lib/upgrade/platform.sh | 1 + target/linux/ar71xx/config-4.4 | 1 + target/linux/ar71xx/config-4.9 | 1 + .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt | 11 ++ target/linux/ar71xx/files/arch/mips/ath79/Makefile | 1 + .../linux/ar71xx/files/arch/mips/ath79/dev-eth.c | 16 +- .../ar71xx/files/arch/mips/ath79/mach-dir-632-a1.c | 180 +++++++++++++++++++++ .../linux/ar71xx/files/arch/mips/ath79/machtypes.h | 1 + .../net/ethernet/atheros/ag71xx/ag71xx_ar7240.c | 2 +- target/linux/ar71xx/image/legacy-devices.mk | 6 + target/linux/ar71xx/image/legacy.mk | 7 + target/linux/ar71xx/mikrotik/config-default | 1 + target/linux/ar71xx/nand/config-default | 1 + 18 files changed, 240 insertions(+), 6 deletions(-) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-dir-632-a1.c 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 e5baa90db8..75375c32e9 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds @@ -357,6 +357,11 @@ dir-615-c1) ucidef_set_led_netdev "wan" "WAN" "d-link:green:wan" "eth1" ucidef_set_led_wlan "wlan" "WLAN" "d-link:green:wlan" "phy0tpt" ;; +dir-632-a1) + ucidef_set_led_usbdev "usb" "USB" "d-link:green:usb" "1-1" + ucidef_set_led_netdev "wan" "WAN" "d-link:green:wan" "eth1" + ucidef_set_led_wlan "wlan" "WLAN" "d-link:green:wireless" "phy0tpt" + ;; dir-825-b1|\ dir-825-c1) ucidef_set_led_usbdev "usb" "USB" "d-link:blue:usb" "1-1" 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..89e658b75d 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/02_network +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network @@ -58,6 +58,13 @@ ar71xx_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" ;; + dir-632-a1) + ucidef_set_interfaces_lan_wan "eth0.1" "eth1.1" + ucidef_add_switch "switch0" \ + "8@eth0" "0:lan" "1:lan" "2:lan" "3:lan" "4:lan" "5:lan" "6:lan" "7:lan" + ucidef_add_switch "switch1" \ + "0@eth1" "1:wan" + ;; alfa-ap120c|\ all0305|\ antminer-s1|\ diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index 6cbb3576d8..55ec822ffd 100644 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -144,6 +144,7 @@ get_status_led() { dir-600-a1|\ dir-615-e1|\ dir-615-i1|\ + dir-632-a1|\ dir-615-e4) status_led="d-link:green:power" ;; diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration b/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration index 29fdde40a0..908c896bca 100644 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration @@ -85,6 +85,7 @@ rb-450) ;; db120|\ +dir-632-a1|\ rb-2011il|\ rb-2011l|\ rb-2011uas-2hnd) diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index b5440230a5..7ef1b4da57 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -579,6 +579,9 @@ ar71xx_board_detect() { *"DIR-615 rev. I1") name="dir-615-i1" ;; + *"DIR-632 rev. A1") + name="dir-632-a1" + ;; *"DIR-825 rev. B1") name="dir-825-b1" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index ecf6820a2b..73bbde4a94 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -224,6 +224,7 @@ platform_check_image() { dir-615-e1|\ dir-615-e4|\ dir-615-i1|\ + dir-632-a1|\ dir-825-c1|\ dir-835-a1|\ dlan-hotspot|\ diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4 index d8684dcc97..e1a0af2c9b 100644 --- a/target/linux/ar71xx/config-4.4 +++ b/target/linux/ar71xx/config-4.4 @@ -88,6 +88,7 @@ CONFIG_ATH79_MACH_DIR_505_A1=y CONFIG_ATH79_MACH_DIR_600_A1=y CONFIG_ATH79_MACH_DIR_615_C1=y CONFIG_ATH79_MACH_DIR_615_I1=y +CONFIG_ATH79_MACH_DIR_632_A1=y CONFIG_ATH79_MACH_DIR_825_B1=y CONFIG_ATH79_MACH_DIR_825_C1=y CONFIG_ATH79_MACH_DIR_869_A1=y diff --git a/target/linux/ar71xx/config-4.9 b/target/linux/ar71xx/config-4.9 index c4939d4312..3f126faa8b 100644 --- a/target/linux/ar71xx/config-4.9 +++ b/target/linux/ar71xx/config-4.9 @@ -86,6 +86,7 @@ CONFIG_ATH79_MACH_DIR_505_A1=y CONFIG_ATH79_MACH_DIR_600_A1=y CONFIG_ATH79_MACH_DIR_615_C1=y CONFIG_ATH79_MACH_DIR_615_I1=y +CONFIG_ATH79_MACH_DIR_632_A1=y CONFIG_ATH79_MACH_DIR_825_B1=y CONFIG_ATH79_MACH_DIR_825_C1=y CONFIG_ATH79_MACH_DIR_869_A1=y diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt index 1198fcb74b..54a4f96950 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt +++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt @@ -561,6 +561,17 @@ config ATH79_MACH_DIR_615_I1 select ATH79_DEV_M25P80 select ATH79_DEV_WMAC +config ATH79_MACH_DIR_632_A1 + bool "D-Link DIR-632 A1 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 + select ATH79_DEV_USB + select ATH79_NVRAM + config ATH79_MACH_DIR_825_B1 bool "D-Link DIR-825 rev. B1 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..ee30a96757 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile +++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile @@ -95,6 +95,7 @@ obj-$(CONFIG_ATH79_MACH_DIR_505_A1) += mach-dir-505-a1.o obj-$(CONFIG_ATH79_MACH_DIR_600_A1) += mach-dir-600-a1.o obj-$(CONFIG_ATH79_MACH_DIR_615_C1) += mach-dir-615-c1.o obj-$(CONFIG_ATH79_MACH_DIR_615_I1) += mach-dir-615-i1.o +obj-$(CONFIG_ATH79_MACH_DIR_632_A1) += mach-dir-632-a1.o obj-$(CONFIG_ATH79_MACH_DIR_825_B1) += mach-dir-825-b1.o obj-$(CONFIG_ATH79_MACH_DIR_825_C1) += mach-dir-825-c1.o obj-$(CONFIG_ATH79_MACH_DIR_869_A1) += mach-dir-869-a1.o diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c index a8b19b68b2..791a91caf3 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c @@ -182,6 +182,7 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) if (ath79_soc == ATH79_SOC_AR9341 || ath79_soc == ATH79_SOC_AR9342 || ath79_soc == ATH79_SOC_AR9344 || + ath79_soc == ATH79_SOC_AR7242 || ath79_soc == ATH79_SOC_QCA9556 || ath79_soc == ATH79_SOC_QCA9558 || ath79_soc == ATH79_SOC_QCA956X) @@ -204,6 +205,11 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) mdio_data = &ath79_mdio1_data; break; + case ATH79_SOC_AR7242: + ath79_set_pll(AR71XX_PLL_REG_SEC_CONFIG, + AR7242_PLL_REG_ETH0_INT_CLOCK, 0x62000000, + AR71XX_ETH0_PLL_SHIFT); + /* fall through */ case ATH79_SOC_AR9341: case ATH79_SOC_AR9342: case ATH79_SOC_AR9344: @@ -219,11 +225,6 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) } break; - case ATH79_SOC_AR7242: - ath79_set_pll(AR71XX_PLL_REG_SEC_CONFIG, - AR7242_PLL_REG_ETH0_INT_CLOCK, 0x62000000, - AR71XX_ETH0_PLL_SHIFT); - /* fall through */ default: mdio_dev = &ath79_mdio0_device; mdio_data = &ath79_mdio0_data; @@ -240,6 +241,11 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) mdio_data->builtin_switch = 1; break; + case ATH79_SOC_AR7242: + if (id == 1) + mdio_data->builtin_switch = 1; + break; + case ATH79_SOC_AR9330: mdio_data->is_ar9330 = 1; /* fall through */ diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-632-a1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-632-a1.c new file mode 100644 index 0000000000..b49f087afe --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-632-a1.c @@ -0,0 +1,180 @@ +/* + * D-Link DIR-632 rev. A1 board support + * + * Copyright (C) 2017 Konstantin Kuzov + * + * 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 +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include + +#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 "dev-wmac.h" +#include "dev-usb.h" +#include "machtypes.h" +#include "nvram.h" + +#define DIR_632_A1_GPIO_LED_WPS 0 +#define DIR_632_A1_GPIO_LED_POWER_AMBER 1 +#define DIR_632_A1_GPIO_LED_POWER_GREEN 6 +#define DIR_632_A1_GPIO_LED_WAN_AMBER 7 +#define DIR_632_A1_GPIO_LED_WAN_GREEN 17 + +#define DIR_632_A1_GPIO_LED_USB 11 +#define DIR_632_A1_GPIO_LED_WLAN 0 + +#define DIR_632_A1_GPIO_BTN_RESET 8 +#define DIR_632_A1_GPIO_BTN_WPS 12 + +#define DIR_632_A1_KEYS_POLL_INTERVAL 20 /* msecs */ +#define DIR_632_A1_KEYS_DEBOUNCE_INTERVAL (3 * DIR_632_A1_KEYS_POLL_INTERVAL) + +#define DIR_632_A1_NVRAM_ADDR 0x1ffe0000 +#define DIR_632_A1_NVRAM_SIZE 0x10000 + +#define DIR_632_A1_MAC_ADDR 0x1ffb0000 +#define DIR_632_A1_ART_ADDR 0x1fff0000 +#define DIR_632_A1_EEPROM_ADDR 0x1fff1000 + +#define DIR_632_A1_MAC0_OFFSET 0 +#define DIR_632_A1_MAC1_OFFSET 6 + +#define DIR_632A1_LAN_PHYMASK BIT(8) +#define DIR_632A1_WAN_PHYMASK BIT(0) + +#define AR724X_GPIO_FUNCTION_PCIEPHY_TST_EN BIT(16) +#define AR724X_GPIO_FUNCTION_CLK_OBS6_ENABLE BIT(20) + +static struct gpio_led dir_632_a1_leds_gpio[] __initdata = { + { + .name = "d-link:green:power", + .gpio = DIR_632_A1_GPIO_LED_POWER_GREEN, + }, { + .name = "d-link:amber:power", + .gpio = DIR_632_A1_GPIO_LED_POWER_AMBER, + }, { + .name = "d-link:amber:wan", + .gpio = DIR_632_A1_GPIO_LED_WAN_AMBER, + }, { + .name = "d-link:green:wan", + .gpio = DIR_632_A1_GPIO_LED_WAN_GREEN, + .active_low = 1, + }, { + .name = "d-link:blue:wps", + .gpio = DIR_632_A1_GPIO_LED_WPS, + .active_low = 1, + }, { + .name = "d-link:green:usb", + .gpio = DIR_632_A1_GPIO_LED_USB, + .active_low = 1, + } +}; + +static struct gpio_keys_button dir_632_a1_gpio_keys[] __initdata = { + { + .desc = "reset", + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = DIR_632_A1_KEYS_DEBOUNCE_INTERVAL, + .gpio = DIR_632_A1_GPIO_BTN_RESET, + .active_low = 1, + }, { + .desc = "wps", + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = DIR_632_A1_KEYS_DEBOUNCE_INTERVAL, + .gpio = DIR_632_A1_GPIO_BTN_WPS, + .active_low = 1, + } +}; + +static struct flash_platform_data dir_632_a1_flash_data = { + .type = "mx25l6405d", +}; + +static void __init dir_632_a1_setup(void) +{ + const char *nvram = (char *) KSEG1ADDR(DIR_632_A1_NVRAM_ADDR); + u8 *ee = (u8*)KSEG1ADDR(DIR_632_A1_EEPROM_ADDR); + u8 *art = (u8*)KSEG1ADDR(DIR_632_A1_ART_ADDR); + u8 *mac = (u8*)KSEG1ADDR(DIR_632_A1_MAC_ADDR); + u8 mac_buff[6]; + + ath79_register_m25p80(&dir_632_a1_flash_data); + + /* Make LEDs on GPIO6/7 work */ + ath79_gpio_function_enable(AR724X_GPIO_FUNC_JTAG_DISABLE); + + ath79_gpio_function_disable( + AR71XX_GPIO_FUNC_STEREO_EN | + AR724X_GPIO_FUNCTION_CLK_OBS6_ENABLE | + AR724X_GPIO_FUNC_UART_RTS_CTS_EN | + AR724X_GPIO_FUNCTION_PCIEPHY_TST_EN | + AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | + AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | + AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | + AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | + AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); + + ath79_register_leds_gpio(-1, ARRAY_SIZE(dir_632_a1_leds_gpio), + dir_632_a1_leds_gpio); + + ath79_register_gpio_keys_polled(-1, DIR_632_A1_KEYS_POLL_INTERVAL, + ARRAY_SIZE(dir_632_a1_gpio_keys), + dir_632_a1_gpio_keys); + + if (ath79_nvram_parse_mac_addr(nvram, DIR_632_A1_NVRAM_SIZE, + "ath0_hwaddr=", mac_buff) == 0) { + mac = mac_buff; + pr_info("dir_632_a1_setup(): NVRAM ath0_hwaddr=%pM", mac); + } + + ath79_register_mdio(0, ~(DIR_632A1_LAN_PHYMASK)); + ath79_register_mdio(1, ~(DIR_632A1_WAN_PHYMASK)); + + ath79_switch_data.phy4_mii_en = 1; + ath79_switch_data.phy_poll_mask |= DIR_632A1_LAN_PHYMASK; + + ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); + ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev; + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; + ath79_eth0_data.phy_mask = DIR_632A1_LAN_PHYMASK; + ath79_eth0_data.speed = SPEED_100; + ath79_eth0_data.duplex = DUPLEX_FULL; + ath79_register_eth(0); + + ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1); + ath79_eth1_data.mii_bus_dev = &ath79_mdio1_device.dev; + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; + ath79_eth1_data.phy_mask = DIR_632A1_WAN_PHYMASK; + ath79_eth1_data.switch_data = &ath79_switch_data; + ath79_register_eth(1); + + ath79_register_usb(); + + ap9x_pci_setup_wmac_led_pin(0, DIR_632_A1_GPIO_LED_WLAN); + ap91_pci_init(ee, art); +} + +MIPS_MACHINE(ATH79_MACH_DIR_632_A1, "DIR-632-A1", "D-Link DIR-632 rev. A1", + dir_632_a1_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..d8eb942f0d 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h @@ -84,6 +84,7 @@ enum ath79_mach_type { ATH79_MACH_DIR_615_E1, /* D-Link DIR-615 rev. E1 */ ATH79_MACH_DIR_615_E4, /* D-Link DIR-615 rev. E4 */ ATH79_MACH_DIR_615_I1, /* D-Link DIR-615 rev. I1 */ + ATH79_MACH_DIR_632_A1, /* D-Link DIR-632 rev. A1 */ ATH79_MACH_DIR_825_B1, /* D-Link DIR-825 rev. B1 */ ATH79_MACH_DIR_825_C1, /* D-Link DIR-825 rev. C1 */ ATH79_MACH_DIR_835_A1, /* D-Link DIR-835 rev. A1 */ diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c index 3f2f64e2ae..18c8df23fd 100644 --- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c +++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c @@ -1248,7 +1248,7 @@ static struct ar7240sw *ar7240_probe(struct ag71xx *ag) AR7240_MASK_CTRL_VERSION_M; if (sw_is_ar7240(as)) { - swdev->name = "AR7240/AR9330 built-in switch"; + swdev->name = "AR7240/AR7242/AR9330 built-in switch"; swdev->ports = AR7240_NUM_PORTS - 1; } else if (sw_is_ar934x(as)) { swdev->name = "AR934X built-in switch"; diff --git a/target/linux/ar71xx/image/legacy-devices.mk b/target/linux/ar71xx/image/legacy-devices.mk index e418282dd0..c71ba734cc 100644 --- a/target/linux/ar71xx/image/legacy-devices.mk +++ b/target/linux/ar71xx/image/legacy-devices.mk @@ -206,6 +206,12 @@ define LegacyDevice/DIR615C1 endef LEGACY_DEVICES += DIR615C1 +define LegacyDevice/DIR632A1 + DEVICE_TITLE := D-Link DIR-632 rev. A1 + DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport +endef +LEGACY_DEVICES += DIR632A1 + define LegacyDevice/TEW632BRP DEVICE_TITLE := TRENDNet TEW-632BRP endef diff --git a/target/linux/ar71xx/image/legacy.mk b/target/linux/ar71xx/image/legacy.mk index 01d7e50631..6c191fbd62 100644 --- a/target/linux/ar71xx/image/legacy.mk +++ b/target/linux/ar71xx/image/legacy.mk @@ -241,6 +241,7 @@ bxu2000n2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1408k(kerne cameo_ap81_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(config)ro,3840k(firmware),64k(art)ro cameo_ap91_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,3712k(firmware),64k(mac)ro,64k(art)ro cameo_ap99_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,3520k(firmware),64k(mac)ro,192k(lp)ro,64k(art)ro +cameo_ap101_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(nvram)ro,7552k(firmware),64k(mac)ro,192k(lp)ro,64k(art)ro cameo_ap121_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,64k(mac)ro,64k(nvram)ro,192k(language)ro,3648k(firmware) cameo_ap121_mtdlayout_8M=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,64k(mac)ro,64k(nvram)ro,256k(language)ro,7680k@0x80000(firmware) cameo_ap123_mtdlayout_4M=mtdparts=spi0.0:64k(u-boot)ro,64k(nvram)ro,3712k(firmware),192k(lang)ro,64k(art)ro @@ -409,6 +410,10 @@ Image/Build/CameoAP99/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap99_mtd Image/Build/CameoAP99=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_ap99_mtdlayout),$(4),65536) Image/Build/CameoAP99/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap99_mtdlayout)) +Image/Build/CameoAP101/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap101_mtdlayout)) +Image/Build/CameoAP101=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_ap101_mtdlayout),$(4),65536) +Image/Build/CameoAP101/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap101_mtdlayout)) + Image/Build/CameoAP123_4M/buildkernel=$(call MkuImageLzma,$(2),$(3) $(cameo_ap123_mtdlayout_4M)) Image/Build/CameoAP123_4M=$(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo_ap123_mtdlayout_4M),$(4),26) Image/Build/CameoAP123_4M/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(cameo_ap123_mtdlayout_4M)) @@ -909,6 +914,8 @@ $(eval $(call SingleProfile,CameoAP99,64kraw,EBR2310C1,ebr-2310-c1,EBR-2310-C1,t $(eval $(call SingleProfile,CameoAP99,64kraw,DIR615E1,dir-615-e1,DIR-615-E1,ttyS0,115200,"AP93-AR7240-RT-081028-00")) $(eval $(call SingleProfile,CameoAP99,64kraw,DIR615E4,dir-615-e4,DIR-615-E4,ttyS0,115200,"AP99-AR7240-RT-091105-05")) +$(eval $(call SingleProfile,CameoAP101,64kraw,DIR632A1,dir-632-a1,DIR-632-A1,ttyS0,115200,"A101-AR7242-RT-100324-02")) + $(eval $(call SingleProfile,CameoAP123_4M,64kraw,DIR615I1,dir-615-i1,DIR-615-I1,ttyS0,115200,"00DB120AR9341-RT-1012I1-00")) $(eval $(call SingleProfile,CameoAP123_4M,64kraw,DIR615I3,dir-615-i3,DIR-615-I1,ttyS0,115200,"00DB120AR9341-RT-101214-00")) diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default index b67fca1f14..d7c4d63483 100644 --- a/target/linux/ar71xx/mikrotik/config-default +++ b/target/linux/ar71xx/mikrotik/config-default @@ -53,6 +53,7 @@ # CONFIG_ATH79_MACH_DIR_600_A1 is not set # CONFIG_ATH79_MACH_DIR_615_C1 is not set # CONFIG_ATH79_MACH_DIR_615_I1 is not set +# CONFIG_ATH79_MACH_DIR_632_A1 is not set # CONFIG_ATH79_MACH_DIR_825_B1 is not set # CONFIG_ATH79_MACH_DIR_825_C1 is not set # CONFIG_ATH79_MACH_DIR_869_A1 is not set diff --git a/target/linux/ar71xx/nand/config-default b/target/linux/ar71xx/nand/config-default index f7c54e7d3c..1c618a0752 100644 --- a/target/linux/ar71xx/nand/config-default +++ b/target/linux/ar71xx/nand/config-default @@ -53,6 +53,7 @@ CONFIG_ATH79_MACH_C60=y # CONFIG_ATH79_MACH_DIR_600_A1 is not set # CONFIG_ATH79_MACH_DIR_615_C1 is not set # CONFIG_ATH79_MACH_DIR_615_I1 is not set +# CONFIG_ATH79_MACH_DIR_632_A1 is not set # CONFIG_ATH79_MACH_DIR_825_B1 is not set # CONFIG_ATH79_MACH_DIR_825_C1 is not set # CONFIG_ATH79_MACH_DIR_869_A1 is not set