summaryrefslogtreecommitdiff
path: root/common/cmd_mii.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-12-23 15:40:12 -0500
committerWolfgang Denk <wd@denx.de>2011-01-09 18:06:50 +0100
commit8ef583a0351590a91394499eb5ca2ab8a703d959 (patch)
tree36dafbd4bdd7e46130aec04bbc0dbfe26e896d9f /common/cmd_mii.c
parent4ffeab2cc00b61bc4616d9e3c25d33937b0feb34 (diff)
downloadu-boot-imx-8ef583a0351590a91394499eb5ca2ab8a703d959.zip
u-boot-imx-8ef583a0351590a91394499eb5ca2ab8a703d959.tar.gz
u-boot-imx-8ef583a0351590a91394499eb5ca2ab8a703d959.tar.bz2
miiphy: convert to linux/mii.h
The include/miiphy.h header duplicates a lot of things from linux/mii.h. So punt all the things that overlap to keep the API simple and to make merging between U-Boot and Linux simpler. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'common/cmd_mii.c')
-rw-r--r--common/cmd_mii.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/common/cmd_mii.c b/common/cmd_mii.c
index 3fb0795..23b723e 100644
--- a/common/cmd_mii.c
+++ b/common/cmd_mii.c
@@ -35,12 +35,12 @@ typedef struct _MII_reg_desc_t {
} MII_reg_desc_t;
static const MII_reg_desc_t reg_0_5_desc_tbl[] = {
- { 0, "PHY control register" },
- { 1, "PHY status register" },
- { 2, "PHY ID 1 register" },
- { 3, "PHY ID 2 register" },
- { 4, "Autonegotiation advertisement register" },
- { 5, "Autonegotiation partner abilities register" },
+ { MII_BMCR, "PHY control register" },
+ { MII_BMSR, "PHY status register" },
+ { MII_PHYSID1, "PHY ID 1 register" },
+ { MII_PHYSID2, "PHY ID 2 register" },
+ { MII_ADVERTISE, "Autonegotiation advertisement register" },
+ { MII_LPA, "Autonegotiation partner abilities register" },
};
typedef struct _MII_field_desc_t {
@@ -212,20 +212,19 @@ static int special_field(
const MII_field_desc_t *pdesc,
ushort regval)
{
- if ((regno == 0) && (pdesc->lo == 6)) {
- ushort speed_bits = regval & PHY_BMCR_SPEED_MASK;
+ if ((regno == MII_BMCR) && (pdesc->lo == 6)) {
+ ushort speed_bits = regval & (BMCR_SPEED1000 | BMCR_SPEED100);
printf("%2u,%2u = b%u%u speed selection = %s Mbps",
6, 13,
(regval >> 6) & 1,
(regval >> 13) & 1,
- speed_bits == PHY_BMCR_1000_MBPS ? "1000" :
- speed_bits == PHY_BMCR_100_MBPS ? "100" :
- speed_bits == PHY_BMCR_10_MBPS ? "10" :
- "???");
+ speed_bits == BMCR_SPEED1000 ? "1000" :
+ speed_bits == BMCR_SPEED100 ? "100" :
+ "10");
return 1;
}
- else if ((regno == 0) && (pdesc->lo == 8)) {
+ else if ((regno == MII_BMCR) && (pdesc->lo == 8)) {
printf("%2u = %5u duplex = %s",
pdesc->lo,
(regval >> pdesc->lo) & 1,
@@ -233,7 +232,7 @@ static int special_field(
return 1;
}
- else if ((regno == 4) && (pdesc->lo == 0)) {
+ else if ((regno == MII_ADVERTISE) && (pdesc->lo == 0)) {
ushort sel_bits = (regval >> pdesc->lo) & pdesc->mask;
printf("%2u-%2u = %5u selector = %s",
pdesc->hi, pdesc->lo, sel_bits,
@@ -245,7 +244,7 @@ static int special_field(
return 1;
}
- else if ((regno == 5) && (pdesc->lo == 0)) {
+ else if ((regno == MII_LPA) && (pdesc->lo == 0)) {
ushort sel_bits = (regval >> pdesc->lo) & pdesc->mask;
printf("%2u-%2u = %u selector = %s",
pdesc->hi, pdesc->lo, sel_bits,