Separate LPC-centric GEC stuff into gec_lpc.c

This CL attempts to isolate LPC-specific GEC routines into gec_lpc.c.
Eventually, gec.c will be generic and can be used by both gec_lpc
routines and gec_i2c routines.

One challenge this attempts to address is that GEC-specific functions
are used in higher-level logic in doit(), which does not have
programmer-specific knowledge. So a "gec_priv" struct was introduced
as the void * member of the programmer struct so that GEC functions
can always access their command function and state variables.

BUG=chrome-os-partner:8865
TEST=Tested on Link

Firmware read and write (both with same and different images)
succeeded and verified.

Setting a write-protect range and viewing status also worked:
localhost ~ # ./flashrom -p internal:bus=lpc --wp-range 0x00000 0x10000 2>/dev/null
SUCCESS

localhost ~ # ./flashrom -p internal:bus=lpc --wp-status 2>/dev/null
WP: status: 0x00
WP: status.srp0: 0
WP: write protect is disabled.
WP: write protect range: start=0x00000000, len=0x00010000

Change-Id: I36fb3c3ca72f75774645db01b03f8f4d0e00f5ef
Reviewed-on: https://gerrit.chromium.org/gerrit/23595
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 66a75c9..408e584 100644
--- a/programmer.h
+++ b/programmer.h
@@ -666,9 +666,21 @@
 int wpce775x_probe_spi_flash(const char *name);
 
 /* gec.c */
-int gec_probe_programmer(const char *name);
+int gec_probe_lpc(const char *name);
 int gec_need_2nd_pass(void);
 int gec_prepare(uint8_t *image, int size);
+struct gec_priv {
+	int detected;
+	int (*ec_command)(int command, const void *indata, int insize,
+			  void *outdata, int outsize);
+};
+int gec_probe_size(struct flashchip *flash);
+int gec_block_erase(struct flashchip *flash,
+                    unsigned int blockaddr, unsigned int len);
+int gec_read(struct flashchip *flash, uint8_t *readarr,
+             unsigned int blockaddr, unsigned int readcnt);
+int gec_write(struct flashchip *flash, uint8_t *buf, unsigned int addr,
+                    unsigned int nbytes);
 
 void sp_flush_incoming(void);
 fdtype sp_openserport(char *dev, unsigned int baud);