lkml.org 
[lkml]   [2019]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2019-04-23 21:03    [W:0.190 / U:2.760 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site