[U-Boot] [PATCH] revert "tsec: Force TBI PHY to 1000Mbps full duplex in SGMII mode"

Wolfgang Denk
2010-11-17T13:14:29Z

Dear Zhao Chenhui,

In message <1289986984-2314-1-git-send-email-b26998@freescale.com> you wrote:
> On P2020DS and MPC8572DS, the link to SGMII card which use Vitesse
> VSC8234 PHY can't come up. Current TBI PHY settings(TBICR_SETTINGS)
> for SGMII mode cause link problems.
>
> Revert commit 46e91674fb4b6d06c6a4984c0b5ac7d9a16923f4, and fix it.

This patch description is wrong, as you do not simply revert that
patch. Instead, you modify the code, shifting the setting from a
geric one into a XPEDITE5370 specific one.

When doing so, you should at least put the respective board maintainer
on CC. I understand your patch was not even tested on the XPEDITE5370
board?

But actually I think your approach is wrong - Peter's solution looks
reasobanle to me. When your boards with a specific PHY have problems,
then your boards should add appropriate CONFIG_TSEC_TBICR_SETTINGS to
their board config files.

If you insist in changing this code, you might as well clean it up a
bit, like that:

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index 9b5dd92..c205a7e 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -292,13 +292,11 @@ static uint tsec_local_mdio_read(volatile tsec_mdio_t *phyregs,

/* By default force the TBI PHY into 1000Mbps full duplex when in SGMII mode */
#ifndef CONFIG_TSEC_TBICR_SETTINGS
-#define TBICR_SETTINGS ( \
+#define CONFIG_TSEC_TBICR_SETTINGS ( \
TBICR_PHY_RESET \
| TBICR_FULL_DUPLEX \
| TBICR_SPEED1_SET \
)
-#else
-#define TBICR_SETTINGS CONFIG_TSEC_TBICR_SETTINGS
#endif /* CONFIG_TSEC_TBICR_SETTINGS */

/* Configure the TBI for SGMII operation */
@@ -311,7 +309,7 @@ static void tsec_configure_serdes(struct tsec_private *priv)
tsec_local_mdio_write(priv->phyregs_sgmii, priv->regs->tbipa, TBI_TBICON,
TBICON_CLK_SELECT);
tsec_local_mdio_write(priv->phyregs_sgmii, priv->regs->tbipa, TBI_CR,
- TBICR_SETTINGS);
+ CONFIG_TSEC_TBICR_SETTINGS);
}

/* Discover which PHY is attached to the device, and configure it

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
An Elephant is a mouse with an Operating System. - Knuth