Patchwork [U-Boot] powerpc/fm: fix TBI PHY address settings

login
register
mail settings
Submitter shaohui xie
Date Oct. 12, 2012, 6:25 a.m.
Message ID <1350023136-28017-1-git-send-email-Shaohui.Xie@freescale.com>
Download mbox | patch
Permalink /patch/191061/
State Accepted, archived
Delegated to: Andy Fleming
Headers show

Comments

shaohui xie - Oct. 12, 2012, 6:25 a.m.
From: shaohui xie <Shaohui.Xie@freescale.com>

TBI PHY address (TBIPA) register is set in general frame manager
phy init funciton dtsec_init_phy() in drivers/net/fm/eth.c, and
it is supposed to set TBIPA on FM1@DTSEC1 in case of FM1@DTSEC1
isn't used directly, which provides MDIO for other ports. So
following code is wrong in case of FM2, which has a different
mac base.

struct dtsec *regs = (struct dtsec *)fm_eth->mac->base;
/* Assign a Physical address to the TBI */
out_be32(&regs->tbipa, CONFIG_SYS_TBIPA_VALUE);

Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
---
 drivers/net/fm/eth.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Tabi Timur-B04825 - Oct. 12, 2012, 7:24 p.m.
On Fri, Oct 12, 2012 at 1:25 AM, Shaohui Xie <Shaohui.Xie@freescale.com> wrote:
> From: shaohui xie <Shaohui.Xie@freescale.com>
>
> TBI PHY address (TBIPA) register is set in general frame manager
> phy init funciton dtsec_init_phy() in drivers/net/fm/eth.c, and
> it is supposed to set TBIPA on FM1@DTSEC1 in case of FM1@DTSEC1
> isn't used directly, which provides MDIO for other ports. So
> following code is wrong in case of FM2, which has a different
> mac base.

Is this still true with Fman v3?

Does this patch fix any known bugs?
shaohui xie - Oct. 16, 2012, 11:16 a.m.
> -----Original Message-----
> From: Tabi Timur-B04825
> Sent: Saturday, October 13, 2012 3:25 AM
> To: Xie Shaohui-B21989
> Cc: u-boot@lists.denx.de
> Subject: Re: [U-Boot] [PATCH] powerpc/fm: fix TBI PHY address settings
> 
> On Fri, Oct 12, 2012 at 1:25 AM, Shaohui Xie <Shaohui.Xie@freescale.com>
> wrote:
> > From: shaohui xie <Shaohui.Xie@freescale.com>
> >
> > TBI PHY address (TBIPA) register is set in general frame manager phy
> > init funciton dtsec_init_phy() in drivers/net/fm/eth.c, and it is
> > supposed to set TBIPA on FM1@DTSEC1 in case of FM1@DTSEC1 isn't used
> > directly, which provides MDIO for other ports. So following code is
> > wrong in case of FM2, which has a different mac base.
> 
> Is this still true with Fman v3?
[S.H] No. Fman V3 does not need to set TBIPA on FM1@DTSEC1.

> 
> Does this patch fix any known bugs?
[S.H] Yes, it fixed a bug internally (ENGR224292: p4080ds FM2@DTSEC4 can't ping), 
and I sent it upstream as Kumar suggested.

Best Regards, 
Shaohui Xie
Tabi Timur-B04825 - Oct. 16, 2012, 7:25 p.m.
Xie Shaohui-B21989 wrote:

>> Is this still true with Fman v3?
> [S.H] No. Fman V3 does not need to set TBIPA on FM1@DTSEC1.

Does this patch break Fman V3?
shaohui xie - Oct. 17, 2012, 5:59 a.m.
> Xie Shaohui-B21989 wrote:
> 
> >> Is this still true with Fman v3?
> > [S.H] No. Fman V3 does not need to set TBIPA on FM1@DTSEC1.
> 
> Does this patch break Fman V3?

[S.H] No. Fman V3 uses following code:

static void dtsec_init_phy(struct eth_device *dev)
 {
 	struct fm_eth *fm_eth = dev->priv;
-	struct dtsec *regs = (struct dtsec *)fm_eth->mac->base;
 
+#ifndef CONFIG_SYS_FMAN_V3
+	struct dtsec *regs = (struct dtsec *)fm_eth->mac->base;
 	/* Assign a Physical address to the TBI */
 	out_be32(&regs->tbipa, CONFIG_SYS_TBIPA_VALUE);
+#endif
 
 	if (fm_eth->enet_if == PHY_INTERFACE_MODE_SGMII)
 		dtsec_configure_serdes(fm_eth);

The whole patch which introduced Fman V3 is at link:
http://patchwork.ozlabs.org/patch/190087/
Andy will need to merge the codes when he pick the two patches.


Best Regards, 
Shaohui Xie

Patch

diff --git a/drivers/net/fm/eth.c b/drivers/net/fm/eth.c
index 2b616ad..c8dc1d0 100644
--- a/drivers/net/fm/eth.c
+++ b/drivers/net/fm/eth.c
@@ -65,7 +65,7 @@  void dtsec_configure_serdes(struct fm_eth *priv)
 static void dtsec_init_phy(struct eth_device *dev)
 {
 	struct fm_eth *fm_eth = dev->priv;
-	struct dtsec *regs = (struct dtsec *)fm_eth->mac->base;
+	struct dtsec *regs = (struct dtsec *)CONFIG_SYS_FSL_FM1_DTSEC1_ADDR;
 
 	/* Assign a Physical address to the TBI */
 	out_be32(&regs->tbipa, CONFIG_SYS_TBIPA_VALUE);