summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' of git://git.denx.de/u-boot-spiTom Rini2016-01-071-2/+2
|\
| * spi: spi_flash: Fix the arguments of stm_is_locked_sr()Fabio Estevam2016-01-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | stm_is_locked_sr() takes the status register (SR) value as the last parameter, not the second. Based on a patch from Brian Norris for the linux kernel: http://git.infradead.org/linux-mtd.git/commit/a32d5b726ff8cf32bf491522b0ac8ae2545a063e Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Reviewed-by: Jagan Teki <jteki@openedev.com>
* | UBI: Fix compile error when CONFIG_UBI_SILENCE_MSG definedLadislav Michl2016-01-041-1/+0
| | | | | | | | | | | | | | | | drivers/mtd/ubi/io.c:1354:3: error: 'dump_len' undeclared (first use in this function) dump_len = max_t(int, 128, len - i); Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
* | altera_qspi: allow ctrl-c to abort the erase opsThomas Chou2015-12-281-0/+9
| | | | | | | | | | | | Allow ctrl-c to abort the erase ops. Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
* | altera_qspi: show erase progressThomas Chou2015-12-281-0/+14
| | | | | | | | | | | | Show sector erase progress with dot and comma. Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
* | altera_qspi: skip erase if the sector is blankThomas Chou2015-12-281-14/+25
| | | | | | | | | | | | | | Skip erase if the sector is blank. The sector erase is slow, and may take 0.7 sec typically or up to 3 sec worst-case. Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
* | altera_qspi: set fail_addr for erase opsThomas Chou2015-12-281-0/+1
| | | | | | | | | | | | | | | | If the erase fails, fail_addr might indicate exactly which block failed. If fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not at the device level or was not specific to any particular block. Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
* | altera_qspi: call callback even if the erase failedThomas Chou2015-12-281-0/+1
|/ | | | | | | | Erase is an asynchronous operation. Device drivers are supposed to call instr->callback() whenever the operation completes, even if it completes with a failure. Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
* altera_qspi: initialize instr.mtd in flash_eraseThomas Chou2015-12-191-0/+1
| | | | | | | | Initialize instr.mtd in flash_erase(). This fixes the system hang issue when CONFIG_MTD_PARTITIONS is selected. Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Acked-by: Marek Vasut <marex@denx.de>
* sf: Rename sf_ops.c to spi-flash.cJagan Teki2015-12-112-4/+5
| | | | | | | | | Since all spi-flash core operations are moved into sf_ops.c then it's better to renamed as spi-flash.c Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Jagan Teki <jteki@openedev.com>
* sf: Use static for file-scope functionsJagan Teki2015-12-111-5/+5
| | | | | | | | Used static for file-scope functions in sf_probe.c Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Jagan Teki <jteki@openedev.com>
* sf: sf_probe: Remove spi_slave pointer argumentJagan Teki2015-12-113-9/+10
| | | | | | | | | | | | | | Since spi_slave is a spi pointer in spi_flash{} then assign spi_slave{} pointer to flash->spi and remove spi_slave pointer argument to - spi_flash_probe_slave - spi_flash_scan Tested-by: Jagan Teki <jteki@openedev.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Jagan Teki <jteki@openedev.com>
* sf: ops: Fix missing break on spansion read_barJagan Teki2015-12-111-0/+1
| | | | | | | | For assigning read_bar commands in spansion case, break is missing this patch add that break. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Jagan Teki <jteki@openedev.com>
* sf: Remove unneeded SST_BP and SST_WPJagan Teki2015-12-111-5/+2
| | | | | | | | | | | | SST parts added on sf_params.c supports both SST_WR which consits of both BP and WP and there is a spi controller ich which supports only BP so the relevent _write hook set based on "slave->op_mode_tx" hence there is no respective change required from flash side hance removed these. Tested-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Signed-off-by: Jagan Teki <jteki@openedev.com>
* sf: Remove unneeded header includesJagan Teki2015-12-112-5/+0
| | | | | | | | Removed unneeded header includes in sf_ops and sf_probe Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Jagan Teki <jteki@openedev.com>
* sf: Flash power up read-only based on idcode0Jagan Teki2015-12-112-4/+4
| | | | | | | | | | | | Using macro's for flash power up read-only access code leads wrong behaviour hence use idcode0 for runtime detection, hence the flash which require this functionality gets detected at runtime. Tested-by: Jagan Teki <jteki@openedev.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Jagan Teki <jteki@openedev.com>
* sf: Use simple name for register access functionsJagan Teki2015-12-111-26/+26
| | | | | | | | | | Most of the register access function are static, so used simple name to represent each. Tested-by: Jagan Teki <jteki@openedev.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Jagan Teki <jteki@openedev.com>
* sf: Fix MakefileJagan Teki2015-12-111-5/+1
| | | | | | | | This patch removes unneeded ifdef and fixed accordingly. Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Jagan Teki <jteki@openedev.com>
* sf: Use static for file-scope functionsJagan Teki2015-12-112-23/+6
| | | | | | | | | Use static for file-scope functions and removed them from header files. Tested-by: Jagan Teki <jteki@openedev.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Signed-off-by: Jagan Teki <jteki@openedev.com>
* sf: probe: Code cleanupJagan Teki2015-12-111-41/+39
| | | | | | | | | | | | - Move bar read code below the bar write hance both at once place, hence it easy for #ifdef macro only once and readable. - Move read_cmd_array at top Tested-by: Jagan Teki <jteki@openedev.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Jagan Teki <jteki@openedev.com>
* sf: Move read_id code to sf_opsJagan Teki2015-12-113-19/+20
| | | | | | | | | | | read_id code is related to spi_flash stuff hence moved to sf_ops. Tested-by: Jagan Teki <jteki@openedev.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Jagan Teki <jteki@openedev.com>
* sf: Move spi_flash_scan code to sf_opsJagan Teki2015-12-113-342/+357
| | | | | | | | | | | | | | | Intension is that sf_ops should deals all spi_flash related stuff and sf_probe (which should renamed future) should be an interface layer for spi_flash versus spi drivers. sf_ops => spi_flash interface sf_probe => interface layer vs spi_flash(sf_probe) to spi drivers Tested-by: Jagan Teki <jteki@openedev.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Jagan Teki <jteki@openedev.com>
* sf: spi_flash_validate_params => spi_flash_scanJagan Teki2015-12-111-71/+76
| | | | | | | | | | | | | | | Rename spi_flash_validate_params to spi_flash_scan as this code not only deals with params setup but also configure all spi_flash attributes. And also moved all flash related code into spi_flash_scan for future functionality addition. Tested-by: Jagan Teki <jteki@openedev.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Jagan Teki <jteki@openedev.com>
* Merge git://git.denx.de/u-boot-niosTom Rini2015-12-061-2/+97
|\
| * altera_qspi: fix erase and write error codeThomas Chou2015-12-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix erase and write error code, which should be "protected". From the "Embedded Peripherals IP User Guide" of Altera, The "Illegal write" flag indicates that a write instruction is targeting a protected sector on the flash memory. This bit is set to indicate that the IP has cancelled a write instruction. The "Illegal erase" flag indicates that an erase instruction has been set to a protected sector on the flash memory. This bit is set to indicate that the IP has cancelled the erase instruction. Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Acked-by: Chin Liang See <clsee@altera.com> Reviewed-by: Marek Vasut <marex@denx.de>
| * altera_qspi: add lock unlock opsThomas Chou2015-12-061-0/+95
| | | | | | | | | | | | | | | | Add lock() and unlock() mtd ops to altera_qspi. Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Acked-by: Chin Liang See <clsee@altera.com> Reviewed-by: Marek Vasut <marex@denx.de>
* | Fix typo: firstly -> first.Vagrant Cascadian2015-12-051-1/+1
|/ | | | | Signed-off-by: Vagrant Cascadian <vagrant@debian.org> Acked-by: Marek Vasut <marex@denx.de>
* Move console definitions into a new console.h fileSimon Glass2015-11-192-0/+2
| | | | | | | | The console includes a global variable and several functions that are only used by a small subset of U-Boot files. Before adding more functions, move the definitions into their own header file. Signed-off-by: Simon Glass <sjg@chromium.org>
* Merge branch 'master' of git://git.denx.de/u-boot-spiTom Rini2015-11-195-121/+18
|\
| * sf: Correct flash->flags for SST flashBin Meng2015-11-181-4/+5
| | | | | | | | | | | | | | | | flash->flags for SST flash should be updated for both DM and non-DM flash drivers. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Jagan Teki <jteki@openedev.com>
| * spi: sf_ops: Check the return value from spi_flash_cmd_read_status()Fabio Estevam2015-11-181-2/+8
| | | | | | | | | | | | | | | | | | | | | | We should check the return value from spi_flash_cmd_read_status() and propagate it in the case of error. This fixes a defect caught by Coverity. Reported-by: Tom Rini <trini@konsulko.com> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Reviewed-by: Jagan Teki <jteki@openedev.com>
| * sf: Add lock ops for SST SPI NOR flashFabio Estevam2015-11-183-3/+5
| | | | | | | | | | | | | | | | | | | | SST SPI NOR flash has the same locking programming bits as ST Micro - added support for it. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> [Minor change on commit message] Signed-off-by: Jagan Teki <jteki@openedev.com> Reviewed-by: Jagan Teki <jteki@openedev.com>
| * sf: Remove eeprom_m95xxx test driverJagan Teki2015-11-182-112/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The relevent boards which used this driver got zapped in previous release and the driver is never used in the code and also it doesn't use/do any spi-flash operations. Commit details for relevent removed boards: "ARM: at91: remove non-generic boards" (sha1: f6b42c140387589ded24749781ce565571092eac) Cc: Tom Rini <trini@konsulko.com> Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com> Signed-off-by: Jagan Teki <jteki@openedev.com>
* | dm: sf: Add support for all targets which requires MANUAL_RELOCMichal Simek2015-11-191-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It is follow up patch based on "dm: Add support for all targets which requires MANUAL_RELOC" (sha1: 484fdf5ba058b07be5ca82763aa2b72063540ef3) to update function pointers for DM. Using post_bind is not ideal but it is one on current option what can be used. Variable reloc_done has to be used do not call relocation after every bind. Maybe new core functions should be introduced for this case. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* | spl: change return values of spl_*_load_image()Nikita Kiryanov2015-11-181-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make spl_*_load_image() functions return a value instead of hanging if a problem is encountered. This enables main spl code to make the decision whether to hang or not, thus preparing it to support alternative boot devices. Some boot devices (namely nand and spi) do not hang on error. Instead, they return normally and SPL proceeds to boot the contents of the load address. This is considered a bug and is rectified by hanging on error for these devices as well. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Cc: Igor Grinberg <grinberg@compulab.co.il> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> Cc: Ian Campbell <ijc@hellion.org.uk> Cc: Hans De Goede <hdegoede@redhat.com> Cc: Albert Aribaud <albert.u.boot@aribaud.net> Cc: Jagan Teki <jteki@openedev.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* | altera_qspi: change ioremap to map_physmemThomas Chou2015-11-181-1/+1
|/ | | | | | | Change ioremap() to map_physmem(), as it is more used in u-boot. Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Reviewed-by: Marek Vasut <marex@denx.de>
* sf: Fix NULL pointer exception for flashes without lock methodsBin Meng2015-11-131-6/+12
| | | | | | | | | | | commit c3c016c "sf: Add SPI NOR protection mechanism" introduced flash_lock()/flash_unlock()/flash_is_locked() methods for SPI flash, but not every flash driver supplies these. We should test these methods against NULL before actually calling them. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com> Reviewed-by: Jagan Teki <jteki@openedev.com>
* mtd: uboot: Add meaningful error messageMaxime Ripard2015-11-121-1/+1
| | | | | | | | | | The current error message in get_part if CONFIG_MTDPARTS is disabled is "offset is not a number" which is confusing and doesn't help at all. Change that for something that might give a hint on what's going on. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* mtd: add altera quadspi driverThomas Chou2015-11-123-0/+283
| | | | | | | | Add Altera Generic Quad SPI Controller support. The controller converts SPI NOR flash to parallel flash interface. So it is not like other SPI flash, but rather like CFI flash. Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
* cfi_flash: convert to driver modelThomas Chou2015-11-122-0/+89
| | | | | | | Convert cfi flash to driver model. Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Reviewed-by: Simon Glass <sjg@chromium.org>
* dm: implement a MTD uclassThomas Chou2015-11-123-0/+34
| | | | | | | | | | | | Implement a Memory Technology Device (MTD) uclass. It should include most flash drivers in the future. Though no uclass ops are defined yet, the MTD ops could be used. The NAND flash driver is based on MTD. The CFI flash and SPI flash support MTD, too. It should make sense to convert them to MTD uclass. Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
* sf: Add SPI NOR protection mechanismFabio Estevam2015-11-053-2/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | Many SPI flashes have protection bits (BP2, BP1 and BP0) in the status register that can protect selected regions of the SPI NOR. Take these bits into account when performing erase operations, making sure that the protected areas are skipped. Tested on a mx6qsabresd: => sf probe SF: Detected M25P32 with page size 256 Bytes, erase size 64 KiB, total 4 MiB => sf protect lock 0x3f0000 0x10000 => sf erase 0x3f0000 0x10000 offset 0x3f0000 is protected and cannot be erased SF: 65536 bytes @ 0x3f0000 Erased: ERROR => sf protect unlock 0x3f0000 0x10000 => sf erase 0x3f0000 0x10000 SF: 65536 bytes @ 0x3f0000 Erased: OK Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> [re-worked to fit the lock common to dm and non-dm] Signed-off-by: Jagan Teki <jteki@openedev.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Heiko Schocher <hs@denx.de> Reviewed-by: Jagan Teki <jteki@openedev.com>
* sf: Add SPI protection mechanism from the kernelFabio Estevam2015-11-052-0/+173
| | | | | | | | | | | | | | | | | | Add the SPI NOR protection mechanism from the kernel. This code is based on the work from Brian Norris <computersforpeace@gmail.com> Here is the commit details: "mtd: spi-nor: refactor block protection functions" (sha1: 62593cf40b23b523b9fc9334ca61ba6c595ebb09) Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Jagan Teki <jteki@openedev.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Heiko Schocher <hs@denx.de> Reviewed-by: Jagan Teki <jteki@openedev.com> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
* compat: Remove is_power_of_2() definitionFabio Estevam2015-11-052-2/+2
| | | | | | | | | | Use the is_power_of_2() definition from log2.h to align with the kernel implementation. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Heiko Schocher <hs@denx.de> Reviewed-by: Jagan Teki <jteki@openedev.com>
* Merge branch 'master' of git://git.denx.de/u-boot-spiTom Rini2015-10-284-100/+115
|\
| * sf: Add FSR support to spi_flash_cmd_wait_readyJagan Teki2015-10-253-9/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds flag status register reading support to spi_flash_cmd_wait_ready. Cc: Simon Glass <sjg@chromium.org> Cc: Marek Vasut <marex@denx.de> Cc: Michal Simek <michal.simek@xilinx.com> Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com> Cc: Stefan Roese <sr@denx.de> Cc: Tom Warren <twarren@nvidia.com> Cc: Tom Rini <trini@konsulko.com> Cc: Hou Zhiqiang <B48286@freescale.com> Tested-by: Jagan Teki <jteki@openedev.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> Signed-off-by: Jagan Teki <jteki@openedev.com>
| * sf: Update status reg check in spi_flash_cmd_wait_readyJagan Teki2015-10-251-58/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current flash wait_ready logic is not modular to add new register status check, hence updated the status check for adding few more register checks in future. Below are the sf speed runs with 'sf update' on whole flash, 16MiB. => sf update 0x100 0x0 0x1000000 device 0 whole chip 16777216 bytes written, 0 bytes skipped in 59.564s, speed 289262 B/s => sf update 0x100 0x0 0x1000000 device 0 whole chip 16777216 bytes written, 0 bytes skipped in 62.549s, speed 275036 B/s => sf update 0x100 0x0 0x1000000 device 0 whole chip 16777216 bytes written, 0 bytes skipped in 61.276s, speed 284359 B/s Cc: Simon Glass <sjg@chromium.org> Cc: Marek Vasut <marex@denx.de> Cc: Michal Simek <michal.simek@xilinx.com> Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com> Cc: Stefan Roese <sr@denx.de> Cc: Tom Warren <twarren@nvidia.com> Cc: Tom Rini <trini@konsulko.com> Tested-by: Jagan Teki <jteki@openedev.com> Signed-off-by: Jagan Teki <jteki@openedev.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
| * sf: Make flash->flags use for generic usageJagan Teki2015-10-252-5/+9
| | | | | | | | | | | | | | | | | | | | Use the flash->flags for generic usage, not only for dm-spi-flash, this will be used for future flag additions. [Correct the spi flash flags detect logic] Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> Signed-off-by: Jagan Teki <jteki@openedev.com>
| * sf: Optimize BAR write codeJagan Teki2015-10-251-28/+13
| | | | | | | | | | | | | | | | | | | | Optimized spi-flash bar writing code and also removed unnecessary bank_sel in read_ops. Cc: Simon Glass <sjg@chromium.org> Cc: Michal Simek <michal.simek@xilinx.com> Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com> Signed-off-by: Jagan Teki <jteki@openedev.com>
| * sf: Add spi_flash_read_barJagan Teki2015-10-251-19/+34
| | | | | | | | | | | | | | | | | | Add spi_flash_read_bar function for reading bar and discovering bar commands at probe time. Cc: Michal Simek <michal.simek@xilinx.com> Cc: Siva Durga Prasad Paladugu <sivadur@xilinx.com> Signed-off-by: Jagan Teki <jteki@openedev.com>
OpenPOWER on IntegriCloud