SFP PHY Driver -------------------------- -------------------------- Introduction ------------- -------------- This document describes the SFP (Small FormFactor Pluggable) module driver implementation. SFP driver is used to support SFP PHY modules. At a high level, it does the following: - Register as an I2C client device. - Implement the state machine in order to maintain the state for On,Off,Active events. - Register interrupt handlers for Tx fault, LOS and present events. - Process the interrupts and events that occur in the workqueue and do the appropriate action for each case. - Export the sysfs attributes for SFP service level, Tx fault count, LOS (Loss of Signal) count and state. Design flow ------------ ------------ It starts with Power Manager who sets the SFP service level to ON in Active and Off to BBU (battery) based on the policy. Once this is done, SFP driver gets the service level event and changes the "state" accordingly. The state machine below describes the way the state changes and what events are being triggered in each case. Interrupts and events comes in either when service level attribute is changed or when SFP in plugged in/removed which causes SFP HW interrupts to occur. The event handler implements the actions described in this state machine. |---------------------------------------------------------------------------------------------------------------| | Event | On AC | On Battery | SFP Present | |State | | | | |---------------------------------------------------------------------------------------------------------------| |SFP OFF | Change state to SFP ON | NetIP resource control | | | | | method in ACPI on recieving | SFP Present = x | | | | SGMII0 service OFF will turn | State remains OFF | | | | on the SFP Power and Tx | | | | | Disable OFF. | | |---------------------------------------------------------------------------------------------------------------| | | | | | |SFP ON | Power on SFP | Change state to SFP=OFF | SFP Present=0 | | | State = SFP ON | | Change State to SFP active | | | Check if SFP PRESENT | | | | | is Low. If yes, Change | | | | | state to Active and | | | | | trigger NetLink SFP | | | | | active event | | | |---------------------------------------------------------------------------------------------------------------| |SFP Active | State remains Active. | Change state to SFP=OFF | If SFP present =0, | | | Trigger Netlink SFP | | Turns on the SFP Tx Disable | | | active event and set | | Trigger Netlink SFP active | | | SFP Tx Disable=0 | | event and set State= Active | | | | | If SFP present=1, | | | | | Trigger a Netlink SFP inactive | | | | | event and set State=OFF | |---------------------------------------------------------------------------------------------------------------| Implementation --------------- --------------- Implementing the SFP driver are in the lines of how the design flow is described above. Existing Issues --------------- --------------- - I2C communication errors. - Slight SFP Power leakage when turned off.