From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Fri, 13 Jan 2012 13:44:12 +0100 Subject: [U-Boot] [PATCH 3/5] miiphyutil: Add Micrel KSZ9021 support to miiphy_speed In-Reply-To: <1326456604-25137-3-git-send-email-dirk.behme@de.bosch.com> References: <1326456604-25137-1-git-send-email-dirk.behme@de.bosch.com> <1326456604-25137-3-git-send-email-dirk.behme@de.bosch.com> Message-ID: <201201131344.12304.marek.vasut@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de > From: Troy Kisky > > Previously, only GIGE phy was supported in this function. > > Signed-off-by: Troy Kisky > CC: Troy Kisky > CC: Stefano Babic > CC: Marek Vasut > --- > 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"); Very helpful message. Please, if you want to print some output, output something understandable. > + 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");