summaryrefslogtreecommitdiff
path: root/board/servo_v4
Commit message (Collapse)AuthorAgeFilesLines
* ServoV4/V4p1: Change CCD detection flowEric Herrmann2020-08-261-25/+25
| | | | | | | | | | | | | | | | | | | | | Currently, servoV4 and servoV4p1 don't apply terminations to SBU when searching for a DUT. This means SBU can float which can break the SBU voltage detection. Technically, the DUT should only need to pull up D+ and can float D- since it is a FS USB2 device when in CCD mode. Change the detection to connect SBU to the USB2 hub on servoV4/4p1. The USB2 hub will apply 15k pulldowns to the USB lines, which will pull SBU down and fix detection in the case where the DUT floats SBU. BUG=b:161762948, b:150886157, b:151487379 TEST=make BOARD=servo_v4; make BOARD=servo_v4p1 TEST=check that CCD works on DUT without pulldown resistors on SBU BRANCH=none Change-Id: I9b6f620617fb0e270e35804704111afd3c606a3b Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2352439 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* servo_v4: optimize USB PD TX switchingVincent Palatin2020-08-111-55/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optimize the duration when switching the USB PD path to TX, in order to meet the PD spec tStartDive timing between when we start driving the line and the start of the preamble waveform. Try to decrease the number of operations on the GPIO registers which might be clocked slowly in order to achieve this, this includes abandoning the high level GPIO functions and writing directly the useful GPIO registers and knowing in advance between which modes we are switching. A few constant values in the GPIO registers for the TX path are now written in the pd_tx_init function. The current version uses the regular GPIO functions *but* it will glitch these GPIOs, we might want to switch to a lower level implementation and avoid the glitch. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=b:155202697 BRANCH=none TEST=make BOARD=servo_v4p1 TEST=probe TX_DATA on the scope and measure the duration before the preamble Change-Id: I84c8321ed9be045087e228a74f6e0ddb3f677d76 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2346804 Reviewed-by: Nitin Kolluru <nkolluru@google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com> Tested-by: Nitin Kolluru <nkolluru@google.com>
* servo: Increased stack sizes for servo_v4Brian J. Nemec2020-07-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Increased the stack sizes in servo_V4's console and power delivery tasks. The report from stack analysis: make BOARD=servo_v4 SECTION=RW analyzestack Task: HOOKS, Max size: 336 (112 + 224), Allocated size: 768 Task: CONSOLE, Max size: 664 (440 + 224), Allocated size: 768 Task: PD_C0, Max size: 1136 (912 + 224), Allocated size: 1184 Task: PD_C1, Max size: 1136 (912 + 224), Allocated size: 1184 BUG=b:156476618 BRANCH=servo TEST=make -j BOARD=servo_v4 TESt=make BOARD=servo_v4 SECTION=RW analyzestack Signed-off-by: Brian Nemec <bnemec@chromium.org> Change-Id: Id313b02616441e4cc438e76ec01bf84c598bd4e6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2271011 Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
* TCPMv2: Support mode entry for SOP' and SOP''Abe Levkoy2020-06-112-4/+4
| | | | | | | | | | | | | | | | | | | | | | 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>
* servo_v4: clear SrcCap on CHG port disconnectedEric Yilun Lin2020-05-271-0/+8
| | | | | | | | | | | | | | | | | | | | | | | Currently, when CHG port's PD disconnected from the servo-v4, it still holds the SourceCap information. This CL clears the SourceCap when the PD disconnection event is found. BUG=b:157261654 TEST=plug charger: > ada_srccaps 0: 5000mV/3000mA 1: 9000mV/3000mA 2: 15000mV/3000mA 3: 20000mV/2250mA unplug charger: > ada_srccaps # print nothing. BRANCH=servo_v4 Change-Id: Ia91c97d6baa5e796c909893dac9abe0e6bc7ebad Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2215393 Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* servo_v4: use PD_PREFER_HIGH_VOLTAGE for PDO selection logicEric Yilun Lin2020-05-271-0/+9
| | | | | | | | | | | | | | | | | | | | Define PDO selection logic for SourceCap PDO collection. On a 45W PD charger, it might provide PDOs with 15V/3A and 20V/2.25A. In this case, pd_find_pdo_index() would always prefer 15V/3A rather than 20V/2.25A and such that the 20V PDO will be disappeared when servo-v4 advertise the SrcCap. We define PD_PREFER_HIGH_VOLTAGE so that all the PDOs could be advertised by servo-v4. BUG=b:147021699 TEST=plug treeya 45W charger, and see servo-v4 advertise 20V/2.25A PDO BRANCH=servo-v4 Change-Id: I3bd071161679bae98be17fd6b53a24e258d9c15c Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2215391 Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* Rename CONFIG_ macros to CONF_*Daisuke Nojiri2020-05-081-22/+22
| | | | | | | | | | | | | | | | | CONFIG_ name space is reserved for configuration macros, which all live in config.h. This patch renames the regular macros, which happened to be prefixed with CONFIG_, to avoid the presubmit errors. BUG=b/155996358 BRANCH=none TEST=buildall Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Ic87a23a34c7d36d65f210dd51fed109443ef71ce Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2189174 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: Add console commands to override the HPD pass-throughWai-Hong Tam2020-05-084-13/+68
| | | | | | | | | | | | | | | | | New console commands, like: > usbc_action dp hpd ext # use the external HPD, no overridden > usbc_action dp hpd h # override HPD to high, IRQ pass-through > usbc_action dp hpd l # override HPD to low, no IRQ pass-through > usbc_action dp hpd irq # send HPD IRQ BRANCH=servo BUG=b:153647984 TEST=Tried the new console commands. Change-Id: I197efd1d03d906b99d7b82ad151865da44e321ea Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2143937 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: Introduce console commands to config DP alt-modeWai-Hong Tam2020-05-082-40/+144
| | | | | | | | | | | | | | | | | | | | | New console commands, like: > usbc_action dp disable # disable DP alt-mode > usbc_action dp enable # enable DP alt-mode > usbc_action dp pins cde # support pin assignments C, D, and E > usbc_action dp pins cd # support pin assignments C and D > usbc_action dp pins d # support pin assignment D > usbc_action dp mf 1 # enable multi-function preference > usbc_action dp plug 1 # it is a plug > usbc_action dp plug 0 # it is a receptacle BRANCH=servo BUG=b:153647984 TEST=Tried the new console commands. Change-Id: I36744e772999f67f10189bc80dcec9f2b37123c2 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2143936 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: Monitor HPD and signal DUT over PD commWai-Hong Tam2020-05-012-5/+93
| | | | | | | | | | | | | | | | | | It monitors the HPD coming from the external monitor and generates the PD message to signal DUT for HPD high/low or HPD IRQ event. This monitoring logic is only enabled when CCD mode disabled. BRANCH=servo BUG=b:137219603 TEST=Configured to disable dts-mode, plugged a monitor, plugged the Type-C cable to DUT, tried pluging and unplugging the monitor working well. Change-Id: I6b3f9c635dc8d5907a16c3bd9cf203da94e64f7b Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1868925 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: Support DP alt-modeWai-Hong Tam2020-04-303-6/+210
| | | | | | | | | | | | | | | | | | | | | | | | | This is the initial change to support DP alt-mode, with some TODO items to make some settings more configurable for testing. DP alt-mode is only enabled when * servo v4 is configured dts-mode disabled, like through the command 'dut-control servo_v4_dts_mode:off', and * a monitor is plugged to the mini-DP port (for minimizing the impact to PD FAFT). The realtime HPD monitoring is the following patch. There is a bug (b/140900633) in servo v4 hardware that only 2-lane DP works. BRANCH=servo BUG=b:137219603 TEST=Configured to disable dts-mode, plugged the DP cable to monitor, plugged the Type-C cable to DUT, the external monitor worked. Change-Id: I129754afe1b13fe349d472de4ee6bcec3fd8b854 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1868924
* servo_v4: print PD-comm capability with cc commandEric Yilun Lin2020-03-031-0/+1
| | | | | | | | | | | | | | Support to print the PD-comm information for FAFT. BRANCH=servo BUG=b:150185455 TEST=ensure cc print the correct output at SNK/SRC roles Cq-Depend: chromium:2072543, chromium:2073423 Change-Id: Ia8c8a373eaab31a13f70e3422bf6dafcc27f92f1 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2072567 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* cleanup: move voltage rail detection to commonJett Rink2020-02-251-9/+0
| | | | | | | | | | | | | | Single source the VDD rail sagging reset interrupt Add VDD detection to C2D2 as well. BRANCH=servo BUG=none TEST=builds Change-Id: Iceac7d9fa7a9bde5a3c23c36e63b6d635d8812a3 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2064593 Reviewed-by: Diana Z <dzigterman@chromium.org>
* servo_v4: add command ada_srccaps to list adapter's SrcCapEric Yilun Lin2020-02-241-0/+18
| | | | | | | | | | | | | | | | | | | | | | Add the command for a new servod control. FAFT tests can be aware of the capability of the adapter on servo_v4. BUG=b:140256624 BRANCH=servo_v4 TEST=ensure the command print all the SrcCap > ada_srccaps 0: 5000mV/3000mA 1: 9000mV/3000mA 2: 10000mV/3000mA 3: 12000mV/3000mA 4: 15000mV/3000mA 5: 20000mV/3000mA Change-Id: I5d08240f87838267464a38fa09ab2ee59c7d4edf Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2055267 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* servo_v4/pd: support more source voltage to DUTEric Yilun Lin2020-02-241-3/+23
| | | | | | | | | | | | | | | | usbc_action support new subcommand chg which limits the max voltage of PDOs. Also, serov_v4 provides more PDOs to the DUT if the adapter supports it, besides 5, 12, 20V. BRANCH=servo_v4 BUG=b:140256624 TEST=see servo_v4 provides various kinds of SrcCap to DUT Change-Id: Ie33a4fcffe7dc2acbfc65e725c46e62a553f98c1 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2055266 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* TCPMV1/2: Make the PD Config Flags more consistentSam Hurst2020-02-221-0/+2
| | | | | | | | | | | | | | | | | | | | The current use of the PD Config Flags are a bit confusing and has been changed to the following: The CONFIG_USB_POWER_DELIVERY flag is used to enable and disable the TCPMv1 and TCPMv2 stacks. And when CONFIG_USB_POWER_DELIVERY is enabled, one of the following must be enabled: CONFIG_USB_PD_TCPMV1 - legacy power delivery state machine CONFIG_USB_PD_TCPMV2 - current power delivery state machine BUG=b:149993808 BRANCH=none TEST=make -j buildall Change-Id: Ie3f8615a75b15b4f1c703f57f3db9e152a471238 Signed-off-by: Sam Hurst <shurst@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2068519 Reviewed-by: Diana Z <dzigterman@chromium.org>
* Servo: Adds persistent storage of MAC addressBrian J. Nemec2020-02-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | Adds a field to the persistent storage to store the MAC address of the device. This is enabled on ServoV4 in order to store the MAC address for the integrated ethernet port. Added a console command to set and load this value. BUG=b:149506580 TEST=Verified setting and loading the MAC address using: 'macaddr set 12:34:56:78:90:ab' and 'macaddr' or 'macaddr load' Verified that MAC addresses over 19 characters long return an error response and not update the MAC. Verified no set serial number will return the uninitialized string. Verified that the MAC address can be updated independently of serialno Verified that the persist_state fields restore during firmware updates Change-Id: I8425ce9e13322e99a4f59df444ea0dc73821aa6b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2063330 Tested-by: Brian Nemec <bnemec@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Brian Nemec <bnemec@chromium.org>
* ServoMicro: Enable Brownout detection with PVD circuitBrian J. Nemec2020-01-182-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enables the programmable voltage detector (PVD) interrupt in ServoMicro. This interrupt fires when the supply voltage drops from the expected 3.3V to under 2.3V after power on. This gives several hundred microseconds of time for the device to respond to the power reduction. In order to ensure that the ServoMicro does not enter a non-responsive state, it triggers a reboot of the system to restore it to a good configuration. BRANCH=servo BUG=chromium:1023715 TEST=Configured GPIO output to trigger on pvd_interrupt() and verified the interrupt fires during the following situations using Saleae analyzer: * USB Power removed from working device * Ramping supply voltage from 1.5V to 5V with a DC supply * Repoducing failure condition from crbug/1016051 1 Connect ServoMicro to Cyan board 2 dut-control power_state:on 3 dut-control fw_wp_vref:pp3300 4 dut-control power_state:off 5 GPIO toggles and system reset occurs Change-Id: I721f48ab84b01d52a5f98747cc9d879ff2876a07 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1911759 Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Tested-by: Brian Nemec <bnemec@chromium.org> Commit-Queue: Brian Nemec <bnemec@chromium.org> Auto-Submit: Brian Nemec <bnemec@chromium.org>
* pd: cleanup pd_get_data_roleDenis Brockus2020-01-091-3/+7
| | | | | | | | | | | | | | | This is the second half of b/147290482 Cleaning up to use pd_data_role instead of int BUG=b:147314832 BRANCH=none TEST=make buildall -j Change-Id: I2445b06f5f5469fb1f3a968034a83e3ee792e7c7 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1991845 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* pd: cleanup pd_get_roleDenis Brockus2020-01-091-1/+3
| | | | | | | | | | | | | | | | | | pd_get_role in the TCPMv1 stack meant pd_get_power_role. pd_get_role in the TCPMv2 stack meant pd_get_data_role. This CL will clean that up and make them the correct naming. pd_get_power_role will also return an enum pd_power_role type instead of an int. BUG=b:147290482 BRANCH=none TEST=make buildall -j Change-Id: I73ee465401ccd050c2bd151f2fc043a59d95e079 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1991844 Reviewed-by: Jett Rink <jettrink@chromium.org>
* Revert "servo_v4: remove console command on ToT only"Brian Nemec2019-12-181-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 4fa4101b4b9114c13994326be689d74d36e50e68. Reason for revert: Link time optimization enabled to free up space on ToT in CL:1961149 . Original change's description: > servo_v4: remove console command on ToT only > > Servo v4 is under space pressure on Tot, but the actual branch is okay > for now. We release from the firmware branch so remove console commands > on ToT *only*. > > BRANCH=none > BUG=none > TEST=See ~1500K freed on RO and RW images on ToT. > > Change-Id: I8a49db7d4f00b0f5ca4ba4614fe62dccd7f928ee > Signed-off-by: Jett Rink <jettrink@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1940775 > Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> > Commit-Queue: Keith Short <keithshort@chromium.org> Bug: none TEST: Verified ServoV4 flashes successfully, manually tested connection to servod and dut-control commands. Change-Id: If9019b320b78f1af859e1e2370b3da8cae50449f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1971440 Tested-by: Brian Nemec <bnemec@chromium.org> Commit-Queue: Brian Nemec <bnemec@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* Servo: Enable LTO to improve flash spaceBrian J. Nemec2019-12-171-0/+2
| | | | | | | | | | | | | | | | | | | Enables LTO (Link Time Optimization) in order to improve flash space on ServoV4. Current builds have 48B remaining, the link time optimization frees up 6kB of space in the flash. Feature was enabled on ServoMicro and sweetberry. BRANCH=servo BUG=b:145512023 TEST=Manually tested flashing process to ensure they updated both regions, basic communication, and functionality on the following platforms: ServoV4, ServoMicro, and Sweetberry. Change-Id: I8f7a0d23478581c54a7379241a0290b897a635ea Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1961149 Tested-by: Brian Nemec <bnemec@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* usb_pd: Rename "Externally powered" to "Unconstrained Power"Benson Leung2019-12-121-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was changed in PD 2.0 years ago (via ECN authored by our own David Schneider), but our codebase still refers to BIT 27 of the Fixed PDO as "Externally powered" instead of "Unconstrained Power". This will search and replace all instances of "Externally powered" when it refers to BIT 27, as well as function names, other internal representations of that property, strings, and comments. seds: s/PD_FLAGS_PARTNER_EXTPOWER/PD_FLAGS_PARTNER_UNCONSTR/g s/partner_extpower/partner_unconstrained/g s/externally powered/unconstrained/g Some others too. Signed-off-by: Benson Leung <bleung@chromium.org> BUG=chromium:1030990 TEST=Codebase builds clean. No functional change, except for the property shows up in ectool as "Unconstrained power" now. Change-Id: I5ececa03f29eb31057be3d0ad5311117093bc6da Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1956147 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Benson Leung <bleung@google.com> Tested-by: Benson Leung <bleung@google.com>
* usb_pd_policy: Make a lot of objects commonAseda Aboagye2019-12-102-26/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a board specific usb_pd_policy.c file that contains a lot of code for handling DisplayPort Alternate mode, Google Firmware Update Alternate mode, as well as some PD policy functions such as deciding to Accept or Reject a data role swap or a power role swap. Several boards simply copy/paste this code from project to project as a lot of this functionality is not actually board specific. This commit tries to refactor this by pulling the functions that are not mainly board specific into common code. The functions are made overridable such that boards that truly do require a different implementation may do so. Additionally, this consolidation changes the policy behaviour for some boards, but they should be for the better. Some examples include that data swaps are always allowed if we are a UFP (no system image requirement), power swaps are allowed to become a sink if we are no longer dual role (e.g. - in suspend), and DisplayPort Alternate Mode is not entered if the AP is off. In order to facilitate this refactor, a couple CONFIG_* options were introduced: - CONFIG_USB_PD_DP_HPD_GPIO /* HPD is sent to the GPU from the EC via a GPIO */ - CONFIG_USB_PD_CUSTOM_VDO /* * Define this if a board needs custom SNK and/or SRC PDOs. * * The default SRC PDO is a fixed 5V/1.5A with PDO_FIXED_FLAGS indicating * Dual-Role power, USB Communication Capable, and Dual-Role data. * * The default SNK PDOs are: * - Fixed 5V/500mA with the same PDO_FIXED_FLAGS * - Variable (non-battery) min 4.75V, max PD_MAX_VOLTAGE_MV, * operational current PD_MAX_CURRENT_MA, * - Battery min 4.75V, max PD_MAX_VOLTAGE_MV, operational power * PD_OPERATING_POWER_MW */ BUG=chromium:1021724,b:141458448 BRANCH=<as many as we can that are still supported> TEST=`make -j buildall` TEST=Flash a kohaku, verify that DP Alt Mode still works with a variety of DP peripherals TEST=Repeat above with a nocturne TEST=Repeat above with an atlas Change-Id: I18fd7e22dc77fe1dc6c21c38cd7f1bc53cae86cb Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1949052 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: remove console command on ToT onlyJett Rink2019-12-041-0/+4
| | | | | | | | | | | | | | | | Servo v4 is under space pressure on Tot, but the actual branch is okay for now. We release from the firmware branch so remove console commands on ToT *only*. BRANCH=none BUG=none TEST=See ~1500K freed on RO and RW images on ToT. Change-Id: I8a49db7d4f00b0f5ca4ba4614fe62dccd7f928ee Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1940775 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* servo_v4: Use the correct voltage threshold on the flipped CC directionWai-Hong Tam2019-11-061-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the DTS mode, servo pulls up CC lines with different Rp values. When detecting DUT Rd value, servo senses the CC voltage values, and checks it using some table of voltage thresholds. The tables assume CC1 is the primary CC and CC2 is the alternative CC. When servo emulates the flipped CC scenario, should use the correct colume to check the voltage thresholds. BRANCH=servo BUG=b:136014621, b:140876537 TEST=Configed servo to emulate the flipped scenario in dts mode: > cc srcdts cc2 Verified it detect the correct Rd values in DUT (CC0 and CC1 are 2, i.e. TYPEC_CC_VOLT_RD): > tcpc 1 state Port C1, Ena - CC:1, CC0:2, CC1:2 Alert: 0x00 Mask: 0x007d Power Status: 0x48 Mask: 0x00 Without this patch, it detected wrong Rd values in DUT (CC0 is 2, i.e. TYPEC_CC_VOLT_RD, but CC1 is 0, i.e. TYPEC_CC_VOLT_OPEN): > tcpc 1 state Port C1, Ena - CC:1, CC0:2, CC1:0 Alert: 0x00 Mask: 0x007d Power Status: 0x48 Mask: 0x00 Change-Id: Iaf089356230f24f871636956780cb5652fec5c42 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1876800 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: The polarity is based on the flags in SRC DTS modeWai-Hong Tam2019-11-021-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the port in SRC DTS mode, it should not perform the polarity detection. The polarity is predetermined, as a board-specific setting. In the servo case, the polarity is based on the flags. This CL changes the protocol layer to check the port in SRC DTS mode and call the board-specific function board_get_src_dts_polarity() for the polarity. BRANCH=servo BUG=b:140876537 TEST=Configed servo as srcdts and unflipped direction: > cc srcdts cc2 Verified the power negotiation good and detected the correct polarity: > pd 1 state Port C1 CC2, Ena - Role: SRC-UFP State: SRC_READY, Flags: 0x415e Without this patch, it detected the wrong polarity and the power negotiation failed: > pd 1 state Port C1 CC1, Ena - Role: SRC-DFP State: SRC_DISCOVERY, Flags: 0x10608 Change-Id: I32c5dfffeaeb20a21db1417f3a1c98566b7f5e38 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1891255 Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Sean Abraham <seanabraham@chromium.org>
* Rename CONFIG_USB_PD_PORT_COUNT as CONFIG_USB_PD_PORT_MAX_COUNTKarthikeyan Ramasubramanian2019-11-012-2/+2
| | | | | | | | | | | | | | | | | Certain SKUs of certain boards have lesser number of USB PD ports than defined by CONFIG_USB_PD_PORT_COUNT. Hence rename CONFIG_USB_PD_PORT_COUNT as CONFIG_USB_PD_PORT_MAX_COUNT. BUG=b:140816510, b:143196487 BRANCH=octopus TEST=make -j buildall; Boot to ChromeOS Change-Id: I7c33b27150730a1a3b5813b7b4a72fd24ab73c6a Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1879337 Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
* servo_v4: Disable CCD (monitoring SBU) when DTS-mode disabled by a userWai-Hong Tam2019-09-282-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | The SBU monitoring logic is used for muxing the correct polarity for CCD. If the DTS-mode is disabled by a user, meaning that CCD is supposed not being used, the SBU monitoring logic can be disabled. For DP alt-mode, the SBU lines are used for AUX channel. This SBU monitoring logic affects the AUX channel, due to the strong pull-up on the USB D+ line. It should be disabled. Remove the original calls of ccd_enable(), which is called when supplying power and detecting DUT Rd/Rd or Rp/Rp. This requires PD comm. We don't want CCD depends on PD comm. BRANCH=servo BUG=b:137219603 TEST=The default role "cc srcdts", CCD works on both phyical polarity. TEST=Called "cc src", checked GPIO SBU_MUX_EN 0. Change-Id: I8f2f7bda88426e6097f0f4efd811114b7a1135c3 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1815557 Reviewed-by: Nick Sanders <nsanders@chromium.org>
* servo_v4: Disable some features to save spaceWai-Hong Tam2019-09-101-0/+2
| | | | | | | | | | | | | | No room left in the flash for the ToT firmware. Remove some features to save space. BRANCH=servo BUG=b:1002121 TEST=Built the servo v4 firmware, 560 bytes in flash available. Change-Id: I26aeea9cad155085bac7a349b6242d1f2958112f Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1795926 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* pd: USB Power Delivery State Machine based on Revision 3.0 of the spec.Sam Hurst2019-09-101-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds Power Delivery to the TypeC state machine as detailed in Revision 3.0, Version 1.2 of the specification. This CL passes the PD2.0 compliance tests and has been tested on several devices. Some areas such as handling Electronically Marked Cable information, creation of PIDs, and Host commands will be addressed in later CLs. BUG=b:130895206 BRANCH=none TEST=manual Port 0 on Hatch was used to run this CL, merged with PD functionality, on the PD2.0 Compliance tester. All tests pass except for a few physical layer tests. The test report has been added to the bug. Atlas was verified to work with Apple, Amazon, StarTech, MKDGO and several other generic docks. Atlas was verified to work with Google's and Apple's CTVPD. Signed-off-by: Sam Hurst <shurst@chromium.org> Change-Id: Ia5e1988b0d81ec4cf9a7175e273197bd5a0865e4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1737899 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Tested-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* servo_v4: Be a sink without PD comm when power charge-through detachedWai-Hong Tam2019-08-261-4/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL changes the behavior of no charge-through happens but a user explicitly sets servo v4 as a source. It is changed from "sink with PD comm" to "sink without PD comm". BRANCH=servo BUG=b:138585164, b:135035317 TEST=Manual as the following console interaction: (Plug the power cable back to servo v4) > cc src > pd 1 state Port C1 CC1, Ena - Role: SRC-UFP State: SRC_READY, Flags: 0x415e > cc snk > pd 1 state Port C1 CC1, Dis - Role: SNK-UFP State: SNK_DISCOVERY, Flags: 0x0608 > cc pdsnk > pd 1 state Port C1 CC1, Ena - Role: SNK-UFP State: SNK_READY, Flags: 0x414e > cc src > pd 1 state Port C1 CC1, Ena - Role: SRC-UFP State: SRC_READY, Flags: 0x415e (Unplug the power cable from servo v4) > pd 1 state Port C1 CC1, Dis - Role: SNK-UFP State: SNK_DISCOVERY, Flags: 0x0608 (Plug the power cable back to servo v4) > pd 1 state Port C1 CC1, Ena - Role: SRC-UFP State: SRC_READY, Flags: 0x415e > cc pdsnk > pd 1 state Port C1 CC1, Ena - Role: SNK-UFP State: SNK_READY, Flags: 0x414e (Unplug the power cable from servo v4) > pd 1 state Port C1 CC1, Ena - Role: SNK-UFP State: SNK_READY, Flags: 0x414e (Plug the power cable back to servo v4) > pd 1 state Port C1 CC1, Ena - Role: SNK-UFP State: SNK_READY, Flags: 0x414e > cc snk > pd 1 state Port C1 CC1, Dis - Role: SNK-UFP State: SNK_DISCOVERY, Flags: 0x0608 (Unplug the power cable from servo v4) > pd 1 state Port C1 CC1, Dis - Role: SNK-UFP State: SNK_DISCOVERY, Flags: 0x0608 (Plug the power cable back to servo v4) > pd 1 state Port C1 CC1, Dis - Role: SNK-UFP State: SNK_DISCOVERY, Flags: 0x0608 Change-Id: Ia4b6f858a4b0e22d81efbff02df4d02f3dc04bc9 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1724933 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: Support changing CC polarityWai-Hong Tam2019-07-222-37/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support an argument pol0/pol1 to the console command to change the CC polarity. When CC polarity change, apply the Rd/Rp to the proper CC line and fake the proper CC voltage. BRANCH=servo BUG=b:136014621 TEST=Tried the console commands: * Typed "cc src pol0" on servo v4 and checked DUT detected CC1: Port C0 CC1, Ena - Role: SNK-DFP State: SNK_READY, Flags: 0x4946 * Typed "cc src pol1" on servo v4 and checked DUT detected CC2: Port C0 CC2, Ena - Role: SNK-DFP State: SNK_READY, Flags: 0x4946 * Typed "cc snk pol0" on servo v4 and checked DUT detected CC1: Port C0 CC1, Ena - Role: SRC-DFP-VC State: SRC_DISCOVERY, Flags: 0x1608 * Typed "cc snk pol1" on servo v4 and checked DUT detected CC2: Port C0 CC2, Ena - Role: SRC-DFP-VC State: SRC_DISCOVERY, Flags: 0x1608 * Typed "cc srcdts pol0" on servo v4 and checked DUT detected CC1: Port C0 CC1, Ena - Role: SNK-DFP State: SNK_READY, Flags: 0x14946 * Typed "cc srcdts pol1" on servo v4 but resulted some hard reset issue during PD negotiation; need further investigation. Port C0 CC2, Ena - Role: SNK-UFP State: SNK_DISCOVERY, Flags: 0x10608 TEST=Ran the entire PD FAFT suite passed on both CC polarities. Change-Id: I7f983179b13e87a219bd26fe3665446df36de86e Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1693843 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: Support command to limit the max_voltageWai-Hong Tam2019-07-221-3/+25
| | | | | | | | | | | | | | | | firmware_PDVbusRequest forces servo v4 to different max_voltage limits to verify the PD negotiation. Add the firmware support for it. The console command usbc_action is the same as Plankton. So the test side doesn't need any change. BRANCH=servo BUG=b:134700685 TEST=Tried usbc_action command and ran firmware_PDVbusRequest passed. Change-Id: I5f05d73d9a2f92fe26514285e7c251e9fa27aba8 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1686221 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Remove __7b, __8b and __7bfDenis Brockus2019-07-201-9/+9
| | | | | | | | | | | | | | | | | | | The extentions were added to make the compiler perform most of the verification that the conversion was being done correctly to remove 8bit addressing as the standard I2C/SPI address type. Now that the compiler has verified the code, the extra extentions are being removed BUG=chromium:971296 BRANCH=none TEST=make buildall -j TEST=verify sensor functionality on arcada_ish Change-Id: I36894f8bb9daefb5b31b5e91577708f6f9af2a4f Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704792 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* servo_v4: Support sink roles with PD comm enabledWai-Hong Tam2019-07-202-2/+25
| | | | | | | | | | | | | | | | | For the normal lab use, emulating a sink has no PD comm, like a passive hub. For the PD FAFT use, we need to validate some PD behavior, should support sink roles with PD comm enabled. Two new roles "pdsnk" and "pdsnkdts" are introduced. BRANCH=servo BUG=b:134700685 TEST=Typed "cc pdsnk" or "cc pdsnkdts" can transit the DUT port to the PD state "SNK_READY", instead "SNK_DISCOVERY". Change-Id: If6a7c39cd296986b8b28de1c1fbe66ee8438c709 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1682920 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: Support dual-role portWai-Hong Tam2019-07-202-79/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | Support a new flag to enable DRP. The do_cc() function becomes having 4 arguments. So change to merge them into a single cc_config with different bit masks. For the force_source or force_sink role, we explicitly set the the Rp or Rd resistors on CC lines. But for DRP role, the Rp/Rd toggling is controlled by the PD state machine. So don't set any CC pull resistor for DRP. Support an "on" option in "cc" command to restore the previous role before emulating detach. Add "usbc_action drp" to toggle the DRP state, which is compatible with Plankton. BRANCH=servo BUG=b:135691171 TEST=Ran the firmware_PDTrySrc test passed, and not break all the existing PD FAFT tests. Change-Id: I3b90611c9840f502e496c42f80354e7ee002f96e Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1682919 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: Minor update the PD policy and commentsWai-Hong Tam2019-07-201-9/+17
| | | | | | | | | | | | | | | | | | Update the PD policy and comments: * Only allow data role swap on DUT port; * Remove the dts mode condition to initiate a data role swap (not necessary to limit it to dts mode). BRANCH=servo BUG=b:135691171 TEST=Checked the CHG port is always UFP. TEST=Checked the DUT port is SRC/UFP, a data role swap happened (but it was initiated by DUT). Change-Id: I668703209301a9542e94768f31f6ce8e2d9eb0f4 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1682918 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: Remove unnecessary init for GPIO MODULE_USB_PDWai-Hong Tam2019-07-202-7/+7
| | | | | | | | | | | | | | | | | | | | | The pd_config_init() does two things: * pd_tx_init() to init the GPIO MODULE_USB_PD; * pd_set_host_mode() to set CC pull resistors. The pd_config_init() is called on PD phy init hook. For setting CC pull resistors, calling pd_set_host_mode() is enough. Don't need to reinit GPIO MODULE_USB_PD. BRANCH=servo BUG=b:135691171 TEST=Set "cc" role to "src", "snk", "srcdts", "snkdts", and "off". TEST=Unplugged and replugged the CHG port cable. Change-Id: I1e783dfa5da4f8e8f1d9d591818eb1128b7a8caa Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1682917 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Use 7bit I2C/SPI slave addresses in ECDenis Brockus2019-07-191-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Opt for 7bit slave addresses in EC code. If 8bit is expected by a driver, make it local and show this in the naming. Use __7b, __7bf and __8b as name extensions for i2c/spi addresses used in the EC codebase. __7b indicates a 7bit address by itself. __7bf indicates a 7bit address with optional flags attached. __8b indicates a 8bit address by itself. Allow space for 10bit addresses, even though this is not currently being used by any of our attached devices. These extensions are for verification purposes only and will be removed in the last pass of this ticket. I want to make sure the variable names reflect the type to help eliminate future 7/8/7-flags confusion. BUG=chromium:971296 BRANCH=none TEST=make buildall -j Change-Id: I2fc3d1b52ce76184492b2aaff3060f486ca45f45 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1699893 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* servo_v4: Fake CC2 voltage when servo v4 as snkWai-Hong Tam2019-07-191-7/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In servo v4 hardware logic, both CC lines are wired directly to DUT. When servo v4 as a snk, DUT may source Vconn to CC2 and make the voltage high as vRd-3.0, which makes the PD state mess up. As the PD state machine doesn't handle this case. It assumes that CC2 is separated by a Type-C cable, resulting a voltage lower than the max of vRa. It fakes the voltage within vRa so the PD state machine checks the value as expected. This is an issue only happening on servo v4 as it wires both CC lines to DUT. BUG=b:134700685 BRANCH=servo TEST=Servo v4 as snk, verified the CC2 is sensed vRa, i.e. the output "CC1:0" (TYPEC_CC_VOLT_OPEN), instead of "CC1:7" (TYPEC_CC_VOLT_SNK_3_0). 2019-06-18 15:05:47 > cc snk 2019-06-18 15:05:50 cc: on 2019-06-18 15:05:50 dts mode: off 2019-06-18 15:05:50 chg mode: off 2019-06-18 15:05:50 chg allowed: off 2019-06-18 15:05:50 > C1 st2 SNK_DISCONNECTED 2019-06-18 15:05:50 C1 st3 SNK_DISCONNECTED_DEBOUNCE 2019-06-18 15:05:50 C1 st5 SNK_DISCOVERY 2019-06-18 15:05:51 > tcpc 1 state 2019-06-18 15:05:53 Port C1, Dis - CC:2, CC0:6, CC1:0 2019-06-18 15:05:53 Alert: 0x00 Mask: 0x007d 2019-06-18 15:05:53 Power Status: 0x48 Mask: 0x00 TEST=Ran the PD FAFT test firmware_PDConnect passed. Change-Id: I10f1ffe80768100ee3ed4c374598df7c2f9a8d05 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1666468 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: Remove the dts console commandWai-Hong Tam2019-06-211-26/+0
| | | | | | | | | | | | | | | | | | | | | | | Servod now uses the "cc" console command to change the dts mode. So no one uses the "dts" command. Remove it to save the flash space (128 bytes). BUG=b:131840808 BRANCH=servo TEST=Flashed the servo v4 firmware and started servod. Tried: $ dut-control servo_v4_dts_mode servo_v4_dts_mode:on $ dut-control servo_v4_dts_mode:off servo_v4_dts_mode servo_v4_dts_mode:off $ dut-control servo_v4_dts_mode:on servo_v4_dts_mode servo_v4_dts_mode:on Change-Id: I35778ff8975af35e623a9c9c70926264161cff3d Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1669742 Reviewed-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org> Commit-Queue: Jason Clinton <jclinton@chromium.org>
* servo_v4: Enable VBUS detection interrupts to wake PD tasks fast enoughWai-Hong Tam2019-06-182-3/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It fixes a hard reset issue. After a hard reset, the PD state goes to SNK_HARD_RESET_RECOVER state and waits for the VBUS "off" and then back "on" again. When the VBUS goes back to "on", it then transits to SNK_DISCOVERY state that replies the Source_Cap message. In order to make the VBUS detection fast enough, these interrupts are needed to wake the PD tasks up; otherwise, it missed the Source_Cap message BUG=b:134701032 BRANCH=servo TEST=Made servo v4 as sink and issued Hard_Reset on either DUT or servo. 2019-06-14 13:55:04 > cc snk 2019-06-14 13:55:06 cc: on 2019-06-14 13:55:06 dts mode: off 2019-06-14 13:55:06 chg mode: off 2019-06-14 13:55:06 chg allowed: off 2019-06-14 13:55:06 > C1 st3 SNK_DISCONNECTED_DEBOUNCE 2019-06-14 13:55:06 C1 st5 SNK_DISCOVERY 2019-06-14 13:55:06 C1 Req [1] 5000mV 3000mA 2019-06-14 13:55:06 C1 st6 SNK_REQUESTED 2019-06-14 13:55:06 C1 st7 SNK_TRANSITION 2019-06-14 13:55:06 C1 st8 SNK_READY 2019-06-14 13:55:07 2019-06-14 13:55:07 > pd 1 hard 2019-06-14 13:55:16 C1 st34 HARD_RESET_SEND 2019-06-14 13:55:16 > C1 st35 HARD_RESET_EXECUTE 2019-06-14 13:55:16 C1 HARD RST TX 2019-06-14 13:55:16 C1 st4 SNK_HARD_RESET_RECOVER 2019-06-14 13:55:16 Repeat msg_id[0] port[1] 2019-06-14 13:55:16 Repeat msg_id[0] port[1] 2019-06-14 13:55:16 Repeat msg_id[0] port[1] 2019-06-14 13:55:16 C1 st5 SNK_DISCOVERY 2019-06-14 13:55:16 Repeat msg_id[0] port[1] 2019-06-14 13:55:16 C1 HARD RST RX 2019-06-14 13:55:16 C1 st4 SNK_HARD_RESET_RECOVER 2019-06-14 13:55:17 C1 st5 SNK_DISCOVERY 2019-06-14 13:55:17 C1 Req [1] 5000mV 3000mA 2019-06-14 13:55:17 C1 st6 SNK_REQUESTED 2019-06-14 13:55:17 C1 st7 SNK_TRANSITION 2019-06-14 13:55:18 C1 st8 SNK_READY 2019-06-14 13:55:18 C1 Req [1] 5000mV 3000mA 2019-06-14 13:55:18 C1 st6 SNK_REQUESTED 2019-06-14 13:55:18 C1 st7 SNK_TRANSITION 2019-06-14 13:55:18 C1 st8 SNK_READY Issued "pd 0 hard" on DUT: 2019-06-14 13:56:07 > C1 HARD RST RX 2019-06-14 13:56:11 C1 st4 SNK_HARD_RESET_RECOVER 2019-06-14 13:56:12 C1 st5 SNK_DISCOVERY 2019-06-14 13:56:12 C1 Req [1] 5000mV 3000mA 2019-06-14 13:56:12 C1 st6 SNK_REQUESTED 2019-06-14 13:56:12 C1 st7 SNK_TRANSITION 2019-06-14 13:56:12 C1 st8 SNK_READY Change-Id: I0cc80515df8044ec07fa6795d3723aca2a3dc0ef Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1660125 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: Implement CC detach and fakedisconnect on servo v4Wai-Hong Tam2019-06-172-38/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The DUT may have multiple USB Type-C ports. In order to identify a pair of PD port partners, the PD FAFT tests asks one partner to emulate a detach and then checks the other partner if it sees a proper status. This requires to implement a CC detach on servo v4. A console command 'fakedisconnect' (similar to plankton) is introduced to disconnect for a given period and then connect back. BUG=b:131840808 BRANCH=servo TEST=Manuall tested the commands on servo v4 console to emulate detach. . > cc . cc: on . dts mode: on . chg mode: on . chg allowed: on . > pd 1 state . Port C1 CC1, Ena - Role: SRC-UFP State: 23(SRC_READY), Flags: 0x1415e . > cc off . cc: off . dts mode: on . chg mode: on . chg allowed: off . > pd 1 state . Port C1 CC1, Dis - Role: SNK-UFP State: 2(SNK_DISCONNECTED), . Flags: 0x0000 Checked the DUT EC console to verify the port status as detached. . > pd 0 state . Port C0 CC2, Ena - Role: SNK-DFP State: DRP_AUTO_TOGGLE, Flags: 0x0020 Made the servo v4 connect back. . > cc srcdts . cc: on . dts mode: on . chg mode: on . chg allowed: on . > pd 1 state . Port C1 CC1, Ena - Role: SRC-UFP State: 23(SRC_READY), Flags: 0x1415e Checked the DUT EC console to verify the port status as connected. . > pd 0 state . Port C0 CC2, Ena - Role: SNK-DFP State: SNK_READY, Flags: 0x14946 Typed 'fakedisconnect' command to disconnect for a period. . > fakedisconnect 1000 2000 . Fake disconnect for 2000 ms starting in 1000 ms. Verified DUT got disconnected and then connected back. Change-Id: Ie29cfd4f55ac48b593f71d580762ff5e77ee9602 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1603469 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Revert "servo_v4: Enable VBUS voltage and current measurement"Wai-Hong Tam2019-06-012-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 2fa7472da15a402ba8649344016ab5351cb768e7. Reason for revert: Use servo I2C driver to access the INA's instead. Don't need the INA driver and the console command in servo v4 firmware. Original change's description: > servo_v4: Enable VBUS voltage and current measurement > > Enable the INA functions on the VBUS of the DUT port (PP_DUT) and the > VBUS of the CHG port (PP_CHG). > > BUG=b:132807223 > BRANCH=servo > TEST=Typed the console command "ina 0" and returned: > > ina 0 > Configuration: 4127 > Shunt voltage: 10d9 => 10782 uV > Bus voltage : 3d3a => 19592 mV > Power : 069b => 42275 mW > Current : 086d => 2157 mA > Calibration : 0400 > Mask/Enable : 0008 > Alert limit : 0000 > > Used a multimeter to measure the VBUS on the DUT port. The measured > voltage and current are close to the above values. > > Did the same thing on the CHG port. > > Change-Id: I1d49540b4685f299437821251cd6422b1c0ac0b8 > Signed-off-by: Wai-Hong Tam <waihong@google.com> > Reviewed-on: https://chromium-review.googlesource.com/1613805 > Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> > Reviewed-by: Scott Collyer <scollyer@chromium.org> Bug: b:132807223 Change-Id: If8517ceb5255e38bb2824e6cb9fe1848142950c8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1638718 Reviewed-by: Wai-Hong Tam <waihong@google.com> Tested-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* servo_v4: Enable VBUS voltage and current measurementWai-Hong Tam2019-05-202-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable the INA functions on the VBUS of the DUT port (PP_DUT) and the VBUS of the CHG port (PP_CHG). BUG=b:132807223 BRANCH=servo TEST=Typed the console command "ina 0" and returned: > ina 0 Configuration: 4127 Shunt voltage: 10d9 => 10782 uV Bus voltage : 3d3a => 19592 mV Power : 069b => 42275 mW Current : 086d => 2157 mA Calibration : 0400 Mask/Enable : 0008 Alert limit : 0000 Used a multimeter to measure the VBUS on the DUT port. The measured voltage and current are close to the above values. Did the same thing on the CHG port. Change-Id: I1d49540b4685f299437821251cd6422b1c0ac0b8 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/1613805 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org>
* servo_v4: Disable syslock and flash commandsWai-Hong Tam2019-05-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | Servo_v4 is used as a testing equipment, not like a normal Chromebook. So we don't syslock the system and WP the flash. Disable these commands to save space. Before: 1136 bytes in flash and 2336 bytes in RAM available on RO After: 1712 bytes in flash and 2344 bytes in RAM available on RO BUG=b:131840808 BRANCH=servo TEST=Built and flashed the servo v4 firmware. Started servod and verified some functions. Change-Id: Ic84d48d984ae9abb1cbbb7b90aaece1f99d9d729 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/1613804 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org>
* servo_v4: Disable unused features to reduce spaceWai-Hong Tam2019-05-201-0/+3
| | | | | | | | | | | | | | | | | | | | | | The servo_v4 is almost out-of-space. Disable some unused features and console commands to reclaim some space. Before: 176 bytes in flash and 4392 bytes in RAM available on RO After: 1264 bytes in flash and 4400 bytes in RAM available on RO BUG=b:131840808 BRANCH=servo TEST=Built and flashed the servo v4 firmware. Started servod and verified some functions. Change-Id: Ic0e76794d0603fccc2f733cad388f54650d2cd45 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/1597959 Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
* servo_v4: fix in displaying CCD polarityNamyoon Woo2019-05-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From crrev.com/c/1529724, servo-v4 console displays the ccd polarity in opposite manner. 2019-05-15 11:53:59 [583.849805 CCD: connected noflip] 2019-05-15 11:54:01 adC 2019-05-15 11:54:01 CHG_CC1_PD = 1708 2019-05-15 11:54:01 CHG_CC2_PD = 33 2019-05-15 11:54:01 DUT_CC1_PD = 1637 2019-05-15 11:54:01 DUT_CC2_PD = 1625 2019-05-15 11:54:01 SBU1_DET = 3092 2019-05-15 11:54:01 SBU2_DET = 24 2019-05-15 11:54:01 SUB_C_REF = 569 2019-05-15 11:54:20 C1 st3 2019-05-15 11:54:20 C1 st5 2019-05-15 11:54:20 [604.585404 CCD: connected flip] 2019-05-15 11:54:23 adc 2019-05-15 11:54:24 CHG_CC1_PD = 1712 2019-05-15 11:54:24 CHG_CC2_PD = 32 2019-05-15 11:54:24 DUT_CC1_PD = 1616 2019-05-15 11:54:24 DUT_CC2_PD = 1644 2019-05-15 11:54:24 SBU1_DET = 20 2019-05-15 11:54:24 SBU2_DET = 2955 2019-05-15 11:54:24 SUB_C_REF = 611 BUG=None BRANCH=None TEST=manually build fw and checked. 2019-05-15 12:07:46 [27.057955 CCD: connected noflip] 2019-05-15 12:07:47 adc 2019-05-15 12:07:48 CHG_CC1_PD = 1705 2019-05-15 12:07:48 CHG_CC2_PD = 4 2019-05-15 12:07:48 DUT_CC1_PD = 1617 2019-05-15 12:07:48 DUT_CC2_PD = 1645 2019-05-15 12:07:48 SBU1_DET = 20 2019-05-15 12:07:48 SBU2_DET = 3102 2019-05-15 12:07:48 SUB_C_REF = 592 2019-05-15 12:08:05 [45.191161 CCD: connected flip] 2019-05-15 12:08:06 adc 2019-05-15 12:08:08 CHG_CC1_PD = 1704 2019-05-15 12:08:08 CHG_CC2_PD = 4 2019-05-15 12:08:08 DUT_CC1_PD = 1638 2019-05-15 12:08:08 DUT_CC2_PD = 1625 2019-05-15 12:08:08 SBU1_DET = 2970 2019-05-15 12:08:08 SBU2_DET = 23 2019-05-15 12:08:08 SUB_C_REF = 563 Change-Id: I0e8540fb30460827772fefd63a3426d67fa85092 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1613650 Reviewed-by: Nick Sanders <nsanders@chromium.org>
* servo_v4: Remove console command history.Aseda Aboagye2019-05-171-0/+1
| | | | | | | | | | | | | | | | | servo_v4 is tight on space, so remove the history console command to gain some space. BUG=None BRANCH=None TEST=make -j BOARD=servo_v4 Change-Id: Idba1b05335e31f655e98883abdd15000e6310c41 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/1613799 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org>