I thought ERROR bit checking (reading status port) acts like a delay, so I added a 400ns delay after pio_set_registers of the new driver. The new driver finally worked.
It works when once Linux is booted then reboot into FILO.
Maybe I have to re-enable some commands in the initialization procedure. But I've made too many modifications to the new driver, I'm not sure which is really needed.
Takeshi,
The fact that you can boot linux and then reboot into FILO and it works really suggests to me that you are working with a some sort of flaky IDE interface. So don't expect anything to be logical. I've worked with lots of embedded type devices that exhibit this symptom. They just take a while to come out of a cold boot or even from a warm reset.
Hard drives have a special problem in that they must calibrate for both mechanical head drift and ambient temperature before they access the disk _and_ its got to be pretty precise. I'm always amazed at the precision required by a HD.
What happens if you just do a 5 second delay on cold boot before you access the drive? My guess is that it will work. If so then you just need to find out what the minimum delay is before you can access the drive.
You might lark onto a special init sequence that works but I suspect it will be drive specific. Your best bet to come up with a universial solution is probally a user configurable delay for drives that don't handle the BSY flag properly.