summaryrefslogtreecommitdiff
path: root/util/iteflash.c
Commit message (Collapse)AuthorAgeFilesLines
* util/iteflash: Fix resource leakPatrick Georgi2018-07-301-0/+1
| | | | | | | | | | Change-Id: I68008a1ed0d33c5b8c99f7b3d4d8275970c6b04b Signed-off-by: Patrick Georgi <pgeorgi@google.com> Found-by: Coverity Scan #187193 Reviewed-on: https://chromium-review.googlesource.com/1151117 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* The IT8320DX support 512KB internal flash.Donald Huang2018-07-251-10/+297
| | | | | | | | | | | | | | | | | | | | Support Both IT8320 BX and DX chip. For DX chip ,it supports up to 512KB flash. The patch change the erase(erase sector) and program method in DX chip. BUG=none BRANCH=none TEST=1.make -j BOARD=it83xx_evb 2.sudo ./build/it83xx_evb/util/iteflash -w ./build/it83xx_evb/ec.bin Change-Id: I9f5aed5b80e0019b77f30321ca9e8b8407c38733 Signed-off-by: Donald Huang <donald.huang@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/1132906 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* iteflash: retry the special waveform sequence without delayDonald Huang2018-06-281-3/+0
| | | | | | | | | | | | | | | | | | | | | | On the special case,if you set the I2C pin as GPIO output low status. It can't flash after booting. You can press Reset Button before flash EC FW to do the operation successfully. BUG=none BRANCH=none TEST=1.Set GLK-RVP-ITE board I2C Channel setting as gpio output low (GPIO PIN A4 A5) 2.Flash FW => Fail Flash FW + Press Reset Button => OK Change-Id: I98d650da0792eeb194f5b155805adca25b876319 Signed-off-by: Donald Huang <donald.huang@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/1114659 Commit-Ready: Jett Rink <jettrink@chromium.org> Tested-by: Donald Huang <cguwinds@gmail.com> Tested-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* ite_flash: handle termination signal gracefullyJett Rink2018-05-211-54/+92
| | | | | | | | | | | | | | | | | | Since we wait indefinitely for the ITE chip to be ready when we are flashing it, we need to be able to handle the console terminal signal gracefully so the host USB ports do not get in a bad state. BRANCH=none BUG=none TEST=Can exit while loop gracefully Change-Id: Ica8e7c6c707cd58bdaa754be76fffef418d870e4 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1067788 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Justin TerAvest <teravest@chromium.org>
* bip: unwedge SDA line after flashing ITEJett Rink2018-05-161-23/+4
| | | | | | | | | | | | | | | | | | When we exit DBGR mode on the ITE after flashing, it wedges the SDA line, which prevents us from using dut-control cold_reset. We do not need to exit DBGR mode since we will perform a cold reset after we finish flashing. BRANCH=none BUG=b:79592483 TEST=flash bip multiple times and EC resets after flashing automatically Change-Id: Iafbad7a88a528ec7385596fd7c674b151f276166 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1060588 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Justin TerAvest <teravest@chromium.org>
* iteflash: Continue call ftdi_read_data() until all data is readDino Li2018-04-101-16/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We found a symptom that iteflash always programming EC failed on a specific host machine. For this failed case, it is caused by the incomplete read from ftdi_read_data(). For example, we want to read 32 bytes by just call ftdi_read_data() one time, but ftdi_read_data() may return (number of bytes read) 10 or 20 but just not 32. This change will call ftdi_read_data() again and again until all data is read. Change draw_spinner() function to use fprintf(). We will show percentage increase from 0 percent to 100 percen during verifying. Change of flash_ec script: Move operations of reinitialize ftdi_i2c interface to cleanup() and we won't miss them if programming is failed. BUG=none BRANCH=none TEST=To run iteflash on that host machine and flashing is done. Change-Id: Ifa374652870737c8231fce5a699abe033a1f0237 Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/979903 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
* util/iteflash.c: make sure that the file is closedPatrick Georgi2017-10-141-1/+1
| | | | | | | | | | | | | | | | | An insignificant bug, but Coverity complains about it. Reduce the cognitive load by making sure that file is closed in time. BUG=none BRANCH=none TEST=none Change-Id: I2efbe136f4991cf829b95568eef22eb7b2d1a8c6 Found-by: Coverity Scan #141758 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/702304 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Chris Ching <chingcodes@chromium.org>
* util/iteflash.c: Handle potential resource leaksPatrick Georgi2017-10-141-0/+2
| | | | | | | | | | | | | | | | | | | They're of really little consequence right now since an error in verify_flash() is only followed by resource tear down and process exit. verify_flash could gain other call-sites though, so better be safe than sorry. BUG=none BRANCH=none TEST=none Change-Id: I5fa8276dc3b3e124dacceca1ea857430982f7567 Found-by: Coverity Scan #141761, #141762 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/702482 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Chris Ching <chingcodes@chromium.org>
* iteflash: exit DBGR mode after flashingDino Li2017-05-011-11/+21
| | | | | | | | | | | | | | | | | | | This change is separated from CL:344481. We need a cold reset after flashing, but we kill 'servod' before execute iteflash for each flashing process. With this change, we can restart 'servod' again without errors. And we are able to use dut-control to do a EC cold reset. BRANCH=none BUG=none TEST=flashing completed, and wait for servo's cold reset. Change-Id: Ifc242467211253fabcd733a971e999baa68a1026 Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/488002 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* it8380dev: util: Enable Host Global ResetDonald Huang2016-03-241-1/+1
| | | | | | | | | | | | | | 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>
* util/iteflash: Return error on all verify failuresShawn Nematbakhsh2016-03-081-1/+2
| | | | | | | | | | | | | 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>
* iteflash: Initialize variable that later used in the functionAnatol Pomozov2016-03-061-1/+1
| | | | | | | | | | | | | | | | | | 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>
* it8380dev: util: Fix iteflash flash issueDonald Huang2016-02-251-1/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* it8380dev: util: Enhance iteflashDonald Huang2016-01-291-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* it8380dev: util: fix iteflashDonald Huang2015-11-101-5/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for flash the ite ec from usb gpio port Signed-off-by: Donald Huang <donald.huang@ite.com.tw> BRANCH=none BUG=none TEST=Test OK on ITE8390CX from both GPIO PORT (C1,C2) (H5,H6) 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) (br-iteflash) 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. /* ==SNAPSHOT END== */ Change-Id: I422db6f7007622f8be624a534a482e24d53a061a Reviewed-on: https://chromium-review.googlesource.com/311205 Commit-Ready: Donald Huang <donald.huang@ite.com.tw> Tested-by: Donald Huang <donald.huang@ite.com.tw> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Donald Huang <donald.huang@ite.com.tw>
* it8380dev: util/iteflashDino Li2015-07-161-108/+154
| | | | | | | | | | | | | | | | | | | | | | | 1. change I2C frequency to 400K. 2. include the support for other it83xx series. 3. add "chip erase" command if the erase size equals to flash's physical size. 4. remove 50h command. 5. always check write enable bit of the status reg, after write enable command. Signed-off-by: Dino Li <dino.li@ite.com.tw> BRANCH=none BUG=none TEST=servo board + IT83xx EVB can erase, write, and read flash via i2c. (iteflash --e, --w, and --r) Change-Id: I0ac1eeaed5c243215d8817eb45b4b4fe0a7df26a Reviewed-on: https://chromium-review.googlesource.com/283265 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Dino Li <dino.li@ite.com.tw> Commit-Queue: Dino Li <dino.li@ite.com.tw>
* ite: Added functionality to ITE In-system programming tool.Alec Berg2013-11-081-84/+255
| | | | | | | | | | | | | | Added ability to erase and program flash to iteflash. BRANCH=none BUG=chrome-os-partner:23576 TEST=generate random 192kB file, write it to the ITE chip, read flash back and make sure file read in matches file written. Change-Id: Id525b43e523a3d710ee65b623fec07800cf7f347 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/176022 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* ite: Add IT8380 In-system Programming toolVincent Palatin2013-11-071-0/+773
use the IT8380 SMB0 interface connected to the Servo FTDI chip to access the internal flash. The write-protect is not implemented. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Signed-off-by: Alec Berg <alecaberg@chromium.org> BRANCH=none BUG=chrome-os-partner:23576 TEST=check waveforms on the Logic analyzer. Change-Id: Ic3402e4e8def731fe4f2fe93be254f5fd0982abf Reviewed-on: https://chromium-review.googlesource.com/175677 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>