From patchwork Sat Mar 5 15:53:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weijie Gao X-Patchwork-Id: 592393 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (caladan.dune.hu [78.24.191.180]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 814EC14016A for ; Sun, 6 Mar 2016 02:54:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=DqrT0j9S; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 0B631B92251; Sat, 5 Mar 2016 16:53:50 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP; Sat, 5 Mar 2016 16:53:50 +0100 (CET) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 43440B921FF for ; Sat, 5 Mar 2016 16:53:27 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 CL_IP_EQ_HELO_IP=-2 (check from: .gmail. - helo: .mail-pf0-f169.google. - helo-domain: .google.) FROM/MX_MATCHES_HELO(DOMAIN)=-2; rate: -7 Received: from mail-pf0-f169.google.com (mail-pf0-f169.google.com [209.85.192.169]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Sat, 5 Mar 2016 16:53:26 +0100 (CET) Received: by mail-pf0-f169.google.com with SMTP id 124so53580562pfg.0 for ; Sat, 05 Mar 2016 07:53:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=h14vZwfUYgsM/dGH6YAandYPzjt1MJYrp0tuxC18jHY=; b=DqrT0j9SZNsuTc/+fOumQByFxJi0QVuykhUNLPgkBV8/zlwPoUY/6S+I45wrG0NhAL VMF54lEQLoCs4gYLO0GtWgDSY3KVG3BjldoxIVTXBIP/WXVRuFm3uNS1BXwEhMyEawTw Cu7NAJsH5sQ9H/rIEHsu66eeZ4tQ6PmrBnhuuAKmOdwxH+fQ8srqaz9/BQb2x5LyDnO+ ZXs1XtI9YUZjTx6IIJFQE/Tk9gjmmkb5R48Z5CEi0tSF202mopoJdx44vheyWqt20GnK 7oodpisxjnUR9UgkIpFbs2WeXr5HyMIjfj951W1OU2x//RIwP0jkG31NzEDDKrZx0+KH XDdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=h14vZwfUYgsM/dGH6YAandYPzjt1MJYrp0tuxC18jHY=; b=KaUErA3ndw9u+fQ7WjyLpDg4vil/z1rQa9YuGcQHxvVD0sIBSyWVU5zxlHV08b80n9 x8r+Tpyq71Z8UgLfh9SZCP8YH0xpdDxOPV/kUza5Of6vtAKS04KouGZS8DFcnLjQDOsj e/IQJHZmnG8AF7z03hoHAHa/+O6TY8ItrIB4JujnP9C7FKbulbRVD0Rsv/OAU6FKmQVj koYrofamMViCj1Whg8ac1KXmtI8AOARzhZVUMYQQEB+087gpp11gCAhFeXQPFRsNPbgP 4FxgfWZSxZXepIv8S2gHxYnEQ9a+sZ/dAuWy341Ukf6mFNcsE70CVPNbUxpUqDnMGI+U jteQ== X-Gm-Message-State: AD7BkJI9z7fDPl85bXZRBXyBID18MziVg2Samw8fi0opXn6duxSsrgf8JJXgkNBmt4hTkQ== X-Received: by 10.98.16.69 with SMTP id y66mr20945960pfi.86.1457193205250; Sat, 05 Mar 2016 07:53:25 -0800 (PST) Received: from localhost ([2605:f700:40:c00::ab48:b246]) by smtp.gmail.com with ESMTPSA id ez6sm13301789pab.12.2016.03.05.07.53.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 Mar 2016 07:53:24 -0800 (PST) From: Weijie Gao To: openwrt-devel@lists.openwrt.org Date: Sat, 5 Mar 2016 23:53:14 +0800 Message-Id: <1457193194-1272-1-git-send-email-hackpascal@gmail.com> X-Mailer: git-send-email 2.5.0 Subject: [OpenWrt-Devel] [PATCH] ar71xx: fix qca956x ethernet initialization X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.20 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" Signed-off-by: Weijie Gao fix ticket #21520 --- target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) 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 12a376e..b43c80a 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c @@ -271,6 +271,7 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) case ATH79_SOC_QCA956X: if (id == 1) mdio_data->builtin_switch = 1; + mdio_data->is_ar934x = 1; break; default: @@ -1123,16 +1124,25 @@ void __init ath79_register_eth(unsigned int id) if (id == 0) { pdata->reset_bit = QCA955X_RESET_GE0_MAC | QCA955X_RESET_GE0_MDIO; + if (pdata->phy_if_mode == PHY_INTERFACE_MODE_SGMII) pdata->set_speed = qca956x_set_speed_sgmii; else - /* FIXME */ - pdata->set_speed = ath79_set_speed_dummy; + pdata->set_speed = ath79_set_speed_ge0; } else { pdata->reset_bit = QCA955X_RESET_GE1_MAC | QCA955X_RESET_GE1_MDIO; - /* FIXME */ + pdata->set_speed = ath79_set_speed_dummy; + + pdata->switch_data = &ath79_switch_data; + + pdata->speed = SPEED_1000; + pdata->duplex = DUPLEX_FULL; + + /* reset the built-in switch */ + ath79_device_reset_set(AR934X_RESET_ETH_SWITCH); + ath79_device_reset_clear(AR934X_RESET_ETH_SWITCH); } pdata->ddr_flush = ath79_ddr_no_flush; @@ -1196,6 +1206,11 @@ void __init ath79_register_eth(unsigned int id) /* don't assign any MDIO device by default */ break; + case ATH79_SOC_QCA956X: + if (pdata->phy_if_mode != PHY_INTERFACE_MODE_SGMII) + pdata->mii_bus_dev = &ath79_mdio1_device.dev; + break; + default: pdata->mii_bus_dev = &ath79_mdio0_device.dev; break;