[U-Boot-Users] Patch PHY Reset (needed for Marvell 88E1111)

Attached is a patch that preserved the contents of PHY_BMCR during a soft reset by only setting the reset bit. This allows the PHY strapping to be preserved. The patch also include an enhancement that allows overiding of the miiphy_speed and miiphy_duplex functions when RGMII is used without PHYs for proper MAC configuration.
Regards, Carl Riechers
____________________________________________________ Yahoo! Sports Rekindle the Rivalries. Sign up for Fantasy Football http://football.fantasysports.yahoo.com
--- u-boot/common/miiphyutil.c 2005-06-24 14:02:18.457551500 -0500 +++ u-boot/common/miiphyutil.c 2005-06-24 14:03:17.000000000 -0500 @@ -29,6 +29,14 @@ #include <common.h> #include <miiphy.h>
+/* undefine functions that may have been renamed for a specific board */ +#ifdef miiphy_speed +#undef miiphy_speed +#endif +#ifdef miiphy_duplex +#undef miiphy_duplex +#endif + #if defined(CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII)
/***************************************************************************** @@ -93,7 +101,13 @@ int miiphy_reset (unsigned char addr) unsigned short reg; int loop_cnt;
- if (miiphy_write (addr, PHY_BMCR, 0x8000) != 0) { + if (miiphy_read (addr, PHY_BMCR, ®) != 0) { +#ifdef DEBUG + printf ("PHY status read failed\n"); +#endif + return (-1); + } + if (miiphy_write (addr, PHY_BMCR, reg | 0x8000) != 0) { #ifdef DEBUG puts ("PHY reset failed\n"); #endif

In message 20050624194024.24773.qmail@web30313.mail.mud.yahoo.com you wrote:
Attached is a patch that preserved the contents of PHY_BMCR during a soft reset by only setting the reset bit. This allows the PHY strapping to be preserved.
Added, thanks.
The patch also include an enhancement that allows overiding of the miiphy_speed and miiphy_duplex functions when RGMII is used without PHYs for proper MAC configuration.
...
+/* undefine functions that may have been renamed for a specific board */ +#ifdef miiphy_speed +#undef miiphy_speed +#endif +#ifdef miiphy_duplex +#undef miiphy_duplex +#endif
Ummm... me thinks that if these symbols are defined hat there should be some reason for this, and simply undefining those is probably not a good idea? Maybe I simply don't understand what you have in mind. Rejected for now - please elucidate.
Best regards,
Wolfgang Denk
participants (2)
-
Carl Riechers
-
Wolfgang Denk