summaryrefslogtreecommitdiffstats
path: root/sst28sf040.c
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2011-12-18 15:01:24 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2011-12-18 15:01:24 +0000
commit8a3c60cdd0e5632173567923ae1927763e31e857 (patch)
tree3a5514d022392cf4d8fa368f9f02653da21a93ca /sst28sf040.c
parent63fd9026f1e82b67a65072fda862ba7af35839e1 (diff)
downloadflashrom-8a3c60cdd0e5632173567923ae1927763e31e857.tar.gz
flashrom-8a3c60cdd0e5632173567923ae1927763e31e857.tar.bz2
flashrom-8a3c60cdd0e5632173567923ae1927763e31e857.zip
Add struct flashctx * parameter to all functions accessing flash chips
All programmer access function prototypes except init have been made static and moved to the respective file. A few internal functions in flash chip drivers had chipaddr parameters which are no longer needed. The lines touched by flashctx changes have been adjusted to 80 columns except in header files. Corresponding to flashrom svn r1474. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
Diffstat (limited to 'sst28sf040.c')
-rw-r--r--sst28sf040.c55
1 files changed, 29 insertions, 26 deletions
diff --git a/sst28sf040.c b/sst28sf040.c
index ca401648d..a9a740cda 100644
--- a/sst28sf040.c
+++ b/sst28sf040.c
@@ -34,13 +34,13 @@ int protect_28sf040(struct flashctx *flash)
{
chipaddr bios = flash->virtual_memory;
- chip_readb(bios + 0x1823);
- chip_readb(bios + 0x1820);
- chip_readb(bios + 0x1822);
- chip_readb(bios + 0x0418);
- chip_readb(bios + 0x041B);
- chip_readb(bios + 0x0419);
- chip_readb(bios + 0x040A);
+ chip_readb(flash, bios + 0x1823);
+ chip_readb(flash, bios + 0x1820);
+ chip_readb(flash, bios + 0x1822);
+ chip_readb(flash, bios + 0x0418);
+ chip_readb(flash, bios + 0x041B);
+ chip_readb(flash, bios + 0x0419);
+ chip_readb(flash, bios + 0x040A);
return 0;
}
@@ -49,34 +49,36 @@ int unprotect_28sf040(struct flashctx *flash)
{
chipaddr bios = flash->virtual_memory;
- chip_readb(bios + 0x1823);
- chip_readb(bios + 0x1820);
- chip_readb(bios + 0x1822);
- chip_readb(bios + 0x0418);
- chip_readb(bios + 0x041B);
- chip_readb(bios + 0x0419);
- chip_readb(bios + 0x041A);
+ chip_readb(flash, bios + 0x1823);
+ chip_readb(flash, bios + 0x1820);
+ chip_readb(flash, bios + 0x1822);
+ chip_readb(flash, bios + 0x0418);
+ chip_readb(flash, bios + 0x041B);
+ chip_readb(flash, bios + 0x0419);
+ chip_readb(flash, bios + 0x041A);
return 0;
}
-int erase_sector_28sf040(struct flashctx *flash, unsigned int address, unsigned int sector_size)
+int erase_sector_28sf040(struct flashctx *flash, unsigned int address,
+ unsigned int sector_size)
{
chipaddr bios = flash->virtual_memory;
/* This command sequence is very similar to erase_block_82802ab. */
- chip_writeb(AUTO_PG_ERASE1, bios);
- chip_writeb(AUTO_PG_ERASE2, bios + address);
+ chip_writeb(flash, AUTO_PG_ERASE1, bios);
+ chip_writeb(flash, AUTO_PG_ERASE2, bios + address);
/* wait for Toggle bit ready */
- toggle_ready_jedec(bios);
+ toggle_ready_jedec(flash, bios);
/* FIXME: Check the status register for errors. */
return 0;
}
/* chunksize is 1 */
-int write_28sf040(struct flashctx *flash, uint8_t *src, unsigned int start, unsigned int len)
+int write_28sf040(struct flashctx *flash, uint8_t *src, unsigned int start,
+ unsigned int len)
{
int i;
chipaddr bios = flash->virtual_memory;
@@ -90,11 +92,11 @@ int write_28sf040(struct flashctx *flash, uint8_t *src, unsigned int start, unsi
continue;
}
/*issue AUTO PROGRAM command */
- chip_writeb(AUTO_PGRM, dst);
- chip_writeb(*src++, dst++);
+ chip_writeb(flash, AUTO_PGRM, dst);
+ chip_writeb(flash, *src++, dst++);
/* wait for Toggle bit ready */
- toggle_ready_jedec(bios);
+ toggle_ready_jedec(flash, bios);
}
return 0;
@@ -104,17 +106,18 @@ static int erase_28sf040(struct flashctx *flash)
{
chipaddr bios = flash->virtual_memory;
- chip_writeb(CHIP_ERASE, bios);
- chip_writeb(CHIP_ERASE, bios);
+ chip_writeb(flash, CHIP_ERASE, bios);
+ chip_writeb(flash, CHIP_ERASE, bios);
programmer_delay(10);
- toggle_ready_jedec(bios);
+ toggle_ready_jedec(flash, bios);
/* FIXME: Check the status register for errors. */
return 0;
}
-int erase_chip_28sf040(struct flashctx *flash, unsigned int addr, unsigned int blocklen)
+int erase_chip_28sf040(struct flashctx *flash, unsigned int addr,
+ unsigned int blocklen)
{
if ((addr != 0) || (blocklen != flash->total_size * 1024)) {
msg_cerr("%s called with incorrect arguments\n",