mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-26 22:52:34 +02:00
Let the programmer driver decide how to do AAI transfers
Currently spi_aai_write() is implemented without an abstraction mechanism for the programmer driver. This adds another function pointer 'write_aai' to struct spi_programmer, which is set to default_spi_write_aai (renamed spi_aai_write) for all programmers for now. A patch which utilises this abstraction in the dediprog driver will follow. Corresponding to flashrom svn r1543. Signed-off-by: Nico Huber <nico.huber@secunet.com> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
parent
3464d05eb4
commit
7bca126561
@ -71,6 +71,7 @@ static const struct spi_programmer spi_programmer_bitbang = {
|
|||||||
.multicommand = default_spi_send_multicommand,
|
.multicommand = default_spi_send_multicommand,
|
||||||
.read = default_spi_read,
|
.read = default_spi_read,
|
||||||
.write_256 = default_spi_write_256,
|
.write_256 = default_spi_write_256,
|
||||||
|
.write_aai = default_spi_write_aai,
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 0 // until it is needed
|
#if 0 // until it is needed
|
||||||
|
@ -124,6 +124,7 @@ static const struct spi_programmer spi_programmer_buspirate = {
|
|||||||
.multicommand = default_spi_send_multicommand,
|
.multicommand = default_spi_send_multicommand,
|
||||||
.read = default_spi_read,
|
.read = default_spi_read,
|
||||||
.write_256 = default_spi_write_256,
|
.write_256 = default_spi_write_256,
|
||||||
|
.write_aai = default_spi_write_aai,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct buspirate_spispeeds spispeeds[] = {
|
static const struct buspirate_spispeeds spispeeds[] = {
|
||||||
|
@ -709,6 +709,7 @@ static const struct spi_programmer spi_programmer_dediprog = {
|
|||||||
.multicommand = default_spi_send_multicommand,
|
.multicommand = default_spi_send_multicommand,
|
||||||
.read = dediprog_spi_read,
|
.read = dediprog_spi_read,
|
||||||
.write_256 = dediprog_spi_write_256,
|
.write_256 = dediprog_spi_write_256,
|
||||||
|
.write_aai = default_spi_write_aai,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int dediprog_shutdown(void *data)
|
static int dediprog_shutdown(void *data)
|
||||||
|
@ -127,6 +127,7 @@ static const struct spi_programmer spi_programmer_dummyflasher = {
|
|||||||
.multicommand = default_spi_send_multicommand,
|
.multicommand = default_spi_send_multicommand,
|
||||||
.read = default_spi_read,
|
.read = default_spi_read,
|
||||||
.write_256 = dummy_spi_write_256,
|
.write_256 = dummy_spi_write_256,
|
||||||
|
.write_aai = default_spi_write_aai,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct par_programmer par_programmer_dummy = {
|
static const struct par_programmer par_programmer_dummy = {
|
||||||
|
@ -148,6 +148,7 @@ static const struct spi_programmer spi_programmer_ft2232 = {
|
|||||||
.multicommand = default_spi_send_multicommand,
|
.multicommand = default_spi_send_multicommand,
|
||||||
.read = default_spi_read,
|
.read = default_spi_read,
|
||||||
.write_256 = default_spi_write_256,
|
.write_256 = default_spi_write_256,
|
||||||
|
.write_aai = default_spi_write_aai,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Returns 0 upon success, a negative number upon errors. */
|
/* Returns 0 upon success, a negative number upon errors. */
|
||||||
|
3
ichspi.c
3
ichspi.c
@ -1521,6 +1521,7 @@ static const struct spi_programmer spi_programmer_ich7 = {
|
|||||||
.multicommand = ich_spi_send_multicommand,
|
.multicommand = ich_spi_send_multicommand,
|
||||||
.read = default_spi_read,
|
.read = default_spi_read,
|
||||||
.write_256 = default_spi_write_256,
|
.write_256 = default_spi_write_256,
|
||||||
|
.write_aai = default_spi_write_aai,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct spi_programmer spi_programmer_ich9 = {
|
static const struct spi_programmer spi_programmer_ich9 = {
|
||||||
@ -1531,6 +1532,7 @@ static const struct spi_programmer spi_programmer_ich9 = {
|
|||||||
.multicommand = ich_spi_send_multicommand,
|
.multicommand = ich_spi_send_multicommand,
|
||||||
.read = default_spi_read,
|
.read = default_spi_read,
|
||||||
.write_256 = default_spi_write_256,
|
.write_256 = default_spi_write_256,
|
||||||
|
.write_aai = default_spi_write_aai,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct opaque_programmer opaque_programmer_ich_hwseq = {
|
static const struct opaque_programmer opaque_programmer_ich_hwseq = {
|
||||||
@ -1838,6 +1840,7 @@ static const struct spi_programmer spi_programmer_via = {
|
|||||||
.multicommand = ich_spi_send_multicommand,
|
.multicommand = ich_spi_send_multicommand,
|
||||||
.read = default_spi_read,
|
.read = default_spi_read,
|
||||||
.write_256 = default_spi_write_256,
|
.write_256 = default_spi_write_256,
|
||||||
|
.write_aai = default_spi_write_aai,
|
||||||
};
|
};
|
||||||
|
|
||||||
int via_init_spi(struct pci_dev *dev)
|
int via_init_spi(struct pci_dev *dev)
|
||||||
|
@ -283,6 +283,7 @@ static const struct spi_programmer spi_programmer_it85xx = {
|
|||||||
.multicommand = default_spi_send_multicommand,
|
.multicommand = default_spi_send_multicommand,
|
||||||
.read = default_spi_read,
|
.read = default_spi_read,
|
||||||
.write_256 = default_spi_write_256,
|
.write_256 = default_spi_write_256,
|
||||||
|
.write_aai = default_spi_write_aai,
|
||||||
};
|
};
|
||||||
|
|
||||||
int it85xx_spi_init(struct superio s)
|
int it85xx_spi_init(struct superio s)
|
||||||
|
@ -120,6 +120,7 @@ static const struct spi_programmer spi_programmer_it87xx = {
|
|||||||
.multicommand = default_spi_send_multicommand,
|
.multicommand = default_spi_send_multicommand,
|
||||||
.read = it8716f_spi_chip_read,
|
.read = it8716f_spi_chip_read,
|
||||||
.write_256 = it8716f_spi_chip_write_256,
|
.write_256 = it8716f_spi_chip_write_256,
|
||||||
|
.write_aai = default_spi_write_aai,
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint16_t it87spi_probe(uint16_t port)
|
static uint16_t it87spi_probe(uint16_t port)
|
||||||
|
@ -54,6 +54,7 @@ static const struct spi_programmer spi_programmer_linux = {
|
|||||||
.multicommand = default_spi_send_multicommand,
|
.multicommand = default_spi_send_multicommand,
|
||||||
.read = linux_spi_read,
|
.read = linux_spi_read,
|
||||||
.write_256 = linux_spi_write_256,
|
.write_256 = linux_spi_write_256,
|
||||||
|
.write_aai = default_spi_write_aai,
|
||||||
};
|
};
|
||||||
|
|
||||||
int linux_spi_init(void)
|
int linux_spi_init(void)
|
||||||
|
@ -530,6 +530,7 @@ struct spi_programmer {
|
|||||||
/* Optimized functions for this programmer */
|
/* Optimized functions for this programmer */
|
||||||
int (*read)(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
|
int (*read)(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
|
||||||
int (*write_256)(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
|
int (*write_256)(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
|
||||||
|
int (*write_aai)(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
|
||||||
const void *data;
|
const void *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -538,6 +539,7 @@ int default_spi_send_command(struct flashctx *flash, unsigned int writecnt, unsi
|
|||||||
int default_spi_send_multicommand(struct flashctx *flash, struct spi_command *cmds);
|
int default_spi_send_multicommand(struct flashctx *flash, struct spi_command *cmds);
|
||||||
int default_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
|
int default_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
|
||||||
int default_spi_write_256(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
|
int default_spi_write_256(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
|
||||||
|
int default_spi_write_aai(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
|
||||||
int register_spi_programmer(const struct spi_programmer *programmer);
|
int register_spi_programmer(const struct spi_programmer *programmer);
|
||||||
|
|
||||||
/* The following enum is needed by ich_descriptor_tool and ich* code. */
|
/* The following enum is needed by ich_descriptor_tool and ich* code. */
|
||||||
|
@ -201,6 +201,7 @@ static const struct spi_programmer spi_programmer_sb600 = {
|
|||||||
.multicommand = default_spi_send_multicommand,
|
.multicommand = default_spi_send_multicommand,
|
||||||
.read = default_spi_read,
|
.read = default_spi_read,
|
||||||
.write_256 = default_spi_write_256,
|
.write_256 = default_spi_write_256,
|
||||||
|
.write_aai = default_spi_write_aai,
|
||||||
};
|
};
|
||||||
|
|
||||||
int sb600_probe_spi(struct pci_dev *dev)
|
int sb600_probe_spi(struct pci_dev *dev)
|
||||||
|
@ -313,6 +313,7 @@ static struct spi_programmer spi_programmer_serprog = {
|
|||||||
.multicommand = default_spi_send_multicommand,
|
.multicommand = default_spi_send_multicommand,
|
||||||
.read = serprog_spi_read,
|
.read = serprog_spi_read,
|
||||||
.write_256 = default_spi_write_256,
|
.write_256 = default_spi_write_256,
|
||||||
|
.write_aai = default_spi_write_aai,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void serprog_chip_writeb(const struct flashctx *flash, uint8_t val,
|
static void serprog_chip_writeb(const struct flashctx *flash, uint8_t val,
|
||||||
|
8
spi.c
8
spi.c
@ -161,11 +161,17 @@ uint32_t spi_get_valid_read_addr(struct flashctx *flash)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int spi_aai_write(struct flashctx *flash, uint8_t *buf,
|
||||||
|
unsigned int start, unsigned int len)
|
||||||
|
{
|
||||||
|
return flash->pgm->spi.write_aai(flash, buf, start, len);
|
||||||
|
}
|
||||||
|
|
||||||
int register_spi_programmer(const struct spi_programmer *pgm)
|
int register_spi_programmer(const struct spi_programmer *pgm)
|
||||||
{
|
{
|
||||||
struct registered_programmer rpgm;
|
struct registered_programmer rpgm;
|
||||||
|
|
||||||
if (!pgm->write_256 || !pgm->read || !pgm->command ||
|
if (!pgm->write_aai || !pgm->write_256 || !pgm->read || !pgm->command ||
|
||||||
!pgm->multicommand ||
|
!pgm->multicommand ||
|
||||||
((pgm->command == default_spi_send_command) &&
|
((pgm->command == default_spi_send_command) &&
|
||||||
(pgm->multicommand == default_spi_send_multicommand))) {
|
(pgm->multicommand == default_spi_send_multicommand))) {
|
||||||
|
3
spi25.c
3
spi25.c
@ -1069,8 +1069,7 @@ int spi_chip_write_1(struct flashctx *flash, uint8_t *buf, unsigned int start,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int spi_aai_write(struct flashctx *flash, uint8_t *buf, unsigned int start,
|
int default_spi_write_aai(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len)
|
||||||
unsigned int len)
|
|
||||||
{
|
{
|
||||||
uint32_t pos = start;
|
uint32_t pos = start;
|
||||||
int result;
|
int result;
|
||||||
|
@ -75,6 +75,7 @@ static const struct spi_programmer spi_programmer_wbsio = {
|
|||||||
.multicommand = default_spi_send_multicommand,
|
.multicommand = default_spi_send_multicommand,
|
||||||
.read = wbsio_spi_read,
|
.read = wbsio_spi_read,
|
||||||
.write_256 = spi_chip_write_1,
|
.write_256 = spi_chip_write_1,
|
||||||
|
.write_aai = default_spi_write_aai,
|
||||||
};
|
};
|
||||||
|
|
||||||
int wbsio_check_for_spi(void)
|
int wbsio_check_for_spi(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user