All of lore.kernel.org
 help / color / mirror / Atom feed
From: Murali Karicheri <m-karicheri2@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 3/7] net: netcp: add support for phy with rgmii ids
Date: Thu, 21 Feb 2019 12:02:03 -0500	[thread overview]
Message-ID: <20190221170207.17808-4-m-karicheri2@ti.com> (raw)
In-Reply-To: <20190221170207.17808-1-m-karicheri2@ti.com>

Enhance the netcp driver to support phys that can be configured
for internal delay (rgmii-id, rgmii-rxid, rgmii-txid)

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
---
 drivers/net/ti/keystone_net.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ti/keystone_net.c b/drivers/net/ti/keystone_net.c
index a3ba91cc3f..4baeeb83f1 100644
--- a/drivers/net/ti/keystone_net.c
+++ b/drivers/net/ti/keystone_net.c
@@ -88,6 +88,7 @@ struct ks2_eth_priv {
 	struct mii_dev			*mdio_bus;
 	int				phy_addr;
 	phy_interface_t			phy_if;
+	int				phy_of_handle;
 	int				sgmii_link_type;
 	void				*mdio_base;
 	struct rx_buff_desc		net_rx_buffs;
@@ -588,6 +589,10 @@ static int ks2_eth_probe(struct udevice *dev)
 	if (priv->has_mdio) {
 		priv->phydev = phy_connect(priv->mdio_bus, priv->phy_addr,
 					   dev, priv->phy_if);
+#ifdef CONFIG_DM_ETH
+	if (priv->phy_of_handle)
+		priv->phydev->node = offset_to_ofnode(priv->phy_of_handle);
+#endif
 		phy_config(priv->phydev);
 	}
 
@@ -679,6 +684,7 @@ static int ks2_eth_parse_slave_interface(int netcp, int slave,
 	int phy;
 	int dma_count;
 	u32 dma_channel[8];
+	const char *phy_mode;
 
 	priv->slave_port = fdtdec_get_int(fdt, slave, "slave-port", -1);
 	priv->net_rx_buffs.rx_flow = priv->slave_port * 8;
@@ -700,7 +706,9 @@ static int ks2_eth_parse_slave_interface(int netcp, int slave,
 	priv->link_type = fdtdec_get_int(fdt, slave, "link-interface", -1);
 
 	phy = fdtdec_lookup_phandle(fdt, slave, "phy-handle");
+
 	if (phy >= 0) {
+		priv->phy_of_handle = phy;
 		priv->phy_addr = fdtdec_get_int(fdt, phy, "reg", -1);
 
 		mdio = fdt_parent_offset(fdt, phy);
@@ -717,7 +725,19 @@ static int ks2_eth_parse_slave_interface(int netcp, int slave,
 		priv->sgmii_link_type = SGMII_LINK_MAC_PHY;
 		priv->has_mdio = true;
 	} else if (priv->link_type == LINK_TYPE_RGMII_LINK_MAC_PHY) {
-		priv->phy_if = PHY_INTERFACE_MODE_RGMII;
+		phy_mode = fdt_getprop(fdt, slave, "phy-mode", NULL);
+		if (phy_mode) {
+			priv->phy_if = phy_get_interface_by_name(phy_mode);
+			if (priv->phy_if != PHY_INTERFACE_MODE_RGMII &&
+			    priv->phy_if != PHY_INTERFACE_MODE_RGMII_ID &&
+			    priv->phy_if != PHY_INTERFACE_MODE_RGMII_RXID &&
+			    priv->phy_if != PHY_INTERFACE_MODE_RGMII_TXID) {
+				pr_err("invalid phy-mode\n");
+				return -EINVAL;
+			}
+		} else {
+			priv->phy_if = PHY_INTERFACE_MODE_RGMII;
+		}
 		pdata->phy_interface = priv->phy_if;
 		priv->has_mdio = true;
 	}
-- 
2.17.0

  parent reply	other threads:[~2019-02-21 17:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-21 17:02 [U-Boot] [PATCH v3 0/7] Add netcp networking support on K2G ICE EVM Murali Karicheri
2019-02-21 17:02 ` [U-Boot] [PATCH v3 1/7] ARM: k2g-ice: Add pinmux support for rgmii interface Murali Karicheri
2019-02-25 18:24   ` Joe Hershberger
2019-02-25 18:29   ` Joe Hershberger
2019-04-12 16:29   ` [U-Boot] [U-Boot, v3, " Tom Rini
2019-02-21 17:02 ` [U-Boot] [PATCH v3 2/7] ARM: k2g-gp-evm: update to rgmii pinmux configuration Murali Karicheri
2019-02-25 18:25   ` Joe Hershberger
2019-04-12 16:29   ` [U-Boot] [U-Boot, v3, " Tom Rini
2019-02-21 17:02 ` Murali Karicheri [this message]
2019-02-25 18:26   ` [U-Boot] [PATCH v3 3/7] net: netcp: add support for phy with rgmii ids Joe Hershberger
2019-04-12 16:29   ` [U-Boot] [U-Boot, v3, " Tom Rini
2019-02-21 17:02 ` [U-Boot] [PATCH v3 4/7] ARM: k2g: add a workaround to reset the phy Murali Karicheri
2019-02-25 18:28   ` Joe Hershberger
2019-04-12 16:29   ` [U-Boot] [U-Boot, v3, " Tom Rini
2019-02-21 17:02 ` [U-Boot] [PATCH v3 5/7] ARM: dts: k2g-evm: remove unused phy-mode property from phy node Murali Karicheri
2019-02-25 18:36   ` Joe Hershberger
2019-04-12 16:29   ` [U-Boot] [U-Boot, v3, " Tom Rini
2019-02-21 17:02 ` [U-Boot] [PATCH v3 6/7] k2g: config enable ti phy dp83867 for k2g Murali Karicheri
2019-02-21 23:10   ` Tom Rini
2019-02-25 18:35   ` Joe Hershberger
2019-04-12 16:30   ` [U-Boot] [U-Boot, v3, " Tom Rini
2019-02-21 17:02 ` [U-Boot] [PATCH v3 7/7] ARM: dts: k2g-ice: add dt node for netcp Murali Karicheri
2019-02-25 18:30   ` Joe Hershberger
2019-04-12 16:30   ` [U-Boot] [U-Boot, v3, " Tom Rini
2019-02-25 16:18 ` [U-Boot] [PATCH v3 0/7] Add netcp networking support on K2G ICE EVM Murali Karicheri

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=20190221170207.17808-4-m-karicheri2@ti.com \
    --to=m-karicheri2@ti.com \
    --cc=u-boot@lists.denx.de \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.