Boris Brezillon
4f426e6e07
mtd: rawnand: davinci: Stop using nand_chip.legacy.IO_ADDR_{R, W}
...
We can use info->current_cs directly instead of doing this weird
IO_ADDR_{R,W} re-assignment dance.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com >
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com >
Tested-by: Bartosz Golaszewski <bgolaszewski@baylibre.com >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200513172248.141402-2-boris.brezillon@collabora.com
2020-05-24 20:39:43 +02:00
Boris Brezillon
3626fdcf09
mtd: rawnand: davinci: Inherit from nand_controller
...
Let's not rely on the dummy_controller embedded in nand_chip.legacy
and explicitly inherit from nand_controller instead.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com >
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com >
Tested-by: Bartosz Golaszewski <bgolaszewski@baylibre.com >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200513172248.141402-1-boris.brezillon@collabora.com
2020-05-24 20:39:41 +02:00
Álvaro Fernández Rojas
dcb351c03f
mtd: rawnand: brcmnand: correctly verify erased pages
...
The current code checks that the whole OOB area is erased.
This is a problem when JFFS2 cleanmarkers are added to the OOB, since it will
fail due to the usable OOB bytes not being 0xff.
Correct this by only checking that data and ECC bytes aren't 0xff.
Fixes: 02b88eea9f ("mtd: brcmnand: Add check for erased page bitflips")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200512082451.771212-1-noltari@gmail.com
2020-05-24 20:39:39 +02:00
Álvaro Fernández Rojas
d00358d7a1
mtd: rawnand: brcmnand: improve hamming oob layout
...
The current code generates 8 oob sections:
S1 1-5
ECC 6-8
S2 9-15
S3 16-21
ECC 22-24
S4 25-31
S5 32-37
ECC 38-40
S6 41-47
S7 48-53
ECC 54-56
S8 57-63
Change it by merging continuous sections:
S1 1-5
ECC 6-8
S2 9-21
ECC 22-24
S3 25-37
ECC 38-40
S4 41-53
ECC 54-56
S5 57-63
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200512075733.745374-3-noltari@gmail.com
2020-05-24 20:39:37 +02:00
Álvaro Fernández Rojas
130bbde480
mtd: rawnand: brcmnand: fix hamming oob layout
...
First 2 bytes are used in large-page nand.
Fixes: ef5eeea6e9 ("mtd: nand: brcm: switch to mtd_ooblayout_ops")
Cc: stable@vger.kernel.org
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200512075733.745374-2-noltari@gmail.com
2020-05-24 20:39:34 +02:00
Miquel Raynal
2d1b77281f
MAINTAINERS: Remove Xiaolei Li and mark MTK NFC as orphaned
...
Xiaolei's address is bouncing, remove him from MAINTAINERS and mark
the driver he was maintaining, Mediatek's, as orphaned.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200510211809.15610-2-miquel.raynal@bootlin.com
2020-05-24 20:39:32 +02:00
Miquel Raynal
0584d02582
MAINTAINERS: Remove Piotr Sroka and mark Cadence NFC as orphaned
...
Piotr's address is bouncing, remove him from MAINTAINERS and mark the
driver he was maintaining, Cadence's, as orphaned.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200510211809.15610-1-miquel.raynal@bootlin.com
2020-05-24 20:39:30 +02:00
Boris Brezillon
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
Christophe Kerello
699d3e6a87
mtd: rawnand: stm32_fmc2: use FIELD_PREP/FIELD_GET macros
...
This patch removes custom macros and uses FIELD_PREP and FIELD_GET macros.
Signed-off-by: Christophe Kerello <christophe.kerello@st.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/1589284068-4079-3-git-send-email-christophe.kerello@st.com
2020-05-24 20:29:26 +02:00
Christophe Kerello
743f05572e
mtd: rawnand: stm32_fmc2: cosmetic change to use nfc instead of fmc2 where relevant
...
This patch renames functions and local variables.
This cleanup is done to get all functions starting by stm32_fmc2_nfc
in the FMC2 raw NAND driver when all functions will start by
stm32_fmc2_ebi in the FMC2 EBI driver.
Signed-off-by: Christophe Kerello <christophe.kerello@st.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/1589284068-4079-2-git-send-email-christophe.kerello@st.com
2020-05-24 20:29:24 +02:00
Christophe Kerello
0185d50c52
mtd: rawnand: stm32_fmc2: use FMC2_TIMEOUT_MS for timeouts
...
This patch removes the constant FMC2_TIMEOUT_US.
FMC2_TIMEOUT_MS will be used each time that we need to wait (except
when the timeout value is set by the framework).
It was seen, during stress tests with the sequencer in an overloaded
system, that we could be close to 1 second, even if we never met this
value. To be safe, FMC2_TIMEOUT_MS is set to 5 seconds.
Signed-off-by: Christophe Kerello <christophe.kerello@st.com >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/1588756279-17289-4-git-send-email-christophe.kerello@st.com
2020-05-11 21:45:18 +02:00
Christophe Kerello
2d3d54bf12
mtd: rawnand: stm32_fmc2: remove useless inline comments
...
Remove inline comments that are useless since function label are
self explanatory.
Signed-off-by: Christophe Kerello <christophe.kerello@st.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/1588756279-17289-3-git-send-email-christophe.kerello@st.com
2020-05-11 21:45:16 +02:00
Christophe Kerello
71d1f1d595
mtd: rawnand: stm32_fmc2: manage all errors cases at probe time
...
This patch defers its probe when the expected reset control is not
yet ready. This patch also handles properly all errors cases at probe
time.
Signed-off-by: Christophe Kerello <christophe.kerello@st.com >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/1588756279-17289-2-git-send-email-christophe.kerello@st.com
2020-05-11 21:45:13 +02:00
Boris Brezillon
d8ef2b73a4
mtd: rawnand: diskonchip: Get rid of the legacy interface implementation
...
Now that exec_op() has been implemented we can get rid of the legacy
interface implementation.
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/20200501143917.1388957-6-boris.brezillon@collabora.com
2020-05-11 09:51:44 +02:00
Boris Brezillon
f46eb7affb
mtd: rawnand: diskonchip: Implement exec_op()
...
Implement exec_op() so we can later get rid of the legacy
implementation.
It's worth noting that the new implementation assert/deassert the CE
pin on each operation, which might not be necessary. We also dropped
the extra reset done at chip selection time on DOC2001plus. If it's
needed we really should do something smarter, because having a reset
everytime we access the chip is not that great perf-wise.
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/20200501143917.1388957-5-boris.brezillon@collabora.com
2020-05-11 09:51:43 +02:00
Boris Brezillon
f37b1d3c8f
mtd: rawnand: diskonchip: Inherit from nand_controller
...
Stop relying on the dummy controller object embedded in nand_chip.legacy
and explicitly inherit from nand_controller.
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/20200501143917.1388957-4-boris.brezillon@collabora.com
2020-05-11 09:51:43 +02:00
Boris Brezillon
fddf5cec1c
mtd: rawnand: diskonchip: Get rid of doc2000_readbuf_dword()
...
The logic can easily be merged in doc2000_readbuf().
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/20200501143917.1388957-3-boris.brezillon@collabora.com
2020-05-11 09:51:43 +02:00
Boris Brezillon
a50b0c20be
mtd: rawnand: diskonchip: Make sure doc2001plus_readbuf() works for single byte reads
...
Single byte accesses normally go through read_byte() but we are about
to use this function in the exec_op() implementation and thus needs to
prepare for single byte reads.
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/20200501143917.1388957-2-boris.brezillon@collabora.com
2020-05-11 09:51:43 +02:00
Boris Brezillon
dace12ccfd
mtd: rawnand: diskonchip: Set the NAND_NO_BBM_QUIRK flag
...
We have a dummy block_bad() implementation returning 0. Let's set the
NAND_NO_BBM_QUIRK flag and let the core take care of that.
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/20200511064917.6255-3-boris.brezillon@collabora.com
2020-05-11 09:51:43 +02:00
Boris Brezillon
8420c68a16
mtd: rawnand: cafe: Set the NAND_NO_BBM_QUIRK flag
...
We have a dummy block_bad() implementation returning 0. Let's set the
NAND_NO_BBM_QUIRK flag and let the core take care of that.
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/20200511064917.6255-2-boris.brezillon@collabora.com
2020-05-11 09:51:43 +02:00
Boris Brezillon
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
Miquel Raynal
22dc5f9d49
mtd: rawnand: micron: Allow controllers to overload raw accessors
...
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 when
these hooks are supported.
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-14-miquel.raynal@bootlin.com
2020-05-11 09:51:43 +02:00
Miquel Raynal
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
Miquel Raynal
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
Miquel Raynal
daca31765e
mtd: rawnand: jedec: Adapt the parameter page read to constraint controllers
...
We already know that there are controllers not able to read the three
copies of the parameter page in one go. The workaround was to first
request the controller to assert command and address cycles on the
NAND bus to trigger a parameter page read, and then do a read
operation for each page.
But there are also controllers which are not able to split the
parameter page read between the command/address cycles and the actual
data operation.
Let's use a regular PARAMETER PAGE READ operation for the first
iteration and use eithe a CHANGE READ COLUMN or a simple DATA READ
operation for the following copies, depending on what the controller
supports. The default for non-exec-op compliant drivers remains
unchanged: use a SIMPLE READ.
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-11-miquel.raynal@bootlin.com
2020-05-11 09:51:43 +02:00
Miquel Raynal
c27842e7e1
mtd: rawnand: onfi: Adapt the parameter page read to constraint controllers
...
We already know that there are controllers not able to read the three
copies of the parameter page in one go. The workaround was to first
request the controller to assert command and address cycles on the
NAND bus to trigger a parameter page read, and then do a simple read
operation for each page.
But there are also controllers which are not able to split the
parameter page read between the command/address cycles and the actual
data operation.
Let's use a regular PARAMETER PAGE READ operation for the first
iteration and use either a CHANGE READ COLUMN or a simple DATA READ
operation for the following copies, depending on what the controller
supports. The default behavior for non-exec-op compliant drivers
remains the same: DATA READ.
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-10-miquel.raynal@bootlin.com
2020-05-11 09:51:43 +02:00
Miquel Raynal
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
Miquel Raynal
930370253e
mtd: rawnand: Add a helper to check supported operations
...
Let's use a helper to clearly check if an operation is supported or not.
Return -ENOTSUPP when ->exec_op() is not implemented as we cannot know.
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-8-miquel.raynal@bootlin.com
2020-05-11 09:51:42 +02:00
Miquel Raynal
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
Miquel Raynal
6446907307
mtd: rawnand: Rename the use_bufpoi variables
...
Both in nand_do_read_ops() and nand_do_write_ops() there is a boolean
called use_bufpoi which is set to true in case of unaligned request or
when there is a need for a DMA-able buffer. It basically means "use a
bounce buffer".
Depending on the value of use_bufpoi, the bufpoi variable is always
used and will either point to the original buffer or to the nand_chip
structure "internal data buffer" (this buffer is allocated with
kmalloc() on purpose so that it will be DMA-compliant).
In all cases bufpoi is used so the boolean name is misleading. Rename
use_bufpoi to be use_bouce_buf to be more accurate.
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-6-miquel.raynal@bootlin.com
2020-05-11 09:51:42 +02:00
Miquel Raynal
2f959949f2
mtd: rawnand: Fix comments about the use of bufpoi
...
Clarify these comments which are not very accurate (even wrong in the
read case).
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-5-miquel.raynal@bootlin.com
2020-05-11 09:51:42 +02:00
Miquel Raynal
ce8148d7b8
mtd: rawnand: Rename a NAND chip option
...
NAND controller drivers can set the NAND_USE_BOUNCE_BUFFER flag to a
chip 'option' field. With this flag, the core is responsible of
providing DMA-able buffers.
The current behavior is to not force the use of a bounce buffer when
the core thinks this is not needed. So in the end the name is a bit
misleading, because in theory we will always have a DMA buffer but in
practice it will not always be a bounce buffer.
Rename this flag NAND_USES_DMA to be more accurate.
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-4-miquel.raynal@bootlin.com
2020-05-11 09:51:42 +02:00
Miquel Raynal
96d627bdf1
mtd: rawnand: Reorder the nand_chip->options flags
...
These flags are in a strange order, reorder the list, add spaces when
it is relevant, pack definitions that are related.
There is no functional change.
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-3-miquel.raynal@bootlin.com
2020-05-11 09:51:42 +02:00
Miquel Raynal
dd6ed5c989
mtd: rawnand: Translate obscure bitfields into readable macros
...
Use the BIT() macro instead of defining a 8-digit value.
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-2-miquel.raynal@bootlin.com
2020-05-11 09:51:42 +02:00
Boris Brezillon
66aaba3a07
ubi: Relax the 'no MLC' rule and allow MLCs operating in SLC mode
...
The MTD layer provides an SLC mode (purely software emulation of SLC
behavior) addressing the paired-pages corruption issue, which was the
main reason for refusing attaching MLC NANDs to UBI.
Relax this rule and allow partitions that have the
MTD_EMULATE_SLC_ON_MLC flag set to be attached.
Signed-off-by: Boris Brezillon <bbrezillon@kernel.org >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Acked-by: Richard Weinberger <richard@nod.at >
Link: https://lore.kernel.org/linux-mtd/20200503155341.16712-9-miquel.raynal@bootlin.com
2020-05-11 09:51:42 +02:00
Boris Brezillon
568d841b68
mtd: cmdlinepart: Add an slc option to use SLC mode on a part
...
Add a new option to set the MTD_SLC_ON_MLC_EMULATION flag.
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200503155341.16712-8-miquel.raynal@bootlin.com
2020-05-11 09:51:42 +02:00
Boris Brezillon
1998053c8e
mtd: partitions: ofpart: Parse the slc-mode property
...
Parse the slc-mode property and set the MTD_MLC_IN_SLC_MODE flag
when present.
Signed-off-by: Boris Brezillon <bbrezillon@kernel.org >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200503155341.16712-7-miquel.raynal@bootlin.com
2020-05-11 09:51:42 +02:00
Boris Brezillon
422928a040
dt-bindings: mtd: partition: Document the slc-mode property
...
Add a boolean property to force a specific partition attached to an MLC
NAND to be accessed in an emulated SLC mode this making this partition
immune to paired-pages corruptions.
Signed-off-by: Boris Brezillon <bbrezillon@kernel.org >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200503155341.16712-6-miquel.raynal@bootlin.com
2020-05-11 09:51:41 +02:00
Boris Brezillon
9e3307a169
mtd: Add support for emulated SLC mode on MLC NANDs
...
MLC NANDs can be made a bit more reliable if we only program the lower
page of each pair. At least, this solves the paired-pages corruption
issue.
Signed-off-by: Boris Brezillon <bbrezillon@kernel.org >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200503155341.16712-5-miquel.raynal@bootlin.com
2020-05-11 09:51:41 +02:00
Boris Brezillon
d652f3a5bd
mtd: rawnand: toshiba: Set the pairing scheme for TC58TEG5DCLTA00
...
TC58TEG5DCLTA00 uses a stride of 3 between its lower and upper page.
Set the appropriate pairing scheme at init time.
Signed-off-by: Boris Brezillon <bbrezillon@kernel.org >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200503155341.16712-4-miquel.raynal@bootlin.com
2020-05-11 09:51:41 +02:00
Boris Brezillon
18729b1776
mtd: rawnand: Define the "distance 3" MLC pairing scheme
...
Define a new page pairing scheme for MLC NANDs with a distance of 3
pages between the lower and upper page.
Signed-off-by: Boris Brezillon <bbrezillon@kernel.org >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200503155341.16712-3-miquel.raynal@bootlin.com
2020-05-11 09:51:41 +02:00
Boris Brezillon
5338ef99c9
mtd: rawnand: toshiba: Add a specific init for TC58TEG5DCLTA00
...
TC58TEG5DCLTA00 is an MLC NAND which requires scrambling and supports
SDR timings mode 5.
Signed-off-by: Boris Brezillon <bbrezillon@kernel.org >
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Link: https://lore.kernel.org/linux-mtd/20200503155341.16712-2-miquel.raynal@bootlin.com
2020-05-11 09:51:41 +02:00
Boris Brezillon
51b71ac092
mtd: rawnand: cs553x: Get rid of the legacy interface implementation
...
Now that exec_op() is implemented we no longer need to implement the
legacy hooks.
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/20200501090650.1138200-5-boris.brezillon@collabora.com
2020-05-11 09:51:41 +02:00
Boris Brezillon
b4ed6328b9
mtd: rawnand: cs553x: Implement exec_op()
...
So we can later get rid of the legacy hooks.
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/20200501090650.1138200-4-boris.brezillon@collabora.com
2020-05-11 09:51:41 +02:00
Boris Brezillon
ba03e48339
mtd: rawnand: cs553x: Stop using chip->legacy.IO_ADDR_{R, W}
...
Now that we have our own controller struct we can keep the MMIO pointer
in there and use instead of using the chip->legacy.IO_ADDR_{R,W} fields.
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/20200501090650.1138200-3-boris.brezillon@collabora.com
2020-05-11 09:51:41 +02:00
Boris Brezillon
c9e1817ff9
mtd: rawnand: cs553x: Declare controllers instead of NAND chips
...
The CS553x companion chip embeds 4 NAND controllers. Declare them as
NAND controllers instead of NAND chips. That's done in preparation
of the transition to exec_op().
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/20200501090650.1138200-2-boris.brezillon@collabora.com
2020-05-11 09:51:41 +02:00
Miquel Raynal
432ab89d30
mtd: rawnand: jedec: Use intermediate variables to improve readability
...
Before reworking a little bit the JEDEC detection code, let's
clean the coding style of an if statement to improve readability.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200428094302.14624-10-miquel.raynal@bootlin.com
2020-05-11 09:51:41 +02:00
Miquel Raynal
2e8f56f2a9
mtd: rawnand: jedec: Define the number of parameter pages
...
Use a macro to define the number of parameter page instead of
hardcoding it everywhere.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200428094302.14624-9-miquel.raynal@bootlin.com
2020-05-11 09:51:40 +02:00
Miquel Raynal
6e9c65d87c
mtd: rawnand: onfi: Drop a useless parameter page read
...
During detection the logic on the NAND bus is:
/* Regular ONFI detection */
1/ read the three NAND parameter pages
/* Extended parameter page detection */
2/ send "read the NAND parameter page" commands without reading
actual data
3/ move the column pointer to the extended page and read it
If fact, as long as there is nothing happening on the NAND bus between
1/ and 3/, the operation 2/ is redundant so remove it.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200428094302.14624-8-miquel.raynal@bootlin.com
2020-05-11 09:51:40 +02:00
Miquel Raynal
7e928263fc
mtd: rawnand: onfi: Avoid doing a copy of the parameter page
...
There is no need for copying the parameter page, playing with
pointers does the trick.
There is not functional change.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com >
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com >
Link: https://lore.kernel.org/linux-mtd/20200428094302.14624-7-miquel.raynal@bootlin.com
2020-05-11 09:51:40 +02:00