I'm attempting to debug a driver on a code base I've inherited.
One of the drivers which my system reads is causing my entire firmware to hang when the driver reads from a device.
The code goes something like this.
ioctl call to read driver value()
Loop 25 times
If the is hardware working/readable}
read the driver value If the hardware is not working/readable
If the hardware wasn't ever working/readable in the last loop
printf("Driver Failed\n"); }
From the looks of this if the driver isn't readable it should retry for 2.5 seconds then return a failure. I'm seeing that this happens correctly right after I flash and boot the chip. Then I hard power the whole system and let it all boot up again. Now the behavior changes. The system hangs in the ioctl call for ~350 seconds. The odd part is that it prints the Driver Failed message at the beginning of the hang.
One would think that if the Driver Failed message was shown the function would return right away! This is not the case. I've done some timing tests and the hang is directly related to (number of loop retries * mdelay milliseconds).
I was thinking of coding a workaround by creating my own delay function using f_time but before doing that I wanted to see if anyone had a better idea of what is going on first.