Message ID | 1326456604-25137-3-git-send-email-dirk.behme@de.bosch.com |
---|---|
State | Superseded |
Headers | show |
> From: Troy Kisky <troy.kisky@boundarydevices.com> > > Previously, only GIGE phy was supported in this function. > > Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com> > CC: Troy Kisky <troy.kisky@boundarydevices.com> > CC: Stefano Babic <sbabic@denx.de> > CC: Marek Vasut <marek.vasut@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"); 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");
On Friday 13 January 2012 07:10:02 Dirk Behme wrote: > common/miiphyutil.c | 18 +++++++++++++++++- > 1 files changed, 17 insertions(+), 1 deletions(-) this is dead code ... i think we're pushing people to use the name phy framework rather than fixing/extending the old one. > --- a/common/miiphyutil.c > +++ b/common/miiphyutil.c > > +#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) are you sure there aren't defines already in linux/mii.h for these ? -mike
On 15.01.2012 01:56, Mike Frysinger wrote: > On Friday 13 January 2012 07:10:02 Dirk Behme wrote: >> common/miiphyutil.c | 18 +++++++++++++++++- >> 1 files changed, 17 insertions(+), 1 deletions(-) > > this is dead code ... i think we're pushing people to use the name phy > framework rather than fixing/extending the old one. Could you point us to an example how to "use the name phy framework"? Many thanks and best regards Dirk
On 19.01.2012 13:38, Dirk Behme wrote: > On 15.01.2012 01:56, Mike Frysinger wrote: >> On Friday 13 January 2012 07:10:02 Dirk Behme wrote: >>> common/miiphyutil.c | 18 +++++++++++++++++- >>> 1 files changed, 17 insertions(+), 1 deletions(-) >> >> this is dead code ... i think we're pushing people to use the name >> phy framework rather than fixing/extending the old one. > > Could you point us to an example how to "use the name phy framework"? Hmm, is anything like http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=commitdiff;h=5751aa2f248a72c3cec7048cec8dfad33dab0979 http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=commitdiff;h=fcc0c75dea90f2bb8394e7031fc33f72119be544 meant here? Best regards Dirk
On Thursday 19 January 2012 07:38:44 Dirk Behme wrote: > On 15.01.2012 01:56, Mike Frysinger wrote: > > On Friday 13 January 2012 07:10:02 Dirk Behme wrote: > >> common/miiphyutil.c | 18 +++++++++++++++++- > >> 1 files changed, 17 insertions(+), 1 deletions(-) > > > > this is dead code ... i think we're pushing people to use the name phy > > framework rather than fixing/extending the old one. > > Could you point us to an example how to "use the name phy framework"? sorry, typo. i meant "new phy framework". as in the phylib stuff. -mike
On Thursday 19 January 2012 11:19:52 Dirk Behme wrote: > On 19.01.2012 13:38, Dirk Behme wrote: > > On 15.01.2012 01:56, Mike Frysinger wrote: > >> On Friday 13 January 2012 07:10:02 Dirk Behme wrote: > >>> common/miiphyutil.c | 18 +++++++++++++++++- > >>> 1 files changed, 17 insertions(+), 1 deletions(-) > >> > >> this is dead code ... i think we're pushing people to use the name > >> phy framework rather than fixing/extending the old one. > > > > Could you point us to an example how to "use the name phy framework"? > > Hmm, is anything like > > http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=commitdiff;h=5751aa2f2 > 48a72c3cec7048cec8dfad33dab0979 > > http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=commitdiff;h=fcc0c75de > a90f2bb8394e7031fc33f72119be544 > > meant here? yep, that's the ticket -mike
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");