Commit Graph

17 Commits

Author SHA1 Message Date
Sam Hurst 430990ee3f usb-c: tcpc: Disable Dead Battery after system starts
The Dead Battery resistors interfere with port partner
detection. So, Dead Battery is disabled after the system
starts and sets the Rd or Rp resistors on the CC lines.

Tested on b_g474e_dpow1 with JP5 set to USBC.
Tested on stm32g081b_eval with JP17 set to D5V.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2023-03-09 09:20:35 +01:00
Sam Hurst cc416a8b9b usb-c: tcpc: Add support for Dead Battery
Add Dead Battery functionality to the TCPC drive

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2023-02-06 10:03:13 +01:00
Sam Hurst 6b4b7a02e7 usb-c: tcpc: Enable ISR Hard Reset sent bits
This change enables the ISR Hard Reset sent bits, so that
an interrupt is generated when a Hard Reset is sent or
the Hard Reset failed.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2023-01-24 09:43:20 +01:00
Sam Hurst 603ac13145 usb-c: tcpc: Correctly detect Hard Reset sent detection
The Hard Reset sent signal was tested twice in the same
"if else" structure but only handled in the last test. This
change removes the first detection so that Hard Reset can
be correctly detected.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2023-01-24 09:43:20 +01:00
Sam Hurst e3365e961d usb-c: tcpc: Simplify Hard Reset complete logic
This change simplifies the Hard Reset complete logic

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2023-01-24 09:43:20 +01:00
Sam Hurst 77e1638c3c drivers: usb_c: tcpc: stm32: Add VCONN functionality
Add VCONN discharge functionality to TCPC and driver

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-12-20 09:22:21 +01:00
Sam Hurst a19cf99aa3 drivers: usb_c: tcpc: stm32: Explicitly set the unconnected CC line to OPEN
Explicitly set the unconnected CC line to OPEN, so that it can be
used for VCONN.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-12-20 09:22:21 +01:00
Sam Hurst 21f28eacbc drivers: usb_c: tcpc: stm32: Add GoodCRC timer
When operating as a Source, the driver will wait indefinitely for
a GoodCRC message from a Sink. This PR adds a timer to trigger a
no response when a GoodCRC message isn't received.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-12-20 09:22:21 +01:00
Sam Hurst c659f3d8d7 drivers: usb_c: tcpc: stm32: Enable ISR after all UCPD devices initialized
Since all UCPD devices share the same ISR, the interrupt
should be enabled after all UCPD devices are initialized.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-12-20 09:22:21 +01:00
Sam Hurst 9750951dd1 drivers: usb_c: tcpc: stm32: Simplify shared ISR detection
Remove unnecessary code used during shared ISR detection

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-12-20 09:22:21 +01:00
Sam Hurst 029dc41acb drivers: usb_c: tcpc: stm32: Read UCPD Status Reg for source of IRQ
At system startup, the SYSCFG ITLINE registers might not
indicate an interrupt even though a UCPD interrupt is pending.
This cause the ISR to be called repeatedly without being serviced,
resulting in a system lockup. Reading the UCPD Status Reg instead
of the SYSCFG ITLINE register fixes the issue.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-12-20 09:22:21 +01:00
Sam Hurst 1a5e2c9c13 usb-c: Remove VBUS measurement and control
A USB-C VBUS driver will be used to measure VBUS
instead of accessing the measurement hardware
directly.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-10-22 18:38:35 -04:00
Sam Hurst f4b2457322 drivers: usb-c: Update TCPC driver to use devicetree Kconfig symbol
Update TCPC driver to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-10-22 18:38:35 -04:00
Sam Hurst 9659819365 usb-c: tcpc: Changes the @return tag to @retval
The "@return" command should be used for the arbitrary return
description, and "@retval <return value>" for the description
of named return value

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-10-22 18:38:35 -04:00
Sam Hurst 050323f00f stm32: Use DT_NUM_INST_STATUS_OKAY for num IRQ sources
Use DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) to determine
number of potential interrupt sources. This mitigates
the wasting of memory on devices with mutliple UCPD ports
but only one UCPD port is used.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-10-22 18:38:35 -04:00
Sam Hurst 99e07709ff boards: arm: Update STM32 UCPD nodes with pin control
Assign the pins for the STM32G071b and STM32G081b STM32
UCPD peripherals so the UCPD driver can properly
configure the device.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-10-22 18:38:35 -04:00
Sam Hurst 3dd07aebdd usb-c: Change dir name from usbc to usb_c
For improved readability, change dir name from
usbc to usb_c

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
2022-10-22 18:38:35 -04:00