Commit Graph

9189 Commits

Author SHA1 Message Date
Nicolas Boichat
43a5152a2e console_output: Clarify help text for CONFIG_CONSOLE_CHANNEL
BRANCH=poppy
BUG=b:35647963
TEST=N/A

Change-Id: I85dd6553cf3ebace4e19813a308d0a024eba2915
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1071412
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-26 00:21:47 -07:00
Nicolas Boichat
5b7c78edd7 test/utils: Fix memchr test
memchr does not take into account end of string, so the test
`memchr("123", '4', 8)` actually does a buffer overflow. On some
boards, a '4' might be found in the 4 bytes that follow "123", and
the test might fail.

Fix another potential overflow as well.

BRANCH=none
BUG=none
TEST=Flash test-utils to hammer, test passes

Change-Id: I53755c0855bbd5b180801e4198341de1cec7b425
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1071409
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-26 00:21:46 -07:00
Vadim Bendebury
c50523e1d1 rma_reset: prepare for expanding for p256 support
This is mostly a clean up and refactoring change, which will make it
easier to extend rma_reset to supporting more EC curves.

BRANCH=none
BUG=b:73296606
TEST=verified that the same secret value is generated on the client
     and server side by running

  ./rma_reset -t
  ./rma_reset -c <challenge generated by the previous command>

Change-Id: I15c010a4a62306bfaa56b97936318854b28a4945
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1073756
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-26 00:21:46 -07:00
Vadim Bendebury
99adc6aca7 rma_reset: allow building with debug options
When invoking make with DEBUG=1 add '-g -O0' to the compiler
invocation to facilitate debugging with gdb.

BRANCH=none
BUG=b:73296606
TEST=verified that building with DEBUG=1 adds '-g -O0' to the compiler
     invocation.

Change-Id: Idd80bd481091b91683200c78fe49dc7e9783a730
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1073755
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-26 00:21:45 -07:00
Furquan Shaikh
1910779d41 it83xx: Add a config option for enabling mouse LDN
Not all boards using ITE83XX use mouse LDN. This change adds a config
option to allow boards to explicity enable this device. Currently,
this device is enabled only for glkrvp_ite and it83xx_evb. It is
disabled for reef_ite and bip.

Change-Id: I7149fd0cb35cc9f49f2b7b80f6c2deefe2edda55
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1070785
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Dino Li <dino.li@ite.corp-partner.google.com>
2018-05-26 00:21:44 -07:00
Furquan Shaikh
c25b78ae02 chip/it83xx: Clean-up ec2i pnpcfg settings
This change gets rid of enum ec2i_setting and reorganizes
pnpcfg_settings into multiple tables each for a logical device that
needs to be configured.

BUG=b:79897267
BRANCH=None
TEST=Verified that bip still boots up.

Change-Id: If7a756640c5e72b8494294495693589aaaa8fe74
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1070486
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Dino Li <dino.li@ite.corp-partner.google.com>
2018-05-26 00:21:43 -07:00
Nicolas Boichat
b5cebbaadb console_channel.inc: Add more ifdef to reduce number of channels
There are still more ifdef than can be added: this just takes out
the low hanging fruits.

BRANCH=poppy
BUG=b:35647963
TEST=make buildall -j, see that we gain from 0 to 64 bytes on many
     boards.

Change-Id: Ibe85b8bfa5d5c22c160e4a6656104256067beee9
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1070948
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-26 00:21:42 -07:00
Nicolas Boichat
920d4bc14b Makefile.rules: Add buildalltests target
In rare cases, it is useful to be able to build tests for all boards:
buildall only builds the main image, but -paladin builders also builds
test cases for each board.

Also remove/fix tests for boards that currently fail.

BRANCH=none
BUG=b:35647963
TEST=make buildalltests -j, wait a long time, tests pass.

Change-Id: Id6d978705a40a2045731cb08ad2ca5d62cc12ebb
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1072218
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-26 00:21:41 -07:00
Nicolas Boichat
5c5eba404c cheza: Add stubs and ifdefs to fix tests
BRANCH=none
BUG=none
TEST=make BOARD=cheza tests -j

Change-Id: Ifec4653bf71b870b616669f0a32ba528c1e38787
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1072217
Reviewed-by: Wai-Hong Tam <waihong@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-26 00:21:41 -07:00
Randall Spangler
d7705eb311 ccd_config: Simplify open and password
Allow setting password from the AP, but not from USB.  Remove the old
password control logic, which is no longer needed.

Allow open if:
- Not explicitly blocked
- Not blocked via FWMP
- One of the following is true:
  - A password is set
  - Battery is removed (also doesn't require physical presence)
  - Dev mode is on, and request came from the AP

Reduces cr50 binary by 152 bytes.

BUG=b:79983505
BRANCH=cr50
TEST=manual, with a CR50_DEV=1 build

	ccd oops
	ccd lock
	ccd unlock -> fails
	gsctool -U -> fails from host
	gsctool -t -U -> fails from AP

	ccd oops
	ccd password foo -> fails from console
	gsctool -P -> fails from host
	gsctool -t -P -> works from AP
	ccd get -> confirms password set

	ccd lock
	ccd unlock foo -> works
	ccd lock
	gsctool -U -> works from host, if correct password supplied
	ccd lock
	gsctool -t -U -> works from AP, if correct password supplied

	ccd open foo -> works
	ccd lock
	gsctool -O -> works from host, if correct password supplied
	ccd lock
	gsctool -t -O -> works from AP, if correct password supplied

	ccd oops
	ccd lock
	(remove battery)
	ccd open -> works without physical presence
	(reattach battery)
	ccd lock
	gsctool -O -> works from host
	ccd lock
	gsctool -t -O -> works from AP, if dev mode is enabled

Change-Id: I364b322d03db250e7dd140767d7a22dbb3ac1eef
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1072957
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-05-25 20:31:57 -07:00
Randall Spangler
b3218b9533 ccd_config: Ccd vendor command takes params struct
This is needed so ccd_open() can see p->flags, for a subsequent
change.  No change to existing command behavior or binary size.

BUG=b:79983505
BRANCH=cr50
TEST=gsctool -I still works

Change-Id: I614d8c410e8bc55a5045e253469b2ec222078684
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1072500
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-05-25 20:31:56 -07:00
Edward Hill
13776ebef9 careena: Change LED colors
Careena has non-PWM White/Orange LEDs.

BUG=b:79704826,b:79894166
BRANCH=none
TEST=make -j buildall

Change-Id: Ie85de84fbd6e4ac4c6139d8407a7a25b5f6d5e7e
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1072898
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-05-25 20:31:50 -07:00
Edward Hill
092e647d99 careena: Make GPIOs match hardware
Update GPIO definitions for Careena to match hardware.

BUG=b:79704826
BRANCH=none
TEST=make BOARD=careena

Change-Id: I755e5fd8123eefdfa8d30ca2314435c28340e488
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1070989
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-05-25 20:31:50 -07:00
Edward Hill
4ab9fc9fa9 grunt: Move common code to baseboard
Move code that will be common to Grunt and Careena to baseboard
to avoid duplication when creating the Careena board.

Add Careena board files. These are currently just a copy of Grunt
and will be modified for Careena next.

BUG=b:79704826
BRANCH=none
TEST=Grunt still boots ok.

Change-Id: I6dd0035bdd62e92a7f3664120fc6ac3f23a0af4d
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1070988
2018-05-25 20:31:49 -07:00
Nicolas Boichat
1d2c13a163 test: Make it possible to run rsa tests on hammer board
BRANCH=poppy
BUG=b:35647963
BUG=b:77608104
TEST=make run-rsa run-rsa3
TEST=make BOARD=hammer test-rsa3, test on board

Change-Id: Id4bd8d5f550dbc6569d88ced114849b3b6411b2f
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1071410
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-24 19:30:22 -07:00
Jett Rink
ae82b79667 sn5s330: disable under voltage protection
We need to disable under voltage protection because it prevents us from
enabling the sink path when there is not Vbus on the connector side. We
need to enable the sink path before we hibernate otherwise there is no
power power to get to the charger which will then assert ACOK. Without
this we won't wake up with the ACOK wake when USB power is inserted.

BRANCH=none
BUG=b:79948623
TEST=bip wakes with USB power insertion

Change-Id: Idf16a92dacde63cf943ef68b0258b320d11de44c
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1070867
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-05-24 19:30:22 -07:00
Daisuke Nojiri
15bddb51eb Nami: Use lid angle to detect tablet mode
Tablet mode entry and exit are detected by a GMR sensor on Akali and
by lid angles on the rest.

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

BUG=b:77298177,b:77754921
BRANCH=none
TEST=make BOARD=nami

Change-Id: I637f7ab6dec779abbb5e7b7355bbbc665c86391d
Reviewed-on: https://chromium-review.googlesource.com/1059936
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2018-05-24 19:30:21 -07:00
Jett Rink
be610f4d63 ps8751: add source and sink path control
PS8751 supports the TCPCI spec for controlling the power source and sink
path, which is done through GPIO0 and GPIO1, respectively, by default.

BRANCH=none
BUG=b:78896495,b:78021059
TEST=verified TCPC drives PPC via reworked yorp board.

Change-Id: Ie1de67495947b787ad9cd5aee0db3ca21bec5a10
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1047796
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-05-24 19:30:20 -07:00
Sam Hurst
dd30481b17 BMI160: EVE TOT divide by 0 error at boot
The BMI160 driver's init function generates a divide by 0 error
by calling config_interrupt before initializing the range defined
in struct accelgyro_saved_data_t. The explicit error is
generated by macro BMI160_TAP_TH that's called in config_interrupt.

BUG=b:80237518
BRANCH=None
TEST=`make -j buildall`
EVE boots from TOT
Signed-off-by: Sam Hurst <shurst@chromium.org>

Change-Id: I8b7a4a7c63c973bcc639779ee54958f3702f1b36
Reviewed-on: https://chromium-review.googlesource.com/1071847
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
2018-05-24 19:30:19 -07:00
Nicolas Boichat
c7aaf471c9 touchpad_elan: Ensure we at least have 1k of shared memory
Debugging commands may request buffers up to that size.

BRANCH=poppy
BUG=b:63993891
TEST=make buildall -j

Change-Id: I6dedfafc4e36d311026f9678e2cac99c85036ce0
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1071311
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-24 19:30:17 -07:00
Nicolas Boichat
3db1b5ffb8 touchpad_elan: Reload watchdog when programming
When using larger block sizes (e.g. 4096 bytes), the write operations
take too long, which often causes a watchdog reset.

Fix this by reloading the watchdog after programming
every 64 bytes page.

BRANCH=poppy
BUG=b:80167548
TEST=Copy old touchpad FW to soraka, build staff, make sure FW
     can be updated.

Change-Id: Ic6e7a3e3ef63877a4f2d5011e1fb0d49c04177a6
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1070952
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-24 19:30:16 -07:00
Jett Rink
89275aff03 octopus: moving hibernate code to baseboard
bip also need to enable the sink path when going into hibernate

BRANCH=none
BUG=b:79948623
TEST=on bip, verfied that AC_OK, LID_OPEN, and POWER_BTN all wake the EC
up.

Change-Id: I2c1168f856cc45635b5c76f7ca409007fcf141cc
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1065203
2018-05-24 15:44:39 -07:00
Jett Rink
4a65a62f85 ppc: making driver non-const
We need to update the driver based on the runtime board id, so we need
to remove the const attribute.

BRANCH=none
BUG=b:78896495,b:78021059
TEST=build all -j

Change-Id: I5f751c33cf4ec68a38aeb8644170df4987c87d7b
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1068030
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-05-24 15:44:30 -07:00
Jett Rink
1c2a9ee49e ppc: flush console regularly during console dump
I noticed data was getting dropped from my console output on
bip. Adding the cflush fixes it.

BRANCH=none
BUG=none
TEST=ppc_dump 0 on bip works

Change-Id: Ib71cb37c4c8728a7ab958905d3b2627b8c163faa
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1070626
2018-05-24 15:44:29 -07:00
Nicolas Boichat
0bf44c2d56 hammer: Remove unnecessary console commands
Saving space in RW, even if we are not critical in terms of size,
always helps to reduce verification time.

BRANCH=poppy
BUG=b:35647963
TEST=make newsize => Hammer shrinks by ~3k, verification time
     down by ~12 ms.

Change-Id: I63741106fdc56c410871fb367c29605bf37f1b77
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1070951
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-24 04:10:05 -07:00
Nicolas Boichat
db24bed78d timer: Allow disabling gettime console command
hammer does not need that command, let's just remove it.

BRANCH=poppy
BUG=b:35647963
TEST=make newsizes, saves 112 bytes of flash

Change-Id: I24ed979f8a9053128d4eb56fc5af00429f7ba0ae
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1070950
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-24 04:10:04 -07:00
Nicolas Boichat
35e278bb41 console_output: Add option to disable console channels
On hammer, we do not need the console channels, so we can just
disable them to save flash size.

BRANCH=poppy
BUG=b:35647963
TEST=make newsizes, staff image size shrinks by 704 bytes

Change-Id: I7a493ae57573814b166d45e57f1ad3d885f26086
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1070949
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-24 04:10:04 -07:00
Raul E Rangel
336be87591 grunt: Add support for flashing via Suzy-Q and servo
When grunt is connected via a Suzy-Q cable, it can only be flashed using
npcx_uut. Also when grunt is connected via a servo it shouldn't try to
use npcx_uut, but instead use npcx_spi. This change allows a board to
show up in multiple BOARDS_XXX lists. If there are multiples, it will
either look at the --chips flag, or it will check the VALID_CHIP_COMBO
array to see if chip is valid for the servo type.

BUG=b:77927814
BRANCH=none
TEST=Tested each leg of the logic by changing parameters and variables.
Tested using Suzy-Q: ./util/flash_ec --board=grunt
Also tested using ServoV2: ./util/flash_ec --board=grunt

Change-Id: I7068b5bab0cf20bd2d9ffdd3842a58df1f2f8810
Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1044499
Commit-Ready: Martin Roth <martinroth@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
2018-05-24 00:23:13 -07:00
Todd Broch
895b8a9032 nami: Enable auto toggle/low power mode for standalone tcpcs
With the changes made to tcpci for alert handling and low power mode
entry, the anx7447 can operate with auto toggle and low power config
options.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BUG=b:77544959
BRANCH=none
TEST=Verfied that low power mode is entered when nothing is attached
and that when an adapter is attached it connects and when removed
returns to low power mode.

Change-Id: I9c683c3f86ba98e55748ac355b3d4845799d89e5
Reviewed-on: https://chromium-review.googlesource.com/1049061
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: YH Lin <yueherngl@chromium.org>
2018-05-24 00:23:12 -07:00
Furquan Shaikh
0d47794e6c chip/it83xx: Configure IRQTP for KBC when using eSPI
SERIIRQ# is by default deasserted level high. However, when using
eSPI, SERIRQ# is routed over virtual wire as interrupt event. As per
eSPI base spec (doc#327432), all virtual wire interrupt events are
deasserted level low. Thus, it is necessary to configure this
interrupt as inverted. ITE hardware takes care of routing the SERIRQ#
signal appropriately over eSPI/LPC depending upon the selected mode.

BUG=b:79897267
BRANCH=None
TEST=Verified using evtest that keypresses are properly identified on
the OS side.

Change-Id: Ie3b92f20fa915ba8f17dcbcb600ebfe5cbfb4d57
Signed-off-by: Dino Li <dino.li@ite.corp-partner.google.com>
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1069570
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-05-23 20:35:15 -07:00
Randall Spangler
57ed31bcc5 cr50: pass params to vendor commands as struct
This makes it easier to add params or flags for vendor commands
without changing all of the command handlers.  It also reduces code
size by 56 bytes.

For now, existing command handlers continue to use
DECLARE_VENDOR_COMMAND().  Added DECLARE_VENDOR_COMMAND_P() for
handlers which take the params struct directly.  The CCD command will
be the first user of that, since it will have different rules for
'open' based on where the command comes from.

No change to existing command behavior.

BUG=b:79983505
BRANCH=cr50
TEST=gsctool -I still works

Change-Id: I7ed288a9c45e381162e246b50ae88cf76e67490d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1069538
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-05-23 20:35:12 -07:00
Randall Spangler
f07e300fe4 cr50: tpm_alt_extension() specifies command origin is USB
Previously, calls to tpm_alt_extension() were treated as if they came
from the AP via the TPM interface, even though they actually
originated from the cr50 console, which is accessible via the USB
interface.

This affects the following console commands:

spi_hash - was already allowed as both a safe console command and via
the USB vendor command interface.  No change.

rma_auth - was allowed as a safe console command, but not via the USB
vendor command interface.  Now allowed from both.  No change in
security, since anyone could already do it via the console.
Unfortunately, getting a challenge fails because commands issued via
the USB vendor command interface have a maximum payload of 32 bytes
and the challenge is bigger than that; that's tracked in b:80098603.

ccd - was already allowed as a safe console command.  This directly
called ccd_command_wrapper() for lock, open, and password subcommands.
It made an extra check for password set for the unlock subcommand.
Moved the unlock check to the vendor command handler.  Also changed
the order of checks so that FWMP disabling unlock and open supersedes
an existing password; this matches go/ccd-open-simple.  (That has no
effect on existing systems, because CCD is disabled at a higher
level.)

Reduces code size by 8 bytes.

BUG=b:79983505
BRANCH=cr50
TEST=manual, on a CR50_DEV=1 build
	Compile with DEBUG_EXTENSION defined to print extra debug output
	'ccd lock' now shows as coming from USB
	'ccd unlock' fails because no password is set
	'ccd unlock' and 'ccd open' fail if FWMP disallows unlock
	'rma_auth' prints a challenge
	'gsctool -t -r' prints a challenge from AP root shell
	'gsctool -r 12345678' returns error 6 (incorrect challenge), rather
	     than error 127 (no such command).
	'gsctool -I' works from the host
	'gsctool -t -I' still works from AP root shell

Change-Id: I2cd1027f5135b9c336df97ee4b1b1a15354728b4
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1068102
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-05-23 20:35:12 -07:00
Vijay Hiremath
7784fba59d APL/GLK: Clean up UART buffer before shutdown
UART buffer gets overwritten by other tasks if it is not explicitly
flushed before printing it on the console by same task. Hence, clean
up the UART buffer so that all the debug messages are printed on the
UART console before doing shutdown.

BUG=b:79950369
BRANCH=none
TEST=Manually tested on BIP, observed that UART logs are not lost
     on the terminal when apshutdown is issued.

Change-Id: I420e9de9e2e71913ee3168267a6f3a2728b2690b
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/1064977
Commit-Ready: Vijay Hiremath <vijay.p.hiremath@intel.corp-partner.google.com>
Tested-by: Vijay Hiremath <vijay.p.hiremath@intel.corp-partner.google.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-05-23 16:47:50 -07:00
Edward Hill
6a2939005d genvif: Allow usb_pd_policy.c only in baseboard
Update rules for util/genvif to allow usb_pd_policy.c to be present
in just baseboard, or just board, or both.

BUG=b:78638238,b:79704826
BRANCH=none
TEST=make -j buildall

Change-Id: I4e2970a65c131d0681d2159fe2ea18b2639048c9
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1067751
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-05-23 16:47:49 -07:00
Jett Rink
c4387539f6 cleanup: make has_dut_i2c_mux check similar to other checks
BRANCH=none
BUG=none
TEST=flash on bip using new check

Change-Id: I32266554e090c80bdd9078c06cfa78512d5965ea
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1060589
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2018-05-23 16:47:47 -07:00
Jett Rink
36d59f752f yorp: add keyboard backlight control
Enable PWM control of backlight in EC for yorp and phaser. Proto build
of bip will not have backlight control in EC.

BRANCH=none
BUG=b:79422226
TEST=none (no hardware to test with)

Change-Id: Ib6ed4af4de3145b112ed43b4ca1ec9f931f3875f
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1050785
Reviewed-by: Justin TerAvest <teravest@chromium.org>
2018-05-23 12:50:54 -07:00
Jett Rink
535c0bf4fa cleanup: remove transition code for LPC/ESPI cleanup
BRANCH=none
BUG=chromium:818804
TEST=full stack works with lpc and espi

Change-Id: I371e993bc97e7e87fb1075cf3dba82082402c0cf
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1067504
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-23 09:13:50 -07:00
Jett Rink
4d23d995c3 espi: rename remaining eSPI options
Change prefix from CONFIG_ESPI to CONFIG_HOSTCMD_ESPI for consistency.

BRANCH=none
BUG=chromium:818804
TEST=Full stack builds and works on yorp (espi) and grunt (lpc)

Change-Id: I8b6e7eea515d14a0ba9030647cec738d95aea587
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1067513
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-23 09:13:49 -07:00
Jett Rink
11bd4c0f4d bip: enabled PPC interrupts
Need to enable PPC interrupts, otherwise system doesn't work correctly
include USB 2.0 not working (since the BC1.2 chip won't be powered after
the Vbus change)

BRANCH=none
BUG=b:79886742
TEST=USB 2.0 works on insertion on C0 on bip

Change-Id: I227dcfac22128389c3d3ab3efdddd045141dff7e
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1066221
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-05-22 21:57:16 -07:00
scott worley
4f27014532 ec_chip_mchp: Expand data SRAM to 64KB.
Observed task stack sizes growing, especially PD related.
Adjust chip configuration for 64KB data.
Use RAM size config items in flash layout config items.
Update SPI image generator python script to not add
a Boot-ROM header to EC_RW and add a test mode for debugging
SPI read and hash calculations.

BRANCH=none
BUG=
TEST=Build boards based on chip mchp. Check RO and RW
EC binaries are correct size and located properly in
ec.bin
CQ-DEPEND=CL:1036258,CL:1053576

Change-Id: I12709a434d5aaa84fabe459176a3423365343308
Signed-off-by: scott worley <scott.worley@microchip.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/1053948
Commit-Ready: Randall Spangler <rspangler@chromium.org>
Tested-by: Scott Worley <scott.worley@microchip.corp-partner.google.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-22 21:57:13 -07:00
Vadim Bendebury
2531d57871 util: do not generate redundant CROS_EC_VERSION
The values of CROS_EC_VERSION and VERSION variables generated by
getversion.sh are exactly the same. VERSION is used in more places
than CROS_EC_VERSION, let's keep VERSION and use it everywhere.

BRANCH=none
BUG=chromium:632937
TEST=make buildall

Change-Id: Ibec9ecdd4b67789a468dddfbc1c82565f90d48a8
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1069330
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-22 21:57:12 -07:00
Randall Spangler
9df26ce0f2 cr50: Refactor tracking vendor command origin
Added flags parameter to extension_route_command().  The caller now
specifies whether the command comes from the USB interface or the AP.

Moved USB-specific shuffling of response to embed result code into
usb_upgrade.c, so extension_route_command() can be more generic.

No change to permissions/behavior for existing commands.
ccd_command_wrapper() still sends vendor commands as if they come from
the AP.  That's fixed in the next CL.

Reduces code size by 128 bytes

BUG=b:79983505
BRANCH=cr50
TEST=manual
	Build with DEBUG_EXTENSION defined, to turn on printing each command
	'ccd lock' comes from AP and works
	From host, 'gscutil -I' comes from USB and fails
	From AP, 'gscutil -t -I' comes from AP and works

Change-Id: I7136bb54073de9c5951a174c308151b1871c56f3
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1068101
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-05-22 21:57:12 -07:00
Philip Chen
4ec57f1409 chip/stm32/clock: Initialize 'alarm_us'
The new GCC build shows a warning/error in clock-f.c:

'alarm_us' may be used uninitialized in this function
[-Werror=maybe-uninitialized]

This is actually a fake warning. In the context of the logic,
there is no way 'alarm_us' would be used uninitialized.

But let's still initialize 'alarm_us' to clear the compiler warning.

BUG=none
BRANCH=scarlet
TEST='USE=coreboot-sdk emerge-scarlet chromeos-ec'
TEST=make buildall -j

Change-Id: I7a0642cbe03c5a0adb6997ddc80c9cb797715749
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1068256
Commit-Ready: Martin Roth <martinroth@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Tested-by: Martin Roth <martinroth@chromium.org>
Reviewed-by: Martin Roth <martinroth@chromium.org>
2018-05-22 21:57:11 -07:00
scott worley
038e75cd85 ec_chip_mchp: Clear ADC sticky hardware status before starting.
Before starting an ADC conversion clear sticky hardware status
in ADC and interrupt aggregator.

BRANCH=none
BUG=
TEST=Build boards using chip mchp and check for spurious
ADC interrupts.
CQ-DEPEND=CL:1053576

Change-Id: I48b07ecaac2976c5e06e23a4ecf4397ed41c89d1
Signed-off-by: scott worley <scott.worley@microchip.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/1053867
Commit-Ready: Randall Spangler <rspangler@chromium.org>
Tested-by: Scott Worley <scott.worley@microchip.corp-partner.google.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-22 21:57:09 -07:00
scott worley
a63b30e6de ec_chip_mchp: Lower UART interrupt priority.
Reduce UART interrupt priority to not interfere with
critical interrupts. WDT highest, GPIO & other HW,
UART, Port80(lowest).

BRANCH=none
BUG=
TEST=Build boards based on chip mchp.
CQ-DEPEND=CL:1053576

Change-Id: I293132fce46cc460d1cf51abacf4b6a494c8c4a3
Signed-off-by: scott worley <scott.worley@microchip.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/1053873
Commit-Ready: Randall Spangler <rspangler@chromium.org>
Tested-by: Scott Worley <scott.worley@microchip.corp-partner.google.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-22 21:57:06 -07:00
scott worley
67ed6ee3e7 ec_chip_mchp: Fix bug in GPIO interrupt handling.
The previous chip level GPIO itnerrupt change introduced
a bug in calculation of the gpio table index. Bug only
manifested if GPIOs in different banks were configured
for interrupts.

BRANCH=none
BUG=
TEST=Configure board with at least one GPIO interrupt
per bank. Check proper handler is called when pin
interrupt is triggered.
CQ-DEPEND=CL:1053576

Change-Id: I9dd5d18be5f9df0e338e76b072fb82ed2df3e2de
Signed-off-by: scott worley <scott.worley@microchip.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/1053827
Commit-Ready: Randall Spangler <rspangler@chromium.org>
Tested-by: Scott Worley <scott.worley@microchip.corp-partner.google.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-22 21:57:04 -07:00
Jett Rink
b34a5973cd cleanup: add comment to CONFIG_BATTERY_REVIVE_DISCONNECT
When you define CONFIG_BATTERY_REVIVE_DISCONNECT you also need to define
battery_get_disconnected_state method()

BRANCH=none
BUG=none
TEST=none

Change-Id: I0ab42c722e2511cbfa50cab2142baec0906d8263
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1055819
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-05-22 21:57:03 -07:00
scott worley
f62376ade4 ec_chip_mchp: Lower Port80 interrupt priority.
Prevent host spew of port 80h writes from impacting
servicing more critical interrupts.

BRANCH=none
BUG=
TEST=Build boards based on chip mchp.
CQ-DEPEND=CL:1053576

Change-Id: I3e08d2f731fa644c3e3253cbca711e1116789b41
Signed-off-by: scott worley <scott.worley@microchip.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/1053949
Commit-Ready: Randall Spangler <rspangler@chromium.org>
Tested-by: Scott Worley <scott.worley@microchip.corp-partner.google.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-22 21:57:00 -07:00
Jett Rink
8f6fff795b lpc/espi: convert remaning CONFIG_LPC to CONFIG_HOSTCMD_X86
We have converted all LPC-only configs to HOSTCMD_LPC so the remaining
CONFIG_LPC defines represent the common case.

BRANCH=none
BUG=chromium:818804
TEST=Full stack builds and works on yorp (espi) and grunt (lpc)

Change-Id: Iba9a48f2cab12fadd0d9ab8eab0d5d5476eab238
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1067503
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-22 21:56:40 -07:00
Jett Rink
df06639b1d lpc/espi: convert ec chip code to use granular option
Break the ec chip code up with the more granular
CONFIG_HOSTCMD_(X86|LPC|ESPI) options.

BRANCH=none
BUG=chromium:818804
TEST=Full stack builds and works on yorp (espi) and grunt (lpc)

Change-Id: Ie272787b2425175fe36b06fcdeeee90ec5ccbe95
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1067502
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-22 21:56:39 -07:00