summaryrefslogtreecommitdiff
path: root/common/usb_pd_policy.c
Commit message (Collapse)AuthorAgeFilesLines
* TCPM: Move dfp_discover_modes into usb_pd_policy.cAbe Levkoy2020-07-251-0/+20
| | | | | | | | | | | | | It is now only used by TCPMv1. BUG=b:152417597 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Ifcb7023afabea16486d90336994c6cd93a96d69b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2317903 Reviewed-by: Diana Z <dzigterman@chromium.org>
* usb_pd: Move 'is_vdo_present()' and 'is_usb4_vdo()' to TCPMv1Ayushee2020-07-061-0/+22
| | | | | | | | | | | | BUG=b:156749387 BRANCH=None TEST=make buildall -j Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: I8ecffd3084de472ec3d145c3ff69df1ca2d89a56 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2278562 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* usb_pd: TBT: Cleanup limiting the cable speedAyushee2020-06-261-12/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | If the cable doesn't support Intel SVID, thunderbolt cable speed should be set to Passive Gen 2 cable. Ref: USB Type-C Cable and Connector Specification, Fig F-1. This Commit: 1. Removes setting the Thunderbolt cable speed if the Intel SVID is not supported on TCPMv1. 2. If, the cable doesn't support Intel SVID, set the maximum supported Thunderbolt cable speed according to the board's capability or TBT_SS_U32_GEN1_GEN2 cable speed 3. If, the cable supports Intel SVID, set the maximum supported Thunderbolt cable speed according to the board's or cable's capability. BUG=b:157671582 BRANCH=None TEST=Able to enter Thunderbolt-Compat mode for emark cable not supporting Intel SVID. Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: I1835f16dea755b96db127036350bdf60ba9c0734 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2259518 Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* usb_pd: Remove pd_cable dependent Thunderbolt code from common codeAyushee2020-06-261-31/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | 1. Separated the common functions needed to check for port/cable's Thunderbolt mode compatibility back into TCPMv1. 2. Refactored the common Thunderbolt mode functions using pd_cable structure for mode information by adding a. Generic function that returns the Discover Mode response of specified SVID. b. Thunderbolt specific functiion that returns Discover Mode response of Intel SVID. 3. Removed the redundant pd_cable structure from DRP state machine policy engine. BUG=b:158294748 b:150611251 BRANCH=None TEST=1. Able to enter into Thunderbolt mode on TCPMv1 Change-Id: I30c8f1a007228408e08520502db00601ca3a2521 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2249020 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
* usb_pd: Remove pd_cable usage from common codeAyushee2020-06-251-33/+40
| | | | | | | | | | | | | | | | | | | Previously, the Discovery Identity SOP' response for TCPMv1/2 was being stored in pd_discovery and in pd_cable. This commit removes the storage of Discover Identity SOP' response from the pd_cable structure. BUG=b:158294748 b:159504972 BRANCH=None TEST=1. Able to get the cable characteristics 2. Able to enter into Thunderbolt mode on TCPMv1 3. Able to enter into USB4 mode on TCPMv1 Change-Id: I1e5112f9aa158c41abb6226a3819f1612ed906bd Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2247211 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
* TCPMv2: Support mode entry for SOP' and SOP''Abe Levkoy2020-06-111-3/+15
| | | | | | | | | | | | | | | | | | | | | | Add a transmit type parameter to functions involved in mode entry; also add such a parameter to various functions calling those functions. For DisplayPort-specific definitions or calls, specify SOP; we do not currently support DisplayPort mode for cable plugs. For TCPMv1-specific code, specify SOP. TCPMv1 generally assumes that the discovery/mode structures are 1-dimensional, as they were previously, and changing that is outside the scope of this CL. BUG=b:155890173 TEST=Enter DP mode on Volteer with TCPMv2 TEST=Enter DP mode on Volteer with TCPMv1 TEST=Enter TBT mode on Volteer with TCPMV1 BRANCH=none Change-Id: I8afc75b3f3be8939c4645058ac4a31f24c88fb9e Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2229279 Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Diana Z <dzigterman@chromium.org>
* usb_pd: Cleanup: Add functions to process Disc IdentityAyushee2020-06-091-65/+73
| | | | | | | | | | | | | | | | Add separate functions process_am_discover_ident_sop() and process_am_discover_ident_sop_prime() to process the Discover Identity command. BUG=b:148528713 BRANCH=none TEST=make buildall -j Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: Id074b2fc5c9aae02b51b110c9959656cacb36ee7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2185615 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* usb_pd: Cleanup: Cable flagsAyushee2020-06-091-103/+47
| | | | | | | | | | | | | | | | | | | | | | Instead of using CABLE_FLAGS_SOP_PRIME_ENABLE and CABLE_FLAGS_SOP_PRIME_PRIME_ENABLE cable flags, add the type of message to be transmitted directly in the message header. BUG=b:148528713 BRANCH=none TEST=1. make buildall -j 2. Able to enter DP mode with Type-C dock and Type-C to DP connector. 3. Able to enter Thunderbolt-Compatible mode with thunderbolt dock with both Active and Passive cables. 4. Able to Enter USB4 mode with USB4 device with thunderbolt Gen2 cable. Change-Id: Ib0cac818200e7ab8f73cace85ffee65203019709 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2159592 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* usb_pd: Move USB4 functions to common fileAyushee2020-06-051-67/+0
| | | | | | | | | | | | | | | | | Added a check for CONFIG_USB_PD_ALT_MODE_DFP in pd_send_enter_usb() and added separate configs for USB4 DRD and USB3.2 DRD BUG=b:148528713 BRANCH=none TEST=Able to enter USB4 mode with following passive cables - a. Rev 3 USB3.2 Gen 1, USB3.2 Gen 2 and USB4 Gen 3 b. Rev 2 USB3.1 Gen1/Gen2 Change-Id: I80c9b7569429bc54db08d78b5a6eee16780d6fe1 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2051631 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
* usb_pd: USB4: Limit the cable speedAyushee2020-06-051-23/+0
| | | | | | | | | | | | | | | | | | | | | | | Added 'get_usb4_cable_speed()' to return USB4 speed as per the port, the speed supported by DUT's port or cable speed whichever is lowest. Added configuring the cable speed in cros_ec_usb_pd_control according to the mux setting. Removed 'set_max_usb4_cable_speed()' to retain cable's actual VDO response. BUG=b:157671582 BRANCH=none TEST=1. Able to set USB4/USB3.2 Gen2 cable speed when DFP isn't gen 3 capable. 2. Able to limit cable speed according to the port, if the cable speed is higher. Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: I21bba7e5a2aa8ca54f304ef8418320f319f020b1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2220826 Reviewed-by: Keith Short <keithshort@chromium.org>
* usb_pd: TBT: Refactor limiting the cable speedAyushee2020-06-051-26/+4
| | | | | | | | | | | | | | | | | | | | Refactored 'get_tbt_cable_speed()' to return thunderbolt-compatible speed as per the speed supported by DUT's port or cable speed whichever is lowest. Also removed 'usb_pd_limit_cable_speed()' to retain cables's actual VDO response. BUG=b:157671582 BRANCH=none TEST=Able to limit thunderbolt cable speed, if the cable speed is higher than the speed supported by DUT's port. Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: I77d3efddb425daa7bd12e9ed21be7088074285bb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2227088 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* BB retimer: Correct setting USB4 cable speedAyushee2020-05-291-17/+0
| | | | | | | | | | | | | | | | For DFP, TBT/USB4_cable_speed_support is set according to a. Discover mode SOP' response for Thunderbolt-compat mode and b. Discover ID SOP' response for USB4 mode. Ref: Burnside Bridge spec Table 13: Connection state register BUG=b:152544514 BRANCH=None TEST=make buildall -j Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: Ic031489878dab701177936ea8e2f50d434dba25b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2152287 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv2: Define fields for SVID discovery stateAbe Levkoy2020-05-121-3/+18
| | | | | | | | | | | | | | | Index discovery results by SOP type and track SVID discovery state for each type. Define accessors for this state and modify existing accessors to be SOP-type-aware. BUG=b:152419850,b:152418267 TEST=make buildall; attach port partner; observe discovery via Twinkie BRANCH=none Change-Id: I24ee19aac087c5752a3a822ab2b0c9da7a55af1b Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2174464 Reviewed-by: Diana Z <dzigterman@chromium.org>
* usb4: Override USB4 cable speed based on board designAyushee2020-05-051-1/+23
| | | | | | | | | | | | | | | | | | | | Limit the USB4 cable speed according to the port, if the port supports lesser USB4 speed than the cable. Ref: TGL PDG 3.1: Fiberweave Impact for HSIOs Operating at ≥8 GT/s Speeds MAX TBT routing length is 205mm prior to connection to re-timer BUG=b:155429028 BRANCH=None TEST=Tested on Volteer with 40Gbps passive cable, able to limit USB4 cable speed to 20Gbps on Port 1 and restrict USB4 PD-flow on port 0 Change-Id: I317215d3149dae4eeca68149694ad857be5ead35 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2175163 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* usb_pd: Move Thunderbolt-Compatible functions to common fileAyushee2020-05-041-176/+24
| | | | | | | | | | | | | | | | | Added 'get_tcpm_transmit_msg_type()' to return type of SOP message transmitted since, 'PD_HEADER_GET_SOP' is not a part of PD spec and TCPMv1 will return 0 irrespective of type of SOP message transmitted. BUG=b:148528713 BRANCH=none TEST=Able to enter Thunderbolt-Compat mode with both Active and Passive cable on TCPMv1. Change-Id: Ic53efeda9d9e012571f3047bc2a0d65969296b8c Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2051630 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv2: Store Tx type in PE stateAbe Levkoy2020-05-021-1/+1
| | | | | | | | | | | | | | | | | This will be used for VDM request state for discovery. Also change names of identity discovery timer and counter fields to comport with PD spec. This is substantially based on https://crrev.com/c/2148427. BUG=none TEST=make buildall BRANCH=none Change-Id: Iabda5c4cd169944a6c84bc72f551de7eb82ab424 Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2174463 Reviewed-by: Diana Z <dzigterman@chromium.org>
* usb_pd: Correct processing discover SVIDAyushee2020-04-291-3/+3
| | | | | | | | | | | | | | | | | | | | In current code, Discover SVID SOP' is sent if the cable supports Intel SVID. But, according to USB Type-C Cable and Connector Spec figure F-1: TBT3 Discovery Flow, if the cable supports Intel SVID, Discover Mode SOP should be sent. BUG=b:154308721 BRANCH=None TEST=Tested on Volteer, able to enter Thunderbolt and USB4 mode with Passive Gen2 cables: 1. Supporting Intel SVID. 2. Not supporting Intel SVID. Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: I0a8ab913836b018547a5306dd82d3bed80273f87 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2166741 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
* TCPMv1: skip cable probing when not VCONN sourceKeith Short2020-04-281-24/+13
| | | | | | | | | | | | | | | | | | | | | | USB PD specification only permits the port that is currently sourcing VCONN to send SOP' and SOP'' messages to the cable. Ensure USB4 and TBT modes are not probed or entered if the EC is not sourcing VCONN. BUG=b:155073708 BRANCH=none TEST=make buildall TEST=connect Gatkex board to Volteer, with PD analyzer observe that when Gatkex claims VCONN source, EC code skips all SOP' messages but otherwise completes PD discovery. TEST=connect TBT dock, verify SOP' messages sent and TBT mode is entered. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ie7cf2910c0d9d78ba809ca25943585cfc96031a0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2169476 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Ayushee Shah <ayushee.shah@intel.com>
* USB4: Correct getting product type from VDOAyushee2020-04-281-6/+2
| | | | | | | | | | | | | | | | | | Earlier, the product type was extracted from the Product VDO. But, according to USB PD Spec 3.0 version 2.0 and USB PD spec 2.0 version 1.3 ID Header VDO gives the UFP product type. Also added a check to ensure the port receives a valid UFP product VDO. BUG=b:154900425 BRANCH=None TEST=Checked on Volteer, able to enter into USB4 mode Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: I2efa6885701684df4a39d12c064f8bb658efb8a0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2166484 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv2: Cleanup: Ensure PD_FLAGS_* are not used.Edward Hill2020-04-251-0/+38
| | | | | | | | | | | | | | | PD_FLAGS_* are TCPMv1 only, so make sure they are not used with TCPMv2. BUG=none BRANCH=none TEST=none Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I7a119c9745b0004b6067862205f185557f704cb5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2161923 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* USB4: Allow entering USB4 mode for devices and cables without SVIDAyushee2020-04-251-44/+68
| | | | | | | | | | | | | | | | | | USB4 devices and Passive cables with USB4 speed that do not support Intel SVID should enter USB4 mode with cable speed to TBT Gen2 passive cable or board's max TBT speed, whichever is lower. Ref:USB Type-C cable and connector specification 2.0 Figure 5-1 USB4 Discovery and Entry Flow model BUG=b:154308721 BRANCH=None TEST=Able to enter USB4 mode with Passive Gen2 cables Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: Ib6e4463f2ed0682cee14a84e5d1d9560e286bd37 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2159938 Reviewed-by: Keith Short <keithshort@chromium.org> Tested-by: Ayushee Shah <ayushee.shah@intel.corp-partner.google.com>
* TCPMv2: Send VDM version according to PD rev setDiana Z2020-04-081-2/+2
| | | | | | | | | | | | | | | | | Sets the VDM version field according to the PD revision being used for the port and type. Also removes the pd_get_rev() declaration from the usb_pd header as it's only used in the TCPMv1 protocol file. BRANCH=None BUG=b:150784275 TEST=on kindred with TCPMv2, confirm VMDs sent to PD 3.0 partner are versioned as VDM 2.0 and PD 2.0 partner is versioned as VDM 1.0. Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ibff3f020ecf494773da7038c59d50667cd40bfa7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2136904 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* PD: Move pd_discovery init out of dfp_consume_identityDiana Z2020-04-071-0/+2
| | | | | | | | | | | | | | | | | | | | | Moves initialization of pd_discovery from dfp_consume_identity in order to support folding the cable identity into the pd_discovery structure (the cable discovery may or may not precede partner discovery). Also removes a cable structure reset which would clear the cable during a power role swap, and unnecessary references to the TCPMv1 message ID trackers which are a part of the PRL in TCPMv2. BRANCH=None BUG=b:152417977 TEST=on kindred with TCPMv2, ensure discovery information is cleared when unpluggging discovered partner and inserting one with no discover identity response Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I646b3796704fb6980c64d1b9c60327abee19e371 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2130474 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* PD: Rename pd_policy to pd_discoveryDiana Z2020-04-071-9/+9
| | | | | | | | | | | | | | Rename struct pd_policy to struct pd_discovery to more accurately reflect what the structure contains. BRANCH=None BUG=b:152417977 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I51de48103053aa60b3cdb15cf9fbf15dd75d727a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2130473 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* tcpmv2: move function from TC layer to PEJett Rink2020-04-031-6/+0
| | | | | | | | | | | | | | | | | | | | | - Move pd_ function that belong in PE layer to PE layer. Remove the extra pe_ layer. - Remove unnecessary PE and Vconn ifdef guards in TC layer - Remove unused print_dev_info function - Move host commands in TC layer to host command file - Move RW hash stuff from TC to PE, since this only has to do with VDO (Which is a PE layer thing) - Removed dependency for tc_drp test on usbc_fake as we don't really need it anymore once we don't pull in the PRL and PE layers anymore (based on previously landed CLs) BRANCH=none BUG=b:153071799 TEST=everything still builds and passes tests Change-Id: Id1d1efa291c3525f57bc26af9fddda6ddace1b58 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2132871
* usb_pd: Move cable communication functions to common fileAyushee2020-03-271-37/+0
| | | | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=Verified on TCPMV1 and TCPMv2, able to get correct cable characteristics. Change-Id: I812b21c87661952bf4e86acaa194d4b136371594 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2051628 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
* common/system: Unify ec_current_image and system_image_copy_tTom Hughes2020-02-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "enum ec_current_image" is exposed in ec_commands.h (and used by non-EC code, such as biod). We also have an "enum system_image_copy_t" that is the exact same thing (though has a few more definitions). A followup CL (I714b6bd8c0d7192386404c25a831e38438fa5238) adds the "sysinfo" host command, so we want to be able to expose all the potential image variants. Rather than maintain two enums that can potentially get out of sync, unify the code to use a single enum. We choose to keep the "enum ec_current_image", since external code depends on it. To verify that this change results in no changes to the generated binaries: ./util/compare_build.sh --board all BRANCH=none BUG=b:146447208 TEST=./util/compare_build.sh --board=all Change-Id: I13776bc3fd6e6ad635980476a35571c52b1767ac Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2036599 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* TCPMv1/v2: Move pd_process_source_cap() to common fileVijay Hiremath2020-02-121-23/+6
| | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: I6bd6b5875a322ca4ba6d77a4cfc96a72630e5f5c Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2051220 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1/v2: Move pd_get/set_max_voltage() to common fileVijay Hiremath2020-02-121-13/+0
| | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: I6fd4c870b8821a2393c67fda7003583b91ef7f5c Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2051218 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1/v2: Move pd_charge_from_device() to common fileVijay Hiremath2020-02-121-11/+0
| | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: I2327ceaf6be76a0428981106aaeb3ffbb2018049 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2051217 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1/v2: Move pd_set_vbus_discharge() to common fileVijay Hiremath2020-02-121-25/+0
| | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: Id7b0d10396300c4bd5b8253b7ce77c1fe59c9bc8 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2051216 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1/v2: Move pd_check_requested_voltage() to common fileVijay Hiremath2020-02-121-45/+0
| | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: I5ba854552b5c6124e3c6758273651edc0e3c23ae Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2051214 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1/v2: Move pd_usb_billboard_deferred() to common fileVijay Hiremath2020-02-121-17/+0
| | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: I92e7ed06a610126ff80ec91047962e3e9ba2cde1 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2051215 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1/v2: Move "pdcable" console command to common fileVijay Hiremath2020-02-071-96/+8
| | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: I7f78efeb74536d5d6c5dd0b4bd5f32325c1500ec Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2036604 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1/v2: Move "pe" console command to common fileVijay Hiremath2020-02-041-68/+0
| | | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: I71c8d491014a69ec938fa1172eee7b5322572654 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2032726 Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
* TCPMv1/v2: Move DFP alternate mode functions to common fileVijay Hiremath2020-02-041-37/+0
| | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: I34bf543b381fc9e4f858a48d3d1568de42438509 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2032725 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1/v2: Move dfp_discover_modes() to common fileVijay Hiremath2020-02-041-9/+0
| | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: I83c6dca9652a9c613849b292b4c2329da3f9d424 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2032161 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1/v2: Move dfp_consume_modes() to common fileVijay Hiremath2020-02-041-14/+0
| | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: I0a587a68b5c814595d78905f1cdd611f710f2182 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2032160 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1/v2: Move dfp_consume_svids() to common fileVijay Hiremath2020-02-041-38/+0
| | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: I3ba96a803fa68d800a3ca41b4ac31e43325c0266 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2032159 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1/v2: Move dfp_consume_identity() to common fileVijay Hiremath2020-02-041-27/+0
| | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: I5b0bbd553cbe4fc76478b1c89b0f3f391f074a27 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2032158 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1/v2: Move pd_dfp_exit_mode() to common fileVijay Hiremath2020-02-041-70/+0
| | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: I9d6a219ae031ed9954819c12563867e07bcc8668 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2032157 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1/v2: Move pd_dfp_enter_mode() to common fileVijay Hiremath2020-02-041-78/+4
| | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: Id1d3e8bc27d895a53b53a77cf1c8fd36c69b47dc Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2032156 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1/v2: Move pd_dfp_dp_get_pin_mode() to common fileVijay Hiremath2020-02-041-51/+0
| | | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: I9192762e7eba55d659d1ad282e62ad3849e41b65 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2032155 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* usb_pd TCPMv1: Maintain independent MessageId for SOP''Ayushee2020-02-031-15/+20
| | | | | | | | | | | | | | | | | | | This patchset enables checking and storaging the MessageId counter received from the SOP'' messages. Since SOP*(Cable) communication and SOP(Port Partner) have separate MessageID counters, it is necessary to store separate messageIDs to avoid the the incoming packets from getting dropped. BUG=b:148481858 BRANCH=None TEST=Tested on Volteer, able to maintain separate MessageId count for SOP, SOP' and SOP'' communication. Change-Id: Id3a29594c5f9b354ecb650c6d351b16883d2126b Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2032344 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1: Add support for Thunderbolt active cablesAyushee2020-01-311-21/+66
| | | | | | | | | | | | | | | | | | | | | | | | For entering into Thunderbolt-Compatible mode with active cable, the port sends Enter mode command for SOP', SOP'' (if the cable has a SOP'' controller) and SOP respectively. If the port doesn't receive GoodCRC from Enter Mode SOP'', the port resets the cable characteristic and exits the Thunderbolt-Compatible mode discovery. This CL enables SOP'' communication with the cable plug and adds support to enter into Thunderbolt-compatible mode with active cables. BUG=b:140643923 BRANCH=None TEST=Able to enter into Thunderbolt-Compatible mode for active cables. Change-Id: Iea0c652043933047e0158265c911775d4afe5758 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2001938 Reviewed-by: Diana Z <dzigterman@chromium.org>
* usb_pd TCPMv1: Maintain independent MessageID for SOP PrimeAyushee2020-01-311-9/+38
| | | | | | | | | | | | | | | | | | | This patchset enables storage of MessageId counter received from the cable plug. Since SOP*(Cable) communication and SOP(Port Partner) have separate MessageID counters, it is necessary to store separate messageIDs to avoid the the incoming packets from getting dropped. BUG=b:148481858 BRANCH=None TEST=Tested on Volteer, able to maintain separate MessageId count for SOP and SOP' communication. Change-Id: Iac2dc616f99a9e19914588e59441df8b09068afa Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2026650 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1: Add support for USB4.0Ayushee Shah2020-01-311-5/+268
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | USB4 is based on the Thunderbolt 3 protocol specification. It supports 40 Gbit/s throughput, is compatible with Thunderbolt 3, and backwards compatible with USB 3.2, USB 2.0. USB4.0 PD Flow: Ref: USB Type-C Cable and Connector Specification 2.0 Figure 5-1 USB4 Discovery and Entry Flow Model USB PD Explicit Contract Discover ID SOP -------- USB4 compatible? | -------------yes------------|------No----- Exit USB4 Discovery | Discover ID SOP' --------- Product type | Passive cable----------|----Active Cable---USB4? | | | (Not implemented in this CL) USB Signaling ----------------------- | | | | USB4 with USB4 active cable Exit USB4 | Discovery --------------------------------------------- | | | | USB4 Gen3 USB3.2 Gen2 USB3.2 Gen1 USB2.0 | | | | Enter USB4 with | Enter USB4 with Exit USB4 Discovery USB4 Gen3 | USB4 Gen1 Passive cable | Passive cable | DFP Gen3 capable? | ------yes---- |---------No-------- | | Discover SVID SOP Enter USB4 with USB3.2 Gen2 Passive Cable | Discover SVID SOP' | Discover Mode SOP | Discover Mode SOP' --------Is TBT3? | -----yes----|-----No---- | | Enter USB4 with TBT3 Enter USB4 with TBT Gen3 passive cable Gen2 passive cable BUG=b:140819518 BRANCH=None TEST=With Gatkex creek 3 device, TGLRVP can enter to USB4.0 mode Change-Id: Id861661c66c53a0a32679388bb7e2e81aae3ceb5 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1926382 Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv1: Cleanup sending TBT control flags to hostVijay Hiremath2020-01-291-4/+4
| | | | | | | | | | | BUG=b:148114593 BRANCH=none TEST=tested on Volteer, able to get correct TBT control flags Change-Id: If673d4a194d3cc6b9579f0f32511c6363f2614f3 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2013825 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1/v2: Move EC_CMD_USB_PD_GET_AMODE host command to common fileVijay Hiremath2020-01-281-41/+23
| | | | | | | | | | | | BUG=b:142911453 BRANCH=none TEST=make buildall -j Change-Id: I0b9cb76adbc5e385cb20256f693bd2b0687b30de Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2024428 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* TCPMv1/v2: Move EC_CMD_USB_PD_DISCOVERY host command to common fileVijay Hiremath2020-01-281-21/+5
| | | | | | | | | | | | BUG=b:142911453 BRANCH=none TEST=make buildall -j Change-Id: Ia2ad22669a908e9b9c23c4b73e97872399049e75 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2024427 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>