[U-Boot-Users] CONFIG_MII, 83xx, no MII device?
Kim Phillips
kim.phillips at freescale.com
Tue Dec 4 23:03:56 CET 2007
On Fri, 30 Nov 2007 03:22:37 -0800
"Russell McGuire" <rmcguire at videopresence.com> wrote:
> How can I enable full MII commands? Currently it just says there are NO MII
> devices available, i.e. a blank list will appear.
try this:
diff --git a/drivers/qe/uec.c b/drivers/qe/uec.c
index 9bd80e7..7fa4246 100644
--- a/drivers/qe/uec.c
+++ b/drivers/qe/uec.c
@@ -21,6 +21,7 @@
#include "common.h"
#include "net.h"
+#include "miiphy.h"
#include "malloc.h"
#include "asm/errno.h"
#include "asm/io.h"
@@ -69,6 +70,9 @@ static uec_info_t eth2_uec_info = {
};
#endif
+/* needed for the u-boot mii command interface */
+static struct eth_device *eth_devs[2];
+
static int uec_mac_enable(uec_private_t *uec, comm_dir_e mode)
{
uec_t *uec_regs;
@@ -1202,6 +1206,50 @@ static int uec_recv(struct eth_device* dev)
return 1;
}
+/*
+ * Read a MII PHY register.
+ *
+ * Returns:
+ * 0 on success
+ */
+static int uec_miiphy_read(char *devname, unsigned char addr,
+ unsigned char reg, unsigned short *value)
+{
+ unsigned short ret;
+ int index;
+ struct eth_device *dev;
+
+ /* devname is 'FSL UECn', so generate an index from that */
+ index = devname[7] - '0';
+ dev = eth_devs[index];
+
+ ret = (unsigned short)uec_read_phy_reg(dev, addr, reg);
+ *value = ret;
+
+ return 0;
+}
+
+/*
+ * Write a MII PHY register.
+ *
+ * Returns:
+ * 0 on success
+ */
+static int uec_miiphy_write(char *devname, unsigned char addr,
+ unsigned char reg, unsigned short value)
+{
+ int index;
+ struct eth_device *dev;
+
+ /* devname is 'FSL UECn', so generate an index from that */
+ index = devname[7] - '0';
+ dev = eth_devs[index];
+
+ uec_write_phy_reg(dev, addr, reg, value);
+
+ return 0;
+}
+
int uec_initialize(int index)
{
struct eth_device *dev;
@@ -1252,12 +1300,17 @@ int uec_initialize(int index)
eth_register(dev);
+ eth_devs[index] = dev;
+
err = uec_startup(uec);
if (err) {
printf("%s: Cannot configure net device, aborting.",dev->name);
return err;
}
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) && !defined(BITBANGMII)
+ miiphy_register(dev->name, uec_miiphy_read, uec_miiphy_write);
+#endif
err = init_phy(dev);
if (err) {
printf("%s: Cannot initialize PHY, aborting.\n", dev->name);
---
you might have to
mii device 'FSL UEC1'
first.
I'll submit a proper patch if it works for you.
Kim
More information about the U-Boot
mailing list