From patchwork Mon Apr 20 23:24:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael J. Bazzinotti" X-Patchwork-Id: 462934 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0BAD61401E7 for ; Tue, 21 Apr 2015 09:26:29 +1000 (AEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 934CB28BC51; Tue, 21 Apr 2015 01:24:30 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 5733C28BBD1 for ; Tue, 21 Apr 2015 01:24:10 +0200 (CEST) X-policyd-weight: using cached result; rate: -7.6 Received: from mx1.cs.umb.edu (mx1.cs.umb.edu [158.121.104.3]) by arrakis.dune.hu (Postfix) with ESMTP for ; Tue, 21 Apr 2015 01:24:08 +0200 (CEST) Received: from grn.cs.umb.edu (grn.cs.umb.edu [192.168.104.178]) by mx1.cs.umb.edu (8.12.11/8.12.8) with ESMTP id t3KNP3QU027350; Mon, 20 Apr 2015 19:25:03 -0400 (EDT) Received: by grn.cs.umb.edu (Postfix, from userid 7343) id 9C094462911; Mon, 20 Apr 2015 19:25:03 -0400 (EDT) From: "Michael J. Bazzinotti" To: openwrt-devel@lists.openwrt.org Date: Mon, 20 Apr 2015 19:24:15 -0400 Message-Id: <1429572262-20668-4-git-send-email-bazz@grn.cs.umb.edu> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1429572262-20668-1-git-send-email-bazz@grn.cs.umb.edu> References: <1429572262-20668-1-git-send-email-bazz@grn.cs.umb.edu> X-Scanned-By: MIMEDefang 2.65 on 192.168.104.3 Cc: "Michael J. Bazzinotti" Subject: [OpenWrt-Devel] [PATCH 04/11] ar71xx: fix ethernet on wnr2000-v4 X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" From: "Michael J. Bazzinotti" Most people report broken ethernet with upstream. Last year, user "franz.flasch" authored a working mach-file. His patch is outdated so I modernized it. Original patch and user commentary on page 1: https://forum.openwrt.org/viewtopic.php?pid=260861#p260861 I have figured out what the critical differences are between the two that caused upstream ethernet to break. 1) Both ath79_init_mac() functions calls must be invocated before any GMAC init 2) must init GMAC0 before GMAC1 That was enough to get upstream to function, but I wanted to enjoy my confidence having tested franz's patch for a week sucessfully, so I put his whole function in, which only features more differences in order of function calls. An expert should consider these changes, which could pose potential bugs/issues: 1) No longer using the flag AR934X_ETH_CFG_SW_PHY_SWAP in the ath79_setup_ar934x_eth_cfg() call. 2) Possible consequence of no longer explicitly setting ethernet duplex/speed. Review: With this patch, my ethernet and wireless works. Signed-off-by: Michael J. Bazzinotti --- .../ar71xx/files/arch/mips/ath79/mach-wnr2000-v4.c | 34 ++++++++-------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v4.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v4.c index 36896b7..df0bf0e 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v4.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2000-v4.c @@ -122,42 +122,32 @@ static struct gpio_keys_button wnr2000v4_gpio_keys[] __initdata = { static void __init wnr_common_setup(void) { u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - ath79_register_m25p80(NULL); - - ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE | - AR934X_ETH_CFG_SW_PHY_SWAP); + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); ath79_register_mdio(1, 0x0); - /* LAN */ - ath79_init_mac(ath79_eth1_data.mac_addr, art+WNR2000V4_MAC0_OFFSET, 0); + ath79_register_usb(); - /* GMAC1 is connected to the internal switch */ - ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; - ath79_register_eth(1); + ath79_register_m25p80(NULL); - /* WAN */ - ath79_init_mac(ath79_eth0_data.mac_addr, art+WNR2000V4_MAC1_OFFSET, 0); + ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE); - /* GMAC0 is connected to the PHY0 of the internal switch */ + ath79_init_mac(ath79_eth0_data.mac_addr, art+WNR2000V4_MAC0_OFFSET, 0); + ath79_init_mac(ath79_eth1_data.mac_addr, art+WNR2000V4_MAC1_OFFSET, 0); + + /* GMAC0 is connected to the PHY0 of the internal switch, GE0 */ ath79_switch_data.phy4_mii_en = 1; ath79_switch_data.phy_poll_mask = BIT(4); ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; ath79_eth0_data.phy_mask = BIT(4); ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev; - - ath79_eth0_data.speed = SPEED_100; - ath79_eth0_data.duplex = DUPLEX_FULL; - ath79_register_eth(0); - /* WLAN */ - ath79_register_wmac(ee, art+WNR2000V4_MAC0_OFFSET); + /* GMAC1 is connected to the internal switch, GE1 */ + ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII; + ath79_register_eth(1); - /* USB */ - ath79_register_usb(); + ath79_register_wmac(ee, art); } static void __init wnr2000v4_setup(void)