Going over the bugs and warnings I found this one left over. The other
changes have already been correctly done for this driver but the actual
switch to pci_get_device that they assume has not.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
When write-verify is enabled (CONFIG_MTD_ONENAND_VERIFY_WRITE),
the data written is read back and compared. The comparison
was being made between dataRAM buffers, but this does not
verify that the data made it to the dataRAM correctly in
the first place. This patch amends write-verify to
compare back to the original buffer. It also now verifies
sub-page writes.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
The precise timings are board-specific (or NAND chip specific) and don't
belong here. If they're set already, then use what we find there.
Otherwise, revert to the most conservative default values (and whinge).
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
OneNAND records bad block information in the out-of-band area of either the first or second page of a block. Due to a logic error, only the first page was being checked.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
OneNAND does 2 memory allocations for bad block information.
Only one of them was being freed.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
If OneNAND is operating within specification, all operations should easily be
completed within the 20 millisecond timeout.
This patch faithlessly adds a check for the timeout and returns an error in
that case.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
The read-while-load method of reading from OneNAND needs to allow
for the change of bufferRAM address at the boundary between the
two chips in a double density (DDP) device.
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
we don't need to return ecc error when 1-bit ecc.
We only return error code when 2-bit ecc error
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
This patch teaches OneNAND to release processor in
read/write/erase cycles and let other processes proceed.
Also, remove buggi touch watchdog call which only hides
the problem instead of solving it.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Return a fault code if the Dataflash driver runs into a "no device present"
error when the MISO line has a pulldown (it currently expects a pullup), so
that rmmod won't oops.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Fix build issues that show up with the m25p80 SPI flash driver when
building with MTD debug enabled.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Run this:
#!/bin/sh
for f in $(grep -Erl "\([^\)]*\) *k[cmz]alloc" *) ; do
echo "De-casting $f..."
perl -pi -e "s/ ?= ?\([^\)]*\) *(k[cmz]alloc) *\(/ = \1\(/" $f
done
And then go through and reinstate those cases where code is casting pointers
to non-pointers.
And then drop a few hunks which conflicted with outstanding work.
Cc: Russell King <rmk@arm.linux.org.uk>, Ian Molton <spyro@f2s.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Greg KH <greg@kroah.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Karsten Keil <kkeil@suse.de>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Ian Kent <raven@themaw.net>
Cc: Steven French <sfrench@us.ibm.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Cc: Jaroslav Kysela <perex@suse.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
All kcalloc() calls of the form "kcalloc(1,...)" are converted to the
equivalent kzalloc() calls, and a few kcalloc() calls with the incorrect
ordering of the first two arguments are fixed.
Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Greg KH <greg@kroah.com>
Cc: Mark Fasheh <mark.fasheh@oracle.com>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Support for the ITE8172 based boards was deleted a while ago so this is
dead code.
The Kconfig dependency on MIPS was wrong anyway, MIPS is a processor
architecture and nothing else; guesses on systems architecture are likely
to be wrong ...
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
I will not commit even trivial and obvious one-line fixes without building.
I will not commit even trivial and obvious one-line fixes without building.
I will not commit even trivial and obvious one-line fixes without building.
I will not commit even trivial and obvious one-line fixes without building.
Only clever people can get away with that.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
ESB2ROM uses PCI interface functions.
With CONFIG_PCI=n:
drivers/mtd/maps/esb2rom.c: In function 'esb2rom_init_one':
drivers/mtd/maps/esb2rom.c:167: warning: implicit declaration of function 'pci_dev_get'
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
inlined below is the patch that adds physmap driver for of_device.
It's an MTD part of the two-part support for flash/ROM devices based
on Open Firmware descriptions. The arch part (currently only PowerPC
which is no surprise) was introduced to powerpc folks earlier and
recently the older version of the powerpc part has been included into
the powerpc.git tree
(see http://www.kernel.org/git/?p=linux/kernel/git/paulus/powerpc.git;a=commitdiff;h=28f9ec349ae47c91768b7bc5607db4442c818e11).
drivers/mtd/maps/Kconfig | 9 +
drivers/mtd/maps/Makefile | 1
drivers/mtd/maps/physmap_of.c | 255 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 265 insertions(+)
Signed-off-by: Vitaly Wool <vwool@ru.mvista.com>
Signed-off-by: Sergey Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
RedBoot supports storing the FIS directory and the RedBoot
configuration area in the same block of flash memory. This is
not the most common RedBoot configuration, but it is used on
commercially available boards supported by the kernel.
A recent patch to mtd/redboot.c (http://lkml.org/lkml/2006/3/20/410)
which corrected the skipping of deleted table entries has exposed the
latent problem of the kernel redboot parser running off the end of the
FIS directory and interpreting the RedBoot configuration information
as table entries.
This patch terminates the table parsing when the first truly empty
entry is found (table entry deletion only clears the first byte of the
name, so two cleared bytes in a row indicates the end of the table),
thereby supporting the combined redboot FIS directory and RedBoot
configuration information flash layout scenario.
Signed-off-by: Rod Whitby <rod@whitby.id.au>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Add support for 16-bit NAND bus-width for the AT91 NAND driver.
The 16-bit NAND is found on the Atmel AT91SAM9260-EK and AT91SAM9261-EK
boards.
Orignal Patch from Patrice Vilchez
Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Number of address bytes for 64-128 MiB NANDs is 4, not 5.
Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
SLAB_KERNEL is an alias of GFP_KERNEL.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Select MTD_NAND_ECC_SMC (ECC byte order according to the Smart Media
Specification) if MTD_NAND_NDFC is used.
Using the wrong byte order causes fatal, unnoticed data damage.
For further information see:
http://lists.infradead.org/pipermail/linux-mtd/2006-November/016920.html
Signed-off-by: Timo Lindhorst <lindhors@linux.vnet.ibm.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Can't analyze FIS directory in CYGSEM_REDBOOT_FLASH_COMBINED_FIS_AND_CONFIG
really.
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
This patch fixes the
"jffs2_flash_writev(): Non-contiguous write to 00825300 with mtd_dataflash" bug.
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
The newly-added cafe_ecc.c had a lot of it because of the way the lookup
table was auto-generated; clean up the other files too while we're at it.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Changes persistant -> persistent. www.dictionary.com does not know
persistant (with an A), but should it be one of those things you can
spell in more than one correct way, let me know.
Signed-off-by: Jan Engelhardt <jengelh@gmx.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Fix various Kconfig typos.
Signed-off-by: Matt LaPlante <kernel1@cyberdogtech.com>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
While we're fixing up the newly-added symbol, change the neighbouring ones
too, for consistency and also to reflect the author's interpretation of
the GPL -- which is that _no_ non-GPL modules are permitted. The author
always intended his code to be released under the GPL, and believes that
any new interpretation of 'EXPORT_SYMBOL' as being any different from
'EXPORT_SYMBOL_GPL' is entirely invalid; the GPL requires that _all_
exports have the semantics of the new 'EXPORT_SYMBOL_GPL', which means the
extra four characters are entirely redundant.
But since those four extra characters trigger the check for illegal
modules in a way that just EXPORT_SYMBOL does not, it's useful to change
anyway. This action in no way indicates an admission that there is any
legal distinction between the two states, and in particular does not
indicate that the author believes that non-GPL modules may use symbols
exported with EXPORT_SYMBOL alone.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
get_mtd_device() returns NULL in case of any failure. Teach it to return an
error code instead. Fix all users as well.
Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
This patch adds get_device() and put_device() methods to the MTD description
structure (struct mtd_info). These methods are called by MTD whenever the MTD
device is get or put. They are needed when the underlying driver is something
smarter then just flash chip driver, for example UBI.
Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
This patch adds one more function to the MTD interface to make it possible to
open MTD devices by their names, not only numbers. This is very handy in many
situations. Also, MTD device number depend on load order and may vary, while
names are fixed.
Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
Add a MTD_BLKDEVS Kconfig option to cleanup the makefile a bit
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
This patch has fixed name of map probe for cstm_mips_ixx.c
Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
When we sleep and wait for a suspended operation to be resumed, go
back and check until it's ready -- don't just continue after the first
time we're woken. This can cause file system corruption.
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Fix up the config option in the #ifdef statements in nand_ecc.c
Signed-off-by: Timo Lindhorst <lindhors@linux.vnet.ibm.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Fix printk format warning:
drivers/mtd/maps/physmap.c:93: warning: long long unsigned int format, long unsigned int arg (arg 2)
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
As was discussed between Ricard Wanderlöf, David Woodhouse, Artem
Bityutskiy and me, the current API for reading/writing OOB is confusing.
The thing that introduces confusion is the need to specify ops.len
together with ops.ooblen for reads/writes that concern only OOB not data
area. So, ops.len is overloaded: when ops.datbuf != NULL it serves to
specify the length of the data read, and when ops.datbuf == NULL, it
serves to specify the full OOB read length.
The patch inlined below is the slightly updated version of the previous
patch serving the same purpose, but with the new Artem's comments taken
into account.
Artem, BTW, thanks a lot for your valuable input!
Signed-off-by: Vitaly Wool <vwool@ru.mvista.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Currently, mtd_blkdevs enforces a block size of 512, even if the drivers
can seemingly request a different size. This patch fixes mtd_blkdevs so
block sizes other than 512 work correctly.
Signed-off-by: Richard Purdie <rpurdie@openedhand.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Add support for accessing BIOS flash chips connected to the NVIDIA ck804 southbridge.
Signed-off-by: Ryan Jackson <rjackson@lnxi.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
The writel() call accidentally clears all bits in the NDFC_CCR
register (endianess problem). Now __raw_writel() is used instead.
Tested on Bamboo with NAND on chip select 0 and chip select 1.
Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
This patch makes the needlessly global mtdpart_setup() static.
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
This patch converts drivers/mtd/nand/rtc_from4.c to use the new
lib/bitrev.c
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
We can use the two methods to wait.
1. polling: read interrupt status register
2. interrupt: use kernel ineterrupt mechanism
To use interrupt method, you first connect onenand interrupt pin to your
platform and configure interrupt properly
Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
We were resetting cafe->ctl2 to zero after an erase (and also during a
write, but it was correctly reset after that). This meant that ECC reads
after an erase were failing. Doh.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Also use cafe_readl() and cafe_writel() abstraction to make code
slightly cleaner -- especially if we want to use it in PIO mode.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Add description of 'raw' in comments for
drivers/mtd/nand/nand_base.c::nand_write_page_syndrome() so 'make xmldocs'
will not spew a warning at us.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Being a value which isn't in the table is a case we explicitly check for
in the caller. Don't BUG_ON() because it does actually happen in
practice.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
When a flash-based BBT is not used, nand_default_mark_blockbad() is supposed
to mark the block bad in the oob. However, it sets the wrong length variable
so that no bad block marker is in fact written. This patch attempts to
rectify that.
(As note, it seems to be that logically, it shouldn't be necessary to set
both length variables, as one appears to be for the main buffer, and
one for the oob buffer, but this is how it is done in several places,
including the code for the mtd character device MEMWRITEOOB and MEMREADOOB
ioctls. I'm not sure if this is a temporary solution during some rework of
the mtd infrastructure, or whether there is a deeper thought here.)
Signed-off-by: Ricard Wanderlöf <ricardw@axis.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Ditch the separate oobrbuf and oobwbuf fields from the chip buffers,
and use only a single buffer immediately after the data. This accommodates
NAND controllers such as the OLPC CAFÉ chip, which can't do scatter/gather
DMA so needs the OOB buffer to be contiguous with the data, for both read
and write.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
As flash cannot do 0->1 bit transitions when programming, do not do this in
the simulator too. This makes nandsim able to accept subpage writes.
Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
During some testing with several samsung s3c24xx based
devices it was discovered that often the
cfi_cmdset_0001.c would not leave the chip in
read-array mode on suspend. this is an issue if the
same flash chip is used for the bootloader that needs
to be read on resume.
Signed-off-by: David Anders <danders@amltd.com>
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Removes line break after return type in function definitions, to be
consistent with the Linux coding style.
Signed-off-by: Vijay Kumar <vijaykumar@bravegnu.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
For page wise allocation, an array of flash page pointers is allocated
during initialization. The flash pages are themselves allocated when a
write occurs to the page. The flash pages are deallocated when they
are erased.
Signed-off-by: Vijay Kumar <vijaykumar@bravegnu.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
This patch removes code that does chip mapping. The chip mapping code
is no longer used.
Signed-off-by: Vijay Kumar <vijaykumar@bravegnu.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
This patch has removed ITE 8172G and Globespan IVR MTD support.
These boards support have already been removed.
Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Acked-by: Ralf Bächle <ralf@linux-mips.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
1. The ECCGETLAYOUT ioctl copy_to_user() call has a superfluous '&'
causing the resulting information to be garbage rather than the intended
mtd->ecclayout.
2. The MEMGETOOBSEL misses copying mtd->ecclayout->eccbytes so the
resulting field of the returned structure contains garbage.
Signed-off-by: Ricard Wanderlöf <ricardw@axis.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
This version only differs from version posted by Savin Zlobec (20 Jun
2006) in that the AT91RM9200-specific chip-select / bus setup code has
been moved from the at91_nand.c driver into the processor-specific file.
From: Savin Zlobec <savin@epico.si>
Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Fairly self explanatory. Keep a reference initially, drop it when we free up
the driver resources.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Add MTD map driver for BIOS flash chips connected to the Intel ESB2
southbridge.
[akpm@osdl.org: coding-style fixes, build fix]
Signed-off-by: Ryan Jackson <rjackson@lnxi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Add chip driver and JEDEC probe support for the SST 49LF040B flash chip.
Signed-off-by: Ryan Jackson <rjackson@lnxi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
The 2 bits controlling the window size are often set to allow reading the
BIOS, but too small to allow writing, since the lock registers are 4MiB
lower in the address space than the data. This is intended to prevent
flashing the bios, perhaps accidentally.
The bits are 6 and 7. If both bits are set, it is a 5MiB window. If only
the 7 Bit is set, it is a 4MiB window. Otherwise, it is a 64KiB window.
This parameter allows the driver to override the BIOS settings.
Signed-off-by: Ryan Jackson <rjackson@lnxi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>