diff mbox

[U-Boot] driver/net/fec: support fixed speed connection

Message ID 1466590034-15127-1-git-send-email-oe5hpm@oevsv.at
State Accepted
Commit 0750701a3f74e831b6cb0ecc69be2f7eff94e819
Delegated to: Stefano Babic
Headers show

Commit Message

Hannes Schmelzer June 22, 2016, 10:07 a.m. UTC
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.

Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>
---

 doc/README.fec_mxc    | 5 +++++
 drivers/net/fec_mxc.c | 4 ++++
 2 files changed, 9 insertions(+)

Comments

Joe Hershberger July 6, 2016, 3:13 p.m. UTC | #1
On Wed, Jun 22, 2016 at 5:07 AM, Hannes Schmelzer <oe5hpm@oevsv.at> wrote:
> 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.
>
> Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>

You may want to add it to Kconfig, but that's up to Stefano.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Stefano Babic July 11, 2016, 2:23 p.m. UTC | #2
Hi Hannes,

On 22/06/2016 12:07, Hannes Schmelzer wrote:
> 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.
> 
> Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>
> ---
> 
>  doc/README.fec_mxc    | 5 +++++
>  drivers/net/fec_mxc.c | 4 ++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/doc/README.fec_mxc b/doc/README.fec_mxc
> index ed7e47d..9ca6ac2 100644
> --- a/doc/README.fec_mxc
> +++ b/doc/README.fec_mxc
> @@ -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
> diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
> index 360f8e4..e871b3e 100644
> --- a/drivers/net/fec_mxc.c
> +++ b/drivers/net/fec_mxc.c
> @@ -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);
> 


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
Hannes Schmelzer July 11, 2016, 2:36 p.m. UTC | #3
On 07/11/2016 04:23 PM, Stefano Babic wrote:
> Hi Hannes,
Hi Stefano,
>
> On 22/06/2016 12:07, Hannes Schmelzer wrote:
>> 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.
>>
>> Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>
>> ---
>>
>>   doc/README.fec_mxc    | 5 +++++
>>   drivers/net/fec_mxc.c | 4 ++++
>>   2 files changed, 9 insertions(+)
>>
>> diff --git a/doc/README.fec_mxc b/doc/README.fec_mxc
>> index ed7e47d..9ca6ac2 100644
>> --- a/doc/README.fec_mxc
>> +++ b/doc/README.fec_mxc
>> @@ -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
>> diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
>> index 360f8e4..e871b3e 100644
>> --- a/drivers/net/fec_mxc.c
>> +++ b/drivers/net/fec_mxc.c
>> @@ -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);
>>
>
> 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.
many thanks, looking forward for getting merged into u-boot master.

> Best regards,
> Stefano Babic
cheers,
Hannes
diff mbox

Patch

diff --git a/doc/README.fec_mxc b/doc/README.fec_mxc
index ed7e47d..9ca6ac2 100644
--- a/doc/README.fec_mxc
+++ b/doc/README.fec_mxc
@@ -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
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 360f8e4..e871b3e 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -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);