Commit Graph

8953 Commits

Author SHA1 Message Date
Furquan Shaikh
ec74ffb91f nautilus: Move PMIC init to a deferred function
Instead of doing I2C traffic in an init hook, move it to a
deferred function to be called outside of INIT_HOOK processing.

(identical to CL:1001474 on eve branch, moved to nautilus board
file)

BUG=b:77336348
BRANCH=poppy
TEST=None

Change-Id: Id9eec4333c6f04141e475b61e5aea7b838dcedf7
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1033614
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-05-01 05:35:47 -07:00
Furquan Shaikh
a26cdd0812 nautilus: Enable usb device mode
BUG=b:78649985
BRANCH=poppy
TEST=Verified following:
1. ectool usbpd 0 dr_swap
2. ectool usbpd 0
--> Role: SNK UFP

Change-Id: I10addb4936eab169655c1d11f115740da139a14e
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1031109
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
2018-05-01 02:13:32 -07:00
Jett Rink
a5695793ba anx7447: convert automatic OCM erase into command
We do not want to erase the OCM flash automatically so we
can ensure that we fix our supply chain issues. Add a command
that will erase the OCM if needed.

BRANCH=none
BUG=b:77658388
TEST=verified command works on yorp

Change-Id: Iaf6ada3b1e223d15ae0d9624bdcc54b90cb33b64
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1035428
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2018-05-01 02:13:29 -07:00
Jett Rink
bbb5edb220 bip: add correct charger driver
BRANCH=none
BUG=b:76429930
TEST=buildall

Change-Id: I6d318ad80911e564dda67ba542899ecc42068276
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1019607
2018-05-01 02:13:27 -07:00
Aseda Aboagye
10385292c1 board: Add initial nocturne support.
BUG=b:78539498
BRANCH=None
TEST=make -j BOARD=nocturne

Change-Id: I830ff6739fb648625536ba248eeb383797c850e2
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1032094
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@google.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-05-01 02:13:24 -07:00
Jett Rink
34f54ec4d3 isl9238: read full 16-bit register
Now the read and write both use 16-bit register operations.

BRANCH=none
BUG=none
TEST=isl9238 charger still works on yorp

Change-Id: Ia26e1372a48e3f760b1ac2e3cf9bda11111e97b0
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1035460
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-05-01 02:13:23 -07:00
Vadim Bendebury
c0fb7f1a3b cr50: make fallback certs a compile time option
The fallback certificate is provided when TPM is starting up, but the
proper endorsement certificate seed is not found in the RO space.

Unavailability of the proper endorsement cert would be a major failure
for the device using TPM, and it is not supposed to happen: RO space
is protected. On top of that there is no much point in operating with
the fallback certificate.

Let's drop fallback certificate support from the code, leaving it
possible to conditionally compile in for the remote chance of someone
having to debug TPM related problems on the test board (where H1 does
not have proper cert seed in the RO).

BRANCH=cr50, cr50-mp
BUG=b:65253310
TEST=verified that the code without fallback certificate still boots
     fine on the debug board.

     Compiling with fallback cert disabled saves 2048 bytes of the
     flash space.

Change-Id: Ice8fd4ceef03dd7b3bf170e5cee2908b2a99844a
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1031055
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Nagendra Modadugu <ngm@google.com>
2018-04-28 01:17:00 -07:00
Daisuke Nojiri
02b42b78b3 Nami: Add host command handler for keyboard backlight control
This patch adds host command handlers for
EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT and CMD_PWM_GET_KEYBOARD_BACKLIGHT.

Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>

BUG=b:74176833
BRANCH=none
TEST=Verify ectool pwmsetkblight works. Verify kblight console command
returns the value set by ectool and vice versa.

Change-Id: I1929c6a3772ab22cb4b3c68638da23aa23727596
Reviewed-on: https://chromium-review.googlesource.com/1022961
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2018-04-27 21:27:29 -07:00
Daisuke Nojiri
3fbf2c47ae Nami: Add keyboard backlight control
This implements keyboard backlight control for Nami, Vayne, Pantheon,
and Sona. On Sona, GPIOC4 is directly connected to the LED strings.
Thus, we use PWM to control the brightness. On the other variants,
the LED strings are connected to LM3509. Thus, we control the brightness
through I2C.

Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>

BUG=b:76182445,b:78141647
BRANCH=none
TEST=Verify keyboard backlight brightness changes on Nami.
Verify keyboard backlight turns on/off on lid close/open, sleep/suspend.
on Nami. Verify 'kblight' returns x set by 'kblight x' on Sona.

Change-Id: I400ea2bc7a58a3cc57eb959179d2139a99ac176c
Reviewed-on: https://chromium-review.googlesource.com/1022833
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@google.com>
2018-04-27 21:27:29 -07:00
Furquan Shaikh
102ad07292 npcx/lpc: Add debug command to trigger sci/smi/wake
This change adds console command to trigger sci/smi/wake based on the
user-provided argument. This command is enabled only when DEBUG_LPC is
set to 1. It was very helpful while debugging b:78497502 where I could
trigger the interrupts to check communication between AP and EC.

BUG=b:78497502
BRANCH=None
TEST=Verified by enabling DEBUG_LPC that sci/smi/wake are generated as
expected.

Change-Id: I5b52f5ea4e1824e520fd76315091f73bef157ebf
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1033541
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-27 18:05:29 -07:00
Jett Rink
86ab7efb58 tcpci: reset TCPC if alert mask is reset
The PS8751 TCPC expresses that it has been reset by resetting the
alert mask. Handle its re-init case.

BRANCH=none
BUG=b:77551454,b:77639399
TEST=Verify that TCPC is reset on yorp C1 after reinsertion

Change-Id: Ie1a819a3627a1225c3fad65a60a4aca126a69f53
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1014355
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-04-27 18:05:18 -07:00
Vadim Bendebury
9439d0e121 cr50: use new function to verify index presence
The new TPM API function works even before TPM Startup was executed,
this would allow CCD to read FWMP even if the AP does not boot up.

CQ-DEPEND=CL:1020725
BRANCH=cr50, cr50-mp
BUG=b:67009375
TEST=verified that FWMP can be read both before and after AP is
     booted, and that missing FWMP is also processed properly in both
     cases.

Change-Id: I4e57e6211fdb8fa3166f261aa861dba9bab433a1
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1020785
Reviewed-by: Andrey Pronin <apronin@chromium.org>
2018-04-27 18:05:18 -07:00
Mengqi Guo
a820df3fd6 sweetberry: fix stats_manager and refactor
This CL updates stats_manager to match the new functionalities
in powerlog.py and refactors powerlog.py to more easily find
config files and print timestamps in seconds since epoch.

The unit test for stats_manager is also updated accordingly.

BUG=b:72973433
BRANCH=None
TEST=powerlog -b nami_rev0_loc.board -c nami_rev0_loc.scenario \
--print_stats --save_stats /tmp --save_stats_json /tmp \
--save_raw_data /tmp --mW
and looking at the printed data
python -m unittest stats_manager_unittest
CQ-DEPEND=CL:1003522

Change-Id: Ic6e4aadfcd3ad245572788094ee3d3a30106044c
Signed-off-by: Mengqi Guo <mqg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1002546
Reviewed-by: Todd Broch <tbroch@chromium.org>
2018-04-27 14:36:54 -07:00
Edward Hill
d786f8285b grunt: Increase CONFIG_EXTPOWER_DEBOUNCE_MS to 200
When plugging in USB-C power with no battery (or cutoff battery),
the ACOK signal from the ISL9238 charger sometimes has a negative
pulse of up to 175 ms after VBUS increases from 5V to 20V.
The width of the pulse varies from board to board.
Increase CONFIG_EXTPOWER_DEBOUNCE_MS to 200 ms (from default of 30)
to ignore this negative pulse.
If we think we are running with no battery and no AC then we will
set the charger voltage to 2.048V, and therefore lose power.

BUG=b:77455171
BRANCH=none
TEST=Plug power into Grunt with no battery.

Change-Id: I9c0f358985e4c630daef93d61c49b87c2e11a480
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1031563
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-27 12:22:52 -07:00
Simon Glass
487c7a98cf grunt: Drop the unnecessary charge-current limit
Our maximum power is 45W so we don't need to keep this limit. Also we can
drop the TODO since we have a bug to track that work.

BUG=b:69683178
BRANCH=none
TEST=emerge-grunt chromeos-ec

Change-Id: Ie40847e3e88653225dc228563c1ac89cc0970316
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1031115
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Raul E Rangel <rrangel@chromium.org>
2018-04-27 12:22:48 -07:00
Edward Hill
84e486e8e8 power button: Ignore lid open in PWRBTN_STATE_INIT_ON
Normally on lid open, if chipset is off, we pulse the power button
to wake the AP. If we are in PWRBTN_STATE_INIT_ON, then we are already
waiting to power on the AP so ignore the lid open to avoid turning
on the AP too soon.

BUG=b:77455171
BRANCH=none
TEST=Plug power into Grunt with no battery.

Change-Id: Ie57e998725af0ace525f9f2102a0f5a282382a57
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1031565
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Martin Roth <martinroth@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-27 12:22:41 -07:00
Mulin Chao
9dd10a7685 npcx: change chip variants of npcx7 series for better clarification.
In this CL, we changed chip variants npcx7m6xb to npcx7m6fb and npcx7m7w
to npcx7m7wb for better clafiication since it introduced new parameter
"b" for chip generation in the same family series.

In new npcx7 series naming rule, it follows:
Format: NPCX7(M)(N)(G/K/F)(B/C)
  param M: 8: 128-pins package, 9: 144-pins package
  param N: 5: 128KB RAM Size, 6: 256KB RAM Size, 7: 384KB RAM Size
  param G/K/F/W: Google EC depends on specific features.
  param B/C: Chip generation in npcx7. (Generation A is ignored. It
             follows nameing rule in npcx5.)

The all chip variants of npcx7 used in boards are also listed below:
 npcx7m6g  - for npcx7 ec without internal flash on npcx_evb.
 npcx7m6f  - for npcx7 ec with internal flash.
 npcx7m6fb - for npcx7 ec with internal flash, enhanced features.
 npcx7m7wb - for npcx7 ec with internal flash, enhanced features + WOV.

BRANCH=none
BUG=none
TEST=No build errors for npcx7 series.

Change-Id: I896ee33209efa5d7157c90515005db5f36318c76
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/1025471
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-04-27 12:22:39 -07:00
Allen Webb
1820ecce31 Cr50: Add logging functionality to PinWeaver.
In order to be able to recover from the AP and Cr50 getting out of
sync, this logging functionality gives Cr50 a way to track the
state changes of the merkle tree so that the AP can be updated to
the current state as long as it has a recent enough copy.

This involves packing the important information so it can be stored
efficiently on flash, and adding the necessary messages for the
replay.

CQ-DEPEND=CL:895395,CL:929430
BRANCH=none
BUG=chromium:809729, chromium:809745
TEST=cd ~/src/platform/ec && V=1 make run-weaver_ng -j

Change-Id: I40f98de2c8e9706cccb5b922215699f2132fa121
Signed-off-by: Allen Webb <allenwebb@google.com>
Reviewed-on: https://chromium-review.googlesource.com/963773
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-04-27 12:22:26 -07:00
Allen Webb
826a3876b4 Cr50: Add VENDOR_CC_PINWEAVER vendor command.
This connects the pinweaver code to the tpm vendor
specific command code.

CQ-DEPEND=CL:895395
BRANCH=none
BUG=chromium:809741
TEST=TBD

Change-Id: I2a6c4bf52ad77b7bf0395095404e925e1dd48dbc
Signed-off-by: Allen Webb <allenwebb@google.com>
Reviewed-on: https://chromium-review.googlesource.com/929430
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-04-27 12:22:26 -07:00
Allen Webb
c61479bbd8 Cr50: Added Pinweaver base implementation.
This adds some of the ground work for hardware backed brute force
resistance on Cr50. The feature is called Pinweaver. It will
initially be used to enable PIN authentication on CrOS devices
without reducing the security of the platform. A Merkle tree is
used to validate encrypted metadata used to track login attempts.

The metadata tracks counts of failed attempts, a timestamp of the
last failed attempt, the secrets, and any associated parameters.
Instead of storing the metadata on Cr50 an AES-CTR is used with an
HMAC to encrypt the data so it can be stored off-chip and loaded
when needed.

The Merkle tree is used to track the current state of all the
metadata to prevent replay attacks of previously exported copies.
It is a tree of hashes whose root hash is stored on Cr50, and whose
leaves are the HMACs of the encrypted metadata.

BRANCH=none
BUG=chromium:809730, chromium:809741, chromium:809743, chromium:809747
TEST=cd ~/src/platform/ec && V=1 make run-pinweaver -j

Change-Id: Id10bb49d8ebc5a487dd90c6093bc0f51dadbd124
Signed-off-by: Allen Webb <allenwebb@google.com>
Reviewed-on: https://chromium-review.googlesource.com/895395
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-04-27 12:22:25 -07:00
Jett Rink
6e7193c458 bq25793: add hw ramp support
BRANCH=none
BUG=b:76429930
TEST=build with bip

Change-Id: I03da263ad0f751487ab0d807d0cc659bd8f2b2c8
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1024596
Reviewed-by: Scott Collyer <scollyer@chromium.org>
2018-04-26 17:00:47 -07:00
Jett Rink
a34e253d28 octopus: move common usb/battery code into baseboard
Also implement a few remaining usb function for bip

BRANCH=none
BUG=b:75972988,b:76218141,b:74132235,b:78344554
TEST=verified yorp still functions

Change-Id: I201408b5db689ac4a5bcab0011bc38698271b851
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1024279
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-04-26 17:00:45 -07:00
Alexandru M Stan
043ee28da3 cheza: Increase charger current to max
1.5A is really too low for our bringup tests, increase it to max until we have
a battery driver.

BRANCH=none
BUG=b/74395451
TEST="gpioset EN_PP5000_A 1" should not brownout the system
TEST=Backlight can turn on
TEST=Kernel boots and is stable for swboyd

Change-Id: I789b18304c36f6f68296796c076699af722cb5d6
Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1024502
Reviewed-by: Wai-Hong Tam <waihong@google.com>
2018-04-26 17:00:40 -07:00
Furquan Shaikh
664339e6f2 poppy: Enable usb device mode
BUG=b:78577893
BRANCH=poppy
TEST=Verified following:
1. ectool usbpd 0 dr_swap
2. ectool usbpd 0
--> Role: SNK UFP

Change-Id: Ie1130eba3da4352e2a3e09eaad20886a1bea81a3
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1029539
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-26 13:01:47 -07:00
Jett Rink
f3de6cf48d yorp: lower i2c speeds to 100kHz
We need to tune the i2c parameters for the nuvoton chip on our yorp board
to be able to operate at 400kHz. Currently we do not need the extra speed
or bandwidth, so we are reverting to a lower speed where the default
timing parameters work well.

BRANCH=none
BUG=b:78554726,b:78225299
TEST=HDMI over TypeC works on yorp

This reverts commit 2e7e6665b1.

Change-Id: Ic4ba1d5ef25661bd6c7f9490450af65b4e1393ad
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1028752
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2018-04-26 13:53:54 +00:00
Nick Sanders
805b9850a6 it83xx: implement reboot wait-ext
This was missed on it83xx, but is helpful for servod
to work reliably. Refactor save_flags to use common code.

BUG=b:77830536
TEST=(not yet done) it waits 10 sec for external reboot.

Change-Id: Ia2aac1879d73ac11dd7f3dfc13a1dd871905473e
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1018597
Tested-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-25 23:00:34 -07:00
Daisuke Nojiri
c1c571035e Nami: Control LED for Akali
This patch adds LED control for Akali. Akali needs to show an irregular
pattern in S3 (On 1 sec off 3 sec). This patch adds 'alternate' mode
support. It allows an LED to extend off period. In alternate mode, an
LED goes through on-off-off-off cycles.

Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>

BUG=b:77827579
BRANCH=none
TEST=Verify on Nami.

Change-Id: Ia7541236a6c598173cb94089224ac8c0a3f63a68
Reviewed-on: https://chromium-review.googlesource.com/1024691
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-25 23:00:14 -07:00
Daisuke Nojiri
b789e9377d Sona: Blink LED when battery is low
This patch makes the battery LED on Sona blink in white when the state
of charge is below 10%.

Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>

BUG=b:74940319
BRANCH=none
TEST=Verify battery LED blinks when soc is below 10%.

Change-Id: Iee731a63787496ac15d97555564c8b02e1923256
Reviewed-on: https://chromium-review.googlesource.com/1020660
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-25 23:00:14 -07:00
Aseda Aboagye
da3b7696a4 USB PD: Send SoftReset if in explicit contract at init.
Currently, if a board supports dual role power ports, the EC will
briefly apply Rp resistors on the CC lines upon initializing the PD
tasks.  This was put in place such that the partner port is a known
state.  In the case of an external PD charger, the presence of the Rp
will cause the charger to stop sourcing VBUS.  We only apply the pull up
for reset cases where the EC did not just loose power (e.g. power on
reset or brownout).

This however presents a problem when booting off of AC only.  If a user
types 'reboot ap-off', there will be an extra reset because VBUS is
dropped and the "ap-off" flag will be lost.

This commit simply checks to see if there is an explicit contract in
place for a port.  If an explicit contract is in place and PD
communications are allowed, we will not apply the Rp resistors.  The PD
state machine will then attempt to send a SoftReset to the port partner
in order to reset the PD protocol layer.  If an explicit contract is not
in place, or if PD communications are not allowed, the Rp's will be
asserted briefly as before.

BUG=b:72838807,b:35587129,chromium:712746
BRANCH=None
TEST=Flash zoombini; Remove battery and plug in just AC; Enter `reboot
ap-off` and verify that AP remains off in the subsequent boot and there
is no extra reset.
TEST=Make zoombini locked.  Have a PD contract in RW, reboot to RO and
verify that VBUS is dropped from a PD charger.
TEST=Repeat test on meowth.

CQ-DEPEND=CL:905922

Change-Id: Ie2e3fe5b6b318e166b2a42dfa3241646369ec571
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/905390
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-25 23:00:02 -07:00
Aseda Aboagye
36980ec169 pd: Properly assign data role on reset
According to PD spec:
- Data role shall not be reset on soft reset.
- Data role shall be reset to power-role default on hard reset.

Implement the above. Even if both ports follow spec, it's still possible
for a data role conflict to occur if, for example, data role swap occurs
(data role mismatches power role default) followed by a hardware reset
of one port (such that data role gets reset to power role default).
Handle such cases by taking error recovery actions.

BUG=b:71333840,chromium:805040

TEST=Connect scarlet to powered Apple accessory, verify scarlet comes up
in SNK-DFP after soft reset and issuing "reboot" on EC console.  After
issuing a hard reset, the port comes up in SNK-UFP (which is the
power-role default).

BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Change-Id: I65139f277d59a0612f8323d711080f52425ff5e7
Reviewed-on: https://chromium-review.googlesource.com/885462
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-25 23:00:01 -07:00
Aseda Aboagye
d268930c75 servo_v4: Remove crash command.
Servo V4 is out of space, so remove the crash command to gain some back.

BUG=None
BRANCH=None
TEST=make -j buildall

Change-Id: I9e5617de2a41f12f60d1fab246acddbbcfa3bea2
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1022964
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
2018-04-25 23:00:01 -07:00
Aseda Aboagye
0ecb085a0d samus_pd: Enable Link-Time Optimizations.
BUG=None
BRANCH=None
TEST=`make -j BOARD=samus` succeeds.
TEST=samus_pd is able to boot up and negotiate correctly with zinger.

Change-Id: I422be2772df3436bb398ffd3e58096039efcbebe
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/998828
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-25 23:00:00 -07:00
Aseda Aboagye
a112d2495b pd: Save power role in BBRAM.
In order to re-initialize our PD state variables properly following a
reset, we need to save our current power role.  This commit adds a bit
in the BBRAM PD flags for the power role.

BUG=b:71333840,chromium:805040
BRANCH=None
TEST=Add code to save data role and restore both roles, verify that both
are saved accordingly.

Change-Id: I156ae8179c8e12c63322132d1f0078990bd215f8
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/979264
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-25 23:00:00 -07:00
Aseda Aboagye
d8a1f5c148 kevin: Remove 'pwr_avg' command.
Kevin is out of space, so disable this console command to get some back.

BUG=None
BRANCH=None
TEST=make -j buildall

Change-Id: Ic24b83187067e16ca438f31250c4272580f1e34f
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/922322
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-25 22:59:59 -07:00
Aseda Aboagye
a3c9071e26 samus_pd: Remove crash command.
samus_pd is out of space again (groundhogday.jpg).  Remove the `crash`
command.  This command is needed for a FAFT test (firmware_ECSharedMem)
and you cannot qualify a firmware without it.  However, for samus_pd, we
don't seem to run this test against samus_pd itself, but just samus.

BUG=None
BRANCH=None
TEST=make -j buildall

Change-Id: I7e34a1a7a9fcdd36e1d97b1226b66dc3f25213f0
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/917012
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-04-25 22:59:59 -07:00
Aseda Aboagye
7df8c71e7f wheatley: Enable CONFIG_COMMON_GPIO_SHORTNAMES.
Wheatley needs more space (probably to store his book collection
including works of Machiavelli).  Therefore, enable
CONFIG_COMMON_GPIO_SHORTNAMES to save space.

BUG=None
BRANCH=None
TEST=make -j buildall

Change-Id: Ia5dc8d36c9ae8dea6272a28677609f229a835f96
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/917011
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
2018-04-25 22:59:59 -07:00
Aseda Aboagye
7dc83bed48 USB PD: Save explicit contract state for port 2.
pd_get/set_saved_active() made the assumption that there were only two
ports.  But now, we have a board that turned that port count all the way
up to 3.  This commit adds in that new port BBRAM index.  It also turns
the byte where the port information was stored into a byte of flags,
where bit 0 indicates whether there was an explicit contract in place or
not.

BUG=b:72838807
BRANCH=None
TEST=With some code to check for explicit contract state for port 2,
verify it's functional.

Change-Id: I6f062f67bd3c47dd43ea7e24e844a9286fa37af9
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/905923
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-25 22:59:58 -07:00
Aseda Aboagye
3dfcaaaf0b npcx: Add BBRM idx for a 3rd PD port.
Currently, there's only one board with 3 PD ports and it uses NPCX.
Therefore, this commit just adds the index to NPCX which will be used to
save the fact that there was an explicit contract in place.

BUG=b:72838807
BRANCH=None
TEST=make -j buildall

CQ-DEPEND=CL:905390

Change-Id: Ic960f14a52f2a740adbe08bc340c45edfefbbf26
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/905922
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-04-25 22:59:58 -07:00
Vincent Palatin
53019df3a6 ectool: add a workaround for EC_CMD_FP_TEMPLATE
When issuing a host command whose request packet length is equal to the
maximum size (ie max_request_packet_size as returned by
EC_CMD_GET_PROTOCOL_INFO), the command currently fails with STM32H7 over
SPI host protocol.

The finger template upload through the EC_CMD_FP_TEMPLATE host command
fails due to the issue as it 'optimizes' the chunk length to the maximum
size. For now, workaround this issue by removing a 32-bit word (aka 4 bytes)
to max_request_packet_size, so we never hit this corner case.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=b:78544921
TEST=On Meowth, run 'ectool --name=cros_fp fptemplate finger0.bin'
and see it succeeding.

Change-Id: I52072ddeb12534045c37ab30df301a60c8841199
Reviewed-on: https://chromium-review.googlesource.com/1026680
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-04-25 14:40:50 -07:00
Sam Hurst
01a99552df PD: Leave Vbus ON if Vconn and Vbus Requested is set to 0 in the AMA VDO
While troubleshooting why a generic $19.99 Multiport (USB, HDMI, Type-C)
Type-C dongle didn't work on Scarlet, I noticed that Vconn Req and Vbus
Req were both set to zero in the AMA VDO. For a better user experience,
default to Vbus ON if both Vconn and Vbus Req are both zero.

BUG=b:78286905
BRANCH=NONE
TEST=manual
Tested the generic dongle with USB-Keyboard, TypeC power adapter,
and HP monitor.

Change-Id: I170eef1372c3621334de2c457bd4533eea744cc0
Signed-off-by: Sam Hurst <shurst@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1019611
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-25 14:40:45 -07:00
Aaron Durbin
e889631f56 board/yorp: fix PMIC_EN gpio
Apparently the symbol in the yorp schematic is incorrect for our part.
The PMIC_EN signal on ball H6 is actually GPIO72 -- not GPIOD7. Adjust
the gpio used for PMIC_EN.

Note: GPIO72 needs to be put in gpio mode since it defaults to PWRGD
functionality. However, gpio_pre_init() in chip/npcx/gpio.c enables
gpio functionality by default. If that changes, the board options will
need to change as well.

BUG=b:78352179
TEST=Built. Booted. PMIC_EN goes up and down as expected.
BRANCH=none

Change-Id: I955f9a24e0fbecb0cda1380c237fa44c9a575e45
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1026375
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
2018-04-25 14:40:42 -07:00
Aaron Durbin
b73bede72d board/yorp: set the correct chip variant
The yorp build is using part NPCX796FB0BX which evidently maps to
npcx7m6xb. Therefore, set the correct variant to reflect reality.

BUG=b:78352179
TEST=Built. Booted.
BRANCH=none

Change-Id: I3835b4664429c360ea946aad0a7bf3dc32f6eea1
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1024608
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
2018-04-25 14:40:42 -07:00
Jett Rink
3d9c424cd7 bip: set correct AC_PRESENT debouce delay
BRANCH=none
BUG=b:75974377
TEST=none

Change-Id: Ib6fcc0ac7668614a487525196ea4f3a5f399c640
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1024278
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
2018-04-24 18:53:15 -07:00
Mary Ruthven
9b6fdcc0a4 flash_ec: fix handling ccd controls
BUG=none
BRANCH=none
TEST=use ccd uut to flash meowth and ccd bitbang to flash scarlet

Change-Id: I83ba0c82f66b698d4083649637d2f74a85db9bc4
Signed-off-by: Mary Ruthven <mruthven@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1025265
Commit-Ready: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-04-24 18:53:13 -07:00
Jett Rink
d5e01f07d4 bip: add cbi board version
BRANCH=none
BUG=b:78473271
TEST=none

Change-Id: Ic7b500ed33b884c59036c41b9ce3e7925637ee69
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1024962
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-04-24 18:53:12 -07:00
Jett Rink
21f26e25b1 bip: use ITE as TCPC driver for C1
The PS8751 is only being used as mux with the option of
being a TCPC is we stuff resistor on the subboard. The
default resistor configuration uses ITE EC as C1 TCPC.

BRANCH=NONE
BUG=b:78341944
TEST=none

Change-Id: I4ccad314fa7eec0d205a155e42e52109cff5811f
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1024487
2018-04-24 18:53:07 -07:00
Jett Rink
58f790b2c1 mux: add mode for TCPCI mux that is not the TCPC
We need to use the PS8751 as the USB mux without configuring
it as the TCPC. Add mode that allows passing in i2c port
and address instead using tcpc_config_t values.

BRANCH=none
BUG=b:78341944
TEST=build using bip

Change-Id: I45b420ef890dfa8c5e5052864b7a2bb66d8734d6
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1024486
2018-04-24 18:53:06 -07:00
Divya Sasidharan
dc875f284f yorp: Enable temperature sensors
BUG=b:77944804
BRANCH=None
TEST=On yorp; test adc values, verify they are valid.

Change-Id: I64191f33c594d8869391bab813902f59a63d2ea1
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/1018118
Commit-Ready: Divya Sasidharan <divya.s.sasidharan@intel.corp-partner.google.com>
Tested-by: Divya Sasidharan <divya.s.sasidharan@intel.corp-partner.google.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-24 13:31:32 -07:00
Mary Ruthven
6782985535 cr50_rma_open: add servod support
Add support for finding the cr50 uart given a servo port or being given
a servo console using -d. If servod is using ccd to run, we need to do
ccd_reset after the authcode reboot. Add support for that as well.

BUG=none
BRANCH=none
TEST=none

Change-Id: I972ce60a2e67cc68b604d550579fb2e99db8ac08
Signed-off-by: Mary Ruthven <mruthven@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1025267
Commit-Ready: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
2018-04-24 13:31:30 -07:00
Philip Chen
ad06fa1e11 chip/stm32/clock: Align to second for rtc alarm host command
BUG=b:74256016
BRANCH=scarlet
CQ-DEPEND=CL:1025118
TEST=On scarlet, run 'date; powerd_dbus_suspend --wakeup_timeout=10; date',
confirm alarm works and the sleep time is ~10 secs
TEST='idlestat' when scarlet is in S3, confirm scarlet enters sleep mode
and wakes up without missing wake deadline
TEST=Run 'power_Resume' test on scarlet for 10 times and see consistent
'seconds_system_resume'

Change-Id: I4b0cbc2a6b8a85047b682358aec374e8f05a4346
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1008838
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-04-24 00:30:02 -07:00