summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Retanubun <RichardRetanubun@RuggedCom.com>2009-07-01 14:04:05 -0400
committerBen Warren <biggerbadderben@gmail.com>2009-08-10 16:07:54 -0700
commit1443cd7e54d6893ab7cc51d93fe7759cdaa8b31f (patch)
treed7efec9d188cedc1e7f319381936f3df4abbfe12
parent1a9519373b977ef3f7c9563ad3acb6c6f2424657 (diff)
downloadu-boot-imx-1443cd7e54d6893ab7cc51d93fe7759cdaa8b31f.zip
u-boot-imx-1443cd7e54d6893ab7cc51d93fe7759cdaa8b31f.tar.gz
u-boot-imx-1443cd7e54d6893ab7cc51d93fe7759cdaa8b31f.tar.bz2
UEC FIXED PHY: Determine fixed-phy port using UEC interface name.
Fixed a misunderstanding in the original implementation, 'devnum' that was used in the cpu/ppc4xx/4xx_enet.c implementation was NOT the PHY's SMI address, rather it was the number of the MAC interface on the CPU. The equivalent of this for uec_phy will be the UEC number stored in mii_info->dev->name. Usage example is updated for uec. Signed-off-by: Richard Retanubun <RichardRetanubun@RuggedCom.com> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
-rw-r--r--drivers/qe/uec_phy.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/drivers/qe/uec_phy.c b/drivers/qe/uec_phy.c
index d613f3e..aa4eb5e 100644
--- a/drivers/qe/uec_phy.c
+++ b/drivers/qe/uec_phy.c
@@ -51,27 +51,28 @@
*--------------------------------------------------------------------*/
/*
- * Some boards do not have a PHY for each ethernet port. These ports
- * are known as Fixed PHY (or PHY-less) ports. For such ports, set
- * the appropriate CONFIG_PHY_ADDR equal to CONFIG_FIXED_PHY and
- * then define CONFIG_SYS_FIXED_PHY_PORTS to define what the speed and
- * duplex should be for these ports in the board configuration
- * file.
+ * Some boards do not have a PHY for each ethernet port. These ports are known
+ * as Fixed PHY (or PHY-less) ports. For such ports, set the appropriate
+ * CONFIG_SYS_UECx_PHY_ADDR equal to CONFIG_FIXED_PHY_ADDR (an unused address)
+ * When the drver tries to identify the PHYs, CONFIG_FIXED_PHY will be returned
+ * and the driver will search CONFIG_SYS_FIXED_PHY_PORTS to find what network
+ * speed and duplex should be for the port.
*
- * For Example:
+ * Example board header configuration file:
* #define CONFIG_FIXED_PHY 0xFFFFFFFF
+ * #define CONFIG_SYS_FIXED_PHY_ADDR 0x1E (pick an unused phy address)
*
- * #define CONFIG_PHY_ADDR CONFIG_FIXED_PHY
- * #define CONFIG_PHY1_ADDR 1
- * #define CONFIG_PHY2_ADDR CONFIG_FIXED_PHY
- * #define CONFIG_PHY3_ADDR 3
+ * #define CONFIG_SYS_UEC1_PHY_ADDR CONFIG_SYS_FIXED_PHY_ADDR
+ * #define CONFIG_SYS_UEC2_PHY_ADDR 0x02
+ * #define CONFIG_SYS_UEC3_PHY_ADDR CONFIG_SYS_FIXED_PHY_ADDR
+ * #define CONFIG_SYS_UEC4_PHY_ADDR 0x04
*
- * #define CONFIG_SYS_FIXED_PHY_PORT(devnum,speed,duplex) \
- * {devnum, speed, duplex},
+ * #define CONFIG_SYS_FIXED_PHY_PORT(name,speed,duplex) \
+ * {name, speed, duplex},
*
* #define CONFIG_SYS_FIXED_PHY_PORTS \
- * CONFIG_SYS_FIXED_PHY_PORT(0,SPEED_100,DUPLEX_FULL) \
- * CONFIG_SYS_FIXED_PHY_PORT(2,SPEED_100,DUPLEX_HALF)
+ * CONFIG_SYS_FIXED_PHY_PORT("FSL UEC0",SPEED_100,DUPLEX_FULL) \
+ * CONFIG_SYS_FIXED_PHY_PORT("FSL UEC2",SPEED_100,DUPLEX_HALF)
*/
#ifndef CONFIG_FIXED_PHY
@@ -83,7 +84,7 @@
#endif
struct fixed_phy_port {
- unsigned int devnum; /* ethernet port */
+ char name[NAMESIZE]; /* ethernet port name */
unsigned int speed; /* specified speed 10,100 or 1000 */
unsigned int duplex; /* specified duplex FULL or HALF */
};
@@ -592,7 +593,8 @@ static int fixed_phy_read_status (struct uec_mii_info *mii_info)
int i = 0;
for (i = 0; i < ARRAY_SIZE(fixed_phy_port); i++) {
- if (mii_info->mii_id == fixed_phy_port[i].devnum) {
+ if (strncmp(mii_info->dev->name, fixed_phy_port[i].name,
+ strlen(mii_info->dev->name)) == 0) {
mii_info->speed = fixed_phy_port[i].speed;
mii_info->duplex = fixed_phy_port[i].duplex;
mii_info->link = 1; /* Link is always UP */