Commit Graph

8924 Commits

Author SHA1 Message Date
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
Philip Chen
c4778cb4c4 usb_mux: Simplify logging to reduce code size
BUG=none
BRANCH=none
TEST=make buildall

Change-Id: Ib2d9476e4740527ad2e1f73eeecb0306140b3f38
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1025118
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:01 -07:00
Jett Rink
6b57b4b390 ps8751: add note to revert vbus detection workaround
Once the PS8751 has new firmware, it will be able to detect VBus
at the appropriate time. After that, we can go back to using the
cached version of Vbus detection.

BRANCH=none
BUG=b:77639399
TEST=none

Change-Id: I691919f3bd2479a131aa58763c7906cb4f6919ff
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1024531
2018-04-23 21:48:19 -07:00
Wai-Hong Tam
b40f6e5939 flash_ec: For npcx_uut, use servo to boot EC into the flashing mode
Use servo to boot EC into the flashing mode. Use the unified control
ec_boot_mode to do so.

CQ-DEPEND=CL:1018206
BRANCH=none
BUG=b:68707064
TEST=Ran the flash_ec script on Cheza using servo-micro
TEST=Ran the flash_ec script on Meowth using CCD, with some servo
overlays to drive the ccd_ec_boot_mode control

Change-Id: I32dfe5baa82dd842b5237f38ea971c09e91c47d3
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1020159
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
2018-04-23 18:09:16 -07:00
Jett Rink
fb712058ee bq25703: initial commit for bq25703 driver
BRANCH=none
BUG=b:76429930
TEST=building with bip

Change-Id: Ibed206e1e0b578b3a4b70709509a7288284fc23b
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1019606
Reviewed-by: Justin TerAvest <teravest@chromium.org>
2018-04-23 18:09:09 -07:00
Nicolas Boichat
bbdff9dbb8 hammer: Disable side-band wake using detection pin
Side-band wake was only useful when the lid would go in deep-S3,
where the USB interface is disabled. Since we are using S0ix on
poppy and derivatives, the side band wake is useless, and, in
some rare case, may actually cause issues.

BRANCH=poppy
BUG=b:77828249
TEST=Flash staff, can wake soraka from suspend, or from USB
     autosuspend.

Change-Id: I23398a792157b32a5d79505dcffc92aaffd4fec2
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1011523
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-04-23 01:36:52 -07:00
toobest54
7d50aacabd Nami: Disable ALS for Pantheon
Use OEM ID to update motion_sensor_count to disable ALS for Pantheon.

BUG=b:77937854
BRANCH=none
TEST=Change oem id for Pantheon then to check the ALS was disabled.

Change-Id: I4cb2ad16f3413a65b6f2df84eae2d1ced37b72f6
Signed-off-by: Raymond Chou <raymond_chou@compal.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/1010182
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Carter Sung <carter_sung@compal.corp-partner.google.com>
2018-04-23 01:36:46 -07:00
Vincent Palatin
f6a6b7ad89 meowth_fp: enable PCH interface in S0
Enabling the SPI slave interface and the host interface depending on the
detected PCH power state.

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

BRANCH=none
BUG=b:71986991
TEST=On Meowth, check that the MCU interrupt is seen on the CPU side and
we can still send host commands.
TEST=On ZerbleBarn, verify that the SPI slave interface is enabled at
startup.

Change-Id: Ie7b22e69178bc7d34be6ab28ab24db82fefd5a02
Reviewed-on: https://chromium-review.googlesource.com/966023
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-04-22 01:21:46 -07:00
Vincent Palatin
7bb91563e3 stm32: more robust SPI slave on STM32H7
Try to ensure the SPI host protocol byte codes (aka EC_SPI_xxx) are
transmitted and at the right time despite the errata and other brokenness
of the SPI HW controller in the STM32H7 rev Y silicon.

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

BRANCH=poppy
BUG=b:73947203
TEST=on Meowth, run:
'while true; do ectool --name=cros_fp version || break ; done'
same thing with 'fpinfo', 'fptemplate', 'fpframe'.

Change-Id: Ia455dc0d4b2803a150122655460ef5c11afcda6c
Reviewed-on: https://chromium-review.googlesource.com/1012202
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-22 01:21:45 -07:00
Aseda Aboagye
07e19270f6 meowth: Only power base when AP is on.
Previously, the base power was enabled when the base was detected by the
lid.  However, we should only power the base when the AP is on since it
just wastes power otherwise.  This commit adds a pair of chipset hooks
to kick the state machine on startup and disable it on shutdown.

BUG=None
BRANCH=None
TEST=Flash meowth, attach base with AP off, verify that base power is
not enabled.
TEST=Remove base and attach base, verify that base power is disabled
when removed and enabled when attached.
TEST=Shut AP down, verify that base power is disabled.
TEST=Remove base and attach base, verify that base power remains
disabled.
TEST=Power on AP with base detached, verify that base power remains off.

Change-Id: I4379789987dbe91c72d699c4d184b5c5cc812e5f
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1020525
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-04-20 23:01:35 -07:00
Philip Chen
7db9838df5 power/rk3399: Check aborted suspend for s0s3_usb_wake_power_seq
BUG=b:78321971
BRANCH=scarlet
TEST=build kevin and scarlet

Change-Id: I9e0c842cd8f4186147fa8e6d001b1c21ddad7e89
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1022746
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Derek Basehore <dbasehore@chromium.org>
2018-04-20 23:01:33 -07:00
Caveh Jalali
e09917178d flash_ec: remove redundant sudo
we were invoking flashrom as "sudo sudo flashrom", so remove
the gratuitous sudo.

BUG=none
BRANCH=none
TEST=used flash_ec to flash atlas

Change-Id: I420ada94c4b973c8f7efe546670dd04cfbb1b234
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1020782
Commit-Ready: Caveh Jalali <caveh@google.com>
Tested-by: Caveh Jalali <caveh@google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-04-20 23:01:26 -07:00
Caveh Jalali
a59d855c47 atlas: update GPIO names to match new schematics
the latest schematics have been updated to reflect the I2C bus
numbering used in the chip datasheets.  this updates the software to
be consistent with the new datasheets.  this is only a renaming
exercise, there are no physical changes to the board.

BUG=b:75070158,b:78309559
BRANCH=none
TEST=it compiles

Change-Id: I16e6741c2e8a1dcc32b814a50ba12739f36fd8cf
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1020721
Commit-Ready: Caveh Jalali <caveh@google.com>
Tested-by: caveh jalali <caveh@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-04-20 23:01:25 -07:00
Divya Sasidharan
2952045100 tcpm: Check appropriate NULL pointer for src ctrl
BUG=None
BRANCH=None
TEST=On yorp; make buildall -j

Change-Id: I804f82fd4d3f71080fa2a3ced02dca785a3e9891
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/1020523
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-20 15:24:58 -07:00
Daisuke Nojiri
027b18f0e9 Sona: Blink LED on battery error
This patch makes the battery LED blink at 0.5 sec interval in white
when battery error is detected.

This patch also changes the pulse interval resolution from 1 sec to 100
msec. There is no functionality change.

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

BUG=b:74940319
BRANCH=none
TEST=Verify pulsing and blinking are not affected. Verify battery LED
blinks as intended on Sona.

Change-Id: I0767a6004861b9f07bc846d2ba5bf0df9067a748
Reviewed-on: https://chromium-review.googlesource.com/1017305
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-20 12:57:11 -07:00
Divya Sasidharan
0521077d7b yorp: Fix force mode base accel config
Accel data read was (0, 0) without this change.

BUG=b:74602071
BRANCH=None
TEST=On yorp; on EC console test
     accelinfo on -> gives accel data

Change-Id: I08073cccb2108b5d2189be5aa27a77adfae7677a
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/1015974
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-20 00:33:00 -07:00
Justin TerAvest
60f45d2877 power/common: Preserve 5v enable across sysjump
The value of pwr_5v_en_req needs to be preserved when the EC performs a
sysjump, otherwise any task calling power_5v_enable(tid, 0) will drop
the 5v rail for the entire system.

I've scheduled this at HOOK_PRIO_FIRST for restoring the value to ensure
that no other init hooks read a stale value, but I'm not sure if that's
necessary.

BUG=b:78275296
BRANCH=none
TEST=Booted yorp with power only connected to USB-C port 0

Change-Id: I3a9ed24a5fde02b60163ad2c5e3252759f8c1c5b
Signed-off-by: Justin TerAvest <teravest@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1020066
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-19 19:29:07 -07:00
Wai-Hong Tam
2d5331b9a2 flash_ec: Save the original servo states
When first supporting CCD, it skips saving the original servo states
as some of the controls are not supported in CCD.
https://chromium-review.googlesource.com/344427

But then we customized what controls will be used according to the
servo board type.
https://chromium-review.googlesource.com/572142

So we should save original states again. It helps to restore the
original servo states if it gets interrupted in the middle.

BRANCH=none
BUG=none
TEST=Tried running flash_ec using servo-micro.

Change-Id: I5b873d871d36feed4a0e511ba858db9e093a22be
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1020158
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-04-19 19:29:02 -07:00
Edward Hill
a51e6428d8 grunt: Send sensor MKBP events using host event
Add CONFIG_MKBP_EVENT and CONFIG_MKBP_USE_HOST_EVENT
to send sensor events to AP.

BUG=b:77342604
BRANCH=none
TEST=view sensors in AIDA64 Android app in ARC++

Change-Id: I3687072903d251bccb2cdf7670b0780a906dd22d
Signed-off-by: Edward Hill <ecgh@chromium.org>
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1012457
2018-04-19 19:28:58 -07:00
Furquan Shaikh
e5d961ae96 stoney: Use chipset_pre_init callback
Similar to intel_x86, move chipset stoney to using chipset_pre_init
callback.

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

Change-Id: I995bbda01ec78ecd28c302f269cf15739913ecd9
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1018738
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-19 19:28:45 -07:00
Furquan Shaikh
91148de7c8 APL/GLK: Move chipset shutdown to chipset task
In order to ensure that all chipset init/shutdown operations happen
within the context of chipset task for APL/GLK:
1. Update chipset_force_shutdown to only set a flag force_shutdown to
indicate that chipset shutdown is requested and wake the chipset task.
2. Make chipset task (within the power state machine) call
internal_chipset_shutdown.
3. Make internal_chipset_shutdown reset force_shutdown flag and make a
callback to weak function chipset_do_shutdown to trigger chipset
shutdown.

BUG=b:78259506
BRANCH=None
TEST=Verified that "apshutdown" on EC console results in chipset
shutdown action being taken within chipset task.

Change-Id: If13b65ae47e3dce2e466320cc14c68239563f6ed
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1018737
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-19 19:28:44 -07:00
Furquan Shaikh
277d59a36c intel_x86: Get rid of CHIPSET_PRE_INIT hook
Now that all boards are moved to using chipset_pre_init_callback,
get rid of hook notification for CHIPSET_PRE_INIT from x86 power state
machine.

BUG=b:78259506
BRANCH=None
TEST=Verified that yorp still boots.

Change-Id: I244848b3c80e8ccd34b3c99c8aa2dee3030e0e53
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1018736
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-19 19:28:44 -07:00
Furquan Shaikh
753793849a fizz/nami: Use chipset_pre_init_callback
This change updates fizz/nami boards to use chipset_pre_init_callback
instead of hook.

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

Change-Id: Ib09c033c2f0c2c3d324c90776f7bbd8365a71f52
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1018735
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-19 19:28:43 -07:00
Furquan Shaikh
8faa22cb27 APL/GLK boards: Use chipset_pre_init_callback
This change updates all APL/GLK boards to use
chipset_pre_init_callback instead of hook.

BUG=b:78259506
BRANCH=None
TEST=Verified that yorp still boots.

Change-Id: I71ab0f1111e89a254db83fc58abfdfe8eacd3575
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1018734
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-19 19:28:42 -07:00
Furquan Shaikh
e54c3e1728 chipset: Add callback for chipset pre-initialization
This change adds a callback for chipset_pre_init_callback which is
made by x86 common power state machine when in G3S5 state. Until now,
there was a hook CHIPSET_PRE_INIT_CALLBACK that was notified by
chipset task when in G3S5 state. However, there are at least following
reasons why this should be a callback and not a hook notification:
1. The initialization that is done as part of pre-init could be
essential for the power state machine to make progress. Though the
chipset task goes to sleep waiting for power signals after the hook
notification, pre-initialization can all be done as part of a callback
since it is mostly board-specific code that is doing work to
initialize PMIC.
2. Typically, boards use I2C transactions to setup PMIC on getting
chipset pre-init notification. However, since i2c transfers are not
encouraged in hook task, they have to be deferred anyways.
3. Since the initialization is being done as part of hook task, use of
any constructs e.g. pwr_5v_en_req which allows multiple consumers to
enable/disable power rails will use task id for hook task. Instead it
is better to provide correct information about the task by letting
chipset task perform this request.

Thus, this change adds a callback chipset_pre_init_callback in G3S5
state for x86 power state machine. This callback is guarded by
CONFIG_CHIPSET_HAS_PRE_INIT_CALLBACK.

The hook notification is left as is for now until all x86 boards are
moved over to using the newly added callback.

BUG=b:78259506
BRANCH=None
TEST=None

Change-Id: I2e1d73e5308759fef41680ae715ef71268b61780
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1018733
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-19 19:28:41 -07:00
Jett Rink
ff9248fbaa system: update board version to return an error if encountered
Now that board version can come from CBI, we can have a real error
reading it. We should pass that error to the console or to the
AP on the host command and let the AP firmware (or user) decided how to
handle that error case

Also update the CONFIG_BOARD_VERSION to be derived instead of needed
in most cases.

BRANCH=none
BUG=b:77972120
TEST=Error reported on EC console and AP console when CBI is
 invalid on yorp

Change-Id: Ib8d80f610ea226265a61e68b61965150cdc9bb04
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1015776
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-04-19 12:46:14 -07:00
Mary Ruthven
d9386134c1 cr50_rma_open: check write protect too
Cr50 RMA Open will disable write protect. Make sure it is disabled. If
it isn't, manually disable write protect after rma_auth. If cr50 reboots
or loses write protect, cr50_rma_open can now be used to force disable
it again with cr50_rma_open -w.

BUG=none
BRANCH=none
TEST=none

Change-Id: I096cff51ae20b8a4cfbfa92892a011ff48f4cc49
Signed-off-by: Mary Ruthven <mruthven@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1016023
Commit-Ready: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
2018-04-19 03:37:14 -07:00
Nicolas Boichat
c6ce2208e3 flash_ec: Fix SERVO_TYPE test
Without this, we see this line when running flash_ec.
util/flash_ec: line 787: [: =~: binary operator expected

These kind of tests require double brackets.

BUG=b:77825616
BRANCH=none
TEST=run util/flash_ec using servo_micro on staff.

Change-Id: I6baecec2252276ac06992fd2b2e50f74d55805f2
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1018560
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-04-19 03:37:13 -07:00
Vadim Bendebury
49241f476e g: fix signer to always use the manifest
Since the proper signer utility has been introduced in the chroot,
there is no need in generating reduced command option set when
building a self signed image.

Also, the same manifest can be used for all images, self signed or
signed using a fob. The manifest needs to be tweaked for the self
signed images to match the test Key ID.

Since the same base manifest is used for all signings, there is no
need to support the "poor man's json parser" any more.

Rearranged build.mk to accommodate new logic, and added some comments.

BRANCH=cr50, cr50-mp
BUG=b:78212718
TEST=verified that images with proper header version are created when
     both self signed and signed with a private key coming from the
     signing fob.

Change-Id: I5a1f8a223098b0a6c830ef24ffe380fc0badcafa
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1017238
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-18 17:35:41 -07:00
Sam Hurst
cd872d58f2 TCPM: Prevent premature reading of PD Packets in FUSB302 driver
After a successfully PD packet transmit, a PD_EVENT_RX is issued
which could trigger a premature reading of a PD Packet before
the entire packet is received.

BUG=b:71620429
BRANCH=NONE
TEST=manual
Tested on Scarlet with the following three dongles:
ASUS 3-1, (HDMI, USB, TYPEC): Tested with USB-Keyboard, TypeC power
adapter, and HP monitor.

Cable Matter 6-1, (DP, HDMI, USB, SVGA, ETHERNET, TYPEC): Tested with
USB-Keyboard, TypeC power adapter, Ethernet and HP monitor
(DP and HDMI). SVGA was not tested.

Cable Matters 6-1, (DP, DP, USB, USB, ETHERNET, TYPEC): Tested with
USB-Keyboard, USB-Mouse, Ethernet, and two HP monitors
(Scarlet was mirrored on both monitors)

Signed-off-by: Sam Hurst <shurst@chromium.org>
Change-Id: Ib07182201d954cf4b9616277f9c14bbbb337197e
Reviewed-on: https://chromium-review.googlesource.com/1015417
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-18 09:30:36 -07:00