Skip to contentSkip to conversation

CONFIG_PHY_ADDR is now supported by ether. [...]

PATCH New DENX Support System 1 participant 1 message Aug 11, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CONFIG_PHY_ADDR is now supported by ether. [...]

Hello list,

inside the automatic U-Boot patch tracking system a new ticket [DNX#2006081142000091] was created:

<snip>

Quoted 92 lines

Hi,

the following patch adds support for using the CONFIG_PHY_ADDR macro in the ethernet driver (ether.c) for the at91rm9200. All existing PHY drivers (bcm5221,
dm9261 and lxt972) were adapted.

cpu/arm920t/at91rm9200/bcm5221.c +10 -4
index 6db1435..b881323 100644
@@ -34,6 +34,10 @@ #ifdef CONFIG_DRIVER_ETHER
 
 #if (CONFIG_COMMANDS & CFG_CMD_NET)
 
+#ifndef CONFIG_PHY_ADDR
+#define CONFIG_PHY_ADDR 0
+#endif
+
 /*
  * Name:
  *	bcm5221_IsPhyConnected
@@ -50,8 +54,8 @@ unsigned int bcm5221_IsPhyConnected (AT9
 	unsigned short Id1, Id2;
 
 	at91rm9200_EmacEnableMDIO (p_mac);
-	at91rm9200_EmacReadPhy (p_mac, BCM5221_PHYID1, &Id1);
-	at91rm9200_EmacReadPhy (p_mac, BCM5221_PHYID2, &Id2);
+	at91rm9200_EmacReadPhy (p_mac, CONFIG_PHY_ADDR, BCM5221_PHYID1, &Id1);
+	at91rm9200_EmacReadPhy (p_mac, CONFIG_PHY_ADDR, BCM5221_PHYID2, &Id2);
 	at91rm9200_EmacDisableMDIO (p_mac);
 
 	if ((Id1 == (BCM5221_PHYID1_OUI >> 6)) &&
@@ -77,13 +81,15 @@ unsigned char bcm5221_GetLinkSpeed (AT91
 {
 	unsigned short stat1, stat2;
 
-	if (!at91rm9200_EmacReadPhy (p_mac, BCM5221_BMSR, &stat1))
+	if (!at91rm9200_EmacReadPhy (p_mac, CONFIG_PHY_ADDR, BCM5221_BMSR,
+		&stat1))
 		return FALSE;
 
 	if (!(stat1 & BCM5221_LINK_STATUS))	/* link status up? */
 		return FALSE;
 
-	if (!at91rm9200_EmacReadPhy (p_mac, BCM5221_ACSR, &stat2))
+	if (!at91rm9200_EmacReadPhy (p_mac, CONFIG_PHY_ADDR, BCM5221_ACSR,
+		&stat2))
 		return FALSE;
 
 	if ((stat1 & BCM5221_100BASE_TX_FD) && (stat2 & BCM5221_100) && (stat2

& BCM5221_FDX)) {

cpu/arm920t/at91rm9200/bcm5221.c +8 -4
@@ -142,13 +148,15 @@ unsigned char bcm5221_InitPhy (AT91PS_EM
 	}
 
 	/* Disable PHY Interrupts */
-	at91rm9200_EmacReadPhy (p_mac, BCM5221_INTR, &IntValue);
+	at91rm9200_EmacReadPhy (p_mac, CONFIG_PHY_ADDR, BCM5221_INTR,
+		&IntValue);
 	/* clear FDX LED and INTR Enable */
 	IntValue &= ~(BCM5221_FDX_LED | BCM5221_INTR_ENABLE);
 	/* set FDX, SPD, Link, INTR masks */
 	IntValue |= (BCM5221_FDX_MASK  | BCM5221_SPD_MASK |
 		     BCM5221_LINK_MASK | BCM5221_INTR_MASK);
-	at91rm9200_EmacWritePhy (p_mac, BCM5221_INTR, &IntValue);
+	at91rm9200_EmacWritePhy (p_mac, CONFIG_PHY_ADDR, BCM5221_INTR,
+		&IntValue);
 	at91rm9200_EmacDisableMDIO (p_mac);
 
 	return (ret);
@@ -174,41 +182,48 @@ unsigned char bcm5221_AutoNegotiate (AT9
 	unsigned short PhyAnalpar;
 
 	/* Set bcm5221 control register */
-	if (!at91rm9200_EmacReadPhy (p_mac, BCM5221_BMCR, &value))
+	if (!at91rm9200_EmacReadPhy (p_mac, CONFIG_PHY_ADDR, BCM5221_BMCR,
+		&value))
 		return FALSE;
 	value &= ~BCM5221_AUTONEG;	/* remove autonegotiation enable */
 	value |=  BCM5221_ISOLATE;	/* Electrically isolate PHY */
-	if (!at91rm9200_EmacWritePhy (p_mac, BCM5221_BMCR, &value))
+	if (!at91rm9200_EmacWritePhy (p_mac, CONFIG_PHY_ADDR, BCM5221_BMCR,
+		&value))
 		return FALSE;
 
 	/* Set the Auto_negotiation Advertisement Register */
 	/* MII advertising for 100BaseTxFD and HD, 10BaseTFD and HD, IEEE

802.3 */

cpu/arm920t/at91rm9200/bcm5221.c

Quoted 8 lines
cpu/arm920t/at91rm9200/bcm5221.c +2 -1
 	PhyAnar = BCM5221_TX_FDX | BCM5221_TX_HDX |
 		  BCM5221_10_FDX | BCM5221_10_HDX | BCM5221_AN_IEEE_802_3;
-	if (!at91rm9200_EmacWritePhy (p_mac, BCM5221_ANAR, &PhyAnar))
+	if (!at91rm9200_EmacWritePhy (p_mac, CONFIG_PHY_ADDR, BCM5221_ANAR,
+		&PhyAnar))
 		return FALSE;
 
 	/* Read the Control Register     */

</snip>

Your U-Boot support team