Changeset 1470
- Timestamp:
- 11/23/11 10:13:48 (6 months ago)
- Location:
- trunk
- Files:
-
- 22 edited
-
82802ab.c (modified) (1 diff)
-
buspirate_spi.c (modified) (1 diff)
-
chipdrivers.h (modified) (6 diffs)
-
dediprog.c (modified) (3 diffs)
-
dummyflasher.c (modified) (3 diffs)
-
flash.h (modified) (5 diffs)
-
flashrom.c (modified) (7 diffs)
-
ichspi.c (modified) (2 diffs)
-
it87spi.c (modified) (5 diffs)
-
jedec.c (modified) (11 diffs)
-
linux_spi.c (modified) (2 diffs)
-
m29f400bt.c (modified) (1 diff)
-
opaque.c (modified) (2 diffs)
-
pm49fl00x.c (modified) (1 diff)
-
programmer.h (modified) (4 diffs)
-
serprog.c (modified) (2 diffs)
-
spi.c (modified) (4 diffs)
-
spi25.c (modified) (8 diffs)
-
sst28sf040.c (modified) (1 diff)
-
sst49lfxxxc.c (modified) (1 diff)
-
w39.c (modified) (6 diffs)
-
wbsio_spi.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/82802ab.c
r1450 r1470 142 142 143 143 /* chunksize is 1 */ 144 int write_82802ab(struct flashchip *flash, uint8_t *src, int start,int len)144 int write_82802ab(struct flashchip *flash, uint8_t *src, unsigned int start, unsigned int len) 145 145 { 146 146 int i; -
trunk/buspirate_spi.c
r1414 r1470 296 296 { 297 297 static unsigned char *buf = NULL; 298 int i = 0, ret = 0; 298 unsigned int i = 0; 299 int ret = 0; 299 300 300 301 if (writecnt > 16 || readcnt > 16 || (readcnt + writecnt) > 16) -
trunk/chipdrivers.h
r1459 r1470 42 42 int spi_block_erase_60(struct flashchip *flash, unsigned int addr, unsigned int blocklen); 43 43 int spi_block_erase_c7(struct flashchip *flash, unsigned int addr, unsigned int blocklen); 44 int spi_chip_write_1(struct flashchip *flash, uint8_t *buf, int start,int len);45 int spi_chip_write_256(struct flashchip *flash, uint8_t *buf, int start,int len);46 int spi_chip_read(struct flashchip *flash, uint8_t *buf, int start, intlen);44 int spi_chip_write_1(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 45 int spi_chip_write_256(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 46 int spi_chip_read(struct flashchip *flash, uint8_t *buf, unsigned int start, int unsigned len); 47 47 uint8_t spi_read_status_register(void); 48 48 int spi_write_status_register(struct flashchip *flash, int status); … … 52 52 int spi_prettyprint_status_register(struct flashchip *flash); 53 53 int spi_disable_blockprotect(struct flashchip *flash); 54 int spi_byte_program( int addr, uint8_t databyte);55 int spi_nbyte_program( int addr, uint8_t *bytes,int len);56 int spi_nbyte_read( int addr, uint8_t *bytes,int len);57 int spi_read_chunked(struct flashchip *flash, uint8_t *buf, int start, int len,int chunksize);58 int spi_write_chunked(struct flashchip *flash, uint8_t *buf, int start, int len,int chunksize);59 int spi_aai_write(struct flashchip *flash, uint8_t *buf, int start,int len);54 int spi_byte_program(unsigned int addr, uint8_t databyte); 55 int spi_nbyte_program(unsigned int addr, uint8_t *bytes, unsigned int len); 56 int spi_nbyte_read(unsigned int addr, uint8_t *bytes, unsigned int len); 57 int spi_read_chunked(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len, unsigned int chunksize); 58 int spi_write_chunked(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len, unsigned int chunksize); 59 int spi_aai_write(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 60 60 61 61 /* opaque.c */ 62 62 int probe_opaque(struct flashchip *flash); 63 int read_opaque(struct flashchip *flash, uint8_t *buf, int start,int len);64 int write_opaque(struct flashchip *flash, uint8_t *buf, int start,int len);63 int read_opaque(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 64 int write_opaque(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 65 65 int erase_opaque(struct flashchip *flash, unsigned int blockaddr, unsigned int blocklen); 66 66 … … 88 88 int probe_82802ab(struct flashchip *flash); 89 89 int erase_block_82802ab(struct flashchip *flash, unsigned int page, unsigned int pagesize); 90 int write_82802ab(struct flashchip *flash, uint8_t *buf, int start,int len);90 int write_82802ab(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 91 91 void print_status_82802ab(uint8_t status); 92 92 int unlock_82802ab(struct flashchip *flash); … … 101 101 chipaddr dst); 102 102 int probe_jedec(struct flashchip *flash); 103 int write_jedec(struct flashchip *flash, uint8_t *buf, int start,int len);104 int write_jedec_1(struct flashchip *flash, uint8_t *buf, int start,int len);103 int write_jedec(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 104 int write_jedec_1(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 105 105 int erase_sector_jedec(struct flashchip *flash, unsigned int page, unsigned int pagesize); 106 106 int erase_block_jedec(struct flashchip *flash, unsigned int page, unsigned int blocksize); … … 111 111 int block_erase_m29f400bt(struct flashchip *flash, unsigned int start, unsigned int len); 112 112 int block_erase_chip_m29f400bt(struct flashchip *flash, unsigned int start, unsigned int len); 113 int write_m29f400bt(struct flashchip *flash, uint8_t *buf, int start,int len);113 int write_m29f400bt(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 114 114 void protect_m29f400bt(chipaddr bios); 115 115 … … 121 121 int erase_chip_28sf040(struct flashchip *flash, unsigned int addr, unsigned int blocklen); 122 122 int erase_sector_28sf040(struct flashchip *flash, unsigned int address, unsigned int sector_size); 123 int write_28sf040(struct flashchip *flash, uint8_t *buf, int start,int len);123 int write_28sf040(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 124 124 int unprotect_28sf040(struct flashchip *flash); 125 125 int protect_28sf040(struct flashchip *flash); -
trunk/dediprog.c
r1413 r1470 207 207 */ 208 208 static int dediprog_spi_bulk_read(struct flashchip *flash, uint8_t *buf, 209 int start,int len)210 { 211 int ret; 212 int i;209 unsigned int start, unsigned int len) 210 { 211 int ret; 212 unsigned int i; 213 213 /* chunksize must be 512, other sizes will NOT work at all. */ 214 const int chunksize = 0x200;215 const int count = len / chunksize;214 const unsigned int chunksize = 0x200; 215 const unsigned int count = len / chunksize; 216 216 const char count_and_chunk[] = {count & 0xff, 217 217 (count >> 8) & 0xff, … … 254 254 } 255 255 256 static int dediprog_spi_read(struct flashchip *flash, uint8_t *buf, int start,257 int len)256 static int dediprog_spi_read(struct flashchip *flash, uint8_t *buf, 257 unsigned int start, unsigned int len) 258 258 { 259 259 int ret; 260 260 /* chunksize must be 512, other sizes will NOT work at all. */ 261 const int chunksize = 0x200;262 int residue = start % chunksize ? chunksize - start % chunksize : 0;263 int bulklen;261 const unsigned int chunksize = 0x200; 262 unsigned int residue = start % chunksize ? chunksize - start % chunksize : 0; 263 unsigned int bulklen; 264 264 265 265 dediprog_set_leds(PASS_OFF|BUSY_ON|ERROR_OFF); … … 301 301 302 302 static int dediprog_spi_write_256(struct flashchip *flash, uint8_t *buf, 303 int start,int len)303 unsigned int start, unsigned int len) 304 304 { 305 305 int ret; -
trunk/dummyflasher.c
r1463 r1470 47 47 static enum emu_chip emu_chip = EMULATE_NONE; 48 48 static char *emu_persistent_image = NULL; 49 static int emu_chip_size = 0;49 static unsigned int emu_chip_size = 0; 50 50 #if EMULATE_SPI_CHIP 51 static int emu_max_byteprogram_size = 0;52 static int emu_max_aai_size = 0;53 static int emu_jedec_se_size = 0;54 static int emu_jedec_be_52_size = 0;55 static int emu_jedec_be_d8_size = 0;56 static int emu_jedec_ce_60_size = 0;57 static int emu_jedec_ce_c7_size = 0;58 #endif 59 #endif 60 61 static int spi_write_256_chunksize = 256;51 static unsigned int emu_max_byteprogram_size = 0; 52 static unsigned int emu_max_aai_size = 0; 53 static unsigned int emu_jedec_se_size = 0; 54 static unsigned int emu_jedec_be_52_size = 0; 55 static unsigned int emu_jedec_be_d8_size = 0; 56 static unsigned int emu_jedec_ce_60_size = 0; 57 static unsigned int emu_jedec_ce_c7_size = 0; 58 #endif 59 #endif 60 61 static unsigned int spi_write_256_chunksize = 256; 62 62 63 63 static int dummy_spi_send_command(unsigned int writecnt, unsigned int readcnt, 64 64 const unsigned char *writearr, unsigned char *readarr); 65 65 static int dummy_spi_write_256(struct flashchip *flash, uint8_t *buf, 66 int start,int len);66 unsigned int start, unsigned int len); 67 67 68 68 static const struct spi_programmer spi_programmer_dummyflasher = { … … 321 321 const unsigned char *writearr, unsigned char *readarr) 322 322 { 323 int offs;324 static int aai_offs;323 unsigned int offs; 324 static int unsigned aai_offs; 325 325 static int aai_active = 0; 326 326 … … 550 550 551 551 static int dummy_spi_write_256(struct flashchip *flash, uint8_t *buf, 552 int start,int len)552 unsigned int start, unsigned int len) 553 553 { 554 554 return spi_write_chunked(flash, buf, start, len, -
trunk/flash.h
r1459 r1470 109 109 110 110 /* Total chip size in kilobytes */ 111 int total_size;111 unsigned int total_size; 112 112 /* Chip page size in bytes */ 113 int page_size;113 unsigned int page_size; 114 114 int feature_bits; 115 115 … … 122 122 int (*probe) (struct flashchip *flash); 123 123 124 /* Delay after "enter/exit ID mode" commands in microseconds. */ 125 int probe_timing; 124 /* Delay after "enter/exit ID mode" commands in microseconds. 125 * NB: negative values have special meanings, see TIMING_* below. 126 */ 127 signed int probe_timing; 126 128 127 129 /* … … 144 146 int (*printlock) (struct flashchip *flash); 145 147 int (*unlock) (struct flashchip *flash); 146 int (*write) (struct flashchip *flash, uint8_t *buf, int start,int len);147 int (*read) (struct flashchip *flash, uint8_t *buf, int start,int len);148 int (*write) (struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 149 int (*read) (struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 148 150 struct { 149 151 uint16_t min; … … 203 205 extern char *chip_to_probe; 204 206 void map_flash_registers(struct flashchip *flash); 205 int read_memmapped(struct flashchip *flash, uint8_t *buf, int start,int len);207 int read_memmapped(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 206 208 int erase_flash(struct flashchip *flash); 207 209 int probe_flash(int startchip, struct flashchip *fill_flash, int force); … … 211 213 void tolower_string(char *str); 212 214 char *extract_param(char **haystack, const char *needle, const char *delim); 213 int verify_range(struct flashchip *flash, uint8_t *cmpbuf, int start,int len, const char *message);214 int need_erase(uint8_t *have, uint8_t *want, int len, enum write_granularity gran);215 int verify_range(struct flashchip *flash, uint8_t *cmpbuf, unsigned int start, unsigned int len, const char *message); 216 int need_erase(uint8_t *have, uint8_t *want, unsigned int len, enum write_granularity gran); 215 217 char *strcat_realloc(char *dest, const char *src); 216 218 void print_version(void); -
trunk/flashrom.c
r1463 r1470 413 413 } 414 414 415 int read_memmapped(struct flashchip *flash, uint8_t *buf, int start, intlen)415 int read_memmapped(struct flashchip *flash, uint8_t *buf, unsigned int start, int unsigned len) 416 416 { 417 417 chip_readn(buf, flash->virtual_memory + start, len); … … 536 536 537 537 /* start is an offset to the base address of the flash chip */ 538 int check_erased_range(struct flashchip *flash, int start,int len)538 int check_erased_range(struct flashchip *flash, unsigned int start, unsigned int len) 539 539 { 540 540 int ret; … … 559 559 * @return 0 for success, -1 for failure 560 560 */ 561 int verify_range(struct flashchip *flash, uint8_t *cmpbuf, int start,int len,561 int verify_range(struct flashchip *flash, uint8_t *cmpbuf, unsigned int start, unsigned int len, 562 562 const char *message) 563 563 { 564 int i;564 unsigned int i; 565 565 uint8_t *readbuf = malloc(len); 566 566 int ret = 0, failcount = 0; … … 640 640 * @return 0 if no erase is needed, 1 otherwise 641 641 */ 642 int need_erase(uint8_t *have, uint8_t *want, int len, enum write_granularity gran)642 int need_erase(uint8_t *have, uint8_t *want, unsigned int len, enum write_granularity gran) 643 643 { 644 644 int result = 0; 645 int i, j, limit;645 unsigned int i, j, limit; 646 646 647 647 switch (gran) { … … 706 706 * length of the chip. 707 707 */ 708 static int get_next_write(uint8_t *have, uint8_t *want, int len, 709 int *first_start, enum write_granularity gran) 710 { 711 int need_write = 0, rel_start = 0, first_len = 0; 712 int i, limit, stride; 708 static unsigned int get_next_write(uint8_t *have, uint8_t *want, unsigned int len, 709 unsigned int *first_start, 710 enum write_granularity gran) 711 { 712 int need_write = 0; 713 unsigned int rel_start = 0, first_len = 0; 714 unsigned int i, limit, stride; 713 715 714 716 switch (gran) { … … 1031 1033 { 1032 1034 int ret; 1033 int total_size = flash->total_size * 1024;1035 unsigned int total_size = flash->total_size * 1024; 1034 1036 1035 1037 msg_cinfo("Verifying flash... "); … … 1209 1211 unsigned int len)) 1210 1212 { 1211 int starthere = 0, lenhere = 0, ret = 0, skip = 1, writecount = 0; 1213 unsigned int starthere = 0, lenhere = 0; 1214 int ret = 0, skip = 1, writecount = 0; 1212 1215 enum write_granularity gran = write_gran_256bytes; /* FIXME */ 1213 1216 -
trunk/ichspi.c
r1464 r1470 1279 1279 } 1280 1280 1281 int ich_hwseq_read(struct flashchip *flash, uint8_t *buf, int addr, int len) 1281 int ich_hwseq_read(struct flashchip *flash, uint8_t *buf, unsigned int addr, 1282 unsigned int len) 1282 1283 { 1283 1284 uint16_t hsfc; … … 1316 1317 } 1317 1318 1318 int ich_hwseq_write(struct flashchip *flash, uint8_t *buf, int addr, int len) 1319 int ich_hwseq_write(struct flashchip *flash, uint8_t *buf, unsigned int addr, 1320 unsigned int len) 1319 1321 { 1320 1322 uint16_t hsfc; -
trunk/it87spi.c
r1463 r1470 107 107 const unsigned char *writearr, unsigned char *readarr); 108 108 static int it8716f_spi_chip_read(struct flashchip *flash, uint8_t *buf, 109 int start,int len);109 unsigned int start, unsigned int len); 110 110 static int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf, 111 int start,int len);111 unsigned int start, unsigned int len); 112 112 113 113 static const struct spi_programmer spi_programmer_it87xx = { … … 314 314 /* Page size is usually 256 bytes */ 315 315 static int it8716f_spi_page_program(struct flashchip *flash, uint8_t *buf, 316 int start) 317 { 318 int i, result; 316 unsigned int start) 317 { 318 unsigned int i; 319 int result; 319 320 chipaddr bios = flash->virtual_memory; 320 321 … … 341 342 */ 342 343 static int it8716f_spi_chip_read(struct flashchip *flash, uint8_t *buf, 343 int start,int len)344 unsigned int start, unsigned int len) 344 345 { 345 346 fast_spi = 0; … … 359 360 360 361 static int it8716f_spi_chip_write_256(struct flashchip *flash, uint8_t *buf, 361 int start,int len)362 unsigned int start, unsigned int len) 362 363 { 363 364 /* … … 375 376 spi_chip_write_1(flash, buf, start, len); 376 377 } else { 377 int lenhere;378 unsigned int lenhere; 378 379 379 380 if (start % flash->page_size) { -
trunk/jedec.c
r1450 r1470 92 92 } 93 93 94 static int getaddrmask(struct flashchip *flash)94 static unsigned int getaddrmask(struct flashchip *flash) 95 95 { 96 96 switch (flash->feature_bits & FEATURE_ADDR_MASK) { … … 356 356 357 357 /* chunksize is 1 */ 358 int write_jedec_1(struct flashchip *flash, uint8_t *src, int start,int len)358 int write_jedec_1(struct flashchip *flash, uint8_t *src, unsigned int start, unsigned int len) 359 359 { 360 360 int i, failed = 0; 361 361 chipaddr dst = flash->virtual_memory + start; 362 362 chipaddr olddst; 363 int mask;363 unsigned int mask; 364 364 365 365 mask = getaddrmask(flash); … … 377 377 } 378 378 379 int write_page_write_jedec_common(struct flashchip *flash, uint8_t *src, int start,int page_size)379 int write_page_write_jedec_common(struct flashchip *flash, uint8_t *src, unsigned int start, unsigned int page_size) 380 380 { 381 381 int i, tried = 0, failed; … … 384 384 chipaddr dst = bios + start; 385 385 chipaddr d = dst; 386 int mask;386 unsigned int mask; 387 387 388 388 mask = getaddrmask(flash); … … 425 425 * Each page is written separately in chunks with a maximum size of chunksize. 426 426 */ 427 int write_jedec(struct flashchip *flash, uint8_t *buf, int start, intlen)428 { 429 int i, starthere, lenhere;427 int write_jedec(struct flashchip *flash, uint8_t *buf, unsigned int start, int unsigned len) 428 { 429 unsigned int i, starthere, lenhere; 430 430 /* FIXME: page_size is the wrong variable. We need max_writechunk_size 431 431 * in struct flashchip to do this properly. All chips using … … 433 433 * we're OK for now. 434 434 */ 435 int page_size = flash->page_size;435 unsigned int page_size = flash->page_size; 436 436 437 437 /* Warning: This loop has a very unusual condition and body. … … 462 462 unsigned int blocksize) 463 463 { 464 int mask;464 unsigned int mask; 465 465 466 466 mask = getaddrmask(flash); … … 475 475 int probe_jedec(struct flashchip *flash) 476 476 { 477 int mask;477 unsigned int mask; 478 478 479 479 mask = getaddrmask(flash); … … 483 483 int erase_sector_jedec(struct flashchip *flash, unsigned int page, unsigned int size) 484 484 { 485 int mask;485 unsigned int mask; 486 486 487 487 mask = getaddrmask(flash); … … 491 491 int erase_block_jedec(struct flashchip *flash, unsigned int page, unsigned int size) 492 492 { 493 int mask;493 unsigned int mask; 494 494 495 495 mask = getaddrmask(flash); … … 499 499 int erase_chip_jedec(struct flashchip *flash) 500 500 { 501 int mask;501 unsigned int mask; 502 502 503 503 mask = getaddrmask(flash); -
trunk/linux_spi.c
r1432 r1470 37 37 static int linux_spi_send_command(unsigned int writecnt, unsigned int readcnt, 38 38 const unsigned char *txbuf, unsigned char *rxbuf); 39 static int linux_spi_read(struct flashchip *flash, uint8_t *buf, int start,40 int len);39 static int linux_spi_read(struct flashchip *flash, uint8_t *buf, 40 unsigned int start, unsigned int len); 41 41 static int linux_spi_write_256(struct flashchip *flash, uint8_t *buf, 42 int start,int len);42 unsigned int start, unsigned int len); 43 43 44 44 static const struct spi_programmer spi_programmer_linux = { … … 132 132 } 133 133 134 static int linux_spi_read(struct flashchip *flash, uint8_t *buf, int start,135 int len)134 static int linux_spi_read(struct flashchip *flash, uint8_t *buf, 135 unsigned int start, unsigned int len) 136 136 { 137 return spi_read_chunked(flash, buf, start, len, getpagesize());137 return spi_read_chunked(flash, buf, start, len, (unsigned)getpagesize()); 138 138 } 139 139 140 140 static int linux_spi_write_256(struct flashchip *flash, uint8_t *buf, 141 int start,int len)141 unsigned int start, unsigned int len) 142 142 { 143 return spi_write_chunked(flash, buf, start, len, getpagesize() - 4);143 return spi_write_chunked(flash, buf, start, len, ((unsigned)getpagesize()) - 4); 144 144 } -
trunk/m29f400bt.c
r1450 r1470 29 29 30 30 /* chunksize is 1 */ 31 int write_m29f400bt(struct flashchip *flash, uint8_t *src, int start,int len)31 int write_m29f400bt(struct flashchip *flash, uint8_t *src, unsigned int start, unsigned int len) 32 32 { 33 33 int i; -
trunk/opaque.c
r1459 r1470 54 54 } 55 55 56 int read_opaque(struct flashchip *flash, uint8_t *buf, int start,int len)56 int read_opaque(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) 57 57 { 58 58 if (!opaque_programmer->read) { … … 65 65 } 66 66 67 int write_opaque(struct flashchip *flash, uint8_t *buf, int start,int len)67 int write_opaque(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) 68 68 { 69 69 if (!opaque_programmer->write) { -
trunk/pm49fl00x.c
r1414 r1470 23 23 #include "flash.h" 24 24 25 static void write_lockbits_49fl00x(chipaddr bios, int size,26 unsigned char bits, int block_size)25 static void write_lockbits_49fl00x(chipaddr bios, unsigned int size, 26 unsigned char bits, unsigned int block_size) 27 27 { 28 int i, left = size;28 unsigned int i, left = size; 29 29 30 30 for (i = 0; left >= block_size; i++, left -= block_size) { -
trunk/programmer.h
r1463 r1470 564 564 struct spi_programmer { 565 565 enum spi_controller type; 566 int max_data_read;567 int max_data_write;566 unsigned int max_data_read; 567 unsigned int max_data_write; 568 568 int (*command)(unsigned int writecnt, unsigned int readcnt, 569 569 const unsigned char *writearr, unsigned char *readarr); … … 571 571 572 572 /* Optimized functions for this programmer */ 573 int (*read)(struct flashchip *flash, uint8_t *buf, int start,int len);574 int (*write_256)(struct flashchip *flash, uint8_t *buf, int start,int len);573 int (*read)(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 574 int (*write_256)(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 575 575 }; 576 576 … … 579 579 const unsigned char *writearr, unsigned char *readarr); 580 580 int default_spi_send_multicommand(struct spi_command *cmds); 581 int default_spi_read(struct flashchip *flash, uint8_t *buf, int start,int len);582 int default_spi_write_256(struct flashchip *flash, uint8_t *buf, int start,int len);581 int default_spi_read(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 582 int default_spi_write_256(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 583 583 void register_spi_programmer(const struct spi_programmer *programmer); 584 584 … … 626 626 /* Specific functions for this programmer */ 627 627 int (*probe) (struct flashchip *flash); 628 int (*read) (struct flashchip *flash, uint8_t *buf, int start,int len);629 int (*write) (struct flashchip *flash, uint8_t *buf, int start,int len);628 int (*read) (struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 629 int (*write) (struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 630 630 int (*erase) (struct flashchip *flash, unsigned int blockaddr, unsigned int blocklen); 631 631 }; -
trunk/serprog.c
r1463 r1470 303 303 const unsigned char *writearr, 304 304 unsigned char *readarr); 305 static int serprog_spi_read(struct flashchip *flash, uint8_t *buf, int start,306 int len);305 static int serprog_spi_read(struct flashchip *flash, uint8_t *buf, 306 unsigned int start, unsigned int len); 307 307 static struct spi_programmer spi_programmer_serprog = { 308 308 .type = SPI_CONTROLLER_SERPROG, … … 823 823 * non-contiguous address space (like AT45DB161D). When spi_read_chunked is 824 824 * fixed this method can be removed. */ 825 static int serprog_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len) 826 { 827 int i; 828 int cur_len; 829 const int max_read = spi_programmer_serprog.max_data_read; 825 static int serprog_spi_read(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) 826 { 827 unsigned int i, cur_len; 828 const unsigned int max_read = spi_programmer_serprog.max_data_read; 830 829 for (i = 0; i < len; i += cur_len) { 831 830 int ret; -
trunk/spi.c
r1450 r1470 98 98 } 99 99 100 int default_spi_read(struct flashchip *flash, uint8_t *buf, int start,int len)100 int default_spi_read(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) 101 101 { 102 int max_data = spi_programmer->max_data_read;102 unsigned int max_data = spi_programmer->max_data_read; 103 103 if (max_data == MAX_DATA_UNSPECIFIED) { 104 104 msg_perr("%s called, but SPI read chunk size not defined " … … 110 110 } 111 111 112 int default_spi_write_256(struct flashchip *flash, uint8_t *buf, int start,int len)112 int default_spi_write_256(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) 113 113 { 114 int max_data = spi_programmer->max_data_write;114 unsigned int max_data = spi_programmer->max_data_write; 115 115 if (max_data == MAX_DATA_UNSPECIFIED) { 116 116 msg_perr("%s called, but SPI write chunk size not defined " … … 122 122 } 123 123 124 int spi_chip_read(struct flashchip *flash, uint8_t *buf, int start,int len)124 int spi_chip_read(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) 125 125 { 126 int addrbase = 0;126 unsigned int addrbase = 0; 127 127 if (!spi_programmer->read) { 128 128 msg_perr("%s called, but SPI read is unsupported on this " … … 161 161 */ 162 162 /* real chunksize is up to 256, logical chunksize is 256 */ 163 int spi_chip_write_256(struct flashchip *flash, uint8_t *buf, int start,int len)163 int spi_chip_write_256(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) 164 164 { 165 165 if (!spi_programmer->write_256) { -
trunk/spi25.c
r1454 r1470 841 841 } 842 842 843 int spi_byte_program( int addr, uint8_t databyte)843 int spi_byte_program(unsigned int addr, uint8_t databyte) 844 844 { 845 845 int result; … … 876 876 } 877 877 878 int spi_nbyte_program( int addr, uint8_t *bytes,int len)878 int spi_nbyte_program(unsigned int addr, uint8_t *bytes, unsigned int len) 879 879 { 880 880 int result; … … 951 951 } 952 952 953 int spi_nbyte_read( int address, uint8_t *bytes,int len)953 int spi_nbyte_read(unsigned int address, uint8_t *bytes, unsigned int len) 954 954 { 955 955 const unsigned char cmd[JEDEC_READ_OUTSIZE] = { … … 969 969 * Each page is read separately in chunks with a maximum size of chunksize. 970 970 */ 971 int spi_read_chunked(struct flashchip *flash, uint8_t *buf, int start, int len,int chunksize)971 int spi_read_chunked(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len, unsigned int chunksize) 972 972 { 973 973 int rc = 0; 974 int i, j, starthere, lenhere; 975 int page_size = flash->page_size; 976 int toread; 974 unsigned int i, j, starthere, lenhere, toread; 975 unsigned int page_size = flash->page_size; 977 976 978 977 /* Warning: This loop has a very unusual condition and body. … … 1009 1008 * Each page is written separately in chunks with a maximum size of chunksize. 1010 1009 */ 1011 int spi_write_chunked(struct flashchip *flash, uint8_t *buf, int start, int len,int chunksize)1010 int spi_write_chunked(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len, unsigned int chunksize) 1012 1011 { 1013 1012 int rc = 0; 1014 int i, j, starthere, lenhere;1013 unsigned int i, j, starthere, lenhere, towrite; 1015 1014 /* FIXME: page_size is the wrong variable. We need max_writechunk_size 1016 1015 * in struct flashchip to do this properly. All chips using … … 1018 1017 * we're OK for now. 1019 1018 */ 1020 int page_size = flash->page_size; 1021 int towrite; 1019 unsigned int page_size = flash->page_size; 1022 1020 1023 1021 /* Warning: This loop has a very unusual condition and body. … … 1058 1056 */ 1059 1057 /* real chunksize is 1, logical chunksize is 1 */ 1060 int spi_chip_write_1(struct flashchip *flash, uint8_t *buf, int start, int len) 1061 { 1062 int i, result = 0; 1058 int spi_chip_write_1(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) 1059 { 1060 unsigned int i; 1061 int result = 0; 1063 1062 1064 1063 for (i = start; i < start + len; i++) { … … 1073 1072 } 1074 1073 1075 int spi_aai_write(struct flashchip *flash, uint8_t *buf, int start,int len)1074 int spi_aai_write(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) 1076 1075 { 1077 1076 uint32_t pos = start; -
trunk/sst28sf040.c
r1450 r1470 77 77 78 78 /* chunksize is 1 */ 79 int write_28sf040(struct flashchip *flash, uint8_t *src, int start,int len)79 int write_28sf040(struct flashchip *flash, uint8_t *src, unsigned int start, unsigned int len) 80 80 { 81 81 int i; -
trunk/sst49lfxxxc.c
r1353 r1470 36 36 { 37 37 chipaddr registers = flash->virtual_registers; 38 int i, left = flash->total_size * 1024;38 unsigned int i, left = flash->total_size * 1024; 39 39 unsigned long address; 40 40 -
trunk/w39.c
r1414 r1470 22 22 #include "flash.h" 23 23 24 static int printlock_w39_fwh_block(struct flashchip *flash, int offset)24 static int printlock_w39_fwh_block(struct flashchip *flash, unsigned int offset) 25 25 { 26 26 chipaddr wrprotect = flash->virtual_registers + offset + 2; … … 60 60 } 61 61 62 static int unlock_w39_fwh_block(struct flashchip *flash, int offset)62 static int unlock_w39_fwh_block(struct flashchip *flash, unsigned int offset) 63 63 { 64 64 chipaddr wrprotect = flash->virtual_registers + offset + 2; … … 81 81 } 82 82 83 static uint8_t w39_idmode_readb(struct flashchip *flash, int offset)83 static uint8_t w39_idmode_readb(struct flashchip *flash, unsigned int offset) 84 84 { 85 85 chipaddr bios = flash->virtual_memory; … … 128 128 } 129 129 130 static int printlock_w39_common(struct flashchip *flash, int offset)130 static int printlock_w39_common(struct flashchip *flash, unsigned int offset) 131 131 { 132 132 uint8_t lock; … … 139 139 static int printlock_w39_fwh(struct flashchip *flash) 140 140 { 141 int i, total_size = flash->total_size * 1024;141 unsigned int i, total_size = flash->total_size * 1024; 142 142 int ret = 0; 143 143 … … 151 151 static int unlock_w39_fwh(struct flashchip *flash) 152 152 { 153 int i, total_size = flash->total_size * 1024;153 unsigned int i, total_size = flash->total_size * 1024; 154 154 155 155 /* Unlock the complete chip */ -
trunk/wbsio_spi.c
r1463 r1470 63 63 static int wbsio_spi_send_command(unsigned int writecnt, unsigned int readcnt, 64 64 const unsigned char *writearr, unsigned char *readarr); 65 static int wbsio_spi_read(struct flashchip *flash, uint8_t *buf, int start,int len);65 static int wbsio_spi_read(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len); 66 66 67 67 static const struct spi_programmer spi_programmer_wbsio = { … … 195 195 } 196 196 197 static int wbsio_spi_read(struct flashchip *flash, uint8_t *buf, int start,int len)197 static int wbsio_spi_read(struct flashchip *flash, uint8_t *buf, unsigned int start, unsigned int len) 198 198 { 199 199 return read_memmapped(flash, buf, start, len);
Note: See TracChangeset
for help on using the changeset viewer.
