[PATCH 3/7] net fec: Add i.MX6 support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently only 100Mb/s is tested. Freescale's U-Boot suggests that
there are some additional adjustments necessary for Gigabit support.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 drivers/net/fec_imx.c |   25 ++++++++++++++++++++++---
 include/fec.h         |    1 +
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 08cd761..599a9b4 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -274,7 +274,7 @@ static int fec_set_hwaddr(struct eth_device *dev, unsigned char *mac)
 static int fec_init(struct eth_device *dev)
 {
 	struct fec_priv *fec = (struct fec_priv *)dev->priv;
-	u32 rcntl;
+	u32 rcntl, xwmrk;
 
 	/*
 	 * Clear FEC-Lite interrupt event register(IEVENT)
@@ -317,13 +317,25 @@ static int fec_init(struct eth_device *dev)
 			writel(FEC_MIIGSK_ENR_EN, fec->regs + FEC_MIIGSK_ENR);
 		}
 	}
+
+	if (fec->xcv_type == RGMII)
+		rcntl |= 1 << 6;
+
 	writel(rcntl, fec->regs + FEC_R_CNTRL);
 
 	/*
 	 * Set Opcode/Pause Duration Register
 	 */
 	writel(0x00010020, fec->regs + FEC_OP_PAUSE);
-	writel(0x2, fec->regs + FEC_X_WMRK);
+
+	xwmrk = 0x2;
+
+	/* set ENET tx at store and forward mode */
+	if (cpu_is_mx6())
+		xwmrk |= 1 << 8;
+
+	writel(xwmrk, fec->regs + FEC_X_WMRK);
+
 	/*
 	 * Set multicast address filter
 	 */
@@ -349,6 +361,7 @@ static int fec_open(struct eth_device *edev)
 {
 	struct fec_priv *fec = (struct fec_priv *)edev->priv;
 	int ret;
+	u32 ecr;
 
 	/*
 	 * Initialize RxBD/TxBD rings
@@ -363,7 +376,13 @@ static int fec_open(struct eth_device *edev)
 	/*
 	 * Enable FEC-Lite controller
 	 */
-	writel(FEC_ECNTRL_ETHER_EN, fec->regs + FEC_ECNTRL);
+	ecr = FEC_ECNTRL_ETHER_EN;
+
+	/* Enable Swap to support little-endian device */
+	if (cpu_is_mx6())
+		ecr |= 0x100;
+
+	writel(ecr, fec->regs + FEC_ECNTRL);
 	/*
 	 * Enable SmartDMA receive task
 	 */
diff --git a/include/fec.h b/include/fec.h
index 85691b6..f56b023 100644
--- a/include/fec.h
+++ b/include/fec.h
@@ -33,6 +33,7 @@ typedef enum {
 	MII10,
 	MII100,
 	RMII,
+	RGMII,
 } xceiver_type;
 
 /*
-- 
1.7.10


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux