[U-Boot] [PATCH 3/5] miiphyutil: Add Micrel KSZ9021 support to miiphy_speed

Dirk Behme dirk.behme at de.bosch.com
Thu Jan 19 13:27:24 CET 2012


Hi Troy,

On 13.01.2012 13:10, Dirk Behme wrote:
> From: Troy Kisky <troy.kisky at boundarydevices.com>
> 
> Previously, only GIGE phy was supported in this function.
> 
> Signed-off-by: Troy Kisky <troy.kisky at boundarydevices.com>
> CC: Troy Kisky <troy.kisky at boundarydevices.com>
> CC: Stefano Babic <sbabic at denx.de>
> CC: Marek Vasut <marek.vasut at gmail.com>
> ---
>  common/miiphyutil.c |   18 +++++++++++++++++-
>  1 files changed, 17 insertions(+), 1 deletions(-)
> 
> diff --git a/common/miiphyutil.c b/common/miiphyutil.c
> index 2cc23b4..8cb4748 100644
> --- a/common/miiphyutil.c
> +++ b/common/miiphyutil.c
> @@ -471,7 +471,23 @@ int miiphy_speed(const char *devname, unsigned char addr)
>  			(btsr & (PHY_1000BTSR_1000FD | PHY_1000BTSR_1000HD)))
>  		return _1000BASET;
>  #endif /* CONFIG_PHY_GIGE */
> -
> +#ifdef CONFIG_PHY_MICREL_KSZ9021
> +#define MII_PHY_CTL		0x1f
> +#define MII_PHY_CTL_1000	(1 << 6)
> +#define MII_PHY_CTL_100		(1 << 5)
> +#define MII_PHY_CTL_10		(1 << 4)
> +	u16 btsr;
> +	if (miiphy_read(devname, addr, MII_PHY_CTL, &btsr)) {
> +		printf("PHY 1000BT status");
> +		goto miiphy_read_failed;
> +	}
> +	if (btsr & MII_PHY_CTL_1000)
> +		return _1000BASET;
> +	if (btsr & MII_PHY_CTL_100)
> +		return _100BASET;
> +	if (btsr & MII_PHY_CTL_10)
> +		return _10BASET;
> +#endif
>  	/* Check Basic Management Control Register first. */
>  	if (miiphy_read(devname, addr, MII_BMCR, &bmcr)) {
>  		printf("PHY speed");

Thilo mentioned that on an ARM2 board he additionally needs

diff --git a/common/miiphyutil.c b/common/miiphyutil.c
index 8cb4748..d3ff2af 100644
--- a/common/miiphyutil.c
+++ b/common/miiphyutil.c
@@ -500,6 +500,8 @@ int miiphy_speed(const char *devname, unsigned char 
addr)
  			printf("PHY AN speed");
  			goto miiphy_read_failed;
  		}
+		if (anlpar & LPA_1000XFULL )
+			return _1000BASET;
  		return (anlpar & LPA_100) ? _100BASET : _10BASET;
  	}
  	/* Get speed from basic control settings. */

to make GbE work on that board. What do you think?

Best regards

Dirk


More information about the U-Boot mailing list