Age | Commit message (Collapse) | Author | Files | Lines |
|
Implement raw OOB access functions to retrieve OOB bytes when accessing the
NAND in raw mode.
Signed-off-by: Boris Brezillon <[email protected]>
Tested-by: Huang Shijie <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
Several MTD users (either in user or kernel space) expect a valid raw
access support to NAND chip devices.
This is particularly true for testing tools which are often touching the
data stored in a NAND chip in raw mode to artificially generate errors.
The GPMI drivers do not implemenent raw access functions, and thus rely on
default HW_ECC scheme implementation.
The default implementation consider the data and OOB area as properly
separated in their respective NAND section, which is not true for the GPMI
controller.
In this driver/controller some OOB data are stored at the beginning of the
NAND data area (these data are called metadata in the driver), then ECC
bytes are interleaved with data chunk (which is similar to the
HW_ECC_SYNDROME scheme), and eventually the remaining bytes are used as
OOB data.
Signed-off-by: Boris Brezillon <[email protected]>
Tested-by: Huang Shijie <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
Add a new function to copy bits (not bytes) from a memory region to
another one.
This function is similar to memcpy except it acts at bit level.
It is needed to implement GPMI raw access functions and adapt to the
hardware ECC engine which does not pad ECC bits to the next byte boundary.
Signed-off-by: Boris Brezillon <[email protected]>
Tested-by: Huang Shijie <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
write_enable() was being duplicated to both m25p80.c and fsl-quadspi.c.
But this should be handled within the spi-nor abstraction layer.
At the same time, let's add write_disable() after erasing, so we don't
leave the flash in a write-enabled state afterward.
Signed-off-by: Brian Norris <[email protected]>
Acked-by: Huang Shijie <[email protected]>
|
|
We need to store the six bytes ID for s25fl128s, since it shares the same
five bytes with s25fl129p1.
This patch adds a macro INFO6 which is used for the six bytes ID flash, and adds
a new item for the s25fl128s.
Signed-off-by: Huang Shijie <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
The "id" array contains all the information about the JEDEC and the
manufacturer ID info. This patch removes the jedec_id/ext_id from
flash_info.
Signed-off-by: Huang Shijie <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
This patch adds the id/id_len fields for flash_info{}, and rewrite the
INFO to fill them. And at last, we read out 6 bytes in the spi_nor_read_id(),
and we use these new fields to parse out the correct flash_info.
Signed-off-by: Huang Shijie <[email protected]>
Signed-off-by: Rafał Miłecki <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
Signed-off-by: Gu Zheng <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
Signed-off-by: Geert Uytterhoeven <[email protected]>
Cc: David Woodhouse <[email protected]>
Cc: [email protected]
Signed-off-by: Brian Norris <[email protected]>
|
|
There is no need to use memcpy32_toio/memcpy32_fromio to transfer data
between memory and NFC sram. As the NFC sram is a also a memory space
not an I/O space, we can just use memcpy().
We remove the __iomem prefix for NFC sram to avoid sparse warnings.
Signed-off-by: Josh Wu <[email protected]>
Reviewed-by: Brian Norris <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
This write_page() function is functionally equivalent to the default in
nand_base.c. Its only difference is in subpage programming support,
which cafe_nand.c does not advertise, so the difference is negligible.
Signed-off-by: Brian Norris <[email protected]>
|
|
Signed-off-by: Knut Wohlrab <[email protected]>
Signed-off-by: Alison Chaiken <[email protected]>
Reviewed-by: Jagannadha Sutradharudu Teki <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
As stated in a5b7616c5, "mtd: m25p80,spi-nor: Fix module aliases for
m25p80", m25p_ids[] in m25p80.c needs to be kept in sync with
spi_nor_ids[] in spi-nor.c. The change here corrects a misalignment.
(We were missing m25px80 and we had a duplicate w25q128.)
Signed-off-by: Alison Chaiken <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
Cc: <[email protected]> # 3.18+
|
|
There are a few small issues with the timeout loop in
spi_nor_wait_till_ready():
* The first operation should not be a reschedule; we should check the
status register at least once to see if we're complete!
* We should check the status register one last time after declaring the
deadline has passed, to prevent a premature timeout error (this is
theoretically possible if we sleep for a long time after the previous
status register check).
* Add an error message, so it's obvious if we ever hit a timeout.
Signed-off-by: Brian Norris <[email protected]>
Acked-by: Huang Shijie <[email protected]>
Reviewed-by: Ezequiel Garcia <[email protected]>
|
|
The functions kfree() and pci_dev_put() test whether their argument is NULL
and then return immediately. Thus the test around the call is not needed.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
3430LDP has NAND flash with 32 bytes OOB size which is sufficient to hold
BCH8 codes but the small page check introduced in
commit b491da7233d5 ("mtd: nand: omap: clean-up ecc layout for BCH ecc schemes")
considers anything below 64 bytes unsuitable for BCH4/8/16. There is another
bug in that code where it doesn't skip the check for OMAP_ECC_HAM1_CODE_SW.
Get rid of that small page check code as it is insufficient and redundant
because we are checking for OOB available bytes vs ecc layout before calling
nand_scan_tail().
Fixes: b491da7233d5 ("mtd: nand: omap: clean-up ecc layout for BCH ecc schemes")
Reported-by: Tony Lindgren <[email protected]>
Signed-off-by: Roger Quadros <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
Tested with ATO AFND1G08U3, 128MiB NAND.
Signed-off-by: Brian Norris <[email protected]>
|
|
It may be useful info, e.g. if someone wants to use ubinize.
Signed-off-by: Rafał Miłecki <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
Fixes warning:
drivers/mtd/tests/oobtest.c: In function 'memcmpshow':
drivers/mtd/tests/oobtest.c:129: warning: format '%x' expects type 'unsigned int', but argument 3 has type 'size_t'
Signed-off-by: Brian Norris <[email protected]>
Cc: Roger Quadros <[email protected]>
Cc: Sekhar Nori <[email protected]>
|
|
read_page_raw and write_page_raw method description is not clear enough.
It clearly specifies that ECC correction should not be involved but does
not talk about specific layout (by layout I mean where in-band and
out-of-band data are stored on the NAND media) used by NAND/ECC
controllers.
Those specific layouts might impact MTD users and thus should be hidden (as
already done in the standard NAND_ECC_HW_SYNDROME implementation).
Clearly state this constraint in the nand_ecc_ctrl struct documentation.
Signed-off-by: Boris Brezillon <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
It is common for NAND devices to have bitflip errors.
Add a bitflip_limit parameter to specify how many bitflips per
page we can tolerate without flagging an error.
By default zero bitflips are tolerated.
Signed-off-by: Roger Quadros <[email protected]>
Signed-off-by: Sekhar Nori <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
Add a function memcmpshow() that compares the 2 data buffers
and shows the address:offset and data bytes on comparison failure.
This function does not break at a comparison failure but runs the
check for the whole data buffer.
Use memcmpshow() instead of memcmp() for all the verification paths.
Signed-off-by: Roger Quadros <[email protected]>
Signed-off-by: Sekhar Nori <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
Freescale's QorIQ T Series processors support 8 IFC chip selects
within a memory map backward compatible with previous P Series
processors which supported only 4 chip selects.
Signed-off-by: Aaron Sierra <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
If there is no PMECC lookup table stored in ROM, or lookup table offset is
not specified, PMECC driver should build it in DDR by itself.
That make the PMECC driver work for some board which doesn't have PMECC
lookup table in ROM.
The PMECC use the BCH algorithm, so based on the build_gf_tables()
function in lib/bch.c, we can build the Galois Field lookup table.
For more information can refer to section 5.4 of PMECC controller
application note:
http://www.atmel.com/images/doc11127.pdf
Signed-off-by: Josh Wu <[email protected]>
Cc: [email protected]
Signed-off-by: Brian Norris <[email protected]>
|
|
The driver was also using own method to do 32bit copy, turns out
we have a kernel API so use that instead
Signed-off-by: Vinod Koul <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
The ->PUtable[] array has "->nb_blocks" number of elemetns so this
comparison should be ">=" instead of ">". Otherwise it could result in
a minor read beyond the end of an array.
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
Add sst25wf080 to the spi-nor device id table.
Signed-off-by: Harini Katakam <[email protected]>
Reviewed-by: Peter Crosthwaite <[email protected]>
Signed-off-by: Michal Simek <[email protected]>
Acked-by: Marek Vasut <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
Tested with this particular FRAM chip
Signed-off-by: Rostislav Lisovy <[email protected]>
Acked-by: Marek Vasut <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
The AM335x Technical Reference Manual (spruh73j.pdf) says
"Because the ECC engine includes only one accumulation context,
it can be allocated to only one chip-select at a time ... "
(7.1.3.3.12.3). Since the commit 97a288ba2cfa ("ARM: omap2+:
gpmc-nand: Use dynamic platform_device_alloc()") gpmc-nand
driver supports multiple NAND flash devices connected to
the single controller.
Use global 'struct nand_hw_control' among multiple NAND
instances to synchronize the access to the single ECC Engine.
Tested with custom AM335x board using 2x NAND flash chips.
Signed-off-by: Rostislav Lisovy <[email protected]>
Acked-by: Roger Quadros <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
Because n25q032 is the Micron SPI chip, move it to Micron
devices list group. In order that know which Micron SPI
chips have been support at a glance.
Signed-off-by: Chunhe Lan <[email protected]>
Cc: Brian Norris <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Huang Shijie <[email protected]>
Acked-by: Marek Vasut <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
We are trying to remove the legacy tx_dma and rx_dma fields from the
spi_transfer structure. Currently dataflash uses tx_dma but only to make
sure that it's set to 0 so we can remove this use by replacing with a
zero initialisation of the entire spi_transfer struct.
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
We don't need to expose a 'wait-till-ready' interface to drivers. Status
register polling should be handled by the core spi-nor.c library, and as
of now, I see no need to provide a special driver-specific hook for it.
Signed-off-by: Brian Norris <[email protected]>
Reviewed-by: Marek Vasut <[email protected]>
|
|
spi-nor.c should be taking care of these now.
Signed-off-by: Brian Norris <[email protected]>
Cc: Huang Shijie <[email protected]>
Reviewed-by: Marek Vasut <[email protected]>
|
|
spi-nor.c should be taking care of these now.
Signed-off-by: Brian Norris <[email protected]>
Reviewed-by: Marek Vasut <[email protected]>
|
|
We shouldn't have *every* function checking if a previous write is
complete; this should be done synchronously after each write/erase.
Signed-off-by: Brian Norris <[email protected]>
Reviewed-by: Marek Vasut <[email protected]>
|
|
The error label was unused here. It looks like we're missing at least
one case that should be doing 'goto write_err'.
Signed-off-by: Brian Norris <[email protected]>
Reviewed-by: Marek Vasut <[email protected]>
Acked-by: Huang Shijie <[email protected]>
|
|
These functions were near-carbon-copies due to a small per-flash quirk.
Let's add a new spi_nor::flags bitfield to support these types of
quirks.
Signed-off-by: Brian Norris <[email protected]>
Reviewed-by: Marek Vasut <[email protected]>
Cc: Graham Moore <[email protected]>
Cc: Huang Shijie <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
The help text of CONFIG_MTD_OF_PARTS refers to additional documentation
in booting-without-of.txt but this documentation was moved to another
file in commit efcc2da3fd148c9acb7d7cf1d9800e0649f950fc (Stefan Roese:
Factor MTD physmap bindings out of booting-without-of). This updates the
help text to point to the right place.
Signed-off-by: Michal Sojka <[email protected]>
[Brian: fixed doc reference]
Signed-off-by: Brian Norris <[email protected]>
|
|
update a comment in nand_command_lp() about specific requirements of
individual commands, the DEPLETE1 command was removed in the past and
the comment no longer applied
Signed-off-by: Gerhard Sittig <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
For the DDR Quad read, the dummy cycles maybe 3 or 6 which is less then 8.
The dummy cycles is actually 8 for SPI fast/dual/quad read.
This patch makes preparations for the DDR quad read, it fixes the wrong dummy
value for both the spi-nor.c and m25p80.c.
Signed-off-by: Huang Shijie <[email protected]>
Acked-by: Marek Vasut <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
NAND devices with page sizes over 4 KiB require more than 4-bits of ECC
coverage. This patch calculates the value of ecc_bytes based on a still
assumed 512-byte step size (13-bits) and the ecc_strength.
Example:
Micron M73A devices (8 KiB page) require 8-bit ECC per 512-byte
Signed-off-by: Jordan Friendshuh <[email protected]>
Signed-off-by: Aaron Sierra <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
The drivers/mtd/nand/gpio.c driver does not GPIO bitbang the complete
NAND protocol, but instead is GPIO _assisted_ -- a memory mapped interface
communicates commands and data, and only few control signals are connected
to GPIO pins.
Expand comments in the driver source and in the Kconfig description to
better reflect the very nature of the driver. The previous text could be
mistaken for complete GPIO bitbanging.
Signed-off-by: Gerhard Sittig <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
Expand the description of the 'gpios' property in the GPIO assisted
NAND flash binding, to explicitly list the required GPIO pin references
and their order.
Update the example section to individually bracket the GPIO references,
and capitalize the signal names for improved readability.
Signed-off-by: Gerhard Sittig <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
To keep the two paths in sync
|
|
After '#echo mem > /sys/power/state' some devices can not be properly resumed
because apparently the MTD Partition Configuration Register has been reset
to default thus the rootfs cannot be mounted cleanly on resume.
An example of this can be found in the SA-1100 Developer's Manual at 9.5.3.3
where the second step of the Sleep Shutdown Sequence is described:
"An internal reset is applied to the SA-1100. All units are reset...".
As workaround we refresh the PCR value as done initially on chip setup.
This behavior and the fix are confirmed by our tests done on 2 different Zaurus
collie units with kernel 3.17.
Fixes: 812c5fa82bae: ("mtd: cfi_cmdset_0001.c: add support for Sharp LH28F640BF NOR")
Signed-off-by: Dmitry Eremin-Solenikov <[email protected]>
Signed-off-by: Andrea Adami <[email protected]>
Cc: <[email protected]> # 3.16+
Signed-off-by: Brian Norris <[email protected]>
|
|
Since commit 6d178ef2fd5e ("mtd: nand: Move ELM driver and rename as
omap_elm"), I don't have any mtd devices present on my am335x. This
changes the link order of the omap_elm and omap2 objects, causing them
to probe in the wrong order.
To fix this, make elm_config defer probing until the omap_elm driver is
actually loaded.
Signed-off-by: Frans Klaver <[email protected]>
Acked-by: Roger Quadros <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
Add the sunxi NAND Flash Controller dt bindings documentation.
Signed-off-by: Boris Brezillon <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
Add support for the sunxi NAND Flash Controller (NFC).
Signed-off-by: Boris Brezillon <[email protected]>
[Brian: tweaked to fix ecc->steps issue]
Signed-off-by: Brian Norris <[email protected]>
|
|
nandsim can simulate NAND Flash which returns the ID bytes specified
by first_id_byte, ..., fourth_id_byte module parameters.
In order to simulate NAND flash which returns more than four ID bytes,
this adds id_bytes module parameter which is specified by the array of
byte like this:
# modprobe nandsim id_bytes=0x98,0xdc,0x90,0x26,0x76,0x15,0x01,0x08 bch=1
This doesn't add fifth_id_byte, ..., seventh_id_byte module parameters,
because they are redundant. But the existing first_id_byte, ...,
fourth_id_byte module parameters are preserved and add "(obsolete)" to
the description.
Cc: Artem Bityutskiy <[email protected]>
Cc: David Woodhouse <[email protected]>
Cc: Brian Norris <[email protected]>
Cc: [email protected]
Signed-off-by: Akinobu Mita <[email protected]>
Signed-off-by: Brian Norris <[email protected]>
|
|
With CONFIG_OF=n, we can see the following warning:
drivers/mtd/devices/docg3.c:2122:28: warning: 'docg3_dt_ids' defined but not used [-Wunused-variable]
static struct of_device_id docg3_dt_ids[] = {
Signed-off-by: Brian Norris <[email protected]>
Cc: Robert Jarzmik <[email protected]>
|