Initial GEC I2C implementation
Based off of Vincent's ectool work
This does the following:
- Adds some basic Linux I2C helper functions.
- Adds a ec_command function for GEC over I2C
- Allows user to specify "-p internal:bus=i2c" at the command-line
which currently targets "opaque" programmers.
- Add a hack that will also use GEC on I2C for ARM platforms if
-p internal:bus=lpc is used.
Caveat: There seem to be some regions that we need to skip for
the current EC firmware. 0x5800-0x6800 seems problematic.
BUG=chrome-os-partner:8865
TEST=Tested on Snow by reading flash content and doing a partial write
(in this case, it was in region 0xe000-0xefff).
flashrom -p internal:bus=i2c -r /tmp/foo.bin 2>/dev/null
Reading flash... SUCCESS
flashrom -p internal:bus=i2c --ignore-fmap -l layout.txt -i foo \
-w random_64k.bin 2>/dev/null
Erasing and writing flash chip... Verifying flash... VERIFIED.
SUCCESS
localhost ~ # ./flashrom -p internal:bus=i2c --get-size 2>/dev/null
65536
Change-Id: I2797e52b0e1c137cb2f4710619d5fde953b17da0
Reviewed-on: https://gerrit.chromium.org/gerrit/23601
Commit-Ready: David Hendricks <dhendrix@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
diff --git a/programmer.h b/programmer.h
index 408e584..ea0548c 100644
--- a/programmer.h
+++ b/programmer.h
@@ -666,6 +666,7 @@
int wpce775x_probe_spi_flash(const char *name);
/* gec.c */
+int gec_probe_i2c(const char *name);
int gec_probe_lpc(const char *name);
int gec_need_2nd_pass(void);
int gec_prepare(uint8_t *image, int size);