public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: richardretanubun <richardretanubun@ruggedcom.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [Patch 1/1] Re-Submit: QE UEC: Add MII Commands
Date: Tue, 29 Jul 2008 11:10:09 -0400	[thread overview]
Message-ID: <488F32D1.2080704@ruggedcom.com> (raw)
In-Reply-To: <20080729144312.D998B248B9@gemini.denx.de>

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 <4885F8BE.6010503@gmail.com> 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
>
>   

  reply	other threads:[~2008-07-29 15:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-16 19:17 [U-Boot-Users] QE UEC: MII command support and adding UECs richardretanubun
2008-07-16 21:16 ` Andy Fleming
2008-07-22 15:11   ` Ben Warren
2008-07-29 14:43     ` Wolfgang Denk
2008-07-29 15:10       ` richardretanubun [this message]
2008-07-29 15:48         ` [U-Boot-Users] [Patch 1/1] Re-Submit: QE UEC: Add MII Commands Kim Phillips
2008-07-29 21:35         ` [U-Boot-Users] unassigned-patches/15: " u-boot at bugs.denx.de
2008-07-29 21:43           ` Wolfgang Denk

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=488F32D1.2080704@ruggedcom.com \
    --to=richardretanubun@ruggedcom.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