LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Murali Karicheri <m-karicheri2@ti.com>
To: <robh+dt@kernel.org>, <mark.rutland@arm.com>,
	<ssantosh@kernel.org>, <malat@debian.org>, <w-kwok2@ti.com>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>, <davem@davemloft.net>,
	<netdev@vger.kernel.org>, <grygorii.strashko@ti.com>,
	<nsekhar@ti.com>
Subject: [net-next PATCH v4 04/13] net: netcp: ethss: make sgmii configuration conditional
Date: Tue, 17 Apr 2018 17:30:33 -0400	[thread overview]
Message-ID: <1524000642-23944-5-git-send-email-m-karicheri2@ti.com> (raw)
In-Reply-To: <1524000642-23944-1-git-send-email-m-karicheri2@ti.com>

As a preparatory patch to add support for 2u cpsw hardware found on
K2G SoC, make sgmii configuration conditional. This is required
since 2u uses RGMII interface instead of SGMII and to allow for driver
re-use.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
---
 drivers/net/ethernet/ti/netcp_ethss.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c
index 1b79fe5..e1e67ff 100644
--- a/drivers/net/ethernet/ti/netcp_ethss.c
+++ b/drivers/net/ethernet/ti/netcp_ethss.c
@@ -74,6 +74,8 @@
 
 #define IS_SS_ID_VER_14(d) \
 	(GBE_IDENT((d)->ss_version) == GBE_SS_VERSION_14)
+#define IS_SS_ID_2U(d) \
+	(GBE_IDENT((d)->ss_version) == GBE_SS_ID_2U)
 
 #define GBENU_SS_REG_INDEX		0
 #define GBENU_SM_REG_INDEX		1
@@ -2239,7 +2241,8 @@ static void gbe_slave_stop(struct gbe_intf *intf)
 	struct gbe_priv *gbe_dev = intf->gbe_dev;
 	struct gbe_slave *slave = intf->slave;
 
-	gbe_sgmii_rtreset(gbe_dev, slave, true);
+	if (!IS_SS_ID_2U(gbe_dev))
+		gbe_sgmii_rtreset(gbe_dev, slave, true);
 	gbe_port_reset(slave);
 	/* Disable forwarding */
 	cpsw_ale_control_set(gbe_dev->ale, slave->port_num,
@@ -2274,9 +2277,11 @@ static int gbe_slave_open(struct gbe_intf *gbe_intf)
 
 	void (*hndlr)(struct net_device *) = gbe_adjust_link;
 
-	gbe_sgmii_config(priv, slave);
+	if (!IS_SS_ID_2U(priv))
+		gbe_sgmii_config(priv, slave);
 	gbe_port_reset(slave);
-	gbe_sgmii_rtreset(priv, slave, false);
+	if (!IS_SS_ID_2U(priv))
+		gbe_sgmii_rtreset(priv, slave, false);
 	gbe_port_config(priv, slave, priv->rx_packet_max);
 	gbe_set_slave_mac(slave, gbe_intf);
 	/* enable forwarding */
@@ -3042,7 +3047,8 @@ static void init_secondary_ports(struct gbe_priv *gbe_dev,
 			continue;
 		}
 
-		gbe_sgmii_config(gbe_dev, slave);
+		if (!IS_SS_ID_2U(gbe_dev))
+			gbe_sgmii_config(gbe_dev, slave);
 		gbe_port_reset(slave);
 		gbe_port_config(gbe_dev, slave, gbe_dev->rx_packet_max);
 		list_add_tail(&slave->slave_list, &gbe_dev->secondary_slaves);
@@ -3399,7 +3405,9 @@ static int set_gbenu_ethss_priv(struct gbe_priv *gbe_dev,
 	}
 	gbe_dev->switch_regs = regs;
 
-	gbe_dev->sgmii_port_regs = gbe_dev->ss_regs + GBENU_SGMII_MODULE_OFFSET;
+	if (!IS_SS_ID_2U(gbe_dev))
+		gbe_dev->sgmii_port_regs =
+		       gbe_dev->ss_regs + GBENU_SGMII_MODULE_OFFSET;
 
 	/* Although sgmii modules are mem mapped to one contiguous
 	 * region on GBENU devices, setting sgmii_port34_regs allows
-- 
1.9.1

  parent reply	other threads:[~2018-04-17 21:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-17 21:30 [net-next PATCH v4 00/13] Add support for netcp driver on K2G SoC Murali Karicheri
2018-04-17 21:30 ` [net-next PATCH v4 01/13] soc: ti: K2G: enhancement to support QMSS in K2G NAVSS Murali Karicheri
2018-04-17 21:30 ` [net-next PATCH v4 02/13] soc: ti: K2G: provide APIs to support driver probe deferral Murali Karicheri
2018-04-17 21:30 ` [net-next PATCH v4 03/13] net: netcp: ethss: use macro for checking ss_version consistently Murali Karicheri
2018-04-17 21:30 ` Murali Karicheri [this message]
2018-04-17 21:30 ` [net-next PATCH v4 05/13] net: netcp: ethss: add support for handling rgmii link interface Murali Karicheri
2018-04-17 21:30 ` [net-next PATCH v4 06/13] net: netcp: ethss: use rgmii link status for 2u cpsw hardware Murali Karicheri
2018-04-17 21:30 ` [net-next PATCH v4 07/13] net: netcp: ethss: map vlan priorities to zero flow Murali Karicheri
2018-04-17 21:30 ` [net-next PATCH v4 08/13] net: netcp: ethss: re-use stats handling code for 2u hardware Murali Karicheri
2018-04-17 21:30 ` [net-next PATCH v4 09/13] net: netcp: ethss: use of_get_phy_mode() to support different RGMII modes Murali Karicheri
2018-04-17 21:30 ` [net-next PATCH v4 10/13] Revert "net: netcp: remove dead code from the driver" Murali Karicheri
2018-04-17 21:30 ` [net-next PATCH v4 11/13] net: netcp: support probe deferral Murali Karicheri
2018-04-17 21:30 ` [net-next PATCH v4 12/13] net: netcp: add api to support set rx mode in netcp modules Murali Karicheri
2018-04-17 21:30 ` [net-next PATCH v4 13/13] net: netcp: ethss: k2g: add promiscuous mode support Murali Karicheri
2018-04-19  1:07 ` [net-next PATCH v4 00/13] Add support for netcp driver on K2G SoC David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1524000642-23944-5-git-send-email-m-karicheri2@ti.com \
    --to=m-karicheri2@ti.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=grygorii.strashko@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=malat@debian.org \
    --cc=mark.rutland@arm.com \
    --cc=netdev@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=robh+dt@kernel.org \
    --cc=ssantosh@kernel.org \
    --cc=w-kwok2@ti.com \
    --subject='Re: [net-next PATCH v4 04/13] net: netcp: ethss: make sgmii configuration conditional' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).