[U-Boot] [PATCH V4 3/8] imx: fec: Resolve speed before configuring gasket

Troy Kisky
2012-04-19T19:27:16Z

On 4/19/2012 1:55 AM, Timo Ketola wrote:
> Gasket needs a different configuration for 10BaseT than for higher
> speeds.
>
> Signed-off-by: Timo Ketola<timo@exertus.fi>
> ---
>
> Changes in v4:
> - Rewrapped commit message
>
> Changes in v2:
> - Dropped patches 2 and 3 so this one changed from 5 to 3
> - Rebased to u-boot-imx next
> - Removed the remove of 'miiphy_duplex' call
> - Changed 'speed == _100BASET' to 'speed != _10BASET' to not to break
> _1000BASET
> - Changed configuration option to put gasket into RMII mode from
> !CONFIG_MII to CONFIG_RMII. I'm not too sure how this should be
> done though. !CONFIG_MII is normally used for this but its original
> purpose was to enable MII *management* interface, I think...
>
> drivers/net/fec_mxc.c | 43 ++++++++++++++++++++++++-------------------
> 1 files changed, 24 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
> index 824a199..48a69d4 100644
> --- a/drivers/net/fec_mxc.c
> +++ b/drivers/net/fec_mxc.c
> @@ -440,6 +440,22 @@ static int fec_open(struct eth_device *edev)
> */
> writel(readl(&fec->eth->ecntrl) | FEC_ECNTRL_ETHER_EN,
> &fec->eth->ecntrl);
> +#ifdef CONFIG_PHYLIB
> + if (!fec->phydev)
> + fec_eth_phy_config(edev);
> + if (fec->phydev) {
> + /* Start up the PHY */
> + phy_startup(fec->phydev);
> + speed = fec->phydev->speed;
> + } else {
> + speed = _100BASET;
> + }
> +#else
> + miiphy_wait_aneg(edev);
> + speed = miiphy_speed(edev->name, fec->phy_id);
> + miiphy_duplex(edev->name, fec->phy_id);
> +#endif
> +
> #if defined(CONFIG_MX25) || defined(CONFIG_MX53)
> udelay(100);
> /*
> @@ -453,9 +469,14 @@ static int fec_open(struct eth_device *edev)
> while (readw(&fec->eth->miigsk_enr)& MIIGSK_ENR_READY)
> udelay(2);
>
> -#if !defined(CONFIG_MII)
> - /* configure gasket for RMII, 50 MHz, no loopback, and no echo */
> - writew(MIIGSK_CFGR_IF_MODE_RMII,&fec->eth->miigsk_cfgr);
> +#if defined(CONFIG_RMII)

While this change seems to make sense, it could break some boards.
Please split out to a separate patch,
and leave as !defined(CONFIG_MII) for this patch.

Thanks
Troy