Skip to contentSkip to conversation

driver/net/fec: support fixed speed connection

PATCH New Hannes Schmelzer 4 participants 4 messages Jun 22, 2016 – Jul 11, 2016 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 driver/net/fec: support fixed speed connection

If MAC is directly connected to another MAC (like a switch for example) we don't need to probe for a phy, autoneogation and so on. We simply have to setup speed.

---

 doc/README.fec_mxc    | 5 +++++
 drivers/net/fec_mxc.c | 4 ++++
 2 files changed, 9 insertions(+)
doc/README.fec_mxc +5 -0
index ed7e47d..9ca6ac2 100644
@@ -27,6 +27,11 @@ CONFIG_FEC_MXC_PHYADDR
 	Optional, selects the exact phy address that should be connected
 	and function fecmxc_initialize will try to initialize it.
 
+CONFIG_FEC_FIXED_SPEED
+	Optional, selects a fixed speed on the MAC interface without asking some
+	phy. This is usefull if there is a direct MAC <-> MAC connection, for
+	example if the CPU is connected directly via the RGMII interface to a
+	ethernet-switch.
 
 Reading the ethaddr from the SoC eFuses:
 if CONFIG_FEC_MXC is defined and the U-Boot environment does not contain the
drivers/net/fec_mxc.c +4 -0
index 360f8e4..e871b3e 100644
@@ -233,6 +233,7 @@ static int miiphy_restart_aneg(struct eth_device *dev)
 	return ret;
 }
 
+#ifndef CONFIG_FEC_FIXED_SPEED
 static int miiphy_wait_aneg(struct eth_device *dev)
 {
 	uint32_t start;
@@ -260,6 +261,7 @@ static int miiphy_wait_aneg(struct eth_device *dev)
 
 	return 0;
 }
+#endif /* CONFIG_FEC_FIXED_SPEED */
 #endif
 
 static int fec_rx_task_enable(struct fec_priv *fec)
@@ -502,6 +504,8 @@ static int fec_open(struct eth_device *edev)
 		}
 		speed = fec->phydev->speed;
 	}
+#elif CONFIG_FEC_FIXED_SPEED
+	speed = CONFIG_FEC_FIXED_SPEED;
 #else
 	miiphy_wait_aneg(edev);
 	speed = miiphy_speed(edev->name, fec->phy_id);
Signature · 1 line
1.9.1
#2 lore raw

PATCH 1/1 driver/net/fec: support fixed speed connection

In reply to Hannes Schmelzer

Hi Hannes,

Quoted 49 lines · Hannes Schmelzer

If MAC is directly connected to another MAC (like a switch for example) we don't need to probe for a phy, autoneogation and so on. We simply have to setup speed.

---

 doc/README.fec_mxc    | 5 +++++
 drivers/net/fec_mxc.c | 4 ++++
 2 files changed, 9 insertions(+)
doc/README.fec_mxc +5 -0
index ed7e47d..9ca6ac2 100644
@@ -27,6 +27,11 @@ CONFIG_FEC_MXC_PHYADDR
 	Optional, selects the exact phy address that should be connected
 	and function fecmxc_initialize will try to initialize it.
 
+CONFIG_FEC_FIXED_SPEED
+	Optional, selects a fixed speed on the MAC interface without asking some
+	phy. This is usefull if there is a direct MAC <-> MAC connection, for
+	example if the CPU is connected directly via the RGMII interface to a
+	ethernet-switch.
 
 Reading the ethaddr from the SoC eFuses:
 if CONFIG_FEC_MXC is defined and the U-Boot environment does not contain the
drivers/net/fec_mxc.c +2 -0
index 360f8e4..e871b3e 100644
@@ -233,6 +233,7 @@ static int miiphy_restart_aneg(struct eth_device *dev)
 	return ret;
 }
 
+#ifndef CONFIG_FEC_FIXED_SPEED
 static int miiphy_wait_aneg(struct eth_device *dev)
 {
 	uint32_t start;
@@ -260,6 +261,7 @@ static int miiphy_wait_aneg(struct eth_device *dev)
 
 	return 0;
 }
+#endif /* CONFIG_FEC_FIXED_SPEED */
 #endif
 
 static int fec_rx_task_enable(struct fec_priv *fec)

drivers/net/fec_mxc.c static int fec_open(struct eth_device *edev) · line 511

Quoted 8 lines
drivers/net/fec_mxc.c +2 -0
@@ -502,6 +504,8 @@ static int fec_open(struct eth_device *edev)
 		}
 		speed = fec->phydev->speed;
 	}
+#elif CONFIG_FEC_FIXED_SPEED
+	speed = CONFIG_FEC_FIXED_SPEED;
 #else
 	miiphy_wait_aneg(edev);
 	speed = miiphy_speed(edev->name, fec->phy_id);

Really I had already sent a patch for this issue, and I merged this into u-boot-imx, - next

http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=57b7371e24e429ee37403cfb084d142cf7699bd7

Anyway, your patch is more complete as mine. I will drop my patch and substitute with your.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#3 lore raw

PATCH 1/1 driver/net/fec: support fixed speed connection

Quoted 1 line · Stefano Babic

Hi Hannes,

Hi Stefano,

Quoted 63 lines · Hannes Schmelzer
Quoted 49 lines

If MAC is directly connected to another MAC (like a switch for example) we don't need to probe for a phy, autoneogation and so on. We simply have to setup speed.

---

  doc/README.fec_mxc    | 5 +++++
  drivers/net/fec_mxc.c | 4 ++++
  2 files changed, 9 insertions(+)
doc/README.fec_mxc +5 -0
index ed7e47d..9ca6ac2 100644
@@ -27,6 +27,11 @@ CONFIG_FEC_MXC_PHYADDR
  	Optional, selects the exact phy address that should be connected
  	and function fecmxc_initialize will try to initialize it.
 
+CONFIG_FEC_FIXED_SPEED
+	Optional, selects a fixed speed on the MAC interface without asking some
+	phy. This is usefull if there is a direct MAC <-> MAC connection, for
+	example if the CPU is connected directly via the RGMII interface to a
+	ethernet-switch.
 
  Reading the ethaddr from the SoC eFuses:
  if CONFIG_FEC_MXC is defined and the U-Boot environment does not contain the
drivers/net/fec_mxc.c +2 -0
index 360f8e4..e871b3e 100644
@@ -233,6 +233,7 @@ static int miiphy_restart_aneg(struct eth_device *dev)
  	return ret;
  }
 
+#ifndef CONFIG_FEC_FIXED_SPEED
  static int miiphy_wait_aneg(struct eth_device *dev)
  {
  	uint32_t start;
@@ -260,6 +261,7 @@ static int miiphy_wait_aneg(struct eth_device *dev)
 
  	return 0;
  }
+#endif /* CONFIG_FEC_FIXED_SPEED */
  #endif
 
  static int fec_rx_task_enable(struct fec_priv *fec)

drivers/net/fec_mxc.c static int fec_open(struct eth_device *edev) · line 511

Quoted 8 lines
drivers/net/fec_mxc.c +2 -0
@@ -502,6 +504,8 @@ static int fec_open(struct eth_device *edev)
  		}
  		speed = fec->phydev->speed;
  	}
+#elif CONFIG_FEC_FIXED_SPEED
+	speed = CONFIG_FEC_FIXED_SPEED;
  #else
  	miiphy_wait_aneg(edev);
  	speed = miiphy_speed(edev->name, fec->phy_id);

Really I had already sent a patch for this issue, and I merged this into u-boot-imx, - next

Quoted 4 lines

http://git.denx.de/?p=u-boot/u-boot-imx.git;a=commit;h=57b7371e24e429ee37403cfb084d142cf7699bd7

Anyway, your patch is more complete as mine. I will drop my patch and substitute with your.

many thanks, looking forward for getting merged into u-boot master.

Quoted 2 lines

Best regards,
Stefano Babic

cheers,
Hannes