summaryrefslogtreecommitdiffstats
path: root/flash.h
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2009-07-22 15:36:50 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2009-07-22 15:36:50 +0000
commit02487aa4edfc832b27afcd850cbfbe499fa09c35 (patch)
treef63fae957dd853e016abfffdd8fff62ffb2ebb1f /flash.h
parentf3196df7f07d27fd1ebdd94365717369fb98a472 (diff)
downloadast2050-flashrom-02487aa4edfc832b27afcd850cbfbe499fa09c35.zip
ast2050-flashrom-02487aa4edfc832b27afcd850cbfbe499fa09c35.tar.gz
Replace most of the switch cases in the spi code with lookup on a struct instead
This brings the SPI code in line with the generic programmer infrastructure. This patch is a reworked version of a patch by Jakob Bornecrantz. Corresponding to flashrom svn r657. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Signed-off-by: Jakob Bornecrantz <wallbraker@gmail.com> Acked-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Jakob Bornecrantz <wallbraker@gmail.com> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'flash.h')
-rw-r--r--flash.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/flash.h b/flash.h
index e31a219..ba201ec 100644
--- a/flash.h
+++ b/flash.h
@@ -420,8 +420,18 @@ struct spi_command {
const unsigned char *writearr;
unsigned char *readarr;
};
+struct spi_programmer {
+ int (*command)(unsigned int writecnt, unsigned int readcnt,
+ const unsigned char *writearr, unsigned char *readarr);
+ int (*multicommand)(struct spi_command *spicommands);
+
+ /* Optimized functions for this programmer */
+ int (*read)(struct flashchip *flash, uint8_t *buf, int start, int len);
+ int (*write_256)(struct flashchip *flash, uint8_t *buf);
+};
extern enum spi_controller spi_controller;
+extern const struct spi_programmer spi_programmer[];
extern void *spibar;
int probe_spi_rdid(struct flashchip *flash);
int probe_spi_rdid4(struct flashchip *flash);
@@ -452,6 +462,9 @@ int spi_nbyte_read(int addr, uint8_t *bytes, int len);
int spi_read_chunked(struct flashchip *flash, uint8_t *buf, int start, int len, int chunksize);
int spi_aai_write(struct flashchip *flash, uint8_t *buf);
uint32_t spi_get_valid_read_addr(void);
+int default_spi_send_command(unsigned int writecnt, unsigned int readcnt,
+ const unsigned char *writearr, unsigned char *readarr);
+int default_spi_send_multicommand(struct spi_command *spicommands);
/* 82802ab.c */
int probe_82802ab(struct flashchip *flash);
@@ -477,6 +490,7 @@ int ich_spi_send_command(unsigned int writecnt, unsigned int readcnt,
const unsigned char *writearr, unsigned char *readarr);
int ich_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
int ich_spi_write_256(struct flashchip *flash, uint8_t * buf);
+int ich_spi_send_multicommand(struct spi_command *spicommands);
/* it87spi.c */
extern char *it87opts;
OpenPOWER on IntegriCloud