USB: typec: tps6598x: Add TPS25750 support
TPS25750 controller requires a binary to be loaded with a configuration
binary by an EEPROM or a host.
Appling a patch bundling using a host is implemented based on the flow
diagram pg.62 in TPS25750 host interface manual.
https://www.ti.com/lit/ug/slvuc05a/slvuc05a.pdf
The flow diagram can be summarized as following:
- Start the patch loading sequence with patch bundle information by
executing PBMs
- Write the whole patch at once
- When writing the patch fails, execute PBMe which instructs the PD controller
to end the patching process
- After writing the patch successfully, execute PBMc which verifies the patch
integrity and applies the patch internally
- Wait for the device to switch into APP mode (normal operation)
The execuation flow diagram polls the events register and then polls the
corresponding register related to the event as well before advancing to the next
state. Polling the events register is a redundant step, in this implementation
only the corresponding register related to the event is polled.
Adding tps25750 support, the followings are being taken care of:
- Implement applying patch flow.
- When an EEPROM is present, tps25750 loads the binary configuration from
EEPROM. Hence, all we need to do is wait for the device to switch to APP
mode.
- Dead battery flag is cleared after switching tps25750 to APP mode so the
PD controller becomes fully functional.
- Add port registration as tps25750 doesn't have system configuration register
to get dr/pr of the current applied binary configuration. Get data role from
the device node and power role from PD status register.
- tps25750 event registers structure is different than tps6598x's,
tps25750 has 11 bytes of events which are read at once where
tps6598x has two event registers of 8 bytes each which are read
separately. Likewise MASK event registers. Also, not all events
are supported in both devices. Create a new handler to accommodate
tps25750 interrupt.
- Enable sleep mode so the device enters sleep state when idling.
- When the current mode is PTCH, enable tps25750 by loading a
configuration patch that switches the device into APP mode.
- Add resume and suspend pm for tps25750.
Signed-off-by: Abdel Alkuor <abdelalkuor@geotab.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20231003155842.57313-7-alkuor@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>