[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190423190156.GJ28405@lunn.ch>
Date: Tue, 23 Apr 2019 21:01:56 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Grygorii Strashko <grygorii.strashko@...com>
Cc: netdev@...r.kernel.org,
Ilias Apalodimas <ilias.apalodimas@...aro.org>,
"David S . Miller" <davem@...emloft.net>,
Ivan Khoronzhuk <ivan.khoronzhuk@...aro.org>,
Florian Fainelli <f.fainelli@...il.com>,
Sekhar Nori <nsekhar@...com>, linux-kernel@...r.kernel.org,
linux-omap@...r.kernel.org, Murali Karicheri <m-karicheri2@...com>
Subject: Re: [PATCH net-next 17/19] net: ethernet: ti: cpsw: introduce mac sl
module api
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
Powered by blists - more mailing lists