From: Kim Phillips <kim.phillips@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] CONFIG_MII, 83xx, no MII device?
Date: Tue, 4 Dec 2007 16:03:56 -0600 [thread overview]
Message-ID: <20071204160356.fb61dc05.kim.phillips@freescale.com> (raw)
In-Reply-To: <001a01c83343$502979e0$6405a8c0@absolut>
On Fri, 30 Nov 2007 03:22:37 -0800
"Russell McGuire" <rmcguire@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
next prev parent reply other threads:[~2007-12-04 22:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.185590.1187040981.7786.u-boot-users@lists.sourceforge.net>
2007-11-30 11:22 ` [U-Boot-Users] CONFIG_MII, 83xx, no MII device? Russell McGuire
2007-12-04 22:03 ` Kim Phillips [this message]
2007-12-04 23:50 ` Joakim Tjernlund
2007-12-05 15:12 ` Kim Phillips
2007-12-19 3:58 ` [U-Boot-Users] 83xx, FSL_UEC reducing boot latency, printf causing crash Russell McGuire
2007-12-19 7:54 ` Joakim Tjernlund
2007-12-19 8:07 ` Joakim Tjernlund
2007-12-19 23:36 ` Russell McGuire
2007-12-20 1:13 ` Kim Phillips
[not found] ` <000001c8435a$99d4b1f0$6405a8c0@absolut>
[not found] ` <1198194282.8129.45.camel@gentoo-jocke.transmode.se>
2007-12-21 10:45 ` Russell McGuire
2007-12-21 12:35 ` Joakim Tjernlund
2007-12-21 12:44 ` Joakim Tjernlund
2007-12-22 0:18 ` Ben Warren
2007-12-21 11:02 ` Russell McGuire
2007-12-21 12:12 ` Joakim Tjernlund
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071204160356.fb61dc05.kim.phillips@freescale.com \
--to=kim.phillips@freescale.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox