
Le 04/08/2010 09:23, Albert ARIBAUD a écrit :
Le 04/08/2010 08:08, Prafulla Wadaskar a écrit :
- Instead of adding fixed 41/50 usec delay between the writes to
Scontrol It would be good if you can check/poll some status bit associated with IDE controller, this will make mvsata driver rock solid on any platform.
I've looked up the marvell kirkwood and orion docs for such a control bit but found none. I'll look it up again, however it might help if you can find someone inside Marvell who would, and could, provide the info.
I think I've found out how it works.
I initially thought the DET field in SControl was a sort of reset line, and that writing a 1 would put the controller in continuous reset and writing a 0 to put it out of reset.
But actually, DET is a command field : a write of 1 starts the reset sequence immediately: the DET field of the SStatus register will go from 0 to 3 (possibly passing through 1).
Then you can set SControl's DET back to 0 so that you can use the port.
Thus the init sequence becomes: write 3 to SControl's IPM and 1 to DET, read SStatus until its DET field is 3, write 0 to SControl's DET.
However I'll keep a timeout value in the status read loop, because you can't expect SStatus to become 3: it could stay 0 if no drive is connected, for instance. If I did not keep a timeout, u-boot would freeze. :/
Amicalement,