From mboxrd@z Thu Jan 1 00:00:00 1970 From: Harini Katakam Subject: Re: [PATCH v2 1/4] net: macb: Check MDIO state before read/write and use timeouts Date: Tue, 27 Nov 2018 11:06:36 +0530 Message-ID: References: <1543216072-9623-1-git-send-email-harini.katakam@xilinx.com> <1543216072-9623-2-git-send-email-harini.katakam@xilinx.com> <5de882e3-65ac-7ff1-bb55-7537666dfc77@microchip.com> <20181126145210.GD12116@lunn.ch> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: Claudiu Beznea , Harini Katakam , Nicolas Ferre , David Miller , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Michal Simek , Shubhrajyoti Datta , sai.pavan.boddu@xilinx.com To: Andrew Lunn Return-path: In-Reply-To: <20181126145210.GD12116@lunn.ch> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org Hi Claudiu, On Mon, Nov 26, 2018 at 8:22 PM Andrew Lunn wrote: > > On Mon, Nov 26, 2018 at 02:46:01PM +0000, Claudiu.Beznea@microchip.com wrote: > > Hi Harini, > > > > On 26.11.2018 09:07, Harini Katakam wrote: > > > From: Harini Katakam > > > > > > Replace the while loop in MDIO read/write functions with a timeout. > > > In addition, add a check for MDIO bus busy before initiating a new > > > operation as well to make sure there is no ongoing MDIO operation. > > > > Is this MDIO bus busy check necessary? The caller of > > macb_mdio_read/macb_mdio_write locks the mdio bus mutex before calling it > > (e.g. mdiobus_read). > > Hi Claudiu > > It depends on the implementation. A write operation you could just > launch, but not wait for it to complete, allowing you to do other > stuff while the hardware is busy. For the next operation you then do > need to check the previous operation has completed. > > I've not checked it is actually implemented this way. Yes, as Andrew mentioned, a previous MDIO bus operation cannot be assumed to be complete always - for ex., in case of a timeout. There is a chance that the MDIO bus bit is busy when mdio_read/write is called. Regards, Harini