- 18 9月, 2017 2 次提交
-
-
由 Masahiro Yamada 提交于
Several drivers check ->chipsize to see if the third row address cycle is needed. Instead of embedding magic sizes such as 32MB, 128MB in drivers, introduce a new flag NAND_ROW_ADDR_3 for clean-up. Since nand_scan_ident() knows well about the device, it can handle this properly. The flag is set if the row address bit width is greater than 16. Delete comments such as "One more address cycle for ..." because intention is now clear enough from the code. Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com> Acked-by: NWenyou Yang <wenyou.yang@microchip.com> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
由 Miquel Raynal 提交于
Use the core's large page OOB layout functions when not reserving any space for ECC bytes in the OOB layout. Fix ->nand_ooblayout_ecc_lp() to return -ERANGE instead of a zero length in this case. Signed-off-by: NMiquel Raynal <miquel.raynal@free-electrons.com> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
- 30 8月, 2017 1 次提交
-
-
由 Lothar Waßmann 提交于
commit c51d0ac5 ("mtd: nand: Move Samsung specific init/detection logic in nand_samsung.c") introduced a regression for Samsung SLC NAND chips. Prior to this commit chip->bits_per_cell was initialized by calling nand_get_bits_per_cell() before using nand_is_slc(). With the offending commit this call is skipped, leaving chip->bits_per_cell cleared to zero when the manufacturer specific '.detect' function calls nand_is_slc() which in turn interprets bits_per_cell != 1 as indication for an MLC chip. The effect is that e.g. a K9F1G08U0F NAND chip is falsely detected as MLC NAND with 4KiB page size rather than SLC with 2KiB page size. Add a call to nand_get_bits_per_cell() before calling the .detect hook function in nand_manufacturer_detect(), so that the nand_is_slc() calls in the manufacturer specific code will return correct results. Fixes: c51d0ac5 ("mtd: nand: Move Samsung specific init/detection logic in nand_samsung.c") Cc: <stable@vger.kernel.org> Signed-off-by: NLothar Waßmann <LW@KARO-electronics.de> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
- 23 8月, 2017 2 次提交
-
-
由 Jean-Louis Thekekara 提交于
This commit removes hard-coded '8' used for looping into struct nand_chip.id.data array. NAND_MAX_ID_LEN has been introduced by Artem Bityutskiy in 53552d22 for defining ids length in nand_flash_ids[] list. This commit unifies ids length in nand base driver. Signed-off-by: NJean-Louis Thekekara <jeanlouis.thekekara@parrot.com> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
由 Boris Brezillon 提交于
The nand_scan_ident() function is not expected to allocate resources, and people are usually not calling nand_cleanup() if something fails between nand_scan_ident() and nand_scan_tail(). Move all functions that may allocate resource to the nand_scan_tail() path to prevent such resource leaks. Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
- 13 8月, 2017 1 次提交
-
-
由 Boris Brezillon 提交于
We are planning to share more code between different NAND based devices (SPI NAND, OneNAND and raw NANDs), but before doing that we need to move the existing include/linux/mtd/nand.h file into include/linux/mtd/rawnand.h so we can later create a nand.h header containing all common structure and function prototypes. Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: NPeter Pan <peterpandong@micron.com> Acked-by: NVladimir Zapolskiy <vz@mleia.com> Acked-by: NAlexander Sverdlin <alexander.sverdlin@gmail.com> Acked-by: NWenyou Yang <wenyou.yang@microchip.com> Acked-by: NKrzysztof Kozlowski <krzk@kernel.org> Acked-by: NHan Xu <han.xu@nxp.com> Acked-by: NH Hartley Sweeten <hsweeten@visionengravers.com> Acked-by: NShawn Guo <shawnguo@kernel.org> Acked-by: NGregory CLEMENT <gregory.clement@free-electrons.com> Acked-by: NNeil Armstrong <narmstrong@baylibre.com> Acked-by: NMasahiro Yamada <yamada.masahiro@socionext.com> Acked-By: NHarvey Hunt <harveyhuntnexus@gmail.com> Acked-by: NTony Lindgren <tony@atomide.com> Acked-by: NKrzysztof Halasa <khalasa@piap.pl>
-
- 03 8月, 2017 1 次提交
-
-
由 Boris Brezillon 提交于
Commit 7d70f334 ("mtd: nand: add lock/unlock routines") introduced support for the Micron LOCK/UNLOCK commands but no one ever used the nand_lock/unlock() functions. Remove support for these vendor-specific operations from the core. If one ever wants to add them back they should be put in nand_micron.c and mtd->_lock/_unlock should be directly assigned from there instead of exporting the functions. Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
- 02 8月, 2017 3 次提交
-
-
由 Boris Brezillon 提交于
Some ONFI NANDs do not support the SET/GET FEATURES commands, which, according to the spec, is perfectly valid. On these NANDs we can't set a specific timing mode using the "timing mode" feature, and we should assume the NAND does not require any setup to enter a specific timing mode. Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com> Fixes: d8e725dd ("mtd: nand: automate NAND timings selection") Reported-by: NAlexander Dahl <ada@thorsis.com> Cc: <stable@vger.kernel.org> Tested-by: NAlexander Dahl <ada@thorsis.com> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
由 Jonathan Corbet 提交于
Commit 0b4773fd (mtd: nand: Drop unused cached programming support) removed the "cached" parameter from nand_write_page(), but did not update the kerneldoc comments, creating this docs build warning: ./drivers/mtd/nand/nand_base.c:2751: warning: Excess function parameter 'cached' description in 'nand_write_page' Remove the offending line so we can have a little peace and quiet. Signed-off-by: NJonathan Corbet <corbet@lwn.net> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
由 Miquel Raynal 提交于
When using soft ecc, if no ooblayout is given, the core automatically uses one of the nand_ooblayout_{sp,lp}*() functions to determine the layout inside the out of band data. Until kernel version 4.6, struct nand_ecclayout was used for that purpose. During the migration from 4.6 to 4.7, an error shown up in the small page layout, in the case oob section is only 8 bytes long. The layout was using three bytes (0, 1, 2) for ecc, two bytes (3, 4) as free bytes, one byte (5) for bad block marker and finally two bytes (6, 7) as free bytes, as shown there: [linux-4.6] drivers/mtd/nand/nand_base.c:52 static struct nand_ecclayout nand_oob_8 = { .eccbytes = 3, .eccpos = {0, 1, 2}, .oobfree = { {.offset = 3, .length = 2}, {.offset = 6, .length = 2} } }; This fixes the current implementation which is incoherent. It references bit 3 at the same time as an ecc byte and a free byte. Furthermore, it is clear with the previous implementation that there is only one ecc section with 8 bytes oob sections. We shall return -ERANGE in the nand_ooblayout_ecc_sp() function when asked for the second section. Signed-off-by: NMiquel Raynal <miquel.raynal@free-electrons.com> Fixes: 41b207a7 ("mtd: nand: implement the default mtd_ooblayout_ops") Cc: <stable@vger.kernel.org> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
- 10 6月, 2017 1 次提交
-
-
由 Masahiro Yamada 提交于
Driver are responsible for setting up ECC parameters correctly. Those include: - Check if ECC parameters specified (usually by DT) are valid - Meet the chip's ECC requirement - Maximize ECC strength if NAND_ECC_MAXIMIZE flag is set The logic can be generalized by factoring out common code. This commit adds 3 helpers to the NAND framework: nand_check_ecc_caps - Check if preset step_size and strength are valid nand_match_ecc_req - Match the chip's requirement nand_maximize_ecc - Maximize the ECC strength To use the helpers above, a driver needs to provide: - Data array of supported ECC step size and strength - A hook that calculates ECC bytes from the combination of step_size and strength. By using those helpers, code duplication among drivers will be reduced. Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
- 01 6月, 2017 7 次提交
-
-
由 Masahiro Yamada 提交于
Drivers are supposed to set correct ecc->{size,strength,bytes} before calling nand_scan_tail(), but it does not complain about ecc->total bigger than oobsize. In this case, chip->scan_bbt() crashes due to memory corruption, but it is hard to debug. It would be kind to fail it earlier with a clear message. Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
由 Boris Brezillon 提交于
READ0 is sometimes used to exit GET STATUS mode. When this is the case no address cycles are requested, and we can use this information to detect that READSTART should not be issued after READ0 or that we shouldn't wait for the chip to be ready. Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com> Tested-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com>
-
由 Boris Brezillon 提交于
Drivers setting NAND_ECC_CUSTOM_PAGE_ACCESS are supposed to handle the full read/write page sequence, and waiting for a page to actually be programmed is part of this write-page sequence. This is also what is done in ->write_oob_xxx() hooks, so let's do that in ->write_page_xxx() as well to make it consistent. Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
由 Boris Brezillon 提交于
The ->errstat() hook is no longer implemented NAND controller drivers. Get rid of it before someone starts abusing it. Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
由 Boris Brezillon 提交于
Cached programming is always skipped, so drop the associated code until we decide to really support it. Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
由 Boris Brezillon 提交于
Some NAND controllers can assign different NAND timings to different CS lines. Pass the CS line information to ->setup_data_interface() so that the NAND controller driver knows which CS line is concerned by the setup_data_interface() request. Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
由 Pavel Machek 提交于
If we see ~0UL in flash, there's no need for hweight, and no need to check number of bitflips. So this should be net win. Signed-off-by: NPavel Machek <pavel@denx.de> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
- 30 5月, 2017 1 次提交
-
-
由 Boris Brezillon 提交于
A lot of drivers are providing their own ->cmdfunc(), and most of the time this implementation does not support all possible NAND operations. But since ->cmdfunc() cannot return an error code, the core has no way to know that the operation it requested is not supported. This is a problem we cannot address for all kind of operations with the current design, but we can prevent these silent failures for the GET/SET FEATURES operation by overloading the default ->onfi_{set,get}_features() methods with one returning -ENOTSUPP. Reported-by: NChris Packham <Chris.Packham@alliedtelesis.co.nz> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com> Tested-by: NChris Packham <Chris.Packham@alliedtelesis.co.nz>
-
- 22 5月, 2017 3 次提交
-
-
由 Colin Ian King 提交于
nand_ooblayout_lp_hamming_ops can be made static as it does not need to be in global scope. Signed-off-by: NColin Ian King <colin.king@canonical.com> Acked-by: NBoris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
由 Brian Norris 提交于
If we fail any time after calling nand_detect(), then we don't call the vendor-specific ->cleanup() callback, and we'll leak any resources the vendor-specific code might have allocated. Mark the "fix" against the first commit that started allocating anything in ->init(). Fixes: 626994e0 ("mtd: nand: hynix: Add read-retry support for 1x nm MLC NANDs") Signed-off-by: NBrian Norris <computersforpeace@gmail.com> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
由 Brian Norris 提交于
This bug seems to have been here forever, although we came close to fixing all of them in [1]! [1] 11eaf6df ("mtd: nand: Remove BUG() abuse in nand_scan_tail") Signed-off-by: NBrian Norris <computersforpeace@gmail.com> Acked-by: NEzequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
- 16 5月, 2017 1 次提交
-
-
由 Mauro Carvalho Chehab 提交于
./drivers/mtd/nand/nand_bbt.c:1: warning: no structured comments found ./include/linux/mtd/nand.h:785: ERROR: Unexpected indentation. ./drivers/mtd/nand/nand_base.c:449: WARNING: Definition list ends without a blank line; unexpected unindent. ./drivers/mtd/nand/nand_base.c:1161: ERROR: Unexpected indentation. ./drivers/mtd/nand/nand_base.c:1162: WARNING: Block quote ends without a blank line; unexpected unindent. Signed-off-by: NMauro Carvalho Chehab <mchehab@s-opensource.com>
-
- 15 5月, 2017 2 次提交
-
-
由 Thomas Petazzoni 提交于
The nand_read_page_raw() and nand_write_page_raw() functions might be re-used by vendor-specific implementations of the read_page/write_page functions. Instead of having vendor-specific code duplicate this code, it is much better to export those functions and allow them to be re-used. Signed-off-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com> Reviewed-by: NRichard Weinberger <richard@nod.at> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
由 Thomas Petazzoni 提交于
A number of NAND flashes have a capability called "on-die ECC" where the NAND chip itself is capable of detecting and correcting errors. Linux already has support for using the ECC implementation of the NAND controller, or a software based ECC implementation, but not for using the ECC implementation of the NAND controller. However, such an implementation is sometimes useful in situations where the NAND controller provides ECC algorithms that are not strong enough for the NAND chip used on the system. A typical case is a NAND chip that requires a 4-bit ECC, while the NAND controller only provides a 1-bit ECC algorithm. This commit introduces the support for the NAND_ECC_ON_DIE ECC mode: - Parsing of the "on-die" value for the "nand-ecc-mode" Device Tree property - Handling NAND_ECC_ON_DIE case in nand_scan_tail(). The idea is that the vendor specific code for the NAND chip must implement ->read_page() and ->write_page(). It may optionally provide its own ->read_page_raw() and ->write_page_raw() as well. For OOB operation, we assume the standard operations are good enough, but they can be overridden by the vendor specific code if needed. Signed-off-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com> Reviewed-by: NRichard Weinberger <richard@nod.at> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
- 03 5月, 2017 1 次提交
-
-
由 Alexander Couzens 提交于
The old 1-bit hamming layout requires ECC data to be placed at a fixed offset, and not necessarily at the end of the OOB area. Add this old layout back in order to fix legacy setups. Fixes: 41b207a7 ("mtd: nand: implement the default mtd_ooblayout_ops") Cc: <stable@vger.kernel.org> Signed-off-by: NAlexander Couzens <lynxis@fe80.eu> Acked-by: NBoris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
-
- 25 4月, 2017 4 次提交
-
-
由 Masahiro Yamada 提交于
In some cases, nand_do_{read,write}_ops is passed with unaligned ops->datbuf. Drivers using DMA will be unhappy about unaligned buffer. The new struct member, buf_align, represents the minimum alignment the driver require for the buffer. If the buffer passed from the upper MTD layer does not have enough alignment, nand_do_*_ops will use bufpoi. Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
由 Masahiro Yamada 提交于
Some NAND controllers are using DMA engine requiring a specific buffer alignment. The core provides no guarantee on the nand_buffers pointers, which forces some drivers to allocate their own buffers and pass the NAND_OWN_BUFFERS flag. Rework the nand_buffers allocation logic to allocate each buffer independently. This should make most NAND controllers/DMA engine happy, and allow us to get rid of these custom buf allocation in NAND controller drivers. Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
由 Masahiro Yamada 提交于
The comment for ecc.read_page() requires that it should return "0 if bitflips uncorrectable". Actually, drivers could return positive values when uncorrectable bitflips occur. For example, nand_read_page_swecc() is the case. If ecc.correct() returns -EBADMSG for the first ECC sector, and a positive value for the second one, nand_read_page_swecc() returns a positive max_bitflips and increments ecc_stats.failed for the same page. The requirement can be relaxed by tweaking nand_do_read_ops(). Move the max_bitflips calculation below the retry. Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com> Suggested-by: NBoris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
由 Boris Brezillon 提交于
The last/only user of the chip->write_page() hook (the Atmel NAND controller driver) has been reworked and is no longer specifying a custom ->write_page() implementation. Drop this hook before someone else start abusing it. Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com> Reviewed-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
-
- 24 3月, 2017 4 次提交
-
-
由 Masahiro Yamada 提交于
Set Features (0xEF) command toggles the R/B# pin after 4 sub feature parameters are written. Currently, nand_command(_lp) calls chip->dev_ready immediately after the address cycle because NAND_CMD_SET_FEATURES falls into default: label. No wait is needed at this point. If you see nand_onfi_set_features(), R/B# is already cared by the chip->waitfunc call. Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
由 Masahiro Yamada 提交于
Read ID (0x90) command does not toggle the R/B# pin. Without this patch, NAND_CMD_READID falls into the default: label, then R/B# is checked by chip->dev_ready(). Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
由 Masahiro Yamada 提交于
The nand_default_block_markbad() and scan_block_fast() use high level APIs to get access to the BBM. On the other hand, nand_block_bad (the default implementation of ->block_bad) calls the lower level ->cmdfunc hook. This prevents drivers from using ->ecc.read_oob() even if optimized read operation is implemented. Besides, some NAND controllers may protect the BBM with ECC. Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
由 Masahiro Yamada 提交于
Currently, it is valid to specify both "nand-ecc-step-size" and "nand-ecc-strength", but not allowed to set only one of them. This requirement has a conflict with "nand-ecc-maximize"; this flag is used when you want the driver to choose the best ECC strength. If "nand-ecc-maximize" is set, "nand-ecc-strength" is very likely to be unset. It would be possible to make the if-conditional more complex by adding the check for the NAND_ECC_MAXIMIZE flag, but I chose to drop the check entirely. I thought of the situation where the hardware has a fixed ECC step size (so it can be hard-coded in the driver), whereas the ECC strength is configurable by software. In that case, we may want to only set "nand-ecc-strength" (or "nand-ecc-maximize") in DT. Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
- 09 3月, 2017 6 次提交
-
-
由 Boris Brezillon 提交于
Move Macronix specific initialization logic into nand_macronix.c. This is part of the "separate vendor specific code from core" cleanup process. Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
-
由 Boris Brezillon 提交于
Move AMD/Spansion specific initialization/detection logic into nand_amd.c. This is part of the "separate vendor specific code from core" cleanup process. Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com> Acked-by: NRichard Weinberger <richard@nod.at>
-
由 Boris Brezillon 提交于
Move Micron specific initialization logic into nand_micron.c. This is part of the "separate vendor specific code from core" cleanup process. Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com> Acked-by: NRichard Weinberger <richard@nod.at>
-
由 Boris Brezillon 提交于
Move Toshiba specific initialization and detection logic into nand_toshiba.c. This is part of the "separate vendor specific code from core" cleanup process. Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com> Acked-by: NRichard Weinberger <richard@nod.at>
-
由 Boris Brezillon 提交于
Move Hynix specific initialization and detection logic into nand_hynix.c. This is part of the "separate vendor specific code from core" cleanup process. Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com> Acked-by: NRichard Weinberger <richard@nod.at>
-
由 Boris Brezillon 提交于
Move Samsung specific initialization and detection logic into nand_samsung.c. This is part of the "separate vendor specific code from core" cleanup process. Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com> Acked-by: NRichard Weinberger <richard@nod.at>
-