Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752556AbdIVQdG (ORCPT ); Fri, 22 Sep 2017 12:33:06 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:52611 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752097AbdIVQdD (ORCPT ); Fri, 22 Sep 2017 12:33:03 -0400 Date: Fri, 22 Sep 2017 18:32:58 +0200 From: Andrew Lunn To: Vivien Didelot Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com, "David S. Miller" , Florian Fainelli Subject: Re: [PATCH net-next 1/4] net: dsa: move up phy enabling in core Message-ID: <20170922163258.GA3470@lunn.ch> References: <20170922161753.19563-1-vivien.didelot@savoirfairelinux.com> <20170922161753.19563-2-vivien.didelot@savoirfairelinux.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170922161753.19563-2-vivien.didelot@savoirfairelinux.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 886 Lines: 30 On Fri, Sep 22, 2017 at 12:17:50PM -0400, Vivien Didelot wrote: > bcm_sf2 is currently the only driver using the phy argument passed to > .port_enable. It resets the state machine if the phy has been hard > reset. This check is generic and can be moved to DSA core. > > dsa_port_set_state_now(p->dp, stp_state); > > - if (p->phy) > - phy_start(p->phy); > + if (phy) { > + /* If phy_stop() has been called before, phy will be in > + * halted state, and phy_start() will call resume. > + * > + * The resume path does not configure back autoneg > + * settings, and since the internal phy may have been > + * hard reset, we need to reset the state machine also. > + */ > + phy->state = PHY_READY; > + phy_init_hw(phy); > + phy_start(phy); > + } Hi Vivien If this is generic, why is it needed at all here? Shouldn't this actually by in phylib? Florian ? Andrew