Patchwork [U-Boot,03/11] FEC: Kill mode select FIXME's

login
register
mail settings
Submitter Marek Vasut
Date Sept. 8, 2011, 8:37 p.m.
Message ID <1315514242-18998-4-git-send-email-marek.vasut@gmail.com>
Download mbox | patch
Permalink /patch/113937/
State Changes Requested
Headers show

Comments

Marek Vasut - Sept. 8, 2011, 8:37 p.m.
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Ben Warren <biggerbadderben@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>
---
 drivers/net/fec_mxc.c |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)
Mike Frysinger - Sept. 9, 2011, 12:48 a.m.
On Thursday, September 08, 2011 16:37:14 Marek Vasut wrote:
> +	/* Start with frame length = 1518, common for all modes. */
> +	rcntrl = 1518 << FEC_RCNTRL_MAX_FL_SHIFT;

you mean PKTSIZE ? ;)
-mike
Marek Vasut - Sept. 9, 2011, 12:19 p.m.
On Friday, September 09, 2011 02:48:13 AM Mike Frysinger wrote:
> On Thursday, September 08, 2011 16:37:14 Marek Vasut wrote:
> > +	/* Start with frame length = 1518, common for all modes. */
> > +	rcntrl = 1518 << FEC_RCNTRL_MAX_FL_SHIFT;
> 
> you mean PKTSIZE ? ;)
> -mike

Fixed internally ... if there's anything else, let me know. I'll roll out the 
new series then.

Patch

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 8e0d30a..bd76f97 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -400,6 +400,7 @@  static int fec_init(struct eth_device *dev, bd_t* bd)
 {
 	uint32_t base;
 	struct fec_priv *fec = (struct fec_priv *)dev->priv;
+	uint32_t rcntrl;
 
 	/* Initialize MAC address */
 	fec_set_hwaddr(dev);
@@ -442,19 +443,19 @@  static int fec_init(struct eth_device *dev, bd_t* bd)
 	/*
 	 * Set FEC-Lite receive control register(R_CNTRL):
 	 */
-	if (fec->xcv_type == SEVENWIRE) {
-		/*
-		 * Frame length=1518; 7-wire mode
-		 */
-		writel(0x05ee0020, &fec->eth->r_cntrl);	/* FIXME 0x05ee0000 */
-	} else {
-		/*
-		 * Frame length=1518; MII mode;
-		 */
-		writel(0x05ee0024, &fec->eth->r_cntrl);	/* FIXME 0x05ee0004 */
 
+	/* Start with frame length = 1518, common for all modes. */
+	rcntrl = 1518 << FEC_RCNTRL_MAX_FL_SHIFT;
+	if (fec->xcv_type == SEVENWIRE)
+		rcntrl |= FEC_RCNTRL_FCE;
+	else	/* MII mode */
+		rcntrl |= FEC_RCNTRL_FCE | FEC_RCNTRL_MII_MODE;
+
+	writel(rcntrl, &fec->eth->r_cntrl);
+
+	if (fec->xcv_type == MII10 || fec->xcv_type == MII100)
 		fec_mii_setspeed(fec);
-	}
+
 	/*
 	 * Set Opcode/Pause Duration Register
 	 */
@@ -731,7 +732,8 @@  static int fec_probe(bd_t *bd)
 	/*
 	 * Frame length=1518; MII mode;
 	 */
-	writel(0x05ee0024, &fec->eth->r_cntrl);	/* FIXME 0x05ee0004 */
+	writel((1518 << FEC_RCNTRL_MAX_FL_SHIFT) | FEC_RCNTRL_FCE |
+		FEC_RCNTRL_MII_MODE, &fec->eth->r_cntrl);
 	fec_mii_setspeed(fec);
 
 	sprintf(edev->name, "FEC");