From patchwork Thu Mar 15 06:41:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SZ Lin X-Patchwork-Id: 10283943 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3AC7160386 for ; Thu, 15 Mar 2018 06:42:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AC352873B for ; Thu, 15 Mar 2018 06:42:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F49528740; Thu, 15 Mar 2018 06:42:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B84232873B for ; Thu, 15 Mar 2018 06:42:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751619AbeCOGmx (ORCPT ); Thu, 15 Mar 2018 02:42:53 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:45689 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751508AbeCOGmw (ORCPT ); Thu, 15 Mar 2018 02:42:52 -0400 Received: by mail-pf0-f194.google.com with SMTP id h19so2472614pfd.12; Wed, 14 Mar 2018 23:42:52 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=DsWiI2sbNirc+jojdGbR05A1QaF1h0XvLVucVKf3T08=; b=pMPQw8MO6ziHkG+HKIzpWEQL3YdObMxuktWNKjC49AFFhH0ZBP9hN0/7mQPC1bAiAP TWJvuai1k+Um/RZpH7sIuuvszhuN7U9i/xxowRRjQxnAbK7IuQI78r1DeEWTOGEptApJ fZFZSnB51Cttqqn0RUpWMvXO8u+I1sAVovJD1URnfHSC75jlzsNehPRDUOz9lwoxGfaE NL3Kt5LSwHcJ8IQZogZiV/r/+m6BI8wpIjHL19EQlHUeVlduCxVqZk0TE/jHHi3fmBcx 4N40kSltszGtp+6EfMrg0ZMje6BQlxakvCXj1EDFBQjP5XJJ/cKqlr3x2h8DaD/S+Vlk zMcw== X-Gm-Message-State: AElRT7HGEeYbdAu/860OVRcSwMznEHXtXDL/ZHBJSSQvfbaXX0aCL5cY WepApkT/dAWcpFyzvuBHKrI= X-Google-Smtp-Source: AG47ELvxfV3VW2Gr0fQT+n/A9FX0uEmYefuhWiDoqRkEgWFqgtj+WgTuSE/eTEfZDRJBea8MWOSqeQ== X-Received: by 10.99.151.26 with SMTP id n26mr5968272pge.370.1521096171742; Wed, 14 Mar 2018 23:42:51 -0700 (PDT) Received: from szlin-TW ([122.146.92.136]) by smtp.gmail.com with ESMTPSA id t20sm7934070pfh.182.2018.03.14.23.42.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 14 Mar 2018 23:42:50 -0700 (PDT) Received: from root by szlin-TW with local (Exim 4.90_1) (envelope-from ) id 1ewMbB-0001q8-Ea; Thu, 15 Mar 2018 14:42:49 +0800 From: =?UTF-8?q?SZ=20Lin=20=28=E6=9E=97=E4=B8=8A=E6=99=BA=29?= Cc: =?UTF-8?q?SZ=20Lin=20=28=E6=9E=97=E4=B8=8A=E6=99=BA=29?= , Schuyler Patton , Grygorii Strashko , "David S. Miller" , Ivan Khoronzhuk , Keerthy , Sekhar Nori , linux-omap@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: ethernet: ti: cpsw: add check for in-band mode setting with RGMII PHY interface Date: Thu, 15 Mar 2018 14:41:43 +0800 Message-Id: <20180315064145.7022-1-sz.lin@moxa.com> X-Mailer: git-send-email 2.16.2 MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP According to AM335x TRM[1] 14.3.6.2, AM437x TRM[2] 15.3.6.2 and DRA7 TRM[3] 24.11.4.8.7.3.3, in-band mode in EXT_EN(bit18) register is only available when PHY is configured in RGMII mode with 10Mbps speed. It will cause some networking issues without RGMII mode, such as carrier sense errors and low throughput. TI also mentioned this issue in their forum[4]. This patch adds the check mechanism for PHY interface with RGMII interface type, the in-band mode can only be set in RGMII mode with 10Mbps speed. References: [1]: https://www.ti.com/lit/ug/spruh73p/spruh73p.pdf [2]: http://www.ti.com/lit/ug/spruhl7h/spruhl7h.pdf [3]: http://www.ti.com/lit/ug/spruic2b/spruic2b.pdf [4]: https://e2e.ti.com/support/arm/sitara_arm/f/791/p/640765/2392155 Suggested-by: Holsety Chen (陳憲輝) Signed-off-by: SZ Lin (林上智) Signed-off-by: Schuyler Patton --- drivers/net/ethernet/ti/cpsw.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 1b1b78fdc138..3bbf22ed59cf 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -1014,7 +1014,13 @@ static void _cpsw_adjust_link(struct cpsw_slave *slave, /* set speed_in input in case RMII mode is used in 100Mbps */ if (phy->speed == 100) mac_control |= BIT(15); - else if (phy->speed == 10) + + /* in band mode only works in 10Mbps RGMII mode */ + else if ((phy->speed == 10) && + ((phy->interface == PHY_INTERFACE_MODE_RGMII) || + (phy->interface == PHY_INTERFACE_MODE_RGMII_ID) || + (phy->interface == PHY_INTERFACE_MODE_RGMII_RXID) || + (phy->interface == PHY_INTERFACE_MODE_RGMII_TXID))) mac_control |= BIT(18); /* In Band mode */ if (priv->rx_pause)