From patchwork Mon Apr 2 14:37:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 10319923 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 B2E0760375 for ; Mon, 2 Apr 2018 14:52:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A29B028AC1 for ; Mon, 2 Apr 2018 14:52:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96C5328AC7; Mon, 2 Apr 2018 14:52:07 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0052C28AC1 for ; Mon, 2 Apr 2018 14:52:06 +0000 (UTC) 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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+Vypsifxi33y0+LDzRQtOBSOkQiy7Dz5JWPavOruSrI=; b=mgpFj8hw0c1rn0 I3BnJLeRretJbxCU9hP4HwADWmTJIXKXRUHBhHEEd2cHyiH21susEt+OCdoYoSfubjnsBWuGQtXmX fuR3q91lvGF/DKK1s463hGiGYsAa1xvdmq1qq9s5vh4JMa4lf9PjDiV2tjS7IdblF9yUBiwnE/xfG U5My6LKx8vgVaSZ45fmX+8OvnZ0GRCqW69TB4N1ctEpHdMC7qdMZV/MzOyXmb8LQn+szl/XEUJCOB FH9I2HeRr5OolRVOhHKM45tWQHF2C6RkjF00n6ajEUPzckq3ql2BZYbg+NvR5S1BFCv5c+uKfBA08 3R8LO+9p5s9cGAC5VXQg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f30oR-0008JP-Np; Mon, 02 Apr 2018 14:51:59 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f30Yl-0004E0-Hq for linux-arm-kernel@bombadil.infradead.org; Mon, 02 Apr 2018 14:35:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=c2h2L28rhz1c1LukMvHpobneELqz/8ZyJ7t1D+PEnpo=; b=oqNXqRTxG9Opfpa4+oLrWfZCx hZucfqHsHVmHDHUJ7/Ekx9mGNA/qyyb20836RbqtOHt54/+OMUg304ZmmV19BxrbUh4l9gZBe7zCF etfmLrhnd5TB/T6G6+qCRvkeb3Z0ZtU4un5tJQA4zQC8EXbuuRnQX6wyZ6XjxsyTLxobLX9v6v4d0 b0epvec0MxDHWVh7kpkc26Eza8npelbtKa9Lw8+aPPszVsfPZxPJnbZbcXWgiBEZaZ+v03vEGk6Bk 8ntsyX3dpOVGNLQpaj/0R8BLBhc0vdsSHhV7Iv/m3vYRxZZsowZH58+99fmAlCRqyT19FDlOb9fVW NVribfYTQ==; Received: from fllnx209.ext.ti.com ([198.47.19.16]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f30Yi-0007sT-Ar for linux-arm-kernel@lists.infradead.org; Mon, 02 Apr 2018 14:35:45 +0000 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w32EZQgd017931; Mon, 2 Apr 2018 09:35:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1522679726; bh=+E5F/PkxjljAAB6dqXVBWE1Ee6rn9zQHP4OEU1E+Ew4=; h=From:To:Subject:Date:In-Reply-To:References; b=t+IsaBUnzixG3azInLOyoYNXF8sGLRUX2sBF00lidQMGw6Xh+OiN4EBeXhiz1mxjn KUQeO27s7wWNgh1QFHupRLogooBAFNIneDiZt3AMyKg1vvR3Kwu/o3eet77DAsWgjZ eimB6gmU9VCqwXjWSXRg2ITPdWu7T3jffukeTK+0= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w32EZQD7024895; Mon, 2 Apr 2018 09:35:26 -0500 Received: from DFLE101.ent.ti.com (10.64.6.22) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 2 Apr 2018 09:35:26 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 2 Apr 2018 09:35:26 -0500 Received: from ula0868495.am.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w32EZKc6025486; Mon, 2 Apr 2018 09:35:25 -0500 From: Murali Karicheri To: , , , , , , , , , Subject: [net-next PATCH v3 09/11] net: netcp: ethss: use of_get_phy_mode() to support different RGMII modes Date: Mon, 2 Apr 2018 10:37:59 -0400 Message-ID: <1522679881-25643-10-git-send-email-m-karicheri2@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1522679881-25643-1-git-send-email-m-karicheri2@ti.com> References: <1522679881-25643-1-git-send-email-m-karicheri2@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180402_103544_537269_EC75B101 X-CRM114-Status: GOOD ( 14.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The phy used for K2G allows for internal delays to be added optionally to the clock circuitry based on board desing. To add this support, enhance the driver to use of_get_phy_mode() to read the phy-mode from the phy device and pass the same to phy through of_phy_connect(). Signed-off-by: Murali Karicheri --- drivers/net/ethernet/ti/netcp_ethss.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index 7b3b373..f7af999 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -705,6 +706,7 @@ struct gbe_slave { u32 link_interface; u32 mac_control; u8 phy_port_t; + struct device_node *node; struct device_node *phy_node; struct ts_ctl ts_ctl; struct list_head slave_list; @@ -2318,6 +2320,21 @@ static int gbe_slave_open(struct gbe_intf *gbe_intf) has_phy = true; phy_mode = PHY_INTERFACE_MODE_SGMII; slave->phy_port_t = PORT_MII; + } else if (slave->link_interface == RGMII_LINK_MAC_PHY) { + has_phy = true; + phy_mode = of_get_phy_mode(slave->node); + /* if phy-mode is not present, default to + * PHY_INTERFACE_MODE_RGMII + */ + if (phy_mode < 0) + phy_mode = PHY_INTERFACE_MODE_RGMII; + + if (!phy_interface_mode_is_rgmii(phy_mode)) { + dev_err(priv->dev, + "Unsupported phy mode %d\n", phy_mode); + return -EINVAL; + } + slave->phy_port_t = PORT_MII; } else if (slave->link_interface == XGMII_LINK_MAC_PHY) { has_phy = true; phy_mode = PHY_INTERFACE_MODE_NA; @@ -2943,6 +2960,7 @@ static int init_slave(struct gbe_priv *gbe_dev, struct gbe_slave *slave, slave->link_interface = SGMII_LINK_MAC_PHY; } + slave->node = node; slave->open = false; if ((slave->link_interface == SGMII_LINK_MAC_PHY) || (slave->link_interface == RGMII_LINK_MAC_PHY) ||