summaryrefslogtreecommitdiff
path: root/driver/tcpm/tusb422.c
Commit message (Collapse)AuthorAgeFilesLines
* TCPC: Cleanup: Enable PPC from PD or Power MUXVijay Hiremath2021-04-201-1/+1
| | | | | | | | | | | | | | | Some PD chips have integrated SRC FET and control the SRC/SINK FET from GPIOs hence cleaned up the code to enable Power Path Control from either from PD or from Power MUX. BUG=none BRANCH=none TEST=make buildall -j Change-Id: I77f96b681fd2e5fca35bce425e4bd5ec87d5ccfd Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2828980 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* tusb422: Don't perform soft reset during initializationPatryk Duda2021-02-101-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | After waking from Low Power Mode, TCPMv2 always performs TCPC initialization. Issuing soft reset during initialization leads to lose information about DRP result and set CC lines to Rd. When attaching sink, TCPC will report that nothing is connected and as a result TCPMv2 will enable DRP and go to Low Power Mode again. When LPM debounce delay is longer than tDRP (time in which TCPC will advertise source and sink, between 50ms and 100ms according to Type-C specification), then TCPC will always find connection before going to Low Power Mode. If it is smaller, TCPMv2 will loop between LowPowerMode and DRPAutoToggle states. BUG=b:176986511 BRANCH=none TEST=Run EC on Volteer board. Check if TCPC works. TEST=Change PD_LPM_DEBOUNCE_US to 10ms and check if sink (eg. pendrive) is detected correctly. Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I0cd56d9a9ca31239afb4e41302e98b7996fb3a47 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2682482 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv2: Support BIST Test ModeAbe Levkoy2021-01-221-0/+1
| | | | | | | | | | | | | | | | | | After the first BIST Test Data packet, enable BIST Test Mode if the TCPC supports it (currently just TCPCI). While in BIST Test Mode, mask ALERT.ReceivedSOP*MessageStatus. Unmask it when the test ends, due to Hard Reset or to detach. BUG=b:173023378,b:169385081,b:172709198,b:173028832,b:173028791 BUG=b:173141941,b:173142113 TEST=Complete TDA.2.1.2.2 BMC PHY RX INT REJ on volteer without running out of Rx buffer space or watchdog timeout (still fail though) BRANCH=firmware-volteer-13521.B-master Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I03bbc4cfacceebd0334aa814e11a16e09177a322 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2545667 Reviewed-by: Diana Z <dzigterman@chromium.org>
* tusb422: Fix multi-line #error directivesSimon Glass2021-01-161-4/+4
| | | | | | | | | | | | | | | | | It does not make sense to split these over two lines. The first one causes the compiler to halt compilation and the second one never gets reported. BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer -j30 With a zephyr-chrome CL, build volteer on zephyr Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I4fe9434aa8956900fdc2c82bfb914086b962ba21 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2631085 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* Move tcpic.h header into include/driverSimon Glass2021-01-071-1/+1
| | | | | | | | | | | | | | | | | | This header cannot currently be accessed by Zephyr since it is in a driver directory, not an include directory. This header has quite a bit of public stuff in it, so it seems reasonable to consider everything public. Move the header file and update all users. BUG=b:175434113 BRANCH=none TEST=make buildall -j30 build volteer on zephyr Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ibba37f47a06783fafb5095f853f2a68d92b6df87 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2607745
* tcpm: Move tcpm.h into an include directorySimon Glass2020-12-221-1/+1
| | | | | | | | | | | | | | | | | | This header file is used from quite a few files, relying on the EC build system to find includes in the driver/tcpm directory. For Zephyr we don't want to add that as an include. It makes more sense for header files to be in an include directory, so move it and fix up the users. BUG=b:175434113 BRANCH=none TEST=build Zephyr and ECOS on volteer Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I5851914b1a7d3fdc1ba911c0fbe9046afbaf6f5d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597985 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPC: Change SOP' disable interfaceDiana Z2020-11-181-1/+1
| | | | | | | | | | | | | | | Add the ability to enable or disable SOP' traffic through a new parameter. Name the function for "enable" to match other EC conventions. BRANCH=None BUG=b:168560801 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ife52e7d7d098825ab2163c70a4c59510da958876 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2542864 Reviewed-by: Keith Short <keithshort@chromium.org>
* tcpmv2: disable receive of SOP' during VCONN swapKeith Short2020-09-021-0/+3
| | | | | | | | | | | | | | | | | | | The USB PD specification indicates that the initial VCONN source shall cease source VCONN within tVCONNSourceOff (25 ms) after receiving PS_RDY. Not all partners wait after sending PS_RDY before trying to communicate with the cable. BUG=b:163478172, b:163143427 BRANCH=none TEST=make buildall TEST=Connect 2 Volteers together and force VCONN swaps confirming the sequence completes normally. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I14720f033c5f6e9caed9c4fe3bfa11e5c046116e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2381030 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* TUSB422: Add support for FRSEric Herrmann2020-07-071-5/+48
| | | | | | | | | | | | | | | | | The TUSB422 does not officially support FRS. support is being added to workaround bugs in the SYV682. BUG=b:148144711 TEST=Check that FRS is signaled to the TCPM from the TUSB422 driver when CONFIG_USB_PD_FRS_TCPC is set TEST=make buildall BRANCH=none Change-Id: I4c8fefbf0f01b327f345d4b4f09b6c422aaa2e5d Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2278354 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* tusb422: Ensure auto discharge disconnect disabledKeith Short2020-06-201-1/+17
| | | | | | | | | | | | | | | | | | | | The TUSB422 requires auto discharge disconnect to be enabled when in active mode (defined as not unattached). Make sure auto discharge disconnect is disabled prior to enable of DRP toggling as required by the USB Port Controller Specification. BUG=b:159160125 BRANCH=none TEST=make buildall TEST=On Volteer CC line toggling when unattached and verify connection of SNK devices. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I583085dae2547026e64c2b6162912b85805f0137 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2255329 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* tusb422: Enable ADD before setting CCAbe Levkoy2020-05-291-1/+43
| | | | | | | | | | | | | | | | | | | | Enable AutoDischargeDisconnect before setting CC lines. Unless ADD is enabled, TUSB422 will not enter active mode, and CC ADC comparators will be disabled. Disable internal VBUS discharge to avoid side effects from this non-standard behavior. BUG=b:156110530 TEST=Detach external VBUS source from attached dongle; observe EC port TEST=switch from sink to source. BRANCH=none Change-Id: Icd39334c6a43016970a87def41232053b8cc722a Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2209186 Tested-by: Eric Herrmann <eherrmann@chromium.org> Reviewed-by: Eric Herrmann <eherrmann@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* tcpc: change name of get_vbus_level to check_vbus_levelDenis Brockus2020-05-151-1/+1
| | | | | | | | | | | | | | | | | | | | this is to add near future functionality to allow not only the current PRESENT range check but to add Save0V range checking as well, for platforms that allow for this. This just lays the framework and is functionally equivalent. BUG=none BRANCH=none TEST=verify basic USB functionality Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I1eb3411bc3aa9b792c9b97799e1721e5cb229f64 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2199036 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>
* tusb422: Fix DRP auto toggleKeith Short2020-03-131-2/+21
| | | | | | | | | | | | | | | | Fix DRP auto toggle on the TUSB422 TCPC. The CC lines get stuck in a persistent SRC.Open state after a device connection (SRC or SNK) if AUTO_DISCHARGE_DISCONNECT is clear. BUG=b:145250123, b:149974946 BRANCH=none TEST=make buildall TEST=Verify connection of SRC and SNK devices to USB C0 on Volteer. Change-Id: I048e75e906714c542a0aefe5e47731686a13a5ca Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2073279 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* tcpc: Add driver for TI TUSB422 tcpcScott Collyer2018-09-071-0/+66
Initial driver for TUSB422 TCPC which is a tcpci compliant TCPC. This TCPC does not inlude a Type C mux and uses the tcpci driver for all of the methods. BUG=b:111281797 BRANCH=none TEST=Verified operation as sink on DragonEgg. Have not verified source operation, or low power/auto-toggle modes as those config options can't be enabled on ITE at this point. Change-Id: I783a5e2c4a13bc0b8fa4da4b134588382542024c Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/1178994 Commit-Ready: Jett Rink <jettrink@chromium.org> Tested-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>