Commit 71fb2348663e291c99284844b35d5991ded389a1

Authored by balrog
1 parent 998a0501

Increase write buffer size in pflash emulation (Thomas Petazzoni).

The current flash emulation code advertises a write buffer size of 16
bytes (1 << 4, according to offset 0x2A of the CFI table). This is
very small compared to normal write buffer sizes, and makes the
process of writing to the flash very slow (at least from U-Boot).

This patch increases this size to 2048 bytes. Except the modification
of the CFI table, the only other required modification is to use
"value" instead of "cmd" to set pfl->counter, because cmd is truncated
to the 8 lower bits of value, while the number of bytes for a write
can now be greater than 255 bytes.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5454 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 3 additions and 3 deletions
hw/pflash_cfi01.c
@@ -276,8 +276,8 @@ static void pflash_write (pflash_t *pfl, target_ulong offset, uint32_t value, @@ -276,8 +276,8 @@ static void pflash_write (pflash_t *pfl, target_ulong offset, uint32_t value,
276 276
277 break; 277 break;
278 case 0xe8: 278 case 0xe8:
279 - DPRINTF("%s: block write of %x bytes\n", __func__, cmd);  
280 - pfl->counter = cmd; 279 + DPRINTF("%s: block write of %x bytes\n", __func__, value);
  280 + pfl->counter = value;
281 pfl->wcycle++; 281 pfl->wcycle++;
282 break; 282 break;
283 case 0x60: 283 case 0x60:
@@ -583,7 +583,7 @@ pflash_t *pflash_cfi01_register(target_phys_addr_t base, ram_addr_t off, @@ -583,7 +583,7 @@ pflash_t *pflash_cfi01_register(target_phys_addr_t base, ram_addr_t off,
583 pfl->cfi_table[0x28] = 0x02; 583 pfl->cfi_table[0x28] = 0x02;
584 pfl->cfi_table[0x29] = 0x00; 584 pfl->cfi_table[0x29] = 0x00;
585 /* Max number of bytes in multi-bytes write */ 585 /* Max number of bytes in multi-bytes write */
586 - pfl->cfi_table[0x2A] = 0x04; 586 + pfl->cfi_table[0x2A] = 0x0B;
587 pfl->cfi_table[0x2B] = 0x00; 587 pfl->cfi_table[0x2B] = 0x00;
588 /* Number of erase block regions (uniform) */ 588 /* Number of erase block regions (uniform) */
589 pfl->cfi_table[0x2C] = 0x01; 589 pfl->cfi_table[0x2C] = 0x01;