Commit Graph

899 Commits

Author SHA1 Message Date
Wai-Hong Tam
9102494be2 flash_ec: stm32/npcx_uut: Set ec_boot_mode to off on exit
The ec_boot_mode is used for flashing EC on STM32 and NPCX chips.

The ec_boot_mode pin is an open-drain GPIO. Doing save/restore is
destructive. For example, if DUT is unpowered (ec_boot_mode is "on"),
doing save/restore will force it outputting to "on". We should not
put it to the save/restore list. Instead, set it back to "off" on
exit.

BRANCH=none
BUG=b:80305869
TEST=Ran flash_ec when DUT is unpowered -> failed as expected.
Reran again when powered. Checked EC UART showed-up afterward.

Change-Id: Iecf4b663fe9ae75a673a29a66505a4121d29888c
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1073646
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-30 01:02:48 -07:00
Nicolas Boichat
5c924c0c21 hammer: Increase PDU size to 4k
Saves another ~1300 bytes of flash size, as the touchpad
hashes can now be computed in blocks of 4K, instead of 1K.

This costs 3K of SRAM, which we would not otherwise need on
hammer.

wand can only fit 2k PDU, so let's stick to that.

Also, make sure that util/gen_touchpad_fw is regenerated when the
configuration option changes (touchpad FW size, PDU size). Sadly,
this will still break bisection from commit after this CL, to
before this CL.

BRANCH=poppy
BUG=b:80167548
TEST=make buildall -j
TEST=make BOARD=hammer/staff/wand/whiskers all tests -j
TEST=Copy new staff image with old touchpad FW to DUT, verify that
     FW can be updated.

Change-Id: Ic1763684da730dc986bbbcb3312088c8208c84b5
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1070953
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-28 07:30:36 -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
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
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
Stephen Boyd
0a602bd7b4 ectool: Fix typo in feature listing
The power delivery spelling shouldn't have the extra 'e'. Remove it.

BRANCH=None
BUG=None
TEST=ectool inventory and check for spelling

Change-Id: Ic1ca8b5d15a20c532f5ae8d0404634e0bf93849b
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1057835
Commit-Ready: Randall Spangler <rspangler@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
2018-05-22 15:54:09 -07:00
CHLin
a2a1f66cb5 util: improve uartupdatetool (UUT) mechanism
The original UUT mechanism has the limitation that the image size cannot
exceed the code RAM size. Hence, it only allows to flash the EC firmware
by programming RO and RW images seperately.

In this CL, we introduce the "--auto" flag in uartupdattool.
It will divide the firmware into segments (4K bytes) and program
the segments one by one.
It also simplifies the function flash_npcx_uut() in flash_ec because
some actions are moved into the uartupdatetool with auto flag enabled.

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" or
   "./util/flash_ec --board=npcx7_evb --ro"
(Note: this line in flash_ec must be removed in step 6:
https://chromium.googlesource.com/chromiumos/platform/ec/+/master/util/flash_ec#961)

Change-Id: Ifdb6a40ef88c6a9fb435169e158fd615100237cf
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/1043825
Commit-Ready: CH Lin <chlin56@nuvoton.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-22 12:56:26 -07:00
Jett Rink
70091bf0f7 ite_flash: handle termination signal gracefully
Since we wait indefinitely for the ITE chip to be ready
when we are flashing it, we need to be able to handle the
console terminal signal gracefully so the host USB ports do
not get in a bad state.

BRANCH=none
BUG=none
TEST=Can exit while loop gracefully

Change-Id: Ica8e7c6c707cd58bdaa754be76fffef418d870e4
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1067788
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
2018-05-21 21:18:02 -07:00
Vadim Bendebury
338c594ce3 cr50: prepare to release version 0.4.7
BRANCH=none
BUG=none
TEST=none

Change-Id: I3c5516f8c8b3119ae705308eba3068ba5bf4d7e7
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1067780
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-05-21 21:18:01 -07:00
Patrick Georgi
880bb8b212 util/ecst: refactor path mangling
ecst has two open-coded implementations of a function to inject a string
into another string (that happens to be a path). Factor out and make
sure that gcc 8.1's static analysis of string lengths is happy.

BUG=b:65441143
BRANCH=none
TEST=builds with gcc 8.1

Change-Id: I80581d26b6f75cac2c9530c18f94d12614aa1586
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1061878
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2018-05-18 10:05:13 -07:00
Jett Rink
0b6be8f7b5 bip: unwedge SDA line after flashing ITE
When we exit DBGR mode on the ITE after flashing, it wedges the
SDA line, which prevents us from using dut-control cold_reset.

We do not need to exit DBGR mode since we will perform a cold reset
after we finish flashing.

BRANCH=none
BUG=b:79592483
TEST=flash bip multiple times and EC resets after flashing automatically

Change-Id: Iafbad7a88a528ec7385596fd7c674b151f276166
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1060588
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
2018-05-16 16:43:04 -07:00
Stefan Adolfsson
86734119fc Reland "npcx: CEC: Send CEC message in mkbp event"
This reverts commit f139d3a0ca.

Reason for revert: Verified that the problem is in the kernel, not EC.

Original change's description:
> Revert "npcx: CEC: Send CEC message in mkbp event"
>
> This reverts commit 74b5a2ccb5.
>
> Suspected to have broken perf tests by keeping a CPU busy on kevin/bob.
>
> BUG=chromium:842873, b:76467407
>
> Change-Id: Iebbbb4623116840b851656e3ec28e75dc99cff79
> Reviewed-on: https://chromium-review.googlesource.com/1060073
> Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
> Tested-by: Ilja H. Friedel <ihf@chromium.org>

Bug: chromium:842873, b:76467407
Change-Id: I7d8990b2b8901b7de08f190a993bec645bbdacd2
Reviewed-on: https://chromium-review.googlesource.com/1061854
Commit-Ready: Stefan Adolfsson <sadolfsson@chromium.org>
Tested-by: Stefan Adolfsson <sadolfsson@chromium.org>
Reviewed-by: Stefan Adolfsson <sadolfsson@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-16 16:43:03 -07:00
Daisuke Nojiri
5252c73936 cbi-util: Allow field size to be specified
Currently, field sizes are automatically set to the smallest size
which can fit a given value. This patch makes cbi-util allow field
sizes to be specified.

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

BUG=b:79514391
BRANCH=none
TEST=Tested as follows:
1. Create CBI image:
$ cbi-util create --file cbi.bin --board_version 0x202 \
  --oem_id 0xabcd:2 --sku_id 0xff:4 --size 256
2. Verify the image:
$ cbi-util show --file cbi.bin
CBI image: /home/dnojiri/tmp/nami/tmp/cbi.new.bin
  TOTAL_SIZE: 22
  Data Field: name: value (hex, tag, size)
    BOARD_VERSION: 514 (0x202, 0, 2)
    OEM_ID: 43981 (0xabcd, 1, 2)
    SKU_ID: 255 (0xff, 2, 4)
3. Verify the output matches with the previous output if field sizes
are not specified.

Change-Id: Ic7149274d6e4a118ea12bbf03199b548b7089a3e
Reviewed-on: https://chromium-review.googlesource.com/1056201
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2018-05-16 16:42:47 -07:00
Vincent Palatin
d9354c9cd9 fpsensor: add capture type for reset pixel test
Add the FP_CAPTURE_RESET_TEST capture mode to be able to perform the
reset pixel values test.
Update ectool accordingly and also remove the deprecated 'fpcheckpixels'
command.

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

BRANCH=poppy
BUG=b:78597564
TEST=run 'ectool --name=cros_fp fpmode capture test_reset',
then 'ectool --name=cros_fp fpframe > test.pnm'
CQ-DEPEND=CL:*626747

Change-Id: I183f33b1cb9ba4db67219b8f7740d29dc0551f2d
Reviewed-on: https://chromium-review.googlesource.com/1061074
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-05-16 12:41:30 -07:00
Daisuke Nojiri
d95964b670 cbi-util: Refactor the tool
This patch moves argument parsing code in each sub-command routine.

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

CQ-DEPEND=CL:*625723
BUG=b:79514391
BRANCH=none
TEST=Verify cbi-util show and create produce the same results.

Change-Id: I8842f16394210399ff55c75adb16dadcae8642e7
Reviewed-on: https://chromium-review.googlesource.com/1056200
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-05-16 12:41:27 -07:00
Ilja H. Friedel
f139d3a0ca Revert "npcx: CEC: Send CEC message in mkbp event"
This reverts commit 74b5a2ccb5.

Suspected to have broken perf tests by keeping a CPU busy on kevin/bob.

BUG=chromium:842873, b:76467407

Change-Id: Iebbbb4623116840b851656e3ec28e75dc99cff79
Reviewed-on: https://chromium-review.googlesource.com/1060073
Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
Tested-by: Ilja H. Friedel <ihf@chromium.org>
2018-05-15 17:00:53 +00:00
Daisuke Nojiri
fa6c5abae5 ectool: Allow cbi set to accept 4 byte filed
This patch makes 'cbi set' command accept a 4 byte field.

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

BUG=b:79514391
BRANCH=none
TEST=Run ectool cbi set 2 0xabc 4 on Nami.

Change-Id: I4ebfa6d35bf6dccbae80ec91ffd6bcc01fec03e5
Reviewed-on: https://chromium-review.googlesource.com/1056199
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-14 21:29:46 -07:00
Jett Rink
5550ae7f8d bip: update flash script to use dut_i2c_mux
Bip has an I2C mux that we need to set before we can program the ITE8320
chip. Set the dut's i2c mux to pass through to the EC.

BRANCH=none
BUG=b:79533605
TEST=flash bip and reef_it8320
CQ-DEPEND=CL:1054559

Change-Id: I690aa253c757c37dfb276d5be897b92a9aa1545e
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1054560
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
2018-05-13 12:00:21 -07:00
Stefan Adolfsson
74b5a2ccb5 npcx: CEC: Send CEC message in mkbp event
Instead of fetching incoming CEC messages using a specific read
command, extend the standard mkbp event so the CEC message can
be delivered directly inside the event.

Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org>

BUG=b:76467407
BRANCH=none
TEST="ectool cec read" still working with a kernel that has support
for the increased mkbp size.
CQ-DEPEND=CL:1046186,CL:1051085

Change-Id: Id9d944be86ba85084b979d1df9057f7f3e7a1fd0
Reviewed-on: https://chromium-review.googlesource.com/1051105
Commit-Ready: Stefan Adolfsson <sadolfsson@chromium.org>
Tested-by: Stefan Adolfsson <sadolfsson@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-12 12:06:06 -07:00
Stefan Adolfsson
6415c19415 CEC: Group ectool subcommands under "ectool cec"
Instead of e.g. "ectool cecwrite", use "ectool cec write" to
not clutter the command list.

BUG=b:76467407
BRANCH=none
TEST=Run "cec read/write/get/set" and make sure they still
work.
CQ-DEPEND=CL:1030218

Change-Id: Id515782f5a5ff0861fb95ab63c45dc8ab153f0bb
Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1046185
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-05-11 09:30:36 -07:00
Stefan Adolfsson
436dd71e5d CEC: Add cecset/cecget to ectool
Set and get CEC parameters. Currently supported
parameters are "enable" and "address"

Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org>

BUG=b:76467407
BRANCH=none
TEST=Using EC firmware with CEC support, set values
and read them back.
CQ-DEPEND=CL:1030217

Change-Id: I429710f5d8897b23c5b5e54bd10cbf38d1830811
Reviewed-on: https://chromium-review.googlesource.com/1030218
Commit-Ready: Stefan Adolfsson <sadolfsson@chromium.org>
Tested-by: Stefan Adolfsson <sadolfsson@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-05-10 02:27:07 -07:00
Stefan Adolfsson
1c941f01db CEC: Add cecread command to ectool
Wait for a CEC event and read out the new message.

Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org>

BUG=b:76467407
BRANCH=none
TEST=Using EC firmware with CEC support:
ectool cecread -- -1
Turn on TV, cecread says the same as logical analyzer
CQ-DEPEND=CL:1030216

Change-Id: Iadd2fcfad0dc647aaaa9bd8a04c5c0f582259af5
Reviewed-on: https://chromium-review.googlesource.com/1030217
Commit-Ready: Stefan Adolfsson <sadolfsson@chromium.org>
Tested-by: Stefan Adolfsson <sadolfsson@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-10 02:27:06 -07:00
Stefan Adolfsson
d81f36efce CEC: Wait for send-event after cec writes in ectool
For factory testing purposes, make the cecwrite
return-value depend on whether it got an ACK from the sink.

Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org>

BUG=b:76467407
BRANCH=none
TEST=Using EC firmware with CEC support, ectool cecwrite with
and without sink
CQ-DEPEND=CL:1030215

Change-Id: I681243f74e4745796ac8d50e60dc0f7f9c087335
Reviewed-on: https://chromium-review.googlesource.com/1030216
Commit-Ready: Stefan Adolfsson <sadolfsson@chromium.org>
Tested-by: Stefan Adolfsson <sadolfsson@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-05-10 02:27:06 -07:00
Stefan Adolfsson
8dab5788f3 CEC: Add cecwrite command to ectool
cecwrite can be used to write a sequence of bytes on the CEC bus.

Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org>

BUG=b:76467407
BRANCH=none
TEST=Using EC firmware with CEC support, turn on/off TV:
ectool cecwrite 0x40 0x04
ectool cecwrite 0x40 0x36
CQ-DEPEND=CL:1030214

Change-Id: I5bc1efcaaf6ea4c7f92d3654d6e0fcc8717ab757
Reviewed-on: https://chromium-review.googlesource.com/1030215
Commit-Ready: Stefan Adolfsson <sadolfsson@chromium.org>
Tested-by: Stefan Adolfsson <sadolfsson@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-05-10 02:27:05 -07:00
Stefan Adolfsson
f04ec041b2 CEC: Add CEC API
Add HDMI CEC commands and events. Will be used by npcx CEC
implementation.

Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org>

BUG=b:76467407
BRANCH=none
TEST=Build ec-utils and chromeos-ec

Change-Id: I9008eb77179c296d6d07d321f48ba24585323607
Reviewed-on: https://chromium-review.googlesource.com/995440
Commit-Ready: Stefan Adolfsson <sadolfsson@chromium.org>
Tested-by: Stefan Adolfsson <sadolfsson@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-09 22:36:18 -07:00
Jett Rink
0385f2fefd phaser: initial files commit
BRANCH=none
BUG=b:78770036
TEST=build

Change-Id: I10ce1cc0196bc1e9b7d892834351bb9b3d27e3e1
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1042730
Reviewed-by: Scott Collyer <scollyer@chromium.org>
2018-05-09 14:40:24 -07:00
Daisuke Nojiri
84a843bf63 CBI: Disallow board version and OEM ID to be reprogrammed
This patch makes CBI refuse to change board version and OEM ID.
When CONFIG_SYSTEM_UNLOCKED is defined, this restriction is removed.

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

BUG=b:74946347
BRANCH=none
TEST=buildall

Change-Id: I6ceda5764af56ed18a575f5563eaf294bb2876d0
Reviewed-on: https://chromium-review.googlesource.com/1017225
Commit-Ready: Jett Rink <jettrink@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-04 03:02:49 -07:00
Aseda Aboagye
97bf820d2d flash_ec: Add nocturne board.
BUG=b:78539498
BRANCH=None
TEST=Attepmt ./util/flash_ec --board nocturne and verify that the
flashrom programmer is invoked.

Change-Id: I93fd9c2712fcfd684ea3456c8f2176ac2557e220
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1043347
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-05-04 00:13:49 -07:00
Brian Norris
db55f6866b ectool: add 'kbinfo' command
We might use this in the kernel, so it's nice to have a diagnostic
command for it too.

BRANCH=none
BUG=chromium:836279
TEST=`ectool kbinfo` on kevin and scarlet

Change-Id: I746badf0d2be53d471592a2ca0d7b8ff8070f7a1
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1038729
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-05-02 22:21:11 -07:00
Raul E Rangel
585d33e5d9 ectool: Add hibernate-clear-ap-off command
Allows for: ectool reboot_ec hibernate-clear-ap-off

TEST=Built and tested on grunt
BRANCH=none
BUG=b:73825078

Change-Id: Ia05f9c2db9e7b699882fdec61aaa9fb67b2e097d
Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1033926
Reviewed-by: Edward Hill <ecgh@chromium.org>
2018-05-02 22:20:58 -07:00
Vadim Bendebury
5b6381713b cr50: prepare to release prepvt 0.4.6
BRANCH=none
BUG=none
TEST=mnone

Change-Id: Icf5a2069fcdc8908711af6592886a39236c8beab
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1038761
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-05-02 22:20:34 -07:00
Furquan Shaikh
38889d0819 ectool: Don't use board name in ectool tool version
When using unified images, it might be confusing to have a single
board name in the tool version. Since tool version was added to check
for compatibility, it is sufficient to look at the sha versions
without the actual board name.

BUG=None
BRANCH=None
TEST=Verified that "ectool version" does not report board name in
tool version.

Change-Id: I862956791706f8a8d508b780bf050caee7c7ccd2
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1036114
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-05-01 13:06:50 -07:00
Mulin Chao
9dd10a7685 npcx: change chip variants of npcx7 series for better clarification.
In this CL, we changed chip variants npcx7m6xb to npcx7m6fb and npcx7m7w
to npcx7m7wb for better clafiication since it introduced new parameter
"b" for chip generation in the same family series.

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

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

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

Change-Id: I896ee33209efa5d7157c90515005db5f36318c76
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/1025471
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-04-27 12:22:39 -07:00
Jett Rink
a34e253d28 octopus: move common usb/battery code into baseboard
Also implement a few remaining usb function for bip

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

Change-Id: I201408b5db689ac4a5bcab0011bc38698271b851
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1024279
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-04-26 17:00:45 -07:00
Vincent Palatin
53019df3a6 ectool: add a workaround for EC_CMD_FP_TEMPLATE
When issuing a host command whose request packet length is equal to the
maximum size (ie max_request_packet_size as returned by
EC_CMD_GET_PROTOCOL_INFO), the command currently fails with STM32H7 over
SPI host protocol.

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

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

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

Change-Id: I52072ddeb12534045c37ab30df301a60c8841199
Reviewed-on: https://chromium-review.googlesource.com/1026680
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-04-25 14:40:50 -07:00
Mary Ruthven
9b6fdcc0a4 flash_ec: fix handling ccd controls
BUG=none
BRANCH=none
TEST=use ccd uut to flash meowth and ccd bitbang to flash scarlet

Change-Id: I83ba0c82f66b698d4083649637d2f74a85db9bc4
Signed-off-by: Mary Ruthven <mruthven@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1025265
Commit-Ready: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-04-24 18:53:13 -07:00
Wai-Hong Tam
b40f6e5939 flash_ec: For npcx_uut, use servo to boot EC into the flashing mode
Use servo to boot EC into the flashing mode. Use the unified control
ec_boot_mode to do so.

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

Change-Id: I32dfe5baa82dd842b5237f38ea971c09e91c47d3
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1020159
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
2018-04-23 18:09:16 -07:00
Caveh Jalali
e09917178d flash_ec: remove redundant sudo
we were invoking flashrom as "sudo sudo flashrom", so remove
the gratuitous sudo.

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

Change-Id: I420ada94c4b973c8f7efe546670dd04cfbb1b234
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1020782
Commit-Ready: Caveh Jalali <caveh@google.com>
Tested-by: Caveh Jalali <caveh@google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-04-20 23:01:26 -07:00
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
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
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
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
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
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
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
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