Skip to contentSkip to conversation

drivers: net: keystone_net: add rgmii link type support when parsing dt

PATCH New Mugunthan V N 5 participants 7 messages Nov 14, 2016 – Nov 30, 2016 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: net: keystone_net: add rgmii link type support when parsing dt

Add support to detect RGMII link interface from link-interface device tree entry. Also rename the existing link type enums so that it provides meaning full interface like SGMII.

---

Without this support there is a crash in K2G EVM tftp boot [1]. Verified this with tftp download on K2G EVM [2]

[1] - http://pastebin.ubuntu.com/23474751/
[2] - http://pastebin.ubuntu.com/23474748/

---
 drivers/net/keystone_net.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)
drivers/net/keystone_net.c +15 -8
index f88d83e727..a5120e01ad 100644
@@ -56,13 +56,16 @@ struct rx_buff_desc net_rx_buffs = {
 #ifdef CONFIG_DM_ETH
 
 enum link_type {
-	LINK_TYPE_MAC_TO_MAC_AUTO = 0,
-	LINK_TYPE_MAC_TO_PHY_MODE = 1,
-	LINK_TYPE_MAC_TO_MAC_FORCED_MODE = 2,
-	LINK_TYPE_MAC_TO_FIBRE_MODE = 3,
-	LINK_TYPE_MAC_TO_PHY_NO_MDIO_MODE = 4,
-	LINK_TYPE_10G_MAC_TO_PHY_MODE = 10,
-	LINK_TYPE_10G_MAC_TO_MAC_FORCED_MODE = 11,
+	LINK_TYPE_SGMII_MAC_TO_MAC_AUTO		= 0,
+	LINK_TYPE_SGMII_MAC_TO_PHY_MODE		= 1,
+	LINK_TYPE_SGMII_MAC_TO_MAC_FORCED_MODE	= 2,
+	LINK_TYPE_SGMII_MAC_TO_FIBRE_MODE	= 3,
+	LINK_TYPE_SGMII_MAC_TO_PHY_NO_MDIO_MODE	= 4,
+	LINK_TYPE_RGMII_LINK_MAC_PHY		= 5,
+	LINK_TYPE_RGMII_LINK_MAC_MAC_FORCED	= 6,
+	LINK_TYPE_RGMII_LINK_MAC_PHY_NO_MDIO	= 7,
+	LINK_TYPE_10G_MAC_TO_PHY_MODE		= 10,
+	LINK_TYPE_10G_MAC_TO_MAC_FORCED_MODE	= 11,
 };
 
 #define mac_hi(mac)     (((mac)[0] << 0) | ((mac)[1] << 8) |    \
@@ -1077,11 +1080,15 @@ static int ks2_eth_parse_slave_interface(int netcp, int slave,
 		priv->mdio_base = (void *)fdtdec_get_addr(fdt, mdio, "reg");
 	}
 
-	if (priv->link_type == LINK_TYPE_MAC_TO_PHY_MODE) {
+	if (priv->link_type == LINK_TYPE_SGMII_MAC_TO_PHY_MODE) {
 		priv->phy_if = PHY_INTERFACE_MODE_SGMII;
 		pdata->phy_interface = priv->phy_if;
 		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;
+		pdata->phy_interface = priv->phy_if;
+		priv->has_mdio = true;
 	}
 
 	return 0;
Signature · 1 line
2.11.0.rc0.7.gbe5a750
#1 lore raw

PATCH 1/1 drivers: net: keystone_net: add rgmii link type support when parsing dt

Quoted 5 lines · Mugunthan V N

Add support to detect RGMII link interface from link-interface device tree entry. Also rename the existing link type enums so that it provides meaning full interface like SGMII.

Thanks and regards,
Lokesh

Quoted 58 lines

---

Without this support there is a crash in K2G EVM tftp boot [1]. Verified this with tftp download on K2G EVM [2]

[1] - http://pastebin.ubuntu.com/23474751/
[2] - http://pastebin.ubuntu.com/23474748/

---
 drivers/net/keystone_net.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)
drivers/net/keystone_net.c +15 -8
index f88d83e727..a5120e01ad 100644
@@ -56,13 +56,16 @@ struct rx_buff_desc net_rx_buffs = {
 #ifdef CONFIG_DM_ETH
 
 enum link_type {
-	LINK_TYPE_MAC_TO_MAC_AUTO = 0,
-	LINK_TYPE_MAC_TO_PHY_MODE = 1,
-	LINK_TYPE_MAC_TO_MAC_FORCED_MODE = 2,
-	LINK_TYPE_MAC_TO_FIBRE_MODE = 3,
-	LINK_TYPE_MAC_TO_PHY_NO_MDIO_MODE = 4,
-	LINK_TYPE_10G_MAC_TO_PHY_MODE = 10,
-	LINK_TYPE_10G_MAC_TO_MAC_FORCED_MODE = 11,
+	LINK_TYPE_SGMII_MAC_TO_MAC_AUTO		= 0,
+	LINK_TYPE_SGMII_MAC_TO_PHY_MODE		= 1,
+	LINK_TYPE_SGMII_MAC_TO_MAC_FORCED_MODE	= 2,
+	LINK_TYPE_SGMII_MAC_TO_FIBRE_MODE	= 3,
+	LINK_TYPE_SGMII_MAC_TO_PHY_NO_MDIO_MODE	= 4,
+	LINK_TYPE_RGMII_LINK_MAC_PHY		= 5,
+	LINK_TYPE_RGMII_LINK_MAC_MAC_FORCED	= 6,
+	LINK_TYPE_RGMII_LINK_MAC_PHY_NO_MDIO	= 7,
+	LINK_TYPE_10G_MAC_TO_PHY_MODE		= 10,
+	LINK_TYPE_10G_MAC_TO_MAC_FORCED_MODE	= 11,
 };
 
 #define mac_hi(mac)     (((mac)[0] << 0) | ((mac)[1] << 8) |    \
@@ -1077,11 +1080,15 @@ static int ks2_eth_parse_slave_interface(int netcp, int slave,
 		priv->mdio_base = (void *)fdtdec_get_addr(fdt, mdio, "reg");
 	}
 
-	if (priv->link_type == LINK_TYPE_MAC_TO_PHY_MODE) {
+	if (priv->link_type == LINK_TYPE_SGMII_MAC_TO_PHY_MODE) {
 		priv->phy_if = PHY_INTERFACE_MODE_SGMII;
 		pdata->phy_interface = priv->phy_if;
 		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;
+		pdata->phy_interface = priv->phy_if;
+		priv->has_mdio = true;
 	}
 
 	return 0;
#2 lore raw

PATCH 1/1 drivers: net: keystone_net: add rgmii link type support when parsing dt

In reply to Mugunthan V N
Quoted 52 lines · Mugunthan V N

Add support to detect RGMII link interface from link-interface device tree entry. Also rename the existing link type enums so that it provides meaning full interface like SGMII.

---

Without this support there is a crash in K2G EVM tftp boot [1]. Verified this with tftp download on K2G EVM [2]

[1] - http://pastebin.ubuntu.com/23474751/
[2] - http://pastebin.ubuntu.com/23474748/

---
 drivers/net/keystone_net.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)
drivers/net/keystone_net.c +11 -8
index f88d83e727..a5120e01ad 100644
@@ -56,13 +56,16 @@ struct rx_buff_desc net_rx_buffs = {
 #ifdef CONFIG_DM_ETH
 
 enum link_type {
-       LINK_TYPE_MAC_TO_MAC_AUTO = 0,
-       LINK_TYPE_MAC_TO_PHY_MODE = 1,
-       LINK_TYPE_MAC_TO_MAC_FORCED_MODE = 2,
-       LINK_TYPE_MAC_TO_FIBRE_MODE = 3,
-       LINK_TYPE_MAC_TO_PHY_NO_MDIO_MODE = 4,
-       LINK_TYPE_10G_MAC_TO_PHY_MODE = 10,
-       LINK_TYPE_10G_MAC_TO_MAC_FORCED_MODE = 11,
+       LINK_TYPE_SGMII_MAC_TO_MAC_AUTO         = 0,
+       LINK_TYPE_SGMII_MAC_TO_PHY_MODE         = 1,
+       LINK_TYPE_SGMII_MAC_TO_MAC_FORCED_MODE  = 2,
+       LINK_TYPE_SGMII_MAC_TO_FIBRE_MODE       = 3,
+       LINK_TYPE_SGMII_MAC_TO_PHY_NO_MDIO_MODE = 4,
+       LINK_TYPE_RGMII_LINK_MAC_PHY            = 5,
+       LINK_TYPE_RGMII_LINK_MAC_MAC_FORCED     = 6,
+       LINK_TYPE_RGMII_LINK_MAC_PHY_NO_MDIO    = 7,
+       LINK_TYPE_10G_MAC_TO_PHY_MODE           = 10,
+       LINK_TYPE_10G_MAC_TO_MAC_FORCED_MODE    = 11,
 };
 
 #define mac_hi(mac)     (((mac)[0] << 0) | ((mac)[1] << 8) |    \
@@ -1077,11 +1080,15 @@ static int ks2_eth_parse_slave_interface(int netcp, int slave,
                priv->mdio_base = (void *)fdtdec_get_addr(fdt, mdio, "reg");
        }
 
-       if (priv->link_type == LINK_TYPE_MAC_TO_PHY_MODE) {
+       if (priv->link_type == LINK_TYPE_SGMII_MAC_TO_PHY_MODE) {
                priv->phy_if = PHY_INTERFACE_MODE_SGMII;

drivers/net/keystone_net.c static int ks2_eth_parse_slave_interface(int netcp, int slave, · line 1094

Quoted 10 lines
drivers/net/keystone_net.c +4 -0
                pdata->phy_interface = priv->phy_if;
                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;
+               pdata->phy_interface = priv->phy_if;
+               priv->has_mdio = true;
        }
 
        return 0;

This is great, but can you please add this info to a bindings file in doc/device-tree-bindings/net/keystone-netcp.txt so that it's less magic?

Thanks,
-Joe

#3 lore raw

PATCH 1/1 drivers: net: keystone_net: add rgmii link type support when parsing dt

Joe

Quoted 3 lines · Joe Hershberger

This is great, but can you please add this info to a bindings file in doc/device-tree-bindings/net/keystone-netcp.txt so that it's less magic?

link-interface is already documented in Kernel device tree bindings (Documentation/devicetree/bindings/net/keystone-netcp.txt), still do we need to document the same in u-boot as well?

Regards
Mugunthan V N

#4 lore raw

PATCH 1/1 drivers: net: keystone_net: add rgmii link type support when parsing dt

Quoted 10 lines · Mugunthan V N

Joe

Quoted 3 lines · Joe Hershberger

This is great, but can you please add this info to a bindings file in doc/device-tree-bindings/net/keystone-netcp.txt so that it's less magic?

link-interface is already documented in Kernel device tree bindings (Documentation/devicetree/bindings/net/keystone-netcp.txt), still do we need to document the same in u-boot as well?

I guess I'll leave this to Tom and Simon, but I believe most of the bindings are replicated to U-Boot when we begin supporting them.

#5 lore raw

PATCH 1/1 drivers: net: keystone_net: add rgmii link type support when parsing dt

Hi Joe,

Quoted 9 lines · Joe Hershberger
Quoted 7 lines · Mugunthan V N

Joe

Quoted 3 lines · Joe Hershberger

This is great, but can you please add this info to a bindings file in doc/device-tree-bindings/net/keystone-netcp.txt so that it's less magic?

Quoted 6 lines
Quoted 3 lines

link-interface is already documented in Kernel device tree bindings (Documentation/devicetree/bindings/net/keystone-netcp.txt), still do we need to document the same in u-boot as well?

I guess I'll leave this to Tom and Simon, but I believe most of the bindings are replicated to U-Boot when we begin supporting them.

Yes that's the idea.

Regards,
Simon

#6 lore raw

PATCH 1/1 drivers: net: keystone_net: add rgmii link type support when parsing dt

In reply to Mugunthan V N
Quoted 5 lines · Mugunthan V N

Add support to detect RGMII link interface from link-interface device tree entry. Also rename the existing link type enums so that it provides meaning full interface like SGMII.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161117/ab19d1d7/attachment.sig>