{"id":817633,"url":"http://patchwork.ozlabs.org/api/patches/817633/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/20170922161753.19563-2-vivien.didelot@savoirfairelinux.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170922161753.19563-2-vivien.didelot@savoirfairelinux.com>","list_archive_url":null,"date":"2017-09-22T16:17:50","name":"[net-next,1/4] net: dsa: move up phy enabling in core","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":true,"hash":"3e246c609990a59f66749b38823c213ddccae697","submitter":{"id":15889,"url":"http://patchwork.ozlabs.org/api/people/15889/?format=json","name":"Vivien Didelot","email":"vivien.didelot@savoirfairelinux.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/20170922161753.19563-2-vivien.didelot@savoirfairelinux.com/mbox/","series":[{"id":4666,"url":"http://patchwork.ozlabs.org/api/series/4666/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=4666","date":"2017-09-22T16:17:53","name":"net: dsa: simplify port enabling","version":1,"mbox":"http://patchwork.ozlabs.org/series/4666/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/817633/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/817633/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xzJgB3nzVz9s7g\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 23 Sep 2017 02:23:02 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752636AbdIVQW3 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 22 Sep 2017 12:22:29 -0400","from mail.savoirfairelinux.com ([208.88.110.44]:39468 \"EHLO\n\tmail.savoirfairelinux.com\" rhost-flags-OK-OK-OK-OK) by\n\tvger.kernel.org with ESMTP id S1752564AbdIVQVh (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Fri, 22 Sep 2017 12:21:37 -0400","from localhost (localhost [127.0.0.1])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTP id B917A9C2D06;\n\tFri, 22 Sep 2017 12:21:36 -0400 (EDT)","from mail.savoirfairelinux.com ([127.0.0.1])\n\tby localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new,\n\tport 10032)\n\twith ESMTP id kGx5J-hUaxE6; Fri, 22 Sep 2017 12:21:35 -0400 (EDT)","from localhost (localhost [127.0.0.1])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTP id 443629C2CF3;\n\tFri, 22 Sep 2017 12:21:35 -0400 (EDT)","from mail.savoirfairelinux.com ([127.0.0.1])\n\tby localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new,\n\tport 10026)\n\twith ESMTP id Ra13-VCvSmBc; Fri, 22 Sep 2017 12:21:35 -0400 (EDT)","from weeman.mtl.sfl (unknown [192.168.49.192])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTPSA id 0F4299C2D0B;\n\tFri, 22 Sep 2017 12:21:35 -0400 (EDT)"],"X-Virus-Scanned":"amavisd-new at mail.savoirfairelinux.com","From":"Vivien Didelot <vivien.didelot@savoirfairelinux.com>","To":"netdev@vger.kernel.org","Cc":"linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com,\n\t\"David S. Miller\" <davem@davemloft.net>,\n\tFlorian Fainelli <f.fainelli@gmail.com>, Andrew Lunn <andrew@lunn.ch>,\n\tVivien Didelot <vivien.didelot@savoirfairelinux.com>","Subject":"[PATCH net-next 1/4] net: dsa: move up phy enabling in core","Date":"Fri, 22 Sep 2017 12:17:50 -0400","Message-Id":"<20170922161753.19563-2-vivien.didelot@savoirfairelinux.com>","X-Mailer":"git-send-email 2.14.1","In-Reply-To":"<20170922161753.19563-1-vivien.didelot@savoirfairelinux.com>","References":"<20170922161753.19563-1-vivien.didelot@savoirfairelinux.com>","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"bcm_sf2 is currently the only driver using the phy argument passed to\n.port_enable. It resets the state machine if the phy has been hard\nreset. This check is generic and can be moved to DSA core.\n\nSigned-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>\n---\n drivers/net/dsa/bcm_sf2.c | 16 +---------------\n net/dsa/slave.c           | 15 +++++++++++++--\n 2 files changed, 14 insertions(+), 17 deletions(-)","diff":"diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c\nindex 898d5642b516..ad96b9725a2c 100644\n--- a/drivers/net/dsa/bcm_sf2.c\n+++ b/drivers/net/dsa/bcm_sf2.c\n@@ -184,22 +184,8 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port,\n \tcore_writel(priv, reg, CORE_PORT_TC2_QOS_MAP_PORT(port));\n \n \t/* Re-enable the GPHY and re-apply workarounds */\n-\tif (priv->int_phy_mask & 1 << port && priv->hw_params.num_gphy == 1) {\n+\tif (priv->int_phy_mask & 1 << port && priv->hw_params.num_gphy == 1)\n \t\tbcm_sf2_gphy_enable_set(ds, true);\n-\t\tif (phy) {\n-\t\t\t/* if phy_stop() has been called before, phy\n-\t\t\t * will be in halted state, and phy_start()\n-\t\t\t * will call resume.\n-\t\t\t *\n-\t\t\t * the resume path does not configure back\n-\t\t\t * autoneg settings, and since we hard reset\n-\t\t\t * the phy manually here, we need to reset the\n-\t\t\t * state machine also.\n-\t\t\t */\n-\t\t\tphy->state = PHY_READY;\n-\t\t\tphy_init_hw(phy);\n-\t\t}\n-\t}\n \n \t/* Enable MoCA port interrupts to get notified */\n \tif (port == priv->moca_port)\ndiff --git a/net/dsa/slave.c b/net/dsa/slave.c\nindex 02ace7d462c4..606812160fd5 100644\n--- a/net/dsa/slave.c\n+++ b/net/dsa/slave.c\n@@ -72,6 +72,7 @@ static int dsa_slave_get_iflink(const struct net_device *dev)\n static int dsa_slave_open(struct net_device *dev)\n {\n \tstruct dsa_slave_priv *p = netdev_priv(dev);\n+\tstruct phy_device *phy = p->phy;\n \tstruct dsa_port *dp = p->dp;\n \tstruct dsa_switch *ds = dp->ds;\n \tstruct net_device *master = dsa_master_netdev(p);\n@@ -106,8 +107,18 @@ static int dsa_slave_open(struct net_device *dev)\n \n \tdsa_port_set_state_now(p->dp, stp_state);\n \n-\tif (p->phy)\n-\t\tphy_start(p->phy);\n+\tif (phy) {\n+\t\t/* If phy_stop() has been called before, phy will be in\n+\t\t * halted state, and phy_start() will call resume.\n+\t\t *\n+\t\t * The resume path does not configure back autoneg\n+\t\t * settings, and since the internal phy may have been\n+\t\t * hard reset, we need to reset the state machine also.\n+\t\t */\n+\t\tphy->state = PHY_READY;\n+\t\tphy_init_hw(phy);\n+\t\tphy_start(phy);\n+\t}\n \n \treturn 0;\n \n","prefixes":["net-next","1/4"]}