35fe1b98a0
mtd: nand: ecc-hamming: Create the software Hamming engine
...
Let's continue introducing the generic ECC engine abstraction in the
NAND subsystem by instantiating a second ECC engine: software
Hamming.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200929230124.31491-20-miquel.raynal@bootlin.com
2020-12-10 22:37:30 +01:00
19b2ce184b
mtd: nand: ecc-hamming: Stop using raw NAND structures
...
This code is meant to be reused by the SPI-NAND core. Now that the
driver has been cleaned and reorganized, use a generic ECC engine
object to store the driver's data instead of accessing members of the
nand_chip structure. This means adding proper init/cleanup helpers.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200929230124.31491-17-miquel.raynal@bootlin.com
2020-12-10 22:37:29 +01:00
90ccf0a019
mtd: nand: ecc-hamming: Rename the exported functions
...
Prefix by ecc_sw_hamming_ the functions which should be internal only
but are exported for "raw" operations.
Prefix by nand_ecc_sw_hamming_ the other functions which will be used
in the context of the declaration of an Hamming proper ECC engine
object.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200929230124.31491-16-miquel.raynal@bootlin.com
2020-12-10 22:37:29 +01:00
e5acf9c862
mtd: nand: ecc-hamming: Move Hamming code to the generic NAND layer
...
Hamming ECC code might be later re-used by the SPI NAND layer.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200929230124.31491-12-miquel.raynal@bootlin.com
2020-12-10 22:37:29 +01:00
9994bb3f36
mtd: nand: ecc-bch: Create the software BCH engine
...
Let's continue introducing the generic ECC engine abstraction in the
NAND subsystem by instantiating a first ECC engine: the software
BCH one.
While at it, make a very tidy ecc_sw_bch_init() function and move all
the sanity checks and user input management in
nand_ecc_sw_bch_init_ctx(). This second helper will be called from the
raw RAND core.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200929230124.31491-10-miquel.raynal@bootlin.com
2020-12-10 22:37:26 +01:00
80fe603160
mtd: nand: ecc-bch: Stop using raw NAND structures
...
This code is meant to be reused by the SPI-NAND core. Now that the
driver has been cleaned and reorganized, use a generic ECC engine
object to store the driver's data instead of accessing members of the
nand_chip structure.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200929230124.31491-9-miquel.raynal@bootlin.com
2020-11-30 09:27:33 +01:00
ea146d7fbf
mtd: nand: ecc-bch: Update the prototypes to be more generic
...
These functions must be usable by the main NAND core, so their names
must be technology-agnostic as well as the parameters. Hence, we pass
a generic nand_device instead of a raw nand_chip structure.
As it seems that changing the raw NAND functions to always pass a
generic NAND device is a lost of time, we prefer to create dedicated
raw NAND wrappers that will be useful in the near future to do the
translation.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200929230124.31491-8-miquel.raynal@bootlin.com
2020-11-30 09:27:33 +01:00
127aae6077
mtd: nand: ecc-bch: Drop mtd_nand_has_bch()
...
Like for any other compilation option, use the IS_ENABLED() macro
instead of hardcoding it.
By droping this helper we can get rid of the BCH header in nandsim.c.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200929230124.31491-7-miquel.raynal@bootlin.com
2020-11-30 09:27:33 +01:00
3c0fe36abe
mtd: nand: ecc-bch: Stop exporting the private structure
...
The NAND BCH control structure has nothing to do outside of this
driver, all users of the nand_bch_init/free() functions just save it
to chip->ecc.priv so do it in this driver directly and return a
regular error code instead.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200929230124.31491-5-miquel.raynal@bootlin.com
2020-11-30 09:27:32 +01:00
cdbe8df5e2
mtd: nand: ecc-bch: Move BCH code to the generic NAND layer
...
BCH ECC code might be later re-used by the SPI NAND layer.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200929230124.31491-3-miquel.raynal@bootlin.com
2020-11-30 09:27:32 +01:00
fb8c3810d7
mtd: rawnand: Don't overwrite the error code from nand_set_ecc_soft_ops()
...
The error code received from nand_set_ecc_soft_ops() was overwritten,
drop this redundant assignment and use the error code received from
the callee.
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200917075213.532161-4-tudor.ambarus@microchip.com
2020-09-30 16:44:17 +02:00
6e88127904
mtd: rawnand: Introduce nand_set_ecc_on_host_ops()
...
There were too many levels of indentation and the code was
hard to read. Introduce a new function, similar to
nand_set_ecc_soft_ops().
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200917075213.532161-3-tudor.ambarus@microchip.com
2020-09-30 16:44:17 +02:00
b5156335ac
mtd: rawnand: Use the NAND framework user_conf object for ECC flags
...
Instead of storing the ECC flags in chip->ecc.options, use
nanddev->ecc.user_conf.flags.
There is currently only one to save: NAND_ECC_MAXIMIZE.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200827085208.16276-21-miquel.raynal@bootlin.com
2020-09-30 16:44:15 +02:00
d7157ff49a
mtd: rawnand: Use the ECC framework user input parsing bits
...
Many helpers are generic to all NAND chips, they should not be
raw-NAND specific, so use the generic ones.
To avoid moving all the raw NAND core "history" into the generic NAND
layer, we keep a part of this parsing in the raw NAND core to ensure
backward compatibility.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200827085208.16276-20-miquel.raynal@bootlin.com
2020-09-30 16:44:15 +02:00
8c126720fe
mtd: rawnand: Use the ECC framework nand_ecc_is_strong_enough() helper
...
Plus, the new helper has a more "english" name.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200827085208.16276-19-miquel.raynal@bootlin.com
2020-09-30 16:44:14 +02:00
1e3b37aab9
mtd: rawnand: Use the ECC framework OOB layouts
...
No need to have our own in the raw NAND core.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200827085208.16276-18-miquel.raynal@bootlin.com
2020-09-30 16:43:52 +02:00
c441bcd312
mtd: rawnand: Make use of the ECC framework
...
Just enable the ECC framework with raw NAND so that we can drop, one
by one, all the unnecessary/redundant definitions.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200827085208.16276-17-miquel.raynal@bootlin.com
2020-09-28 15:59:49 +02:00
53576c7bfc
mtd: rawnand: Use nanddev_get/set_ecc_requirements() when relevant
...
Instead of accessing ->strength/step_size directly.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200827085208.16276-15-miquel.raynal@bootlin.com
2020-09-28 15:59:48 +02:00
bace41f80f
mtd: rawnand: Use the new ECC engine type enumeration
...
Mechanical switch from the legacy "mode" enumeration to the new
"engine type" enumeration in drivers and board files.
The device tree parsing is also updated to return the new enumeration
from the old strings.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200827085208.16276-11-miquel.raynal@bootlin.com
2020-09-28 15:59:42 +02:00
ef24f97daa
mtd: rawnand: Separate the ECC engine type and the ECC byte placement
...
The use of "syndrome" placement should not be encoded in the ECC
engine mode/type.
Create a "placement" field in NAND chip and change all occurrences of
the NAND_ECC_HW_SYNDROME enumeration to be just NAND_ECC_HW and
possibly a placement entry like NAND_ECC_PLACEMENT_INTERLEAVED.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200827085208.16276-10-miquel.raynal@bootlin.com
2020-09-28 15:56:34 +02:00
e0a564ae0a
mtd: rawnand: Rename the ECC algorithm enumeration items
...
NAND_ECC_ is not a meaningful prefix, use NAND_ECC_ALGO_ instead.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200827085208.16276-3-miquel.raynal@bootlin.com
2020-08-27 10:55:58 +02:00
35b6bcc970
mtd: rawnand: Allocate the interface configurations dynamically
...
Instead of manipulating the statically allocated structure and copy
timings around, allocate one at identification time and save it in the
nand_chip structure once it has been initialized.
All NAND chips using the same interface configuration during reset and
startup, we define a helper to retrieve a single reset interface
configuration object, shared across all NAND chips.
We use a second pointer to always have a reference on the currently
applied interface configuration, which may either point to the "best
interface configuration" or to the "default reset interface
configuration".
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200529111322.7184-29-miquel.raynal@bootlin.com
2020-06-26 08:35:08 +02:00
a69ad11168
mtd: rawnand: Get rid of the default ONFI timing mode
...
The ->choose_interface() hook is here for manufacturer drivers to
provide a better timing interface than the default one, this field is
not needed anymore.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200529111322.7184-28-miquel.raynal@bootlin.com
2020-06-26 08:35:08 +02:00
26d014f040
mtd: rawnand: Add the ->choose_interface_config() hook
...
This hook can be overloaded by NAND manufacturer drivers to propose
alternative timings when not following the main standards. In this
case, the manufacturer drivers is responsible for choosing the best
interface configuration that fits both the controller and chip
capabilities.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200529111322.7184-23-miquel.raynal@bootlin.com
2020-06-26 08:35:07 +02:00
b5b39f640c
mtd: rawnand: Introduce nand_choose_best_sdr_timings()
...
Extract the logic out of nand_choose_interface_config() to create a
public helper that can be reused by manufacturer drivers. Add the
possibility to provide a specific set of timings.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200529111322.7184-22-miquel.raynal@bootlin.com
2020-06-26 08:35:07 +02:00
42a9ad050e
mtd: rawnand: timings: Make onfi_fill_interface_config() a void helper
...
Warn the user if the parameters are wrong but basically it would mean
there is a serious issue in the NAND core. So no need to ever check
its output, let's make this helper return void.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200529111322.7184-21-miquel.raynal@bootlin.com
2020-06-26 08:35:07 +02:00
4c46667b3d
mtd: rawnand: s/data_interface/interface_config/
...
The name/suffix data_interface is a bit misleading in that the field
or functions actually represent a configuration that can be applied by
the controller/chip. Let's rename all fields/functions/hooks that are
worth renaming.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
2020-06-26 08:35:07 +02:00
e0160cd41f
mtd: rawnand: Hide the chip->data_interface indirection
...
As a preparation for allocating the data interface structure
dynamically (and rename it), let's avoid accessing
chip->data_interface directly.
Instead, we introduce a helper, nand_get_interface_config(), and use
it to retrieve the current data interface configuration out of a
nand_chip object.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200529111322.7184-19-miquel.raynal@bootlin.com
2020-06-26 08:35:06 +02:00
623c0141f5
mtd: rawnand: timings: Provide onfi_fill_data_interface() with a data interface
...
Right now the core uses onfi_fill_data_interface() to initialize the
nand_data_interface object embedded in nand_chip, but we are about to
allocate this object dynamically and let manufacturer drivers provide
their own interface config. Let's patch the onfi_fill_data_interface()
so it can initialize an interface config that's not the one
currently attached to the nand_chip.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200529111322.7184-14-miquel.raynal@bootlin.com
2020-06-26 08:35:05 +02:00
5e179a532a
mtd: rawnand: Rename nand_init_data_interface()
...
This name is a bit misleading, what we do in this helper is trying to
find the best SDR timings supported by the controller and the chip.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200529111322.7184-12-miquel.raynal@bootlin.com
2020-06-26 08:35:05 +02:00
8d69a80f54
mtd: rawnand: Fix nand_setup_data_interface() description
...
This is a copy/paste error and belongs to nand_init_data_interface()
description.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200529111322.7184-11-miquel.raynal@bootlin.com
2020-06-26 08:35:05 +02:00
adcf98b2d8
mtd: rawnand: Rename nand_has_setup_data_iface()
...
This is really a NAND controller hook so call it
nand_controller_can_setup_data_iface(), which makes much more sense.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200529111322.7184-10-miquel.raynal@bootlin.com
2020-06-26 08:35:05 +02:00
fe7f7b0846
mtd: rawnand: Use the data interface mode entry when relevant
...
The data interface setup does not care about the default timing mode
but cares about the actual timing mode at the time of the call of this
helper.
Use this entry instead and let chip->default_timing_mode only be used
at initialization time.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200529111322.7184-9-miquel.raynal@bootlin.com
2020-06-26 08:35:05 +02:00
6ef10df37e
mtd: rawnand: Compare the actual timing values
...
Avoid relying just on the default timing mode to discriminate if the
data interface must be restored. This field should only be used
at initialization time by legacy chips statically defined. Do a
memcmp() instead.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200529111322.7184-8-miquel.raynal@bootlin.com
2020-06-26 08:35:05 +02:00
271de009b7
mtd: rawnand: Rename the manufacturer structure
...
It is currently called nand_manufacturer but could actually be called
nand_manufacturer_desc, like its instances, so that the former name is
left unused for now.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200529111322.7184-5-miquel.raynal@bootlin.com
2020-06-26 08:35:04 +02:00
8e8b2706e1
mtd: rawnand: Create a nand_chip operations structure
...
And move nand_chip hooks there.
While moving entries from one structure to the other, adapt the
documentation style.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200529111322.7184-4-miquel.raynal@bootlin.com
2020-06-26 08:35:04 +02:00
86f2b225ad
mtd: rawnand: Add an invalid ECC mode to discriminate with valid ones
...
NAND ECC modes (or providers) have their own enumeration but, unlike
their algorithms counterpart, there is no invalid or uninitialized
value to discriminate between an error and having chosen a no-ECC
situation. Add an "invalid" entry for this purpose.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200526195633.11543-7-miquel.raynal@bootlin.com
2020-05-31 10:53:41 +02:00
dbc2f2e6d5
mtd: rawnand: Return an enum from of_get_nand_ecc_algo()
...
There is an enumeration to list ECC algorithm, let's use it instead of
returning an int.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200526195633.11543-6-miquel.raynal@bootlin.com
2020-05-31 10:53:41 +02:00
74e24cd237
mtd: rawnand: Drop OOB_FIRST placement scheme
...
This scheme has been introduced for the Davinci controller and means
that the OOB area must be read *before* the rest of the data. This has
nothing to do with the ECC in OOB placement as it could be understood
and most importantly, there is no point in having this function out of
the Davinci NAND controller driver. A DT property for this scheme has
been added but never used, even by the Davinci driver which only uses
this scheme to change the default nand_read_page().
Move the main read_page() helper into the Davinci driver and remove
the remaining boilerplate.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200526195633.11543-4-miquel.raynal@bootlin.com
2020-05-31 10:53:41 +02:00
f66a6fd0dc
mtd: rawnand: Avoid a typedef
...
In new code, the use of typedef is discouraged. Turn this one in the
raw NAND core into a regular enumeration.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200526195633.11543-3-miquel.raynal@bootlin.com
2020-05-31 10:53:41 +02:00
9630a05525
mtd: rawnand: Stop using nand_release()
...
This helper is not very useful and very often people get confused:
they use nand_release() instead of nand_cleanup().
Now that all drivers have been converted to do not use nand_release()
anymore, let's remove this helper.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Cc: Jonathan Corbet <corbet@lwn.net >
Link: https://lore.kernel.org/linux-mtd/20200519130035.1883-63-miquel.raynal@bootlin.com
2020-05-31 10:53:40 +02:00
d7904619ea
mtd: rawnand: Add nand_extract_bits()
...
There are cases where ECC bytes are not byte-aligned. Indeed, BCH
implies using a number of ECC bits, which are not always a multiple of
8. We then need a helper like nand_extract_bits() to extract these
syndromes from a buffer.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200519074549.23673-5-miquel.raynal@bootlin.com
2020-05-24 22:34:55 +02:00
0651ed5082
mtd: rawnand: Ensure the number of bitflips is consistent
...
The main NAND read page function can loop over "page reads" many times
in if the reading reports uncorrectable error(s) and if the chip
supports the read_retry feature.
In this case, the number of bitflips is summarized between
attempts. Fix this by re-initializing the entire mtd_ecc_stats object
each time we retry.
Suggested-by: Boris Brezillon <boris.brezillon@collabora.com >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200519074549.23673-4-miquel.raynal@bootlin.com
2020-05-24 20:48:11 +02:00
e45a4b652d
mtd: rawnand: Fix nand_gpio_waitrdy()
...
Mimic what's done in nand_soft_waitrdy() and add one to the jiffies
timeout so we don't end up waiting less than actually required.
Reported-by: Tudor Ambarus <tudor.ambarus@microchip.com >
Fixes: b0e137ad24
("mtd: rawnand: Provide helper for polling GPIO R/B pin")
Cc: <stable@vger.kernel.org >
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com >
Reviewed-by: Tudor Ambarus <tudor.ambarus@microchip.com >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200518155237.297549-1-boris.brezillon@collabora.com
2020-05-24 20:39:50 +02:00
1f1ec62262
mtd: rawnand: Propage CS selection to sub operations
...
Some controller using the instruction parse infrastructure might need
to know which CS a specific sub-operation is targeting. Let's propagate
this information.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com >
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200505101353.1776394-2-boris.brezillon@collabora.com
2020-05-24 20:39:27 +02:00
ec7cfc3d76
mtd: rawnand: Add a NAND_NO_BBM_QUIRK flag
...
Some controllers with embedded ECC engines override the BBM marker with
data or ECC bytes, thus making bad block detection through bad block
marker impossible. Let's flag those chips so the core knows it shouldn't
check the BBM and consider all blocks good.
This should allow us to get rid of two implementers of the
legacy.block_bad() hook.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200511064917.6255-1-boris.brezillon@collabora.com
2020-05-11 09:51:43 +02:00
0e7f4b64ea
mtd: rawnand: Allow controllers to overload soft ECC hooks
...
Some controller drivers do not support executing regular
nand_read/write_page_raw() helpers. For that, we created
nand_monolithic_read/write_page_raw() alternatives. Let's now allow
the driver to overload the ECC ->read/write_page_raw() hooks.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200507105241.14299-13-miquel.raynal@bootlin.com
2020-05-11 09:51:43 +02:00
658beb6639
mtd: rawnand: Expose monolithic read/write_page_raw() helpers
...
The current nand_read/write_page_raw() helpers are already widely used
but do not fit the purpose of "constrained" controllers which cannot,
for instance, separate command/address cycles with data cycles.
Workaround this issue by proposing alternative helpers that can be
used by these controller drivers instead.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200507105241.14299-12-miquel.raynal@bootlin.com
2020-05-11 09:51:43 +02:00
b451f5beec
mtd: rawnand: Give the possibility to verify a read operation is supported
...
This can be used to discriminate between two path in the parameter
page detection: use data_in cycles (like before) if supported, use the
CHANGE READ COLUMN command otherwise.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200507105241.14299-9-miquel.raynal@bootlin.com
2020-05-11 09:51:42 +02:00
21b5cf3f64
mtd: rawnand: Avoid indirect access to ->data_buf()
...
The logic in nand_do_read_ops() is to use a bufpoi variable, either
set to the original buffer, or set to a bounce buffer which in the end
happens to be chip->data_buf depending on the value of the
use_bounce_buf boolean. This is not a reason to call chip->data_buf
directly when we know that we are using the bounce buffer. Let's use
bufpoi instead to be consistent.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200507105241.14299-7-miquel.raynal@bootlin.com
2020-05-11 09:51:42 +02:00