summaryrefslogtreecommitdiff
path: root/util
Commit message (Collapse)AuthorAgeFilesLines
* util: add build include for private host toolsHarry Cutts2019-10-111-0/+6
| | | | | | | | | | | | | | | | | | | | | | We have provision for private host commands (see the `EC_PRIVATE_HOST_COMMAND_VALUE` macro), but no way to make a private host-side tool that can share the host command protocol implementation in util/. This CL allows a private directory to be symlinked as util/private and have its build.mk file included in the build. For an (internal-only) example of what you might put in private, see https://crrev.com/i/1914158. BRANCH=none BUG=chromium:1008568 TEST=Patch https://crrev.com/i/1914158 in the private repo (or add a util directory there with a build.mk), then from the ec directory, run `ln -s ../private/util util/private`. Run a build and verify that the private build.mk gets run. Change-Id: Ie1ad00cb454ba9ed57e4e9b24d4f5d397ca0d7a5 Signed-off-by: Harry Cutts <hcutts@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1836757 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* flash_fp_mcu: Add pwr enable for hatch followersCraig Hesling2019-10-101-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | This change ensures that the power is enabled for the FPMCU. This change is valid for all hatch followers. BRANCH=hatch BUG=b:142001487 TEST=cros_workon --board=hatch start chromeos-base/ec-utils-test emerge-hatch chromeos-base/ec-utils-test cros deploy --root=/usr/local dut1 chromeos-base/ec-utils-test # Manually power off the fpmcu cd /sys/class/gpio echo 467 >export echo out >gpio467/direction echo 0 >gpio467/value echo 467 >unexport # ectool --name=cros_fp version # should fail # flash_fp_mcu prior to this CL should fail here, also # determine the proper firmware for fp board and replace below flash_fp_mcu /opt/google/biod/fw/*.bin # Ensure that flash_fp_mcu succeeds Change-Id: Ia96690d49bb4e5bb25aeebddcc08687b13a43b0b Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1845781
* ec_commands: Obsolete v0 and declare v1 of host command EC_CMD_POWER_INFOTim Wawrzynczak2019-10-051-9/+29
| | | | | | | | | | | | | | | | | | | | | v0 of this command is no longer used (no handler is defined), so it is removed. The new host command version gives the AP the ability to dynamically change its power settings based on the battery status, A/C, USB-PD, and the static configuration of the system and its battery. Also modified ectool to support v1 of this command and deprecate support for v0. BUG=b:139840435 BRANCH=master TEST=buildall Change-Id: I516d838581400314e626fd679ca1c5afd5e34ff6 Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1825880 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* printf: Enable compile-time format checkingEvan Green2019-10-051-0/+1
| | | | | | | | | | | | | | | Add annotations to allow the compiler to check printf-style format strings in the EC. BUG=chromium:984041 TEST=make -j buildall BRANCH=None Change-Id: Ic39f37f8362372de7d289becea684d9da535599a Signed-off-by: Evan Green <evgreen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1733101 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* flash_ec: Look for flashrom in PATH before /usr/sbinRaul E Rangel2019-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | /usr/sbin should have lower priority than $PATH. This allows pointing to a different version of flashrom by setting the path variable. It shouldn't have any impact because by default flashrom is installed in /usr/sbin. BUG=none BRANCH=none TEST=PATH=/tmp/zork:$PATH flash_ec --board=zork --image=foo.bin Change-Id: Ie656bec10145734bdec1f067b08f164afcf89e90 Signed-off-by: Raul E Rangel <rrangel@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1842034 Commit-Queue: Edward Hill <ecgh@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* flash_ec: Support image name with spacesRaul E Rangel2019-10-041-2/+2
| | | | | | | | | | | | BUG=none BRANCH=none TEST=Flashed a zork ec image with a space in the name Change-Id: I9915f04f222de7a34e757fddcb30563d66093c71 Signed-off-by: Raul E Rangel <rrangel@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1842033 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org>
* util/comm-i2c: Add switch to specify I2C busHarry Cutts2019-10-044-34/+73
| | | | | | | | | | | | | | | | | | | | Currently, devices running CrOS EC that aren't actually the embedded controller (such as touchpad or fingerprint MCUs) can only be contacted over I2C if they are in the device tree. To avoid having to recompile the Kernel, Coreboot, or `ectool`, the `--i2c_bus` switch allows `ectool` to be used for testing as-is. BRANCH=none BUG=none TEST=Checked various commands (hello, version, inventory...) with `--i2c_bus=7`, connecting to a MAX32660. Verified that a contradictory `--interface` switch is rejected. Checked that invalid bus numbers (≥32) are rejected. Change-Id: I92f3307bbbdf88978b9f8271610a3ae222279767 Signed-off-by: Harry Cutts <hcutts@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1828064 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* fpsensor: Add async FP_CMD_CONTEXTTom Hughes2019-10-021-0/+55
| | | | | | | | | | | | | | | | | | | | Setting the context now triggers a reset of the sensor library (see I3e25bdf7eaaf99f3801547e11a6c524f924f4726), which in turn will end up calling fp_sensor_open to re-initialize the sensor. Since some calibration is performed in that command, it takes ~173 ms, which is close enough to the EC command timeout (200 ms) that it often fails. This change makes the command "asynchronous" so that userspace can poll for the result and avoid the command timeout. BRANCH=nocturne BUG=b:137288498 TEST=make buildall -j TEST=ectool --name=cros_fp fpcontext 01234567890123456789012345678901 Change-Id: I997bf9c5b9e90eceb5375dccffcb535529a86e47 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1819115 Reviewed-by: Yicheng Li <yichengli@chromium.org>
* cr50: prepare to release 0.{3,4}.23Vadim Bendebury2019-10-022-2/+2
| | | | | | | | | | | | | | Note that 0,x.22 is skipped, 0.3.22 will be used for the new factory image. BRANCH=cr50, cr50-mp BUG=none TEST=none Change-Id: I4f6d2fefcfade38e9f8443e4faf2c0a58c56ff36 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1834525 Reviewed-by: Andrey Pronin <apronin@chromium.org>
* Unify #! use in python scriptsStefan Reinauer2019-10-019-9/+9
| | | | | | | | | | | | | | | | | | Right now we have several different versions of #! in our python scripts. Unify them all and specify that we are using python2. Signed-off-by: Stefan Reinauer <reinauer@chromium.org> BUG=none BRANCH=none TEST=make buildall Change-Id: Iab33a3f5d4b827451a55542bcee8837b00da7867 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1817948 Commit-Queue: Stefan Reinauer <reinauer@chromium.org> Tested-by: Stefan Reinauer <reinauer@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* util/comm-i2c: return response length from `ec_command`Harry Cutts2019-10-011-1/+1
| | | | | | | | | | | | | | | | | | In my original implementation I returned the response code (possibly because I was confused by `ec_command_servo_spi` returning something like that), but `do_i2c_xfer` (used for all I2C passthrough stuff) breaks in that case. Changing it to return response length (consistent with the `ec_command` doc comment) fixes that problem. BRANCH=none BUG=chromium:1008568 TEST=Use `ectool i2cwrite ...` to write to one of the EC's I2C slaves (should report success instead of "Truncated read response"). Change-Id: I341c3907ac44c6c3d1086ae10b31e81062215f20 Signed-off-by: Harry Cutts <hcutts@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1830099 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* automation: move create_variant to dev/contribPaul Fagerburg2019-09-281-63/+0
| | | | | | | | | | | | | | | | | Most of the scripts to automate creating a new variant are moving to platform/dev/contrib/variant for maintenance reasons. Keeping them in one place makes it easier to coordinate changes in the scripts, instead of having them spread across different repos. It also allows keeping documentation close to the scripts. BUG=b:140261109 BRANCH=None TEST=N/A, script is being removed Change-Id: Idd9ad328d2fab34a9bd9e42c360219b75018d3af Signed-off-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1829398 Reviewed-by: Jett Rink <jettrink@chromium.org>
* util/comm-i2c: upgrade to host command protocol v3Harry Cutts2019-09-261-104/+133
| | | | | | | | | | | | | | | | | | | | | We can remove the v2 code, as any boards still using it have reached end-of-life, with the exception of Samus's PD, which we only communicate with via the Kernel driver, as far as I can tell. (I verified that an `ectool` built with this change can still be used to communicate with the Samus PD.) BRANCH=none BUG=none TEST=Checked various commands (hello, version, inventory...) with `--interface=i2c` and `comm_init_i2c` modified to hard-code the I2C bus to use (as the board I tested with is not yet in sysfs). The test board is using a MAX32660, so https://crrev.com/c/1716928 was patched in for testing. Change-Id: I1e014c6f747ce29d9bf1541be51c519af98e7f45 Signed-off-by: Harry Cutts <hcutts@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1803977 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* cleanup: remove copy of pd_cc_state enumJett Rink2019-09-261-9/+9
| | | | | | | | | | | | | | | | | | | | | The EC command interface created a separate copy of the enum pd_cc_state. Remove the EC command version and move the pd_cc_state definition to the command interface. Also remove PD_CC_NO_UFP option as there is no difference between that value and PD_CC_NONE. Split PD_CC_DEBUG_ACC into separate UFP and DFP values for clarity. BRANCH=none BUG=none TEST=builds Change-Id: Ic8c4c5ac4dd340b1e605100e35acb147c226a455 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1825503 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Sam Hurst <shurst@google.com>
* iteflash.md: Update link to CrOS EC development docMatthew Blecker2019-09-251-1/+1
| | | | | | | | | | | BRANCH=none BUG=none TEST=Used Gitiles to view and follow the updated link. Change-Id: I5be72babb69e4c76b4f38f8370448bf9ab795ba0 Signed-off-by: Matthew Blecker <matthewb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1825501 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* ec: improvements in automation scriptPaul Fagerburg2019-09-211-34/+33
| | | | | | | | | | | | | | | | | | | | | | | | | Make style changes (upper case for variable names, uniform exit codes, don't need to popd when exiting) and error handling improvements in the create_variant.sh script. Add optional parameter to specify the bug number for creating the new variant. BUG=b:140261109, chromium:999705 BRANCH=none TEST=``./create_variant.sh hatch sushi && git show`` Compare board/hatch/* to board/sushi/* Also run the script with an existing board name to verify that you can't create a variant that already exists. Also run the script with a non-existent base board to verify that you can't clone something that doesn't exist. Cq-Depend: chromium:1782686 Signed-off-by: Paul Fagerburg <pfagerburg@chromium.org> Change-Id: I7bad4e3f2b368dc4baf71a9ffd5460e05fd17d63 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1814396 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* flash_fp_mcu: add options for flash read/write protectionTom Hughes2019-09-181-3/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Defaults to disabling both read and write flash protection, but you can disable either or both with these new commandline flags. This is primarily going to be used for testing (e.g., RDP1 to RDP0 causing mass erase). BRANCH=nocturne,nami BUG=chromium:890059 TEST=dut-control fw_wp_state:force_off flash_fp_mcu /opt/google/biod/fw/nami_fp_v2.2.133-31dfe0b1a.bin ectool --name=cros_fp version TEST=flash_fp_mcu -r /tmp/rb.bin diff /tmp/rb.in /opt/google/biod/fw/nami_fp_v2.2.133-31dfe0b1a.bin TEST=dut-control fw_wp_state:force_on ectool --name=cros_fp flashprotect enable ectool --name=cros_fp reboot_ec dut-control fw_wp_state:force_off flash_fp_mcu -r --noremove_flash_read_protect /tmp/rb.bin echo $? => 1 ectool --name=cros_fp version => works flash_fp_mcu -r /tmp/rb-erase.bin hexdump /tmp/rb-erase.bin => all 0xff Change-Id: I42f7daf08dcf229a4980c88a24e6882be7c0e8d6 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1474743
* util/ecst: Fix sign issues for file sizePatrick Georgi2019-09-121-2/+2
| | | | | | | | | | | | | | | | | | Since we'll never have to deal with 2GB+ sized images, don't bother with larger data types. Found by Coverity Scan #203948 BUG=none BRANCH=none TEST=none Change-Id: I95cb75d693b94444a87d2100a3f25ddae87a5faa Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1801207 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* util/ecst.c: Improve return values in calc_header_crc_binPatrick Georgi2019-09-121-3/+3
| | | | | | | | | | | | | | | | Ensure consistency in types (TRUE/FALSE) and document the outcome in the function header. BUG=none BRANCH=none TEST=none Change-Id: Ie3786f5de6f1a93813afd4a88be2994b690886c6 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1793587 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* util/ecst.c: Catch errors in remaining fseek callsPatrick Georgi2019-09-121-3/+7
| | | | | | | | | | | | | | | | | | There's little reason why fseek should fail, but when it does, we're not looking where we think we look. Found by Coverity Scan #58144 BUG=none BRANCH=none TEST=none Change-Id: I7a784cb96def611ae5802d530882eb14daf58ce1 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1793585 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* util: Add missing "meanings" from ec_status codesTom Hughes2019-09-091-1/+6
| | | | | | | | | | | | | | | The "meanings" array is used to translate the ec_status enums, but haven't been kept in sync. This results in valid ec_status return values showing up as "<unknown>". BRANCH=none BUG=none TEST=make buildall -j Change-Id: I82a8fe0e60716b11ca305a1a5bef2e26fec5b1aa Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1790567 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* util/ectool: check malloc for NULLPatrick Georgi2019-09-071-0/+2
| | | | | | | | | | | | | | | | Found by Coverity Scan #141760. BUG=none BRANCH=none TEST=none Change-Id: Icba3268919e8dde937e00172c288b10e2e3f6e87 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1789147 Tested-by: Patrick Georgi <pgeorgi@chromium.org> Auto-Submit: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* util/ecst: check fseek/ftell return valuesPatrick Georgi2019-09-071-26/+35
| | | | | | | | | | | | | | | | | | | | Found by Coverity Scan #5814[14-9], #58159, #58160 Also fix a bunch of typos in comments and variable names and remove extraneous fseek(..., 0, SEEK_SET) before moving to the actual offset (again with SEEK_SET). BUG=none BRANCH=none TEST=none Change-Id: I9d7cb950a7a659c5abb1ff7d6d2c48d623ee515c Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1789145 Tested-by: Patrick Georgi <pgeorgi@chromium.org> Auto-Submit: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* util/ectool.c: Fix resource leakPatrick Georgi2019-09-071-0/+1
| | | | | | | | | | | | | | | | Found by Coverity Scan #141759. BUG=none BRANCH=none TEST=none Change-Id: I7b17330aa25a6d23c1a547829d6908931baa7891 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1789146 Tested-by: Patrick Georgi <pgeorgi@chromium.org> Auto-Submit: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* util/ecst.c: ensure string terminationPatrick Georgi2019-09-071-5/+9
| | | | | | | | | | | | | | | | Found by Coverity Scan #58136, #58137 BUG=none BRANCH=none TEST=none Change-Id: Ie17330c4766f6537134117ecd81ecd78cd408132 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1789144 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Auto-Submit: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* ec: create initial EC image for a new variantPaul Fagerburg2019-09-061-0/+64
| | | | | | | | | | | | | | | | | | | | | | Creating an initial EC image for a variant is just a copy of the base board's files. After all of the CLs to create the variant have landed, then we can make changes specific to the variant. BUG=b:140261109, chromium:999705 BRANCH=none TEST=``./initial_ec_image.sh hatch sushi && git show`` Compare board/hatch/* to board/sushi/* Also run the script with an existing board name to verify that you can't create a variant that already exists. Also run the script with a non-existent base board to verify that you can't clone something that doesn't exist. Change-Id: Ic54b0b5a8b41476779dcbb6af63bd0ddfaff2896 Signed-off-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1782686 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* util/ectool: Free memory before giving upPatrick Georgi2019-09-041-0/+2
| | | | | | | | | | | | | | | Found by Coverity Scan #203652, #203653 BUG=none BRANCH=none TEST=none Change-Id: I195773c42d4d0dfa35836e3e442cca15125ac9ea Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1781471 Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* util/iteflash: Close file on error pathPatrick Georgi2019-09-041-0/+1
| | | | | | | | | | | | | | | Found by Coverity Scan #58166 BUG=none TEST=none BRANCH=none Change-Id: I1caa2a407a2c623c006c500a56c7048649ebb158 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1781470 Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* util/uut: Fix printf formatsPatrick Georgi2019-09-042-7/+7
| | | | | | | | | | | | | | | Found by Coverity Scan #1194{41,48,49,50,53,54,55} BUG=none BRANCH=none TEST=none Change-Id: I8fee672359f7b13639d09e603f3aaa11de05e820 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1781468 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* util/uut/l_com_port: coding style fixPatrick Georgi2019-09-041-4/+4
| | | | | | | | | | | | | | | | The upload hooks complained about using the function name in the string, asking to use __file__ instead. BUG=none BRANCH=none TEST=repo upload is happy now Change-Id: I089e3acd3015cfea74439b2cccd5bb07eb5a4045 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1781467 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* util/comm-i2c: Fix memory leakPatrick Georgi2019-09-041-1/+2
| | | | | | | | | | | | | | | Found by Coverity #58167 BUG=none BRANCH=none TEST=none Change-Id: I434d4b140683b4c3440c30b232fab34d781da9d4 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1781466 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* audio_codec: remove unused EC_FEATURE codeTzung-Bi Shih2019-09-031-1/+0
| | | | | | | | | | | | | | | | Audio codec don't use EC feature. Remove all EC_FEATURE-related code. BRANCH=none BUG=b:122027734, b:123268236 TEST=make BOARD=kukui_scp -j Change-Id: Ib46c5a9bc1486547b81b76d3683e1faf7ff8483d Signed-off-by: Tzung-Bi Shih <tzungbi@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1697885 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
* util/ectool: Protect against out-of-memory conditionPatrick Georgi2019-08-281-1/+6
| | | | | | | | | | | | | | | Found by Coverity Scan BUG=none BRANCH=none TEST=none Change-Id: I9c29f915a732e8dc762b6ebcdffda6f433e983c2 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1768652 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* cr50: prepare to release 0.{3,4}.21Vadim Bendebury2019-08-272-2/+2
| | | | | | | | | | | BRANCH=cr50, cr50-mp BUG=none TEST=none Change-Id: Ib94b414de9531c9ea603ba377186c90b1c9fd91c Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1769492 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* flash_ec: Add support for dartmonkey and bloonchipperCraig Hesling2019-08-271-1/+3
| | | | | | | | | | | | | | | | | | | | | | | This adds the aforementioned aliases to the flash_ec script. These aliases already exist as boards, thanks to crrev.com/c/1715638. Aliases: dartmonkey --> nocturne_fp bloonchipper --> hatch_fp BRANCH=none BUG=b:140059271,b:136678758,b:137108509 TEST=sudo servod -b dragonclaw ./util/flash_ec --board=bloonchipper --image=build/bloonchipper/ec.bin TEST=sudo servod -b dragontalon ./util/flash_ec --board=dartmonkey --image=build/dartmonkey/ec.bin Change-Id: Id4476da4cab9e72092b529c1bfc52acb4edd44cd Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1769491 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* flash_ec: npcx_uut uses "--read-flash" flag to read EC binaryNamyoon Woo2019-08-261-14/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | flash_ec used to get a flash memory size from EC UART command "flashinfo", and pass it to uartudatetool with read command. If EC is in a bad status, then it failed to read EC binary, because flashinfo wasn't responded. Thanks to the patch crrev.com/c/1763888, flash_ec doesn't need to pass the flash memory size to uartupdatetool to read binary. Instead, it just passes "--read-flash". This CL also handles the comparison between the different sized binaries. BUG=b:139752920 BRANCH=null TEST=manually ran flash_ec on platforms. $ util/flash_ec --board ${BRD} --image ${IMG} --verify - Checked on hatch with ccd and servo_v2. - Checked on liara with ccd, servo_v2 and servo_micro. - Checked on fleex with ccd and servo_micro. - Checked on scarlet with ccd. Cq-Depend:chromium:1763888 Change-Id: I196420dc29ce95c6737dbc241ba92660557d2bc5 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1766095 Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Mary Ruthven <mruthven@chromium.org>
* util: UartUpdateTool: support "--read-flash" flagCHLin2019-08-263-13/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch creates a table to map the chip/device ID to the size of the internal flash. When the "--read-flash" flag is given, uut will read the device ID and chip ID registers and use them to look up the table to get the flash size. Afterward, uut will read the flash content from flash according to the size and write it to the file specified by the "--file" flag. BUG=b:139752920 BRANCH=none TEST=manually ran the following commands on yorp and grunt. dut-control --port=9999 ec_ec3po_interp_connect:off dut-control --port=9999 ccd_keepalive_en:on dut-control --port=9999 ccd_ec_boot_mode_uut:on dut-control --port=9999 cold_reset:on dut-control --port=9999 cold_reset:off dut-control --port=9999 ccd_ec_boot_mode_uut:off ./build/${BOARD}/util/uartupdatetool --port=pts/15 --baudrate=115200 --read-flash --file=<file_name> diff ./build/yorp/ec.bin <file_name> Change-Id: If802c76e1690af2d84edea950d3755fa87347159 Signed-off-by: CHLin <CHLIN56@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1763888 Reviewed-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: CH Lin <chlin56@nuvoton.com> Tested-by: CH Lin <chlin56@nuvoton.com>
* util: uartupdatetool: do not strip trailing white spaceNamyoon Woo2019-08-231-8/+2
| | | | | | | | | | | | | | | | | | | uartupdatetool won't ignore trailing white space. It will erase flash segments for sure corresponding to that part. BUG=b:139884342 BRANCH=None TEST=manually ran flash_ec on hatch through ccd with two different binaries: one ${IMG1} has less trailing 0xFF space than the other ${IMG2}. flash_ec --board hatch --image ${IMG1} --verify flash_ec --board hatch --image ${IMG2} --verify Change-Id: Id25a9e05a2d2df76255dd688f829dee48dc819cf Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1766099 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* ectool: Update usbpdmuxinfo to latest changesVijay Hiremath2019-08-221-11/+7
| | | | | | | | | | | | BUG=b:139140865 BRANCH=none TEST=Manually tested on intelrvp, "ectool usbpdmuxinfo" command shows correct SS mux info Change-Id: Id9dc616f62cb88600c3bcb631c08423661cc32c8 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1759279 Reviewed-by: Jett Rink <jettrink@chromium.org>
* flash_ec: use active_v4_deviceMary Ruthven2019-08-221-4/+31
| | | | | | | | | | | | | | | | | | | | Servo may be using ccd and servo micro. Update the flash_ec servo type to reflect which device actually has control of the DUT, so flash_ec can make the correct decisions about how to flash the device. Add the device prefix to all dut-control commands. If servo is using ccd and servo_micro, ccd controls will be prefixed with 'ccd_cr50.'. Add this prefix to all dut-control commands. BUG=b:35579416 BRANCH=none TEST=flash phaser ec ec using servo_v4_with_servo_micro_and_ccd_cr50, servo_v4_with_servo_micro, and servo_v4_with_ccd_cr50 Change-Id: I3d561ceb3c0ef0d95678c8346fb9922fd44378bf Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1757272 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* util: UartUpdateTool retries Host/Dev sync up to three timesNamyoon Woo2019-08-221-12/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch increases the number of device sync attempts from two to three. It is to be tolerant on the first command failure because of USB DATA PID mismatch that could happen from USB reconnection. BUG=b:135617689 BRANCH=none TEST=Tested on Hatch and Kohaku, Octopus and Grunt. $ ./util/flash_ec --board hatch --image ${IMG} ... Performing a Host/Device synchronization check... Host/Device synchronization failed, error = 1. Writing [784] bytes in [4] packets ... INFO: Flashing done. INFO: Restoring servo settings... The first attempt runs good. Disconnect Suzy-Q cable, and reconnect it, and run it again: $ ./util/flash_ec --board hatch --image ${IMG} Before this patch, it used to fail: ... Performing a Host/Device synchronization check... Host/Device synchronization failed, error = 2. Host/Device synchronization failed, error = 1. ERROR: Failed to load monitor binary. INFO: Restoring servo settings... After this patch, it succeeds: ... Performing a Host/Device synchronization check... Host/Device synchronization failed, error = 2. Host/Device synchronization failed, error = 1. Writing [784] bytes in [4] packets ... INFO: Flashing done. INFO: Restoring servo settings... Change-Id: Id8e7041a5cb08075129148ddba5e8cf12f3aae54 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1755182 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* driver: lis2dwl: add driver supportPaul Ma2019-08-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | lis2dwl has almost the same register interface as lis2dw12. lis2dwl only has one low power mode and when in low power mode, it has only 12 bit resolution. In order to get 14 bit resolution, we only use its high performance mode. Add MOTIONSENSE_FLAG_INT_ACTIVE_HIGH flag to support both active high and active low interrupt. BUG=b:138768226, b:138978278 BRANCH=none TEST=use Akemi board, add lis2dwl as accel sensor, boot the board and make sure sensor x/y/z get correct value by 'accelinfo on' Cq-Depend: chromium:515302 Change-Id: I37fcc0f43af3c8055079e09db00757b665813ba8 Signed-off-by: Paul Ma <magf@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1739026 Tested-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: mario tesi <mario.tesi@st.com> Commit-Queue: Martin Roth <martinroth@chromium.org>
* util/presubmit_check.sh: Exclude README.md and navbar.md filesTom Hughes2019-08-211-0/+4
| | | | | | | | | | | | | | | These files aren't used by "make buildall", so it shouldn't cause a developer to run "make buildall" before submitting a change to the file. BUG=None BRANCH=None TEST=Modify navbar.md. Try to upload and verify that the presubmit check does not flag it. Change-Id: Ia4eaa7009aa52b7a096171e66e6541694ef73032 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1758539 Reviewed-by: Jett Rink <jettrink@chromium.org>
* hammer: Add magnemite boardNicolas Boichat2019-08-161-0/+1
| | | | | | | | | | | | | | | A close hammer derivative. BRANCH=none BUG=b:138968914 TEST=make BOARD=magnemite -j Flash into staff, see the board boot: util/flash_ec --board=magnemite --port=9000 Change-Id: Ibe5c3f4b0fb4a31d4667d5dc4d76a691b0e64e39 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1741599 Reviewed-by: Yilun Lin <yllin@chromium.org>
* util: make flash_ec tolerant with dummy npcx_uut chipNamyoon Woo2019-08-151-2/+4
| | | | | | | | | | | | | | | | | | | | | | flash_ec fails when npcx_uut chip in a bad status doesn't respond at all, especially upon ec_flash_size query. This patch subpress the exit on ec_flash_size query failure, because that information is not mandatory in flashing EC. BUG=none BRANCH=none TEST=manualy tested on kohaku. 1. programmed kohaku EC with a wrong binary. 2. checked kohaku EC in a bad status, and was not able to respond. 3. ran flash_ec and checked flash_ec finished EC FW program. e.g. flash_ec --board kohaku --image ${IMG} 4. read EC firmware back. e.g. flash_ec --board kohaku --read ${TMP_IMG} Change-Id: Ic853dd9f827217621cd598c799c68fbbf970078a Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1753009 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* tglrvp_ite: Add TGL-U/Y RVP base codeDaniel Gonzalez2019-08-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | Added TGL-U/Y RVP base code using ITE EC. Following features are enabled. 1. TCPC + retimer 2. Charger 3. Battery 4. Power sequencing 5. Host communication 6. LED 7. Keyboard BUG=b:138597987 BRANCH=none TEST=Both TGLRVP U&Y can boot to ChromeOS Change-Id: Idf6be38796c26b31be6e13485a63ec13487bf954 Signed-off-by: Daniel Gonzalez <daniel.d.gonzalez@intel.com> Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1726943 Reviewed-by: Keith Short <keithshort@chromium.org>
* flash_ec: support "--read" and "--verify" flags for npcx_uutNamyoon Woo2019-08-141-23/+74
| | | | | | | | | | | | | | | | | | | | | | This patch enables flash_ec to read EC image from npcx_uut type chip, and to verify the flash programmed image. BUG=b:133265593 BRANCH=none TEST=manually ran flash_ec on fleex and careena. flash_ec --board flex --image ${IMG} --verify flash_ec --board flex --read ${TMP_IMG} flash_ec --board careena --image ${IMG} --verify flash_ec --board careena --read ${TMP_IMG} Cq-Depend: chromium:1748803 Change-Id: Ifaefa64b0efed6c875c99ede59a3a1e0dfe0bf7f Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1749554 Reviewed-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: Raul E Rangel <rrangel@chromium.org>
* driver: lis2dw12: Add driver supportmario tesi2019-08-131-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added ACC LIS2DW12 driver support. Features included in this driver are: - Basic Sensor Read acceleration data - ODR and FS runtime configuration - FIFO support with watermark interrupt events - Shared commons function with ST MEMs devices - Switch Low Power to High perf. mode in case of ODR > 200 Hz - Configure D-TAP event detection in Hardware BUG=b:73546254 BRANCH=master TEST=Tested on discovery_stmems target BOARD with LIS2DW12 connected to EC i2c master bus and motion sense task running. To build firmware for discovery_stmems target with LIS2DW12 sensor connected, simply uncomment CONFIG_ACCEL_LIS2DW12 define in board.h target file and make with target BOARD=discovery_stmems. Commands used to test LIS2DW12 device are: - accelinit 0 (to configure accel. device) All basic features tested, including changing in ODR: - accelrate 0 10000 (set ODR to 10 Hz) - accelrate 0 12500 (set ODR to 12.5 Hz) - accelrate 0 25000 (set ODR to 25 Hz) - accelrate 0 50000 (set ODR to 50 Hz) - accelrate 0 100000 (set ODR to 100 Hz) - accelrate 0 200000 (set ODR to 200 Hz) - accelrate 0 400000 (set ODR to 400 Hz) - accelrate 0 800000 (set ODR to 800 Hz) - accelrate 0 1600000 (set ODR to 1.6 kHz) Full Scale Range: - accelrange 0 2 (set Full Scale Range to 2g) - accelrange 0 4 (set Full Scale Range to 4g) - accelrange 0 8 (set Full Scale Range to 8g) - accelrange 0 16 (set Full Scale Range to 16g) FIFO features and interrupt management: - accelinfo on 1000 (motion info task with refresh rate 1 s) and polling data read: - accelread 0 (to read data from accelerometer) Change-Id: I0b9861a71e81052e7ee8eb235a1a5b2a57d4c6f5 Signed-off-by: mario tesi <mario.tesi@st.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/515302 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Paul Ma <magf@bitland.corp-partner.google.com> Tested-by: Paul Ma <magf@bitland.corp-partner.google.com> Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org>
* cbi-util: Remove OEM_ID from required fieldsPhilip Chen2019-08-121-6/+4
| | | | | | | | | | | | | BUG=b:138663009 BRANCH=none TEST=successfully create a cbi image w/o OEM_ID set Change-Id: Ic2b96f6d6f02a433de4f2ddc0777035369fd9c4a Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1734007 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org>
* hammer: Add masterball boardNicolas Boichat2019-08-121-0/+1
| | | | | | | | | | | | | | | | A close hammer derivative. BRANCH=none BUG=b:138968914 TEST=make BOARD=masterball -j Flash into staff, see the board boot: util/flash_ec --board=masterball --port=9000 Change-Id: I9f8d897c23d0f53557c6d6789c33e5b776dca982 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1741589 Reviewed-by: Wei-Han Chen <stimim@chromium.org> Reviewed-by: Yilun Lin <yllin@chromium.org>