From patchwork Tue Apr 23 10:46:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 238874 X-Patchwork-Delegate: monstr@monstr.eu 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 C51CC2C0170 for ; Tue, 23 Apr 2013 20:48:39 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 92B514A18A; Tue, 23 Apr 2013 12:48:32 +0200 (CEST) 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 6X8zr6xg27N5; Tue, 23 Apr 2013 12:48:32 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 464F44A1A2; Tue, 23 Apr 2013 12:47:51 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 127604A195 for ; Tue, 23 Apr 2013 12:47:49 +0200 (CEST) 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 cS4sjVffLPfs for ; Tue, 23 Apr 2013 12:47:48 +0200 (CEST) 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 mail-we0-f180.google.com (mail-we0-f180.google.com [74.125.82.180]) by theia.denx.de (Postfix) with ESMTPS id 145AA4A1C2 for ; Tue, 23 Apr 2013 12:47:07 +0200 (CEST) Received: by mail-we0-f180.google.com with SMTP id x43so429299wey.39 for ; Tue, 23 Apr 2013 03:47:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:in-reply-to:references:content-type :x-gm-message-state; bh=QGkInAefomBrA3lNOETv3BjqnD5+iYAuHmB++LzETaw=; b=fNNrGTwOe2qboK5rLfftQhqgKSDERAdR1KQEsOuOEpnaG0tRz+E9TCdXs0r5y11TrQ ut092xV0wC+3IZI/f9xHJaTv8bKSgM30ktzMfSat/H4AxWEAZ+BYujvuk4wbdQnS1YwD /oVNxBq/PjCASn9pGA2T91w3TGC+Z+sNpOorBBwT7e3DF6olqs1p/wFhp5zs1EEzD41f pCdBrBbrZ4JYXnklWN6FqkZpxGQa9LVT4d+hvWk9uwZZSu2HPNwh7UOXqNfQvy7ppeh2 U8/9fyL/Rc1tOn7w5B+94vCUs4h2m9REn2dbIcaYvbIw4jbKNZjP4bQ3Fy5/HZsz8+hb eilg== X-Received: by 10.180.188.3 with SMTP id fw3mr28570889wic.33.1366714027173; Tue, 23 Apr 2013 03:47:07 -0700 (PDT) Received: from localhost (nat-63.starnet.cz. [178.255.168.63]) by mx.google.com with ESMTPSA id q18sm25407663wiw.8.2013.04.23.03.47.04 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Tue, 23 Apr 2013 03:47:05 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, Joe Hershberger , Albert Aribaud , Tom Rini Date: Tue, 23 Apr 2013 12:46:10 +0200 Message-Id: X-Mailer: git-send-email 1.8.2.1 In-Reply-To: References: In-Reply-To: References: X-Gm-Message-State: ALoCoQmjhLiY4AbounJojVMH25yWpgE49rPR034nzHkHRAZVSsPBELw4VZUBkiZBuwjZQnYKZehd Cc: Peter Crosthwaite , Jagannadha Sutradharudu Teki Subject: [U-Boot] [PATCH v2 11/15] net: gem: Preserve clk on emio interface 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 From: David Andrey Avoid overwriting GEMx_RCLK_CTRL and GEMx_CLK_CTRL if the Ethernet interface is connect on EMIO Do not enable emio for this standard board configuration for now. Signed-off-by: David Andrey Signed-off-by: Michal Simek --- Changes in v2: - Remove CONFIG_ prefix from non configurable macros (emio) board/xilinx/zynq/board.c | 4 ++-- drivers/net/zynq_gem.c | 12 +++++++++--- include/netdev.h | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) -- 1.8.2.1 diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c index 546adc8..57d8f53 100644 --- a/board/xilinx/zynq/board.c +++ b/board/xilinx/zynq/board.c @@ -43,11 +43,11 @@ int board_eth_init(bd_t *bis) #if defined(CONFIG_ZYNQ_GEM) # if defined(CONFIG_ZYNQ_GEM0) ret |= zynq_gem_initialize(bis, ZYNQ_GEM_BASEADDR0, - CONFIG_ZYNQ_GEM_PHY_ADDR0); + CONFIG_ZYNQ_GEM_PHY_ADDR0, 0); # endif # if defined(CONFIG_ZYNQ_GEM1) ret |= zynq_gem_initialize(bis, ZYNQ_GEM_BASEADDR1, - CONFIG_ZYNQ_GEM_PHY_ADDR1); + CONFIG_ZYNQ_GEM_PHY_ADDR1, 0); # endif #endif return ret; diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index 316816d..8e0e01c 100644 --- a/drivers/net/zynq_gem.c +++ b/drivers/net/zynq_gem.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #if !defined(CONFIG_PHYLIB) @@ -136,6 +137,7 @@ struct zynq_gem_priv { u32 rxbd_current; u32 rx_first_buf; int phyaddr; + u32 emio; int init; struct phy_device *phydev; struct mii_dev *bus; @@ -317,8 +319,11 @@ static int zynq_gem_init(struct eth_device *dev, bd_t * bis) clk = (5 << 20) | (8 << 8) | (0 << 4) | (1 << 0); break; } - /* FIXME maybe better to define gem address in hardware.h */ - zynq_slcr_gem_clk_setup(dev->iobase != 0xE000B000, rclk, clk); + + /* Change the rclk and clk only not using EMIO interface */ + if (!priv->emio) + zynq_slcr_gem_clk_setup(dev->iobase != + ZYNQ_GEM_BASEADDR0, rclk, clk); setbits_le32(®s->nwctrl, ZYNQ_GEM_NWCTRL_RXEN_MASK | ZYNQ_GEM_NWCTRL_TXEN_MASK); @@ -427,7 +432,7 @@ static int zynq_gem_miiphy_write(const char *devname, uchar addr, return phywrite(dev, addr, reg, val); } -int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr) +int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr, u32 emio) { struct eth_device *dev; struct zynq_gem_priv *priv; @@ -444,6 +449,7 @@ int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr) priv = dev->priv; priv->phyaddr = phy_addr; + priv->emio = emio; sprintf(dev->name, "Gem.%x", base_addr); diff --git a/include/netdev.h b/include/netdev.h index 81117b1..516b351 100644 --- a/include/netdev.h +++ b/include/netdev.h @@ -104,7 +104,7 @@ int xilinx_emaclite_initialize(bd_t *bis, unsigned long base_addr, int txpp, int rxpp); int xilinx_ll_temac_eth_init(bd_t *bis, unsigned long base_addr, int flags, unsigned long ctrl_addr); -int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr); +int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr, u32 emio); /* * As long as the Xilinx xps_ll_temac ethernet driver has not its own interface * exported by a public hader file, we need a global definition at this point.