summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
Commit message (Collapse)AuthorAgeFilesLines
* mtd: core: initialize *retlen in mtd_write()Sascha Hauer2015-11-231-0/+2
| | | | | | | | | | Some mtd drivers like the spi-nor driver do not assign a value to the retlen pointer but instead only add the bytes written to *retlen. Users of mtd_write expect the variable to be initialized by the mtd core though, so we have to do it in mtd_write(). The same is done in mtd_read already. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: nand_denali: don't include arch headerLucas Stach2015-10-142-2/+0
| | | | | | | | It causes build failures on other arches than socfpga and the driver doesn't use anything provided by this header. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mtd'Sascha Hauer2015-10-076-0/+2190
|\
| * mtd denali: pass col argument to READID operationEnrico Jorns2015-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | A read id operation followed by 0x00 reads the device ID while a read id operation followed by 0x20 reads the possible ONFI identifier. As the READID function did not propagate the second id parameter but had a hard-coded call for 0x90 0x00, reading the ONFI identifier was not possible and thus chips werde not detected (tested with MT29F8G08ABABAWP) Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd nand_denali: Add denali nand driverEnrico Jorns2015-09-235-0/+2188
| | | | | | | | | | | | | | The driver is based on the denali driver from the linux kernel Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd nand: added 'bits_per_cell' propertyEnrico Jorns2015-09-231-0/+2
| | | | | | | | | | | | | | This one is available in the kernel and used by the denali driver Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: spi-nor: add Spansion S25FL204K supportAntony Pavlov2015-09-021-0/+1
|/ | | | | | | | | | Spansion S25FL204K is a 4-Mbit 3.0V Serial Flash Memory with Uniform 4 kB Sectors. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Acked-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mtd'Sascha Hauer2015-09-013-71/+18
|\
| * mtd: spi-nor: mostly drop lock/unlock codeSascha Hauer2015-08-281-66/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The lock/unlock code is broken beyond repair. First of all the algorithm doesn't work properly. SPI NOR flashes can only protect a certain amount of blocks from the end of the device which is incompatible to the protect(start,len) API we have. The algorithm tries to be clever by doing protection only when it does not protect unrelated blocks and unprotection only when it does not unprotect unrelated blocks. This breaks for example when some code protects the last blocks (which may contain the bootloader), then protects the blocks before the last ones (which may contain the environment). Then if we try to overwrite the bootloader this won't work since it would unprotect the environment aswell, so the driver will not unprotect anything resulting in a failed erase/write later. Then the protection behaviour is different between different flashes. Some have three protection bits, some have four. For some the smallest protection are is 1/16 of the device, others have 1/256 or 1/64. Some have a bit which selects the lower area instead of upper area for protection. The position of this bit differs on different flashes. This patch removes the lock code completely and always unprotects the whole device. This way we can unprotect a device for writing to it and never protect it again. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: m25p80: make it possible to use large blocks if desiredSascha Hauer2015-08-263-5/+10
| | | | | | | | | | | | | | | | | | | | Some SPI NOR flashes support 4K erase blocks. 4K erase blocks do not work with UBIFS which needs a minimum erase block size of 15360 bytes. Also bigger sectors are faster to erase. This patch adds a device tree option to use the bigger blocks instead of the default 4K blocks. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
* | mtd: nand: mrvl-nand: create initial empty bbtRobert Jarzmik2015-08-191-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When creating an initial bad blocks table, create it empty. This is necessary because when the bad block table blocks are not initialized (all ff) while some partitions are, all the blocks which have an OOB data not beginning with 0xff 0xff will be marked as bad blocks in the initial bad blocks scan. As a consequence, any existing blocks are impossible to erase anymore. Fix this by fixing the BBT creation flag. Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | spi-nor: Align spi_nor_ids[] with kernel 4.1Fabio Estevam2015-08-191-7/+12
|/ | | | | | | Sync the spi_nor_ids[] struct with the one from kernel 4.1. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2015-08-062-9/+12
|\
| * mtd: nand_base: replace ifdef with IS_ENABLEAntony Pavlov2015-08-061-7/+7
| | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: of: put master offset into partition nameSascha Hauer2015-07-231-2/+2
| | | | | | | | | | | | | | Partition names should be partition@<offset> with <offset> being the offset in the master mtd, and not a counting number. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mtd: core: Check partitions for empty stringTeresa Remmet2015-07-201-0/+3
| | | | | | | | | | | | | | Make setting partitions a litte bit more robust. Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: concat: initialize *retlenSascha Hauer2015-08-051-0/+4
| | | | | | | | | | | | | | | | In concat_write and concat_read *retlen is only added to, but it's never initialized. If the caller hasn't initialized retlen doesn't contain valid values. Fix this by initializing *retlen properly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: cfi-flash: Fix infoSascha Hauer2015-08-051-8/+15
|/ | | | | | | | | | | Since 636d384 mtd: cfi-flash: Add mtd concat support The devinfo output is broken. dev->priv no longer contains a struct flash_info * but instead a struct cfi_priv *. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/blspec'Sascha Hauer2015-07-061-0/+1
|\
| * fs: ubifs: Implement Linux rootargSascha Hauer2015-06-181-0/+1
| | | | | | | | | | | | | | | | Add the parameter to boot from ubifs fileystems. This assumes that there will be only one UBI device registered in the kernel, otherwise there is no way to predict the ubi number. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/mtd'Sascha Hauer2015-07-033-8/+45
|\ \ | | | | | | | | | | | | Conflicts: drivers/mtd/core.c
| * | ubi: Lower 'already attached' message to debug levelSascha Hauer2015-06-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The caller will show a message, no need to do this in UBI. This is for the case when mtd_detect calls ubi_attach_mtd_dev. mtd_detect does not know whether this is already attached and it's not an error. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mtd: detect ubi devices automaticallySascha Hauer2015-06-261-0/+40
| | | | | | | | | | | | | | | | | | | | | Hook UBI attachment into the mtd class devices detect function. This makes it possible to attach ubi devices with 'detect nand0.root'. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | ubi: Use preditable device namesSascha Hauer2015-06-262-7/+4
| |/ | | | | | | | | | | | | | | | | Instead of naming all ubi devices and cdev names ubi<num> append '.ubi' to the original mtd name. This makes ubi device and cdev names predictable. With this ubi0 becomes nand0.root.ubi. Also do the same for volume names, so ubi0.root becomes nand0.root.ubi.root. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2015-07-035-22/+19
|\ \
| * | mtd: m25p80: make flash_name constSascha Hauer2015-06-291-7/+4
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mtd: Make devname argument to add_mtd_device constSascha Hauer2015-06-294-4/+4
| | | | | | | | | | | | | | | | | | | | | add_mtd_device duplicates the string where necessary, so make it const. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mtd: m25p80: Whitespace cleanupSascha Hauer2015-06-171-11/+11
| |/ | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/imx-bbu-nand-fcb'Sascha Hauer2015-07-031-0/+13
|\ \ | | | | | | | | | | | | Conflicts: common/Kconfig
| * | mtd: partition: implement write_oobSascha Hauer2015-06-121-0/+13
| | | | | | | | | | | | | | | | | | To enable mtd_write_oob for partitions. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/cfi-flash'Sascha Hauer2015-07-037-516/+1293
|\ \ \
| * | | mtd: cfi-flash: Add mtd concat supportSascha Hauer2015-06-231-14/+66
| | | | | | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | mtd: Add mtd concat supportSascha Hauer2015-06-233-0/+776
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mtd concat layer supports concatenating several MTD devices into a single one. This is nearly as-is from the corresponding Kernel code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | mtd: cfi-flash: remove dead codeSascha Hauer2015-06-223-48/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | CFG_FLASH_PROTECTION is never defined, remove the code. Also remove code inside #if 0. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | mtd: cfi-flash: Coding style cleanupSascha Hauer2015-06-224-248/+283
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - use consistent variable types (drop uchar, ushort and friends) - remove whitespace between functions and opening brace - Add some blank lines to rectify code - drop 'rc' and 'retcode' and use 'ret' consistently - Do not put variable assignment into if() - drop unncessary braces Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | mtd: cfi-flash: use unaligned accessor functionsSascha Hauer2015-06-221-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some members in struct cfi_qry are unaligned. Use get_unaligned_* to access them. Fixes unaligned aborts on busses which don't support unaligned accesses. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | mtd: cfi-flash: turn some messages into vdbgSascha Hauer2015-06-222-14/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some messages produce a lot of log spam. Turn them into dev_vdbg to make some more important messages more visible. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | mtd: cfi-flash: return 0 for successSascha Hauer2015-06-223-49/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use zero as success return code and negative standard error codes consistently in the driver. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | mtd: cfi-flash: make flash_detect_width more readableSascha Hauer2015-06-221-28/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use variables instead of long defines to get the loops into a single line. Also use goto to move the deeply indented code more to the left. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | mtd: cfi-flash: remove unnecessary ifdefsSascha Hauer2015-06-221-7/+3
| | | | | | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | mtd: cfi-flash: replace ifdef with IS_ENABLEDSascha Hauer2015-06-221-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | TO get rid of some ifdefs. While at it add the vendor code of the unsupported vendor to the error message. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | mtd: cfi-flash: statically initialize instead of memsetSascha Hauer2015-06-221-3/+1
| | | | | | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | mtd: cfi-flash: save indention levelSascha Hauer2015-06-221-113/+114
| | | | | | | | | | | | | | | | | | | | | | | | Bail out early in flash_get_size() and save an indention level. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | mtd: cfi-flash: We can print longlongsSascha Hauer2015-06-221-23/+1
| | |/ | |/| | | | | | | | | | | | | printf supports printing longlongs, so drop print_longlong. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / | mtd: m25p80: Fix Kconfig dependenciesSascha Hauer2015-06-291-1/+2
|/ / | | | | | | | | | | | | | | | | | | The m25p80 driver now depends on MTD_SPI_NOR which is disabled in all defconfigs, so this effectively disables the m25p80 driver in all defconfigs. Fix this by selecting MTD_SPI_NOR which is library code without further dependencies. Also let m25p80 depend on SPI because it needs the SPI code and won't link without it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/spi-nor'Sascha Hauer2015-06-098-835/+2544
|\ \
| * | mtd: m25p80: use the SPI nor frameworkSteffen Trumtrar2015-05-292-835/+166
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the spi-nor framework for the m25p80 driver to de-duplicate the code base and follow along with the linux kernel version, so bugfixes or features can be easier integrated. Based on the Linux v4.1-rc3 version of m25p80.c. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mtd: spi-nor: add cadence quadspi driverSteffen Trumtrar2015-05-293-0/+1221
| | | | | | | | | | | | | | | Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mtd: spi-nor: add SPI-NOR frameworkSteffen Trumtrar2015-05-295-0/+1157
| |/ | | | | | | | | | | | | | | Import the SPI-NOR framework from linux kernel v3.19. Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Abolish cpu_read* and cpu_write* accessorsMasahiro Yamada2015-05-201-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 2e6a88f2101d (add cpu native ordered io accessors) introduced these macros and then commit be57f20cdd7d (Fix big endian MMIO primitives) figured out they are equivalent to __raw_{read,write}*. They turned out unnecessary after all. Anyway, most source files use __raw_read* and __raw_write*. Let's replace a few remaining references and abolish them. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>