Re: [PATCH net-next 17/19] net: ethernet: ti: cpsw: introduce mac sl module api

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux