Patchwork [U-Boot,v2,2/3] fec: add the i.mx6q enet driver support

login
register
mail settings
Submitter Jason Liu
Date Dec. 16, 2011, 3:17 p.m.
Message ID <1324048628-27516-3-git-send-email-jason.hui@linaro.org>
Download mbox | patch
Permalink /patch/131830/
State Awaiting Upstream
Delegated to: Stefano Babic
Headers show

Comments

Jason Liu - Dec. 16, 2011, 3:17 p.m.
Cc: Stefano Babic <sbabic@denx.de>
Signed-off-by: Jason Liu <jason.hui@linaro.org>
Acked-by: Stefano Babic <sbabic@denx.de>

---
v2: Add Stefano's ack
---
 drivers/net/fec_mxc.c |   10 ++++++++++
 drivers/net/fec_mxc.h |    7 ++++++-
 2 files changed, 16 insertions(+), 1 deletions(-)
Stefano Babic - Dec. 19, 2011, 6:45 a.m.
On 16/12/2011 16:17, Jason Liu wrote:
> Cc: Stefano Babic <sbabic@denx.de>
> Signed-off-by: Jason Liu <jason.hui@linaro.org>
> Acked-by: Stefano Babic <sbabic@denx.de>
> 


Applied to u-boot-imx, next branch, thanks.

Best regards,
Stefano Babic

Patch

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index b05a4c0..3affda8 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -384,6 +384,14 @@  static int fec_open(struct eth_device *edev)
 	writel(1 << 2, &fec->eth->x_cntrl);
 	fec->rbd_index = 0;
 
+#if defined(CONFIG_MX6Q)
+	/* Enable ENET HW endian SWAP */
+	writel(readl(&fec->eth->ecntrl) | FEC_ECNTRL_DBSWAP,
+		&fec->eth->ecntrl);
+	/* Enable ENET store and forward mode */
+	writel(readl(&fec->eth->x_wmrk) | FEC_X_WMRK_STRFWD,
+		&fec->eth->x_wmrk);
+#endif
 	/*
 	 * Enable FEC-Lite controller
 	 */
@@ -485,6 +493,8 @@  static int fec_init(struct eth_device *dev, bd_t* bd)
 	rcntrl = PKTSIZE << FEC_RCNTRL_MAX_FL_SHIFT;
 	if (fec->xcv_type == SEVENWIRE)
 		rcntrl |= FEC_RCNTRL_FCE;
+	else if (fec->xcv_type == RGMII)
+		rcntrl |= FEC_RCNTRL_RGMII;
 	else if (fec->xcv_type == RMII)
 		rcntrl |= FEC_RCNTRL_RMII;
 	else	/* MII mode */
diff --git a/drivers/net/fec_mxc.h b/drivers/net/fec_mxc.h
index 8b26645..39337bf 100644
--- a/drivers/net/fec_mxc.h
+++ b/drivers/net/fec_mxc.h
@@ -196,6 +196,7 @@  struct ethernet_regs {
 #define FEC_RCNTRL_PROM			0x00000008
 #define FEC_RCNTRL_BC_REJ		0x00000010
 #define FEC_RCNTRL_FCE			0x00000020
+#define FEC_RCNTRL_RGMII		0x00000040
 #define FEC_RCNTRL_RMII			0x00000100
 
 #define FEC_TCNTRL_GTS			0x00000001
@@ -206,6 +207,9 @@  struct ethernet_regs {
 
 #define FEC_ECNTRL_RESET		0x00000001	/* reset the FEC */
 #define FEC_ECNTRL_ETHER_EN		0x00000002	/* enable the FEC */
+#define FEC_ECNTRL_DBSWAP		0x00000100
+
+#define FEC_X_WMRK_STRFWD		0x00000100
 
 #if defined(CONFIG_MX25) || defined(CONFIG_MX53)
 /* defines for MIIGSK */
@@ -261,7 +265,8 @@  enum xceiver_type {
 	SEVENWIRE,	/* 7-wire       */
 	MII10,		/* MII 10Mbps   */
 	MII100,		/* MII 100Mbps  */
-	RMII		/* RMII */
+	RMII,		/* RMII */
+	RGMII,		/* RGMII */
 };
 
 /**