From patchwork Tue Dec 13 13:44:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Hui X-Patchwork-Id: 5633 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 A8FA823E0E for ; Tue, 13 Dec 2011 13:35:35 +0000 (UTC) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 982AEA181C7 for ; Tue, 13 Dec 2011 13:35:35 +0000 (UTC) Received: by mail-bw0-f52.google.com with SMTP id 17so9189244bke.11 for ; Tue, 13 Dec 2011 05:35:35 -0800 (PST) Received: by 10.204.152.138 with SMTP id g10mr10913140bkw.36.1323783335395; Tue, 13 Dec 2011 05:35:35 -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.205.129.2 with SMTP id hg2cs81430bkc; Tue, 13 Dec 2011 05:35:35 -0800 (PST) Received: by 10.236.173.170 with SMTP id v30mr3689620yhl.24.1323783333393; Tue, 13 Dec 2011 05:35:33 -0800 (PST) Received: from TX2EHSOBE002.bigfish.com (tx2ehsobe001.messaging.microsoft.com. [65.55.88.11]) by mx.google.com with ESMTPS id j35si8720636ann.27.2011.12.13.05.35.32 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 13 Dec 2011 05:35:33 -0800 (PST) Received-SPF: neutral (google.com: 65.55.88.11 is neither permitted nor denied by best guess record for domain of jason.hui@linaro.org) client-ip=65.55.88.11; Authentication-Results: mx.google.com; spf=neutral (google.com: 65.55.88.11 is neither permitted nor denied by best guess record for domain of jason.hui@linaro.org) smtp.mail=jason.hui@linaro.org Received: from mail146-tx2-R.bigfish.com (10.9.14.242) by TX2EHSOBE002.bigfish.com (10.9.40.22) with Microsoft SMTP Server id 14.1.225.23; Tue, 13 Dec 2011 13:35:32 +0000 Received: from mail146-tx2 (localhost [127.0.0.1]) by mail146-tx2-R.bigfish.com (Postfix) with ESMTP id 4DCFA540144; Tue, 13 Dec 2011 13:35:32 +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-DOMAIN-IP-MATCH: fail Received: from mail146-tx2 (localhost.localdomain [127.0.0.1]) by mail146-tx2 (MessageSwitch) id 1323783331435904_572; Tue, 13 Dec 2011 13:35:31 +0000 (UTC) Received: from TX2EHSMHS021.bigfish.com (unknown [10.9.14.250]) by mail146-tx2.bigfish.com (Postfix) with ESMTP id 529F840047; Tue, 13 Dec 2011 13:35:31 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by TX2EHSMHS021.bigfish.com (10.9.99.121) with Microsoft SMTP Server (TLS) id 14.1.225.23; Tue, 13 Dec 2011 13:35:27 +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; Tue, 13 Dec 2011 07:35:27 -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 pBDDZLs2001519; Tue, 13 Dec 2011 07:35:25 -0600 (CST) From: Jason Liu To: CC: Subject: [U-Boot][PATCH 2/3] fec: add the i.mx6q enet driver support Date: Tue, 13 Dec 2011 21:44:23 +0800 Message-ID: <1323783864-11614-3-git-send-email-jason.hui@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1323783864-11614-1-git-send-email-jason.hui@linaro.org> References: <1323783864-11614-1-git-send-email-jason.hui@linaro.org> MIME-Version: 1.0 X-OriginatorOrg: sigmatel.com Cc: Stefano Babic Signed-off-by: Jason Liu --- 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 */ }; /**