Commit Graph

1291 Commits

Author SHA1 Message Date
Joern Engel
d30f11d225 [MTD] Use after free, found by the Coverity tool
Signed-off-by: Alexander Nyberg <alexn@dsv.su.se>
Signed-off-by: Joern Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:43:32 +02:00
Thomas Gleixner
3b88775c75 [MTD] NAND: Check command timeout
Check timeout while we wait for the command to finish. No worry about a
false result. This prevents deadlocking when detecting an unknown number
of chips and is useful for removable media too.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:42:49 +02:00
Thomas Gleixner
dfd6129440 [MTD] DiskOnChip: Wait for the command to finish.
Do not use the ready function here, as it might hang for ever. 
The result will show, whether the chip is there or not

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:42:18 +02:00
Ben Dooks
fdf2fd5274 [MTD] Sparse fixes
Fix sparse errors due to lack of address-space markers
Updated header comments
Small re-format of initialiser

Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:41:32 +02:00
Artem B. Bityuckiy
4945079584 [MTD] Fix unregister_mtd_user() public function documentation.
Signed-off-by: Artem B. Bityuckiy <dedekind@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:41:03 +02:00
Ben Dooks
7685359656 [MTD] Update BAST driver configuration
update the BAST driver config (which already supports the vr1000) to
be selected only if the vr1000 has been configured

Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:40:28 +02:00
Nicolas Pitre
332d71f768 [MTD] Make OTP actually work.
The OTP code is rather broken without this.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:39:55 +02:00
Artem B. Bityuckiy
b81226c5d5 [JFFS2] Fix node lookup
Look the ref->next_phys field instead of ->next_in_ino to determine
if the block has more then one node.

Signed-off-by: Artem B. Bityuckiy <dedekind@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:39:35 +02:00
Artem B. Bityuckiy
171650af9c [MTD] NAND: Fix bad block table scan for small page devices
Scan 1st and 2nd pages of SP devices for BB marker by default.
Fix more then one page scanning in create_bbt.c.

Signed-off-by: Artem B. Bityuckiy <dedekind@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:38:33 +02:00
Nicolas Pitre
f16407d73e [MTD] Quiet unused variable warning
Signed-off-by: Nioclas Pitre <nico@cam.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:37:52 +02:00
Kyungmin Park
0ea4a7558f [MTD] NAND: Early Manufacturer ID lookup
Move manufacturer ID search to display correct ID in case of buswidth
mismatch.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:36:30 +02:00
Ben Dooks
88ec7c50bf [MTD] Add SST 39VF1601 (MPF+) ID
Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:34:00 +02:00
Ben Dooks
011b2a3627 [MTD] Fixup probing logic for single 16bit devices
The change to the generic probe to look for the
smallest width of chip first is causing some problems
on boards with a single 16bit device.

The problem seems to be the jedec_match() is truncating
the device-id read from the table to match against the
one read from the hardware, causing a match against the
partial id of some chips with 16bit IDs (such as the
SST39LF160)

This fixes things for my own board, but something may
need to be done if the same problem is exhibited for
chips with an 8bit ID

Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:33:26 +02:00
Artem B. Bityuckiy
eeada24da8 [MTD] NAND: Read only OOB bytes during bad block scan
When scanning NAND for bad blocks, don't read the whole page, read
only needed OOB bytes instead. Also check the return code of the
nand_read_raw() function. Correctly free the this->bbt array in
case of failure. Tested with Large page NAND.

Fix debugging message.

Signed-off-by: Artem B. Bityuckiy <dedekind@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:32:18 +02:00
Artem B. Bityuckiy
41ce921440 [MTD] NAND: Allow operation without bad block table
Small bugfix. Sometimes it may be handy not to have bbt.
So, this->bbt might be NULL.

Signed-off-by: Artem B. Bityuckiy <dedekind@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:31:01 +02:00
Thomas Gleixner
0040bf382c [MTD] NAND: Skip bad block table scan on request
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:30:07 +02:00
Andrew Victor
2f82ce1eb6 [JFFS2] Use a single config option for write buffer support
This patch replaces the current CONFIG_JFFS2_FS_NAND, CONFIG_JFFS2_FS_NOR_ECC
and CONFIG_JFFS2_FS_DATAFLASH with a single configuration option -
CONFIG_JFFS2_FS_WRITEBUFFER.

The only functional change of this patch is that the slower div/mod
calculations for SECTOR_ADDR(), PAGE_DIV() and PAGE_MOD() are now always
used when CONFIG_JFFS2_FS_WRITEBUFFER is enabled.

Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:29:43 +02:00
Andrew Victor
8f15fd55f9 [JFFS2] Add support for JFFS2-on-Dataflash devices.
For Dataflash, can_mark_obsolete = false and the NAND write buffering
code (wbuf.c) is used.

Since the DataFlash chip will automatically erase pages when writing,
the cleanmarkers are not needed - so cleanmarker_oob = false and
cleanmarker_size = 0

DataFlash page-sizes are not a power of two (they're multiples of 528
bytes).  The SECTOR_ADDR macro (added in the previous core patch) is
replaced with a (slower) div/mod version if CONFIG_JFFS2_FS_DATAFLASH is
selected.

Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:28:03 +02:00
Andrew Victor
3be36675d4 [JFFS2] Core changes required to support JFFS2-on-Dataflash devices.
DataFlash page-sizes are not a power of two (they're multiples of 528
bytes).  There are a few places in JFFS2 code where sector_size is used
as a bitmask.  A new macro (SECTOR_ADDR) was defined to calculate these
sector addresses. For non-DataFlash devices, the original (faster)
bitmask operation is still used.

In scan.c, the EMPTY_SCAN_SIZE was a constant of 1024.
Since this could be larger than the sector size of the DataFlash, this
is now basically set to MIN(sector_size, 1024).

Addition of a jffs2_is_writebuffered() macro.

Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:27:09 +02:00
Nicolas Pitre
045e9a5d51 [MTD] Unabuse file-f_mode for OTP purpose
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:26:40 +02:00
Nicolas Pitre
31f4233bae [MTD] User interface to Protection Registers
This is implemented using a ioctl to switch the MTD char device into
one of the different OTP "modes", at which point read/write/seek can
operate on the selected OTP area.  Also some extra ioctls to query
for size and lock protection segments or groups.  Some example user
space utilities are provided.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:26:04 +02:00
Nicolas Pitre
f77814dd57 [MTD] Support for protection register support on Intel FLASH chips
This enables support for reading, writing and locking so called
"Protection Registers" present on some flash chips.
A subset of them are pre-programmed at the factory with a
unique set of values. The rest is user-programmable.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:25:23 +02:00
Estelle Hammache
67d9e95c39 [JFFS2] Prevent deadlock during write buffer recovery
Prevent deadlock when checking erased block for
space allocation during wbuf recovery.

Signed-off-by: Estelle Hammache <estelle.hammache@st.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:23:54 +02:00
Nicolas Pitre
72b56a2d7d [MTD] Add OTP basisc
add structure definition for OTP region info

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:22:37 +02:00
Jonas Holmberg
322b12eb57 [MTD] amd_flash: Fix chip ID clash
* Removed table entry for AM29BDS643D, since device ID clashes with AM29DL640G
and both chips support CFI.

Signed-off-by: Jonas Holmberg <jonas.holmberg@axis.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:21:41 +02:00
David Woodhouse
8aee6ac144 [JFFS2] Remove NAND dependencies for NOR FLASH
make NAND code work on NOR flash again

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:20:43 +02:00
Thomas Gleixner
f29a4b86f5 [MTD] DiskOnChip: big endian fix for NFTL devices
Make NFTL devices work on big endian machines.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:18:59 +02:00
Thomas Gleixner
39605398cd [MTD] DiskOnChip code cleanup
Remove commented ugliness

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:17:42 +02:00
Thomas Gleixner
651078ba3a [MTD] DiskOnChip use CONFIG_ options instead of random symbols
Using the CONFIG_ options from KConfig seems to work better :8

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:17:03 +02:00
Estelle Hammache
9b88f47390 [JFFS2] Code cleanup
Code beautification and block filing correction for optimization.

Signed-off-by: Estelle Hammache <estelle.hammache@st.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:16:06 +02:00
Russell King
6170b43401 [MTD] Fix MTD device probing
Try larger numbers of chips before smaller
numbers of chips across the bus width.

This means we'll avoid misdetecting a 2 x16 array as 1 x32 if the
high 16-bits happen to read as zeros in the QRY area.

Signed-off-by: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:15:15 +02:00
Estelle Hammache
3118db3dfe [JFFS2] Fix refile of blocks due to write failure.
avoid segfault when nextblock was refiled because of a write failure
- avoid filing blocks on the clean list when they have wasted
space

Signed-off-by: Estelle Hammache <estelle.hammache@st.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:14:34 +02:00
Estelle Hammache
7f716cf3f9 [JFFS2] Fix block refiling
- block refiling when writing directly to flash a buffer
which is bigger than wbuf
- retry cases for flushing wbuf

Signed-off-by: Estelle Hammache <estelle.hammache@st.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:12:13 +02:00
Estelle Hammache
e4803c30d6 [JFFS2] Fix write buffer retry case
Correction of retry case to avoid silent failure of rmdir
when jffs2_wbuf_recover GCs the previous entry (+ corresponding
dnode case).

Signed-off-by: Estelle Hammache <estelle.hammache@st.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:11:28 +02:00
David A. Marlin
ed3786a599 [MTD] rtc_from4 error status check, disable virtual erase blocks
Added routine to perform extra error status checks on erase and write
failures to determine if errors are correctable.
Added option to prevent JFFS2 from using virtual erase blocks.
Performed minor cleanup on whitespace and comments.

Signed-off-by: David A. Marlin <dmarlin@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:10:36 +02:00
David A. Marlin
068e3c0a00 [MTD] NAND Add optional ECC status check callback
Add optional hardware specific callback routine to perform extra error
status checks on erase and write failures for devices with hardware ECC.

Signed-off-by: David A. Marlin <dmarlin@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 12:08:59 +02:00
Ben Dooks
99f2a8aea1 [MTD] Platform RAM Driver
Driver for generic RAM blocks which are exported by an platform_device
from the device driver system.

Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 11:33:47 +02:00
David A. Marlin
a4ab4c5d32 [MTD] NAND use symbols instead of literals
Replace some literals with defined symbols.

Signed-off-by: David A. Marlin <dmarlin@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 11:32:36 +02:00
Richard Purdie
7ba48c4583 [MTD] NAND SharpSL fix default partition size
Correct Poodle default partition size

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 11:31:47 +02:00
Todd Poynor
8fabed4a0f [JFFS2] Avoid warning for empty filesystems
Avoid "Eep. No valid nodes for ino #1" message for just-created filesystem.

Signed-off-by: Todd Poynor <tpoynor@mvista.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 11:30:31 +02:00
Thomas Gleixner
15266bb74d [MTD] NAND replace yield
Replace yield by msleep. M.Wilcox stared at it and frowned

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 11:29:39 +02:00
Ben Dooks
6fc93d8ca7 [MTD] bast-flash partitions fixup
Ensure the whole device is added if there are no partitions found on the
device, so that at least the flash can be read/written.

Replace some of the constants with their SZ_xxx counterparts

Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 11:28:55 +02:00
David A. Marlin
97f1a087dc [MTD] Renesas AG-AND device recovery
Add routine to perform device recovery (deplete) procedure.
Clean up some compiler warnings.

Signed-off-by: David A. Marlin <dmarlin@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 11:27:56 +02:00
David A. Marlin
30f464b74b [MTD] NAND workaround for AG-AND disturb issue. AG-AND recovery
Added workaround for Renesas AG-AND chips "disturb" issue 
for Bad Block Table. 
Added support for the device recovery command sequence 
for Renesas AG-AND chips.

Signed-off-by: David A. Marlin <dmarlin@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 11:26:45 +02:00
David A. Marlin
28a48de72b [MTD] NAND extended commands, badb block table autorefresh
Added extended commands for AG-AND device and added 
option for BBT_AUTO_REFRESH.

Signed-off-by: David A. Marlin <dmarlin@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 11:22:05 +02:00
Herbert Valerio Riedel
8ea2e06fc8 [MTD] FTL Fix missing pointer assignment
For the case that mtd partitions are enabled it would cause a 0-pointer 
dereferencing in mtdpart.c:mtd_erase_callback()

Signed-off-by: Herbert Valerio Riedel <hvr@inso.tuwien.ac.at>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 11:19:46 +02:00
Josh Boyer
14f8351a31 [MTD] slram driver cleanup
Add error checks to read/write functions and add an eraseblock size.
Makes slram a suitable device for JFFS2.

Signed-off-by: Josh Boyer <jdub@us.ibm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2005-05-23 11:16:56 +02:00
Linus Torvalds
49a43876b9 [PATCH] prevent NULL mmap in topdown model
Prevent the topdown allocator from allocating mmap areas all the way
down to address zero.

We still allow a MAP_FIXED mapping of page 0 (needed for various things,
ranging from Wine and DOSEMU to people who want to allow speculative
loads off a NULL pointer).

Tested by Chris Wright.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-19 07:46:36 -07:00
Linus Torvalds
05d3794aa8 Automatic merge of rsync://rsync.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6.git/ 2005-05-18 16:37:46 -07:00
Stephen Tweedie
301216244b [PATCH] Avoid console spam with ext3 aborted journal.
Avoid console spam with ext3 aborted journal.

ext3 usually reports error conditions that it detects in its environment.
But when its journal gets aborted due to such errors, it can sometimes
continue to report that condition forever, spamming the console to such
an extent that the initial first cause of the journal abort can be lost.

When the journal aborts, we put the filesystem into readonly mode.  Most
subsequent filesystem operations will get rejected immediately by checks
for MS_RDONLY either in the filesystem or in the VFS.  But some paths do
not have such checks --- for example, if we continue to write to a file
handle that was opened before the fs went readonly.  (We only check for
the ROFS condition when the file is first opened.)  In these cases, we
can continue to generate log errors similar to

EXT3-fs error (device $DEV) in start_transaction: Journal has aborted

for each subsequent write.

There is really no point in generating these errors after the initial
error has been fully reported.  Specifically, if we're starting a
completely new filesystem operation, and the filesystem is *already*
readonly (ie. the ext3 layer has already detected and handled the
underlying jbd abort), and we see an EROFS error, then there is simply
no point in reporting it again.

Signed-off-by: Stephen Tweedie <sct@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-18 09:10:02 -07:00