This can help to catch the case where hardware is writing after dma free.
[[email protected]: tidy code, fix comment, use sizeof(page->offset), use pr_err()]
Signed-off-by: Matthieu Castet <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
- NAND_CMD_READID want an address that it is not scaled on x16 device (it is always 0x20)
- NAND_CMD_PARAM want 8 bits data
Signed-off-by: Matthieu CASTET <[email protected]>
Signed-off-by: Artem Bityutskiy <[email protected]>
The driver call nand_scan_ident in 8 bit mode, then
readid or onfi detection are done (and detect bus width).
The driver should update its bus width before calling nand_scan_tail.
This work because readid and onfi are read work 8 byte mode.
Note that nand_scan_ident send command (NAND_CMD_RESET, NAND_CMD_READID, NAND_CMD_PARAM), address and read data
The ONFI specificication is not very clear for x16 device if high byte of address should be driven to 0,
but according to [1] it should be ok to not drive it during autodetection.
[1]
3.3.2. Target Initialization
[...]
The Read ID and Read Parameter Page commands only use the lower 8-bits of the data bus.
The host shall not issue commands that use a word data width on x16 devices until the host
determines the device supports a 16-bit data bus width in the parameter page.
Signed-off-by: Matthieu CASTET <[email protected]>
Signed-off-by: Artem Bityutskiy <[email protected]>
This help to detect bad flash identification in case the size is not present
on the name (ONFI).
Signed-off-by: Matthieu CASTET <[email protected]>
Signed-off-by: Artem Bityutskiy <[email protected]>
nand_wait_ready timeout should not assume HZ=100.
Make it independent of HZ value by using msecs_to_jiffies.
Signed-off-by: Matthieu CASTET <[email protected]>
Signed-off-by: Artem Bityutskiy <[email protected]>
This patch allow to detect buggy driver/hardware with
bad RnB (dev_ready) management or when timeout occurs in polling mode.
This works when dev_ready is set or not set.
There are 2 methods to wait for an erase/program command completion:
1. Wait until nand RnB pin goes high (that's what chip->dev_ready usually does)
2. Poll the device: send a status (0x70) command and read status byte in a loop
until bit NAND_STATUS_READY is set
In all cases, you should send a status command after completion, to check if
the operation was successful. And if the operation completed, the status should
have bit NAND_STATUS_READY set.
Signed-off-by: Matthieu CASTET <[email protected]>
Signed-off-by: Artem Bityutskiy <[email protected]>
The current version on mtdoops erase first block of mtdoops partition at each
boot if there is no oops stored in flash. This can wear the flash.
When mtdoops start, find_next_position is called to find the next free entry in
the circular buffer. But if the flash is erased, find_next_position don't find
anything (maxcount == 0xffffffff) and start with the first entry after erasing it.
The scanning that is done in find_next_position already track free/used entries.
So if at the end of the scanning we don't find anything, we can start at the
first entry and erased the entry only if it is marked as used.
Most of this is implemented in mtdoops_inc_counter, so to avoid duplicating
code, if we don't find anything we set position to -1. mtdoops_inc_counter with
increment it, erase the entry if needed and start as before with nextpage = 0
and nextcount = 1).
Also during the scan phase, we use the MTDOOPS_KERNMSG_MAGIC to detect corruped
entries.
Signed-off-by: Matthieu Castet <matthieu.castet@parrot@com>
Signed-off-by: Artem Bityutskiy <[email protected]>
Without this patch, these PEB are not scrubbed until we put data in them.
Bitflip can accumulate latter and we can loose the EC header (but VID header
should be intact and allow to recover data).
Signed-off-by: Matthieu Castet <[email protected]>
Cc: [email protected]
Signed-off-by: Artem Bityutskiy <[email protected]>
When using hidraw, hid buffer can be big and take lot's of
time to process (interrupt) kernel context.
Don't try to parse report if we are only interrested in hidraw.
Also don't prepare data for debug stuff if no debugfs file
are opened.
Signed-off-by: Matthieu CASTET <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
If we don't read fast enough hidraw device, hidraw_report_event
will cycle and we will leak list->buffer.
Also list->buffer are not free on release.
After this patch, kmemleak report nothing.
Signed-off-by: Matthieu CASTET <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
With onfi a flash is organized into one or more logical units (LUNs).
A logical unit (LUN) is the minimum unit that can independently execute
commands and report status.
Mtd does not exploit LUN, so make it see a big single flash where size is
lun_size * number_of_lun.
Without this patch MT29F8G08ADBDAH4 size is 512MiB instead of 1GiB.
Artem: split long line on 2 shorter ones.
Signed-off-by: Matthieu Castet <[email protected]>
Acked-by: Florian Fainelli <[email protected]>
Signed-off-by: Artem Bityutskiy <[email protected]>
Signed-off-by: David Woodhouse <[email protected]>
there is a bug in nand_flash_detect_onfi, busw need to be passed
by pointer to return it.
Signed-off-by: Matthieu CASTET <[email protected]>
Acked-by: Brian Norris <[email protected]>
Signed-off-by: Artem Bityutskiy <[email protected]>
Now that ehci_run don't call ehci_reset, we can use ehci_run.
Signed-off-by: Matthieu CASTET <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
TDI driver does the ehci_reset in their reset callback.
Don't reset in ehci_run because configuration settings done in
platform driver will be reset.
This will allow to make msm use ehci_run.
Signed-off-by: Matthieu CASTET <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
tdi_reset is already taking care of setting host mode for tdi devices.
Don't duplicate code in platform driver.
Make ehci_halt a nop if the controller is not in host mode (otherwise it
will fail), and let's ehci_reset do the tdi_reset.
We need to move hcd->has_tt flags before ehci_halt, in order ehci_halt
knows we are a tdi device.
Before the setup routine was doing :
- put controller in host mode
- ehci_halt
- ehci_init
- hcd->has_tt = 1;
- ehci_reset
Now we do :
- hcd->has_tt = 1;
- ehci_halt
- ehci_init
- ehci_reset
PS : now we handle correctly the device -> host transition.
Signed-off-by: Matthieu CASTET <[email protected]>
Cc: Alan Stern <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
In 'mount_ubifs()', in case of 'ubifs_leb_unmap()' falure,
free allocated resources.
Signed-off-by: Matthieu CASTET <[email protected]>
Signed-off-by: Artem Bityutskiy <[email protected]>
Generate random image_seq when attaching empty MTD device (kernel do the
ubi formating).
Signed-off-by: Matthieu CASTET <[email protected]>
Signed-off-by: Artem Bityutskiy <[email protected]>
For s3c2412, set parent for clk_erefclk and clk_urefclk.
This allow for example to use xtal or extclk for i2s clock.
Signed-off-by: Ben Dooks <[email protected]>
Signed-off-by: Matthieu Castet <[email protected]>