summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
Commit message (Collapse)AuthorAgeFilesLines
* cfi_flash driver - Add delay after reset commandAaron Williams2011-04-211-0/+7
| | | | | | | | | | | | | I ran into a problem where the reset was failing except when I enabled debugging support. After talking with Garret Swalling at Spansion I was told that the GL-N series of devices require a 500ns wait for the reset to complete. The below patch adds a 1us delay after all reset commands. -Aaron Williams Signed-off-by: Aaron Williams <aaron.williams@caviumnetworks.com> Signed-off-by: Stefan Roese <sr@denx.de>
* mtd, cfi: read AMD 3-byte (expanded) device ids on 16bit devicesHeiko Schocher2011-04-211-2/+11
| | | | | | | | | | | | | | | | | | | | | tested on the a4m072 board with a S29GL512P flash. flinfo without this patch Bank # 1: CFI conformant flash (16 x 16) Size: 32 MB in 256 Sectors AMD Standard command set, Manufacturer ID: 0x01, Device ID: 0x227E Erase timeout: 16384 ms, write timeout: 2 ms Buffer write timeout: 5 ms, buffer size: 32 bytes [...] flinfo with this patch Bank # 1: CFI conformant flash (16 x 16) Size: 32 MB in 256 Sectors AMD Standard command set, Manufacturer ID: 0x01, Device ID: 0x227E2301 Erase timeout: 16384 ms, write timeout: 2 ms Buffer write timeout: 5 ms, buffer size: 32 bytes [...] Signed-off-by: Heiko Schocher <hs@denx.de> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: reverse geometry for M29W800DT partsMike Frysinger2011-04-211-3/+4
| | | | | | | | | | | | | | | | | | | | | | The M29W800DT parts also report their geometry with the sector layout reversed. So add that ID to the flash_fixup_stm function. Otherwise, we get: bfin> flinfo Bank # 1: CFI conformant FLASH (16 x 16) Size: 1 MB in 19 Sectors AMD Standard command set, Manufacturer ID: 0x20, Device ID: 0x22D7 Erase timeout: 8192 ms, write timeout: 1 ms Sector Start Addresses: 20000000 20004000 20006000 20008000 20010000 20020000 20030000 20040000 20050000 20060000 20070000 20080000 20090000 200A0000 200B0000 200C0000 200D0000 200E0000 200F0000 Reported-by: Jianxi Fu <fujianxi@gmail.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Stefan Roese <sr@denx.de>
* NAND: rearrange ONFI revision checking, add ONFI 2.3Florian Fainelli2011-04-151-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch sync with Brian's patch on Linux in nand_flash_detect_onfi() commit b7b1a29d94c17e4341856381bccb4d17495bea60 Author: Brian Norris <computersforpeace@gmail.com> Date: Sun Dec 12 00:23:33 2010 -0800 mtd: nand: rearrange ONFI revision checking, add ONFI 2.3 In checking for the ONFI revision, the first conditional (for checking "unsupported" ONFI) seems unnecessary. All ONFI revisions should be backwards-compatible; even if this is not the case on some newer ONFI revision, it should simply fail the second version-checking if-else block (i.e., the bit-fields for 1.0, 2.0, etc. would not be set to 1). Thus, we move our "unsupported" condition after having checked each bit field. Also, it's simple enough to add a condition for ONFI revision 2.3. Note that this does *NOT* mean we handle all new features of ONFI versions above 1.0. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Florian Fainelli <ffainelli@freebox.fr> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Florian Fainelli <florian@openwrt.org>
* NAND: Fix integer overflow in ONFI detection of chips >= 4GiBFlorian Fainelli2011-04-151-1/+1
| | | | | | | | | | | | | | This patch sync with David's patch on Linux in nand_flash_detect_onfi() commit 4ccb3b4497ce01fab4933704fe21581e30fda1a5 Author: David Woodhouse <David.Woodhouse@intel.com> Date: Fri Dec 3 16:36:34 2010 +0000 mtd: nand: Fix integer overflow in ONFI detection of chips >= 4GiB Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Florian Fainelli <florian@openwrt.org>
* Merge branch 'sf' of git://git.denx.de/u-boot-blackfinWolfgang Denk2011-04-1310-75/+71
|\
| * sf: sst: add support for SST25VF064CJames Kosin2011-04-131-0/+4
| | | | | | | | | | Signed-off-by: James Kosin <jkosin@intcomgrp.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
| * sf: use print_size() for sector_size outputMike Frysinger2011-04-121-2/+2
| | | | | | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
| * sf: localize erase funcsMike Frysinger2011-04-128-9/+9
| | | | | | | | | | | | | | No need for these to be exported as they are only accessed indirectly via function pointers. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
| * sf: sst: setup read funcMike Frysinger2011-04-121-0/+1
| | | | | | | | | | | | The previous unification patch missed setting up the sst read func. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
| * sf: add struct spi_flash.sector_size parameterRichard Retanubun2011-04-1210-64/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a new member to struct spi_flash (u16 sector_size) and updates the spi flash drivers to start populating it. This parameter can be used by spi flash commands that need to round up units of operation to the flash's sector_size. Having this number in one place also allows duplicated code to be further collapsed into one common location (such as erase parameter and the detected message). Signed-off-by: Richard Retanubun <RichardRetanubun@RuggedCom.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
| * sf: atmel: undo unification of status pollingMike Frysinger2011-04-111-2/+29
| | | | | | | | | | | | | | | | The AT45 flashes are completely different (at the command set and status register level) from all other SPI flashes, so we can't unify their logic with common code. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* | cfi_flash: Fix CONFIG_SYS_FLASH_AUTOPROTECT_LIST usagePeter Tyser2011-04-131-6/+8
|/ | | | | | | | | | | | | | | | | | | | | Commit 6ee1416e8184b4d9ebe6087d396a60bcecf3551c (mtd, cfi: introduce void flash_protect_default(void)) introduced a bug which resulted in boards that define CONFIG_SYS_FLASH_AUTOPROTECT_LIST not compiling with the the following errors and warning: ptyser@petert u-boot $ make -s xpedite520x Configuring for xpedite520x board... cfi_flash.c: In function 'flash_protect_default': cfi_flash.c:2118: error: 'i' undeclared (first use in this function) cfi_flash.c:2118: error: (Each undeclared identifier is reported only once cfi_flash.c:2118: error: for each function it appears in.) cfi_flash.c:2118: error: 'apl' undeclared (first use in this function) cfi_flash.c:2118: error: invalid application of 'sizeof' to incomplete type 'struct apl_s' cfi_flash.c: In function 'flash_init': cfi_flash.c:2137: warning: unused variable 'apl' Signed-off-by: Peter Tyser <ptyser@xes-inc.com> Reported-by: Kumar Gala <galak@kernel.crashing.org> Cc: Heiko Schocher <hs@denx.de>
* sf: unify read functionsMike Frysinger2011-04-119-157/+22
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* sf: unify erase functionsMike Frysinger2011-04-118-335/+83
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* sf: unify status polling for ready bitMike Frysinger2011-04-119-283/+81
| | | | | | | | All of the spi flash drivers implement the status register polling for detecting the device ready state, so unify them all in a new helper function -- spi_flash_wait_ready. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* sf: unify read/write helpersMike Frysinger2011-04-111-48/+19
| | | | | | | These functions largely do the same exact thing, so unify them all into one basic function. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* mtd, cfi: introduce void flash_protect_default(void)Heiko Schocher2011-04-071-36/+41
| | | | | | | | collect code which protects default sectors in a function, called flash_protect_default. So boardspecific code can call it too. Signed-off-by: Heiko Schocher <hs@denx.de> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: use AMD fixups for AMIC (e.g. A29L160A series) tooMario Schuknecht2011-04-071-1/+2
| | | | | | Signed-off-by: Mario Schuknecht <m.schuknecht@dresearch.de> Signed-off-by: Steffen Sledz <sledz@dresearch.de> Signed-off-by: Stefan Roese <sr@denx.de>
* atmel_nand: don't require CONFIG_SYS_NAND_ENABLE_PINmichael2011-04-011-0/+2
| | | | | | | | | | | | If NCE is hooked up to NCS3, we don't need to (and can't) explicitly set the state of the NCE pin. Instead, the controller asserts it automatically as part of a command/data access. Only "CE don't care"-type NAND chips can be used in this manner. Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com> Cc: Scott Wood <scottwood@freescale.com> Cc: Reinhard Meyer <u-boot@emk-elektronik.de>
* NAND: add support for reading ONFI page tableFlorian Fainelli2011-04-011-49/+144
| | | | | | | | | | | | This patch adds support for reading an ONFI page parameter from a NAND device supporting it. If this is the case, struct nand_chip onfi_version member contains the supported ONFI version, 0 otherwise. This allows NAND drivers past nand_scan_ident to set the best timings for the NAND chip. Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: Scott Wood <scottwood@freescale.com>
* NAND: add more watchdog resetsScott Wood2011-04-012-0/+8
| | | | | | | Poke the watchdog in a variety of looping constructs, which could take a long time to complete. Signed-off-by: Scott Wood <scottwood@freescale.com>
* cfi_flash: fix bug with flash banks with different sector numbersMartin Krause2011-03-281-0/+5
| | | | | | | | | | | | | | | The function find_sector() does not take into account if the flash bank has changed since the last call. This could lead to illegal accesses inside and beyond the flash_info_t info strcture. For example if the current flash bank has less sectors than the last used flash bank. This patch adds two cheks. One that insures, that the current sector does not exceed the allowed maximum (which is always a good idea). And one that checks if the current access is to the same flash bank as the last access. If not, the search loop will start with sector 0. Signed-off-by: Martin Krause <martin.krause@tqs.de> Signed-off-by: Stefan Roese <sr@denx.de>
* Minor Coding Style Cleanup.Wolfgang Denk2011-02-021-19/+19
| | | | Signed-off-by: Wolfgang Denk <wd@denx.de>
* mxc_nand: add support for i.MX35 processorStefano Babic2011-02-021-3/+3
| | | | | Signed-off-by: Stefano Babic <sbabic@denx.de> Acked-by: Scott Wood <scottwood@freescale.com>
* Replace "FLASH" strings with "Flash" or "flash"Peter Tyser2011-01-191-2/+2
| | | | | | | | There's no compelling reason to have the output on bootup or the "flinfo" command print "flash" in uppercase, so use the proper case where appropriate. Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
* mtd: nand: Allow caller to pass alternative ID table to nand_scan_ident()Lei Wen2011-01-122-15/+16
| | | | | | | | | | | | | | This patch sync with David's patch on Linux for handling nand_scan_ident. commit 5e81e88a4c140586d9212999cea683bcd66a15c6 Author: David Woodhouse <David.Woodhouse@intel.com> Date: Fri Feb 26 18:32:56 2010 +0000 mtd: nand: Allow caller to pass alternative ID table to nand_scan_ident() Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Lei Wen <leiwen@marvell.com>
* NAND: add the ability to directly write yaffs imageLei Wen2011-01-121-8/+55
| | | | | | | This patch add addition suffix to nand write to give the uboot the power to directly burn the yaffs image to nand. Signed-off-by: Lei Wen <leiwen@marvell.com>
* nand: fix bug with multiple NAND devices if CONFIG_MTD_DEVICE is defined.Alexander Holler2011-01-121-1/+1
| | | | | | The variable i has to be static, otherwise it would be always zero. Signed-off-by: Alexander Holler <holler@ahsoftware.de>
* add AM29F400BB to table of supported legacy flashsDavid Müller2011-01-111-0/+18
| | | | | Signed-off-by: David Mueller <d.mueller@elsoft.ch> Signed-off-by: Stefan Roese <sr@denx.de>
* cfi_flash: avoid flash_verbose when possibleMike Frysinger2011-01-091-0/+6
| | | | | | | The flash_verbose logic is only used by the CFI MTD layer, so if we aren't using that, disable the logic completely. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* MTD/NAND: fix nand_base.c to use get_timer() correctlyReinhard Meyer2010-12-171-6/+9
| | | | | | | | | This is part of the timer cleanup effort. In the future we only use get_timer() in its intended way to program timeout loops. reset_timer() shall not be used anymore. Signed-off-by: Reinhard Meyer <u-boot@emk-elektronik.de>
* nand: constify id/manu tablesMike Frysinger2010-12-172-5/+5
| | | | | | These id tables need not be writable. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Merge branch 'next' of git://www.denx.de/git/u-boot-cfi-flash into nextWolfgang Denk2010-12-171-3/+58
|\
| * cfi_flash: Add optional config register write to cfi-detectionStefan Roese2010-12-171-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds the possibility to (optinally) write to the flash configuration register. The Intel style CFI chips support such a register that can be used to configure the operation mode to a non-default value. This method will be used by the t3corp board, which needs to configure the DS617 Xilinx flash for async read mode. Signed-off-by: Stefan Roese <sr@denx.de>
| * cfi_flash: Use flash_read32() in sector_erased()Stefan Roese2010-12-171-3/+3
| | | | | | | | | | | | | | | | | | | | The function sector_erased() is modified to not use pointer access, but to use the correct accessor functions. This fixes a problem on the t3corp board with the Xilinx DS617 flash chips. Here a board specific accessor function is needed to read from flash in 32bit mode. This patch enables such an operation mode. Signed-off-by: Stefan Roese <sr@denx.de>
| * cfi_flash: Fix problems with status/id read modeStefan Roese2010-12-171-0/+12
| | | | | | | | | | | | | | | | | | This patch adds some calls to set the flash chip in the read-status- register- or read-id-mode before the corresponding register is read back. This problem was detected while porting the common CFI driver to support the Xilinx DS617 flash chips. Signed-off-by: Stefan Roese <sr@denx.de>
* | sf: winbond: add support for W25Q16/32/128 partsWojtek Skulski2010-12-171-10/+29
| | | | | | | | | | | | | | While we're here, cut out the useless id defines too. Signed-off-by: Wojtek Skulski <skulski@pas.rochester.edu> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* | sf: new driver for EON devicesChong Huang2010-12-174-0/+280
|/ | | | | | Signed-off-by: Chong Huang <chuang@ucrobotics.com> Signed-off-by: Haitao Zhang <minipanda@linuxrobot.org> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* fsl_upm: Add MxMR/MDR synchronizationJohn Schmoller2010-12-131-0/+2
| | | | | | | | | | | | | | | | | According to Freescale reference manuals (eg section "13.4.4.2 Programming the UPMs" of the P4080 Reference Manual): "Since the result of any update to the MxMR/MDR register must be in effect before the dummy read or write to the UPM region, a write to MxMR/MDR should be followed immediately by a read of MxMR/MDR." The UPM on a custom P4080-based board did not work without performing a read of MxMR/MDR after a write. Signed-off-by: John Schmoller <jschmoller@xes-inc.com> Signed-off-by: Peter Tyser <ptyser@xes-inc.com> Acked-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* fix s3c2410_nand timing default valuesDavid Müller (ELSOFT AG)2010-12-061-3/+9
| | | | | | | The attached patch fixes wrong timing default values and adds the possibility to specify board specific timing value in the board config file. Signed-off-by: David Mueller <d.mueller@elsoft.ch>
* cfi_flash: fix bug introduced while recent change to flash_get_size()Anatolij Gustschin2010-11-281-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit ec50a8e389863ac35bfd9d9a2e8b30187318e59e "cfi_flash: handle 'chip size exceeds address window' situation" added 3rd argument to flash_get_size() but didn't fix all the function calls from the board specific code. Many boards have their own flash_get_size() definitions in the board code and use them there, but some boards (e.g. tqm834x, tqm85xx, pdm360ng) use flash_get_size() from the cfi_flash.c driver. The bug shows up if the value of the "max_size" argument (which is not defined when calling the function with two arguments) happens to be less than "info->size". In this case on the affected boards we end up with a bank of reduced size and in the worst case might even be not able to update U-Boot or to boot the kernel from flash: => fli Bank # 1: CFI conformant FLASH (32 x 16) Size: 0 kB in 1 Sectors AMD Standard command set, Manufacturer ID: 0x01, Device ID: 0x227E Erase timeout: 4096 ms, write timeout: 1 ms Buffer write timeout: 3 ms, buffer size: 64 bytes Sector Start Addresses: F0000000 RO Bank # 2: CFI conformant FLASH (32 x 16) Size: 128 MB in 512 Sectors AMD Standard command set, Manufacturer ID: 0x01, Device ID: 0x227E Erase timeout: 4096 ms, write timeout: 1 ms Buffer write timeout: 3 ms, buffer size: 64 bytes Sector Start Addresses: F8000000 F8040000 F8080000 F80C0000 F8100000 F8140000 F8180000 F81C0000 F8200000 F8240000 ... E.g., updating U-Boot is not possible now: => protect off ${u-boot_addr} +${u-boot_size} Error: end address (0xf007ffff) not in flash! Bad address format => era ${u-boot_addr} +${u-boot_size} Error: end address (0xf007ffff) not in flash! Bad address format This patch removes the 3rd argument of flash_get_size() again and sets "max_size" in the function itself instead of passing it as a function argument. Signed-off-by: Anatolij Gustschin <agust@denx.de>
* ppc4xx/NAND: Reduce size of NAND SPL imageStefan Roese2010-11-271-2/+2
| | | | | | | | | | This is needed for the canyonlands_nand build target. Without it the resulting image won't fit into 4k. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Scott Wood <scottwood@freescale.com> Acked-by: Scott Wood <scottwood@freescale.com> Acked-by: Stefan Roese <sr@denx.de>
* Switch from archive libraries to partial linkingSebastien Carlier2010-11-175-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, weak symbols were not overridden by non-weak symbols found in archive libraries when linking with recent versions of binutils. As stated in the System V ABI, "the link editor does not extract archive members to resolve undefined weak symbols". This commit changes all Makefiles to use partial linking (ld -r) instead of creating library archives, which forces all symbols to participate in linking, allowing non-weak symbols to override weak symbols as intended. This approach is also used by Linux, from which the gmake function cmd_link_o_target (defined in config.mk and used in all Makefiles) is inspired. The name of each former library archive is preserved except for extensions which change from ".a" to ".o". This commit updates references accordingly where needed, in particular in some linker scripts. This commit reveals board configurations that exclude some features but include source files that depend these disabled features in the build, resulting in undefined symbols. Known such cases include: - disabling CMD_NET but not CMD_NFS; - enabling CONFIG_OF_LIBFDT but not CONFIG_QE. Signed-off-by: Sebastien Carlier <sebastien.carlier@gmail.com>
* sf: ramtron: new spi fram driverReinhard Meyer2010-11-104-0/+329
| | | | | | | Supports most types that support Read-Id and the FM25H20. Signed-off-by: Reinhard Meyer <u-boot@emk-elektronik.de> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Merge branch 'master' of git://git.denx.de/u-boot-samsungWolfgang Denk2010-10-291-12/+13
|\
| * Add generic support for samsung s3c2440C Nauman2010-10-281-12/+13
| | | | | | | | | | | | | | | | | | | | | | This patch adds generic support for the Samsung s3c2440 processor. Global s3c24x0 changes to struct members converting from upper case to lower case. Signed-off-by: Craig Nauman <cnauman@diagraph.com> Cc: kevin.morfitt@fearnside-systems.co.uk Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
* | Replace CONFIG_RELOC_FIXUP_WORKS by CONFIG_NEEDS_MANUAL_RELOCWolfgang Denk2010-10-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | By now, the majority of architectures have working relocation support, so the few remaining architectures have become exceptions. To make this more obvious, we make working relocation now the default case, and flag the remaining cases with CONFIG_NEEDS_MANUAL_RELOC. Signed-off-by: Wolfgang Denk <wd@denx.de> Tested-by: Heiko Schocher <hs@denx.de> Tested-by: Reinhard Meyer <u-boot@emk-elektronik.de>
* | cfi_flash: handle 'chip size exceeds address window' situationIlya Yanok2010-10-231-5/+23
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | On some boards we have flash mapped high in the address space with considerably small window (say 0xFE000000 and 32MB). When we install bigger chip (say 64MB) on such a board strange things happen (flash_write() doesn't work at all, for ex). That's because cfi_flash driver doesn't care about window size at all. Of course, cleanest solution would probably be to just extend address window to be able to map the whole flash but for legacy/compatibility reasons some people prefer just truncate the flash size and never use the upper part. This patch adds an option for cfi_flash driver to handle this situation properly. To achieve this we add the new function cfi_flash_bank_size() which can be provided by the board code and weak-aliased to default implementation that returns value from the CONFIG_SYS_FLASH_BANKS_SIZES array if it's defined or 0 otherwise (the last case is added for compatibility). If non-zero flash bank size is provided and detected chip size is bigger than provided address window size the warning will be displayed and flash chip will be truncated. Signed-off-by: Ilya Yanok <yanok@emcraft.com> Changed cfi_flash_bank_size() return type to unsigned long to match caller function. Signed-off-by: Wolfgang Denk <wd@denx.de>
* davinci_nand, trivial : use symbolic ECC start commandBen Gardiner2010-10-171-1/+2
| | | | | | | | | | | The ECC calculations were started by writing 1 << 13 to the nand FCR register; that value is also defined as DAVINCI_NANDFCR_4BIT_CALC_START in emif_defs.h. This patch substitutes the macro DAVINCI_NANDFCR_4BIT_CALC_START for the magic number '1 << 13'. Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca> Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
OpenPOWER on IntegriCloud