Commit 7e7a3c81 authored by Abdel Alkuor's avatar Abdel Alkuor Committed by Greg Kroah-Hartman

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: default avatarAbdel Alkuor <abdelalkuor@geotab.com>
Reviewed-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20231003155842.57313-7-alkuor@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5bd4853d
This diff is collapsed.
......@@ -199,4 +199,21 @@
#define TPS_DATA_STATUS_DP_SPEC_PIN_ASSIGNMENT_A BIT(2)
#define TPS_DATA_STATUS_DP_SPEC_PIN_ASSIGNMENT_B (BIT(2) | BIT(1))
/* BOOT STATUS REG*/
#define TPS_BOOT_STATUS_DEAD_BATTERY_FLAG BIT(2)
#define TPS_BOOT_STATUS_I2C_EEPROM_PRESENT BIT(3)
/* PD STATUS REG */
#define TPS_REG_PD_STATUS_PORT_TYPE_MASK GENMASK(5, 4)
#define TPS_PD_STATUS_PORT_TYPE(x) \
TPS_FIELD_GET(TPS_REG_PD_STATUS_PORT_TYPE_MASK, x)
#define TPS_PD_STATUS_PORT_TYPE_SINK_SOURCE 0
#define TPS_PD_STATUS_PORT_TYPE_SINK 1
#define TPS_PD_STATUS_PORT_TYPE_SOURCE 2
#define TPS_PD_STATUS_PORT_TYPE_SOURCE_SINK 3
/* SLEEP CONF REG */
#define TPS_SLEEP_CONF_SLEEP_MODE_ALLOWED BIT(0)
#endif /* __TPS6598X_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment