[U-Boot] [U-Boot PATCH MX31:] smc911x MII made available

Helmut.Raiger at hale.at Helmut.Raiger at hale.at
Mon Jun 20 08:10:54 CEST 2011


From: Helmut Raiger <helmut.raiger at hale.at>

The driver already had the MII functions, but they have not been
registered using miiphy_register().

Signed-off-by: Helmut Raiger <helmut.raiger at hale.at>
---
 drivers/net/smc911x.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index aeafeba..9378a63 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -235,6 +235,25 @@ static int smc911x_rx(struct eth_device *dev)
 	return 0;
 }
 
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
+/* wrapper for smc911x_miiphy_read */
+static int _phy_read(char *devname, u8 phy, u8 reg, u16 *val)
+{
+	struct eth_device *dev = eth_get_dev_by_name(devname);
+	if (dev)
+		return smc911x_miiphy_read(dev, phy, reg, val);
+	return -1;
+}
+/* wrapper for smc911x_miiphy_write */
+static int _phy_write(char *devname, u8 phy, u8 reg, u16 val)
+{
+	struct eth_device *dev = eth_get_dev_by_name(devname);
+	if (dev)
+		return smc911x_miiphy_write(dev, phy, reg, val);
+	return -1;
+}
+#endif
+
 int smc911x_initialize(u8 dev_num, int base_addr)
 {
 	unsigned long addrl, addrh;
@@ -273,5 +292,10 @@ int smc911x_initialize(u8 dev_num, int base_addr)
 	sprintf(dev->name, "%s-%hu", DRIVERNAME, dev_num);
 
 	eth_register(dev);
+
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
+	miiphy_register(dev->name, _phy_read, _phy_write);
+#endif
+
 	return 1;
 }
-- 
1.7.4.4



--
Scanned by MailScanner.



More information about the U-Boot mailing list