Patchwork [U-Boot,v2,3/6] arm: mvf600: Add FEC support for Vybrid MVF600

login
register
mail settings
Submitter Alison Wang
Date May 14, 2013, 9:51 a.m.
Message ID <1368525108-2266-4-git-send-email-b18965@freescale.com>
Download mbox | patch
Permalink /patch/243662/
State Superseded
Delegated to: Albert ARIBAUD
Headers show

Comments

Alison Wang - May 14, 2013, 9:51 a.m.
This patch adds FEC support for Vybrid MVF600 platform.
Add code to use RMII for MVF600.

Signed-off-by: Alison Wang <b18965@freescale.com>
---
Changes in v2:
- Use common FEC driver fec_mxc.c

 drivers/net/fec_mxc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Stefano Babic - May 15, 2013, 8:15 a.m.
On 14/05/2013 11:51, Alison Wang wrote:
> This patch adds FEC support for Vybrid MVF600 platform.
> Add code to use RMII for MVF600.
> 
> Signed-off-by: Alison Wang <b18965@freescale.com>
> ---
> Changes in v2:
> - Use common FEC driver fec_mxc.c
> 
>  drivers/net/fec_mxc.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
> index 4dbcdca..21e58f4 100644
> --- a/drivers/net/fec_mxc.c
> +++ b/drivers/net/fec_mxc.c
> @@ -518,7 +518,11 @@ static int fec_open(struct eth_device *edev)
>  		u32 ecr = readl(&fec->eth->ecntrl) & ~FEC_ECNTRL_SPEED;
>  		u32 rcr = (readl(&fec->eth->r_cntrl) &
>  				~(FEC_RCNTRL_RMII | FEC_RCNTRL_RMII_10T)) |
> -				FEC_RCNTRL_RGMII | FEC_RCNTRL_MII_MODE;
> +				FEC_RCNTRL_MII_MODE;
> +		if (fec->xcv_type == RGMII)
> +			rcr |= FEC_RCNTRL_RGMII;
> +		else if (fec->xcv_type == RMII)
> +			rcr |= FEC_RCNTRL_RMII;
>  		if (speed == _1000BASET)
>  			ecr |= FEC_ECNTRL_SPEED;
>  		else if (speed != _100BASET)
> 

This can generally be applied, it is not only related to the new SOC.

Acked-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic
Benoît Thébaudeau - May 15, 2013, 2:19 p.m.
Hi Stefano, Alison,

On Wednesday, May 15, 2013 10:15:35 AM, Stefano Babic wrote:
> On 14/05/2013 11:51, Alison Wang wrote:
> > This patch adds FEC support for Vybrid MVF600 platform.
> > Add code to use RMII for MVF600.
> > 
> > Signed-off-by: Alison Wang <b18965@freescale.com>
> > ---
> > Changes in v2:
> > - Use common FEC driver fec_mxc.c
> > 
> >  drivers/net/fec_mxc.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
> > index 4dbcdca..21e58f4 100644
> > --- a/drivers/net/fec_mxc.c
> > +++ b/drivers/net/fec_mxc.c
> > @@ -518,7 +518,11 @@ static int fec_open(struct eth_device *edev)
> >  		u32 ecr = readl(&fec->eth->ecntrl) & ~FEC_ECNTRL_SPEED;
> >  		u32 rcr = (readl(&fec->eth->r_cntrl) &
> >  				~(FEC_RCNTRL_RMII | FEC_RCNTRL_RMII_10T)) |
> > -				FEC_RCNTRL_RGMII | FEC_RCNTRL_MII_MODE;
> > +				FEC_RCNTRL_MII_MODE;
> > +		if (fec->xcv_type == RGMII)
> > +			rcr |= FEC_RCNTRL_RGMII;
> > +		else if (fec->xcv_type == RMII)
> > +			rcr |= FEC_RCNTRL_RMII;
> >  		if (speed == _1000BASET)
> >  			ecr |= FEC_ECNTRL_SPEED;
> >  		else if (speed != _100BASET)
> > 
> 
> This can generally be applied, it is not only related to the new SOC.
> 
> Acked-by: Stefano Babic <sbabic@denx.de>

This is already done in fec_reg_setup(), so the piece of code above could
perhaps just leave untouched the FEC_RCNTRL_RGMII / FEC_RCNTRL_RMII /
FEC_RCNTRL_MII_MODE bits, i.e.:

---
#ifdef FEC_QUIRK_ENET_MAC
	{
		u32 ecr = readl(&fec->eth->ecntrl) & ~FEC_ECNTRL_SPEED;
-		u32 rcr = (readl(&fec->eth->r_cntrl) &
-				~(FEC_RCNTRL_RMII | FEC_RCNTRL_RMII_10T)) |
-				FEC_RCNTRL_RGMII | FEC_RCNTRL_MII_MODE;
+		u32 rcr = readl(&fec->eth->r_cntrl) & ~FEC_RCNTRL_RMII_10T;
		if (speed == _1000BASET)
			ecr |= FEC_ECNTRL_SPEED;
		else if (speed != _100BASET)
---

Best regards,
Benoît

Patch

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 4dbcdca..21e58f4 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -518,7 +518,11 @@  static int fec_open(struct eth_device *edev)
 		u32 ecr = readl(&fec->eth->ecntrl) & ~FEC_ECNTRL_SPEED;
 		u32 rcr = (readl(&fec->eth->r_cntrl) &
 				~(FEC_RCNTRL_RMII | FEC_RCNTRL_RMII_10T)) |
-				FEC_RCNTRL_RGMII | FEC_RCNTRL_MII_MODE;
+				FEC_RCNTRL_MII_MODE;
+		if (fec->xcv_type == RGMII)
+			rcr |= FEC_RCNTRL_RGMII;
+		else if (fec->xcv_type == RMII)
+			rcr |= FEC_RCNTRL_RMII;
 		if (speed == _1000BASET)
 			ecr |= FEC_ECNTRL_SPEED;
 		else if (speed != _100BASET)