summaryrefslogtreecommitdiff
path: root/drivers/mtd
Commit message (Collapse)AuthorAgeLines
* cfi-flash: Fix problem in flash_toggle(), busy was not detected reliablyStefan Roese2008-06-19-8/+4
| | | | | | | | | | | | | This patch simplifies flash_toggle() (AMD commandset), which is used to detect if a FLASH device is still busy with erase/program operations. On 800MHz Canyonlands/Glacier boards (460EX/GT) the current implementation did not detect the busy state reliably, resulting in non erased sectors etc. This patch now simplifies this function by "just" comparing the complete data-word instead of ANDing it with the command-word (0x40) before the compatison. It is done the same way in the Linux implementation chip_ready() in cfi_cmdset_0002.c. Signed-off-by: Stefan Roese <sr@denx.de>
* Merge branch 'master' of git://www.denx.de/git/u-boot-cfi-flashWolfgang Denk2008-06-11-7/+34
|\
| * cfi_flash: enable M18 flash chips family support.Vasiliy Leoenenko2008-06-03-2/+21
| | | | | | | | | | | | | | | | Added new command set ID. Buffered write command processing is changed in order to support M18 flash chips family. Signed-off-by: Alexey Korolev <akorolev@infradead.org> Signed-off-by: Vasiliy Leonenko <vasiliy.leonenko@mail.ru>
| * cfi_flash: support of long cmd in U-boot.Vasiliy Leoenenko2008-06-03-7/+15
| | | | | | | | | | | | | | | | | | Some NOR flash chips needs support of commands with length grether than max value size of uchar. For example all M18 family chips use 0x1ff command in buffered write mode as value of program loops count. Signed-off-by: Alexey Korolev <akorolev@infradead.org> Signed-off-by: Vasiliy Leonenko <vasiliy.leonenko@mail.ru>
* | NAND: Added support for 128-bit OOB, adaptedSergei Poselenov2008-06-11-13/+33
| | | | | | | | Signed-off-by: Sergei Poselenov <sposelenov@emcraft.com>
* | NAND FSL UPM: driver re-write using the hwcontrol callbackWolfgang Grandegger2008-06-10-82/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a re-write of the NAND FSL UPM driver using the more universal hwcontrol callback (instead of the cmdfunc callback). Here is a brief list of furher modifications: - For the time being, the UPM setup writing the UPM array has been removed from the driver and must now be done by the board specific code. - The bus width definition in "struct fsl_upm_nand" is now in bits to comply with the corresponding Linux driver and 8, 16 and 32 bit accesses are supported. - chip->dev_read is only set if fun->dev_ready != NULL, which is required for boards not connecting the R/B pin. - A few issue have been fixed with MxMR bit manipulation like in the corresponding Linux driver. Note: I think the "io_addr" field of "struct fsl_upm" could be removed as well, because the address is already determined by "nand->IO_ADDR_[RW]", but I'm not 100% sure. This patch has been tested on a TQM8548 modules with the NAND chip Micron MT29F8G08FABWP. This patch is based on the following patches posted to this list a few minutes ago: PPC: add accessor macros to clear and set bits in one shot 83xx/85xx/86xx: add more MxMR local bus definitions Signed-off-by: Wolfgang Grandegger <wg@grandegger.com> Acked-by: Anton Vorontsov <avorontsov@ru.mvista.com>
* | SPI Flash subsystemHaavard Skinnemoen2008-06-03-0/+616
| | | | | | | | | | | | | | | | | | | | This adds a new SPI flash subsystem. Currently, only AT45 DataFlash in non-power-of-two mode is supported, but some preliminary support for other flash types is in place as well. Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
* | Fix warnings from gcc-4.3.0 build on a ppc hostKumar Gala2008-06-03-0/+2
| | | | | | | | | | | | | | | | | | | | | | * The cfi_flash.c memset fix actual allows the board to boot so there is a bit more going on here than just resolving warnings associated with uninitialized variables. * include/asm/bitops.h:302: warning: '__swab32p' is static but used in inline function 'ext2_find_next_zero_bit' which is not static Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* | nand: Correct NAND erase percentage outputDirk Behme2008-05-28-0/+7
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | For NAND erase sizes smaller than one NAND erase block, erase percentage output becomes grater than 100% e.g. -- cut -- > nand info Device 0: NAND 64MiB 1,8V 8-bit, sector size 16 KiB > nand erase 0x100000 0x2000 NAND erase: device 0 offset 0x100000, size 0x2000 Erasing at 0x100000 -- 200% complete. OK > -- cut -- Correct this and give user a warning that more is erased than specified: -- cut -- > nand erase 0x100000 0x2000 NAND erase: device 0 offset 0x100000, size 0x2000 Warning: Erase size 0x00002000 smaller than one erase block 0x00004000 Erasing 0x00004000 instead Erasing at 0x100000 -- 100% complete. OK > -- cut -- Signed-off-by: Dirk Behme <dirk.behme@gmail.com>
* Big white-space cleanup.Wolfgang Denk2008-05-21-113/+113
| | | | | | | | | | | This commit gets rid of a huge amount of silly white-space issues. Especially, all sequences of SPACEs followed by TAB characters get removed (unless they appear in print statements). Also remove all embedded "vim:" and "vi:" statements which hide indentation problems. Signed-off-by: Wolfgang Denk <wd@denx.de>
* onenand: rename 16 bit memory copy into memcpy_16() to avoid conflictsWolfgang Denk2008-05-01-4/+4
| | | | | | | | Onenand needs a version of memcpy() which performs 16 bit accesses only; make sure the name does not conflict with the standard function. Signed-off-by: Wolfgang Denk <wd@denx.de>
* cfi-flash: Add CFG_FLASH_AUTOPROTECT_LISTMatthias Fuchs2008-04-25-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* PATCH - Fix oob data copied into supplied bufferTroy Kisky2008-04-21-9/+8
| | | | | | | | | | | | | This patch correctly sets the oobavail variable and fixes a bug where the oob data was not valid when there where multiple groups in oobfree. First segment fixes a typo Second segment fixes a bug where oob data may be copied incorrectly. Third segment adds an error message when exiting due to write protect. Forth segment fixes a bug where oobavail may be set incorrectly. Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
* Clean up dataflash partitioningUlf Samuelsson2008-04-18-42/+3
| | | | | | | | | | | | | | | This patch removes the board dependent parts from "drivers/mtd/dataflash.c". Each board relying on this, will have the appropriate code in a new file, "partition.c" in the board directory. board Makefiles updated to use the file. The dataflash partitions are aligned on sector/page boundaries. The CONFIG_NEW_DF_PARTITION was used to create named partitions This is now the default operation, and the CONFIG variable is removed. Signed-off-by: Ulf Samuelsson <ulf@atmel.com>
* Remove conflicting NAND IDMike Frysinger2008-04-17-2/+0
| | | | | | | | | | | There are two NAND entries with ID 0xDC and this obviously causes problems. In the kernel, they punted the first entry, so we should do the same. See this upstream e-mail for more info: http://lists.infradead.org/pipermail/linux-mtd/2007-July/018795.html Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Fix OneNAND readKyungmin Park2008-04-13-0/+13
| | | | | | | | It should access with 16-bit instead of 8-bit Now it uses the generic memcpy with 8-bit access. It means it reads wrong data from OneNAND. Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
* cfi_flash: Support buffered writes on non-standard Spansion NOR flashGuennadi Liakhovetski2008-04-12-30/+16
| | | | | | | | | | | 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>
* Merge branch 'master' of git://www.denx.de/git/u-boot-at91Wolfgang Denk2008-04-08-64/+27
|\
| * dataflash: Move CONFIG_HAS_DATAFLASH to MakefileJean-Christophe PLAGNIOL-VILLARD2008-04-01-7/+4
| | | | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
| * Cleanup DataFlash partition handlingStelian Pop2008-04-01-57/+23
| | | | | | | | | | | | | | | | DataFlash partition information has become a mess. This patch defines a single partition scheme for Atmel DataFlashes. This partition scheme will be used by all AT91CAP9 and AT91SAM9 boards. Signed-off-by: Stelian Pop <stelian@popies.net>
* | MTD/CFI: flash_read64 is defined a weak function (for SPARC)Daniel Hellstrom2008-03-29-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | MTD/CFI: Add support for 16bit legacy AMD flashTor Krill2008-03-28-9/+54
|/ | | | | | | | 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>
* Add Flex-OneNAND booting supportKyungmin Park2008-03-26-0/+6
| | | | | | | | | | | | | | | | Flex-OneNAND is a monolithic integrated circuit with a NAND Flash array using a NOR Flash interface. This on-chip integration enables system designers to reduce external system logic and use high-density NAND Flash in applications that would otherwise have to use more NOR components. Flex-OneNAND enables users to configure to partition it into SLC and MLC areas in more flexible way. While MLC area of Flex-OneNAND can be used to store data that require low reliability and high density, SLC area of Flex-OneNAND to store data that need high reliability and high performance. Flex-OneNAND can let users take advantage of storing these two different types of data into one chip, which is making Flex-OneNAND more cost- and space-effective. Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
* CFI: Small cleanup for FLASH_SHOW_PROGRESSStefan Roese2008-03-19-13/+9
| | | | | | | | | 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>
* Flash programming progress countdown.Jerry Van Baren2008-03-19-1/+43
| | | | Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
* CFI: Do not use uninitialized cmd_resetMichael Schwingen2008-02-21-1/+6
| | | | | | | | | | | | | | | | | | | | 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>
* AT91CAP9 support : build integrationStelian Pop2008-02-14-2/+3
| | | | Signed-off-by: Stelian Pop <stelian@popies.net>
* Improve DataFlash CS definition.Stelian Pop2008-02-14-13/+18
| | | | | | | Use a structure instead of the error prone unnamed array to define the possible dataflash banks. Signed-off-by: Stelian Pop <stelian@popies.net>
* Remove duplicate defines for ARRAY_SIZEKumar Gala2008-02-14-4/+0
| | | | Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* Fix incorrect address test in AT91F_DataflashSelect().Stelian Pop2008-02-14-1/+1
| | | | Signed-off-by: Stelian Pop <stelian@popies.net>
* nand: FSL UPM NAND driverAnton Vorontsov2008-01-16-0/+203
| | | | Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
* OneNAND: Separate U-Boot dependent code from OneNANDKyungmin Park2008-01-16-21/+42
| | | | | | OneNAND: Separate U-Boot dependent code from OneNAND Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
* CFI: Fix CONFIG_FLASH_CFI_LEGACY compilationMichael Schwingen2008-01-13-2/+2
| | | | | Signed-off-by: Michael Schwingen <michael@schwingen.org> Acked-by: Stefan Roese <sr@denx.de>
* fix comments with new drivers organizationMarcel Ziswiler2008-01-09-1/+1
| | | | Signed-off-by: Marcel Ziswiler <marcel@ziswiler.com>
* cfi_flash: Fix bug in flash_isset() to use correct 32bit functionStefan Roese2008-01-02-1/+1
| | | | | | | 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>
* cfi_flash: Add missing check for erased dest to flash_write_cfibuffer()Stefan Roese2007-12-27-1/+51
| | | | | | | | | 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>
* cfi_flash: Add manufacturer-specific fixupsHaavard Skinnemoen2007-12-17-14/+53
| | | | | | | | | | | | | | | | | | 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>
* cfi_flash: Add cmdset-specific init functionsHaavard Skinnemoen2007-12-17-63/+111
| | | | | | | | | 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>
* cfi_flash: Read whole QRY structure in one goHaavard Skinnemoen2007-12-17-86/+90
| | | | | | | | 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>
* cfi_flash: Use map_physmem() and unmap_physmem()Haavard Skinnemoen2007-12-13-60/+109
| | | | | | | | 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>
* cfi_flash: Introduce read and write accessorsHaavard Skinnemoen2007-12-13-78/+127
| | | | | | | | | 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>
* cfi_flash: Reorder functions and eliminate extra prototypesHaavard Skinnemoen2007-12-13-687/+656
| | | | | | | | | 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>
* cfi_flash: Make some needlessly global functions staticHaavard Skinnemoen2007-12-13-7/+9
| | | | | | Make functions not declared in any header file static. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
* cfi_flash: Break long linesHaavard Skinnemoen2007-12-13-115/+189
| | | | | | | | | 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>
* CFI: synchronize command offsets with Linux CFI driverBartlomiej Sieka2007-12-13-3/+20
| | | | | | Fixes non-working CFI Flash on the Inka4x0 board. Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>
* CFI: Coding style cleanupStefan Roese2007-12-08-5/+4
| | | | Signed-off-by: Stefan Roese <sr@denx.de>
* CFI: support JEDEC flash roms in CFI-flash frameworkMichael Schwingen2007-12-08-12/+411
| | | | | | | | | 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>
* drivers/mtd : move mtd drivers to drivers/mtdJean-Christophe PLAGNIOL-VILLARD2007-11-25-0/+12989
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>