From patchwork Mon Apr 11 12:18:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 65506 Delivered-To: patch@linaro.org Received: by 10.112.43.237 with SMTP id z13csp1435064lbl; Mon, 11 Apr 2016 05:18:41 -0700 (PDT) X-Received: by 10.194.140.17 with SMTP id rc17mr9540518wjb.175.1460377121791; Mon, 11 Apr 2016 05:18:41 -0700 (PDT) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id w1si26769534wjh.228.2016.04.11.05.18.41; Mon, 11 Apr 2016 05:18:41 -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 E05E1A7607; Mon, 11 Apr 2016 14:18:40 +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 YPZkTbphmQDR; Mon, 11 Apr 2016 14:18:40 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3CE3CA752D; Mon, 11 Apr 2016 14:18:40 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A2934A752D for ; Mon, 11 Apr 2016 14:18:36 +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 FYJWqNsLy6HM for ; Mon, 11 Apr 2016 14:18:36 +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 3605BA748F for ; Mon, 11 Apr 2016 14:18:32 +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 u3BCIUgq009886; Mon, 11 Apr 2016 07:18:30 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id u3BCIU9e026811; Mon, 11 Apr 2016 07:18:30 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Mon, 11 Apr 2016 07:18:29 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id u3BCITIF012421; Mon, 11 Apr 2016 07:18:29 -0500 Received: from localhost (a0272616local.am.dhcp.ti.com [172.22.173.216]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id u3BCIT919361; Mon, 11 Apr 2016 07:18:29 -0500 (CDT) From: Dan Murphy To: Date: Mon, 11 Apr 2016 07:18:22 -0500 Message-ID: <1460377108-19262-1-git-send-email-dmurphy@ti.com> X-Mailer: git-send-email 2.7.2.333.g70bd996 MIME-Version: 1.0 Cc: trini@konsulko.com, michal.simek@xilinx.com Subject: [U-Boot] [uboot] [PATCH v5 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 --- v5 - Fix checkpatch warning no spaces before tabs and typo is subject - https://patchwork.ozlabs.org/patch/608082/ drivers/net/cpsw.c | 18 ++++++++++++++++-- include/cpsw.h | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) -- 2.8.0.rc3 _______________________________________________ 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..8ee33a6 100644 --- a/drivers/net/cpsw.c +++ b/drivers/net/cpsw.c @@ -965,6 +965,9 @@ static int cpsw_phy_init(struct cpsw_priv *priv, struct cpsw_slave *slave) phydev->supported &= supported; phydev->advertising = phydev->supported; + if (slave->data->phy_of_handle) + phydev->dev->of_offset = slave->data->phy_of_handle; + priv->phydev = phydev; phy_config(phydev); @@ -1217,8 +1220,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) { + 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 {