GitHub/moto-9609/android_kernel_motorola_exynos9610.git
14 years agojffs2: Fix long-standing bug with symlink garbage collection.
David Woodhouse [Wed, 16 Dec 2009 03:27:20 +0000 (03:27 +0000)]
jffs2: Fix long-standing bug with symlink garbage collection.

Ever since jffs2_garbage_collect_metadata() was first half-written in
February 2001, it's been broken on architectures where 'char' is signed.
When garbage collecting a symlink with target length above 127, the payload
length would end up negative, causing interesting and bad things to happen.

Cc: stable@kernel.org
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
14 years agomtd: OneNAND: Fix test of unsigned in onenand_otp_walk()
Roel Kluin [Wed, 16 Dec 2009 00:37:17 +0000 (01:37 +0100)]
mtd: OneNAND: Fix test of unsigned in onenand_otp_walk()

mtd->writesize and len are unsigned so the test does not work.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
14 years agomtd: cfi_cmdset_0002, fix lock imbalance
Jiri Slaby [Thu, 10 Dec 2009 13:23:57 +0000 (14:23 +0100)]
mtd: cfi_cmdset_0002, fix lock imbalance

Stanse found a double unlock in get_chip. get_chip is called with
chip->mutex held and caller is responsible for unlocking it too.

Do not unlock the lock in get_chip on a fail path. This would mean
a double unlock.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
14 years agoRevert "mtd: move mxcnd_remove to .exit.text"
Uwe Kleine-König [Mon, 7 Dec 2009 09:44:05 +0000 (09:44 +0000)]
Revert "mtd: move mxcnd_remove to .exit.text"

This reverts commit 82613b0da622efbd24cb7b23eb349966802310f1, because
commit daa0f15 (mtd: don't use __exit_p to wrap mxcnd_remove) is a
better solution. Not having a remove callback breaks rebinding because
resources are not freed on remove.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
14 years agomtd: m25p80: add support for Macronix MX25L4005A
Simon Guinot [Sat, 5 Dec 2009 14:28:00 +0000 (15:28 +0100)]
mtd: m25p80: add support for Macronix MX25L4005A

Signed-off-by: Simon Guinot <sguinot@lacie.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agokmsg_dump: fix build for CONFIG_PRINTK=n
Randy Dunlap [Tue, 1 Dec 2009 18:52:02 +0000 (10:52 -0800)]
kmsg_dump: fix build for CONFIG_PRINTK=n

kmsg_dump() fails to build when CONFIG_PRINTK=n; provide stubs
for the kmsg_dump*() functions when CONFIG_PRINTK=n.

kernel/printk.c: In function 'kmsg_dump':
kernel/printk.c:1501: error: 'log_buf_len' undeclared (first use in this function)
kernel/printk.c:1502: error: 'logged_chars' undeclared (first use in this function)
kernel/printk.c:1506: error: 'log_buf' undeclared (first use in this function)

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: nandsim: add support for 4KiB pages
Sebastian Andrzej Siewior [Sun, 29 Nov 2009 18:07:57 +0000 (19:07 +0100)]
mtd: nandsim: add support for 4KiB pages

I was going to play with a faulty nand image from real flash and noticed
that nandsim does not work with:
first_id_byte=0xec second_id_byte=0xd5 third_id_byte=0x51 fourth_id_byte=0xa6

This patch seems to fix it.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agoMerge branch 'mxc-nand' of git://git.pengutronix.de/git/imx/linux-2.6
David Woodhouse [Mon, 30 Nov 2009 12:35:02 +0000 (12:35 +0000)]
Merge branch 'mxc-nand' of git://git.pengutronix.de/git/imx/linux-2.6

15 years agomtd: mtdoops: refactor as a kmsg_dumper
Simon Kagstrom [Tue, 3 Nov 2009 13:19:03 +0000 (14:19 +0100)]
mtd: mtdoops: refactor as a kmsg_dumper

The last messages which happens before a crash might contain interesting
information about the crash. This patch reworks mtdoops using the
kmsg_dumper support instead of a console, which simplifies the code and
also includes the messages before the oops started.

On oops callbacks, the MTD device write is scheduled in a work queue (to
be able to use the regular mtd->write call), while panics call
mtd->panic_write directly. Thus, if panic_on_oops is set, the oops will
be written out during the panic.

A parameter to specify which mtd device to use (number or name), as well
as a flag, writable at runtime, to toggle wheter to dump oopses or only
panics (since oopses can often be handled by regular syslog).

The patch was massaged and amended by Artem.

Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Reviewed-by: Anders Grafstrom <anders.grafstrom@netinsight.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: mtdoops: make record size configurable
Simon Kagstrom [Thu, 29 Oct 2009 12:41:19 +0000 (13:41 +0100)]
mtd: mtdoops: make record size configurable

The main justification for this is to allow catching long messages
during a panic, where the top part might otherwise be lost since moving
to the next block can require a flash erase.

Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Reviewed-by: Anders Grafstrom <anders.grafstrom@netinsight.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: mtdoops: limit the maximum mtd partition size
Simon Kagstrom [Tue, 3 Nov 2009 06:08:41 +0000 (08:08 +0200)]
mtd: mtdoops: limit the maximum mtd partition size

Make the maximum mtdoops partition size to be 8MiB. Indeed, it does
not make sense to use anything larger than that anyway. This limit
makes it possible to catch stupid mistakes where the user gives e.g.,
a rootfs partition to mtdoops (which will happily erase it).

Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: mtdoops: keep track of used/unused pages in an array
Simon Kagstrom [Thu, 29 Oct 2009 12:41:11 +0000 (13:41 +0100)]
mtd: mtdoops: keep track of used/unused pages in an array

This patch makes mtdoops keep track of used/unused pages in an array
instead of scanning the flash after a write. The advantage with this
approach is that it avoids calling mtd->read on a panic, which is not
possible for all mtd drivers.

Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Reviewed-by: Anders Grafstrom <anders.grafstrom@netinsight.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: mtdoops: several minor cleanups
Artem Bityutskiy [Sun, 11 Oct 2009 10:40:40 +0000 (13:40 +0300)]
mtd: mtdoops: several minor cleanups

While looking into the mtdoops module, I've spotted several minor
imperfections. This patch addresses them. Namely:

1. Remove several trailing white-spaces and tabs
2. Check 'vmalloc()' return code straight away, not several lines
   below in the 'mtdoops_console_init()' function.
3. Clean up printks - make them more consistent and use the same
   code formatting style for them.
4. Remove silly style of putting brackets around everything in
   "if" operators.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: Simon Kagstrom <simon.kagstrom@netinsight.net>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agocore: Add kernel message dumper to call on oopses and panics
Simon Kagstrom [Fri, 16 Oct 2009 12:09:18 +0000 (14:09 +0200)]
core: Add kernel message dumper to call on oopses and panics

The core functionality is implemented as per Linus suggestion from

  http://lists.infradead.org/pipermail/linux-mtd/2009-October/027620.html

(with the kmsg_dump implementation by Linus). A struct kmsg_dumper has
been added which contains a callback to dump the kernel log buffers on
crashes. The kmsg_dump function gets called from oops_exit() and panic()
and invokes this callbacks with the crash reason.

[dwmw2: Fix log_end handling]
Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Reviewed-by: Anders Grafstrom <anders.grafstrom@netinsight.net>
Reviewed-by: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: add ARM pismo support
Russell King - ARM Linux [Sun, 29 Nov 2009 15:23:51 +0000 (15:23 +0000)]
mtd: add ARM pismo support

The following patch adds support for PISMO modules found on ARM Ltd
development platforms.  These are MTD modules, and can have a
selection of SRAM, flash or DOC devices as described by an on-board
I2C EEPROM.

We support SRAM and NOR flash devices only by registering appropriate
conventional MTD platform devices as children of the 'pismo' device.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: pxa3xx_nand: Fix PIO data transfer
David Hunter [Tue, 24 Nov 2009 05:02:35 +0000 (21:02 -0800)]
mtd: pxa3xx_nand: Fix PIO data transfer

The shift operator used here to convert from bytes to 32-bit words is
backwards.

Signed-off-by: David Hunter <hunterd42@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: nand: fix multi-chip suspend problem
Li Yang [Tue, 17 Nov 2009 22:45:49 +0000 (14:45 -0800)]
mtd: nand: fix multi-chip suspend problem

Symptom:
device_suspend(): mtd_cls_suspend+0x0/0x58 returns -11
PM: Device mtd14 failed to suspend: error -11
PM: Some devices failed to suspend

This patch enables other chips to be suspended if the active chip of
the controller has been suspended.

Signed-off-by: Jin Qing <b24347@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: add support for switching old SST chips into QRY mode
Guillaume LECERF [Mon, 23 Nov 2009 01:10:49 +0000 (02:10 +0100)]
mtd: add support for switching old SST chips into QRY mode

SST 39VF160x/39VF320x and some old SST chips need a special command
sequence to enter CFI QueRY mode [1].
This patch adds the relevant sequence to cfi_qry_mode_on().
Tested with 39VF3201.

Signed-off-by: Guillaume LECERF <glecerf@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: fix M29W800D dev_id and uaddr
Ladislav Michl [Sun, 22 Nov 2009 23:06:50 +0000 (00:06 +0100)]
mtd: fix M29W800D dev_id and uaddr

This one sits in my tree for more than two years...
Using device code found on page 12 (http://www.btdesigner.com/pdfs/M29W800D.pdf)
and unlock address from page 15 MTD subsytem happily detects ST M29W800DB
in 16-bit mode. I do believe original author used only 8-bit mode and thus
didn't hit this bug.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: don't use PF_MEMALLOC
KOSAKI Motohiro [Tue, 17 Nov 2009 07:18:41 +0000 (16:18 +0900)]
mtd: don't use PF_MEMALLOC

Non MM subsystem must not use PF_MEMALLOC. Memory reclaim need few
memory, anyone must not prevent it. Otherwise the system cause
mysterious hang-up and/or OOM Killer invokation.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: Add bad block table overrides to Davinci NAND driver
Mark A. Greer [Mon, 12 Oct 2009 23:16:37 +0000 (16:16 -0700)]
mtd: Add bad block table overrides to Davinci NAND driver

The existing NAND infrastructure allows the default main and
mirror bad block tables to be overridden in nand_default_bbt().
However, the davinci_nand driver does not support this.  Add
that support by adding fields to the davinci driver's platform
data so platform code can pass in their own bbt's and make the
davinci_nand driver honor them.

Signed-off-by: Mark A. Greer <mgreer@mvista.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
CC: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: m25p80: Add support for CAT25xxx serial EEPROMs
Anton Vorontsov [Mon, 12 Oct 2009 16:24:40 +0000 (20:24 +0400)]
mtd: m25p80: Add support for CAT25xxx serial EEPROMs

CAT25 chips (as manufactured by On Semiconductor, previously Catalyst
Semiconductor) are similar to the original M25Px0 chips, except:

- Address width can vary (1-2 bytes, in contrast to 3 bytes in M25P
  chips). So, implement convenient m25p_addr2cmd() and m25p_cmdsz()
  calls, and place address width information into flash_info struct;

- Page size can vary, therefore we shouldn't hardcode it, so get rid
  of FLASH_PAGESIZE definition, and place the page size information
  into flash_info struct;

- CAT25 EEPROMs don't need to be erased, so add NO_ERASE flag, and
  propagate it to the mtd subsystem.

[dwmw2: Fix up for conflicts with DMA safety patch]
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: m25p80: Rework probing/JEDEC code
Anton Vorontsov [Mon, 12 Oct 2009 16:24:38 +0000 (20:24 +0400)]
mtd: m25p80: Rework probing/JEDEC code

Previosly the driver always tried JEDEC probing, assuming that non-JEDEC
chips will return '0'. But truly non-JEDEC chips (like CAT25) won't do
that, their behaviour on RDID command is undefined, so the driver should
not call jedec_probe() for these chips.

Also, be less strict on error conditions, don't fail to probe if JEDEC
found a chip that is different from what platform code told, instead
just print some warnings and use an information obtained via JEDEC. In
that case we should not trust partitions any longer, but they might be
still useful (i.e. they could protect some parts of the chip).

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: m25p80: Convert to device table matching
Anton Vorontsov [Mon, 12 Oct 2009 16:24:35 +0000 (20:24 +0400)]
mtd: m25p80: Convert to device table matching

This patch converts the m25p80 driver so that now it uses .id_table
for device matching, making it properly detect devices on OpenFirmware
platforms (prior to this patch the driver misdetected non-JEDEC chips,
seeing all chips as "m25p80").

Also, now jedec_probe() only does jedec probing, nothing else. If it
is not able to detect a chip, NULL is returned and the driver fall
backs to the information specified by the platform (platform_data, or
exact ID).

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: make pagetest work
Artem Bityutskiy [Fri, 27 Nov 2009 14:58:08 +0000 (16:58 +0200)]
mtd: make pagetest work

The mtd_pagetest test did not initialize the pgsize variable, which
basically means it did not work. This problem was reported by
Török Edwin <edwintorok@gmail.com>

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: don't use __exit_p to wrap mxcnd_remove
Uwe Kleine-König [Tue, 24 Nov 2009 21:07:08 +0000 (22:07 +0100)]
mtd: don't use __exit_p to wrap mxcnd_remove

The function mxcnd_remove is defined using __devexit, so don't use
__exit_p but __devexit_p to wrap it.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: move excite_nand_remove to .devexit.text
Uwe Kleine-König [Tue, 24 Nov 2009 21:06:58 +0000 (22:06 +0100)]
mtd: move excite_nand_remove to .devexit.text

The function excite_nand_remove is used only wrapped by __devexit_p so
define it using __devexit.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agoJFFS2: fix min/max confusion
Roel Kluin [Sat, 21 Nov 2009 15:34:36 +0000 (16:34 +0100)]
JFFS2: fix min/max confusion

MAX_SUMMARY_SIZE was meant as a limit, not as a minimum

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: CFI cmdset_0002: enable erase-suspend-program
Joakim Tjernlund [Thu, 19 Nov 2009 11:01:58 +0000 (12:01 +0100)]
mtd: CFI cmdset_0002: enable erase-suspend-program

Erase-suspend for writing is required to avoid blocking applications
that wish to write some data (to a NOR block other than the one being
erased). Particularly, it solves some huge delays that an application
(which writes to a UBIFS) will experience if UBI attaches to empty NOR
flash. In this case the UBI background thread will erase a lot of blocks
and the application can be blocked for minutes because of the "MTD/CFI
chip lock".

This feature has been disabled for years. Maybe this was because the old
code turned it on for erase-suspend read-only chips also
(cfip->EraseSuspend & 0x1). This is wrong and corrected now.

This patch was tweaked by Norbert van Bolhuis.

Signed-off-by: Norbert van Bolhuis <nvbolhuis@aimvalley.nl>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: eLBC NAND: give more verbose output on error
Scott Wood [Fri, 13 Nov 2009 20:14:15 +0000 (14:14 -0600)]
mtd: eLBC NAND: give more verbose output on error

We want error information even if the kernel hasn't been built for verbose
debugging.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: eLBC NAND: use recommended command sequences
Scott Wood [Fri, 13 Nov 2009 20:13:01 +0000 (14:13 -0600)]
mtd: eLBC NAND: use recommended command sequences

Currently, the program and erase sequences do not wait for completion,
instead relying on a subsequent waitfunc() callback.  However, this causes
the chipselect to be deasserted while the NAND chip is still asserting the
busy pin, which can corrupt activity on other chipselects.

This patch switches to using the sequences recommended by the manual,
in which a wait is performed within the initial command sequence.  We can
now re-use the status byte from the initial command sequence, rather than
having to do another status read in the waitfunc.

Since we're already touching the command sequences, it also cleans up some
cruft in SEQIN that isn't needed since we cannot program partial pages
outside of OOB.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Reported-by: Suchit Lepcha <suchit.lepcha@freescale.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: eLBC NAND: increase bus timeout to maximum
Scott Wood [Fri, 13 Nov 2009 20:12:16 +0000 (14:12 -0600)]
mtd: eLBC NAND: increase bus timeout to maximum

When a NAND operation is in progress, all other localbus operations
(including NOR flash) will have to wait for access to the bus.  However, the
NAND operation may take longer to complete than the default timeout.  Thus,
if NOR is accessed while a NAND operation is in progress, the NAND operation
will fail.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: alauda: Use hweight8
Akinobu Mita [Fri, 13 Nov 2009 07:02:22 +0000 (16:02 +0900)]
mtd: alauda: Use hweight8

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agojffs2: Fix error return in jffs2_do_read_inode_internal()
Roel Kluin [Thu, 12 Nov 2009 17:09:48 +0000 (18:09 +0100)]
jffs2: Fix error return in jffs2_do_read_inode_internal()

The returned error should stay negative

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: error return -EIO instead of EIO
Roel Kluin [Wed, 11 Nov 2009 20:47:06 +0000 (21:47 +0100)]
mtd: error return -EIO instead of EIO

Return a negative error value instead of a positive

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: move manufacturer to the common cfi.h header file
Hans-Christian Egtvedt [Thu, 5 Nov 2009 14:53:43 +0000 (15:53 +0100)]
mtd: move manufacturer to the common cfi.h header file

This patch moves the MANUFACTURER_ST and MANUFACTURER_INTEL to the
include/linux/mtd/cfi.h header file and renames them to CFI_MFR_ST and
CFI_MFR_INTEL. CFI_MFR_ST was already present there.

All references in drivers/mtd/chips/cfi_cmdset_0001.c are updated to reflect
this.

Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: add lock fixup for AT49BV640D and AT49BV640DT chips
Hans-Christian Egtvedt [Thu, 5 Nov 2009 14:53:37 +0000 (15:53 +0100)]
mtd: add lock fixup for AT49BV640D and AT49BV640DT chips

This patch sets the MTD_POWERUP_LOCK flag for AT49BV640D and AT49BV640DT
devices, since the devices are locked when powered up and needs to be unlocked
before interfaced.

Quote datasheet; "At power-up and reset, all sectors have their Softlock
protection mode enabled.".

Tested on AVR32 hardware platform with an AT49BV640D flash device.

Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: ensure index is positive
Roel Kluin [Tue, 3 Nov 2009 19:49:18 +0000 (20:49 +0100)]
mtd: ensure index is positive

The index is signed, make sure it is not negative
when we read the array element.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: m25p80: make command buffer DMA-safe
Johannes Stezenbach [Wed, 28 Oct 2009 13:21:37 +0000 (14:21 +0100)]
mtd: m25p80: make command buffer DMA-safe

spi_write() requires the buffer to be DMA-safe, kmalloc()
it seperately to ensure this.

Signed-off-by: Johannes Stezenbach <js@sig21.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: s3c2410: propagate nand options from the platform data
Ben Dooks [Mon, 2 Nov 2009 18:12:51 +0000 (18:12 +0000)]
mtd: s3c2410: propagate nand options from the platform data

Update the nand information passed to the core from the platform data to
setup the initial option value, so that flags such as NAND_SCAN_SILENT_NODEV
can pass through.

Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Simtec Linux Team <linux@simtec.co.uk>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: nand: add option to quieten off the no device found messgae
Ben Dooks [Mon, 2 Nov 2009 18:12:33 +0000 (18:12 +0000)]
mtd: nand: add option to quieten off the no device found messgae

Add NAND_SCAN_SILENT_NODEV to chip->options to the user-worrying messages
'No NAND device found!!!'. This message often worries users (was three
exclamation marks really necessary?) and especially in systems such as the
Simtec Osiris where there may be optional NAND devices which are not
known until probe time.

Revised version of the original NAND_PROBE_SPECULATIVE patch after comments
by Artem Bityutskiy about adding a whole new call.

Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Simtec Linux Team <linux@simtec.co.uk>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: txx9ndfmc: Use nand_release to free resources
Atsushi Nemoto [Mon, 2 Nov 2009 14:40:48 +0000 (23:40 +0900)]
mtd: txx9ndfmc: Use nand_release to free resources

This patch fixes memory leak on chip->bbt and chip->buffers.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: ixp4xx map: use resource_size
Tobias Klauser [Fri, 30 Oct 2009 16:54:33 +0000 (17:54 +0100)]
mtd: ixp4xx map: use resource_size

Use the resource_size inline function instead of manually calculating
the resource size. This reduces the chance of introducing off-by-one
errors.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: Add panic_write for NAND flashes
Simon Kagstrom [Mon, 5 Oct 2009 13:55:52 +0000 (15:55 +0200)]
mtd: Add panic_write for NAND flashes

This is a quick and dirty patch to add panic_write for NAND flashes. The
patch seems to work OK on my CRIS board running a 2.6.26 kernel with a
ID: 0x20, Chip ID: 0xf1 (ST Micro NAND 128MiB 3,3V 8-bit), and also on a
OpenRD base (Marvell Kirkwood) board with a Toshiba NAND 512MiB 3,3V
8-bit flash with 2.6.32-pre1.

Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: add missing put_chip() in cfi_intelext_reset()
Nicolas Pitre [Fri, 23 Oct 2009 20:02:42 +0000 (16:02 -0400)]
mtd: add missing put_chip() in cfi_intelext_reset()

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: OneNAND: fix double printing of function name
Mika Korhonen [Fri, 23 Oct 2009 05:50:44 +0000 (07:50 +0200)]
mtd: OneNAND: fix double printing of function name

Signed-off-by: Mika Korhonen <ext-mika.2.korhonen@nokia.com>
Reviewed-by: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: OneNAND: multiblock erase support
Mika Korhonen [Fri, 23 Oct 2009 05:50:43 +0000 (07:50 +0200)]
mtd: OneNAND: multiblock erase support

Add support for multiblock erase command. OneNANDs (excluding Flex-OneNAND)
are capable of simultaneous erase of up to 64 eraseblocks which is much faster.

This changes the erase requests for regions covering multiple eraseblocks
to be performed using multiblock erase.

Signed-off-by: Mika Korhonen <ext-mika.2.korhonen@nokia.com>
Reviewed-by: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: OneNAND: move erase method to a separate function
Mika Korhonen [Fri, 23 Oct 2009 05:50:42 +0000 (07:50 +0200)]
mtd: OneNAND: move erase method to a separate function

Separate the actual execution of erase to a new function:
onenand_block_by_block_erase(). This is done in preparation for
the multiblock erase support.

Signed-off-by: Mika Korhonen <ext-mika.2.korhonen@nokia.com>
Reviewed-by: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: add nand_ecc test module
Akinobu Mita [Thu, 22 Oct 2009 07:53:33 +0000 (16:53 +0900)]
mtd: add nand_ecc test module

This module tests NAND ECC functions.

The test is simple.

1. Create a 256 or 512 bytes block of data filled with random bytes (data)
2. Duplicate the data block and inject single bit error (error_data)
3. Try to correct error_data
4. Compare data and error_data

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Vimal Singh <vimalsingh@ti.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: Add __nand_calculate_ecc() to NAND ECC functions
Akinobu Mita [Thu, 22 Oct 2009 07:53:32 +0000 (16:53 +0900)]
mtd: Add __nand_calculate_ecc() to NAND ECC functions

Add __nand_calculate_ecc() which does not take struct mtd_info.
The built-in 256/512 software ECC calculation and correction tester
will use it.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Vimal Singh <vimalsingh@ti.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: OneNAND OTP support rework
Amul Kumar Saha [Wed, 21 Oct 2009 11:30:05 +0000 (17:00 +0530)]
mtd: OneNAND OTP support rework

What is OTP in OneNAND?
The device includes,
1. one block-sized OTP (One Time Programmable) area and
2. user-controlled 1st block OTP(Block 0)
that can be used to increase system security or to provide
identification capabilities.

What is done?
In OneNAND, one block of the NAND Array is set aside as an OTP
memory area, and 1st Block (Block 0) can be used as OTP area.
This area, available to the user, can be configured and locked
with secured user information. The OTP block can be read,
programmed and locked using the same operations as any other NAND
Flash Array memory block. After issuing an OTP-Lock, OTP block
cannot be erased. OTP block is fully-guaranteed to be a good
block.

Why it is done?
Locking the 1st Block OTP has the effect of a 'Write-protect' to
guard against accidental re-programming of data stored in the 1st
block and OTP Block.

Which problem it solves?
OTP support is provided in the existing implementation of
OneNAND/Flex-OneNAND driver, but it is not working with OneNAND
devices. Have observed the following in current OTP OneNAND Implmentation,
1. DataSheet specific sequence to lock the OTP Area is not followed.
2. Certain functions are quiet generic to cope with OTP specific activity.
This patch re-implements OTP support for OneNAND device.

How it is done?
For all blocks, 8th word is available to the user.
However, in case of OTP Block, 8th word of sector 0, page 0 is reserved as
OTP Locking Bit area. Therefore, in case of OTP Block, user usage on this
area is prohibited. Condition specific values are entered in the 8th word,
sector0, page 0 of the OTP block during the process of issuing an OTP-Lock.
The possible conditions are:
1. Only 1st Block Lock
2. Only OTP Block Lock
3. Lock both the 1st Block and the OTP Block

What Other feature additions have been done in this patch?
This patch adds feature for:
1. Only 1st Block Lock
2. Lock both the 1st Block and the OTP Blocks

Re-implemented OTP support for OneNAND
Added following features to OneNAND
1. Lock only 1st Block in OneNAND
2. Lock BOTH 1st Block and OTP Block in OneNAND

[comments were slightly tweaked by Artem]

Signed-off-by: Amul Kumar Saha <amul.saha@samsung.com>
Reviewed-by: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: vmu-flash: Use hweight_long
Akinobu Mita [Fri, 20 Nov 2009 05:56:07 +0000 (14:56 +0900)]
mtd: vmu-flash: Use hweight_long

Use hweight_long instead of Brian Kernighan's/Peter Wegner's method

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomxc_nand: use DRIVER_NAME where appropriate
Sascha Hauer [Wed, 21 Oct 2009 14:06:27 +0000 (16:06 +0200)]
mxc_nand: use DRIVER_NAME where appropriate

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
15 years agomxc_nand: remove TROP_US_DELAY
Sascha Hauer [Wed, 21 Oct 2009 14:01:02 +0000 (16:01 +0200)]
mxc_nand: remove TROP_US_DELAY

wait_op_done is only called with the same timeout, so
code the timeout into the function itself.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
15 years agomxc_nand: Allow flash based bbt
Sascha Hauer [Wed, 21 Oct 2009 12:25:27 +0000 (14:25 +0200)]
mxc_nand: Allow flash based bbt

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
15 years agomxc_nand: disable sp_en bit only once
Sascha Hauer [Mon, 5 Oct 2009 15:18:42 +0000 (17:18 +0200)]
mxc_nand: disable sp_en bit only once

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
15 years agomxc_nand: Add NFC V2 support
Sascha Hauer [Mon, 5 Oct 2009 10:14:21 +0000 (12:14 +0200)]
mxc_nand: Add NFC V2 support

The v2 version of this controller is used on i.MX35/25 SoCs.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
15 years agomxc_nand: Get rid of pagesize_2k flag
Sascha Hauer [Mon, 5 Oct 2009 09:24:02 +0000 (11:24 +0200)]
mxc_nand: Get rid of pagesize_2k flag

Later versions of this controller also allow 4k pagesize,
so use mtd->writesize instead of a flag.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
15 years agomxc_nand: Make main/spare areas runtime configurable
Sascha Hauer [Mon, 5 Oct 2009 09:14:35 +0000 (11:14 +0200)]
mxc_nand: Make main/spare areas runtime configurable

The main/spare areas are on different addresses on later versions
of the controller, so make them configurable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
15 years agomxc_nand: remove unused defines
Sascha Hauer [Fri, 5 Jun 2009 08:55:32 +0000 (10:55 +0200)]
mxc_nand: remove unused defines

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
15 years agomxc nand: modify send_page to send all pages, not only one
Sascha Hauer [Thu, 4 Jun 2009 15:25:53 +0000 (17:25 +0200)]
mxc nand: modify send_page to send all pages, not only one

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
15 years agomxc nand: simplify command processing
Sascha Hauer [Thu, 4 Jun 2009 15:18:01 +0000 (17:18 +0200)]
mxc nand: simplify command processing

Instead of having two switch/case with other operations
in between, use only one switch/case

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
15 years agomxc nand: use buffers
Sascha Hauer [Thu, 4 Jun 2009 15:12:26 +0000 (17:12 +0200)]
mxc nand: use buffers

The NAND controller has some limitations how to access the
internal buffers. It only allows 32 bit accesses. The driver
used to work around this by having special alignment aware
copy routines.
We now copy the whole page to a buffer in memory and let the
access functions use this buffer. This simplifies the driver.
A bonnie++ test showed that this has no negative performance
impact on the driver.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
15 years agomxc nand: use resource_size()
Sascha Hauer [Thu, 4 Jun 2009 14:16:01 +0000 (16:16 +0200)]
mxc nand: use resource_size()

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
15 years agomxc nand: remove dead code
Sascha Hauer [Thu, 4 Jun 2009 14:12:40 +0000 (16:12 +0200)]
mxc nand: remove dead code

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
15 years agomxc nand: remove debug param
Sascha Hauer [Thu, 4 Jun 2009 13:57:20 +0000 (15:57 +0200)]
mxc nand: remove debug param

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
15 years agomxc_nand: introduce mxc_do_addr_cycle
Sascha Hauer [Tue, 2 Jun 2009 09:47:59 +0000 (11:47 +0200)]
mxc_nand: introduce mxc_do_addr_cycle

This factors the address cycle to a seperate function. This
becomes useful in a later patch where we can simplify the
command processing by making use of this function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
15 years agomxc_nand: merge send_read_page and send_prog_page
Sascha Hauer [Tue, 2 Jun 2009 09:37:53 +0000 (11:37 +0200)]
mxc_nand: merge send_read_page and send_prog_page

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
15 years agomxc_nand: cleanup initialization
Sascha Hauer [Wed, 21 Oct 2009 08:39:05 +0000 (10:39 +0200)]
mxc_nand: cleanup initialization

The oob layout was initialized several times. Instead, use
a smallpage layout by default and switch to a largepage
afterwards if necessary.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
15 years agomxc_nand: cleanup eccoob descriptions
Sascha Hauer [Wed, 21 Oct 2009 08:22:01 +0000 (10:22 +0200)]
mxc_nand: cleanup eccoob descriptions

The original Freescale driver used to have eccoob descriptions like
this:

static struct nand_ecclayout nand_hw_eccoob_8 = {
.eccbytes = 5,
.eccpos = {6, 7, 8, 9, 10},
.oobfree = {{0, 5}, {11, 5}}
};

static struct nand_ecclayout nand_hw_eccoob_16 = {
.eccbytes = 5,
.eccpos = {6, 7, 8, 9, 10},
.oobfree = {{0, 6}, {12, 4}}
};

The former was used for 8bit flashes and the latter for 16bit flashes.
They honored the fact that the bad block marker on 8bit flashes is on byte 5
while on 16bit flashes it is on byte 11.
In the Kernel driver this was copied wrong and we ended up with two identical
descriptions.

Change it so that we have only one description which leaves byte 5 and byte
11 unspecified so that it won't be used by others.

Also, rename the descriptions to nand_hw_eccoob_smallpage and
nand_hw_eccoob_largepage so that it can't be confused with Nand chip bus
widths (what actually happened in this driver)

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
15 years agomtd: Fix compile failure and error path in physmap.c
H Hartley Sweeten [Tue, 20 Oct 2009 16:23:33 +0000 (12:23 -0400)]
mtd: Fix compile failure and error path in physmap.c

Commit 4b56ffcacee937a85bf39e14872dd141e23ee85f ("mtd: Fix kernel NULL
pointer dereference in physmap.c") introduced a couple of bugs.

It neglected to run the loop of map_destroy() calls in
physmap_flash_remove(), if !info->cmtd, which would happen if that
function was called to clean up errors during probe.

It also failed to compile if CONFIG_MTD_PARTITIONS was not defined.

Reported-By: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agoRevert "mtd: mxc_nand: fix 2KiB pagesize NAND on i.MX27"
David Woodhouse [Tue, 20 Oct 2009 13:02:41 +0000 (22:02 +0900)]
Revert "mtd: mxc_nand: fix 2KiB pagesize NAND on i.MX27"

This reverts commit 71b7d0d90d536ae4e70929cc59a1a9f6ba457c6c.

The problem which that commit attempted to fix was a bootloader issue,
which had been misunderstood. The 'fix' causes lots of false bad blocks
for existing users with sane firmware.

Thanks to Mathieu Berland for diagnosing the problem coherently.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd_blkdevs.c: quiet a "symbol shadows" sparse warning
hartleys [Fri, 16 Oct 2009 12:52:53 +0000 (12:52 +0000)]
mtd_blkdevs.c: quiet a "symbol shadows" sparse warning

In register_mtd_blktrans(), the symbol 'ret' is already declared
as an int at the start of the function.  The inner loop declaration
is unnecessary.  Quiets the following sparse warning:

  warning: symbol 'ret' shadows an earlier one

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: add bcmring nand driver
Leo (Hao) Chen [Sat, 10 Oct 2009 02:13:08 +0000 (19:13 -0700)]
mtd: add bcmring nand driver

Signed-off-by: Leo Hao Chen <leochen@broadcom.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: Fix kernel NULL pointer dereference in physmap.c
H Hartley Sweeten [Mon, 19 Oct 2009 17:31:46 +0000 (13:31 -0400)]
mtd: Fix kernel NULL pointer dereference in physmap.c

During the probe for physmap platform flash devices there are a
number error exit conditions that all do a goto err_out which
then calls physmap_flash_remove().  In that function one of the
cleanup steps is:

#ifdef CONFIG_MTD_CONCAT
if (info->cmtd != info->mtd[0])
mtd_concat_destroy(info->cmtd);
#endif

This test will succeed since info->cmtd == NULL and info->mtd[0] is
valid.

Fix this by exiting the remove function when info->cmtd == NULL.

Also, cleanup the #ifdef CONFIG_MTD_PARTITIONS stuff by using
mtd_has_partitions().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: plat_nand: request memory resource before doing ioremap
H Hartley Sweeten [Mon, 19 Oct 2009 23:45:29 +0000 (19:45 -0400)]
mtd: plat_nand: request memory resource before doing ioremap

Add a request_mem_region() before doing the ioremap().  Also, use the
resource_size macro instead of doing the end - start + 1 calc by hand.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agopcmcia: convert pcmciamtd driver to use new CIS helpers
Dominik Brodowski [Sun, 18 Oct 2009 23:07:34 +0000 (16:07 -0700)]
pcmcia: convert pcmciamtd driver to use new CIS helpers

Convert the (broken) pcmciamtd driver to use the new CIS helpers.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: maps: remove obsolete ipaq-flash driver
Dmitry Artamonow [Tue, 13 Oct 2009 11:34:54 +0000 (15:34 +0400)]
mtd: maps: remove obsolete ipaq-flash driver

This driver seems to be obsolete and broken for a long time.
It depends on CONFIG_IPAQ_HANDHELD that simply doesn't exists
anywhere in kernel. Also, it seems that none of machines it
claims to support have any use of it:
 SA11xx-based iPAQs (h3100/h3600) use sa1100-flash
 iPAQ h5000 uses physmap-flash
 Jornada 720 uses sa1100-flash
 Jornada 560 and iPAQ h1910 are not in mainline

Signed-off-by: Dmitry Artamonow <mad_soft@inbox.ru>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: fix memory leak in mtd_dataflash
H Hartley Sweeten [Wed, 7 Oct 2009 21:08:08 +0000 (17:08 -0400)]
mtd: fix memory leak in mtd_dataflash

Fix a potential memory leak in mtd_dataflash driver.

The private data that is allocated when registering a DataFlash
device with the MTD subsystem is not released if an error occurs
when add_mtd_partitions() or add_mtd_device() is called.  Fix this
by adding an error path.  The memory is already released during a
remove.

Also, add a dev_set_drvdata(&spi->dev, NULL) before the kfree() so
that the spi device does not reference invalid data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: cleanup mtd_oobtest
Akinobu Mita [Fri, 9 Oct 2009 09:43:52 +0000 (18:43 +0900)]
mtd: cleanup mtd_oobtest

- Remove unnecessary memset for bbt
  All entries will be initialized at a few lines below
- Remove unnecessary initialization for mtd->erasesize
- Use write_whole_device()

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: maps/sa1100: fix section mismatch
Dmitry Artamonow [Fri, 9 Oct 2009 08:18:49 +0000 (12:18 +0400)]
mtd: maps/sa1100: fix section mismatch

Commit f0b1e589 changed sa1100_mtd_probe from __init to __devinit,
but missed to correct sa1100_setup_mtd definition accordingly, which
causes following warning:

WARNING: vmlinux.o(.devinit.text+0xf4): Section mismatch in reference from
 the function sa1100_mtd_probe() to the function .init.text:sa1100_setup_mtd()
The function __devinit sa1100_mtd_probe() references
a function __init sa1100_setup_mtd().
If sa1100_setup_mtd is only used by sa1100_mtd_probe then
annotate sa1100_setup_mtd with a matching annotation.

Signed-off-by: Dmitry Artamonow <mad_soft@inbox.ru>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: move mxcnd_remove to .exit.text
Uwe Kleine-König [Thu, 1 Oct 2009 08:28:21 +0000 (10:28 +0200)]
mtd: move mxcnd_remove to .exit.text

The function mxcnd_remove is used only wrapped by __exit_p so define it
using __exit.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Vladimir Barinov <vova.barinov@gmail.com>
Cc: Vladimir Barinov <vbarinov@embeddedalley.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: atmel_nand: unused variable removed
Claudio Scordino [Wed, 7 Oct 2009 12:27:07 +0000 (14:27 +0200)]
mtd: atmel_nand: unused variable removed

Unused variable "eccpos" removed from atmel_nand driver.

Signed-off-by: Claudio Scordino <claudio@evidence.eu.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: make onenand_base.c compile again
David Woodhouse [Mon, 5 Oct 2009 07:30:04 +0000 (08:30 +0100)]
mtd: make onenand_base.c compile again

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: Standardising prints in onenand_base.c
Amul Kumar Saha [Fri, 2 Oct 2009 11:29:11 +0000 (16:59 +0530)]
mtd: Standardising prints in onenand_base.c

This patch resolves all the prints present in onenand_base.c
Primarily, it replaces the hard-coded function names in the prints,
and makes use of __func__.

Signed-off-by: Amul Kumar Saha <amul.saha@samsung.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: nand: davinci: fix to use mask_ale from pdata
Hemant Pedanekar [Thu, 1 Oct 2009 14:25:06 +0000 (19:55 +0530)]
mtd: nand: davinci: fix to use mask_ale from pdata

Correct typo to use mask_ale from platform data when set to non-zero.

Signed-off-by: Hemant Pedanekar <hemantp@ti.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: Fix warning in sa1100-flash.c
Russell King [Sun, 27 Sep 2009 22:51:04 +0000 (23:51 +0100)]
mtd: Fix warning in sa1100-flash.c

drivers/mtd/maps/sa1100-flash.c: In function 'sa1100_probe_subdev':
drivers/mtd/maps/sa1100-flash.c:214: warning: format '%d' expects type 'int', but argument 3 has type 'uint64_t'

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agoARM Nomadik: use new OneNand name and pdata
Alessandro Rubini [Sun, 20 Sep 2009 21:28:24 +0000 (23:28 +0200)]
ARM Nomadik: use new OneNand name and pdata

This enables the onenand with the new platform device name.
Moreover, it fixes a related typo that doesn't deserve a
separate patch.

Signed-off-by: Alessandro Rubini <rubini@unipv.it>
Acked-by: Andrea Gallo <andrea.gallo@stericsson.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: unify status enum from three headers
Alessandro Rubini [Sun, 20 Sep 2009 21:28:14 +0000 (23:28 +0200)]
mtd: unify status enum from three headers

nand.h, onenand.h and flashchip.h defined enumeration types
for chip status using the same symbolic names. This prevented
a board file to include more than one of them. In particular,
no nand and onenand platform devices could live in the same file.
This patch augments flashchip.h with a few status values in order
to cover all cases, so nand.h and onenand.h can use flstate_t
without declaring their own status enum.

Signed-off-by: Alessandro Rubini <rubini@unipv.it>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: use bbm.h in nand.h
Alessandro Rubini [Sun, 20 Sep 2009 21:28:04 +0000 (23:28 +0200)]
mtd: use bbm.h in nand.h

This consolidates common code in nand.h and bbm.h. The
comments and data structures were the same, this keeps
the comment from nand.h as it fits 80 columns, while the one
in bbm.h did not.

Signed-off-by: Alessandro Rubini <rubini@unipv.it>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: m25p80: disable SST software protection bits by default
Graf Yang [Thu, 24 Sep 2009 19:46:22 +0000 (15:46 -0400)]
mtd: m25p80: disable SST software protection bits by default

The SST SPI flashes is like Atmel SPI flashes in that the software
protection bits are set by default at power up, so clear them at init
time.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd/maps: gpio-addr-flash: depend on GPIO arch support
Mike Frysinger [Thu, 24 Sep 2009 19:11:38 +0000 (15:11 -0400)]
mtd/maps: gpio-addr-flash: depend on GPIO arch support

The driver requires gpio functionality, so make sure we depend on that in
the Kconfig menu.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd/maps: gpio-addr-flash: pull in linux/ headers rather than asm/
Mike Frysinger [Thu, 24 Sep 2009 19:11:37 +0000 (15:11 -0400)]
mtd/maps: gpio-addr-flash: pull in linux/ headers rather than asm/

Now that there are linux/ versions of gpio.h and io.h, include those
rather than hitting the asm/ versions.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agomtd: nand: fix htmldocs warnings
Jaswinder Singh Rajput [Thu, 24 Sep 2009 12:04:53 +0000 (13:04 +0100)]
mtd: nand: fix htmldocs warnings

Fixed following htmldocs warnings:

  DOCPROC Documentation/DocBook/mtdnand.xml
  Warning(drivers/mtd/nand/nand_base.c:769): No description found for parameter 'page'
  Warning(drivers/mtd/nand/nand_base.c:785): No description found for parameter 'page'
  Warning(drivers/mtd/nand/nand_base.c:824): No description found for parameter 'page'
  Warning(drivers/mtd/nand/nand_base.c:947): No description found for parameter 'page'
  Warning(drivers/mtd/nand/nand_base.c:996): No description found for parameter 'page'
  Warning(drivers/mtd/nand/nand_base.c:1040): No description found for parameter 'page'

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
15 years agoMerge git://git.infradead.org/mtd-2.6
Linus Torvalds [Wed, 23 Sep 2009 17:07:49 +0000 (10:07 -0700)]
Merge git://git.infradead.org/mtd-2.6

* git://git.infradead.org/mtd-2.6: (58 commits)
  mtd: jedec_probe: add PSD4256G6V id
  mtd: OneNand support for Nomadik 8815 SoC (on NHK8815 board)
  mtd: nand: driver for Nomadik 8815 SoC (on NHK8815 board)
  m25p80: Add Spansion S25FL129P serial flashes
  jffs2: Use SLAB_HWCACHE_ALIGN for jffs2_raw_{dirent,inode} slabs
  mtd: sh_flctl: register sh_flctl using platform_driver_probe()
  mtd: nand: txx9ndfmc: transfer 512 byte at a time if possible
  mtd: nand: fix tmio_nand ecc correction
  mtd: nand: add __nand_correct_data helper function
  mtd: cfi_cmdset_0002: add 0xFF intolerance for M29W128G
  mtd: inftl: fix fold chain block number
  mtd: jedec: fix compilation problem with I28F640C3B definition
  mtd: nand: fix ECC Correction bug for SMC ordering for NDFC driver
  mtd: ofpart: Check availability of reg property instead of name property
  driver/Makefile: Initialize "mtd" and "spi" before "net"
  mtd: omap: adding DMA mode support in nand prefetch/post-write
  mtd: omap: add support for nand prefetch-read and post-write
  mtd: add nand support for w90p910 (v2)
  mtd: maps: add mtd-ram support to physmap_of
  mtd: pxa3xx_nand: add single-bit error corrections reporting
  ...

15 years agoMerge branch 'vgaarb-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
Linus Torvalds [Wed, 23 Sep 2009 17:07:24 +0000 (10:07 -0700)]
Merge branch 'vgaarb-fix' of git://git./linux/kernel/git/airlied/drm-2.6

* 'vgaarb-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
  vgaarb: make client interface config invariant.

15 years agoMerge git://git.infradead.org/iommu-2.6
Linus Torvalds [Wed, 23 Sep 2009 17:06:10 +0000 (10:06 -0700)]
Merge git://git.infradead.org/iommu-2.6

* git://git.infradead.org/iommu-2.6: (23 commits)
  intel-iommu: Disable PMRs after we enable translation, not before
  intel-iommu: Kill DMAR_BROKEN_GFX_WA option.
  intel-iommu: Fix integer wrap on 32 bit kernels
  intel-iommu: Fix integer overflow in dma_pte_{clear_range,free_pagetable}()
  intel-iommu: Limit DOMAIN_MAX_PFN to fit in an 'unsigned long'
  intel-iommu: Fix kernel hang if interrupt remapping disabled in BIOS
  intel-iommu: Disallow interrupt remapping if not all ioapics covered
  intel-iommu: include linux/dmi.h to use dmi_ routines
  pci/dmar: correct off-by-one error in dmar_fault()
  intel-iommu: Cope with yet another BIOS screwup causing crashes
  intel-iommu: iommu init error path bug fixes
  intel-iommu: Mark functions with __init
  USB: Work around BIOS bugs by quiescing USB controllers earlier
  ia64: IOMMU passthrough mode shouldn't trigger swiotlb init
  intel-iommu: make domain_add_dev_info() call domain_context_mapping()
  intel-iommu: Unify hardware and software passthrough support
  intel-iommu: Cope with broken HP DC7900 BIOS
  iommu=pt is a valid early param
  intel-iommu: double kfree()
  intel-iommu: Kill pointless intel_unmap_single() function
  ...

Fixed up trivial include lines conflict in drivers/pci/intel-iommu.c

15 years agomisc: remove redundant start_kernel prototypes
Rusty Russell [Wed, 23 Sep 2009 09:33:54 +0000 (10:33 +0100)]
misc: remove redundant start_kernel prototypes

Impact: cleanup

No need for redeclaration.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6
Linus Torvalds [Wed, 23 Sep 2009 17:04:37 +0000 (10:04 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/lrg/voltage-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6: (41 commits)
  regulator: Add some brief design documentation
  regulator: fix voltage range in da9034 ldo12
  regulator/driver: be more specific in nanodoc for is_enabled
  regulator/lp3971: drop unnecessary initialization
  regulator: drop 'default n'
  regulator: fix typos
  regulator: fix calculation of voltage range in da9034_set_ldo12_voltage()
  regulator: update a filename in documentation
  drivers/regulator/Kconfig: fix typo (s/Usersapce/Userspace/) in REGULATOR_USERSPACE_CONSUMER description
  REGULATOR Handle positive returncode from enable
  regulator: tps650xx - build fixes for x86_64
  Fix some regulator documentation
  Regulator: Adding TPS65023 and TPS6507x in Kconfig and Makefile
  Regulator: Add TPS6507x regulator driver
  Regulator: Add TPS65023 regulator driver
  regulator: userspace: use sysfs_create_group
  regulator: Add GPIO enable control to fixed voltage regulator driver
  Regulator: Implement list_voltage for pcf50633 regulator driver.
  regulator: regulator_enable() permission checking
  regulator: Push locking for regulator_is_enabled() out
  ...

15 years agoMerge branch 'fix/misc' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
Linus Torvalds [Wed, 23 Sep 2009 17:04:14 +0000 (10:04 -0700)]
Merge branch 'fix/misc' of git://git./linux/kernel/git/tiwai/sound-2.6

* 'fix/misc' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ALSA: lx6464es - remove unused struct member
  ALSA: lx6464es - cleanup of rmh message bus function
  ALSA: pcm - Simplify snd_pcm_drain() implementation