From patchwork Fri Nov 9 23:47:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 10676733 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 39BEE175A for ; Fri, 9 Nov 2018 23:49:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AC1F2EE2B for ; Fri, 9 Nov 2018 23:49:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E6522EE6B; Fri, 9 Nov 2018 23:49:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9F3952EE4A for ; Fri, 9 Nov 2018 23:49:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RXMDkqB4dDfSFJpLKRzBcQEEgKnthZvYqnvKDVq0lMU=; b=ijy2y5rQASXitZ OvGbKhnZ3f/aLoMRMBayDIyBgi5Q/9sCsM21aOT1dzd08+1tc5yd93I2Uu/aH1zMRKhFGl4FbpnHI ID9y0/1+qY3gv8kFcYLd2cF7eAzOeujGlyLXnUVCNqDJY2grUG2dafYToqg+/6NI+Ed0hVXF8HGic WzQWaPOdpSSHsKkUxwadgxkfm427v4JIi7O1fa1BO+mO5wExj2IqNMrtdESeYdVWCkE3YKtgMJAFk kH9z7kMV8liCVk4r5Btsf3VT6egwymV+pEOU2Fj6q69WjFoP3dramOMAP3QKlBbqeDDxCEttv+l4w wH4NTkqE6IVziqqulNzg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLGWb-0003bM-Az; Fri, 09 Nov 2018 23:49:17 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLGWQ-0003My-D9; Fri, 09 Nov 2018 23:49:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=wAoXWWgNJlphbxo9jBvLHX39ICCAouj0KQbEd5GdbPw=; b=3izYug+CkxwiRBDZQgk1NCFoB r1P9WplHiD9M7cSdpiJDNAnYg7uIJkNHseYlUlj2ya1gsLh1i1AUnZnXqW5bNuOzar8Y/0lFT5l2t NMfTe2oOZJLype6DtgrId3eqsIHc15Rwzi1PT6dWvzJof47N7MBSOaPRjeB694G8on4C3KsVYQVwK MLz88sAzaghW6s4mhP2rWEvN8sw68+S1wOQWM/AY/mqUr62U8y8QTPRxr6gSrIvzDzqKYsve8fgkD CZQWmJGiPDCQJ7QlrqsZH6cixU7X61X+9+eAFsR5Svd8jP8VnHnRXsZVWjEARkCNMXV0+2RZDmBLE 139CX9gvA==; Received: from lelv0143.ext.ti.com ([198.47.23.248]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLGWJ-0000AA-H2; Fri, 09 Nov 2018 23:49:01 +0000 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 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 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181109_184859_728076_23460631 X-CRM114-Status: GOOD ( 17.31 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Grygorii Strashko , Quentin Schulz , Manu Gautam , Tony Lindgren , netdev@vger.kernel.org, Antoine Tenart , Sekhar Nori , linux-kernel@vger.kernel.org, Maxime Ripard , Chen-Yu Tsai , Chunfeng Yun , linux-mediatek@lists.infradead.org, Vivek Gautam , Carlo Caione , linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Matthias Brugger Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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;