Silicon Image device hotplug debounce
This is some info that Silicon Image provided, for use in developing SATA hotplug. This info is public and not NDA as of the publishing of the SiI 311x hardware documentation at
http://gkernel.sourceforge.net/specs/sii/
Kudos again to SiI for opening their 311x and CMD680 [PATA] docs.
Jeff
Here are some writeups for our 3112/3152 hot plug/unplug handling. Hope it will
help in your open source development.
For the 3114 controller, the sequence is essentially the same as the 3112 except
that the PHYRDY change handler does not need to reset the channel and of course obvious changes to handle the two additional channels of the 3114.
Best regards,
[silicon image person]
During driver initialization:
Write 0xFFFF0000 to both SERROR registers (BAR 5 offsets 0x108 and 0x188) to clear any pre-existing serial error bits.
Enable the PHYRDY change interrupt (bit 16) of the SIEN registers (BAR 5 offsets 0x148 and 0x1C8)
Interrupt handler:
Read PCI Bus Master2 - IDE0 register (BAR 5 offset 0x10) and examine bits 4 and 6. If either bit is set then read the appropriate SERROR register and look at bit 16. If this bit is set a PHYRDY change (hot plug/unplug event) has occurred and the PHYRDY change handler should be called.
PHYRDY change handler:
If PHYRDY debounce timer is currently running, stop it.
Read the appropriate SSTATUS register (BAR 5 offsets 0x104 or 0x184) and examine bits 0 and 1. If both of these bits are not set then the device has been unplugged so perform a hard reset on the channel to cause the ATA status register to be reset to 0x7F to facilitate device detection later on if a device plugged back in.
Restart the PHYRDY debounce timer (recommended timer period of ~500ms.)
PHYRDY debounce timer handler:
Read the appropriate SSTATUS register (BAR 5 offsets 0x104 or 0x184) and examine bits 0 and 1.
If both bits are set a device has been plugged in and the driver should run its normal device detection/configuration code to make the device ready for use.
If both bits are not set then the device has been unplugged and the driver should clean-up any outstanding commands to the removed device.
Quoted 8 lines · Jeff Garzik <jgarzik <at> pobox.com> writes:
This is some info that Silicon Image provided, for use in developing SATA hotplug. This info is public and not NDA as of the publishing of the SiI 311x hardware documentation at
Quoted 8 lines
Kudos again to SiI for opening their 311x and CMD680 [PATA] docs.
Jeff
Here are some writeups for our 3112/3152 hot plug/unplug handling. Hope it
will
Quoted 3 lines
help in your open source development.
For the 3114 controller, the sequence is essentially the same as the 3112
except
Quoted 1 line
that the PHYRDY change handler does not need to reset the channel and of
course
Quoted 5 lines
obvious changes to handle the two additional channels of the 3114.
Best regards,
[silicon image person]
Hi, This is Ricky. I am finding solution of sil 3512 chip hotswap problem. I think this doc can help some. But I don't really understand libata very much. Can someone help some ideas?..Thanks
I know I should do something in interrupt handler in libata.c like check status of plug/unplug. Is is right?
Quoted 5 lines · Ricky Cheng
Hi, This is Ricky. I am finding solution of sil 3512 chip hotswap problem. I think this doc can help some. But I don't really understand libata very much. Can someone help some ideas?..Thanks
I know I should do something in interrupt handler inlibata.clike check status of plug/unplug. Is is right?
Yo.
I'm working on a hotswap infrastructure patch right now that would give you the API necessary to perform a hotswap. There are essentially two parts:
1) The driver has to recognize that a plug/unplug event occurred
2) libata has to take the appropriate action to plug/unplug a device.
Currently, I have only done step 1) for the sata_promise driver. Step
2) is being... well, written. Since you're doing hotswap stuff, great, you can test it for me (I am in China until September with no goddamn hardware to test with)!
Look (tonight, over the next few hours in fact) for messages of the type "Add disk hotswap support to libata." I should have some patches sent in by then.
Luke Kosewski
Quoted 5 lines
Look (tonight, over the next few hours in fact) for messages of the type "Add disk hotswap support to libata." I should have some patches sent in by then.
Hi, Luke
Thanks a lot, I'll keep waiting for the patch sent tonight to test.
Ricky Cheng