[U-Boot] [PATCH 1/5] net: fec_mxc: Add 1000 Mbps selection

Marek Vasut marek.vasut at gmail.com
Fri Jan 13 13:42:30 CET 2012


> From: Troy Kisky <troy.kisky at boundarydevices.com>
> 
> Add 1000 Mbps selection and print negotiated speed
> 
> 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>
> ---
>  drivers/net/fec_mxc.c |   16 +++++++++++++++-
>  1 files changed, 15 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
> index ed73353..9e8ef7a 100644
> --- a/drivers/net/fec_mxc.c
> +++ b/drivers/net/fec_mxc.c
> @@ -379,6 +379,7 @@ static int fec_set_hwaddr(struct eth_device *dev)
>  static int fec_open(struct eth_device *edev)
>  {
>  	struct fec_priv *fec = (struct fec_priv *)edev->priv;
> +	int speed;
> 
>  	debug("fec_open: fec_open(dev)\n");
>  	/* full-duplex, heartbeat disabled */
> @@ -428,8 +429,21 @@ static int fec_open(struct eth_device *edev)
>  #endif
> 
>  	miiphy_wait_aneg(edev);
> -	miiphy_speed(edev->name, fec->phy_id);
> +	speed = miiphy_speed(edev->name, fec->phy_id);
>  	miiphy_duplex(edev->name, fec->phy_id);
> +#ifdef CONFIG_MX6Q
> +	{
> +		u32 ecr = readl(&fec->eth->ecntrl) & ~(0x1 << 5);
> +		u32 rcr = (readl(&fec->eth->r_cntrl) & ~0x300) | 0x44;

Why the magic?

> +		if (speed == _1000BASET)
> +			ecr |= (0x1 << 5);
> +		else if (speed != _100BASET)
> +			rcr |= (0x1 << 9);
> +		writel(ecr, &fec->eth->ecntrl);
> +		writel(rcr, &fec->eth->r_cntrl);
> +	}
> +#endif
> +	printf("%s:Speed=%i\n", __func__, speed);

debug()

> 
>  	/*
>  	 * Enable SmartDMA receive task


More information about the U-Boot mailing list