Commit Graph

12 Commits

Author SHA1 Message Date
Patrick Georgi
828da3d556 util/iteflash.c: make sure that the file is closed
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>
2017-10-14 08:03:05 -07:00
Patrick Georgi
57ae0b0f18 util/iteflash.c: Handle potential resource leaks
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>
2017-10-14 08:03:05 -07:00
Dino Li
98b8d8c840 iteflash: exit DBGR mode after flashing
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>
2017-05-01 21:54:04 -07:00
Donald Huang
cb38156bbc it8380dev: util: Enable Host Global Reset
BRANCH=none
BUG=none
TEST=Test OK on ITE8390CX.
     You can run "make -j BOARD=it8380dev" to build ec.bin
     and flash the ec.bin via
     "sudo ./build/it8380dev/util/iteflash -w ./build/it8380dev/ec.bin"

Change-Id: I2077012114bdbd5a8cc8f7dc29e43cdcb77d65b6
Signed-off-by: Donald Huang <donald.huang@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/334176
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-03-24 00:03:08 -07:00
Shawn Nematbakhsh
554ecc6b9d util/iteflash: Return error on all verify failures
BUG=None
TEST=`make buildall -j`
BRANCH=None

Change-Id: Iefc8e1eaf1e5d7c8533d8497c227c8c16eb2c06d
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/331200
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-03-08 13:56:40 -08:00
Anatol Pomozov
da191ee1ac iteflash: Initialize variable that later used in the function
Latest GCC gives compiler error:
  util/iteflash.c: In function verify_flash:
  util/iteflash.c:927:9: error: res may be used uninitialized in
                this function [-Werror=maybe-uninitialized]
    return res;
           ^

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

Change-Id: I184d8673020552797fd54bb98ee582a63debbf16
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Reviewed-on: https://chromium-review.googlesource.com/330873
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-03-06 11:48:07 -08:00
Donald Huang
8e31328e02 it8380dev: util: Fix iteflash flash issue
Fix iteflash flash issue.
1. Avoid EC watchdog reset while flashing.
2. Do watchdog reset after flashing.

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

/* ==SNAPSHOT START== */

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

/* ==SNAPSHOT END== */

Change-Id: I43fc5124f3854a516df17fab78649d4b083ed9b0
Signed-off-by: Donald Huang <donald.huang@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/328873
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-02-25 11:22:09 -08:00
Donald Huang
bca1ba350f it8380dev: util: Enhance iteflash
Add verify function.

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

/* ==SNAPSHOT START== */

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

/* ==SNAPSHOT END== */

Change-Id: Iac08e2eeb934c3a4a721e17a85de628ea4d9d065
Signed-off-by: Donald Huang <donald.huang@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/322524
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-01-29 01:06:33 -08:00
Donald Huang
dbc3f1dad5 it8380dev: util: fix iteflash
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>
2015-11-10 06:54:51 -08:00
Dino Li
5727da84de it8380dev: util/iteflash
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>
2015-07-16 05:15:34 +00:00
Alec Berg
277f1c1e5c ite: Added functionality to ITE In-system programming tool.
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>
2013-11-08 00:53:05 +00:00
Vincent Palatin
a5d2fa9fb4 ite: Add IT8380 In-system Programming tool
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>
2013-11-07 03:43:57 +00:00