[U-Boot] [PATCH] ppc4xx - allow usage of fixed/unmanaged PHYs

Wolfgang Ocker
2008-08-26T18:11:24Z

This patch allows a managed switch like the 88E6083 to be directly
connected to a 4xx using PHY mode.

It avoids waiting for a link (it's always there) and uses fixed values
for speed and duplex mode since both settings are hardware controlled.

Should I use "FIXED" instead of "UNMANAGED" (so called in the kernel
afair)?

---
Support unmanaged/fixed PHYs like port 8/9 of Marvell 88E6083 on 4xx.

Added config vars CONFIG_UNMANAGED_PHY, CONFIG_UNMANAGED_PHY_SPEED
and CONFIG_UNMANAGED_PHY_FULL_DUPLEX to allow unmanaged PHYs
and to configure the settings for speed and duplex mode.

Signed-off-by: Wolfgang Ocker <weo@reccoware.de>

---
cpu/ppc4xx/4xx_enet.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/cpu/ppc4xx/4xx_enet.c b/cpu/ppc4xx/4xx_enet.c
index 8a38335..3b32fa5 100644
--- a/cpu/ppc4xx/4xx_enet.c
+++ b/cpu/ppc4xx/4xx_enet.c
@@ -800,7 +800,9 @@ static int ppc_4xx_eth_init (struct eth_device *dev, bd_t * bis)
unsigned long failsafe;
unsigned mode_reg;
unsigned short devnum;
+#ifndef CONFIG_UNMANAGED_PHY
unsigned short reg_short;
+#endif
#if defined(CONFIG_440GX) || \
defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \
@@ -945,6 +947,7 @@ static int ppc_4xx_eth_init (struct eth_device *dev, bd_t * bis)
out_be32((void *)EMAC_M1 + hw_p->hw_addr, mode_reg);
#endif /* defined(CONFIG_440GX) || defined(CONFIG_440SP) */

+#ifndef CONFIG_UNMANAGED_PHY
/* wait for PHY to complete auto negotiation */
reg_short = 0;
#ifndef CONFIG_CS8952_PHY
@@ -1082,7 +1085,10 @@ static int ppc_4xx_eth_init (struct eth_device *dev, bd_t * bis)

speed = miiphy_speed (dev->name, reg);
duplex = miiphy_duplex (dev->name, reg);
-
+#else /* !CONFIG_UNMANAGED_PHY */
+ speed = CONFIG_UNMANAGED_PHY_SPEED;
+ duplex = CONFIG_UNMANAGED_PHY_FULL_DUPLEX ? FULL : HALF;
+#endif
if (hw_p->print_speed) {
hw_p->print_speed = 0;
printf ("ENET Speed is %d Mbps - %s duplex connection (EMAC%d)\n",