summaryrefslogtreecommitdiff
path: root/util
Commit message (Collapse)AuthorAgeFilesLines
* cr50: prepare to release 0.4.17Vadim Bendebury2019-05-071-1/+1
| | | | | | | | | | | BRANCH=cr50 BUG=none TEST=none Change-Id: I25c87502d3e38b42430c85a4426e43a2f5f6a7f3 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1595157 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* flash_ec: collect dut-control values to restore before they changeNamyoon Woo2019-05-041-73/+57
| | | | | | | | | | | | | | | | | | | | | | | | This CL enables add dut-control values to restore during execution. This helps flash_ec store necessary values only. Also this CL fixes the problem that flash_ec failure leaves spi1_buf_en:on, not restoring to off. Cq-Depend:chromium:1591590 BUG=None BRANCH=None TEST=manually ran flash_ec on duts. soraka with servo_v2, ccd_cr50 scarlet with servo_v2, ccd_cr50 dragontalon with servo_v2, servo_micro coral with servo_v2, servo_micro, ccd_cr50 grunt(liara) with servo_v2, servo_micro, ccd_cr50 fleex with servo_v2, servo_micro, ccd_cr50 ampton with servo_v2, servo_v4, ccd_cr50 Change-Id: Iefb8c85125841040ab408551ab254f8151080a54 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1593817 Reviewed-by: Matthew Blecker <matthewb@chromium.org>
* common: add MOTIONSENSE_CHIP_TCS3400Nick Vaccaro2019-05-041-0/+3
| | | | | | | | | | | | | | Add new chip definition for AMS TCS3400 light sensor. BUG=b:129419982 BRANCH=master TEST=none Change-Id: Ic66a0922f3c48775f2eaeff0c5ac37a09624a5d6 Signed-off-by: Nick Vaccaro <nvaccaro@google.com> Reviewed-on: https://chromium-review.googlesource.com/1541954 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* common: add new MOTIONSENSE_TYPE_LIGHT_RGB sensor typeNick Vaccaro2019-05-041-0/+3
| | | | | | | | | | | | | | Add a new light sensor type for color light sensors. BUG=b:129419982 BRANCH=master TEST=none Change-Id: I30cec56761b1f7f90544dda52a90415d39ded337 Signed-off-by: Nick Vaccaro <nvaccaro@google.com> Reviewed-on: https://chromium-review.googlesource.com/1541953 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* console: add support for disabling timestampsMary Ruthven2019-04-301-14/+23
| | | | | | | | | | | | | People may want to disable timestamps. Add a command to do that. BUG=none BRANCH=none TEST=none Change-Id: I702c41a214367b6c58f3d9b932310e1bb7e08b95 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1586588 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* mt_scp: Generate IPI tables with util gen_ipi_table.Yilun Lin2019-04-302-0/+66
| | | | | | | | | | | | | | | | | | | | IPI table is board-specific. This CL removes the original IPI table in chip layer, and uses gen_ipi_table to generate the table for each board to reduce the maintenance effort. TEST=make BOARD=kukui_scp, and see build/kukui_scp/ipi_table_gen.inc exists. Push to Kukui, and see SCP boots. TEST=modify IPI_COUNT in board.h and see it generates a new ipi_table_gen.inc BUG=b:130508869 BRANCH=None Change-Id: I0c05319447d15917e8833aa80d61166c4e396370 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1568890 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* cr50: update version to .16Mary Ruthven2019-04-262-2/+2
| | | | | | | | | | | BRANCH=none BUG=none TEST=none Change-Id: I873b50ebd73c0edd16c278b1fa825378e693d18d Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1584589 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* flash_fp_mcu: use modalias to detect FP spiidTom Hughes2019-04-261-5/+28
| | | | | | | | | | | | | | | | | | During bringup there was a point where the spiid for the fingerprint sensor changed between devices (apparently due to broken TPM firmware since the TPM is usually the first SPI device)). This resulted in non-obvious failures when running flash_fp_mcu since many other things were also not working. BRANCH=none BUG=chromium:955117 TEST=emerge-nocturne ec-utils-test && cros deploy nocturne ec-utils-test flash_fp_mcu /opt/google/biod/fw/nocturne_fp_v2.2.110-b936c0a3c.bin Change-Id: I9161361e2c66de200f618c00074eeb42a9ecb29b Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1566653 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* uartupdatetool: retry opr_check_sync() if the first attept failsNamyoon Woo2019-04-261-0/+8
| | | | | | | | | | | | | | | | This is a workaround fix for grunt, where the first command after EC reset gets zero bytes as response. BUG=b:126795953 BRANCH=none TEST=manually ran flash_ec on grunt/careena, grunt/liara and octopus/fleex through servo_v4_with_ccd_cr50 or suzy-Qable. Change-Id: I5da3bd7889d9e4059a8f523352db4f3e5a7ce841 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1583128 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Raul E Rangel <rrangel@chromium.org>
* util: Add tool to generate cros_ec_commands.hGwendal Grignou2019-04-262-0/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a rule to generate a new cros_ec_commands.h when ec_commands.h is modified. The rule is checked when buildall is invoked. At Presubmit stage, check a cros_ec_commands.h exists if ec_commands.h is modified. The CL author is responsible to upstream that file. BUG=chromium:945948 BRANCH=none Cq-Depend: chromium:1558853 TEST=Check manually cros_ec_commands.h is generated with make build_cros_ec_commands Check no bread crumbs are left-over when the rule fails. Check checkpatch triggers when it finds an invalid syntax in the output file. Check ../../repohooks/pre-upload.py returns a meaningful error when cros_ec_commands.h file is not present. Change-Id: Ibc8ed7165914d39b5f0bd41643932a8514768925 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1559380 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Brian Norris <briannorris@chromium.org>
* util/stm32mon: Add cmdline option to display versionTom Hughes2019-04-242-2/+20
| | | | | | | | | | | | | | | | | | | Also display the version when running in order to make it easier to debug flashing issues in the field or factory. BRANCH=none BUG=chromium:952332 TEST=./util/flash_ec --board=hatch_fp --image=./build/hatch_fp/ec.bin => displays stm32mon version ./build/hatch_fp/util/stm32mon -v => displays version ./build/hatch_fp/util/stm32mon --version => displays version Change-Id: I43f622ed370938eeed31453d5b11806f02b47277 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1565462 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* util/ectool, common/system: Share sysmbol reset_flag_desc.Yilun Lin2019-04-181-24/+17
| | | | | | | | | | | | | | | | | There were two symbols reset_flag_desc and reset_flag_strings used in two separated places: host binary ectool and device. This CL combines these two symbols to reduce maintance efforts. TEST=make buildall -j BRANCH=None BUG=None Change-Id: I3b5731ab08804f46629d6e43466dce963bd86a69 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1514395 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* *_fp: Add private version infoTom Hughes2019-04-181-0/+3
| | | | | | | | | | | | | | | | | | This shows up when you run the "version" command in the UART console. BRANCH=none BUG=b:130417373 TEST=BOARD=hatch_fp ./util/getversion.sh => shows private version in VERSION BOARD=nocturne_fp ./util/getversion.sh => shows private version in VERSION BOARD=nocturne ./util/getversion.sh => does not show private version in VERSION Change-Id: Ibdf94795bbc8bc823d29ec006b01fc89e8f37114 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1566040 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* flash_fp_mcu: print canonical pathTom Hughes2019-04-161-0/+4
| | | | | | | | | | | | | | | | | This avoids confusion when installing in /usr/local/bin vs /usr/bin. See https://crbug.com/341708 for more details. BRANCH=none BUG=chromium:952447 TEST=emerge-nocturne ec-utils-test && cros deploy nocturne ec-utils-test flash_fp_mcu /opt/google/biod/fw/nocturne_fp_v2.2.110-b936c0a3c.bin Change-Id: Ifba5c668613bc35e24d9466c6e7245b6b862fc90 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1566650 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* signer: allow board id of 0:0:0Mary Ruthven2019-04-151-2/+9
| | | | | | | | | | | | | | | | | | | | | In the prod branch the prod signer sets the board id to FFFF:0:10000, because we're going to start doing automatic signing. We need to be able to override that board id to 0:0:0. bs doesn't support this right now because it always assumes the first field of the given board id is a 4 character string that it needs to convert into hex. This change modifies bs to use 0 for the board_id rlz if the rlz is 0 instead of trying to convert an ascii character into hex. 0 is the only digit bs will accept for the board_id, because it's easy to interpret. BUG=none BRANCH=cr50 TEST=sign image with CR50_BOARD_ID=0:0:0. Make sure gsctool -b shows the RLZ is 0 instead of 0x30. Change-Id: I1fe30877ff8d6d1574934c55c2fb5cdc543c34ad Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1565549 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* util/usb_if: return failure when usb device cannot be claimed.Namyoon Woo2019-04-141-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL returns an error code when usb device finding fails. BUG=none BRANCH=none TEST=manually ran flash_ec on dragonegg in CCD with servod. [Before this CL] ... iteflash -W 0 -c ccd -e -w ${IMG} found interface 5 endpoint 6, chunk_len 64 util/usb_if.c:106, libusb_claim_interface returned -6 (Resource busy) READY <----- should not proceed. ------- Using CCD device util/usb_if.c:127, libusb_bulk_transfer returned -99 (Other error) ... [After this CL] ... iteflash -W 0 -c ccd -e -w ${IMG} found interface 5 endpoint 6, chunk_len 64 util/usb_if.c:106, libusb_claim_interface returned -6 (Resource busy) connect_to_ccd_i2c_bridge: usb_findit returned error -1 dut-control --port=9999 ccd_ec_boot_mode_uut:off dut-control --port=9999 ccd_ec_boot_mode_bitbang:off ... Change-Id: Ibec9828487b2fed5f5a5bc2012b8b9f29d182531 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1490831 Reviewed-by: Matthew Blecker <matthewb@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org>
* stm32mon: retry on damaged ACK, NACK or timeoutNamyoon Woo2019-04-121-126/+253
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BUG=b:112837404 BRANCH=None TEST=manually ran stm32mon or flash_ec on scarlet and DragonTalon. 1. stm32mon via Servo V4 type-C at 57600 bps on scarlet. $ ./util/flash_ec --board scarlet --image ${IMG} \ --bitbang_rate 57600 --verbose 2. stm32mon via Servo V4 type-C at 9600 bps on scarlet. which tends to fail for NACK or timeout. $ ./util/flash_ec --board scarlet --image ${IMG} \ --bitbang_rate 9600 --verbose 3. flash_ec via Servo Micro on scarlet $ ./util/flash_ec --board scarlet --image ${IMG} --verbose 4. flash_ec on DragonTalon via Servo V2 and Servo Micro respectively. $ ./util/flash_ec --board hatch_fp --image ${IMG} --verbose Full log can be found at http://gpaste/5439133910564864 Change-Id: I3c8e8c81d9d12475f5722eaacc932dc1244625d5 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1540496 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Matthew Blecker <matthewb@chromium.org>
* iteflash.md: revised the steps in 'Prerequisites for CR50 CCD'Namyoon Woo2019-04-111-3/+3
| | | | | | | | | | | BRANCH=none BUG=b:124388894 TEST=checked the document through Gitiles. Change-Id: I11fe46a8900ec59edee799157358698e4c0e1cc6 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1555026 Reviewed-by: Matthew Blecker <matthewb@chromium.org>
* make: include iteflash in host-util groupNamyoon Woo2019-04-111-2/+2
| | | | | | | | | | | | | | | | iteflash is a flash tool for ITE EC, and needs to be installed in labstations. iteflash should belong to host-util like other EC flash tools. BUG=b:130036463 BRANCH=None TEST=built and ran iteflash on Ampton using servo_v2, servo_micro and Suzy-Q. Change-Id: If711a26f7d6d3979332b9064313a7e1b87cd594a Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1560143 Reviewed-by: Matthew Blecker <matthewb@chromium.org>
* ectool: cleanup cmd_fp_seed()Nicolas Norvez2019-04-111-6/+5
| | | | | | | | | | | | | | | | - check |argc| before accessing argv[1] - remove redundant variables/assignments BRANCH=None BUG=None TEST=ectool --name=cros_fp fpseed => fails TEST=ectool --name=cros_fp fpseed aabb => fails (only 4 bytes) TEST=ectool --name=cros_fp fpseed aabb...aabb => succeeds Change-Id: I515de53a2ee3b934da2e930e32d0680375488711 Signed-off-by: Nicolas Norvez <norvez@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1558970 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* flash_ec: Update error msg and TODO bug num for servo I2C adapter lookup.Matthew Blecker2019-04-091-16/+6
| | | | | | | | | | | | | | | | | | This also removes the placeholder code for a dut-control command that does not actually exist yet. BRANCH=none BUG=b:79684405,b:130165933 TEST=Ran flash_ec using Servo v4 -> Servo Micro -> Ampton. With i2c-pseudo loaded and servod running, reflashing worked. With i2c-pseudo unloaded and servod running, the new error message was written stderr and flash_ec exited non-zero as desired. Change-Id: Icfa4f4a894eda6c683a2d1cef4a87b3ac3a0a359 Signed-off-by: Matthew Blecker <matthewb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1558371 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* hatch_fp: STM32F412 can have up to 1 MB Flash (some have less)Tom Hughes2019-04-091-15/+291
| | | | | | | | | | | | | | | | | | | | | | | | For sizes, see: See https://www.st.com/resource/en/reference_manual/dm00180369.pdf Section 3.3 Embedded Flash Memory We read the Flash size data register to get the actual size: See https://www.st.com/resource/en/reference_manual/dm00180369.pdf Section 31 Device electronic signature BRANCH=none BUG=b:126455006,b:124996507 TEST=make BOARD=hatch_fp -j ./build/host/util/stm32mon -b 115200 -d /dev/pts/24 \ -u -e -w ./build/hatch_fp/ec.bin Change-Id: I105840150cde68c7c7579d44c8d8c43b6b567233 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1541818 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* iteflash.md: Document procedure for reflashing ITE ECs.Matthew Blecker2019-04-051-0/+119
| | | | | | | | | | BRANCH=none BUG=b:79684405,b:124388894 TEST=Viewed the document through Gitiles, verified formatting. Change-Id: I95ffccca3d7b88f4ab478e85bc1af252813100ff Signed-off-by: Matthew Blecker <matthewb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1549982
* cr50 signer: make sure SQA images can not be signed with prod keysVadim Bendebury2019-04-051-2/+2
| | | | | | | | | | | | | | | This patch makes sure that SQA images can not be signed with prod keys. BRANCH=none BUG=none TEST=manually verified that the modified grep expression triggers for both DBG and SQA containing strings. Change-Id: I3c8b8c45dbbf5d38bc9c35f766e80ada8257cb65 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1553575 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* hatch_fp: Fix flash erase in stm32monTom Hughes2019-04-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | hatch_fp uses STM32F412, which *does* support mass erase. The original commit that matches against STM32F41 seems to be targeted to the STM32F411 based on the commit message: 09a7fa4ae When trying to erase the STM32F412 for hatch_fp by page, the command fails: Waiting for the monitor startup ...Done. ChipID 0x441 : STM32F412 Bootloader v1.1, commands : 00 01 02 11 21 31 44 63 73 82 92 Unprotecting flash read... Flash read unprotected. Waiting for the monitor startup ...Done. Flash write unprotected. Waiting for the monitor startup ...Timeout Done. Erasing... NACK payload 0 ACK failed for CMD44 BRANCH=None BUG=b:124996507 TEST=hatch_dut> flash_fp_mcu ec.bin Change-Id: Idc800b1f3ae29f7776405b1e952f71ef2d7c8a14 Signed-off-by: Nicolas Norvez <norvez@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1539016 Commit-Ready: Tom Hughes <tomhughes@chromium.org> Tested-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* util:ecst: add the support of CHIP_VARIANT npcx7m7wc for NPCX7CHLin2019-04-031-3/+5
| | | | | | | | | | | | | | | | | | This CL adds the support for chip variant npcx7m7wc in the ecst utility. BRANCH:none BUG=none TEST=pass "make buildall" TEST=in the follow CL, change CHIP_VARIANT to npcx7m7wc in board/npcx7_evb/build.mk; build the image by "BOARD=npcx7_evb make"; check the image can be built and the image header is correct. Change-Id: I6031a6f188f06e31ca7ce0571065b11ee68b27ab Signed-off-by: CHLin <CHLIN56@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/1543061 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* flash_ec: sort STM32 boards alphabeticallyNicolas Norvez2019-04-021-1/+1
| | | | | | | | | | | | | | hatch_fp had been added in the wrong place, fix the ordering. No functional changes. BRANCH=None BUG=b:124996507 TEST=None Change-Id: I7e1602d80db9366bf0e97f03abe1f0f7af2aa670 Signed-off-by: Nicolas Norvez <norvez@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1547141 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* bip: Delete boardEvan Green2019-04-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | bip has an it8320bx with 256kB of flash space. After dividing by two and subtracting 0x800, this means the RO section of bip is 126kB. This is very tight. We've already removed a few commands to free up space, but this board hasn't been worked on since summer 2018. Delete it to avoid excessive maintenance burden. BUG=b:129283539 BRANCH=none TEST=make -j buildall CQ-DEPEND=CL:1538819,CL:*1086038 Signed-off-by: Evan Green <evgreen@chromium.org> Change-Id: Iac903397dd653c8e012c8b3956807ba1bacf681e Reviewed-on: https://chromium-review.googlesource.com/1536490 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* flash_ec: Have iteflash use I2C through servod with CR50 CCD.Matthew Blecker2019-04-011-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously flash_ec would instruct iteflash to communicate directly with CR50 when using CCD. Now the same communication path through servod is used with Servo Micro is also used with CR50. Benefits: 1) Allows for resolving b:126189871 without adding significant new complexity in servod. Without this, fixing that bug would involve implementing CR50 I2C USB endpoint disconnect and reconnect commands, exposing them through dut-control, and ensuring they play nicely with I2cPseudoAdapter. With this, that bug can be trivially fixed, and then the retry loop in flash_ec around dut_i2c_mux:ec_prog can be deleted. 2) Simplifies flash_ec with slightly less differences needed in iteflash invocation. BRANCH=none BUG=b:75976718,b:79684405,b:124388894,b:126189871 CQ-DEPEND=CL:1250029,CL:1546592 TEST=The following servo + board combinations were tested: flash_ec -> iteflash -> servo_micro -> bip flash_ec -> iteflash -> servo_v4 -> servo_micro -> bip flash_ec -> iteflash -> servo_v2 -> bip flash_ec -> iteflash -> servo_v4 -> cr50 -> bip Change-Id: I36009b01e45576c786ea78853baf46b52d2232d6 Signed-off-by: Matthew Blecker <matthewb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1522846 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* flash_ec: change the default bitbang rate to 57600Namyoon Woo2019-03-301-1/+1
| | | | | | | | | | | | | | | | | | Bitbanging in 9600 bps is not stable. Since the current cr50 implementation is optimized for 57600 and complaints with 9600 bps are growing, the default rate should be set to 57600. BUG=b:129570292 BRANCH=None TEST=manually ran flash_ec on scarlet and kului. Change-Id: Ibd7d0240662b44853b53d2e067bdbe70a0d760e3 Signed-off-by: Namyoon Woo <namyoon@google.com> Reviewed-on: https://chromium-review.googlesource.com/1545087 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* flash_ec: add support for hatch_fpTom Hughes2019-03-301-1/+2
| | | | | | | | | | | | | | Same as nocturne_fp. BRANCH=None BUG=b:124996507 TEST=manually flash over UART/servo Change-Id: I2218a7bfd9dea5b31ec10b1738c9b26ccbd291b9 Signed-off-by: Nicolas Norvez <norvez@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1541828 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Tom Hughes <tomhughes@chromium.org>
* ec-utils: Add cros_fp as name to ectool help msgCraig Hesling2019-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add the already supported cros_fp device name to the ectool's help message. The previous output was: Usage: ectool [--dev=n] [--interface=dev|i2c|lpc] [--name=cros_ec|cros_pd|cros_scp|cros_sh] [--ascii] <command> [params] ... The new output is: Usage: ectool [--dev=n] [--interface=dev|i2c|lpc] [--name=cros_ec|cros_fp|cros_pd|cros_scp|cros_sh] [--ascii] <command> [params] ... BRANCH=none BUG=none TEST=Deployed to nocturne device Change-Id: Ib2eaf97ab181c7e43fd4fcdf86088c30145986b9 Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1541952 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* ectool: Updating EC_CMD_USB_PD_CONTROL command versionsAyushee2019-03-291-5/+9
| | | | | | | | | | | | | | | BUG=None BRANCH=None TEST=Manually tested on Dragonegg, able to get correct supported version for the usb_pd_control command Change-Id: I53f3e6cf6458bac27ffbc9f73e8f74674b92dd50 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/1540461 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Ayushee Shah <ayushee.shah@intel.com> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
* flash_ec: fixes dut-control invocation error.Namyoon Woo2019-03-281-25/+22
| | | | | | | | | | | | | | | | | | | | | It fixes in executing dut-control with parameters, which are in array type. The purpose of crrev.com/c/15246070 was to replace the external tool dependencies (e.g. cut or sed) with bash built-in function. BUG=b:129425648 BRANCH=None TEST=ran flash_ec on several duts with servo_v2, and servo_v4_with_(servo_micro|ccd_cr50). - coral and scarlet/kukui: http://gpaste/6534367952240640 - octopus_npcx and octopus_ite: http://gpaste/5062482861228032 Change-Id: I37b7b8a075f636a094b1ec25a63c10e7eddd6d99 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1541951 Reviewed-by: Matthew Blecker <matthewb@chromium.org>
* power/intel_x86: Introduce s0ix failure detectionEvan Green2019-03-281-21/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces logic in the EC that can detect if the host attempted to go into S0ix, but never made it. The host already sends commands indicating its intent to enter S0ix, and the EC has a SLP_S0 line that gets asserted by the AP when it actually enters S0ix. All that's needed to monitor failures is to arm a timer when receiving the S0ix suspend message. If the SLP_S0 pin goes low, then the suspend occurred and the timer is canceled. If the timer expires before SLP_S0 goes low, then the EC wakes the AP up, since it has entered a shallower idle state than intended, and should be alerted to avoid short battery life. The timer is also started when SLP_S0 is deasserted on resume. The SoC comes out of S0ix to perform housekeeping activities unbeknownst to Linux. In cases where housekeeping fails to suspend all the way back down, this timer will wake the AP. Additionally, the number of S0ix transitions is reported on resume. This enabled the AP to analyze the amount of "sleepwalking" that is done, and can complain if it seems to be waking up too often. Design doc at: https://docs.google.com/document/d/1mY-v02KAuOyET3td9s5GnxeUgMiAcD058oLEo57DZpY/edit BUG=b:123716513 BRANCH=None TEST=Test S0ix on hatch with modified code that forces a timeout, use ectool to send messages manually before and after timeout, Hack Linux to fail suspend very late to verify no regressions. Signed-off-by: Evan Green <evgreen@chromium.org> Change-Id: Ia64b496675a13dbed4ef74637f51e39eee68aa1a Reviewed-on: https://chromium-review.googlesource.com/1501512 Commit-Ready: Evan Green <evgreen@chromium.org> Tested-by: Evan Green <evgreen@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
* ectool: fix help message for sub-command - usbchargemode.Marco Chen2019-03-281-2/+2
| | | | | | | | | | | | | | | | Add optional third argument - inhibit_charge into help message of usbchargemode. BRANCH=none BUG=None TEST=Check help message by executing new generated ectool binary. Change-Id: Ie6dca334c3eec00e00fa2e3083f57c45bed3c745 Signed-off-by: Marco Chen <marcochen@google.com> Reviewed-on: https://chromium-review.googlesource.com/1485031 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Marco Chen <marcochen@chromium.org> Reviewed-by: Zhuohao Lee <zhuohao@chromium.org>
* usb_pd: Get current DP pin modeAyushee2019-03-281-1/+20
| | | | | | | | | | | | | | | | | | | | | DP pin mode is needed to configure the Intel virtual muxes hence, added a board level function that returns the current DP pin mode. Also added a variable to return the DP pin mode in USB_PD_CONTROL host command. BUG=b:112311321 BRANCH=None TEST=Verified on Dragonegg, able to get correct pin mode USB:0x0 (No DP) DP cable:0x4 (Mode:C) USBC dock:0x8 (Mode:D) Change-Id: I997de80d0963e8ac45e97e5da0064694d5572942 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/1512134 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
* flash_ec: remove sed or cut call in getting a value from dut-controlstabilize-11998.BNamyoon Woo2019-03-271-42/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BUG=none BRANCH=none TEST=manually ran flash_ec on coral, scarlet, and ampton. The test log is at gpaste/6202232963858432. $ ./util/flash_ec --board=coral --read ${IMG} $ ./util/flash_ec --board=scarlet --read ${IMG} --bitbang_rate=57600 $ ./util/flash_ec --board=ampton --read ${IMG} Tested with a EXPECT_TO_FAIL case with a line, dut_control_get xxxx $ ./util/flash_ec --board=scarlet --read ${IMG} --verbose Problem with ['xxxx'] :: No control named "xxxx" ERROR: dut_control_get failed: dut-control --port=9999 xxxx Tested with a board name in stm32_dfu, and checked dut_command_get is not called. $ ./util/flash_ec --board dingdong --image ${IMG} --verbose INFO: Using a dedicated debug cable INFO: Using toad. INFO: Using ec image : /tmp/ec.read.bin INFO: Flashing chip stm32_dfu. INFO: Using dfu flasher : dfu-util ... Change-Id: Ib936cf450c3d12f0784ff1aaf3c33e9d18069606 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1524670 Reviewed-by: Matthew Blecker <matthewb@chromium.org>
* flash_ec: check I2C ccd state before triggering ITE EC DBGR modeNamyoon Woo2019-03-261-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To flash ITE in ccd mode, I2C ccd capability should be set always. This CL makes flash_ec check this condition before it attempts to ask CR50 to send a special waveform which triggers ITE EC DBGR mode. CQ-DEPEND=CL:1524439 BUG=b:123901082 BRANCH=none TEST=manually ran flash_ec on ampton in CCD mode. // Expected to fail , case 1 $ ./util/flash_ec --board=ampton --read /tmp/ec.ampton.read.bin --verbose ... ERROR: CCD I2C capability is not set as 'Always' : IfOpened ... // Expected to fail , case 2 $ ./util/flash_ec --board=ampton --read /tmp/ec.ampton.read.bin --verbose ... ERROR: CCD I2C capability is not set as 'Always' : UnlessLocked ... // Expected to fail , case 3 $ ./util/flash_ec --board=ampton --read /tmp/ec.ampton.read.bin --verbose ... ERROR: CCD I2C capability is not set as 'Always' : Default ... // Expected to success $ ./util/flash_ec --board=ampton --read /tmp/ec.ampton.read.bin --verbose ... 524288 bytes read. INFO: Flashing done. ... Change-Id: I394ea9b6c6e41f0a926f4af5d3767ebba7037f37 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1524669 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Matthew Blecker <matthewb@chromium.org>
* flash_fp_mcu: only control PWREN if it existsNicolas Norvez2019-03-261-4/+8
| | | | | | | | | | | | | | | | | | Some boards (Hatch) do not control the PWREN via a GPIO, instead the power is always on. In that case, do not try to handle that non-existent GPIO. BRANCH=None BUG=b:124405913 BUG=b:126455006 TEST=flash_fp_mcu on Hatch doesn't error out TEST=flash_fp_mcu on Nocturne still works Change-Id: I959024693b8af614e930f03991e11b0f44573a49 Signed-off-by: Nicolas Norvez <norvez@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1532344 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* common: bit change 1 << constants with BIT(constants)Gwendal Grignou2019-03-262-8/+8
| | | | | | | | | | | | | | | | | Mechanical replacement of bit operation where operand is a constant. More bit operation exist, but prone to errors. Reveal a bug in npcx: chip/npcx/system-npcx7.c:114:54: error: conversion from 'long unsigned int' to 'uint8_t' {aka 'volatile unsigned char'} changes value from '16777215' to '255' [-Werror=overflow] BUG=None BRANCH=None TEST=None Change-Id: I006614026143fa180702ac0d1cc2ceb1b3c6eeb0 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518660 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* common: replace 1 << digits, with BIT(digits)Gwendal Grignou2019-03-264-11/+13
| | | | | | | | | | | | | | | | Requested for linux integration, use BIT instead of 1 << First step replace bit operation with operand containing only digits. Fix an error in motion_lid try to set bit 31 of a signed integer. BUG=None BRANCH=None TEST=compile Change-Id: Ie843611f2f68e241f0f40d4067f7ade726951d29 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518659 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* iteflash: restore ability to build outside chrootVadim Bendebury2019-03-211-2/+2
| | | | | | | | | | | | | | | | | | | | It looks like ftdi library API is different outside chrtoot, in particular, some parameter pointers are not expected to be const. This patch restores the ability to build ec utils outside chroot. BRANCH=none BUG=none TEST=manual make BOARD=host utils succeeds both inside and outside chroot. Change-Id: I9d470df692821c095b9fab8186cb9dea384e3ad9 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1526488 Reviewed-by: Matthew Blecker <matthewb@chromium.org>
* iteflash: Add --block-write-size flag.Matthew Blecker2019-03-211-16/+24
| | | | | | | | | | | | | | | | | | The previous hardcoded block_write_size values remain as defaults. The new flag can be used to override, with any I2C interface. BRANCH=none BUG=b:79684405,b:124388894 TEST=The following servo + board combinations were tested: flash_ec -> iteflash -> servo_micro -> bip flash_ec -> iteflash -> servo_v4 -> servo_micro -> bip flash_ec -> iteflash -> servo_v2 -> bip flash_ec -> iteflash -> servo_v4 -> cr50 -> bip Change-Id: I56d267fb6b9ec4b46abd1738895a1655cdfa9d12 Signed-off-by: Matthew Blecker <matthewb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1523106 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* console: add time stamp to EC logsTim Wawrzynczak2019-03-201-2/+28
| | | | | | | | | | | | | | | Prefix all EC log lines with the host's current time, in YYYY-MM-DD HH:MM:SS format BUG=b:111675966 BRANCH=none TEST=manual, verify functionality while connected to console via servod & miniterm Change-Id: I3ac26301e781a1992628d43c6d6add1eed0ac91f Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1515815 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* flash_ec,iteflash: Add support for flashing ITE EC with Servo Micro.Matthew Blecker2019-03-202-136/+383
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In iteflash this adds support for using the Linux i2c-dev interface. When combined with the new i2c-pseudo module and servod's use of it, this allows for iteflash to work with any Servo version with no further code changes, so long as ITE direct firmware update mode can be enabled first. In flash_ec this triggers the special waveform via dut-control -> servod -> servo_micro firmware. When using Servo Micro, I2C is still handled by iteflash, whose communication path is now iteflash -> i2c-dev -> Linux -> i2c-pseudo -> servod -> servo_micro -> DUT. BRANCH=none BUG=b:79684405,b:124388894 CQ-DEPEND=CL:1282275,CL:1300373,CL:1351517,CL:1364327 TEST=The following servo + board combinations were tested: flash_ec -> iteflash -> servo_micro -> bip flash_ec -> iteflash -> servo_v4 -> servo_micro -> bip flash_ec -> iteflash -> servo_v2 -> bip flash_ec -> iteflash -> servo_v4 -> cr50 -> bip Change-Id: If68e86468aae07e29f5922a0fd77f62b9031e9fe Signed-off-by: Matthew Blecker <matthewb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1301154 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* cr50: add support for building CR50_SQA imagesMary Ruthven2019-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Devices in the lab need to be switched from prepvt to pvt flags. This change adds a build flag for CR50_SQA. Images built with CR50_SQA have more capabilities than normal cr50 images, but less than CR50_DEV images. SQA images can access the rollback command, updates including downgrading to images with lower version numbers and mismatched board id will not be rejected, and the 'bid force_pvt' console command can be used to set the bid flags to 0. bid force_pvt does not erase flashinfo. After the board id has been set, we can still change 1 bits to 0, so we don't need to eraseflashinfo to change the board id flags to 0. This makes the command a bit safer, because the board id RLZ can't be changed just the flags. Changing the flags to 0 works for the test team, because it prevents cr50 from updating to prepvt. This change also marks rollback as a safe command. CR50_SQA images aren't automatically open, so if rollback isn't safe, they will have to go through the open process to change to pvt. Rollback is only included in DEV and SQA images, so it's ok if it's marked safe. It's understood these images aren't supposed to be used on regular devices. They're just for special development and test environments. NEW PROCESS FOR SQA: - update to sqa image - run 'bid force_pvt' - flash pvt image - run rollback BRANCH=cr50 BUG=b:126618143 TEST=run sqa process Change-Id: Ia713274830c9e19cdb3ccafa87849c160d667683 Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1529834 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* flash_ec: remove sudo in executing iteflashNamyoon Woo2019-03-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | iteflash can be run with normal user access. BUG=none BRANCH=none TEST=manually ran flash_ec and iteflash. $ groups adm floppy audio cdrom 20 video users portage primarygroup $ echo help > /dev/ttyUSB0 -bash: /dev/ttyUSB0: Permission denied $ ./build/ampton/util/iteflash -W 1 -c ccd -r /tmp/ec.ampton.read.bin -m -d $ sudo servod -b octopus_ite $ dut-control servo_type servo_type:servo_v4_with_ccd_cr50 $ ./util/flash_ec --board=ampton --read ${TMPIMG} --verbose $ ./util/flash_ec --board=ampton --image ${IMG} --verbose $ dut-control servo_type servo_type:servo_v2 $ ./util/flash_ec --board=ampton --read ${TMPIMG} --verbose $ ./util/flash_ec --board=ampton --image ${IMG} --verbose The log can be found at gpaste/5375035751530496. Change-Id: I8ac1a19455b84f4eeee7626aa1b3c3e98f3d2395 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1525155 Reviewed-by: Matthew Blecker <matthewb@chromium.org>
* iteflash: Error when given a non-page boundary read address.Matthew Blecker2019-03-141-5/+12
| | | | | | | | | | | | | | | | | | | Previously command_read_pages() would quietly ignore the last byte of the address. This also makes command_read_pages() address calculation look more like command_write_pages() and command_write_pages2(). BRANCH=none BUG=b:79684405 TEST=flash_ec -> iteflash -> servo_v2 -> bip flash_ec -> iteflash -> servo_v4 -> cr50 -> bip (verification step involves reads) Change-Id: I106263d820bd284474412ddb2215820e498a4900 Signed-off-by: Matthew Blecker <matthewb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1364327 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* iteflash: Fix command_write_pages2() program page address calculation.Matthew Blecker2019-03-141-17/+13
| | | | | | | | | | | | | | | | | | | | Previously this function assumed block_write_size was a multiple of 256 B. This is analogous to the command_write_pages() change in: https://crrev.com/c/1195309 BRANCH=none BUG=b:79684405 TEST=flash_ec -> iteflash -> servo_v2 -> bip flash_ec -> iteflash -> servo_v4 -> cr50 -> bip When combined with further changes to use iteflash -> i2c-dev -> i2c-pseudo -> servod -> servo_micro -> DUT programming path, this fixes block alignment corruption when writing ampton EC firmware. Change-Id: I4aa208559973845ef5e4205935ce7979f98d9d4a Signed-off-by: Matthew Blecker <matthewb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1363890 Reviewed-by: Namyoon Woo <namyoon@chromium.org>