From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lunn Subject: Re: [PATCH] net: macb: do not disable MDIO bus when closing interface Date: Thu, 9 Aug 2018 17:14:33 +0200 Message-ID: <20180809151433.GB20006@lunn.ch> References: <20180808121901.10264-1-anssi.hannula@bitwise.fi> <425ed5af-eac2-a58b-b6ca-f022a80367e4@microchip.com> <3c3a606e-b3e1-41fc-fcd8-7b98968fd06b@bitwise.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Claudiu Beznea , Nicolas Ferre , "David S. Miller" , netdev@vger.kernel.org To: Anssi Hannula Return-path: Received: from vps0.lunn.ch ([185.16.172.187]:59969 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732312AbeHIRkB (ORCPT ); Thu, 9 Aug 2018 13:40:01 -0400 Content-Disposition: inline In-Reply-To: <3c3a606e-b3e1-41fc-fcd8-7b98968fd06b@bitwise.fi> Sender: netdev-owner@vger.kernel.org List-ID: Hi Anssi > macb_reset_hw() is called in init path too, though, so maybe clearing > all bits is intentional / wanted to get the controller to a known state, > even though the comment only mentions TX/RX? You need to be careful here. Once of_mdiobus_register() is called, the MDIO should be usable. If you happen to have an Ethernet switch on the bus, it could be probed then. The DSA driver will start using the bus. Or if you have a second PHY, connected to some other MAC, it could be used by the other MAC. This all happens in the macb_probe function. Sometime later, the interface will be up'ed. At this point macb_open() is called, which calls macb_init_hw(), which calls macb_reset_hw(). What you don't want happening is changes to the NCR at this point breaking an MDIO transaction which might be going on. Ideally, the MPE should be enabled before of_mdiobus_register(), and left alone until mdiobus_unregister() is called in macb_remove(). Andrew