Commit Graph

559 Commits

Author SHA1 Message Date
Shawn Nematbakhsh
541433abaf cleanup: lars / kunimitsu (and _pd): Remove board-level code
Authoritative firmware for these boards can be found on
firmware-glados-7820.B branch.

BUG=chrome-os-partner:49909
BRANCH=None
TEST=`make buildall -j`

Change-Id: I78dddef7bc36ecceb5cd9f0eb07052e8e16b6c15
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/343201
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-05-12 13:06:45 -07:00
Donald Huang
f36943f95a flash_ec: Add support for it83xx_evb
Add it83xx_evb support in flash_ec script.

BRANCH=none
BUG=none
TEST=Test OK on ITE8390CX.
     You can run
     "~/trunk/src/platform/ec/util/flash_ec --board=it83xx_evb --image=./build/it8380dev/ec.bin"

/* ==SNAPSHOT START== */
(cr) (flashec) donald@donald-nb ~/trunk/src/platform/ec $ ~/trunk/src/platform/ec/util/flash_ec --board=it83xx_evb --image=./build/it8380dev/ec.bin
INFO: Using ec image : ./build/it8380dev/ec.bin
INFO: Flashing chip it83xx.
Waiting for the EC power-on sequence ...CHIPID 8390, CHIPVER 82, Flash size 256 kB
Done.
CHIPID 8390, CHIPVER 82, Flash size 256 kB
Erasing chip...
/100%
Writing 262144 bytes at 0x00000000
Done.
Verify 262144 bytes at 0x00000000
-100%
Verify Done.
INFO: Flashing done.

/* ==SNAPSHOT END== */

Change-Id: I0a76c0ccfcc3726796372ba3b7915a41c64d5766
Signed-off-by: Donald Huang <donald.huang@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/343985
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-05-12 00:56:35 -07:00
Shawn Nematbakhsh
9494fc0dd1 pwm: Add generic PWM control host commands
Add generic PWM host commands for setting + getting duty cycle. PWMs can
be controlled through index (board-specific meaning) or by type
(currently KB backlight and display backlight are supported, more can be
added as needed).

BUG=chrome-os-partner:52002
BRANCH=None
TEST=Manual on chell.
`ectool pwmsetduty kb 100` - Verify KB backlight goes to 100%
`ectool pwmgetduty kb` - Prints 100
`ectool pwmgetduty 0` - Prints 100
`ectool pwmsetduty 0 0` - Verify KB backlight goes to 0%
`ectool pwmgetduty kb` - Prints 0
`ectool pwmgetduty disp` - Error res 3 (unsupported PWM type)
`ectool pwmsetduty 1` - Error res 3 (non-existent PWM index)

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I607c92a291e6c2e3af8238eaf22ad2bb81ffc805
Reviewed-on: https://chromium-review.googlesource.com/344012
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-11 18:24:30 -07:00
Shawn Nematbakhsh
bdbf0810d0 gru: Initial mainboard commit
Clone of kevin w/ minor GPIO / LED changes.

BUG=chrome-os-partner:52736
BRANCH=None
TEST=Verify image boots + sequences on kevin p1.

Change-Id: I7d3f3ce97a8b080516b635a3d2b7bc3c6515c6d9
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/340542
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: David Schneider <dnschneid@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-05-04 16:15:02 -07:00
Bruce
d539c79960 sb_firmware_update: Set ac flag at fw update mode
Some reason cause the power off during battery fw update process.
Then execute the process again, tool can't detect AC because EC
can't read data from battery. So set AC_PRESS flag after check
battery is in battery fw update mode.

BUG=None
BRANCH=None
TEST=check the battery can execute fw update in this case.

Change-Id: Iafe501eb1719a12425d5cac42d27c897e078acc1
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/341044
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-02 21:30:13 -07:00
Gwendal Grignou
e54d1284ff ectool: Revert "ectool: Remove CROS_EC_DEV_IOCRDMEM"
CROS_EC_DEV_IOCRDMEM must be used on architecture where legacy IO mapped
registers are accessed inderectly via EMI. The kernel is taking care of
the translation.

TEST=Check on reks that we need to use the IOCTL.
BUG=chrome-os-partner:52550,chromium:602832
BRANCH=none

This reverts commit de45353bbd ("ectool: Remove CROS_EC_DEV_IOCRDMEM").

Change-Id: I8efad56df90c58c25bdc9ccd70a508547e629a77
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/340348
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-04-22 17:17:56 -07:00
Kevin K Wong
b737fe07a3 amenia: initial board code
used board wheatley as the initial code base for amenia

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: Ifa561dae01e486058b2a3115bf37075a164369c2
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/331652
Commit-Ready: David Hendricks <dhendrix@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-04-15 21:29:14 -07:00
Gwendal Grignou
de45353bbd ectool: Remove CROS_EC_DEV_IOCRDMEM
On !LPC EC, we can read memory via CROS_EC_DEV_IOCXCMD ioctl,
using command EC_CMD_READ_MEMMAP.
On platform that supports direct memory access (lpc), we access
the memory directly, bypassing the ioctl.

BUG=chromium:602832
TEST=On gnawty and veyron, check 'ectool battery' works.
Verify that gnawty use io mapped registers.
BRANCH=none

Change-Id: I9bfcddcf450bf8df63ead78e1df97dd7392289e6
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/338853
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-04-15 13:40:17 -07:00
Rong Chang
8d2aac6bef elm: initial elm mainboard
Elm is an oak variant that uses ANX7688 PD port controller. This CL sets
PD port count to 1 and modifies TCPC I2C address to 0x50.

Other elm changes are included in this change:
  - add 2 KX022 motion sensors, remove BMI160
  - remove ALS
  - LED configuration changed to 2 bi-color LEDs
  - remove pi3usb30532
  - add ANX7688 mux driver
  - change PD interrupt polarity

BRANCH=none
BUG=none
TEST=manual
  make BOARD=elm -j
  load and test on elm proto

Signed-off-by: Rong Chang <rongchang@chromium.org>
Change-Id: I8ad02da9acade985bc0e7e2f85d9e58db7e6b38d
Reviewed-on: https://chromium-review.googlesource.com/331453
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-04-14 03:43:09 -07:00
Guenter Roeck
7ce63a09f9 ectool: Upgrade to improved ioctl format
Support both old and new ioctl formats at the same time.
Auto-detect the ioctl format used by the kernel.

BUG=chromium:481710
BRANCH=None
TEST=Work on Samus with kernel 4.4 and 3.8/3.14/3.18

Change-Id: I31d7ce5b517b4b5af8e2b617e386c3cfd3276f20
Signed-off-by: Guenter Roeck <groeck@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/331830
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2016-04-12 19:00:36 -07:00
Devn Lu
93be0c3b0a ectool: Support keyboard factory scanning
This is keyboard test mechanism request for "multiple key press test",
we can thru the testing to scan out kso ksi pins shortting or keyboard has
multiple key pressing, below was the testing steps:

1. Turn off internal keyboard scan function.
2. Set all scan & sense pins to input and internal push up.
3. Set start one pin to output low.
4. check other pins status if any sense low level.
5. repeat step 3~4 for all keyboard KSO/KSI pins.
6. Turn on internal keyboard scan function.

BUG=chrome-os-partner:49235
BRANCH=ToT
TEST=manual
  Short any KSO or KSI pins and excute "ectool kbfactorytest", it shows failed.
  if no pins short together, it shows passed.

Change-Id: Id2c4310d45e892aebc6d2c0795db22eba5a30641
Signed-off-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/332322
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-04-01 00:21:35 -07:00
Shawn Nematbakhsh
4e1ddc02c6 flash_ec: Add support for kevin
Add support for kevin, which uses external 1.8V SPI.

BUG=chrome-os-partner:51722
TEST=Verify kevin EC is flashable. Verify wheatley still uses pp3300 SPI
voltage.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I13e45e829cdc7b2298715812f5714d5dd806df06
Reviewed-on: https://chromium-review.googlesource.com/335396
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-03-28 21:55:20 -07:00
Donald Huang
cb38156bbc it8380dev: util: Enable Host Global Reset
BRANCH=none
BUG=none
TEST=Test OK on ITE8390CX.
     You can run "make -j BOARD=it8380dev" to build ec.bin
     and flash the ec.bin via
     "sudo ./build/it8380dev/util/iteflash -w ./build/it8380dev/ec.bin"

Change-Id: I2077012114bdbd5a8cc8f7dc29e43cdcb77d65b6
Signed-off-by: Donald Huang <donald.huang@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/334176
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-03-24 00:03:08 -07:00
Shawn Nematbakhsh
6ea8793394 cleanup: ectool: Ensure LED-related strings are defined for all types
Use asserts to ensure that new strings are added when new ec_led_colors
/ ec_led_id enum types are defined.

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

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I4bcd6ad6de15b96a1c6a3fb70dbcc74f4d7f2857
Reviewed-on: https://chromium-review.googlesource.com/334382
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-03-22 16:21:33 -07:00
Shawn Nematbakhsh
f06443e2f7 ectool: Eliminate needless stderr output from tempsinfo
`tempsinfo all` will probe all 24 sensor IDs, which will produce stderr
output due to host command failure if a given sensor does not exist.
Therefore, check memmap data for presence before probing a given ID.

BUG=chrome-os-partner:51026
BRANCH=None
TEST=Manual on Sentry. Verify "ectool tempsinfo all" dumps info on 4
temperature sensors and prints nothing to stderr.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I14d65c1ad03eafafc21db41781c434b3ed74cb7e
Reviewed-on: https://chromium-review.googlesource.com/333779
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-03-18 20:49:23 -07:00
Nick Sanders
d3a8bd0c36 servo_micro: add initial servo_micro build
* Update flash_ec to allow flashing servo_micro
* Add servo_micro build

BUG=chromium:571477
BRANCH=None
TEST=updated servod is able to control gpio, gpio extender,
     SPI flash, ec uart, ap uart on test yoshi

Signed-off-by: Nick Sanders <nsanders@google.com>

Change-Id: I4d69c83ae581cb41da928a27c39b7152475d7ca8
Reviewed-on: https://chromium-review.googlesource.com/327214
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-03-16 16:19:53 -07:00
Mulin Chao
3424deb481 npcx: Add 256KB alignment of RO & RW regions for npcx5m6g.
Since npcx5m6g has larger than 128 KB code ram for FW, the original
alignment between RO & RW regions isn't suitable for new chip.
Therefore, we add 256KB alignment of them for npcx5m6g.

In order to program the flash used by npcx5m6g, we add new board array,
BOARDS_NPCX_5M6G_JTAG, in flash_ec to distinguish which flash layout
ec used. In npcx_cmds.tcl, add new script funcs such as flash_npcx5m5g
and flash_npcx5m6g to program flash with different layout.

Modified sources:
1. config_flash_layout.h: Add 256KB alignment of RO & RW regions for
   npcx5m6g.
2. util/flash_ec: Add new board array, BOARDS_NPCX_5M6G_JTAG, to
   distinguish which flash layout ec used.
3. openocd/npcx_cmds.tcl: Add new script funcs to program flash with
   different layout.

BUG=chrome-os-partner:34346
TEST=make buildall -j; test nuvoton IC specific drivers
BRANCH=none

Change-Id: I0ace31d96d6df2c423b66d508d30cefb0b82ed6c
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/331903
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-03-15 21:49:36 -07:00
Shawn Nematbakhsh
554ecc6b9d util/iteflash: Return error on all verify failures
BUG=None
TEST=`make buildall -j`
BRANCH=None

Change-Id: Iefc8e1eaf1e5d7c8533d8497c227c8c16eb2c06d
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/331200
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-03-08 13:56:40 -08:00
Bruce
1e20c1f88d sb_firmware_update: Remove battery HWID check
We're supporting a wide range of batteries, and since file name
matching is based on HWID, we don't need to maintain a separate
table of supported HWIDs in our utility.

BUG=chrome-os-partner:49589,chrome-os-partner:50469
BRANCH=None
TEST=buildall

Change-Id: I3e7c62379c07a598e23f3c543959503d3d25aee3
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/330231
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Bruce Wan <Bruce.Wan@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-03-07 01:20:09 -08:00
Anatol Pomozov
da191ee1ac iteflash: Initialize variable that later used in the function
Latest GCC gives compiler error:
  util/iteflash.c: In function verify_flash:
  util/iteflash.c:927:9: error: res may be used uninitialized in
                this function [-Werror=maybe-uninitialized]
    return res;
           ^

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

Change-Id: I184d8673020552797fd54bb98ee582a63debbf16
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Reviewed-on: https://chromium-review.googlesource.com/330873
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-03-06 11:48:07 -08:00
Ryan Zhang
9d472018f9 Common : Fix ectool led cmd segmentation fault
led_color_names[] should have EC_LED_COLOR_COUNT numbers of data.

A missing data cause strcasecmp() compare argv[] with NULL in
find_led_color_by_name(), that results in Bundle Image test error

BUG=chrome-os-partner:50612
BRANCH=lars
TEST=`make -j buildall`, `ectool led power blue=255` with homemade ectool.
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>

Change-Id: I2132775f9d4a074517f9a98b81919dd77bc86102
Reviewed-on: https://chromium-review.googlesource.com/330075
Commit-Ready: David Wu <david_wu@quantatw.com>
Tested-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-03-04 11:35:50 -08:00
David Hendricks
ad7d6516b5 locks: Update lockfile dir to be FHS 3.0 compliant
The Filesystem Hierarchy Standard version 3.0* specifies that /run
should be used for runtime variables such as locks.

The rationale for switching to use /run instead of /var/run was
because /var might not be available at early boot. Since /run is
implemented as a tmpfs and doesn't require /var to be mounted first
it can be made available earlier.

*http://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s15.html

BUG=chromium:591366
BRANCH=none
TEST=none

Change-Id: Ic0b5ff336c1c258db8891c0a17c836497d9793c5
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/330123
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-03-02 18:03:45 -08:00
David Hendricks
d89301b036 Replace SysV semaphore lock with file lock
Some systems, such as Android, do not support SysV semaphore locks.
This implements an alternative file lock mechanism using flock().

flock() was chosen because it's pretty straight forward. It's known to
be broken when using NFS, but I doubt we'll ever store our lock on an
NFS volume.

CQ-DEPEND=CL:327407,CL:325609
BUG=chrome-os-partner:49527
BRANCH=none
TEST=tested on Smaug by running mosys and ectool while reading
firmware ROM with flashrom, all three utilities eventually
ran successfully.

Change-Id: Ic73fe0281fbc1dfaae1bb03e5683774a0c04ae5b
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/329430
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-03-01 14:53:50 -08:00
David Hendricks
7b43197449 Add library for working with Android
This adds a couple of helper functions for working within Android:
- in_android(): Crude test that uses getenv() to see if an Android-
specific environment variable is defined.

- android_tmpdir_path(): Android doesn't have the usual locations for
temporary file storage such as /tmp or even /var/run/locks. And to
make matters worse, there isn't even a standard location for
temporary files so it must be determined at run time.

This will be used in a follow-up patch.

BUG=chrome-os-partner:49527
BRANCH=none
TEST=tested on smaug

Change-Id: Ifb5fb4067fffb7c8cb2d4350ca4a223e884d3aa5
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/329299
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-02-29 18:20:07 -08:00
Vadim Bendebury
d1bf3aecfa cr50: signer: sync up with upstream
This change just copies files shared between two repositories which
have changed since the last sync up. This time it is as of @CL85098.

BRANCH=none
BUG=none
TEST=the signed image  boots fine on the b1 board.

Change-Id: I7a1d1b344119e6f6729a38bbea04da75f2d3371c
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/329407
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-02-27 00:38:28 -08:00
Donald Huang
8e31328e02 it8380dev: util: Fix iteflash flash issue
Fix iteflash flash issue.
1. Avoid EC watchdog reset while flashing.
2. Do watchdog reset after flashing.

BRANCH=none
BUG=none
TEST=Test OK on ITE8390CX.
     You can run "make -j BOARD=it8380dev" to build ec.bin
     and flash the ec.bin via
     "sudo ./build/it8380dev/util/iteflash -w ./build/it8380dev/ec.bin"

/* ==SNAPSHOT START== */

(cr) ((29b0840...)) donald@donald-nb ~/trunk/src/platform/ec $ sudo ./build/it8380dev/util/iteflash -w ./build/it8380dev/ec.bin
Waiting for the EC power-on sequence ...CHIPID 8390, CHIPVER 82, Flash size 256 kB
Done.
CHIPID 8390, CHIPVER 82, Flash size 256 kB
Erasing chip...
/100%
Writing 262144 bytes at 0x00000000
Done.
Verify 262144 bytes at 0x00000000
-100%
Verify Done.

/* ==SNAPSHOT END== */

Change-Id: I43fc5124f3854a516df17fab78649d4b083ed9b0
Signed-off-by: Donald Huang <donald.huang@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/328873
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-02-25 11:22:09 -08:00
Aseda Aboagye
defe8ea6a9 util: ec3po: Implement auto interrogation mode.
This commits adds support for the auto interrogation mode.  The auto
mode continually scans across the console output looking for a string
that is printed upon reboot.  The string is:

    Console is enabled; type HELP for help

When the EC-3PO interactive console sees this string, it knows that the
current EC image is not enhanced and therefore no longer needs to
perform an interrogation after every command.  Additionally, the
enhanced EC images will print a slightly different string than from
above so that the console can detect enhanced EC images as well.

By default, the console interpreter will now start up in the 'auto' mode
instead of the 'always' mode that it used to.  This removes the 300ms
delay after each console command.

BUG=chromium:588611
BRANCH=None
TEST=./util/ec3po/run_tests.sh
TEST=cros lint --debug util/ec3po/console.py
TEST=cros lint --debug util/ec3po/console_unittest.py

Change-Id: Iec7ebd437ee363c2fc01b8b1adade485a0bff7a9
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/329054
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-02-24 14:13:32 -08:00
Anatol Pomazau
e4565cca1a Add bionic compatibility
TEST=Build ectool for Android and run it
BUG=None
BRANCH=master

Signed-off-by: Anatol Pomazau <anatol@google.com>

Change-Id: I5f148adfc24591523a7d8c50817c8095072071c3
Reviewed-on: https://chromium-review.googlesource.com/327220
Commit-Ready: Anatol Pomazau <anatol@google.com>
Tested-by: Anatol Pomazau <anatol@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-02-10 18:19:24 -08:00
Aseda Aboagye
c0c4402623 util: ec3po: Allow changing interrogation modes.
Currently, a majority of the users don't use the experimental EC console
and as it stands, they have to wait approximately 300ms after pressing
enter after every command.

This commit adds a OOBM command to change the interrogation mode.
Additionally, it allows this command to be entered from the EC console.

Usage:

  interrogate <never | always | auto> [enhanced]

Type the percent key to enter the (primitive) OOBM console.  From
there a user can enter 'interrogate never' followed by enter to
completely disable the interrogation that occurs.

By default, the EC-3PO console will start in the 'always' state.

BUG=None
BRANCH=None
TEST=./util/ec3po/run_tests.sh
TEST=Run cros lint --debug for all changed files.

Change-Id: I10eef0c796eab4e0af1c232a3d3da8898ba3d348
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/327035
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@chromium.org>
2016-02-10 15:45:53 -08:00
Vadim Bendebury
d6c6dc5150 cr50: signer: pick up latest and greatest
These are relevant changes in the FPGA tree since the most recent sync
up.

BRANCH=none
BUG=chrome-os-partner:50141
TEST=image signed by the new signer boots successfully.

Change-Id: Id30c5da614aa5c2496305f9687bce06030449beb
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/326483
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-02-08 12:09:06 -08:00
Vadim Bendebury
ce52342554 cr50: add public key for RO verification
This key matches the private key used by the chip's rom to verify the
first stage user firmware.

By virtue of the fact that this is a public key, the signer, in case
this key is used, will look for a fob storing the matching private key
to sign the read-only portion of the image.

BRANCH=none
BUG=chrome-os-partner:49950
TEST=none yet

Change-Id: I0c55d5250a354eae8294560ef7b442fee6445b4f
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/326481
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-02-08 12:09:05 -08:00
Aseda Aboagye
cef39847f4 flash_ec: Disconnect EC-3PO interps when flashing.
Since the stm32 MCUs are programmed over the UART, we need to make
some changes to allow the interpreter to stop listening to the UART
PTY when flash_ec needs those PTYs.  Otherwise, the EC-3PO interpreter
will interfere with the programming and cause the flash to fail every
time.

BUG=chromium:571170
BRANCH=None
TEST=Use flash_ec to program both veyron_jerry and samus_pd with no
interruptions.
TEST=Use flash_ec to program veyron_jerry without servod changes with
no interruptions.

CQ-DEPEND=CL:321084
CQ-DEPEND=CL:318900

Change-Id: I350fdb708d30c4ec6f18e5dc4abd621370522381
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/320629
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
2016-02-06 17:28:00 -08:00
Luigi Semenzato
4ec554dd8f ectool: add inject-keys.py
A simple wrapper for "ectool kbpress" to do basic automation
when working remotely (for instance, logging in).

Includes a test script.

BUG=b:26349756
TEST=ran on platform in various ways
BRANCH=none
Signed-off-by: Luigi Semenzato <semenzato@chromium.org>

Change-Id: I96fdd99aa228b51cf22f9323facdc4ddb59db9ff
Reviewed-on: https://chromium-review.googlesource.com/322286
Commit-Ready: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-02-05 06:02:49 -08:00
Shawn Nematbakhsh
c5e0634054 cleanup: Fix signed vs unsigned typing
- ec_response_thermal_get_threshold.value is unsigned, so it can not be
  less than zero.
- make power_button_wait_for_release() take a signed int, to match its
  existing usage.

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

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ie5748df3d9904d1e417adc38fee18f8cb3ce9750
Reviewed-on: https://chromium-review.googlesource.com/325840
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-02-03 21:34:47 -08:00
Aseda Aboagye
086e501be3 util: ec3po: Add OOBM queue and dynamic loglevels.
This commit adds an Out Of Band Managament queue which will allow the
console to receive commands outside of the PTY which it can take
action on.  The first use of this is to dynamically change the logging
level.  Prior to this change, changing the log level using dut-control
would not affect the log level of the console or interpreter.

BUG=None
BRANCH=None
TEST=Launch modified servod; issue dut-control loglevel:debug, verify
that debug messages from both servod and ec3po are emitted.  Then
issue dut-control loglevel:info and verify that no debug messages from
either are emitted.

Change-Id: I692824742b018da9540a81305985f6f355f716e6
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/325134
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-02-03 17:16:33 -08:00
Aseda Aboagye
8d3fe8d54d util: ec3po: Change console permissions to 660.
666 gives out permissions to everyone and should be avoided.  A
similar change is made in servod.

BUG=None
BRANCH=None
TEST=Run console.py and verify that the created PTY has the
permissions of 660.

Change-Id: Ib58952af5f9681fdc2ef351b2c2ac2ec10109095
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/325493
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-02-03 15:00:19 -08:00
Stefan Reinauer
4f6f505900 Fix null pointer check in tokenFilename()
From https://scan.coverity.com/projects/chromium-ec :
CID61407: Dereference after null check

The home directory that is received from getpwuid()
needs to be assigned to home but it wasn't.

BUG=none
BRANCH=none
TEST=build tested
Signed-off-by: Stefan Reinauer <reinauer@chromium.org>

Change-Id: I36c30906e1388e2f8a0d466d516a5ffa6ae70bf6
Reviewed-on: https://chromium-review.googlesource.com/324637
Commit-Ready: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-02-01 17:18:23 -08:00
Donald Huang
bca1ba350f it8380dev: util: Enhance iteflash
Add verify function.

BRANCH=none
BUG=none
TEST=Test OK on ITE8390CX.
     You can run "make -j BOARD=it8380dev" to build ec.bin
     and flash the ec.bin via
     "sudo ./build/it8380dev/util/iteflash -w ./build/it8380dev/ec.bin"

/* ==SNAPSHOT START== */

(cr) (b-verify) donald@donald-nb ~/trunk/src/platform/ec $ sudo ./build/it8380dev/util/iteflash -w ./build/it8380dev/ec.bin
Waiting for the EC power-on sequence ...CHIPID 8390, CHIPVER 82, Flash size 256 kB
Done.
CHIPID 8390, CHIPVER 82, Flash size 256 kB
Erasing chip...
/100%
Writing 262144 bytes at 0x00000000
Done.
Verify 262144 bytes at 0x00000000
-100%
Verify Done.

/* ==SNAPSHOT END== */

Change-Id: Iac08e2eeb934c3a4a721e17a85de628ea4d9d065
Signed-off-by: Donald Huang <donald.huang@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/322524
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-01-29 01:06:33 -08:00
Nick Sanders
a50b12ef97 flash_ec: Allow dfu updates without servo console
flash_ec is used for both ec chips accessed over servo, and
standalone stm32 devices. It's not necessary to have a servo
conencted to update the standalone devices over usb.

This is useful for servo v4 and servo micro.

BUG=chromium:571477
TEST=Verify servo micro/discovery can be flashed without servo v2.
BRANCH=none

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

Change-Id: I9deee1616d93feeac4d6675bc3a4f573d4906f7b
Reviewed-on: https://chromium-review.googlesource.com/321925
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@google.com>
Reviewed-by: Wai-Hong Tam <waihong@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
2016-01-14 19:52:55 -08:00
Aseda Aboagye
b1b0e88beb util: ec3po: Change console permissions to 666.
Updated the permissions of ec_uart_pty to match the permissions of the
other PTYs.

BUG=None
BRANCH=None
TEST=cros_workon hdctools ec-devutils, run servod, ls -l on ec_uart_pty
from dut-control, verify that permissions are 666.

Change-Id: I71c72645c5a435fea562084185b80ff6d31652b4
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/321371
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
2016-01-12 14:10:26 -08:00
Aseda Aboagye
4368dcfb32 util: ec3po: Add support to disconnect from UART.
This commit adds support for the EC-3PO interpreter to disconnect and
reconnect to the EC UART.  This is handy so that other tools that need
to use the raw UART directly can do so without interference from
EC-3PO.

BUG=chromium:571170
BRANCH=None
TEST=For both enhanced and non-enhanced EC images, issue disconnect
command and verify that no debug prints were emitted and no commands
were sent to the EC.  Then issue reconnect and verify that the console
works as normal and that no commands were buffered.
TEST=./util/ec3po/run_tests.sh

Change-Id: Ic572e25d24d5e45fbe2eeb84a534235c4ec98d38
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/321084
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-01-11 20:05:40 -08:00
Shawn Nematbakhsh
119916761c sb_firmware_update: Use any available host protocol
Don't restrict host protocol to LPC since newer boards only support
COMM_DEV.

BUG=chrome-os-partner:44052
TEST=Verify SB FW update is successful on Ultima.
BRANCH=None

Change-Id: I64f0c3ff278fe464cc71661454734c4cac5e88a9
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/321330
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-01-11 17:56:23 -08:00
Aseda Aboagye
726ce97002 util: presubmit_check.sh: Fix (again) for ec3po.
If a user had already run util/ec3po/run_tests.sh, and then never
modified any ec3po files, the presubmit check would list every file in
the EC repo that was newer since the the last run.  This included
files such as build artifacts.

BUG=chromium:575032
BRANCH=None
TEST=Run ./util/ec3po/run_tests.sh once.  Run make -j buildall, try to
upload and verify that no nag message to run ec3po tests is presented.
TEST=Touch an ec3po file, try to upload, verify that nag message about
running ec3po unit tests is presented.

Change-Id: I4f09bb76dcd85b570b57030197f4887bed85f1a7
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/321134
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-01-11 14:05:01 -08:00
Aseda Aboagye
c7c04e673e util: presubmit_check.sh: Fix check for ec3po.
The presubmit check would nag at the user to run the EC-3PO unit
tests, even if they hadn't modified any EC-3PO files.  This was not my
intention.  This commit fixes the presubmit check to only check for
unit test success if a EC-3PO file is modified.

BUG=chromium:575032
BRANCH=None
TEST=Remove util/ec3po/.tests-passed; Modify a non-ec3po file, commit,
and try to upload.  Verify that no nag message is presented.
TEST=Remove util/ec3po/.tests-passed; Modify a ec3po file, commit, and
try to upload.  Verify that a nag message to run unit tests is
presented.

Change-Id: I86e9f325329b7ad1a4c7c5971b7851e9024e7750
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/320831
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-01-07 14:29:41 -08:00
Aseda Aboagye
9fce7075d9 util: ec3po: Add served PTY to logging.
Some devices have multiple ECs (main EC and PD MCU) and therefore there
are multiple consoles and interpreters running concurrently.  This
commit prepends each log message with the served PTY to identify which
of the console or interpreter instances the log message comes from.

BUG=None
BRANCH=None
TEST=Ran ec3po in servo for samus. Noticed each debug print with the
different PTYs for the main EC as well as the PD MCU.
TEST=util/ec3po/run_tests.sh

Change-Id: Icc69d2257172f4fedc217572ad0b6d15dac40387
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/320597
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@chromium.org>
2016-01-05 21:14:44 -08:00
Aseda Aboagye
5f18982f67 util: ec3po: Change interrogation timeouts.
In testing, it was found that certain ECs couldn't respond to the EC_SYN
in less than 0.1s.  Therefore, this commit changes the interrogation
timeouts.  For non-enhanced EC images, the timeout has been increased to
0.3 seconds.  This is small enough that there's not too much of a delay,
but long enough that enhanced EC images can respond in time.  With an
enhanced EC image on veyron_jerry, EC_ACKs were arriving after ~0.2s.

BUG=None
BRANCH=None
TEST=Flash enhanced EC image on veyron_jerry, start console/interpreter
pair and verify that the console is functional.
TEST=util/ec3po/run_tests.sh

Change-Id: I4931aaee908653ae302a8e57941444e5f0b6ce2b
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/320594
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-01-05 21:14:42 -08:00
Aseda Aboagye
c6773e6765 util: ec3po: Add presubmit check for ec3po.
Added presubmit check to make sure that when any ec3po files are
modified, the unit tests should be run as well.

BUG=None
BRANCH=None
TEST=Touched a unit test file, tried repo upload and received an error
about running unit tests.  Ran run_tests.sh and all tests passed.  Tried
to repo upload again and this time it succeeded.
TEST=Created a failure in one unit test, ran run_tests.sh and verified
that the failure was caught and the CL wouldn't pass the presubmit
check.

Change-Id: I4df4a0fd1107292f693749188491f6286360f557
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/319211
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-01-04 16:26:22 -08:00
Shawn Nematbakhsh
d85c7d3f1b util: npcx: Fix build for ARM host boards
ecst is used at build / link time, so it should be compiled for the
build machine architecture, not the architecture of the host board.

BUG=chromium:567232
TEST=Verify 'cros_sdk ... cros_run_unit_tests --board=oak' passes with
CL:319256.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ic7f6aa989d0760eda1fe64221e41d3230c9ab9b9
Reviewed-on: https://chromium-review.googlesource.com/319633
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-12-30 13:52:45 -08:00
Aseda Aboagye
4bad633cb9 ec3po: Add graceful exit.
The console and interpreter are usually killed by KeyboardInterrupt
whether or not it's run standalone or by servod.  This commit tries to
make the exit graceful by closing pipes, file descriptors, and exiting
each process.

BUG=chromium:570526
BRANCH=None
TEST=Run ec3po standalone and hit Ctrl+C to kill it.  Observe no
traceback and no leftover processes.
TEST=Repeat above test, but inside servod
TEST=cros lint --debug util/ec3po/console.py
TEST=cros lint --debug util/ec3po/interpreter.py
TEST=python2 -b util/ec3po/console_interpreter.py
TEST=python2 -b util/ec3po/console_interpreter.py

Change-Id: Ia151b9ede8adf7f8dec6c07277f62d097c13e63e
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/319252
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@chromium.org>
2015-12-17 23:45:18 -08:00
Aseda Aboagye
f5773e74d5 ec3po: Add setup script.
This commit adds a setup script for the ec3po package.  This is
necessary such that ec3po can be included as a part of ec-devutils.

BUG=chrome-os-partner:46054
BRANCH=None
TEST=Update the ec-devutils ebuild to install the ec3po package.
sudo emerge ec-devutils; `python -c 'import ec3po'; print ec3po`
in the chroot.  Verify that ec3po is installed in the site-packages.
TEST=Verify that interpreter and console modules are exported in the
package.

CQ-DEPEND=CL:316479

Change-Id: I5c8856b530936dc4ce3b09e38802f1e015c4576b
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/316701
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
2015-12-08 20:05:05 -08:00