From patchwork Mon Oct 8 23:49:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 148466 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp4243030lji; Mon, 8 Oct 2018 16:50:02 -0700 (PDT) X-Google-Smtp-Source: ACcGV61s3AU3jNJqClbKjWRAZlTp1cHaqq3m98yZ09sSl8cJT2AQd+EY9Dc4MWXWnDfZ8P901BCa X-Received: by 2002:a63:184a:: with SMTP id 10-v6mr22771768pgy.81.1539042602002; Mon, 08 Oct 2018 16:50:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539042601; cv=none; d=google.com; s=arc-20160816; b=IXlVz3yoQe3kMWpIEePAX82qw8xfrcVMLzrFI0NjvVdX/JdAIJYBMSND/XZEaSfM4s cxaBo7/b1TXuDkx/8jwOdN3uVPk+ItNgKgPPvpa3Eb20QBJ+I9tIaasCcUtpMd6k2lWo 76jxfmW752QTeF5cIwqW01IwdA+TC83/8KJ2a7trWaJupBL+qrFYEaenPaN2uwqMNk84 6e7iUl/QMbloQEhnuQdiwSYKyQAxs829ntNN9brcXeJn7Ts4Ocwrhsb3D0fO/QQ+bHUa 7lhEwok9QEHRse7gJ2F/J5kbJqZZDhE9DV+cu3AksJzkxi3Rr6k6YHKJrQaX6UZdBdzu jVaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=qAdOAVFcrQW2ns+nKEeBvF6x4Nb/j951S7LnOMCiuZo=; b=lG1WEjVrNLnZBm+GY8wcavXneHqgsA2ASOaai9uS22WETvxL1XUx0nRQJVpx3FkkfN 54l7qI8w/ERahajByPwwcnurlQOXgUn7mOcJWVMuRIc1hSaB2fx/hDqDcmwuw5VUTWbE eLgC/W/tAx4iHEWW9a3fBdH2Z7txug6AK0uFYihz0DTFMvvmaZmRuap+Q3dJXLzX5ZNf c4c6nooxmaKLh5ckxvMdkcO5rwj4H8KVsZObNczhaODg2ME7umeZjh0+2Fwr+DQZda22 Lb3sXw1dM9DpO4vYd9WUg4eIyIK0uRiddtSYiRh2+bQqExvWe1ujSKwGqstsJwXb3d/j w0YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Zp7j6VQt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e18-v6si15765692pgh.388.2018.10.08.16.50.01; Mon, 08 Oct 2018 16:50:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Zp7j6VQt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726794AbeJIHEI (ORCPT + 32 others); Tue, 9 Oct 2018 03:04:08 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:59158 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726613AbeJIHEI (ORCPT ); Tue, 9 Oct 2018 03:04:08 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id w98NnrUT074795; Mon, 8 Oct 2018 18:49:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1539042593; bh=qAdOAVFcrQW2ns+nKEeBvF6x4Nb/j951S7LnOMCiuZo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Zp7j6VQtxVjdktFAyagSMthb8IzojJEL6a/45lvS1VnwScbIPB7h9mKw1wPqaFiUA Dy63/KhCcBEbaBUMfudIm2Ajr7HsK9QgHNq/Fx/bXKI8ci4NiUW+cr5YSQo11fVn5Q yPeaFFNCHxiAwvhGyinRzBKAWGt+PEBSxO1sfkCs= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w98NnrPX023961; Mon, 8 Oct 2018 18:49:53 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 8 Oct 2018 18:49:52 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Mon, 8 Oct 2018 18:49:52 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w98Nnqm2031121; Mon, 8 Oct 2018 18:49:52 -0500 Received: from localhost (uda0226610.dhcp.ti.com [128.247.59.147]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id w98Nnqx25228; Mon, 8 Oct 2018 18:49:52 -0500 (CDT) From: Grygorii Strashko To: "David S. Miller" , , Tony Lindgren , Rob Herring , Kishon Vijay Abraham I CC: Sekhar Nori , , , , Grygorii Strashko Subject: [RFC PATCH 05/11] net: ethernet: ti: cpsw: add support for port interface mode selection phy Date: Mon, 8 Oct 2018 18:49:43 -0500 Message-ID: <20181008234949.15416-6-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.10.5 In-Reply-To: <20181008234949.15416-1-grygorii.strashko@ti.com> References: <20181008234949.15416-1-grygorii.strashko@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for port interface mode selection phy (phy-gmii-sel): - try to request interface mode selection phy from Port DT node and fail silently if not defined and old CONFIG_TI_CPSW_PHY_SEL driver enabled. - use new phy if requested successfully. Cc: Kishon Vijay Abraham I Cc: Tony Lindgren Signed-off-by: Grygorii Strashko --- drivers/net/ethernet/ti/cpsw.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) -- 2.10.5 diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 832bce0..4607de2 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -387,6 +388,7 @@ struct cpsw_slave_data { int phy_if; u8 mac_addr[ETH_ALEN]; u16 dual_emac_res_vlan; /* Reserved VLAN for DualEMAC */ + struct phy *ifphy; }; struct cpsw_platform_data { @@ -1502,7 +1504,11 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv) phy_start(slave->phy); /* Configure GMII_SEL register */ - cpsw_phy_sel(cpsw->dev, slave->phy->interface, slave->slave_num); + if (!IS_ERR(slave->data->ifphy)) + phy_set_netif_mode(slave->data->ifphy, slave->data->phy_if); + else + cpsw_phy_sel(cpsw->dev, slave->phy->interface, + slave->slave_num); } static inline void cpsw_add_default_vlan(struct cpsw_priv *priv) @@ -3135,6 +3141,16 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, if (strcmp(slave_node->name, "slave")) continue; + slave_data->ifphy = devm_of_phy_get(&pdev->dev, slave_node, + NULL); + if (!IS_ENABLED(CONFIG_TI_CPSW_PHY_SEL) && + IS_ERR(slave_data->ifphy)) { + ret = PTR_ERR(slave_data->ifphy); + dev_err(&pdev->dev, + "%d: Error retrieving port phy: %d\n", i, ret); + return ret; + } + slave_data->phy_node = of_parse_phandle(slave_node, "phy-handle", 0); parp = of_get_property(slave_node, "phy_id", &lenp);