summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Swap system_jumped_to_this_image with system_jumped_latestabilize-quickfix-13310.91.B-masterstabilize-quickfix-13310.76.B-masterstabilize-quickfix-13310.73.B-masterstabilize-13310.99.B-masterstabilize-13310.94.B-masterstabilize-13310.83.B-masterstabilize-13310.74.B-masterstabilize-13310.72.B-masterrelease-R85-13310.B-masterDaisuke Nojiri2020-06-2633-42/+42
| | | | | | | | | | | | | | | | | | | | EFS2 boards need to call system_jumped_late in HOOK_INIT to avoid running init code twice per boot. system_jumped_to_this_image and system_jumped_late are functionally equivalent for non EFS2 boards. This patch will prevent system_jumped_to_this_image from being used for EFS2 boards when code is copied from a past project. BUG=chromium:1072743 BRANCH=none TEST=buildall Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I73fb5cedc5325d1c80825f9346954013046ee1df Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2267685 Reviewed-by: Keith Short <keithshort@chromium.org>
* Swap system_jumped_to_this_image with _late for common codeDaisuke Nojiri2020-06-265-6/+5
| | | | | | | | | | | | | | | | | EFS2 boards need to call system_jumped_late in HOOK_INIT to avoid running init code twice per boot. system_jumped_to_this_image and system_jumped_late are functionally equivalent for non EFS2 boards. BUG=chromium:1072743 BRANCH=none TEST=buildall Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Iecfd4f6d3e9d43cea535cfd503d6bcf7b79bc4fa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2267684 Reviewed-by: Keith Short <keithshort@chromium.org>
* EFS2: Ping cr50 beforehand in case it's asleepDaisuke Nojiri2020-06-261-0/+6
| | | | | | | | | | | | | | | | | | | | | | There are situations where EC resets while Cr50 is in sleep. In such cases, Cr50 doesn't get ready for ec-comm until EC talks to Cr50 thus EC may time out after 5 attempts. This patch makes EC toggle PACKET_MODE_EN proactively in case Cr50 is in sleep. BUG=b:158486465 BRANCH=none TEST=Shutdown Trembyle, hibernate EC, press power button. EC receives response from Cr50 without timeout. Change-Id: I02fcfdc00e2596d6ca6a7be4e0a8996654639984 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2264893 Reviewed-by: Eric Peers <epeers@google.com> Tested-by: Eric Peers <epeers@google.com> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* tcpmv1: string reductionKeith Short2020-06-261-12/+19
| | | | | | | | | | | | | | De-duplicate some output strings to reduce flash sizes. BUG=none BRANCH=none TEST=make buildall -j Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ide613f2641cdf7190603c37ab774121a4bd639ef Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2267680 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
* tcpmv2: Add delay when exiting low-power modeKeith Short2020-06-261-2/+25
| | | | | | | | | | | | | | | | | Adds a 25ms delay when exiting low power mode. Some TCPCs are slow to update the CC_STATUS register when exiting low power mode when a non-PD charger is connected. BUG=b:155364505 BRANCH=none TEST=make buildall TEST=connect 15W non-PD charger to Volteer C1 port. Verify charging starts. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I0d4514447799acd60ffbcd52a62bff8bffb58b42 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2259272 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: Clear VDM timeout flag in readyDiana Z2020-06-251-1/+2
| | | | | | | | | | | | | | | | The VDM timeout flag represents an issue within a single AMS and should therefore be cleared on return to the READY states. BRANCH=None BUG=None TEST=on zork, timeout on cable identity VDM doesn't effect future SOP identity calls Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ic065fbeeb9e1df88595bffbbbf6c3827e9bb17af Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2267628 Commit-Queue: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: Report message discard to the PEDiana Z2020-06-257-71/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | This commit creates a reporting function for the PRL to let the PE know when messages have been discarded. States will have to handle message discard internally since the response depends on the portion of the AMS sequence they're in. For some states which begin AMSes, a new shared parent has been added which runs the sender response timer and checks discard for the child. More states (and discard mid-AMS) are expected to be added in future CLs. The new parent state saves an average of 124 bytes of flash space. BRANCH=None BUG=b:158248741,b:157228506 TEST=on waddledoo, Dell dock no longer soft resets during power role swap Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I61b3e96e1d14634dcd5edda4e133968ace769b21 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2241577 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* common: Document flash_set_protect betterCraig Hesling2020-06-251-6/+33
| | | | | | | | | | | BRANCH=none BUG=none TEST=none Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I07967c32fd481f76385e65af8752c9f5c5d19d98 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2222691 Reviewed-by: Jett Rink <jettrink@chromium.org>
* volteer: Remove c10_gate_changeAbe Levkoy2020-06-251-3/+0
| | | | | | | | | | | | | | | This is unneeded, now that the EC doesn't need to control power sequencing. BUG=b:143375057 TEST=make buildall BRANCH=none Change-Id: I36d3ddefa5941d94b1549c1b8e1374bfa0d10b80 Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2267624 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* sn5s330: initialize chip after EFS2 sysjumpCaveh Jalali2020-06-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | this fixes an issue where the pcc was not fully initialized as intended due to EFS2 interactions. when EFS2 is enabled, we sysjump to RW very early - before INIT_HOOKS run. any code in pd_task that is predicated by system_jumped_to_this_image() will either always run or never run. this is not the intended behavior. sn5s330_init() is called from ppc_init() which runs as part of initialization done by pd_task(). we now need to check system_jumped_late() instead of system_jumped_to_this_image() to get the intended behavior. BRANCH=none BUG=b:159769490, chromium:1072743 TEST=verified all of sn5s330_init() now runs using additional debug printfs. Change-Id: I3a8e6627e6e57e22b287b3f97bc79b0f3a07e5fa Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2265608 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org> Tested-by: Keith Short <keithshort@chromium.org>
* isl9241: set current limit after EFS2 sysjumpCaveh Jalali2020-06-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | this fixes an issue where the charger current limit is not set as early as intended due to EFS2 interactions. when EFS2 is enabled, we sysjump to RW very early - before INIT_HOOKS run. any code in INIT_HOOK functions that is predicated by system_jumped_to_this_image() will either always run or never run. this is not the intended behavior. charger_chips_init() is called from INIT_HOOKS, and that's where we call isl9241_init(). we now need to check system_jumped_late() instead of system_jumped_to_this_image() to get the intended behavior. BRANCH=none BUG=b:159769490, chromium:1072743 TEST=isl9241_init now sets current limit to 512mA right after EFS2 sysjump (verified with additional debug printfs) Change-Id: I6de12d947ea9abb8e6db85dee0129a7053d0708c Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2265303 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org> Tested-by: Keith Short <keithshort@chromium.org>
* morphius: support aoz and nxp ppc by gpioZick Wei2020-06-253-19/+12
| | | | | | | | | | | | | BUG=b:156552519 BRANCH=none TEST=make buildall Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: I524684c6885cabe39d821081652ac8d016f0515c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2255828 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org> Tested-by: Edward Hill <ecgh@chromium.org>
* berknip/morphius: update gpio S0_PWROK_ODZick Wei2020-06-2510-28/+174
| | | | | | | | | | | | | | | This patch update S0_PWROK_OD for schematic change. BUG=b:150278507, b:152841287 BRANCH=none TEST=make buildall, verify EC code can power on rework MB. Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: Iaf8f2458c2dfe49f40eada8dced1febe2c4c4687 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2255826 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org> Tested-by: Edward Hill <ecgh@chromium.org>
* berknip: add HDMI_POWER_EN_DB to NCT3807Zick Wei2020-06-252-0/+19
| | | | | | | | | | | | | | The HDMI_POWER_EN_DB signal is set to power HDMI power rail. BUG=b:152841287 BRANCH=none TEST=make buildall Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: I3b5ba82a670bd4308fa5fda36b81697000d526bb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2260172 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org>
* berknip: remove mst/hdmi hpd functionZick Wei2020-06-252-56/+1
| | | | | | | | | | | | | | This CL remove mst/hdmi hpd function for schematic change. BUG=b:152841287 BRANCH=none TEST=make buildall Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: Ifffd43ca682e5bdec103f87b52ed38934640fc15 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2260092 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org>
* endeavour: gpios: move USB-C polarity to low-voltage pinJeff Chase2020-06-251-2/+1
| | | | | | | | | | | | | | | | The polarity signal is 1.8V so needs to be on a GPIO that supports low voltage. BUG=b:157236750 BRANCH=none TEST=build Change-Id: If125a43ad563ada348712fd6bca035d82723e830 Signed-off-by: Jeff Chase <jnchase@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2265305 Reviewed-by: Joe Tessler <jrt@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* usb_pd: Remove pd_cable usage from common codeAyushee2020-06-256-198/+156
| | | | | | | | | | | | | | | | | | | 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: Add some TODO bugs, fix indentAndrew McRae2020-06-252-4/+4
| | | | | | | | | | | | | | | | Add some TODO bugs, fix indents. BUG=b:159073520 TEST=Build all BRANCH=none Change-Id: Ic06450e50924bdcedd12829ba683cc6b3b308ae0 Signed-off-by: Andrew McRae <amcrae@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2264693 Tested-by: Andrew McRae <amcrae@chromium.org> Auto-Submit: Andrew McRae <amcrae@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* tcpm: Change the get_chip_info() to prevent race conditionsWai-Hong Tam2020-06-2512-50/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original get_chip_info() returns a point of point to the chip_info. This way helps to cache the chip_info to a static variable and the function just returns the pointer to the static variable. This static variable has a race condition on the PS8805 chip. The PS8805 chip returns a different PID when the firmware is corrupted, i.e. 0x8803 instead of 0x8805. The !live case fixes the PID, by modifying the static variable directly. When another task calls the same function for the live case, the static variable is modified and has a race condition. This change fixes the issue by changing the get_chip_info() parameter to a point of the chip_info. The caller has to allocate a buffer in the stack and pass the address to the function. For the !live case, the function copies the cache value from the static variable to the buffer. So the static variable doesn't have a race condition. BRANCH=None BUG=b:159588335 TEST=Used ectool to check the PD chip PID 0x8805 (was 0x8803). localhost ~ # ectool pdchipinfo 1 vendor_id: 0x1da0 product_id: 0x8805 device_id: 0x1 fw_version: 0x0 min_req_fw_version: 0x0 Change-Id: Ic24615af77ea58016d286480572d2a282c4fa09a Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2264477 Reviewed-by: Julius Werner <jwerner@chromium.org>
* TCPMV2: Add support for sending Alert MessagesSam Hurst2020-06-255-1/+86
| | | | | | | | | | | | | Add support for sending Alert OVC and OVP messages BRANCH=none BUG=b:117854867 TEST=make -j buildall Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: Ia436c8869880897ea9af0c2c2b0d6e9288831a8f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2229285 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4p1: Add USB3 routing to DUT or HOST functionalitySam Hurst2020-06-254-0/+106
| | | | | | | | | | | | | | This functionality is only available in RO and enables the USB3 ports A0 and A1 to be routed to the DUT or HOST. BRANCH=none BUG=b:146793000 TEST=make -j buildall Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I1fb11fcf918d3351094fd3e2f0553a3aa551f945 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2216403 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* volteer (board): Remove power sequencing supportAbe Levkoy2020-06-253-216/+0
| | | | | | | | | | | | | | | The board/AP can handle power sequencing without AP intervention. This support was already disabled by default in configuration. BUG=b:143375057,b:157609784 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I96a40530479a9916c13fc59355f253057a48a56b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2264482 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* volteer: Remove DisplayPort HPD GPIOsAbe Levkoy2020-06-251-4/+0
| | | | | | | | | | | | | | | This function is already handled by the AP's internal mux, and the GPIOs were already unused. BUG=b:157609784 TEST=make buildall BRANCH=none Change-Id: I2969ccbf9713d87ab24c9c1a87d917f01d303078 Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2264479 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* volteer: reset the TCPCs on EC resetCaveh Jalali2020-06-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | this fixes the ps8815 not being taken out of reset due to EFS2 interactions. when EFS2 is enabled, we sysjump to RW very early - before INIT_HOOKS run. any code in INIT_HOOK functions that is predicated by system_jumped_to_this_image() will either always run or never run. this is not the intended behavior. the solution is to use system_jumped_late() instead. BRANCH=none BUG=b:159769490 TEST=ps8815 no longer stays in reset after EFS2 sysjump Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I6c2048f5caad8eb790dab8a5b44fc55da92baa48 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2263092 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* tcpm: add attached_wait decision to common after auto-toggleDenis Brockus2020-06-245-24/+42
| | | | | | | | | | | | | | | | | | Need to verify auto toggle connections and non auto toggle connections still work. I will verify on trembyle BUG=b:159736927 BRANCH=none TEST=check basic functionality Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I378ddf520026591d8129986078875ce46f1e0ad8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2264472 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>
* test: Add flash_write_protect to default testsNicolas Boichat2020-06-241-1/+1
| | | | | | | | | | | BRANCH=none BUG=b:159496910 TEST=make BOARD=krane -j tests Change-Id: I2da037758cc1754ddad7ecab8f51b227cb631eac Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2256634 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* test/flash_write_protect: Handle different WP polarityNicolas Boichat2020-06-241-1/+11
| | | | | | | | | | | | | | Also handle the hard-coded case (mirrored from common/flash.c). BRANCH=none BUG=b:159571683 TEST=make BOARD=krane -j tests Change-Id: I0bbdb4b6cc86226f01653c5a2dad569b6282e5b4 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2256633 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* TCPMv2: Refactor DP mode to use a state machineAndrew McRae2020-06-246-60/+201
| | | | | | | | | | | | | | | | | | | | | | | Refactor the DP alt mode handling to use a state machine to process the commands, ACKs and NAKs. Also add states to handle detecting a NAK on a DP mode enter command, and attempt to exit the mode and then retry. When a partner enters alt mode (e.g a monitor with DP alt mode), and the EC is reset or goes into recovery mode, the new negotiation will fail because the command to enter alt mode when the partner is already in that mode will fail with a NAK. BUG=b:159073520 TEST=Tested on duffy with a type-C monitor. BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: I0b4506b17987ba71e51f019910db84b32a6da2c2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2256620 Reviewed-by: Andrew McRae <amcrae@chromium.org> Commit-Queue: Andrew McRae <amcrae@chromium.org> Tested-by: Andrew McRae <amcrae@chromium.org>
* ectool: motionsense: add commands for fast/manual offset compensationInno.Park2020-06-241-26/+77
| | | | | | | | | | | | | | | | - command 'calibrate' added for accel/gyro calibration - command 'offset' modified so that it can also set offset manually BUG=b:159557101 BRANCH=none TEST=build ectool and run following commands. 'ectool motionsense calibrate 2' 'ectool motionsense offset 2 -- -187 312 -62' Change-Id: I58d0920e0ed48145cad55587ee3ba125d6a5c175 Signed-off-by: Inno.Park <ih.yoo.park@samsung.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2256964 Reviewed-by: Jett Rink <jettrink@chromium.org>
* tcpci: debug cleanupDenis Brockus2020-06-241-8/+43
| | | | | | | | | | | | | | | | | | | | | | | DEBUG_GET_CC was already present to output CC information on every get_cc call. This CL adds in spam reduction to not continue to output the values if they are the same as they were the last time they were output. DEBUG_ROLE_CTRL_UPDATES was added to output RoleControl register information every time it is written in the TCPCI code. BUG=none BRANCH=none TEST=make buildall Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Ic6eeadce8813908f1b89e4b756e90e95b1f9ca01 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250093 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* tcpmv2: only enable AutoDischargeDisconnect when attachedDenis Brockus2020-06-246-343/+183
| | | | | | | | | | | | | | | | | | | | | | | | | | Connecting a non-PD charger the DUT performs a TRY switch to become SRC. During this TRY path the AutoDischargeDisconnect had been enabled and the fact the non-PD charger will never allow Vbus to drop to Safe0V causes the fault. AutoDischargeDisconnect should only be enabled when there is a known stable attach and when this stops being the case the feature should return back to disabled. Verified on Trembyle NCT3807 platform BUG=b:158751942 BRANCH=none TEST=verify try does not fault on 5V charger Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I9ab507a1bbc5b84948620b6174f946f07befde90 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250092 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* drawcia: enable USB-A power 5VDevin Lu2020-06-243-2/+11
| | | | | | | | | | | BUG=none BRANCH=none TEST=make sure USB-A port works. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: Ie22f7129932b26d2b47913c4a2e49450ded4d5c5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2260177 Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv2: Add RCH check to avoid RX packet dropsEric Herrmann2020-06-241-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | The chunked message RX state machine can take multiple cycles to process a PD message when the message is received while transmitting. If another message comes in during this, it can overwrite the current PD message since the RCH state machine is before the extended buffer to the PE. This CL checks to make sure the RCH state machine doesn't have a pending message before overwriting pdmsg. This issue only shows up when CONFIG_USB_PD_REV30 is set (since PD20 doesn't use chunked messages). It was seen during fast role swaps on multiple devices. A fast role swap will send an ACCEPT immediately followed by a PS_READY, and the ACCEPT was being dropped. BUG=b:148144711, b:159671235 TEST=make buildall TEST=with an FRS-capable device and host, make sure no packets are dropped in the swap. this is easy to see with PD debug level 2 BRANCH=none Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Change-Id: Ib86fd25a70b42cc14457bcec4261cdb9734fad63 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2259332 Reviewed-by: Jett Rink <jettrink@chromium.org>
* volteer: re-enable CONFIG_CMD_KEYBOARDKeith Short2020-06-231-1/+0
| | | | | | | | | | | | | | | | | CONFIG_CMD_KEYBOARD is needed by the FAFT tests. With this change Volteer still has 944 bytes RO and 772 bytes RW free with the TCPMv2 stack. BUG=b:158572770, b:159521752, b:159058351 BRANCH=none TEST=make buildall -j Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ieb85542e4eced938e509547b23ce130d6fd4e7bb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2261294 Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Jes Klinke <jbk@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* docs/fingerprint: Add instructions for toggling hardware write protectTom Hughes2020-06-231-0/+25
| | | | | | | | | | | | BRANCH=none BUG=none TEST=none Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ibd8fa4a504798860acb85ae8fc4c4383ee55337e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2190821 Reviewed-by: Craig Hesling <hesling@chromium.org> Commit-Queue: Craig Hesling <hesling@chromium.org>
* stm32: Enable rsa and rsa3 on-device unit testsYicheng Li2020-06-236-0/+12
| | | | | | | | | | | | | | | | | | | | BRANCH=none BUG=b:155235321 TEST=make BOARD=nucleo-dartmonkey tests -j TEST=make BOARD=bloonchipper tests -j TEST=make BOARD=dartmonkey tests -j TEST=make BOARD=nucleo-f412zg tests -j TEST=make BOARD=nucleo-h743zi tests -j TEST=flash rsa unit test binary to nucleo-f412zg, run test => pass TEST=flash rsa3 unit test binary to nucleo-f412zg, run test => pass TEST=flash rsa unit test binary to nucleo-h743zi, run test => pass TEST=flash rsa3 unit test binary to nucleo-h743zi, run test => pass Signed-off-by: Yicheng Li <yichengli@chromium.org> Change-Id: I2ebcf6f322f9c16aba65a3a627a0a83ca00d2a02 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2240516 Commit-Queue: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* tcpci: add 16-bit TCPC I2C accessorsCaveh Jalali2020-06-232-13/+21
| | | | | | | | | | | | | | | | this extends the TCPC I2C access API to provide 16-bit accessors for vendor specific pages of a TCPC. some TCPCs, like the ps8xxx series define registers in pages beyond the TCPCI definition for vendor specific functions. BRANCH=none BUG=b:158857815 TEST=buildall -j succeeds Change-Id: I115ab305317a0816e625718676b2bedfaa39e70d Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2254991 Reviewed-by: Keith Short <keithshort@chromium.org>
* include/chipset: Define dummy init_reset_log if no CHIPSET task.Nicolas Boichat2020-06-231-5/+7
| | | | | | | | | | | BRANCH=none BUG=b:159571683 TEST=make BOARD=krane -j tests Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Change-Id: I77212f0ff3215270c0e466f2220d64e267c18efb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2256632 Reviewed-by: Jett Rink <jettrink@chromium.org>
* include/power: Add dummy power_get_state if no CHIPSET taskNicolas Boichat2020-06-231-0/+6
| | | | | | | | | | | BRANCH=none BUG=b:159571683 TEST=make BOARD=krane -j tests Change-Id: I0484bbb5b6dcb0703aace88be59248968a662bb5 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2256631 Reviewed-by: Jett Rink <jettrink@chromium.org>
* asurada: enable config of CONFIG_IT83XX_RESET_PD_CONTRACT_IN_BRAMDino Li2020-06-231-0/+5
| | | | | | | | | | | | BUG=b:154670981 BRANCH=none TEST=Unplug type-c adapter, and plug it in: no soft reset occurred during negotiation. (no reboot continuously) Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: Ie18f9f9a75306242dc1cfa237521c82a4b44d0b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2259414 Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
* it83xx: add option to reset PD contract in power-on resetDino Li2020-06-232-0/+18
| | | | | | | | | | | | | | | | This CL allows to reset PD contract in power-on reset. It applies to situation of EC's VBAT won't go low when system's power isn't presented. BUG=b:154670981 BRANCH=none TEST=PD contract gets cleared when power-on reset even VBAT keeps high Change-Id: I2c8d185725542bb77fadfe6cb0497e0aace8aee2 Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2208343 Reviewed-by: Jett Rink <jettrink@chromium.org>
* Puff: Only reset TCPC on power-on restartAndrew McRae2020-06-231-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Reset the TCPC after a power-on restart, and clear any explicit PD contract so that the previous state is not restored. Even though Puff does not have BBRAM, the state is required for restarts so that PD can determine when power needs to be renegotiated explicitly through sending a soft reset, or not since the system is starting from a fresh connection. The impact was that a system powered from a type-C charger would not go into recovery since a restart assumed it was an initial charger connection (so no soft reset was sent), the wait for capabilities timed out, and a hard reset was sent, causing the charger to cycle power, and thereby skipping the recovery stage. BUG=b:159281839 TEST=Confirm that recovery can be entered using type-C charger. BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: Ibecf75e999ae5ff15580ce69c3a58a3c49930b48 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2251706 Tested-by: Andrew McRae <amcrae@chromium.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Commit-Queue: Andrew McRae <amcrae@chromium.org>
* TCPMv2: Do not reset negotiated PD revision level during soft resetPatryk Duda2020-06-234-12/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | PD3.0 6.2.1.1.5 Specification Revision clearly states that negotiated Specification Revision level should be used until Detach, Hard Reset or Error Recovery happens. Current implementation of soft reset performs full reinitialization of PRL state machines, flags, counters including negotiated Specification Revision level. As a result when sending PD_CTRL_SOFT_RESET DUT was waiting for SinkTxOk, but it was never observed because ServoV4 was running PD2.0 stack. This issue was fixed by separating parts of SM_INIT state which shouldn't be reset during soft reset. BUG=b:158996004 BRANCH=none TEST=Flash nocturne with firmware which contains fix. Make sure ServoV4 runs PD2.0 revision. Run firmware_PDResetSoft test, make sure that hard reset doesn't occur. Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I852817a63772dbc8baab74ff6b0c425228b2f49b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2246020 Reviewed-by: Jett Rink <jettrink@chromium.org>
* fuzz: Fix varargs/printf with MSANEdward Hill2020-06-231-0/+6
| | | | | | | | | | | | | | | | | | Remove our implementations of memcpy/memset/memmove for MSAN and ASAN since they are intercepted by the sanitizers. This was breaking varargs, causing va_arg() to return 0, which was most obvious in printf() with MSAN enabled. BUG=chromium:963303 BRANCH=none TEST=make -j host-host_command_fuzz TEST_MSAN=1 Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: Id65d88b79bbb1834babe62c90078ec92a6aa5fba Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2220160 Reviewed-by: Evgenii Stepanov <eugenis@chromium.org> Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
* common: add CONFIG_POWER_SIGNAL_RUNTIME_CONFIGZick Wei2020-06-232-0/+7
| | | | | | | | | | | | | | This patch add config: CONFIG_POWER_SUGNAL_RUNTIME_CONFIG to allow board modified power signal gpio if needed. BUG=b:150278507, b:152841287 BRANCH=none TEST=make buildall Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: I5c885f9cb3400f3354a18b6d497340dfe3ad993b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2256624 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* Puff: Implement power monitoring and controlAndrew McRae2020-06-234-234/+296
| | | | | | | | | | | | | | | | Monitor the power usage and if necessary apply throttles to reduce power demand. go//puff-power-distro BUG=b:151252619 TEST=Reduce power margin and check that throttling occurs. BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: Ib385cbf561795be0b424cf6a9a15c976e20d8b80 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2224677 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Commit-Queue: Andrew McRae <amcrae@chromium.org> Tested-by: Andrew McRae <amcrae@chromium.org>
* npcx: Add a new flag to check for initial power-onAndrew McRae2020-06-238-32/+81
| | | | | | | | | | | | | | | | | | | | | The CR50 will reset the EC on some platforms after power-on. Add a reset flag to detect this and treat the second restart as a power-on restart rather than reset. Subsume the CONFIG_GPIO_INIT_POWER_ON_DELAY_MS config to make it clear what the behaviour will be. BUG=b:151329011 TEST=Confirm on dalboz, puff & variants that second reset is treated correctly. BRANCH=none Change-Id: Ib66de920403f08099b87d1eff797270606b44f8f Signed-off-by: Andrew McRae <amcrae@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2255830 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Commit-Queue: Andrew McRae <amcrae@chromium.org> Tested-by: Andrew McRae <amcrae@chromium.org>
* Lazor: Modify LED behavior.Sue2020-06-232-64/+53
| | | | | | | | | | | | | | | | | | | | | | LED behavior: Charging | Amber on (S0/S3/S5) Full Charged | Blue on (S0/S3/S5) Discharging S3 | Amber on 1 sec, off 3 sec Discharging S5 | off Error | Amber on 1 sec, off 1 sec Discharging S0 | Blue on Factory mode | Blue on 2 sec, Amber on 2 sec BUG=b:158226994 BRANCH=none TEST=make buildall -j; check led behavior in every state on Lazor Change-Id: Ie654c64f8bb6bb6e364edc1b61009f97638e8f1a Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2235233 Reviewed-by: Alexandru M Stan <amstan@chromium.org> Tested-by: Alexandru M Stan <amstan@chromium.org> Commit-Queue: Alexandru M Stan <amstan@chromium.org>
* usb_prl: new unit test with mocksPaul Fagerburg2020-06-2314-0/+356
| | | | | | | | | | | | | | | | | Now that the old usb_prl unit test is under usb_prl_old, add a new unit test for usb_prl with mocks for the various subsystems that it will use. BUG=b:158608129 BRANCH=None TEST=`TEST_LIST_HOST="usb_prl_old usb_prl" make runhosttests` Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: Ie1bf9a4494cd933473caa4ceb594eddd97c277c7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2252662 Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* octopus: Enable TCPMv2Patryk Duda2020-06-231-1/+5
| | | | | | | | | | | | | | | | | | This patch enables TCPMv2 on octopus boards. Please note that due to bug in PS8751 (see b/148554997 for details) only PD2.0 specification level is enabled. BUG=none BRANCH=none TEST=Flash board from octopus family. Make sure that TCPMv2 is running. Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I9aabcbcd274964e4206e1d82324782dcf67793a4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250685 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>