Commit Graph

7906 Commits

Author SHA1 Message Date
Gwendal Grignou
a3931810fe scarlet: Add min/max frequencies for sensors
As part of new interface MOTIONSENSE_CMD_INFO, we need to provide
sensors min and max frequency.

BUG=none
BRANCH=none
TEST=compile

Change-Id: I8bcd4e2287a79ac17b0dce58ad7704876e89bcdb
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/723601
2017-10-20 14:38:47 -07:00
Rong Chang
67c8adc817 hana: Add EC console USART internal pull-up
This change prevents the floating RX console pin from entering unwanted
commands.

BRANCH=oak
BUG=b:67033247
TEST=manual
  load on hana and probe USART RX pin

Change-Id: I6dc05e03f82dcc71ea6f957f93c5fe7c6b65d2bf
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/722381
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-10-20 06:08:58 -07:00
Nicolas Boichat
ccfc005fa4 isl9238: Add support for providing power using OTG
BRANCH=none
BUG=b:66575472
TEST=Flash lux and wand, wand can provide power to lux.

Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Change-Id: I59091c509b78bacf9f382550ab380a77fbf68ba9
Reviewed-on: https://chromium-review.googlesource.com/725122
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-20 06:08:58 -07:00
Nicolas Boichat
6336a7c751 poppy: Add CONFIG_BATTERY_PRESENT_CUSTOM option
We define battery_is_present in board/poppy/battery.c, so we should
also set CONFIG_BATTERY_PRESENT_CUSTOM.

BRANCH=none
BUG=b:67984464
TEST=Flash soraka, battery status when connected and disconnected is correct.
TEST=Recovery from battery-cutoff is fine
TEST=Device does not get stuck in reboot loop when in critical battery
     condition

Change-Id: I02a597e30513a1bb4dab86a21ea107fc4876a63b
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/727444
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2017-10-19 23:25:27 -07:00
Kyoung Kim
704ae50098 Poppy: change unused pins config
Configure unused pins to INPUT/PU to lower S0ix power.

BUG=b:64503543
BRANCH=none
TEST=measure EC power and check if S0ix/S3 power become lower
by ~9mW.

Change-Id: I2cf50bb86e3e1312c6b9150f01dee451db89750c
Signed-off-by: Kyoung Kim <kyoung.il.kim@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/714376
Commit-Ready: Kyoung Il Kim <kyoung.il.kim@intel.com>
Tested-by: Kyoung Il Kim <kyoung.il.kim@intel.com>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Kyoung Il Kim <kyoung.il.kim@intel.com>
2017-10-19 23:25:27 -07:00
Nicolas Boichat
540601885f poppy: If base ADC value is unclear, try reading it again
If the base ADC value does not clearly indicate attach, reverse
attach, or disconnect, read the ADC value again in 500ms.

This time should be long enough that even if the ADC value is
wrong, it would not use an inconsiderate amount of power.

BRANCH=none
BUG=b:67970530
TEST=Connect 6K and 30K resistors in parallel between DET and GND
     pin, EC detects an unclear 27 mV ADC value, and retries
     every 500ms until the 6K resistor is removed and a clear
     attach value is read (154 mV).
TEST=Connect base in reverse, ADC value is around 475 mV, and
     ADC is not polled again.
TEST=Disconnect base, ADC value is at maximum (2816 mV), and ADC
     is not polled again.

Change-Id: I616114afc683608b853c18d0a081c6cd1e150c75
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/727790
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2017-10-19 21:15:32 -07:00
Philip Chen
4e294f911a scarlet: Lower VMIVR
Lower minimum input voltage regulation from 4.4V to 4V.

BUG=b:67932466
BRANCH=none
TEST=manually poke the register value and confirm VMIVR is 4V

Change-Id: Ia1af423612a35ef48ecdd2987cdcc7d10f81bc28
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/727411
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: David Schneider <dnschneid@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-10-19 21:15:29 -07:00
Stefan Reinauer
3bd60c42ec Fix keyboard in systemd-boot
This prevents problematic disabling of the keystrokes by making it
so that 0xAD can't disable keystrokes.

Also cleans up keyboard controller enable/disable code.

BRANCH=none
BUG=none
TEST=keyboard now working in UEFI bootloaders like systemd-boot
     (aka gummiboot)

Change-Id: I921834fc418572c9a0f4586039ac1ce05504bf1d
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Signed-off-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/722124
Tested-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-10-19 14:56:09 -07:00
Shawn Nematbakhsh
ce2377414a servo_v4: Add CHG / DUT port voltage synchronization
The previous method of negotiating > 5V on CHG port followed by
asynchronously negotiating > 5V on DUT port (and then switching DUT VBUS
source from internal 5V to DUT) will often not function correctly due to
VBUS glitching on the switchover. Instead, immediately switch VBUS
source to CHG when detected, and negotiate > 5V on CHG only after DUT
has requested a transition.

BUG=chromium:775542
BRANCH=servo
TEST=Attach {kevin, scarlet} to servo_v4, attach Apple charger to
servo_v4, verify DUTs charge at 9V and consoles are reachable on
scarlet.

Change-Id: I1e53f1e74e5ab1cd32a252243c23faaa8fce107b
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/724683
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-19 14:56:08 -07:00
Shawn Nematbakhsh
9f10ffc653 cleanup: pd: Make PDO find / extract functions non-static
Allow other modules to call pd_find_pdo_index() / pd_extract_pdo_power()
in order to get information about current PDOs.

BUG=chromium:775542
TEST=Manual on kevin, verify 20V negotiation with zinger still works.
BRANCH=servo

Change-Id: I1861a0226501bda13e7d576d0971d841da9d2b74
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/724682
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-19 14:56:07 -07:00
Marius Schilder
de007979d3 MN50: delete
Project moved to private-cr53/

BUG=none
BRANCH=none
TEST=compiles

Change-Id: I30f99678f8b572030f565bcf3a31ca0f00babebc
Reviewed-on: https://chromium-review.googlesource.com/727660
Commit-Ready: Marius Schilder <mschilder@chromium.org>
Tested-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2017-10-19 12:56:49 -07:00
Shawn Nematbakhsh
165f7d6f3b charge_ramp: Ramp USB-C DTS sources
suzy-qable advertises 1.5A, but its actual capability depends on the
host USB port it is attached to. Since suzy-qable is ubiquitous and
other DTS sources may behave in the same way, ramp the input current
limit in order to find a reasonable maximum.

BUG=chromium:770296
BRANCH=None
TEST=Attach suzy-qable to kevin and reef, verify that neither OCs and EC
console via cr50 is available on reef. Also verify donette chargers
kevin at 3A and does not ramp.

Change-Id: Idd0683ede3a44111a01da6b4faab52f388ee82fd
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/693295
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-19 12:56:42 -07:00
Shawn Nematbakhsh
251212fb9d pd: Remove ACCESSORY states
According to the USB-C spec, when a debug accessory is identified, we may
optionally establish USB PD communication over CC. Some DTS partners
(eg. servo_v4) expect us to speak PD, so let's make it so. There is no
need for special ACCESSORY states, these do not exist in the PD spec.

BRANCH=servo
BUG=chromium:737755,b:65837068
TEST=On scarlet, attach servo_v4 and verify scarlet charges. Also verify
EC and cr50 consoles are available through servo_v4.

Change-Id: I59d1ca50b4766509eccf38562cdf926578138585
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/693294
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-19 12:56:42 -07:00
Shawn Nematbakhsh
7c2c5a9dc3 pd: Add "freeze" dual-role policy
Add a new DRP policy to "freeze" the power role of each port, never
toggling automatically, though manual role swaps may still occur.

BUG=chromium:769895
BRANCH=servo
TEST=On servo_v4, verify DUT port stays in SRC role and POWER port
stays in SNK role while disconnected.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ibff3cd1ffaf0e884b030c231003763a57acbe02e
Reviewed-on: https://chromium-review.googlesource.com/715276
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-19 12:56:42 -07:00
Shawn Nematbakhsh
e7dfbf35a4 servo_v4: Use charge_manager for input port / ILIM selection
BUG=chromium:769895
BRANCH=servo
TEST=On servo_v4, attach OEM Apple charger to power port and verify
negotiation to 9V and port / ILIM selection from charge_manager. Attach
samus to DUT port and verify 9V charging.

Change-Id: Icf16f6e8c99af4fbb48a83b7a36f550c20f5fd69
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/713944
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-19 12:56:41 -07:00
Patrick Georgi
87dbec5dfa util/misc_util: Fix unchecked error
It's unlikely, but let's check for ftell() errors.

BUG=b:64477774
BRANCH=none
TEST=none

Change-Id: I3690da60f756ab056e852e9f485b3c439c82e67b
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Found-by: Coverity Scan #58158
Reviewed-on: https://chromium-review.googlesource.com/719196
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Martin Roth <martinroth@chromium.org>
2017-10-19 05:15:31 -07:00
Nicolas Boichat
b6547eda9b staff: Adjust touchpad dimensions
BRANCH=none
BUG=b:67982128
TEST=Flash staff, no more *** TP mismatch error.

Change-Id: I8f9aee68bc81a550eae176b9903add2a4f26b700
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/727390
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-19 05:15:30 -07:00
Furquan Shaikh
3b4223f695 power/intel_x86: Give host a chance to read hostevents on S0ix wake
Instead of clearing out all the host events on S0ix wake, provide an
opportunity to the host to read the events and log it. Move the call
to clear events to the point where host sends a command indicating
exit from S0ix.

BUG=b:67874513
BRANCH=None
TEST=make -j buildall. Verified that host events are cleared by the
host during logging.

Change-Id: I339dc70d761bb851286d98c5c20094ccaefd238f
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/724188
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-10-19 00:52:27 -07:00
Philip Chen
d0320d8fd5 scarlet: Upgrade the charger IC to RT9467 on rev2
WARNING: This will break charging on rev1 which uses RT9466
since RT9467 has different I2C address from RT9466.

BUG=b:67917615
BRANCH=none
TEST=manually verify charger works on rev2

Change-Id: I633ab783eece033cfe733401e09ee83359a5f265
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/725001
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-10-18 23:14:18 -07:00
Philip Chen
b10fa27b6b scarlet: Use TCPC to detect VBUS
On Scarlet rev2, we see rt9467 has trouble
detecting VBUS level reliably.
Let's use TCPC to detect VBUS instead as we once
considered in b:65698085.

BUG=b:65698085, b:67917615
BRANCH=none
TEST=verify usb mouse and charging works through usb-c hub

Change-Id: I439cd3267bb26d5cdcbfd4a3c48179cf7942b870
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/725000
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-10-18 23:14:18 -07:00
Furquan Shaikh
5bd5f1b1fa host_event_commands: Add support for always reporting masks
Add a new mask type (ALWAYS_REPORT mask) that is set by default to
certain host events that should always be reported to the host
irrespective of the state of SCI, SMI and wake masks. This mask
includes host events like critical events resulting in shutdown or
reboot, events that are consumed by BIOS, etc.

Now that ALWAYS_REPORT mask is added, this change also updates the way
EC manages set/query operations for host events:
1. During set operation, EC will check if the host event is present in
any of the 4 masks - SCI, SMI, wake and always report. If yes, then it
is set in hostevents.
2. During query operation, EC will extract the lowest set event from
hostevents, clear it and return it back to the host.

In order to reflect the above change in EC behavior, a new feature bit
is used EC_FEATURE_UNIFIED_WAKE_MASKS. This allows the host to decide
when wake mask needs to be set before checking for host events.

BUG=None
BRANCH=None
TEST=make -j buildall. Also verified following:
1. Wake from S3 works as expected. Host is able to log correct wake
sources (Verified power button, lid open, base key press and tablet
mode change on soraka).
2. Wake from S5 works as expected. Host is able to log correct wake
sources (Verified power button, lid open on soraka).
3. Wake from S0ix works as expected (Verified power button, lid open
on soraka).
4. Software method to trigger recovery still works fine:
    reboot ap-off
    hostevent set 0x4000
    powerb

Change-Id: I62e5c1f82247c82348cd019e082883d86ec2688f
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/719578
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-10-18 23:14:18 -07:00
Furquan Shaikh
05d59d14c9 host_command: Add flags1 to host_command_get_features
There are two entries in feature flags array. Report back flags1 along
with flag0 while responding to host queries.

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

Change-Id: I7e92c9558a5ddee0515e026ea51eb70f1e26eafc
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/719487
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-10-18 23:14:17 -07:00
Marius Schilder
e5663fcc81 Add CONFIG_IGNORE_G_UPDATE_CHECKS
In some scenarios we want to take RW updates w/o taking version numbers into consideration,
much like the behavior we get w/ CR50_DEV.
But then without the additional CR50_DEV features enabled for the rest of the code.

BRANCH=none
BUG=none
TEST=compiles
Change-Id: I7dd946ab77bbdc35850ed934cd53735418e13845
Reviewed-on: https://chromium-review.googlesource.com/724967
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Marius Schilder <mschilder@chromium.org>
Trybot-Ready: Marius Schilder <mschilder@chromium.org>
2017-10-18 22:48:41 +00:00
Aseda Aboagye
8f3f0c0807 flash_ec: Add 1s delay after turning on SPI VREF.
On zoombini, we were taking enough power that the voltage dipped for a
little bit.  This commit adds a 1 second delay after applying SPI VREF
but before actually flashing the EC.

BUG=b:65694390
BRANCH=None
TEST=`./util/flash_ec --board zoombini` still works.

Change-Id: I431cbfcc569fd5369971b06dedb85e8d5fdb9a32
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/722354
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-10-18 10:30:41 -07:00
Nicolas Boichat
7501654d20 chip/stm32/usart: Add flags to usart_config
Allows setting TXINV/RXINV bits.

BRANCH=none
BUG=b:65697962
TEST=make BOARD=wand -j

Change-Id: Ib1bb290cd9758c53b98c8fc1ca1a9369c8cff39e
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/694561
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-18 08:30:16 -07:00
Nicolas Boichat
8434ed8f10 isl9237: Fix HW ramp setting in charger_post_init
While introducing support for isl9238, I accidentally used an
incorrect config option (CONFIG_ISL9237), instead of
CONFIG_CHARGER_ISL9237.

BRANCH=none
BUG=b:35585464
TEST=make buildall -j

Fixes: b1101b8ed6 charger: isl923x: Add support for ISL9238

Change-Id: I2f62f3fbefbc60cc9d83726ef88a66c5c9f1b245
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/725121
Reviewed-by: Rong Chang <rongchang@chromium.org>
2017-10-18 06:15:05 -07:00
Furquan Shaikh
b9e07ce1bf host_event: Move host events and mask handling into common code
Instead of duplicating the handling of host events and host event
masks in chip lpc drivers, add routines in common code to provide
basic functions like setting/getting of masks, setting/getting of
events and handling of masks transitions across sysjump.

BUG=None
BRANCH=None
TEST=make -j buildall. Verified following:
1. Event masks are correctly retained across sysjumps.
2. Wake from S3 works fine.
3. Wake from S0ix works fine.
4. SCI generated correctly.

Change-Id: Ie409f91b12788e4b902b2627e31ba5ce40ff1d27
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/707771
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-10-17 23:14:19 -07:00
Vadim Bendebury
501fba17a9 g:prevent SOF calibration debug message spew
It turns out the code logic is not exactly correct: the range for
coarse trim values is 0..0xFF.

Use the fixed top of the range value and do not print messages if the
value is at the range boundary.

BRANCH=cr50
BUG=b:67788437

TEST=Observed occasional messages on the Cr50 console when
     plugging/unplugging Suzy-Q, but not the constant spew.

Change-Id: I94ab581769ba8326346b636b1342136e98d61ff1
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/723981
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2017-10-17 23:14:18 -07:00
Stefan Reinauer
38d23e4af0 keyboard_8042: ensure key scanning on when keyboard enabled
BRANCH=none
BUG=none
TEST=Boot Windows in legacy mode and observe keyboard is working.

Change-Id: Id203a8804b86e0fcfbb9974658f66e9bd2602151
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Signed-off-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/722123
Tested-by: Stefan Reinauer <reinauer@google.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-10-17 20:49:10 -07:00
Gaggery Tsai
f9bd2c5546 Fizz: enable fan
This patch is to enable fan through PWM4 output and TACH feedback
from TA2 GPIOA6, and move EC_PLATFORM_RST to GPIO45.

BUG=b:64915426
BRANCH=None
TEST=emerge-fizz chromeos-ec and use fanduty and faninfo from EC
     console to control and check fan status. Probed oscilloscope
     on PWM output and checked the duty as expected. Made sure the
     fan was stopped when DUT entered S3 and was running when DUT
     resumed from S3.

Change-Id: I09f3ac43d2e4170b2aff3830f832bc5fd46a15c0
Signed-off-by: Gaggery Tsai <gaggery.tsai@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/627542
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2017-10-17 13:02:53 -07:00
Vadim Bendebury
9f68af75f6 gsctool: allow to pass optional value for --rma
It would be much easier to use the --rma command line option if it
allowed to pass the authentication code in a separate invocation.

This patch changes the behavior of the --rma command line option and
improves the help message to match actual features of gsctool.

When passed without an extra parameter it requests the Cr50 to
generate the RMA authentication challenge, prints the challenge on the
console as before, and then exits instead of waiting for the user to
enter the authentication code.

When the extra parameter is given, it is considered the authentication
code received from the server, the code is passed to the Cr50 and the
response is reported to the user.

BRANCH=none
BUG=b:37952913
TEST=verified the expected behavior:

  localhost tmp # ./gsctool -r -t
  Challenge:
   CCYAQ 5ZUDP 9Q8NY S7TQR 7PVUR ETX7P T5YQK NGV9S
   7TY8Z QY7H5 5DEH3 5EEWY UBJPA WN7YX SE35G TPS76
  localhost tmp # ./gsctool -t -r EYE3E
  Processing response...
  rma unlock failed, code 1
  localhost tmp # echo $?
  3
  localhost tmp # ./gsctool -t -r EYE3EWQG
  Processing response...RMA unlock succeeded.
  localhost tmp # echo $?
  0
  localhost tmp #

Change-Id: I2c61ff3a3ef1718eb4f192321bebd8caba388aeb
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/722115
2017-10-17 13:02:50 -07:00
Vadim Bendebury
e63e0515e4 gsctool: harden the APIs marking pointers const
This is just a tweak marking pointers to the vendor command payloads
as const, as the command payloads are not supposed to be modified by
the communication layers.

BRANCH=none
BUG=none
TEST=make buildall -j; make -c ./extra/usb_updater

Change-Id: I68f15e8c77dc892173ff0241072128d960712a80
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/722114
Reviewed-by: Andrey Pronin <apronin@chromium.org>
2017-10-17 13:02:49 -07:00
Daisuke Nojiri
465eaf4d7e Fizz: Add EC_RW_B in FMAP
This patch adds EC_RW_B entry in the FMAP. This allows FAFT to locate
the RW_B image and manipulate it.

BUG=b:64614832,b:67748602
BRANCH=none
TEST=Run futility dump_fmap ec.bin.

Change-Id: I03aec945e0c8c3e08fc629a34ea6e5183bcccb61
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/722024
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-10-17 13:02:49 -07:00
Daisuke Nojiri
20c94b726e EFS: Sysjump to active copy
In EFS, EC needs to sysjump to the active copy, which is hashed
and validated by the AP.

BUG=b:67748602
BRANCH=none
TEST=Verify Depthcharge makes EC jump to RW.

Change-Id: I2ca893f7691ad776a791f2044dd7a0983d06e3c5
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/717676
2017-10-17 13:02:49 -07:00
Shawn Nematbakhsh
33ec4ae3bc charge_manager: Support no-battery / no-host boards
Boards without batteries and/or without host command support may wish to
use charge_manager.

BUG=chromium:769895
BRANCH=None
TEST=`make buildall -j`

Change-Id: I2455528de3300a0651791752a05409c888b5f2a3
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/713943
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-17 11:07:44 -07:00
Philip Chen
ebcbc5d5f2 scarlet: Fix SPI master
Add startup/shutdown code for SPI2.
Fix mapping for DMA channels.
Set the initial level as high for CS pins.

BUG=b:67694935, b:64798990
BRANCH=none
TEST=boot scarlet rev1 without seeing auxiliary watchdog triggered,
see reasonable accel and gyro measurement from 'accelread'

Change-Id: Icb79c3b716adb90804231032505c31148b88a9ee
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/717735
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Alexandru M Stan <amstan@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-10-17 02:37:35 -07:00
Vijay Hiremath
ee7716b544 GLKRVP: Enable low power idle mode
BUG=b:67782644
BRANCH=glkrvp
TEST=Make buildall -j

Change-Id: I89eae439c7adebf9abdec7620f5b126aab48b9a4
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/719975
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-10-17 00:33:12 -07:00
Vijay Hiremath
08210d0a34 GLKRVP: Enable verified boot support
BUG=b:67780603
BRANCH=glkrvp
TEST=EC console command 'hash' can print the vboot hash
     calculated values.

Change-Id: I3d9efa7b6c57f8a862676929a1af9ae21b5c9b2d
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/719881
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-10-17 00:33:11 -07:00
Vadim Bendebury
26a8e16de1 util: let cr50 signer use chroot version of gsctool
Requiring installation of the gsctool locally in the EC tree could
collide with debug versions or executables built for wrong
architectures.

Let's use the version installed in chroot and give user instructions
how to install it if it is not there.

BRANCH=cr50
BUG=none
TEST=verified that create_released_image.sh still works with the
     chroot version of the tool

Change-Id: Ib155e166297d28c1660f7f33bb000b3bb8fe7a15
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/709739
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-10-16 18:17:35 -07:00
Vijay Hiremath
b2d6bf0ada GLKRVP: Correct GPIO assignment for PCH_WAKE_L
BUG=b:67797598
BRANCH=glkrvp
TEST=In S3, toggling PCH_WAKE_L wakes system to S0.

Change-Id: If4d6786d8b24488c11f7894499c7e19f43a9b7f8
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/719486
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-10-16 14:14:04 -07:00
CHLin
72d91062f4 npcx/flash: not enable the flash pinmux when using internal flash
In npcx5, the flash interface pinmux should be turned on in order to
access the external flash. However, in npcx7, the internal flash is
used. It is meaningless to turn the pinmux on. And it also causes the
alternative function of these pins not work normally(such as
GPIOA0/GPIOA2) if the pinmux is enabled. This CL uses the preprocessor
flag NPCX_INT_FLASH_SUPPORT to conditionally prohibit the execution of
flash pinmux code.

BRANCH=none
BUG=none
TEST=No build errors for "make buildall". Build npcx_evb and npcx7_evb
boards, make sure the pinmux are correctly configured seperately.

Change-Id: Iba2300159f204b65d15852ec1755714df0c64816
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/704316
Commit-Ready: CH Lin <chlin56@nuvoton.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2017-10-15 21:55:56 -07:00
Patrick Georgi
828da3d556 util/iteflash.c: make sure that the file is closed
An insignificant bug, but Coverity complains about it. Reduce the
cognitive load by making sure that file is closed in time.

BUG=none
BRANCH=none
TEST=none

Change-Id: I2efbe136f4991cf829b95568eef22eb7b2d1a8c6
Found-by: Coverity Scan #141758
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/702304
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Chris Ching <chingcodes@chromium.org>
2017-10-14 08:03:05 -07:00
Patrick Georgi
57ae0b0f18 util/iteflash.c: Handle potential resource leaks
They're of really little consequence right now since an error in
verify_flash() is only followed by resource tear down and process exit.
verify_flash could gain other call-sites though, so better be safe than
sorry.

BUG=none
BRANCH=none
TEST=none

Change-Id: I5fa8276dc3b3e124dacceca1ea857430982f7567
Found-by: Coverity Scan #141761, #141762
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/702482
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Chris Ching <chingcodes@chromium.org>
2017-10-14 08:03:05 -07:00
Chris Ching
8373a0f86c [fan] Add CONFIG_FAN_SPEED option to override EC fan speed
Fans will be initialed at the given RPM, and not the max speed.
Changed kahlee to use new method and set speed to ~50%, down from 75%

BUG=b:67055475
TEST=run on kahlee board
BRANCH=none

Change-Id: Iad40a58b531f46ac80572b47aef9378b47222be1
Signed-off-by: Chris Ching <chingcodes@google.com>
Reviewed-on: https://chromium-review.googlesource.com/714386
Commit-Ready: Chris Ching <chingcodes@chromium.org>
Tested-by: Chris Ching <chingcodes@chromium.org>
Reviewed-by: Chris Ching <chingcodes@chromium.org>
2017-10-13 21:55:20 -07:00
Shawn Nematbakhsh
2e1ec23353 tcpc: Don't retry sending of source caps
TCPM will retry sending of source caps on failure and retrying in TCPC
will cause us to violate PD_T_SEND_SOURCE_CAP.

BUG=None
TEST=Attach servo_v4 to twinkie, verify source caps are sent in ~100ms
intervals and not in bursts of four.
BRANCH=servo_v4

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I3264e5578afbde7b9d2c003b6744974329a253d4
Reviewed-on: https://chromium-review.googlesource.com/719729
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-13 19:43:01 -07:00
Scott Collyer
35ed69cde8 coral: Remove LED signals from pwm channel list
The GPIO lines for the charger LED are being used as simple on/off and
no PWM control is used. Removed them from the pwm channel list so that
it reflects more accurately what PWM is used for on Coral.

BUG=b:64192049
BRANCH=None
TEST=make -j BOARD=coral

Change-Id: I3546001f96cb01f81fa1c373de28e460b63012c1
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/717187
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2017-10-13 17:22:07 -07:00
Scott Collyer
5436afc8f6 coral: Add support for power LED for Robo devices
Robo devices have a power button LED. For these devices the desried
power button LED behavior is:
S0 -> always on
S3 -> charging, then 500 mSec off, 3 seconds on
S3 -> not charging, always off
S5 -> always off

Because the hook tick runs at 200 msec, using 600 msec for the off
period when blinking in S3.

BUG=b:64015212
BRANCH=None
TEST=Manual
This LED is not connected on EVT, so added a wire on GPIO02 and used a
scope. Verifed that in S0 the signal level is low, and in S3 that it
control signal toggles 600 mSec high/3 sec low. Verifed than in S5
control signal is high.

Change-Id: I72438a009a507fcddaae5a673bf3bc83988f2dd5
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/717183
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2017-10-13 17:22:06 -07:00
Randall Spangler
7d9bd07693 chip/g: Run unrestricted image even if Board ID can't be read
Previously, an error reading Board ID would prevent any image from
running, even a wildcard (unrestricted) image with mask=flags=0 which
would match any Board ID.

Now, if Board ID can't be read, match the image against
type=type_inv=flags=0.  This will match only an unrestricted image.

(This is better than checking directly for an unrestricted image,
because that check is more susceptible to clock-jitter-induced errors.)

BUG=b:67651806
BRANCH=cr50
TEST=Hack read_board_id() to return error.  See that an unrestricted
     image will now boot.

Change-Id: I1071e146b4541e8efd50c8409b8f76012a107731
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/713574
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-10-13 14:45:26 -07:00
Rong Chang
c1afa30794 Revert "hana: disable console input when system is locked"
This reverts commit df12bc1c02.

Reason for revert: the config flag is deprecated and should not use in any project.

Original change's description:
> hana: disable console input when system is locked
>
> Shipped devices were found that batteries could enter ship mode
> unexpectedly. Fail rate is about 5/700pcs per day. Failure happens
> when battery is charged fully and eneters sleep(mem), and then AC is
> plugged out.
> Battery ship mode is entered because ec execute console command
> "cutoff". Still do not know what causes that when no any device
> connected to servo board connector (console TX and RX are floated).
> Enable this config item will cut off route from RX input and fix
> the issue.
>
> BUG=b:67033247
> BRANCH=none
> TEST=with 50 DUTs, flash ec to DUTs and then lock the system, charge
> the battery from about 80% capacity to 100% capacity, close the lid
> for 20 minutes, unplug AC, boot the system, all DUTs boot, no DUT's
> battery enter ship mode. The same test repeats 3 times.
>
> Change-Id: I9939fed1467026bc2d85c645b6ecebae4b6796c6
> Signed-off-by: Chao Ge <chao.ge@bitland.com.cn>
> Reviewed-on: https://chromium-review.googlesource.com/693921
> Commit-Ready: ge chao <chao.ge@bitland.com.cn>
> Tested-by: ge chao <chao.ge@bitland.com.cn>
> Reviewed-by: Rong Chang <rongchang@chromium.org>

Bug: b:67033247
Change-Id: Ide8a3cc8d1eeee9914922d47ec12c44b7d0e9675
Reviewed-on: https://chromium-review.googlesource.com/718237
Commit-Ready: Rong Chang <rongchang@chromium.org>
Tested-by: Rong Chang <rongchang@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
2017-10-13 14:45:22 -07:00
Scott Collyer
c36e313a20 coral: Remove support for ALS since coral devices don't have it
No Coral configurations will contain the ambient light sensor
(ALS). Therefore, no reason to have support for this in the board.c/.h
files.

BUG=b:38271876
BRANCH=eve
TEST=make -j BOARD=coral and verify no errors.

Change-Id: Ib8f6c546d5fb4d0bb8d37e84a62c4725e37be6f5
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/711196
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-10-13 14:45:19 -07:00