From patchwork Thu Feb 28 13:48:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Tenart X-Patchwork-Id: 1049500 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 449DTM6mZjz9s5R for ; Fri, 1 Mar 2019 00:50:31 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730866AbfB1NuH (ORCPT ); Thu, 28 Feb 2019 08:50:07 -0500 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:54129 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726189AbfB1NuH (ORCPT ); Thu, 28 Feb 2019 08:50:07 -0500 X-Originating-IP: 90.88.147.150 Received: from localhost (aaubervilliers-681-1-27-150.w90-88.abo.wanadoo.fr [90.88.147.150]) (Authenticated sender: antoine.tenart@bootlin.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 1CE54C0004; Thu, 28 Feb 2019 13:50:01 +0000 (UTC) From: Antoine Tenart To: davem@davemloft.net, linux@armlinux.org.uk, andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com Cc: Antoine Tenart , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, maxime.chevallier@bootlin.com, gregory.clement@bootlin.com, miquel.raynal@bootlin.com, nadavh@marvell.com, stefanc@marvell.com, ymarkman@marvell.com, mw@semihalf.com Subject: [PATCH net-next 1/3] net: phy: marvell10g: implement suspend/resume callbacks Date: Thu, 28 Feb 2019 14:48:35 +0100 Message-Id: <20190228134837.32740-2-antoine.tenart@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190228134837.32740-1-antoine.tenart@bootlin.com> References: <20190228134837.32740-1-antoine.tenart@bootlin.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch adds the suspend/resume callbacks for Marvell 10G PHYs. The three PCS (base-t, base-r and 1000base-x) are set in low power (the PCS are powered down) when the PHY isn't used. Signed-off-by: Antoine Tenart --- drivers/net/phy/marvell10g.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 79106e70010f..95aeeda0eb16 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -201,6 +201,30 @@ static int mv3310_hwmon_probe(struct phy_device *phydev) } #endif +static int mv3310_suspend(struct phy_device *phydev) +{ + phy_modify_mmd(phydev, MDIO_MMD_PCS, MV_PCS_BASE_T + MDIO_CTRL1, + MDIO_CTRL1_LPOWER, MDIO_CTRL1_LPOWER); + phy_modify_mmd(phydev, MDIO_MMD_PCS, MV_PCS_BASE_R + MDIO_CTRL1, + MDIO_CTRL1_LPOWER, MDIO_CTRL1_LPOWER); + phy_modify_mmd(phydev, MDIO_MMD_PCS, MV_PCS_1000BASEX + MDIO_CTRL1, + MDIO_CTRL1_LPOWER, MDIO_CTRL1_LPOWER); + + return 0; +} + +static int mv3310_resume(struct phy_device *phydev) +{ + phy_modify_mmd(phydev, MDIO_MMD_PCS, MV_PCS_BASE_T + MDIO_CTRL1, + MDIO_CTRL1_LPOWER, 0); + phy_modify_mmd(phydev, MDIO_MMD_PCS, MV_PCS_BASE_R + MDIO_CTRL1, + MDIO_CTRL1_LPOWER, 0); + phy_modify_mmd(phydev, MDIO_MMD_PCS, MV_PCS_1000BASEX + MDIO_CTRL1, + MDIO_CTRL1_LPOWER, 0); + + return mv3310_hwmon_config(phydev, true); +} + static int mv3310_probe(struct phy_device *phydev) { struct mv3310_priv *priv; From patchwork Thu Feb 28 13:48:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Tenart X-Patchwork-Id: 1049497 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 449DT34JRDz9s71 for ; Fri, 1 Mar 2019 00:50:15 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731656AbfB1NuL (ORCPT ); Thu, 28 Feb 2019 08:50:11 -0500 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:53265 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726189AbfB1NuJ (ORCPT ); Thu, 28 Feb 2019 08:50:09 -0500 X-Originating-IP: 90.88.147.150 Received: from localhost (aaubervilliers-681-1-27-150.w90-88.abo.wanadoo.fr [90.88.147.150]) (Authenticated sender: antoine.tenart@bootlin.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 785A1C000E; Thu, 28 Feb 2019 13:50:05 +0000 (UTC) From: Antoine Tenart To: davem@davemloft.net, linux@armlinux.org.uk, andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com Cc: Antoine Tenart , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, maxime.chevallier@bootlin.com, gregory.clement@bootlin.com, miquel.raynal@bootlin.com, nadavh@marvell.com, stefanc@marvell.com, ymarkman@marvell.com, mw@semihalf.com Subject: [PATCH net-next 2/3] net: phy: marvell10g: add the suspend/resume callbacks for the 88x2210 Date: Thu, 28 Feb 2019 14:48:36 +0100 Message-Id: <20190228134837.32740-3-antoine.tenart@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190228134837.32740-1-antoine.tenart@bootlin.com> References: <20190228134837.32740-1-antoine.tenart@bootlin.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When the 88x2110 PHY support was added, the suspend and resume callbacks were forgotten. This patch adds them to the 88x2110 PHY callback definition. Signed-off-by: Antoine Tenart --- drivers/net/phy/marvell10g.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index 95aeeda0eb16..e5d098bd33a6 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -498,6 +498,8 @@ static struct phy_driver mv3310_drivers[] = { .name = "mv88x2110", .get_features = genphy_c45_pma_read_abilities, .probe = mv3310_probe, + .suspend = mv3310_suspend, + .resume = mv3310_resume, .soft_reset = gen10g_no_soft_reset, .config_init = mv3310_config_init, .config_aneg = mv3310_config_aneg, From patchwork Thu Feb 28 13:48:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antoine Tenart X-Patchwork-Id: 1049499 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 449DTH33xLz9s47 for ; Fri, 1 Mar 2019 00:50:27 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731794AbfB1NuQ (ORCPT ); Thu, 28 Feb 2019 08:50:16 -0500 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:34745 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731727AbfB1NuP (ORCPT ); Thu, 28 Feb 2019 08:50:15 -0500 X-Originating-IP: 90.88.147.150 Received: from localhost (aaubervilliers-681-1-27-150.w90-88.abo.wanadoo.fr [90.88.147.150]) (Authenticated sender: antoine.tenart@bootlin.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 0850CC000B; Thu, 28 Feb 2019 13:50:07 +0000 (UTC) From: Antoine Tenart To: davem@davemloft.net, linux@armlinux.org.uk, andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com Cc: Antoine Tenart , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, maxime.chevallier@bootlin.com, gregory.clement@bootlin.com, miquel.raynal@bootlin.com, nadavh@marvell.com, stefanc@marvell.com, ymarkman@marvell.com, mw@semihalf.com Subject: [PATCH net-next 3/3] net: phy: marvell10g: set the PHY in low power by default Date: Thu, 28 Feb 2019 14:48:37 +0100 Message-Id: <20190228134837.32740-4-antoine.tenart@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190228134837.32740-1-antoine.tenart@bootlin.com> References: <20190228134837.32740-1-antoine.tenart@bootlin.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When the Marvell 10G PHYs are set out of reset, the LPOWER bit is set depending on an hardware configuration choice. We also do not know what is the PHY state at boot time. Hence, set the PHY in low power by default when this driver probes. Signed-off-by: Antoine Tenart --- drivers/net/phy/marvell10g.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c index e5d098bd33a6..765edd34a7dd 100644 --- a/drivers/net/phy/marvell10g.c +++ b/drivers/net/phy/marvell10g.c @@ -245,17 +245,8 @@ static int mv3310_probe(struct phy_device *phydev) if (ret) return ret; - return 0; -} - -static int mv3310_suspend(struct phy_device *phydev) -{ - return 0; -} - -static int mv3310_resume(struct phy_device *phydev) -{ - return mv3310_hwmon_config(phydev, true); + /* Set the PHY in low power mode by default */ + return mv3310_suspend(phydev); } /* Some PHYs in the Alaska family such as the 88X3310 and the 88E2010