From patchwork Mon Nov 26 00:15:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 151960 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp4970726ljp; Sun, 25 Nov 2018 16:16:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/XHsZZRc3KFP6q0sBHYX1TimUHZ7ZnsCG0xkngbj80aM33XvEFcrbHJIjRIsOHqvqEtOHDZ X-Received: by 2002:a62:9f01:: with SMTP id g1mr19647936pfe.223.1543191369748; Sun, 25 Nov 2018 16:16:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543191369; cv=none; d=google.com; s=arc-20160816; b=JjYQZbShFX1dZ0/zzKsS3IPt5nSvTOe+4sqwNk32ZsYC1TaAUER+CZssF2YoP6OW0y Ac8xROnbZlB7Crqb+8G+uD7L2zImV4+pawOEoeWZ7rS/mjtX5kB2Ph+7ZQ2oZ4qnn+At CrwqSCE7unvSjP2zCtCwk+SkYEbxF7ZwjcQTGFcyviWC8gVm9V3TpU48Zg2nGtdA+O29 E3OQDufcCeKwsv+yjuIPud0vXVE8LHUeSYm3+QGj/87Qh5Rn4envF9raIOa6+Mwn+lcC yKLdklSXMctazZRJ44z5LreKR665Vok3PD2FFzHcIvcuQ5vqDzqrtZ/iavV5L9RQ7xtf 4KxQ== 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=GnXeS45PGTnjfeOQW4vPy7VEVfXofOgaQHxhQErqVQs=; b=vsI8f3tYXLwRGaQ1EmiRxl1Lss3LK7J8yPxZ9jNJL/qGo92z9rGF7EibgPDS+sV0xx f8TYdE0MJBlzm/j72zXFhPfa6YGkLUk5x+0lredMx8FTlZhW90SdCyPPrYLA1qNILE2q OsQ/cYZDLZKX2k2Tcy/vkushBI1MNhVA6pRJrSC6p1w1gAQbnN6LGsM3gtposu95pZDC IgdzM5W2PYeS2vUQoBno0Q40zdHIXCjgTzcgWmTSNRLX8M9D+l4r9y0rAFC+YsSGwuOo fjyGpgpJG1GRqWaELpHe0zwelfrNlWZdJDyCNSE1ShHMBIKhrNDLQHe3YycAMG+hjXg6 lZPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=j+M+x6jC; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-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 v5si58559537pgg.1.2018.11.25.16.16.09; Sun, 25 Nov 2018 16:16:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-omap-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=j+M+x6jC; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-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 S1726380AbeKZLI1 (ORCPT + 5 others); Mon, 26 Nov 2018 06:08:27 -0500 Received: from lelv0142.ext.ti.com ([198.47.23.249]:52682 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726362AbeKZLI1 (ORCPT ); Mon, 26 Nov 2018 06:08:27 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id wAQ0FYU6098855; Sun, 25 Nov 2018 18:15:34 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1543191334; bh=GnXeS45PGTnjfeOQW4vPy7VEVfXofOgaQHxhQErqVQs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=j+M+x6jCg6dt21AK4YJbNSTZ2rVbzpFTzCSk0pv6TbMWn2m/XMoo1vqR2B5Uii2QX E1g8O5iSrFGXewqX0/arddkCHGb9MC3xi6Ffu71rU7fbhQO5uFhH0n8hDAwu1iuuA5 yejcevBa5xnhCs9rl3M31GdIrWNuE7rj1L5WfTxs= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id wAQ0FYYM126529 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 25 Nov 2018 18:15:34 -0600 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Sun, 25 Nov 2018 18:15:33 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Sun, 25 Nov 2018 18:15:33 -0600 Received: from legion.dal.desgin.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 wAQ0FXpn030827; Sun, 25 Nov 2018 18:15:33 -0600 Received: from localhost (uda0226610.dhcp.ti.com [128.247.59.147]) by legion.dal.desgin.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id wAQ0FXU04350; Sun, 25 Nov 2018 18:15:33 -0600 (CST) From: Grygorii Strashko To: "David S. Miller" , Tony Lindgren , Kishon Vijay Abraham I , Rob Herring CC: , Sekhar Nori , , , Andrew Lunn , , , Grygorii Strashko Subject: [PATCH linux-next 04/10] net: ethernet: ti: cpsw: add support for port interface mode selection phy Date: Sun, 25 Nov 2018 18:15:25 -0600 Message-ID: <20181126001531.12974-5-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.10.5 In-Reply-To: <20181126001531.12974-1-grygorii.strashko@ti.com> References: <20181126001531.12974-1-grygorii.strashko@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@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 | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) -- 2.10.5 diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index e4aa030..ceaec56 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 { @@ -1624,7 +1626,12 @@ 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_mode_ext(slave->data->ifphy, PHY_MODE_ETHERNET, + 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) @@ -3274,6 +3281,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);