Commit Graph

800 Commits

Author SHA1 Message Date
Vincent Palatin
4e39404604 ectool: increase image capture delay to 200ms
the current 50ms delay between the capture and having the image
available was working (to some definition of it) on the current boards,
but we hit issues on the next revision of the board with new sensor
silicon (and somewhat different delay), let's put a larger 200ms delay.
This will be converted to waiting for the proper MKBP event (aka
EC_MKBP_FP_IMAGE_READY) when all the boards using this feature will have
MKBP events support validated.

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

BRANCH=none
BUG=b:71770455
TEST=run 'ectool --name=cros_fp fpcheckpixels' on different boards.

Change-Id: Id1f2402ef85c903744054b00eeab0086221b4d7b
Reviewed-on: https://chromium-review.googlesource.com/888738
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
2018-01-26 16:12:08 -08:00
Nicolas Boichat
e5c6f97d1a charge_state_v2: Basic dual-battery charging algorithm
First version of the algorithm, some TODOs are left in the code
but this, generally, works reasonably well.

When charging, we allocate input current in this general order:
 - Base system (fixed, low, number)
 - Lid system (based on PSYS)
 - Lid battery (estimating how much current the battery actually
   requires)
 - Base battery (similar estimation)
 - Provide everything else to lid

When discharging, we generally:
 - First discharge the base battery
 - Then discharge the lid battery

BRANCH=none
BUG=b:71881017
TEST=Flash lux and wand, EC-EC communication works, adapter power
     is split in a sensible way, and discharging works fine.

Change-Id: I8a4f87963962fc5466b2fedf1347eb4dadd35740
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/659460
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-26 13:25:38 -08:00
Daisuke Nojiri
451fba34b8 Nami: Add Nami to flash_ec script
This patch adds Nami to flash_ec script.

BUG=none
BRANCH=none
TEST=Flash ec.bin to nami proto0.

Change-Id: I7b036c429fb028e916335efd330a4b8d80977263
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/879585
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-23 17:41:53 -08:00
Vincent Palatin
adeb276aa6 eve_fp: remove board
fp is dead, long life to fp.

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

BRANCH=none
BUG=b:72360575
TEST=make buildall

Change-Id: Idccb953044018e24d14b6ef1dbf69766fb9b58ab
Reviewed-on: https://chromium-review.googlesource.com/880954
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-23 17:41:42 -08:00
Vincent Palatin
b16f759652 ectool: use poll interface
Test polling for MKBP events through the kernel cros_ec/pd/fp/.. driver
node.

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

BRANCH=none
BUG=b:69460856
TEST=run on Eve EVT:
ectool --name=cros_fp fpmode fingerdown && \
ectool --name=cros_fp waitevent 5 10000

Change-Id: Ibdec137a3b646cf017a29afcf24ff5bbfb731198
Reviewed-on: https://chromium-review.googlesource.com/806167
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-23 05:25:08 -08:00
Vincent Palatin
96a7e9fe81 fpsensor: update interface
Update the FP MCU interface to include a few convenient diagnostics
functions for factory testing.

It's mostly backward compatible, but overall this interface never
shipped in anything, so not a big deal regardless.

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

BRANCH=none
BUG=b:71986991
TEST=ectool --name=cros_fp fpinfo && ectool --name=cros_fp fpcheckpixels
CQ-DEPEND=CL:*546799

Change-Id: Ic641f891ace02d79af9339cf6cb59a2960e506a7
Reviewed-on: https://chromium-review.googlesource.com/873924
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-23 05:25:08 -08:00
Daisuke Nojiri
ead2428e91 CBI: Allow get command to reload data from EEPROM
This patch adds CBI_GET_RELOAD flag to EC_CMD_GET_CROS_BOARD_INFO
command. When the flag is set, the command will be forced to read
data from EEPROM even, ignoring the data cached by the previous
read.

This allows ectool to verify a write was successful without reboot.

BUG=b:70294260
BRANCH=none
TEST=ectool cbi set 0 0x1234 && ectool cbi get 0 1

Change-Id: I3e7ced5be56a74c605870a4c0622c0a2f47963bb
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/874155
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-18 20:18:11 -08:00
CHLin
97c819c628 util: flash_ec: Add support to flash npcx7_evb with npcx7m7x chip
This CL modified the flash_ec and openocd script to support flashing
npcx7m7x chip on npcx7_evb.

BRANCH=none
BUG=none
TEST=Change CHIP_VARIANT to npcx7m7w in board/npcx7_evb/build.mk;
"BOARD=npcx7_evb make"; Move npcx7_evb from array BOARDS_NPCX_7M6X_JTAG
to BOARDS_NPCX_7M7X_JTAG in util/flash_ec; Connect servo JTAG to npcx7
EVB; "./util/flash_ec --board=npcx7_evb"; Make sure the programing
succeed and EVB bootup.

Change-Id: I9d448f55321330cbe9a7103d2b617617963ea307
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/858989
Commit-Ready: CH Lin <chlin56@nuvoton.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-18 10:11:50 -08:00
Vincent Palatin
07230f772e Add more debugging to run_host_test
If a host test fails, record the execution state of the EC host process.

This is an attempt to provide a hint whether the test was blocked on
I/O, if so it might be in 'D' state (but it might have recovered too
late too).

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

BRANCH=none
BUG=chromium:715011
TEST=run 'make runtests -j', then run it again with TIMEOUT reduced to 1
see it fail on 'kb_scan' and 'interrupt' tests with the trace containing
'*** test [...] in state Ssl+ ***'

Change-Id: I4590a4b84a2aba8d385d3ef911d5d0186e8ce2e3
Reviewed-on: https://chromium-review.googlesource.com/859771
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-18 05:09:42 -08:00
Aseda Aboagye
289347ad6a flash_ec: Support NPCX_INT_SPI using CCD.
A few things needed to be moved around in order for flashing the npcx7
to work over CCD.  This commit makes those changes and fixes a small bug
with the serial number parameter for raiden devices. (It just needed a
space).  It also fixes using just a SuzyQable to flash.

BUG=b:71548795
BRANCH=None
TEST=`./util/flash_ec --board meowth` with a servo_v4 and verify that
flashing is successful.
TEST=Repeat above test with a servo_v2.
TEST=Repeat above test with a servo_micro.
TEST=Repeat above test with a SuzyQable.

Change-Id: I8ff22fb1d2a5fe7af2ad30a14bf896dbae65c024
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/851354
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-18 05:09:35 -08:00
Daisuke Nojiri
bc4b786156 CBI: Add host command to set board info
This patch adds host command to write board information in EERPOM.

BUG=b:70294260
BRANCH=none
TEST=Run ectool cbi set <type> <value> to write BOARD_VERSION, OEM_ID,
and SKU_ID. Enable WP and verify cbi set command fails.

Change-Id: I39536d146313408ace666f350a107d89b331bf7a
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/865570
2018-01-18 05:09:31 -08:00
Daisuke Nojiri
5232cdd16b CBI: Add host command to get board info
This patch adds host command to get board info from EEPROM.

BUG=b:70294260
BRANCH=none
TEST=Run ectool cbi get <type> to get board version, OEM, SKU

Change-Id: I41a84d3eea6da9d88fa8122db36dcd1df515842d
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/865161
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-18 05:09:31 -08:00
Daisuke Nojiri
c62060d9d9 CBI: Add cbi-util
cbi-util is a build command line tool, which creates a blob containing
board information. When invoked with '--show' option, it prints the
information stored in a blob and validates the data.

BUG=b:70294260
BRANCH=none
TEST=Run the command as follows:
$ cbi-util --create /path/to/cbi.bin \
  --board_version 0xabcd --oem_id 2 --sku_id 3 --size 256
$ cbi-util --show /path/to/cbi.bin
CBI blob: /path/to/cbi.bin
  BOARD_VERSION: 0.1 (0xab.cd)
  OEM_ID: 2 (0x02)
  SKU_ID: 3 (0x03)
Data validated successfully
$ cbi-util --create /path/to/cbi.bin \
  --board_version 0xabcd --oem_id 2 --sku_id 3
Missing required arguments
$ cbi-util --create /path/to/cbi.bin --board_version 0xabcde
Invalid --board_version

Change-Id: I7e7b439c50943523039c3cafda3bdf7d08962c61
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/860961
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-18 05:09:30 -08:00
Nicolas Boichat
e71899a573 ectool: battery: Allow negative present current
Battery interface over host command is different, as it allows
negative current values to indicate discharge, let's not fail in
that case.

BRANCH=none
BUG=b:65697620
TEST=ectool battery 1 does not fail when battery is discharging.

Change-Id: I89ca750e24706f55a0589201aeaf9fea50f3132f
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/869552
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-17 06:20:38 -08:00
Vincent Palatin
9d38e46641 ectool: add servo v2 spi support
Add a new transport for ectool to send host command V3 over the Servo v2
SPI interface using libftdi.

Build this new communication mechanism only for the 'build' architecture
as it has a dependency on libftdi, the new ectool binary is called
ectool_servo.
Fix the 'build' tools build if they don't have a source file matching
their binary name.

The serial number of the servo board can be passed in the 'name'
parameter, e.g. :
sudo ectool_servo --name=905537-00474 version

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

BRANCH=none
BUG=b:70320279
TEST=with ZerbleBarn connected to a servo V2, run:
sudo ectool_servo version

Change-Id: Ia7067d465a42f76695fed5932f32fac9a6d0988e
Reviewed-on: https://chromium-review.googlesource.com/864164
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-17 06:20:37 -08:00
Nicolas Boichat
4c56c17a1a battery: Add support for reading base battery through host command
This adds support for EC_CMD_BATTERY_GET_STATIC and
EC_CMD_BATTERY_GET_DYNAMIC host commands, that can currently only
fetch the base battery information using index = 1.

In the future, all battery information can be passed to AP using
these host commands (i.e. lid could provide its own battery
information on index = 0).

BRANCH=none
BUG=b:65697620
TEST=ectool battery shows lid battery information (no change)
TEST=ectool battery 1 shows base battery information

Change-Id: Ib819e4917b3acc337348764f6cc2aa7380bed700
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/863863
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-14 18:38:29 -08:00
Vincent Palatin
4cb76d6c52 stm32mon: do not write trailing empty space
Add a tweak to get faster flashing:
skip writing the empty trailing space at the end of the firmware image.

On the STM32H7x3, flashing 2MB of useless bytes over UART can be
really slow...

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

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

Change-Id: Ie396ee7d5b5771e0f6249e38da37ef8329c84ae3
Reviewed-on: https://chromium-review.googlesource.com/856978
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
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