Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1381365imu; Fri, 9 Nov 2018 15:51:07 -0800 (PST) X-Google-Smtp-Source: AJdET5eqrUg5HZp8uAauRd+h32wcdFACwA5hroAtMJtpFmsjwOUDbLPsPWHB2Rndcvxi1pXH/uT2 X-Received: by 2002:a17:902:7082:: with SMTP id z2-v6mr10977233plk.78.1541807467503; Fri, 09 Nov 2018 15:51:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541807467; cv=none; d=google.com; s=arc-20160816; b=IdW4N9/5+BH0YeV/0R2q61gVTSWPdhXXpBZc4xmvPnrtcSXJXW8t9/mqCdBRNaT3Ke 19RXQ1srU4Q4ClWF+jgmqxb62livbEY56ekdq/GTyAq6qFmXClieNmKodRck9M25sudA NKURDNKKwO9+DHxPkozCHMtizdbOla6gR3x3/cQ9qAQv/tlDF2qGAU+DKV/fyTb93a5b mblPs0aaKM5LjJfa7dIeLJ4Dyf8H/JbYNPHApH4uvDpOrBoSPkjSDqoLAtyEedF1RlOV lfB12MDlaqeP+0CoFIktKtKjyyiwLrdc7ANo3L/TWzbgIPVO4V8rnH4jsi0I8m6OLgoL N93A== 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=wAoXWWgNJlphbxo9jBvLHX39ICCAouj0KQbEd5GdbPw=; b=HE36PLakp2zgmDVXrUqr93YGIDLFr8kB/wvZxK/2aDgdaqnXzIbnUaQy+/tViftzuV BXq1corZQL7IwQGg9TkBhDqpg/0mpP8jcs5/RIjDap8a7sS+BaDmcPJhFEREwKxdufbj DYC/zopKlyeObSOoPMWZ+5eAlPxID4Xx3QrHltc/swq95Myxg9JC7UkY18IhETpBnzcb +KxP/0KLrcW//HmqXLURiCpY3BTNn8mPBs+p/fIRLrqhoUOXF7d8mnFuhOrOPsNmp6pD VKsNztEyUDBySvPHNShUzZnPE3qwz0ycYQZ7OvZqeR5IytELNZB3ASQMFtDHCFqiAIiu 5BLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ZZBVNgUE; 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 u131-v6si8793297pgc.465.2018.11.09.15.50.52; Fri, 09 Nov 2018 15:51:07 -0800 (PST) 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=ZZBVNgUE; 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 S1728917AbeKJJb7 (ORCPT + 99 others); Sat, 10 Nov 2018 04:31:59 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:43980 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726688AbeKJJb6 (ORCPT ); Sat, 10 Nov 2018 04:31:58 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id wA9NlwjG063590; Fri, 9 Nov 2018 17:47:58 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1541807278; bh=wAoXWWgNJlphbxo9jBvLHX39ICCAouj0KQbEd5GdbPw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ZZBVNgUEiCRir3SS8NgsuHQ49X/fb2GYi5TRJOkpRDp6NBxr67bRZZgkFDr3fwvX1 0okdiQSqhsH02T4ztFEfMWmk9j30ZKL/2zxbJP5i91uzQaG12/UyT3WqUDoWfm3x9k 2iNo+dWdjxwXctELcBwQvXtcJRYwiHOIpLKD/UUA= Received: from DLEE106.ent.ti.com (dlee106.ent.ti.com [157.170.170.36]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id wA9NlwuF051913 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 9 Nov 2018 17:47:58 -0600 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 9 Nov 2018 17:47:57 -0600 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; Fri, 9 Nov 2018 17:47:58 -0600 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 wA9Nlv8m017889; Fri, 9 Nov 2018 17:47:57 -0600 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 wA9Nlvx26444; Fri, 9 Nov 2018 17:47:57 -0600 (CST) From: Grygorii Strashko To: "David S. Miller" , Kishon Vijay Abraham I , Russell King - ARM Linux CC: , Sekhar Nori , , , Tony Lindgren , , , Alexandre Belloni , Antoine Tenart , Quentin Schulz , Vivek Gautam , Maxime Ripard , Chen-Yu Tsai , Carlo Caione , Chunfeng Yun , Matthias Brugger , Manu Gautam , Grygorii Strashko Subject: [PATCH v2 3/5] phy: ocelot-serdes: convert to use eth phy mode and submode Date: Fri, 9 Nov 2018 17:47:53 -0600 Message-ID: <20181109234755.21687-4-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.10.5 In-Reply-To: <20181109234755.21687-1-grygorii.strashko@ti.com> References: <20181109234755.21687-1-grygorii.strashko@ti.com> MIME-Version: 1.0 Content-Type: text/plain 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 Convert ocelot-serdes PHY driver to use recently introduced PHY_MODE_ETHERNET and phy_set_mode_ext(). Signed-off-by: Grygorii Strashko --- drivers/net/ethernet/mscc/ocelot.c | 9 ++------- drivers/phy/mscc/phy-ocelot-serdes.c | 14 ++++++++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 3238b9e..3edb608 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -472,7 +472,6 @@ static int ocelot_port_open(struct net_device *dev) { struct ocelot_port *port = netdev_priv(dev); struct ocelot *ocelot = port->ocelot; - enum phy_mode phy_mode; int err; /* Enable receiving frames on the port, and activate auto-learning of @@ -484,12 +483,8 @@ static int ocelot_port_open(struct net_device *dev) ANA_PORT_PORT_CFG, port->chip_port); if (port->serdes) { - if (port->phy_mode == PHY_INTERFACE_MODE_SGMII) - phy_mode = PHY_MODE_SGMII; - else - phy_mode = PHY_MODE_QSGMII; - - err = phy_set_mode(port->serdes, phy_mode); + err = phy_set_mode_ext(port->serdes, PHY_MODE_ETHERNET, + port->phy_mode); if (err) { netdev_err(dev, "Could not set mode of SerDes\n"); return err; diff --git a/drivers/phy/mscc/phy-ocelot-serdes.c b/drivers/phy/mscc/phy-ocelot-serdes.c index c61a9890..f525a21 100644 --- a/drivers/phy/mscc/phy-ocelot-serdes.c +++ b/drivers/phy/mscc/phy-ocelot-serdes.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -116,8 +117,10 @@ struct serdes_mux { .mux = _mux, \ } -#define SERDES_MUX_SGMII(i, p, m, c) SERDES_MUX(i, p, PHY_MODE_SGMII, m, c) -#define SERDES_MUX_QSGMII(i, p, m, c) SERDES_MUX(i, p, PHY_MODE_QSGMII, m, c) +#define SERDES_MUX_SGMII(i, p, m, c) \ + SERDES_MUX(i, p, PHY_INTERFACE_MODE_SGMII, m, c) +#define SERDES_MUX_QSGMII(i, p, m, c) \ + SERDES_MUX(i, p, PHY_INTERFACE_MODE_QSGMII, m, c) static const struct serdes_mux ocelot_serdes_muxes[] = { SERDES_MUX_SGMII(SERDES1G(0), 0, 0, 0), @@ -164,12 +167,15 @@ static int serdes_set_mode(struct phy *phy, enum phy_mode mode, int submode) unsigned int i; int ret; + if (mode != PHY_MODE_ETHERNET) + return -EINVAL; + for (i = 0; i < ARRAY_SIZE(ocelot_serdes_muxes); i++) { if (macro->idx != ocelot_serdes_muxes[i].idx || - mode != ocelot_serdes_muxes[i].mode) + submode != ocelot_serdes_muxes[i].mode) continue; - if (mode != PHY_MODE_QSGMII && + if (submode != PHY_INTERFACE_MODE_QSGMII && macro->port != ocelot_serdes_muxes[i].port) continue; -- 2.10.5