Commit Graph

8887 Commits

Author SHA1 Message Date
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
Daisuke Nojiri
ae135d37f3 Nami: Control LEDs for Nami/Vayne/Sona
Nami/Vayne uses a dual color LED to show power/charge status as follows:
Charging              Amber on (S0/S3/S5)
Charging (full)       White on (S0/S3/S5)
Discharge in S0       White on
Discharge in S3/S0ix  Pulsing (rising for 2 sec , falling for 2 sec)
Discharge in S5       Off
Battery Error         Amber on 1sec off 1sec

Sona - Battery LED (dual color)
AC is attached    Solid ON White
charging          Solid ON Amber
Discharge in S0   Off
Battery Error     Blinking white (0.5 sec On and 0.5 sec Off)
Discharge in S3   Blinking white (1 sec On, 1 sec off regardless AC status)
fuel < 10%        Blinking white (1 sec On, 1 sec Off)

Sona - Power LED (single color)
System S0         Soliid On
System S3         1 second on, 1 second off
System S4/S5      Off

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

BUG=b:74940319,b:77941051,b:73999799
BRANCH=none
TEST=Verify LED behaviors in S3, S0, charge, discharge on Nami and Sona

Change-Id: I55b40742135a49f48044f561eb2dbd82b5556d07
Reviewed-on: https://chromium-review.googlesource.com/1011293
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-18 09:30:34 -07:00
Nick Sanders
ee7850b50f ec3po: console: Detect HUP from user console
ec3po writes to the user pty, which may or may not be open.
Since ptys have limited buffer space, we need to avoid
writing to them if they will never be drained.

ec3po now looks for HUP to indicate whether the pts is opened
or closed, and reads/writes accordingly.

BRANCH=None
BUG=b:76111225
TEST=dut-control ec_board:fizz x 400

Change-Id: Icbecb2e42b261659a006eb1b9fc6dd73490a2218
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1014792
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-04-18 09:30:34 -07:00
Aseda Aboagye
b107af470e isl923x: Add 'charger_dump' console command.
This commit adds an optional console command that will dump the contents
of the battery charger IC registers.  Currently, the only chargers
supported are the BD9995x as well as the ISL923x.

BUG=None
BRANCH=None
TEST=Enable on meowth; Flash; Verify that the command works without any
issues.

Change-Id: I2221efe0ed6e0f6063c97547e0da2d775bf4da45
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1016004
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-04-18 02:08:11 -07:00
CHLin
6f8c010eb5 npcx7: uart: Add FIFO mode support
NPCX79nxB chips add UART FIFO support with 16-bytes of TX/RX buffers.
This CL enables the UART FIFO mode when NPCX79nxB chips are used.

The UART interrupt priority is decreased from 1 to 4 because now it has
the capability to buffter data in the FIFO when ec is serving the
interrupts with higher priority.

BRANCH=none
BUG=none
TEST=No build errors for make buildall.
TEST=stress test the uart port by shell command "while true; do echo
'taskinfo'>/dev/pts/19; sleep 0.1; done".

Change-Id: Ib09c1b5550d0db249201fc4fdd8d3b28c24b8a8e
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/1012002
Commit-Ready: CH Lin <chlin56@nuvoton.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-04-18 02:08:10 -07:00
CHLin
dcaf8edc47 util: uartupdatetool (UUT): Add tool to flash firmware by UART
When the FLPRG# strap pin is set to active low, and npcx7 chip is reset,
it will enter uut mode. This CL adds the host tool to communicate with
npcx chip in uut mode to flash ec firmware via UART port.

BRANCH=none
BUG=none
TEST=No build errors for make buildall.
TEST=
------------------------------------------------------------------------
1. Connect the servo connector (J24) on npcx7 EVB to servo board v2 via
flex cable.
2. Manually turn the switch SW1.6 to "ON" on npcx7 EVB.
3. Reset ec by issuing Power-Up or VCC1_RST reset.
4. Manually turn the switch SW1.6 to "OFF" on npcx7 EVB.
5. Move npcx7_evb from array BOARDS_NPCX_7M7X_JTAG to BOARDS_NPCX_UUT in
flash_ec.
6. "./util/flash_ec --board=npcx7_evb."

Change-Id: I2c588418e809e59f97ef4c3ad7ad13a3fef42f11
Signed-off-by: Dror Goldstein <dror.goldstein@nuvoton.com>
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/952037
Commit-Ready: CH Lin <chlin56@nuvoton.com>
Tested-by: Alexandru M Stan <amstan@chromium.org>
Tested-by: CH Lin <chlin56@nuvoton.com>
Tested-by: Raul E Rangel <rrangel@chromium.org>
Reviewed-by: Raul E Rangel <rrangel@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-18 02:07:59 -07:00
Wai-Hong Tam
b21f335c40 cheza: Lower the I2C speeds on TCPC buses to 400kHz
The initial I2C operating speed of the port-0 TCPC chip is 400kHz.
It requires changing a register addr:0x48 to a value 0x03 to increase
its speed to 1MHz.

The BC1.2 chips on port-0 and port-1 also operate at 400kHz, according
to the datasheet.

So lower the I2C speeds on two TCPC buses to 400kHz.

BRANCH=none
BUG=b:78142256
TEST=Use console to enable TPCP power and check I2C communication:
> gpioset EN_USB_C0_TCPC_PWR 1
> gpioset USB_C0_PD_RST_R_L 1
> i2cscan 1
Scanning 1 tcpc0......................................
0x4a...
0x50........................
0x80...............................................................
> i2cxfer r 1 0x50 0x00
0xaa [170]

Change-Id: I665136d738de50db8beeed338e3102fb5ca6fc84
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1015763
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
2018-04-17 23:34:41 -07:00
Jett Rink
8f1657aa39 yorp: do not wait for 5V rail to go down
After using joint 5V rail code (CONFIG_POWER_PP5000_CONTROL) we cannot
wait for the 5V rail to go down because another task may be using it.

BRANCH=none
BUG=b:78188213
TEST=apshutdown on yorp no longer watchdog resets

Change-Id: Ibc7e3eb2f7b3271fccd6ef0d92cce156c20bd688
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1015845
Reviewed-by: Justin TerAvest <teravest@chromium.org>
2018-04-17 20:53:15 -07:00
Vadim Bendebury
f929c8202b cr50: prepare to release prepvt 0.4.5
BRANCH=cr50
BUG=none
TEST=none

Change-Id: Ieb8eef7d64ee22a8ba04f0b09f22d04387042b45
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1015631
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-04-17 20:53:05 -07:00
Wai-Hong Tam
80cfa588ec cheza: Add initial support for Cheza
Add initial support, like UART, GPIO, I2C, buttons, etc.
Add some hacks for early bring-up.

BRANCH=none
BUG=b:74395451
TEST=BOARD=cheza make
TEST=Flashed the EC image to cheza. Verified AP power-on, booting
coreboot/depthcharge with UART, and then booting kernel from USB.

Change-Id: Id057abb491553bbffd3c57a6f48187ac2f2ff9a6
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/969420
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
2018-04-17 15:47:21 -07:00
Jett Rink
2e7e6665b1 yorp: increase TCPC i2c bus speed
BRANCH=none
BUG=b:74387239
TEST=i2cscan and USB-C ports still connect on yorp

Change-Id: Ic76549d6f81536cf02e1aa858a95e67eb528bccd
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1014704
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
2018-04-17 15:47:19 -07:00
Justin TerAvest
6d5cccefa0 yorp: Keep 5V rail high on jump to RW
The BQ24392 driver controls power on the PP5000_A rail so that BC1.2
detection can be performed when the AP is off. However, that rail is
also controlled by the chipset task, so CONFIG_POWER_PP5000_CONTROL
needs to be defined to keep 5V rail up when necessary.

Calls to power_5v_enable() must only be done when the build has a
chipset task (otherwise, that function is not defined).

BRANCH=none
BUG=b:77874283
TEST=Booted Yorp with software sync enabled

Signed-off-by: Justin TerAvest <teravest@chromium.org>
Change-Id: Ib75655944aa05e381da922da8e916dc5d4dd9f85
Reviewed-on: https://chromium-review.googlesource.com/1014397
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-17 04:02:24 -07:00
Caveh Jalali
ab94e7ac45 flash_ec: fail on flash chip size of 0
flashrom --get-size seems to return a size of 0 in some failure cases.
add specific handling of this case so we don't proceed and end up
failing with a somewhat misleading message like:

Error: Image size doesn't match: stat 524288 bytes, wanted 1048576!

BUG=none
BRANCH=none
TEST=flashrom now fails with "chip size is 0" instead of complaining
	about wanting a 1048576 byte image.

Change-Id: Iab4d0843d86ceec9f0ca482d9e060a33c7a58c7a
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1011823
Commit-Ready: Caveh Jalali <caveh@google.com>
Tested-by: Caveh Jalali <caveh@google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-04-17 00:47:08 -07:00
Philip Chen
fc006560c1 charger/rt946x: Set precharge threshold voltage
Let's explicitly set VPREC as voltage_min in battery info,
instead of relying on the default reg value.

BUG=b:78124353
BRANCH=scarlet
TEST=read reg 0x08, confirm VPREC field matches voltage_min

Change-Id: I1f8d414b5fd5319b15c3ead031a24a258a325536
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1014416
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: David Schneider <dnschneid@chromium.org>
2018-04-17 00:47:03 -07:00
Philip Chen
8bc71d174d charger/rt946x: Fix IPREC mask
The IPREC mask is wrong.
So when we write IPERC ([3:0] in reg 0x08), we clear VPREC ([7:4])
mistakenly.

BUG=b:78124353
BRANCH=scarlet
TEST=read reg 0x08, see VPREC is not clear after we write IPREC

Change-Id: Ic51a974f9d98beb8c264d4038e6b7117a42640c1
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1013156
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: David Schneider <dnschneid@chromium.org>
2018-04-17 00:47:02 -07:00
Mary Ruthven
c40bb886e9 cr50: add s3 term for rk3399 devices
BUG=b:62200096
BRANCH=cr50
TEST=run suspend/resume tests on bob

Change-Id: Idb249125f5967f6f9c80afbf991998425f9f5005
Signed-off-by: Mary Ruthven <mruthven@google.com>
Reviewed-on: https://chromium-review.googlesource.com/991339
Commit-Ready: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-04-16 21:26:45 -07:00
Vijay Hiremath
867a567229 glkrvp_ite: Initial bring-up code
Initial bring-up code for GLKRVP using ITE8320 MECC.

BUG=b:77798195
BRANCH=none
TEST=Able to boot to OS with host communication disabled
     Coreboot image.

Change-Id: Iad0e22c9e7ef1c36889ef5e7f7e3f5a121f234e1
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/1003766
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-14 12:46:59 -07:00
Mary Ruthven
cfcac78e62 cr50: add support for enabling terminations on ap suspend
rk3399 systems need terminations on the SPI signals in S3 and all other
low power states. Add support for enabling the pulldowns and pullups on
the correct pins.

With this change, if BOARD_NEEDS_S3_TERM is set in the board properties,
cr50 will enable a pulldown on the AP TX Cr50 RX signal and a pulldown
on all of the SPS signals. To keep the pulldowns from interfering with
the sps peripheral, s3_term will also disable the input for those
signals.

BUG=b:62200096
BRANCH=cr50
TEST=Flash onto bob. Make sure cr50 enables and disables terminations
when the AP suspends/resumes. Flash onto reef. Make sure it doesn't do
anything.

Change-Id: I4adaf6d66160bab1eb3cf3d343d4a79524ccf883
Signed-off-by: Mary Ruthven <mruthven@google.com>
Reviewed-on: https://chromium-review.googlesource.com/991338
Commit-Ready: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-04-13 21:37:47 -07:00
Nicolas Boichat
cdc9d41761 poppy: Prevent base detection from falling into reverse detection trap
The problem here is that both normal detection range (120-300mV)
and reverse connection detection range (450-500mV) are on the same
side of the interrupt pin TTL level.

So if we accidentally sample the ADC at the wrong time (either on
connection, or after a side-band wake signal from base), we may
fall into a trap where we assume that the base is connected in
reverse, while the value may just be a transient.

We have seen this case in the field, due to side-band wake pulse
from base EC, but this could potentially happen on attach as well.

The code debounces the reverse detection signal a little longer
(this has no impact as the base is not functional anyway), so that
we only consider that the base is connected in reverse if the ADC
value is within the range twice in a row.

BRANCH=poppy
BUG=b:77828249
TEST=With HACK CL to emulate bug:
 - Press a few keys, hammer gets disconnected
 - Connect/disconnect hammer a few times, sometimes it does not
   get disconnected.
TEST=Base connection, normal and reverse, still works properly.

Change-Id: I2ccb911472dd591146e3b0e68400c8bd55368dba
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1010044
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-04-13 21:37:33 -07:00
Daisuke Nojiri
36ce967fce Nami: Enable Analogix USB-C port
Auto-toggling is currently disabled due to b/77544959.

BUG=b:73793947
CQ-DEPEND=CL:988414
BRANCH=none
TEST=Boot Nami. Verify PD power is negotiated and bettery is charged
with a Zinger through the Analogix port.

Change-Id: Ie817883027eb8623a8115aa8194fe4df50c3ce72
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/969989
Reviewed-by: Scott Collyer <scollyer@chromium.org>
2018-04-13 18:45:37 -07:00
Jett Rink
7824f5656d yorp: use cbi for board version
Replace ADC-based board version with CBI/EEPROM board version. This will
cause all of the existing boards to report -1 (or 65535) as their
board version until you can update it from the kernel.

To set your board version to 0 run the following command in
the AP console when WP if off (e.g. battery removed)

$ ectool cbi set 0 0 1 2

BRANCH=none
BUG=b:77551185,b:77900842
TEST=wrote to cbi from ap console and verify flash state on
ap and ec console

Change-Id: I03987cc89ca4c14580dcf61de23780fe5304663b
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1008832
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2018-04-13 13:25:29 -07:00
Scott Collyer
133fe0668c yorp: Add support for Sanyo battery
Currently we only support the Acer LG and Panasonic battery. There is
a 3rd Acer battery type that Quanta could be providing us with for
Yorp proto boards. This CL adds support for the Sanyo battery.

BUG=b:74132235
BRANCH=none
TEST=verifed that when connected to Sanyo battery that the battery is
reported as present.

Change-Id: I1810da59866795e93340163216412441be098795
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1011557
Commit-Ready: Jett Rink <jettrink@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-13 13:25:19 -07:00
Scott Collyer
1e677d3f32 anx7447: Add functions to the anx7447 driver to check/erase OCM flash
This CL adds support to check if the OCM flash is erased and if not,
will erase it at initialization time. These changes are encapsulated
in a new config option CONFIG_USB_PD_TCPM_ANX7447_OCM_ERASE and this
option is enabled for Yorp boards.

BUG=b:77658388
BRANCH=NONE
TEST=make -j buildall. Tested on a board that hadn't yet been
erased. Verifed the message
"anx7447: OCM flash checked and successfully erased"
was in the EC log, but did not show up on subsequent reboots.

Change-Id: I660e76a9498d3dc1ba821a04317b324f716c5089
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/988414
Commit-Ready: Jett Rink <jettrink@chromium.org>
Tested-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-04-13 13:25:13 -07:00
Mark Hayter
4bfde23411 Documentation for CCD and servo_micro
Add markdown documentation (from reviewed doc) for the Servo Micro as
an example of CCD.

Tested with emacs markdown preview (markdown package) which is almost
the same as gitiles.

BUG=none
BRANCH=none
TEST=emacs markdown preview
Signed-off-by: Mark Hayter <mdhayter@chromium.org>

Change-Id: Ic5877a3b80313089ab9c79e376b4ee1f58e573eb
Reviewed-on: https://chromium-review.googlesource.com/996893
Commit-Ready: Mark Hayter <mdhayter@chromium.org>
Tested-by: Mark Hayter <mdhayter@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
2018-04-13 01:43:28 -07:00
Vijay Hiremath
f1127f6d96 it83xx: Add eSPI virtual wires for SMI & SCI
eSPI virtual wires for SMI & SCI are missing in ITE chip code,
added them to avoid compilation error if ESPI config is enabled.

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

Change-Id: Ibfceb3d0fff56ccb145358a776cf76e45d92a311
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/1009110
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>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Dino Li <Dino.Li@ite.com.tw>
2018-04-13 01:43:26 -07:00
Dino Li
c2927f7dbb cleanup: it83xx: pull pnpcfg_settings[] to the chip-level
With this change, we don't need to declare pnpcfg_settings[]
for each it83xx based board.

BUG=b:76022972
BRANCH=none
TEST=make buildall -j, boot to kernel on reef_it8320.

Change-Id: I39eb465ba7d6191dce4ab1a39787a2c925ec3b91
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/1009544
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-12 23:10:59 -07:00
Jett Rink
4338ec527c cbi: always refersh data for cbi ec command
Also updated the description of the cbi command in help

BRANCH=none
BUG=none
TEST=wrote directly to flash and verified the cbi command updated

Change-Id: I54b5d995a0f06b9566622a5079da11ce575fb309
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1008831
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-04-12 18:03:07 -07:00
Mary Ruthven
69d3059d76 flash_ec: fix UART bitbang flashing with ccd
Cr50 is pretty slow to update it's ccd state right now. Add some delays
when flashing devices using uart bitbang, so cr50 will have enough time
to enable bitbang and configure the uarts correctly.

Also add some commands to cleanup to cleanup the cr50 state.

BUG=b:77825616
BRANCH=none
TEST=run util/flash_ec using ccd on reef and scarlet.

Change-Id: I1c84e36c9bb290c49fd15971c7f61f9e1151a424
Signed-off-by: Mary Ruthven <mruthven@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1006484
Commit-Ready: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-04-12 18:03:06 -07:00
Nick Sanders
2dcd5c19c1 flash_ec: add more verbose options
Print stm32mon command in verbose mode.

BUG=None
BRANCH=None
TEST=it prints

Signed-off-by: Nick Sanders <nsanders@chromium.org>

Change-Id: I4b31d1212c139f64e34e92fa0def662202aa3b41
Reviewed-on: https://chromium-review.googlesource.com/1004436
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-04-12 18:03:03 -07:00
Vincent Palatin
92503e0f7f nocturne_fp: add flashing configuration
Declare it in the proper category for flash_ec

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

BRANCH=poppy
BUG=b:77836478
TEST=./util/flash_ec --board=nocturne_fp

Change-Id: If5b9882bb919505c724d4536521b57279a6a302b
Reviewed-on: https://chromium-review.googlesource.com/1009842
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Nicolas Norvez <norvez@chromium.org>
2018-04-12 15:22:27 -07:00
Vincent Palatin
ce02b59656 stm32mon: terminate gracefully when failing to get commands list
When the CMD_GETCMD transaction fails, terminate immediately rather than
continuing and crashing when we use later the uninitialized 'erase'
function.

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

BRANCH=none
BUG=b:77825616
TEST=flash Scarlet EC through CCD.

Change-Id: Ia40107fe27d81fdb9ee8220f73f4215d936a41c1
Reviewed-on: https://chromium-review.googlesource.com/1006595
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-04-12 07:59:48 -07:00
Caveh Jalali
5b521e3ac6 atlas: manage USB-C high speed muxes
this adds control over the USB high speed muxes as a function of DP
HPD.  this allows an external monitor to be added/removed with
chromeos extending the display as appropriate.

BUG=b:77151172
BRANCH=none
TEST=chromeos detects external monitor plugin and extends display

Change-Id: I7df7a8136ddaa4eeaca800d29b46350dafd8f838
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1009208
Commit-Ready: Caveh Jalali <caveh@google.com>
Tested-by: Caveh Jalali <caveh@google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
2018-04-12 01:25:33 -07:00
Divya Sasidharan
36df8427f4 yorp: Configure CONFIG_EXTPOWER_DEBOUNCE_MS
Without this configuration defined the board assumes
battery only mode for G3->S5 boot up power sequence and
thereby waits for power button press.

BUG=b:76230069;b:75974377
BRANCH=None
TEST=On yorp, with battery and external power connected
reboot on EC console boot the SoC to S0. Verify on both ports.

Change-Id: I837b7f99bd3c238ce74e394c773169d703ad9392
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/1008247
Commit-Ready: Aaron Durbin <adurbin@chromium.org>
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-11 22:52:42 -07:00
Vadim Bendebury
a696908bf3 cr50: substitute RMA keys when signing for prod
A recent codebase change included the test RMA reset server public key
in the Cr50 image by default.

Prod images must not include the test key, and luckily recent
modifications of the cr50-codesigner utility allow to swap the keys
before signing. This patch adds the command line option for swapping
the keys and a check to ensure that the signed image includes the
prod key and does not include the test key.

Note that cr50-codesigner would fail to sign if the swap was requested
but the test RMA key was not found in the input .efl file. Thus both
conditions are verified: that the original image includes the test key
and that the signed image includes the prod key.

BRANCH=none
BUG=b:73296144
TEST=prod signed an image, verified that it can be RMA reset using the
     prod RMA reset server.

Change-Id: Ic084d0c5e1de9f027db05c63f82542c2b7cbd916
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1000756
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-04-11 20:28:00 -07:00
Divya Sasidharan
7abf83842a yorp: Disable config for DRP_AUTO_TOGGLE
Since there are known issues with ANX7447 driver to work
reliably in low power mode, disable DRP_AUTO_TOGGLE option
since TCPC_LOW_POWER mode config and this one should be disabled
together.

BUG=b:77544959
BRANCH=None
TEST=On yorp; on port 0 and 1 test without and with battery boots up.
Please note with battery we may still need to press power button to
get the SoC to boot up to S0 b:76230069.
Detaching the Type-C charger with battery connected also shuts down
the system which is a known failure b:77606986.

Change-Id: I1b744cd9aa063328845f9a1cc7e36d291dfec9f5
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/1007629
Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-11 14:55:39 -07:00
Scott Collyer
be2c5fa602 tcpci: Change role control setting for auto-toggle enable
In tcpci_tcpc_drp_toggle the role control is being set to
TYPEC_CC_OPEN. This works for the parade tcpci compliant tcpc, but
does not work the anx7447. The tcpci spec has this description for the
role control requirement (4.4.5.2):

If DRP=1b, the only allowed values for CC1/CC2 are Rp/Rp or Rd/Rd.
COMMAND.Look4Connection shall do nothing if CC1/CC2 are not Rp/Rp or
Rd/Rd.

This CL changes the role control setting associated with starting
auto-toggle to be TYPEC_CC_RD.

BUG=b:77544959
BRANCH=NONE
TEST=Verfied that anx7447 does auto toggle between Rd and
Rp. Previously, the TCPC_REG_COMMAND_LOOK4CONNECTION command was being
ignored.

Change-Id: Iea7ce963ebf57c0f3d43005385484913d97774fd
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1005795
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: S Wang <swang@analogix.corp-partner.google.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-04-11 14:55:37 -07:00
Vadim Bendebury
80f0f5c7cf cr50: bypass signing step if cr50-codesigner is not available
When building EC targets in the setups where the Cr50 codesigner
utility is not present let's just bypass the signing step.

Also removing bitrotten source code of the old codesigner.

BRANCH=none
BUG=chromium:830302
TEST='make buildall' succeeds even if cr50-codesigner is not available.

Change-Id: Ic6c4988455bcee6c45504e1fe781f6e03636d57a
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1005401
Reviewed-by: Allen Webb <allenwebb@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-04-11 11:25:15 -07:00
Vincent Palatin
209f47b692 u2f: accept short APDU
The ISO7816-4 standard for APDU format says the APDU header minimum size
is 4 bytes (CLA, INS, P1, P2). The Lc field is absent if the command has
no data.
Update the size check to accept short APDU (the actual APDU
len was already computed properly for this case).

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

BRANCH=cr50
BUG=b:72788497
TEST=adhoc

Change-Id: Ic60fa51bd4746b04016c488a38fe3ae7585e9942
Reviewed-on: https://chromium-review.googlesource.com/1005345
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-04-11 04:39:07 -07:00