From patchwork Wed Feb 8 00:08:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 140036 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id EF5B8B6EF1 for ; Wed, 8 Feb 2012 11:08:47 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 234B928111; Wed, 8 Feb 2012 01:08:46 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id enOnG8wBCcic; Wed, 8 Feb 2012 01:08:45 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E1B46280C1; Wed, 8 Feb 2012 01:08:43 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AAC5D280C1 for ; Wed, 8 Feb 2012 01:08:41 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WUz2A+5to9ze for ; Wed, 8 Feb 2012 01:08:40 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from oproxy3-pub.bluehost.com (oproxy3-pub.bluehost.com [69.89.21.8]) by theia.denx.de (Postfix) with SMTP id 65643280B1 for ; Wed, 8 Feb 2012 01:08:39 +0100 (CET) Received: (qmail 6146 invoked by uid 0); 8 Feb 2012 00:08:36 -0000 Received: from unknown (HELO box284.bluehost.com) (69.89.31.84) by oproxy3.bluehost.com with SMTP; 8 Feb 2012 00:08:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=boundarydevices.com; s=default; h=Message-Id:Date:Subject:Cc:To:From; bh=biAf77W6eERDZhRz7uulcnGecAvqobkUs3FTk07RAWU=; b=XPGXeVFO6Wfz3V0x99RqIxKEVD5g8OApsKGjL0TBo34Cth14E9llnVfOAvZFxzcf3kvUB5ZaYpYEPQ0Szd0s6L3hnEb0QYRXgdtQhUNw3/RnBRn3wNDT2aD6w4XsChvz; Received: from [70.96.116.236] (helo=officeserver-2) by box284.bluehost.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1Ruv5O-000804-Fs; Tue, 07 Feb 2012 17:08:34 -0700 Received: from tkisky by officeserver-2 with local (Exim 4.76) (envelope-from ) id 1Ruv5g-0001rH-03; Tue, 07 Feb 2012 17:08:52 -0700 From: Troy Kisky To: dirk.behme@googlemail.com Date: Tue, 7 Feb 2012 17:08:46 -0700 Message-Id: <1328659730-7109-1-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 1.7.5.4 X-Identified-User: {1412:box284.bluehost.com:boundar4:boundarydevices.com} {sentby:smtp auth 70.96.116.236 authed with troy.kisky@boundarydevices.com} Cc: r49496@freescale.com, jason.hui@linaro.org, u-boot@lists.denx.de, afleming@gmail.com Subject: [U-Boot] [PATCH v5 1/5] net: fec_mxc: add 1000 Mbps selection X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Define FEC_QUIRK_ENET_MAC and add to arch-mx6/imx-regs.h Signed-off-by: Troy Kisky Acked-by: Dirk Behme --- arch/arm/include/asm/arch-mx6/imx-regs.h | 1 + drivers/net/fec_mxc.c | 21 +++++++++++++++++++-- drivers/net/fec_mxc.h | 2 ++ 3 files changed, 22 insertions(+), 2 deletions(-) This patch series is against Stefano's u-boot-imx Only patch 1 has changed since version 4 diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h index 5227b44..8492b25 100644 --- a/arch/arm/include/asm/arch-mx6/imx-regs.h +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h @@ -163,6 +163,7 @@ #define CHIP_REV_1_0 0x10 #define IRAM_SIZE 0x00040000 #define IMX_IIM_BASE OCOTP_BASE_ADDR +#define FEC_QUIRK_ENET_MAC #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__)) #include diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index ed73353..db8ebfa 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -379,13 +379,14 @@ static int fec_set_hwaddr(struct eth_device *dev) static int fec_open(struct eth_device *edev) { struct fec_priv *fec = (struct fec_priv *)edev->priv; + int speed; debug("fec_open: fec_open(dev)\n"); /* full-duplex, heartbeat disabled */ writel(1 << 2, &fec->eth->x_cntrl); fec->rbd_index = 0; -#if defined(CONFIG_MX6Q) +#ifdef FEC_QUIRK_ENET_MAC /* Enable ENET HW endian SWAP */ writel(readl(&fec->eth->ecntrl) | FEC_ECNTRL_DBSWAP, &fec->eth->ecntrl); @@ -428,9 +429,25 @@ static int fec_open(struct eth_device *edev) #endif miiphy_wait_aneg(edev); - miiphy_speed(edev->name, fec->phy_id); + speed = miiphy_speed(edev->name, fec->phy_id); miiphy_duplex(edev->name, fec->phy_id); +#ifdef FEC_QUIRK_ENET_MAC + { + u32 ecr = readl(&fec->eth->ecntrl) & ~FEC_ECNTRL_SPEED; + u32 rcr = (readl(&fec->eth->r_cntrl) & + ~(FEC_RCNTRL_RMII | FEC_RCNTRL_RMII_10T)) | + FEC_RCNTRL_RGMII | FEC_RCNTRL_MII_MODE; + if (speed == _1000BASET) + ecr |= FEC_ECNTRL_SPEED; + else if (speed != _100BASET) + rcr |= FEC_RCNTRL_RMII_10T; + writel(ecr, &fec->eth->ecntrl); + writel(rcr, &fec->eth->r_cntrl); + } +#endif + debug("%s:Speed=%i\n", __func__, speed); + /* * Enable SmartDMA receive task */ diff --git a/drivers/net/fec_mxc.h b/drivers/net/fec_mxc.h index 9825eab..af33d21 100644 --- a/drivers/net/fec_mxc.h +++ b/drivers/net/fec_mxc.h @@ -198,6 +198,7 @@ struct ethernet_regs { #define FEC_RCNTRL_FCE 0x00000020 #define FEC_RCNTRL_RGMII 0x00000040 #define FEC_RCNTRL_RMII 0x00000100 +#define FEC_RCNTRL_RMII_10T 0x00000200 #define FEC_TCNTRL_GTS 0x00000001 #define FEC_TCNTRL_HBC 0x00000002 @@ -207,6 +208,7 @@ struct ethernet_regs { #define FEC_ECNTRL_RESET 0x00000001 /* reset the FEC */ #define FEC_ECNTRL_ETHER_EN 0x00000002 /* enable the FEC */ +#define FEC_ECNTRL_SPEED 0x00000020 #define FEC_ECNTRL_DBSWAP 0x00000100 #define FEC_X_WMRK_STRFWD 0x00000100