Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KlNpY-00005D-HU for qemu-devel@nongnu.org; Thu, 02 Oct 2008 09:02:56 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KlNpW-0008Ts-IX for qemu-devel@nongnu.org; Thu, 02 Oct 2008 09:02:55 -0400 Received: from [199.232.76.173] (port=48079 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KlNpW-0008Tg-7N for qemu-devel@nongnu.org; Thu, 02 Oct 2008 09:02:54 -0400 Received: from mail.free-electrons.com ([88.191.76.200]:38765) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KlNpV-0003Ls-7m for qemu-devel@nongnu.org; Thu, 02 Oct 2008 09:02:53 -0400 Message-Id: <20081002130238.239052598@free-electrons.com> References: <20081002130214.299833919@free-electrons.com> Date: Thu, 02 Oct 2008 15:02:15 +0200 From: Thomas Petazzoni Content-Disposition: inline; filename=pflash-cfi01-increase-write-buffer-size Subject: [Qemu-devel] [patch 1/4] Increase write buffer size in pflash emulation Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Thomas Petazzoni , michael@free-electrons.com 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 change the type of the cmd local variable in pflash_write() from uint8_t to uint16_t, because the length of the transfer doesn't fit on 8 bits anymore. Signed-off-by: Thomas Petazzoni --- hw/pflash_cfi01.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Index: qemu/hw/pflash_cfi01.c =================================================================== --- qemu.orig/hw/pflash_cfi01.c +++ qemu/hw/pflash_cfi01.c @@ -200,7 +200,7 @@ { target_ulong boff; uint8_t *p; - uint8_t cmd; + uint16_t cmd; cmd = value; offset -= pfl->base; @@ -583,7 +583,7 @@ pfl->cfi_table[0x28] = 0x02; pfl->cfi_table[0x29] = 0x00; /* Max number of bytes in multi-bytes write */ - pfl->cfi_table[0x2A] = 0x04; + pfl->cfi_table[0x2A] = 0x0B; pfl->cfi_table[0x2B] = 0x00; /* Number of erase block regions (uniform) */ pfl->cfi_table[0x2C] = 0x01; -- Thomas Petazzoni, Free Electrons Kernel, drivers and embedded Linux development, consulting, training and support. http://free-electrons.com