[U-Boot-Users] [DNX#2006081142000091] [PATCH] CONFIG_PHY_ADDR is now supported by ether. [...]
DENX Support System
support at denx.de
Fri Aug 11 17:10:02 CEST 2006
Hello list,
inside the automatic U-Boot patch tracking system a new ticket
[DNX#2006081142000091] was created:
<snip>
> 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.
>
> Signed-off-by: Mirco Fuchs <mircofuchs at web.de>
>
>
> diff --git a/cpu/arm920t/at91rm9200/bcm5221.c
> b/cpu/arm920t/at91rm9200/bcm5221.c
> index 6db1435..b881323 100644
> --- a/cpu/arm920t/at91rm9200/bcm5221.c
> +++ b/cpu/arm920t/at91rm9200/bcm5221.c
> @@ -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)) {
> @@ -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 */
> 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
More information about the U-Boot
mailing list