From patchwork Fri Dec 16 15:17:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Hui X-Patchwork-Id: 5821 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 3AA6723E33 for ; Fri, 16 Dec 2011 15:08:17 +0000 (UTC) Received: from mail-lpp01m010-f52.google.com (mail-lpp01m010-f52.google.com [209.85.215.52]) by fiordland.canonical.com (Postfix) with ESMTP id 1B5C6A184D0 for ; Fri, 16 Dec 2011 15:08:17 +0000 (UTC) Received: by mail-lpp01m010-f52.google.com with SMTP id j13so2005410lah.11 for ; Fri, 16 Dec 2011 07:08:17 -0800 (PST) Received: by 10.204.133.213 with SMTP id g21mr3140922bkt.126.1324048096782; Fri, 16 Dec 2011 07:08:16 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.204.41.207 with SMTP id p15cs7986bke; Fri, 16 Dec 2011 07:08:16 -0800 (PST) Received: by 10.180.4.42 with SMTP id h10mr12875360wih.22.1324048095254; Fri, 16 Dec 2011 07:08:15 -0800 (PST) Received: from DB3EHSOBE003.bigfish.com (db3ehsobe003.messaging.microsoft.com. [213.199.154.141]) by mx.google.com with ESMTPS id fj5si6202968wbb.128.2011.12.16.07.08.15 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 16 Dec 2011 07:08:15 -0800 (PST) Received-SPF: neutral (google.com: 213.199.154.141 is neither permitted nor denied by best guess record for domain of jason.hui@linaro.org) client-ip=213.199.154.141; Authentication-Results: mx.google.com; spf=neutral (google.com: 213.199.154.141 is neither permitted nor denied by best guess record for domain of jason.hui@linaro.org) smtp.mail=jason.hui@linaro.org Received: from mail37-db3-R.bigfish.com (10.3.81.240) by DB3EHSOBE003.bigfish.com (10.3.84.23) with Microsoft SMTP Server id 14.1.225.23; Fri, 16 Dec 2011 15:08:13 +0000 Received: from mail37-db3 (localhost [127.0.0.1]) by mail37-db3-R.bigfish.com (Postfix) with ESMTP id 270EE1402B8; Fri, 16 Dec 2011 15:08:23 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275dhz2dh87h2a8h668h839h) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-FB-SS: 13, X-FB-DOMAIN-IP-MATCH: fail Received: from mail37-db3 (localhost.localdomain [127.0.0.1]) by mail37-db3 (MessageSwitch) id 1324048102721311_16816; Fri, 16 Dec 2011 15:08:22 +0000 (UTC) Received: from DB3EHSMHS001.bigfish.com (unknown [10.3.81.245]) by mail37-db3.bigfish.com (Postfix) with ESMTP id A12C1260043; Fri, 16 Dec 2011 15:08:22 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB3EHSMHS001.bigfish.com (10.3.87.101) with Microsoft SMTP Server (TLS) id 14.1.225.23; Fri, 16 Dec 2011 15:08:08 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server id 14.1.355.3; Fri, 16 Dec 2011 09:08:07 -0600 Received: from r64343-desktop.ap.freescale.net (r64343-desktop.ap.freescale.net [10.192.242.36]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id pBGF80l6021112; Fri, 16 Dec 2011 09:08:04 -0600 (CST) From: Jason Liu To: CC: Subject: [U-Boot][PATCH v2 2/3] fec: add the i.mx6q enet driver support Date: Fri, 16 Dec 2011 23:17:07 +0800 Message-ID: <1324048628-27516-3-git-send-email-jason.hui@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1324048628-27516-1-git-send-email-jason.hui@linaro.org> References: <1324048628-27516-1-git-send-email-jason.hui@linaro.org> MIME-Version: 1.0 X-OriginatorOrg: sigmatel.com Cc: Stefano Babic Signed-off-by: Jason Liu Acked-by: Stefano Babic --- v2: Add Stefano's ack --- drivers/net/fec_mxc.c | 10 ++++++++++ drivers/net/fec_mxc.h | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletions(-) 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 */ }; /**