Re: [PATCH v9 02/15] octeontx2-af: Reset all RVU blocks

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

 



> +	void __iomem *reg;
> +	int timeout = 100;
> +	u64 reg_val;
> +
> +	reg = rvu->afreg_base + ((block << 28) | offset);
> +	while (timeout) {
> +		reg_val = readq(reg);
> +		if (zero && !(reg_val & mask))
> +			return 0;
> +		if (!zero && (reg_val & mask))
> +			return 0;
> +		usleep_range(1, 2);
> +		timeout--;
> +	}

One more clarification here: if you loop around a usleep_range(),
I would suggest using 'while (time_before(jiffies, end))'
or 'ktime_before(ktime_get(), end)' as the loop condition, otherwise
the maximum timeout can be fairly large depending on the
actual configuration and presence of timers. Then you can
also make the range much wider, e.g. 'usleep_range(1, 10)'

Aside from that, this looks much better than the delay loop
you had before.

      Arnd



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux