From patchwork Fri Dec 11 11:59:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 555716 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 91FFD1402BF for ; Fri, 11 Dec 2015 23:00:58 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b=agWNHnBg; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0CD7E4B7C1; Fri, 11 Dec 2015 13:00:25 +0100 (CET) X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" 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 l23DXkdBftnZ; Fri, 11 Dec 2015 13:00:24 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CE8C74B6CB; Fri, 11 Dec 2015 12:59:59 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 219EA4B69D for ; Fri, 11 Dec 2015 12:59:55 +0100 (CET) X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" 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 TVn9gqtzFALE for ; Fri, 11 Dec 2015 12:59:55 +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 mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by theia.denx.de (Postfix) with ESMTPS id 061BE4B688 for ; Fri, 11 Dec 2015 12:59:34 +0100 (CET) Received: by wmec201 with SMTP id c201so66800431wme.1 for ; Fri, 11 Dec 2015 03:59:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=lVdZI6+9GEqi9Di8HFqtChecdlhieU62b3RggO72eAU=; b=agWNHnBgWK5FIcVTbshCBDlDKDMiq9BkmrfTwHy3aI2KDp3gZliIlbFf5mfHdbIk6k UPnqSyP/0a0dS/HUk52YnKZmXAUgGDSs/NqX3Lwh23A2hnalmSmT6Ayox6lyBY9844R+ ZXRfG/QM1FPNI/Gnvu1BLGwaSFsVUvNDFzCn9K/j6ylKGhgJoEgLkQyKVC/3mOTwGoZG tYfjcmSgBjEaV5stZ42C1wST5dDA13NfZmPSf6Pn14LGBDEnR73kCinhxELBQvwZshd5 vzN+G6IMWPTvosjaypmyyrzFH1rB0XgmUR/+ZobEkjaSwkwoKbbxTpNiR/+Y3p45Stf7 KqfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=lVdZI6+9GEqi9Di8HFqtChecdlhieU62b3RggO72eAU=; b=fNSWkzLshJ2wszd37FDeZ6ihTdJOPkPaclSTdOjPlJWb4e/BmPg6O5uuBY6xEB/bZJ AxRJASKORtb2wO6EIU/u91sla9EnE4B4T6yOKB1SaazZOze8kGBsnaekX1W4zi33fR4G gS/TpmaSL0ttvy5iYspNlBAdsjhJhDgc1TVSKyk7qfJc4kBfcUydb+UIvyawWog7LBO4 IV1jkQTq9EUUaXdsgYJgJD2Y3CuVsw+N2msRKaaROzbKFP9NV19bN6ZAW7TKfeBoP6MN co+JN9JWatpmg/r7hjqU1cdKYhcDYK6PhhIzlPZC3ISgTlwFFgeOZtU4ZGfk/nPVCUJI IHfw== X-Gm-Message-State: ALoCoQn4mPdlB6sVilKWMv3MQSz/hmAdEvWxcTIvakMOgDKTg8LDwQ1f4uzbxNGjbwi+vwbSQMg418EQtYwLTloxWeOFCciCoQ== X-Received: by 10.28.6.130 with SMTP id 124mr5494404wmg.7.1449835174266; Fri, 11 Dec 2015 03:59:34 -0800 (PST) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id e9sm1948828wjp.18.2015.12.11.03.59.33 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 11 Dec 2015 03:59:33 -0800 (PST) From: Michal Simek To: u-boot@lists.denx.de Date: Fri, 11 Dec 2015 12:59:13 +0100 Message-Id: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: Cc: Joe Hershberger Subject: [U-Boot] [PATCH 08/10] net: axi_emac: Enable access to MDIO in probe X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Detect phy when driver probes. Signed-off-by: Michal Simek Acked-by: Joe Hershberger --- drivers/net/xilinx_axi_emac.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c index c03f8f730d3a..bff4d1b5affe 100644 --- a/drivers/net/xilinx_axi_emac.c +++ b/drivers/net/xilinx_axi_emac.c @@ -222,10 +222,10 @@ static u32 phywrite(struct axidma_priv *priv, u32 phyaddress, u32 registernum, } /* Setting axi emac and phy to proper setting */ -static int setup_phy(struct udevice *dev) +static int axiemac_phy_init(struct udevice *dev) { u16 phyreg; - u32 i, speed, emmc_reg, ret; + u32 i, ret; struct axidma_priv *priv = dev_get_priv(dev); struct axi_regs *regs = priv->iobase; struct phy_device *phydev; @@ -237,6 +237,9 @@ static int setup_phy(struct udevice *dev) SUPPORTED_1000baseT_Half | SUPPORTED_1000baseT_Full; + /* Set default MDIO divisor */ + out_be32(®s->mdio_mc, XAE_MDIO_DIV_DFT | XAE_MDIO_MC_MDIOEN_MASK); + if (priv->phyaddr == -1) { /* Detect the PHY address */ for (i = 31; i >= 0; i--) { @@ -259,6 +262,18 @@ static int setup_phy(struct udevice *dev) phydev->advertising = phydev->supported; priv->phydev = phydev; phy_config(phydev); + + return 0; +} + +/* Setting axi emac and phy to proper setting */ +static int setup_phy(struct udevice *dev) +{ + u32 speed, emmc_reg; + struct axidma_priv *priv = dev_get_priv(dev); + struct axi_regs *regs = priv->iobase; + struct phy_device *phydev = priv->phydev; + if (phy_startup(phydev)) { printf("axiemac: could not initialize PHY %s\n", phydev->dev->name); @@ -358,6 +373,7 @@ static int axi_ethernet_init(struct axidma_priv *priv) /* Set default MDIO divisor */ out_be32(®s->mdio_mc, XAE_MDIO_DIV_DFT | XAE_MDIO_MC_MDIOEN_MASK); + debug("axiemac: InitHw done\n"); return 0; } @@ -621,6 +637,8 @@ static int axi_emac_probe(struct udevice *dev) if (ret) return ret; + axiemac_phy_init(dev); + return 0; }