- 03 10月, 2018 11 次提交
-
-
由 Boris Brezillon 提交于
Let's make the raw NAND API consistent by patching all helpers and hooks to take a nand_chip object instead of an mtd_info one or remove the mtd_info object when both are passed. Let's tackle all chip->write_xxx() hooks at once. Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Boris Brezillon 提交于
Let's make the raw NAND API consistent by patching all helpers and hooks to take a nand_chip object instead of an mtd_info one or remove the mtd_info object when both are passed. Let's tackle all chip->read_xxx() hooks at once. Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Boris Brezillon 提交于
Let's make the raw NAND API consistent by patching all helpers and hooks to take a nand_chip object instead of an mtd_info one or remove the mtd_info object when both are passed. Let's tackle all ecc->write_xxx() hooks at once. Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Boris Brezillon 提交于
Let's make the raw NAND API consistent by patching all helpers and hooks to take a nand_chip object instead of an mtd_info one or remove the mtd_info object when both are passed. Let's tackle all ecc->read_xxx() hooks at once. Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Acked-by: NStefan Agner <stefan@agner.ch> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Boris Brezillon 提交于
Let's make the raw NAND API consistent by patching all helpers and hooks to take a nand_chip object instead of an mtd_info one. Now is ecc->correct()'s turn. Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Boris Brezillon 提交于
Let's make the raw NAND API consistent by patching all helpers and hooks to take a nand_chip object instead of an mtd_info one. Now is ecc->calculate()'s turn. Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Boris Brezillon 提交于
Let's make the raw NAND API consistent by patching all helpers and hooks to take a nand_chip object instead of an mtd_info one. Now is ecc->hwctl()'s turn. Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Boris Brezillon 提交于
Let's make the raw NAND API consistent by patching all helpers to take a nand_chip object instead of an mtd_info one. Now is nand_wait_ready()'s turn. Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Boris Brezillon 提交于
Let's make the raw NAND API consistent by patching all helpers to take a nand_chip object instead of an mtd_info one. Now is nand_release()'s turn. Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Boris Brezillon 提交于
Let's make the raw NAND API consistent by patching all helpers to take a nand_chip object instead of an mtd_info one. We start with nand_scan(). Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Boris Brezillon 提交于
Let's make the raw NAND API consistent by patching all helpers and hooks to take a nand_chip object instead of an mtd_info one or remove the mtd_info object when both are passed. In order to do that, we first need to update the platform_nand_ctrl hooks to take a nand_chip object instead of an mtd_info. We add temporary plat_nand_xxx() wrappers to the do the mtd -> chip conversion, but those will be dropped when patching nand_chip hooks to take a nand_chip object. Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Reviewed-by: NAlexander Sverdlin <alexander.sverdlin@gmail.com> Acked-by: NAlexander Sverdlin <alexander.sverdlin@gmail.com> Acked-by: NRobert Jarzmik <robert.jarzmik@free.fr> Acked-by: NKrzysztof Halasa <khalasa@piap.pl> Acked-by: NPaul Burton <paul.burton@mips.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
- 05 9月, 2018 1 次提交
-
-
由 Boris Brezillon 提交于
Commit c120e75e ("mtd: nand: use read_oob() instead of cmdfunc() for bad block check") removed this only user of the ->read_word() method but kept the hook in place. Remove it now. Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
- 01 8月, 2018 2 次提交
-
-
由 Miquel Raynal 提交于
Now that it is possible to do dynamic allocations during the identification phase, convert the onfi_params structure (which is only needed with ONFI compliant chips) into a pointer that will be allocated only if needed. Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: NBoris Brezillon <boris.brezillon@bootlin.com>
-
由 Brian Norris 提交于
Commit 59b356ff ("mtd: m25p80: restore the status of SPI flash when exiting") is the latest from a long history of attempts to add reboot handling to handle stateful addressing modes on SPI flash. Some prior mostly-related discussions: http://lists.infradead.org/pipermail/linux-mtd/2013-March/046343.html [PATCH 1/3] mtd: m25p80: utilize dedicated 4-byte addressing commands http://lists.infradead.org/pipermail/barebox/2014-September/020682.html [RFC] MTD m25p80 3-byte addressing and boot problem http://lists.infradead.org/pipermail/linux-mtd/2015-February/057683.html [PATCH 2/2] m25p80: if supported put chip to deep power down if not used Previously, attempts to add reboot-time software reset handling were rejected, but the latest attempt was not. Quick summary of the problem: Some systems (e.g., boot ROM or bootloader) assume that they can read initial boot code from their SPI flash using 3-byte addressing. If the flash is left in 4-byte mode after reset, these systems won't boot. The above patch provided a shutdown/remove hook to attempt to reset the addressing mode before we reboot. Notably, this patch misses out on huge classes of unexpected reboots (e.g., crashes, watchdog resets). Unfortunately, it is essentially impossible to solve this problem 100%: if your system doesn't know how to reset the SPI flash to power-on defaults at initialization time, no amount of software can really rescue you -- there will always be a chance of some unexpected reset that leaves your flash in an addressing mode that your boot sequence didn't expect. While it is not directly harmful to perform hacks like the aforementioned commit on all 4-byte addressing flash, a properly-designed system should not need the hack -- and in fact, providing this hack may mask the fact that a given system is indeed broken. So this patch attempts to apply this unsound hack more narrowly, providing a strong suggestion to developers and system designers that this is truly a hack. With luck, system designers can catch their errors early on in their development cycle, rather than applying this hack long term. But apparently enough systems are out in the wild that we still have to provide this hack. Document a new device tree property to denote systems that do not have a proper hardware (or software) reset mechanism, and apply the hack (with a loud warning) only in this case. Signed-off-by: NBrian Norris <computersforpeace@gmail.com> Reviewed-by: NGuenter Roeck <linux@roeck-us.net> Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com>
-
- 31 7月, 2018 5 次提交
-
-
由 Miquel Raynal 提交于
Thanks to the migration of all drivers to use nand_scan() and the related nand_controller_ops, we can now allocate data during the detection phase. Let's do it first for the NAND model parameter which is allocated in nand_detect(). Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: NBoris Brezillon <boris.brezillon@bootlin.com>
-
由 Miquel Raynal 提交于
Both nand_scan_ident() and nand_scan_tail() helpers used to be called directly from controller drivers that needed to tweak some ECC-related parameters before nand_scan_tail(). This separation prevented dynamic allocations during the phase of NAND identification, which was inconvenient. All controller drivers have been moved to use nand_scan(), in conjunction with the chip->ecc.[attach|detach]_chip() hooks that actually do the required tweaking sequence between both ident/tail calls, allowing programmers to use dynamic allocation as they need all across the scanning sequence. Declare nand_scan_[ident|tail]() statically now. Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: NBoris Brezillon <boris.brezillon@bootlin.com>
-
由 Miquel Raynal 提交于
In order to remove the limitation that forbids dynamic allocation in nand_scan_ident(), we must create a path that will be the same for all controller drivers. The idea is to use nand_scan() instead of the widely used nand_scan_ident()/nand_scan_tail() couple. In order to achieve this, controller drivers will need to adjust some parameters between these two functions depending on the NAND chip wired on them. This takes the form of two new hooks (->{attach,detach}_chip()) that are placed in a new nand_controller_ops structure, which is then attached to the nand_controller object at driver initialization time. ->attach_chip() is called between nand_scan_ident() and nand_scan_tail(), and ->detach_chip() is called in the error path of nand_scan() and in nand_cleanup(). Note that some NAND controller drivers don't have a dedicated nand_controller object and instead rely on the default/dummy one embedded in nand_chip. If you're in this case and still want to initialize the controller ops, you'll have to manipulate chip->dummy_controller directly. Last but not least, it's worth mentioning that we plan to move some of the controller related hooks placed in nand_chip into nand_controller_ops to make the separation between NAND chip and NAND controller methods clearer. Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com> Acked-by: NBoris Brezillon <boris.brezillon@bootlin.com>
-
由 Miquel Raynal 提交于
In the raw NAND core, a NAND chip is described by a nand_chip structure, while a NAND controller is described with a nand_hw_control structure which is not very meaningful. Rename this structure nand_controller. As the structure gets renamed, it is logical to also rename the core function initializing it from nand_hw_control_init() to nand_controller_init(). Lastly, the 'hwcontrol' entry of the nand_chip structure is not meaningful neither while it has the role of fallback when no controller structure is provided by the driver (the controller driver is dumb and can only control a single chip). Thus, it is renamed dummy_controller. Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com> Acked-by: NBoris Brezillon <boris.brezillon@bootlin.com>
-
由 Miquel Raynal 提交于
A report from Colin Ian King pointed a CoverityScan issue where error values on these helpers where not checked in the drivers. These helpers can error out only in case of a software bug in driver code, not because of a runtime/hardware error. Hence, let's WARN_ON() in this case and return 0 which is harmless anyway. Fixes: 8878b126 ("mtd: nand: add ->exec_op() implementation") Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
- 20 7月, 2018 2 次提交
-
-
由 Boris Brezillon 提交于
Some implementations simply can't disable their ECC engine. Expose helpers returning -ENOTSUPP so that the caller knows that raw accesses are not supported instead of silently falling back to non-raw accessors. Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Miquel Raynal 提交于
A comment in the kernel doc of the mtd_oob_ops structure tells that it is not possible to write more than one page with OOB. This is actually true for only a few MTD devices like 'onenand' but it is definitely not a general limitation. While this would benefit to be handled elsewhere either by the MTD layer or by the limited drivers, let's update this comment to reflect the reality. Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com>
-
- 18 7月, 2018 12 次提交
-
-
由 Boris Brezillon 提交于
None of the board files are overloading those hooks, so let's drop them from struct platform_nand_ctrl. Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Acked-by: NRobert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Boris Brezillon 提交于
None of the existing drivers are overloading the ->scan_bbt() method, let's get rid of it and replace calls to ->scan_bbt() by nand_create_bbt() ones. Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Boris Brezillon 提交于
Rename nand_default_bbt() into nand_create_bbt() and pass it a nand_chip object to prepare removal of the chip->scan_bbt() hook. We add a temporary nand_default_bbt() wrapper which will be dropped after the removal of ->scan_bbt(). Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Boris Brezillon 提交于
struct device_node is defined in linux/of.h. Let's include this file instead of having a forward declaration of this struct. Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Boris Brezillon 提交于
struct mtd_info is defined in linux/mtd/mtd.h which is included at the beginning of nand_base.c, there's thus no need for the forward declaration of mtd_info. Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Boris Brezillon 提交于
nand_do_read() is a static function implemented in nand_base.c. There's no good reason to expose its prototype in rawnand.h. Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Boris Brezillon 提交于
Add minimal support for the MX35LF1GE4AB SPI NAND chip. Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Frieder Schrempf 提交于
Add support for the W25M02GV chip. Signed-off-by: NFrieder Schrempf <frieder.schrempf@exceet.de> Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Peter Pan 提交于
Add a basic driver for Micron SPI NANDs. Only one device is supported right now, but the driver will be extended to support more devices afterwards. Signed-off-by: NPeter Pan <peterpandong@micron.com> Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Peter Pan 提交于
Add a SPI NAND framework based on the generic NAND framework and the spi-mem infrastructure. In its current state, this framework supports the following features: - single/dual/quad IO modes - on-die ECC Signed-off-by: NPeter Pan <peterpandong@micron.com> Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Abhishek Sahu 提交于
Function nand_ecc_choose_conf() will be help for all the cases, so other helper functions can be made static. nand_check_ecc_caps(): Invoke nand_ecc_choose_conf() with both chip->ecc.size and chip->ecc.strength value set. nand_maximize_ecc(): Invoke nand_ecc_choose_conf() with NAND_ECC_MAXIMIZE flag. nand_match_ecc_req(): Invoke nand_ecc_choose_conf() with either chip->ecc.size or chip->ecc.strength value set and without NAND_ECC_MAXIMIZE flag. CC: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: NAbhishek Sahu <absahu@codeaurora.org> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Abhishek Sahu 提交于
commit 2c8f8afa ("mtd: nand: add generic helpers to check, match, maximize ECC settings") provides generic helpers which drivers can use for setting up ECC parameters. Since same board can have different ECC strength nand chips so following is the logic for setting up ECC strength and ECC step size, which can be used by most of the drivers. 1. If both ECC step size and ECC strength are already set (usually by DT) then just check whether this setting is supported by NAND controller. 2. If NAND_ECC_MAXIMIZE is set, then select maximum ECC strength supported by NAND controller. 3. Otherwise, try to match the ECC step size and ECC strength closest to the chip's requirement. If available OOB size can't fit the chip requirement then select maximum ECC strength which can be fit with available OOB size. This patch introduces nand_ecc_choose_conf function which calls the required helper functions for the above logic. The drivers can use this single function instead of calling the 3 helper functions individually. Signed-off-by: NAbhishek Sahu <absahu@codeaurora.org> Reviewed-by: NMasahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
- 02 7月, 2018 4 次提交
-
-
由 Chris Packham 提交于
Add defines for the ONFI version bits and use them in nand_flash_detect_onfi(). Signed-off-by: NChris Packham <chris.packham@alliedtelesis.co.nz> Reviewed-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Chris Packham 提交于
This is called after the ONFI parameter page checksum is verified and allows us to override the contents of the parameter page. Suggested-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NChris Packham <chris.packham@alliedtelesis.co.nz> Reviewed-by: NBoris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Stefan Agner 提交于
Allow to define a NAND chip as a boot device. This can be helpful for the selection of the ECC algorithm and strength in case the boot ROM supports only a subset of controller provided options. Signed-off-by: NStefan Agner <stefan@agner.ch> Reviewed-by: NBoris Brezillon <boris.brezillon@bootlin.com> Acked-by: NRob Herring <robh@kernel.org> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
由 Stefan Agner 提交于
Add Reed-Solomon (RS) to the enumeration of ECC algorithms. Signed-off-by: NStefan Agner <stefan@agner.ch> Reviewed-by: NBoris Brezillon <boris.brezillon@bootlin.com> Acked-by: NRob Herring <robh@kernel.org> Signed-off-by: NMiquel Raynal <miquel.raynal@bootlin.com>
-
- 01 6月, 2018 1 次提交
-
-
由 Boris Brezillon 提交于
The NAND sub-layers are likely to need the MTD_OPS_XXX mode information in order to decide if they should enable/disable ECC or how they should place the OOB bytes in the provided OOB buffer. Add a field to nand_page_io_req to pass this information. Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com> Reviewed-by: NMiquel Raynal <miquel.raynal@bootlin.com> Tested-by: NFrieder Schrempf <frieder.schrempf@exceet.de> Reviewed-by: NFrieder Schrempf <frieder.schrempf@exceet.de>
-
- 15 5月, 2018 1 次提交
-
-
由 Geert Uytterhoeven 提交于
The __DIVIDE() macro checks whether it is called with a 32-bit or 64-bit dividend, to select the appropriate divide-and-round-up routine. As the check uses the ternary operator, the result will always be promoted to a type that can hold both results, i.e. unsigned long long. When using this result in a division on a 32-bit system, this may lead to link errors like: ERROR: "__udivdi3" [drivers/mtd/nand/raw/nand.ko] undefined! Fix this by casting the result of the division to the type of the dividend. Fixes: 8878b126 ("mtd: nand: add ->exec_op() implementation") Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com>
-
- 14 5月, 2018 1 次提交
-
-
由 Ben Hutchings 提交于
Commit 9e343e87 ("mtd: cfi: convert inline functions to macros") changed map_word_andequal() into a macro, but also changed the right hand side of the comparison from val3 to val2. Change it back to use val3 on the right hand side. Thankfully this did not cause a regression because all callers currently pass the same argument for val2 and val3. Fixes: 9e343e87 ("mtd: cfi: convert inline functions to macros") Signed-off-by: NBen Hutchings <ben@decadent.org.uk> Signed-off-by: NBoris Brezillon <boris.brezillon@bootlin.com>
-