Patch originally submitted by David Saada

http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/38946

Shamelessly copy-pasted below.

Richard
===========================================================================

Add MII commands to the UEC driver. Note that once a UEC device is selected,
any device on its MDIO bus can be addressed.

Signed-off-by: David Saada <david.saada <at> ecitele.com>

 uec.c |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

--- a/drivers/qe/uec.c  2008-03-30 16:30:16.342061000 +0300
+++ b/drivers/qe/uec.c  2008-03-31 12:30:13.862288000 +0300
@@ -29,6 +29,7 @@
 #include "uccf.h"
 #include "uec.h"
 #include "uec_phy.h"
+#include "miiphy.h"

 #if defined(CONFIG_QE)

@@ -125,6 +126,17 @@ static uec_info_t eth4_uec_info = {
 };
 #endif

+#define MAXCONTROLLERS (4)
+
+static struct eth_device *devlist[MAXCONTROLLERS];
+
+static int uec_miiphy_read(char *devname, unsigned char addr,
+                           unsigned char reg, unsigned short *value);
+static int uec_miiphy_write(char *devname, unsigned char addr,
+                            unsigned char reg, unsigned short value);
+u16 phy_read (struct uec_mii_info *mii_info, u16 regnum);
+void phy_write (struct uec_mii_info *mii_info, u16 regnum, u16 val);
+
 static int uec_mac_enable(uec_private_t *uec, comm_dir_e mode)
 {
        uec_t           *uec_regs;
@@ -1334,6 +1346,8 @@ int uec_initialize(int index)
                return -EINVAL;
        }

+       devlist[index] = dev;
+
        uec->uec_info = uec_info;

        sprintf(dev->name, "FSL UEC%d", index);
@@ -1356,6 +1370,45 @@ int uec_initialize(int index)
                return err;
        }

+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) \
+       && !defined(BITBANGMII)
+       miiphy_register(dev->name, uec_miiphy_read, uec_miiphy_write);
+#endif
+
        return 1;
 }
+
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) \
+       && !defined(BITBANGMII)
+
+/*
+ * 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)
+{
+       *value = uec_read_phy_reg(devlist[0], addr, reg);
+
+       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)
+{
+       uec_write_phy_reg(devlist[0], addr, reg, value);
+
+       return 0;
+}
+
+#endif
+
 #endif /* CONFIG_QE */




Wolfgang Denk wrote:
> Dear Richard,
>
> in message <[EMAIL PROTECTED]> Ben Warren wrote:
>   
>>>> The last info I have on this patch is on this posting:
>>>>
>>>> http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/38965
>>>>         
>>> Hm... I vaguely recall seeing that, but it's more in Ben Warren's
>>> domain.  He probably wasn't copied on the patch, either.
>>>   
>>>       
>> Yeah, looks like I missed that one.  To answer your question, no.  I 
>> won't be able to apply it until the weekend at the earliest, so for now 
>> please just apply the patch yourself.
>>     
>
> Can you please post updated patches?
>
> Thanks in advance.
>
> Best regards,
>
> Wolfgang Denk
>
>   


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Reply via email to