Re: [PATCH 1/3] spi: xilinx: Detect stall with Unknown commands

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

 



Hi again

On Wed, Nov 22, 2017 at 8:25 PM, Ricardo Ribalda Delgado
<ricardo.ribalda@xxxxxxxxx> wrote:
> Hi Mark
>
>
> On Wed, Nov 22, 2017 at 12:12 PM, Mark Brown <broonie@xxxxxxxxxx> wrote:
>> On Tue, Nov 21, 2017 at 10:09:02AM +0100, Ricardo Ribalda Delgado wrote:
>>
>>> +             stalled = 10;
>>>               while (rx_words) {
>>> +                     if (rx_words == n_words && !(stalled--) &&
>>> +                         !(sr & XSPI_SR_TX_EMPTY_MASK) &&
>>> +                         (sr & XSPI_SR_RX_EMPTY_MASK)) {
>>
>> 10 seems like a small number for what is essentially just a busy spin -
>> are we sure that we won't reasonably hit a case where the CPU is
>> sufficiently fast and the bus sufficiently slow we falsely detect a
>> stall?  Where did this number come from?
>
> This code is executed after all the data has been pushed to the out
> fifo. Since we are not inhibitng tx, the moment the empty mask is
> evaluated,  at least one byte should be out.
>
> After 1 day of use I have been able to locate one event when stalled
> was two. So 10 is very conservative number.
>
> In other words: 10 is one order of magnitude bigger than the worst
> measured case.


If it makes you more comfortable I could add something like

if (n_tries < 8)
   msleep(10);

Regards!

>
> Thanks for your review :)
>
>
> --
> Ricardo Ribalda



-- 
Ricardo Ribalda
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux