Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3936801yba; Tue, 23 Apr 2019 12:04:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqylq7UwiSCsuuQxER1Y6l27y1nF6mU2leu9yfcA4XcfkCDrt5zDogE8DOM1hTscDFnWmVAd X-Received: by 2002:a17:902:56e:: with SMTP id 101mr27372161plf.142.1556046273414; Tue, 23 Apr 2019 12:04:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556046273; cv=none; d=google.com; s=arc-20160816; b=CnbffRAWW582zF6VIvj4PLpaiyD8btUKajvYsqE1v0sQMWBxKC3MzirhHDj7HbZao4 Jprk762LNMO7BcfDo7xk/ypJRvkiEQB7p6+R9a3h8IVBtXJ1T8WLECGjypKZZ99p8Z8b owjFTYVuRZAMNUr4HMeT+EJd2YTIz7TzyWz9cK+/8GJrOru1srg2EIV/fo6mkf5Ow45N yrySAITMcE8BJw9PqTN12yBa0K1FEnKqwmHJwir5j3aJxK5ZYPGjBFWqmKPUFQtX2xYU K3XTJ0EhW+53zplSuK4XMR+6jocbTYX5WGXcJiTEkLcrQZoJhYQk0BDhumVVgRPoZPWT 053w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ia7LuYatyrJGh91HOiVWhiN0ei1JZZ9US3zdwwg6W5I=; b=Df5sWkAvasyDiBo2tBsTjUbe4CL398fGpZmDKu3+9mcSu6Q7HrFCKNvOJ/NvGKbMDm cPrwVeEFF8xW73gfX4DJ5ST8ANgF1urEOPVKO5hgi5+tLKMRvAVA20oY8ZxguPPq+K7f sbVRS3jRW0iCu+RdLbBzYU3o0fO8n7AUxPGLoMWgvsOzYz942mgmYNyj8Ezpa0NUtjBP RIUbUGVDd86kakiy19aI+LVSDdlDCyOwAsgsdqIFSUhMCrluMlKh1yGh6NtLB7M92DIv GylP+23o4kYE6ORMaTK5iccA6h2518u3uGCKceTvJ2UfP6f4yH2Pefc9+KuGgTwFjf+/ Sh+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b="f2ECr/tz"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j25si15792006pgb.531.2019.04.23.12.04.18; Tue, 23 Apr 2019 12:04:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b="f2ECr/tz"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726651AbfDWTCB (ORCPT + 99 others); Tue, 23 Apr 2019 15:02:01 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:41827 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725945AbfDWTCA (ORCPT ); Tue, 23 Apr 2019 15:02:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ia7LuYatyrJGh91HOiVWhiN0ei1JZZ9US3zdwwg6W5I=; b=f2ECr/tzohUDJ7Hl/gZZoaMKxw qJaKRdiyGCWNGCWMEV/abwg8UvFAGB5iMXfRVcNVLO+Vdgfq/09av1h5kQm+GHfCCyXdjdcu5QbCE hlfd/TDgVEB5yEu2ywHIMoQMtnQrzeczALEgiShCQ5+Usxw3rlHPVRwOvrNlYc2vXaLw=; Received: from andrew by vps0.lunn.ch with local (Exim 4.89) (envelope-from ) id 1hJ0g0-0001lf-KU; Tue, 23 Apr 2019 21:01:56 +0200 Date: Tue, 23 Apr 2019 21:01:56 +0200 From: Andrew Lunn To: Grygorii Strashko Cc: netdev@vger.kernel.org, Ilias Apalodimas , "David S . Miller" , Ivan Khoronzhuk , Florian Fainelli , Sekhar Nori , linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, Murali Karicheri Subject: Re: [PATCH net-next 17/19] net: ethernet: ti: cpsw: introduce mac sl module api Message-ID: <20190423190156.GJ28405@lunn.ch> References: <1556024950-20752-1-git-send-email-grygorii.strashko@ti.com> <1556024950-20752-18-git-send-email-grygorii.strashko@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1556024950-20752-18-git-send-email-grygorii.strashko@ti.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 23, 2019 at 04:09:08PM +0300, Grygorii Strashko wrote: > +void cpsw_sl_reset(struct cpsw_sl *sl, unsigned long tmo) > +{ > + unsigned long timeout = jiffies + msecs_to_jiffies(tmo); > + > + /* Set the soft reset bit */ > + cpsw_sl_reg_write(sl, CPSW_SL_SOFT_RESET, CPSW_SL_SOFT_RESET_BIT); > + > + /* Wait for the bit to clear */ > + do { > + cpu_relax(); > + } while ((cpsw_sl_reg_read(sl, CPSW_SL_SOFT_RESET) & > + CPSW_SL_SOFT_RESET_BIT) && > + time_after(timeout, jiffies)); Hi Grygorii If you are waiting for milliseconds, you probably should have a sleep/delay in here. > +int cpsw_sl_wait_for_idle(struct cpsw_sl *sl, unsigned long tmo) > +{ > + unsigned long timeout = jiffies + msecs_to_jiffies(tmo); > + > + do { > + cpu_relax(); > + } while (!(cpsw_sl_reg_read(sl, CPSW_SL_MACSTATUS) & > + sl->idle_mask) && time_after(timeout, jiffies)); > + Same here. > + if (!(cpsw_sl_reg_read(sl, CPSW_SL_MACSTATUS) & sl->idle_mask)) { > + dev_err(sl->dev, "cpsw_sl failed to soft-reset.\n"); > + return -ETIMEDOUT; > + } > + > + return 0; Andrew