[U-Boot] [PATCH] net: phy: micrel: add an option to disable gigabit for the KSZ9031
Joe Hershberger
joe.hershberger at ni.com
Tue Aug 1 16:34:05 UTC 2017
On Fri, Jul 28, 2017 at 2:59 PM, Sebastien Bourdelin
<sebastien.bourdelin at savoirfairelinux.com> wrote:
> The environment variable "disable_giga" can now be used to disable
> 1000baseTx on the Micrel's KSZ9031.
>
> Signed-off-by: Sebastien Bourdelin <sebastien.bourdelin at savoirfairelinux.com>
Other than one nit below...
Acked-by: Joe Hershberger <joe.hershberger at ni.com>
> ---
> drivers/net/phy/micrel.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index 0e4a4ebcc6..eeeba3c232 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -491,12 +491,39 @@ static int ksz9031_phy_extwrite(struct phy_device *phydev, int addr,
> static int ksz9031_config(struct phy_device *phydev)
> {
> int ret;
> + unsigned features;
> + unsigned bmcr = 0;
Seems better to define these in the block where they are used and
inconsistent initialization is odd. Neither need init since they are
assigned as first use.
> +
> ret = ksz9031_of_config(phydev);
> if (ret)
> return ret;
> ret = ksz9031_center_flp_timing(phydev);
> if (ret)
> return ret;
> +
> + /* add an option to disable the gigabit feature of this PHY */
> + if (getenv("disable_giga")) {
> + /* disable speed 1000 in features supported by the PHY */
> + features = phydev->drv->features;
> + features &= ~(SUPPORTED_1000baseT_Half |
> + SUPPORTED_1000baseT_Full);
> + phydev->advertising = phydev->supported = features;
> +
> + /* disable speed 1000 in Basic Control Register */
> + bmcr = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);
> + bmcr &= ~(1 << 6);
> + phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, bmcr);
> +
> + /* disable speed 1000 in 1000Base-T Control Register */
> + phy_write(phydev, MDIO_DEVAD_NONE, MII_CTRL1000, 0);
> +
> + /* start autoneg */
> + genphy_config_aneg(phydev);
> + genphy_restart_aneg(phydev);
> +
> + return 0;
> + }
> +
> return genphy_config(phydev);
> }
>
> --
> 2.13.3
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot
More information about the U-Boot
mailing list