[U-Boot-Users] CFI Driver Fencepost Bugfix

Wolfgang,
If you apply York's patch to enhance the CFI driver, you will need this bug fix as well. Applying this patch allows the use of a PROMjet ICE to replace a FLASH bank but still appear to use the CFI driver. In this case, the CFI driver just fails to recognize it as a valid CFI device and the bank is treated like normal RAM.
While this was the behaviour, after York's patch is applied, there is a lingering fencepost error after coming out of the CFI detection loop that leaves the info->portwidth and info->chipwidth at an index beyond the array used in York's patch for address calculation. When the subsequent flash_write_cmd() is executed, random results were possible.
This patch prevents that fencepost error, and is must be applied after York's CFI driver patch. (Technically the logical patch can be applied, but the line numbers are post-York's patch.)
Thanks, jdl
* Patch by Jon Loeliger, Kumar Gala, 2004-12-03 - Fix a fencepost error with York's previous patch to the CFI driver for the case where the FLASH banks aren't actually CFI devices. This prevents oversubscripting the offset_multiply[] array.
Index: drivers/cfi_flash.c =================================================================== RCS file: /cm/vault/u-boot/u-boot/drivers/cfi_flash.c,v retrieving revision 1.1.1.1.2.4 retrieving revision 1.1.1.1.2.5 diff -u -r1.1.1.1.2.4 -r1.1.1.1.2.5 --- drivers/cfi_flash.c 22 Nov 2004 17:50:25 -0000 1.1.1.1.2.4 +++ drivers/cfi_flash.c 3 Dec 2004 18:03:31 -0000 1.1.1.1.2.5 @@ -1253,6 +1253,9 @@ if ((info->interface == FLASH_CFI_X8X16) && (info->chipwidth == FLASH_CFI_BY8)) { info->portwidth >>= 1; /* XXX - Need to test on x8/x16 in parallel. */ } + } else { + info->portwidth = 1; + info->chipwidth = 1; }
flash_write_cmd (info, 0, 0, FLASH_CMD_RESET);
participants (1)
-
Jon Loeliger