summaryrefslogtreecommitdiff
path: root/drivers/mtd/cfi_flash.c
AgeCommit message (Collapse)Author
2008-04-25cfi-flash: Add CFG_FLASH_AUTOPROTECT_LISTMatthias Fuchs
This patch adds a configurable flash auto protection list that can be used to make U-Boot protect flash regions in flash_init(). The idea has been discussed on the u-boot mailing list starting on Nov 18th, 2007. Even this patch brings a new feature it is used as a bugfix for 4xx platforms where flash_init() does not completely protect the monitor's flash range in all situations. U-Boot protects the flash range from CFG_MONITOR_BASE to (CFG_MONITOR_BASE + monitor_flash_len - 1) by default. This does not include the reset vector at 0xfffffffc. Example: #define CFG_FLASH_AUTOPROTECT_LIST {{0xfff80000, 0x80000}} This config option will auto protect the last 512k of flash that contains the bootloader on board like APC405 and PMC405. Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
2008-04-12cfi_flash: Support buffered writes on non-standard Spansion NOR flashGuennadi Liakhovetski
Some NOR flash chip from Spansion, for example, the s29ws-n MirrorBit series require different addresses for buffered write commands. Define a configuration option to support buffered writes on those chips. A more elegant solution would be to automatically detect those chips by parsing their CFI records, but that would require introduction of a fixup table into the cfi_flash driver. Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
2008-03-29MTD/CFI: flash_read64 is defined a weak function (for SPARC)Daniel Hellstrom
SPARC has implemented __raw_readq, it reads 64-bit from any 32-bit address. SPARC CPUs implement flash_read64 which calls __raw_readq. For current SPARC architectures (LEON2 and LEON3) each read from the FLASH must lead to a cache miss. This is because FLASH can not be set non-cacheable since program code resides there, and alternatively disabling cache is poor from performance view, or doing a cache flush between each read is even poorer. Forcing a cache miss on a SPARC is done by a special instruction "lda" - load alternative space, the alternative space number (ASI) is processor implementation spcific and can be found by including <asm/processor.h>. Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
2008-03-28MTD/CFI: Add support for 16bit legacy AMD flashTor Krill
Add entry for 512Kx16 AMD flash to jedec_table. Read out 16bit device id if chipwidth is 16bit. Fixed coding style after Stefans feedback Signed-off-by: Tor Krill <tor@excito.com>
2008-03-19CFI: Small cleanup for FLASH_SHOW_PROGRESSStefan Roese
With this patch we don't need that many #ifdef's in the code. It moves the subtraction into the macro and defines a NOP-macro when CONFIG_FLASH_SHOW_PROGRESS is not defined. Signed-off-by: Stefan Roese <sr@denx.de> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
2008-03-19Flash programming progress countdown.Jerry Van Baren
Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
2008-02-21CFI: Do not use uninitialized cmd_resetMichael Schwingen
Do not use uninitialized cmd_reset; issue both AMD and Intel reset commands instead From a short test, it looks like AMD-style flash roms treat *any* unknown command write as a reset, at least when in CFI Query mode, so issuing the Intel reset command to AMD-style flashs seems safe (from the small sample I have), plus the 3-cycle magic sequence should kick the state machine into the right state even without a reset command. Since the AMD-style flashs require the unlock sequence for real operation, I chose to try the AMD reset command first, so that Intel flashs do no see an invalid command prior to the CFI query. I have tested the patch on AM29LV320-style flashs from Fujitsu and Macronix, plus Intel StrataFlash. Signed-off-by: Michael Schwingen <michael@schwingen.org> Signed-off-by: Stefan Roese <sr@denx.de>
2008-01-13CFI: Fix CONFIG_FLASH_CFI_LEGACY compilationMichael Schwingen
Signed-off-by: Michael Schwingen <michael@schwingen.org> Acked-by: Stefan Roese <sr@denx.de>
2008-01-02cfi_flash: Fix bug in flash_isset() to use correct 32bit functionStefan Roese
This bug was detected on the LWMON5 target which has 2 Intel 16bit wide flash chips connected to a 32bit wide port. Signed-off-by: Stefan Roese <sr@denx.de>
2007-12-27cfi_flash: Add missing check for erased dest to flash_write_cfibuffer()Stefan Roese
The check for an sufficiently erased destination was missing in the buffered write function of the cfi flash driver (when CFG_FLASH_USE_BUFFER_WRITE is defined). This patch adds this check to that writing to such a region will fail with the currect error message. Signed-off-by: Stefan Roese <sr@denx.de>
2007-12-17cfi_flash: Add manufacturer-specific fixupsHaavard Skinnemoen
Run fixups based on the JEDEC manufacturer ID independent of the command set ID. This changes current behaviour: Previously, geometry reversal for AMD chips were done based on the command set ID, while they are now done based on the JEDEC manufacturer and device ID. Also add fixup for top-boot Atmel chips. A fixup is needed for AT49BV6416(T) too, but since u-boot currently only reads the low byte of the device ID, there's no way to tell it apart from AT49BV642D, which should not have this fixup. Since AT49BV642D support is necessary to get ATNGW100 board support into mainline, I've commented out the fixup for now. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-12-17cfi_flash: Add cmdset-specific init functionsHaavard Skinnemoen
Move things like reading JEDEC IDs and fixing up geometry reversal into separate functions. The geometry reversal fixup is now performed by altering the qry structure directly, which makes the sector init code slightly cleaner. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-12-17cfi_flash: Read whole QRY structure in one goHaavard Skinnemoen
Read out the whole CFI Standard Query structure after successful cfi identification. This allows subsequent code to access this information directly without having to go through flash_read_uchar() and friends. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-12-13cfi_flash: Use map_physmem() and unmap_physmem()Haavard Skinnemoen
Use map_physmem() and unmap_physmem() to convert from physical to virtual addresses. This gives the arch a chance to provide an uncached mapping for flash accesses. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-12-13cfi_flash: Introduce read and write accessorsHaavard Skinnemoen
Introduce flash_read{8,16,32,64) and flash_write{8,16,32,64} and use them to access the flash memory. This makes it clearer when the flash is actually being accessed; merely dereferencing a volatile pointer looks just like any other kind of access. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-12-13cfi_flash: Reorder functions and eliminate extra prototypesHaavard Skinnemoen
Reorder the functions in cfi_flash.c so that each function only uses functions that have been defined before it. This allows the static prototype declarations near the top to be eliminated and might allow gcc to do a better job inlining functions. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-12-13cfi_flash: Make some needlessly global functions staticHaavard Skinnemoen
Make functions not declared in any header file static. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-12-13cfi_flash: Break long linesHaavard Skinnemoen
This patch tries to keep all lines in the cfi_flash driver below 80 columns. There are a few lines left which don't fit this requirement because I couldn't find any trivial way to break them (i.e. it would take some restructuring, which I intend to do in a later patch.) Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
2007-12-13CFI: synchronize command offsets with Linux CFI driverBartlomiej Sieka
Fixes non-working CFI Flash on the Inka4x0 board. Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>
2007-12-08CFI: support JEDEC flash roms in CFI-flash frameworkMichael Schwingen
The following patch adds support for non-CFI flash ROMS, by hooking into the CFI flash code and using most of its code, as recently discussed here in the thread "Mixing CFI and non-CFI flashs". Signed-off-by: Michael Schwingen <michael@schwingen.org> Signed-off-by: Stefan Roese <sr@denx.de>
2007-11-25drivers/mtd : move mtd drivers to drivers/mtdJean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>