From patchwork Fri Apr 15 12:27:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 65901 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1150320qge; Fri, 15 Apr 2016 05:27:34 -0700 (PDT) X-Received: by 10.28.87.65 with SMTP id l62mr4365561wmb.102.1460723254901; Fri, 15 Apr 2016 05:27:34 -0700 (PDT) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id b75si18337242wmf.43.2016.04.15.05.27.34; Fri, 15 Apr 2016 05:27:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 593F5A751E; Fri, 15 Apr 2016 14:27:33 +0200 (CEST) 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 F5iexseoqB2T; Fri, 15 Apr 2016 14:27:32 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AEFCEA74DB; Fri, 15 Apr 2016 14:27:32 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 24887A74DB for ; Fri, 15 Apr 2016 14:27:30 +0200 (CEST) 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 HsXqhUveAz9T for ; Fri, 15 Apr 2016 14:27:30 +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 comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by theia.denx.de (Postfix) with ESMTPS id A9681A74D0 for ; Fri, 15 Apr 2016 14:27:26 +0200 (CEST) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id u3FCRNg8012656; Fri, 15 Apr 2016 07:27:23 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id u3FCRNgG017055; Fri, 15 Apr 2016 07:27:23 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.224.2; Fri, 15 Apr 2016 07:27:23 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id u3FCRNA0012217; Fri, 15 Apr 2016 07:27:23 -0500 Received: from localhost (a0272616local.am.dhcp.ti.com [172.22.146.61]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id u3FCRN925733; Fri, 15 Apr 2016 07:27:23 -0500 (CDT) From: Dan Murphy To: Date: Fri, 15 Apr 2016 07:27:16 -0500 Message-ID: <1460723242-20805-1-git-send-email-dmurphy@ti.com> X-Mailer: git-send-email 2.7.2.333.g70bd996 MIME-Version: 1.0 Cc: joe.hershberger@ni.com, trini@konsulko.com, michal.simek@xilinx.com Subject: [U-Boot] [PATCH v6 1/7] drivers: net: cpsw: Add reading of DT phy-handle node 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add the ability to read the phy-handle node of the cpsw slave. Upon reading this handle the phy-id can be stored based on the reg node in the DT. The phy-handle also needs to be stored and passed to the phy to access any phy data that is available. Signed-off-by: Dan Murphy --- v6 - Fix build error when DM_ETH is not defined and updated phy_handle error handling - https://patchwork.ozlabs.org/patch/608763/ drivers/net/cpsw.c | 20 ++++++++++++++++++-- include/cpsw.h | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) -- 2.8.1.116.g7b0d47b _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c index 7104754..3d6f0ce 100644 --- a/drivers/net/cpsw.c +++ b/drivers/net/cpsw.c @@ -965,6 +965,11 @@ static int cpsw_phy_init(struct cpsw_priv *priv, struct cpsw_slave *slave) phydev->supported &= supported; phydev->advertising = phydev->supported; +#ifdef CONFIG_DM_ETH + if (slave->data->phy_of_handle) + phydev->dev->of_offset = slave->data->phy_of_handle; +#endif + priv->phydev = phydev; phy_config(phydev); @@ -1217,8 +1222,19 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice *dev) if (phy_mode) priv->data.slave_data[slave_index].phy_if = phy_get_interface_by_name(phy_mode); - fdtdec_get_int_array(fdt, subnode, "phy_id", phy_id, 2); - priv->data.slave_data[slave_index].phy_addr = phy_id[1]; + + priv->data.slave_data[slave_index].phy_of_handle = + fdtdec_lookup_phandle(fdt, subnode, "phy-handle"); + + if (priv->data.slave_data[slave_index].phy_of_handle >= 0) { + priv->data.slave_data[slave_index].phy_addr = + fdtdec_get_int(gd->fdt_blob, + priv->data.slave_data[slave_index].phy_of_handle, + "reg", -1); + } else { + fdtdec_get_int_array(fdt, subnode, "phy_id", phy_id, 2); + priv->data.slave_data[slave_index].phy_addr = phy_id[1]; + } slave_index++; } diff --git a/include/cpsw.h b/include/cpsw.h index cf1d30b..ff95cd8 100644 --- a/include/cpsw.h +++ b/include/cpsw.h @@ -21,6 +21,7 @@ struct cpsw_slave_data { u32 sliver_reg_ofs; int phy_addr; int phy_if; + int phy_of_handle; }; enum {