Commit Graph

783 Commits

Author SHA1 Message Date
Vincent Palatin
e3323bee69 stm32mon: add STM32H7 identifier
Add a new chip ID to support the STM32H7x3 parts.

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

BRANCH=none
BUG=b:67081508
TEST=flash_ec --board=meowth_fp

Change-Id: I3897a74f5414e0e6b13890291706134c2d916af9
Reviewed-on: https://chromium-review.googlesource.com/856977
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2018-01-10 15:44:28 -08:00
Vincent Palatin
906a1b5138 stm32mon: change erase timeout
On some chips, the full erase operation can take really long:
e.g 13s for 2MB mass-erase on the STM32H7x3 family.
Add a new mechanism retrying the ACK detection rather than extending
the default timeout which would imply very slow behavior in other cases
(e.g. connection).

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

BRANCH=none
BUG=b:67081508
TEST=flash_ec --board=meowth_fp

Change-Id: I428f56341c31c327debb9a3d2eba9b12c768ba86
Reviewed-on: https://chromium-review.googlesource.com/856976
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-10 15:44:28 -08:00
Nicolas Boichat
9a89170ed4 lux: Add lux board
lux is a dual-battery poppy derivative.

BRANCH=none
BUG=b:67029560
TEST=make BOARD=lux -j

Change-Id: I01fdb1e5e2b4803cdf7f03f9e6ee73603f84a7b8
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/845542
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-01-10 12:58:55 -08:00
CHLin
a5fe9099d8 util: ecst: Add 2 CHIP_VARIANTs to support npcx7m6xb/npcx7m7w
This CL adds support for chip variant npcx7m6xb and npcx7m7w in the ecst
utility. It also fixed the coding style by replacing some inapproiate
tab characters with white space characters.

BRANCH=none
BUG=none
TEST=No build errors for make buildall.
TEST=Change CHIP_VARIANT to npcx7m7w/npcx7m6xb in
board/npcx7_evb/build.mk; "BOARD=npcx7_evb make"; Check ec image can be
built and image header is correct.

Change-Id: I44bae48dcb4fa3bc8984184d8f43744e54bcf8e7
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/851935
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-09 03:33:19 -08:00
Hung-Te Lin
b9f78632fa ectool: Correct reporting fan numbers on fanless device.
`get_num_fans` tries to determine if fans are available according to
feature list, retrieved from an ec_command.

The ec_command today returns received output size on success, so to
we should not check the result by "rv == EC_SUCCESS".

Instead, we should check if rv returns a negative number, just like
the cmd_inventory.

BRANCH=none
BUG=b:71690953
TEST=(on fanless Eve) ectool pwmgetnumfans # see Fans=0
     ectool pwmgetfanrpm # see empty output, $?=0

Change-Id: Id748b70cec0afb0715febbda8883cd5ed53f7e3d
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/853755
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-08 22:42:09 -08:00
Gwendal Grignou
c49334f143 ec_commands: Add sync sensor
SYNC motion sensor are use to count event.
It sends an event to the AP each time a GPIO goes low/high, the datum
contains a 16 bit counter.
The location indicates the source of the event, as Android sensor hal
will use this information (via sysfs location attribute) to link the
sensor with other subsystem.

BUG=b:67743747
BRANCH=none
TEST=Unit tests.

Change-Id: Ia808b25730ad4100efa216c6a86b7b090197c5a3
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/848496
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-08 17:22:48 -08:00
Vincent Palatin
f5798790ad stm32: add meowth_fp board
Configure it as a fingerprint MCU.

Currently use ZerbleBarn as a proxy for it.

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

BRANCH=none
BUG=b:67081508
TEST=flash and run the image on ZerbleBarn,
do a finger image acquisition with the 'fptest' console command.

Change-Id: I6e060c2d1e950ec81092088e1793b186fc0a5fa0
Reviewed-on: https://chromium-review.googlesource.com/806169
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-08 17:22:48 -08:00
CHLin
e358a5521d util/openocd: modify the openocd srcipts for npcx UUT
In the CL:826909, the name and the restore address of ec_spiflash lfw
are modified becaue of introducing the UUT. This CL modified the openocd
scripts to follow the changes of the lfw.

BRANCH=none
BUG=none
TEST=Apply CL:826906 and "BOARD=npcx7_evb make";
Run cmd "./util/flash_ec --board=npcx7_evb" to flash ec image;
Make sure the ec firmware can be updated with the new npcx_minotor lfw
+ this CL via JTAG on Servo v2.

Change-Id: If622f83e2d2132d66b390bcee30c77e7a9d5f7bd
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/828341
Commit-Ready: CH Lin <chlin56@nuvoton.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-03 22:42:59 -08:00
CHLin
749632d30f util/flash_ec: npcx7 supports programming SPI flash via UART
This CL adds scripts to support updating ec image to the SPI flash by
UUT(UART Update Tool) for npcx ec. A new array BOARDS_NPCX_UUT is
introduced to include the board name which will use the UUT mechanism.

The detail of test setup/procedure is listed below:
1. Connect the following singals between npcx7 evb and Servo board v2.
   NPCX7 EVB            Servo V2
   ---------------------------------------
   GPIO64/CR_SIN  <-->  UART1_SERVO_DUT_TX
   GPIO65/CR_SOUT <-->  UART1_DUT_SERVO_TX
   VDD_3.3V       <-->  PPDUT_UART1_VREF
2. Manually pull the UUT mode strap pin(GPIO65/CR_SOUT) to ground with a
10 KOhm resistor.
3. Assert a EC VCC1_RST reset or issue a Power-Up reset.
4. Remove the pull-down in step 2.
5. Move npcx7_evb from array BOARDS_NPCX_7M6X_JTAG to BOARDS_NPCX_UUT in
flash_ec.
6. ./util/flash_ec --board=npcx7_evb.

BRANCH=none
BUG=none
TEST=Follow the steps above. Dump the SPI flash content to a file via
JTAG. Compare the file and ec image. Make sure their content is all
the same. Check the ec can reboot after programming.
Run "sysjump rw"; make sure RW image works well.

Change-Id: Iada5acb53179bdb78459c4fea7488fd2691575b6
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/826763
Commit-Ready: CH Lin <chlin56@nuvoton.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-02 21:32:18 -08:00
Philip Chen
e896e732ae cleanup: Remove Nefario board
It's a dead board.

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

Change-Id: I9f5530afdea07bb5787fa2b674984147f8425fba
Signed-off-by: Philip Chen <philipchen@google.com>
2017-12-20 20:41:10 -08:00
Nicolas Boichat
9a284576a8 wand: Add wand board
hammer derivative, with a battery.

BRANCH=none
BUG=b:66575472
TEST=make BOARD=wand -j, flash to reworked hammer board,
     battery charging works.

Change-Id: I42366f4738b35c352b9be0c44a17ebeb323adfd1
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/678756
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-12-20 05:49:34 -08:00
Randall Spangler
7d2ce0c47e ec_commands: Remove zero-size structs
The size of empty structs (and unions) varies between C and C++.  When
including in C++ code our external API in ec_commands.h header with
extern "C".  clang will complain (correctly) for all empty structs:
       error: empty struct has size 0 in C, size 1 in C++
       [-Werror,-Wextern-c-compat]

Remove them from the ec_commands.h header file.

ectool.c has some ugly macros which assume subcommands have both
requests and responses.  Change those macros so they only reference
the non-empty sub-structs.  The macros are still ugly, but generate
identical output, and don't rely upon zero-length structs.

BUG=chromium:792408
BRANCH=none
TEST=manual

	1) Compile the following using 'clang -Wall -Werror':

	   #include <stdint.h>
	   extern "C" {
	   #include "include/ec_commands.h"
	   }
	   int main(void) { return 0; }

	   It compiles without error.

	2) Copy the lb_command_paramcount, ms_command_sizes, and
	   cs_paramcount globals from ectool.c to a dummy .c file and
	   compile with 'gcc -S' to generate assembly.  Do the same
	   after applying this patch.

	   Confirm the arrays have the same contents.

Change-Id: Iad76f10315b97205b42118ce070463071fe97128
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/820649
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-12-13 12:33:37 -08:00
Vadim Bendebury
1b53782145 cr50: move major version number component to 1
It is beneficial to have the 'major' version number component advanced
with every major Cr50 code release: this will allow to use the 'minor'
version number component when it is necessary to release a bug fix or
a small addition to the current release.

BRANCH=cr50
BUG=none
TEST=verified proper version number reported by 'version' command

Change-Id: Ie87a2b676b59b46be243fa6367571a1d0877f13d
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/820270
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-12-11 23:57:46 +00:00
Vadim Bendebury
94774ad9df util: do not run host command check unless needed
With the recent addition of the presubmit check progress display it
became obvious that hook2 from ./PRESUBMIT.cfg takes quite a bit of
time on each check.

A closer examination has shown that this script scans the entire
codebase on each patch to see if there have been some inconsistencies
wrt EC host command definitions.

Let's limit running this check only to patches which actually touch EC
host commands in any way.

BRANCH=none
BUG=none
TEST=verified that the check runs only when the 'EC_.*CMD' string is
     present in the diffs output of the patch

Change-Id: I128dba48332142b8835cf36747ab290190e6bcef
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/815951
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Sam Hurst <shurst@google.com>
2017-12-08 20:37:23 -08:00
YB.Ha
47a6acca3a motion: Add bh1730 as a motion sensor
- Add ROHM ambient light sensor driver
    - Add als sensor to motion sensors

    BRANCH=glados
    BUG=b:67022366
    TEST=This driver is tested in caroline
    Signed-off-by: yb.ha <ybha@samsung.com>

Change-Id: Ic73c50e17b412975f7850b7348ce310180f7a6eb
Reviewed-on: https://chromium-review.googlesource.com/784659
Commit-Ready: YongBeum Ha <ybha@samsung.com>
Tested-by: YongBeum Ha <ybha@samsung.com>
Reviewed-by: Gwendal Grignou <gwendal@google.com>
2017-12-08 00:37:03 -08:00
Nick Sanders
dc85ecf029 flash_ec: add --verbose arg
Add the option to dump all dut-control and flashrom
commands and their arguments.

BUG=b:37513705
BRANCH=None
TEST=./util/flash_ec --board fizz --verbose

Change-Id: Ie57c270a925a00f76d25e52831aa11e23ab9a524
Signed-off-by: Nick Sanders <nsanders@google.com>
Reviewed-on: https://chromium-review.googlesource.com/807485
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
2017-12-06 20:24:14 -08:00
Sam Hurst
9b922a6317 Update genvif to create Rev 1.22 Vendor Info Files
Update genvif so that it can create Rev 1.22 Vendor Info Files. Also
format the VIF so that it matches VIFs generated with the USB VIF
generator.

BUG=b:69972352
BRANCH=None
TEST=`make -j buildall`
Used generated VIF for nasher on GRL Test Equipment
Signed-off-by: Sam Hurst <shurst@chromium.org>

Change-Id: I35bc940c0c65c89be9a40ff9228e51123f136e7b
Reviewed-on: https://chromium-review.googlesource.com/801874
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-12-06 20:24:12 -08:00
Daniel Erat
131afcd81a ec: Create lockfile in /run/lock/power_override.
Create a lockfile at
/run/lock/power_override/battery_tool.lock rather than
/run/lock/battery_tool_powerd.lock so that powerd doesn't
need to special-case the file's path.

BUG=chromium:784651
BRANCH=None
TEST=None

Change-Id: I151cf26d635dc969d113e9d80c93177985a7ab2f
Signed-off-by: Daniel Erat <derat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/809921
Commit-Ready: Dan Erat <derat@chromium.org>
Tested-by: Dan Erat <derat@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-12-06 20:24:12 -08:00
Daisuke Nojiri
b26f023631 ectool: Add switch-slot option to reboot_ec command
This patch adds switch-slot option to reboot_ec command. When the
option is specified, it'll make EC switch the active RW slot
before reboot.

BUG=b:69921268
BRANCH=none
TEST=Run ectool reboot_ec cold switch-slot and verify the active
slot is switched.

Change-Id: Iec568be36e6010ed9a51aa768a7f35e4a63f0fc0
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/809944
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-12-06 14:28:58 -08:00
Shawn Nematbakhsh
0819d61af0 cleanup: Remove honeybuns board
BUG=None
TEST=`make buildall -j`
BRANCH=None

Change-Id: Ieeb98eee02eabdf03413975ecf286ca69550ddfc
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/803946
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-12-04 14:32:01 -08:00
Rong Chang
cf0153224e coffeecake: initial commit
Clone HoHo board to CoffeeCake.

BRANCH=none
BUG=none
TEST=make BOARD=coffeecake -j

Signed-off-by: Rong Chang <rongchang@chromium.org>
Change-Id: I62b4bf92a2eaffbc145197c7f36cfb7a29722bf5
Reviewed-on: https://chromium-review.googlesource.com/673963
Reviewed-by: Benson Leung <bleung@chromium.org>
2017-11-29 04:04:12 -08:00
Martin Roth
b38792b78b util: Remove duplicate 'const' in export_taskinfo.c
This is causing an error in the latest coreboot toolchain:
util/export_taskinfo.c:33:30: error: duplicate 'const' declaration
specifier [-Werror=duplicate-decl-specifier]

BUG=None
TEST=Build now passes with latest coreboot toolchain and cros
Ztoolchain
BRANCH=None

Change-Id: I069d08128e264310d25a09ada2276f92796294b7
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://chromium-review.googlesource.com/679939
Commit-Ready: Martin Roth <martinroth@chromium.org>
Tested-by: Martin Roth <martinroth@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
2017-11-20 15:08:44 -08:00
Aseda Aboagye
fc4a6f13b2 flash_ec: Add support for meowth.
BUG=None
BRANCH=None
TEST=None

Change-Id: Ib0c6b029c608ac361ed661249138589c99ea68b6
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/772910
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-11-16 21:07:36 -08:00
Vadim Bendebury
9c090eb0c9 cr50: prepare to release 0.0.26
The new release will include fixes for SPI problems discovered when
debugging Fizz.

BRANCH=cr50
BUG=none
TEST=none

Change-Id: I4ac2ab762ec86957a7555b0aaa41235f44a54d47
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/772738
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-11-15 16:07:33 -08:00
Edward Hill
6d4674fd05 grunt: Initial GPIO setup for grunt
Configure GPIOs to match grunt proto v1.1 schematic.
Change EC chip to npcx7m6f.
Minimal board.c/h, just enough to build.

BUG=b:64935726
BRANCH=none
TEST=make BOARD=grunt

Change-Id: I1a1f581c7ee7b80808c0dde179bc3ee0d69f960e
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/754302
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-11-14 13:31:48 -08:00
Ege Mihmanli
b3c9986802 rainier: add rainier support for flash_ec
BUG=chromium:776441
BRANCH=none
TEST=Run "./flash_ec --board=rainier" from ec/util directory and
make sure there is no error "board rainier not supported" on stderr.
Signed-off-by: egemih@chromium.org
Change-Id: I4b4b714962685d0b33d3b9aa4c96b5a89eb566c5
Reviewed-on: https://chromium-review.googlesource.com/767589
Commit-Ready: Ege Mihmanli <egemih@google.com>
Tested-by: Ege Mihmanli <egemih@google.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-11-14 00:42:46 -08:00
Nicolas Boichat
bce7b5b4b6 ectool: Print temperature unit in ectool temps output
Currently, 'ectool temps all|<n>' just prints "300". This may easily
be mistakenly read as tenth of degree C (30.0 C), as the value
appears to make sense (close to room temperature). However, the value
is actually 300 K (27 C).

CQ-DEPEND=CL:763578
BRANCH=none
BUG=chromium:783845
TEST=ectool temps all shows temperature unit (K)

Change-Id: I70f7f04d061cb1d4f741d59f8b48c7963dd8280f
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/763996
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-11-11 12:13:42 -08:00
Shawn Nematbakhsh
ad3696b1ca cleanup: Remove llama board
The llama is a South American relative of the camel, though the llama
does not have a hump. These sturdy creatures are domestic animals used
by the peoples of the Andes Mountains.

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

Change-Id: I55dbd8d5b0b14c41e27c4ef473833563f38878c3
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/761298
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-11-09 16:43:54 -08:00
Nicolas Boichat
fe69abf6c3 board: Add support for whiskers board
A hammer derivative.

BRANCH=none
BUG=b:68934906
TEST=make BOARD=whiskers -j

Change-Id: I8df5156d622bf518f647addf2fcea6342b2d6f2b
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/754078
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-11-09 16:43:54 -08:00
Wai-Hong Tam
fca1b7b710 flash_ec: Set NEED_SERVO according to chip name instead of board name
One can pass either a board name (e.g. hammer) or a chip name (stm32)
to the flash_ec command. If given a board name, will map to a proper
chip name and then call its chip-flashing method.

The NEED_SERVO variable ("no" if servo not needed) was set according
to the board name. It was broken if only given a chip name. It should
be set according to the chip name.

BUG=b:68943874
BRANCH=None
TEST=Flashed the Staff firmware
SERVO $ dut-control ec_boot_mode:on
DUT   $ ectool gpioset PP3300_DX_BASE 0
DUT   $ ectool gpioset PP3300_DX_BASE 1
DUT   $ flash_ec --chip stm32_dfu --image staff_ec.bin
SERVO $ dut-control ec_boot_mode:off
DUT   $ ectool gpioset PP3300_DX_BASE 0
DUT   $ ectool gpioset PP3300_DX_BASE 1

Change-Id: I1799f083115bfdf203a405733c5baefadbe3fe3e
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/755614
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-11-06 17:26:16 -08:00
Wai-Hong Tam
b9e95e9692 flash_ec: Get the path of EC UART PTY only in flash_stm32
Flashing STM32 requires the EC UART. The path of EC UART PTY was
originally set under some conditions which didn't reflect the case.
Instead of fixing these conditions, this change simply moves it
inside flash_stm32() as other flash functions don't need EC UART PTY.

BRANCH=none
BUG=b:67010776
TEST=Used servo-micro to flash_ec a STM32 EC, no error on getting EC
UART PTY.

Change-Id: I20c31de8e6c7a99fde259f4f397e53325ee80b07
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/745101
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
2017-10-30 23:21:37 -07:00
Vadim Bendebury
9eac4de2ef cr50: prepare to release 0.0.25
Let's make CCD and RMA auth features available on pre-PVT decvices.

BRANCH=cr50
BUG=b:68161393
TEST=none

Change-Id: Ic4ced2ba0e44b620bfeef9aa11f4676667c3176f
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/734762
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-10-24 12:57:45 -07:00
Chris Wang
ca013a9780 ec: add initial nautilus board
For now use the files from poppy. To be changed later on.

BUG=b:66458931
TEST=emerge-nautilus chromeos-ec/make buildall -j

Change-Id: If829d7307f834f1f30878934623c0e9ee77b907d
Signed-off-by: Chris Wang <chriswang@ami.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/701996
Commit-Ready: Grace Kao <grace.kao@intel.com>
Tested-by: Grace Kao <grace.kao@intel.com>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2017-10-23 04:28:27 -07:00
Shawn Nematbakhsh
7c2c5a9dc3 pd: Add "freeze" dual-role policy
Add a new DRP policy to "freeze" the power role of each port, never
toggling automatically, though manual role swaps may still occur.

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

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

BUG=b:64477774
BRANCH=none
TEST=none

Change-Id: I3690da60f756ab056e852e9f485b3c439c82e67b
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Found-by: Coverity Scan #58158
Reviewed-on: https://chromium-review.googlesource.com/719196
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Martin Roth <martinroth@chromium.org>
2017-10-19 05:15:31 -07:00
Aseda Aboagye
8f3f0c0807 flash_ec: Add 1s delay after turning on SPI VREF.
On zoombini, we were taking enough power that the voltage dipped for a
little bit.  This commit adds a 1 second delay after applying SPI VREF
but before actually flashing the EC.

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

Change-Id: I431cbfcc569fd5369971b06dedb85e8d5fdb9a32
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/722354
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-10-18 10:30:41 -07:00
Vadim Bendebury
26a8e16de1 util: let cr50 signer use chroot version of gsctool
Requiring installation of the gsctool locally in the EC tree could
collide with debug versions or executables built for wrong
architectures.

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

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

Change-Id: Ib155e166297d28c1660f7f33bb000b3bb8fe7a15
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/709739
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-10-16 18:17:35 -07:00
Patrick Georgi
828da3d556 util/iteflash.c: make sure that the file is closed
An insignificant bug, but Coverity complains about it. Reduce the
cognitive load by making sure that file is closed in time.

BUG=none
BRANCH=none
TEST=none

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

BUG=none
BRANCH=none
TEST=none

Change-Id: I5fa8276dc3b3e124dacceca1ea857430982f7567
Found-by: Coverity Scan #141761, #141762
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/702482
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Chris Ching <chingcodes@chromium.org>
2017-10-14 08:03:05 -07:00
Shawn Nematbakhsh
7f472114fb cleanup: Use CONFIG_BATTERY to indicate whether a board has a battery
BUG=b:35528297
BRANCH=None
TEST=`make buildall -j`

Change-Id: I9e4814b4172f20711f7edd691c9569f9130aec8e
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/713395
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-10-13 14:45:16 -07:00
Aseda Aboagye
051339e28c flash_ec: Save more variables.
It was found on zoombini, when flashing via flash_ec failed, it would
prevent the board from booting as certain controls were left in their
"flashing" state.  This was because these controls were missing from the
variables list which is what was used to restore the controls.

BUG=b:65694294
BRANCH=None
TEST=Attempt to flash zoombini without the flex connected.  Attach the
servo flex, apply power, verify DUT boots up.

Change-Id: Ic2bc74ef1a61d4f10da6d3ceac77fbd373697838
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/714023
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-10-12 13:37:15 -07:00
YH Lin
c478733f19 grunt: initial setup for ec
Initial files for grunt, to be revised later.

BUG=b:67187149
TEST=None
BRANCH=None

Change-Id: I392bb4982fea0c9374ba8d262f8f4288522207d5
Signed-off-by: YH Lin <yueherngl@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/699554
Reviewed-by: Jason Clinton <jclinton@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-11 20:45:08 -07:00
Vadim Bendebury
a08f61506c g: rename usb_updater into gsctool
The usb_updater utility has long been not just an updater, and has
long been using other interfaces in addition to USB. gsctool is a much
more suitable name.

CQ-DEPEND=CL:709776
BRANCH=cr50
BUG=b:67007500

TEST=verified that make -C ./extra/usb_updater generates
     ./extra/usb_updater/gsctool:

  $ ./extra/usb_updater/gsctool --help

  Usage: gsctool [options] <binary image>

  This updates the Cr50 RW firmware over USB.
  The required argument is the full RO+RW image.

  Options:
  [...]
  $

Change-Id: I3ab70c28acf3664ddefaa923a87ba1fd5c3c437b
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/709738
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2017-10-10 22:13:43 -07:00
Patrick Georgi
f1e6af516c util/ectool.c: Make sure device_name is NUL terminated
BRANCH=none
BUG=none
TEST=none

Found-by: Coverity Scan #144116
Change-Id: I9ec030c1a3820af7d08c2a83e3c1f4c3ee7a3f0a
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/702302
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Chris Ching <chingcodes@chromium.org>
2017-10-09 03:06:27 -07:00
Jagadish Krishnamoorthy
49958cf5c2 vboot: Modify the parameter offset
For the Host Command vboot hash EC_VBOOT_HASH_GET case,
if the input parameter offset and size is 0 then change
offset to data_offset to obtain the latest hash value.
Else retain the offset to get the hash value at offset.

BUG=b:66957716
BRANCH=NONE
TEST=On Soraka, ectool echash commands
(RO, RW) should result in hash information.

Change-Id: Ife17d35b0dfeecb5ec799c9ed722ae48dbec5b5b
Signed-off-by: Jagadish Krishnamoorthy <jagadish.krishnamoorthy@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/685738
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2017-09-27 19:03:03 -07:00
Nicolas Boichat
82e0892fc3 update_fw: Store complete touchpad FW hash
This will be used by the updater to first check that the touchpad
FW on AP side matches the one for which we stored hashes on EC
side.

This guarantee that we do not accidentally try to flash an
incorrect FW, which would render the touchpad non-functional.

BRANCH=none
BUG=b:63993173
TEST=make TOUCHPAD_FW=SA459C-1211_ForGoogleHammer_3.0.bin \
          BOARD=hammer -j
TEST=./usb_updater2 -t
     includes output of
     sha256sum A459C-1211_ForGoogleHammer_3.0.bin

Change-Id: Id30ab2d7c7d7e2d0f25cc893f685d218c44c022e
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/641736
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-09-15 10:50:27 -07:00
Vadim Bendebury
4fdccb6de5 util: fix bug in tagbranch
After mulptiple edits of the script, there is a case when bash
variable is not properly quoted, let's fix it.

BRANCH=cr50
BUG=b:64698702
TEST=verified proper tag description set by git

Change-Id: I5847437cde717bb6e1f4b672fe6008b8e6e6f4e3
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/667917
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-09-15 08:46:32 -07:00
Vadim Bendebury
38650d0b5d util: move 'dirty' marker to be a prefix, not a suffix
With longer git SHA1s reported by git commands and longer version
strings, the entire SHA1 could be not fitting into the 32 byte version
of the VERSION string. So, instead of adding the 'dirty' marker to the
end of SHA1 let's replace the prefix dash with it in case the tree is
dirty.

This way the length of the version string does not change (as long as
the 'dirty' marker is one character long).

BRANCH=cr50
BUG=b:64698702
TEST=verified output of running getversion.sh with a clean tree

   $ ./util/getversion.sh  | grep VERSION32
   #define CROS_EC_VERSION32 "_v1.1.7046-591608e2e"

  and a 'dirty' tree

   $ ./util/getversion.sh  | grep VERSION32
   #define CROS_EC_VERSION32 "_v1.1.7046+591608e2e"

Change-Id: I42684522beaff9e9714206cfaddaf97e6cd644be
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/665958
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-09-15 08:46:32 -07:00
Nicolas Boichat
94279fc38f Makefile: Generate hashes for the touchpad FW
Based on the passed TOUCHPAD_FW parameter to the make command, the
build system generates hashes for the touchpad FW.

To generate the hashes, gen_touchpad_hash splits the touchpad FW
in blocks of CONFIG_UPDATE_PDU_SIZE, that are hashed individually
(SHA-256), and then stored in the EC image.

This will allow the USB updater code to verify the integrity of
the touchpad firmware being flashed.

When no FW is provided, zeros are output, which do not match
any valid data.

BRANCH=none
BUG=b:63993173
TEST=make TOUCHPAD_FW=SA459C-1211_ForGoogleHammer_3.0.bin \
          BOARD=hammer -j
TEST=Using variations of
     make TOUCHPAD_FW=SA459C-1211_ForGoogleHammer_3.0.bin \
          BOARD=hammer -j
     make TOUCHPAD_FW=SA459C-1211_ForGoogleHammer_4.0.bin \
          BOARD=hammer -j
     make BOARD=hammer -j
     Check that TPHASH touchpad_fw_hash.h is only regenerated when
     the parameter changes.

Change-Id: Ie347270aa9c00342de13489c9422e45e681b94c2
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/615321
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-09-15 03:08:26 -07:00
Vadim Bendebury
a26ddda387 utils: a script to help creating EC git tags
The script tries to determine the upstream branch name, and finds out
which is the first sha1 of the current branch.

Then the script tags the branch and generates a git command strings
the operator is supposed to check for sanity and enter to push the new
tag to the server.

With the new tag set each following run of ./util/getversion.sh would
generate version strings including the new tag name and number of
patches above the branch point.

More implementation details are included in the comments in the
script.

BRANCH=cr50
BUG=b:64698702
TEST=tried  the script in cr50 and gru firmware branches:
   cr50$ <path to>/tagbranch.sh
   A new tag 'v1.9308_B.0' has been set. Use the following command
   to push it to the server

   git push --tags https://chromium.googlesource.com/chromiumos/platform/ec v1.9308_B.0

   Or if you want to delete it:

   git tag -d v1.9308_B.0
   cr50$ ./util/getversion.sh | grep -w VERSION
   #define VERSION "_v1.9308_B.192-b5c9d0aa7"
   cr50$
   cr50$ cd <path/to>gru
   gru$ <path to>/tagbranch.sh

   A new tag 'v1.8785_B.0' has been set. Use the following command
   to push it to the server

   git push --tags https://chromium.googlesource.com/chromiumos/platform/ec v1.8785_B.0

   Or if you want to delete it:

   git tag -d v1.8785_B.0

   es^o: ~/new_projects/gru-8785/src/platform/ec 175 > ./util/getversion.sh | grep -w VERSION
   gru$ #define VERSION "_v1.8785_B.218-5d857ed8c"
   gru$

Change-Id: I0c0067f6b7bb837a0c119bc14ff48cb9223a3fa5
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/656575
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-09-14 11:36:37 -07:00