Commit Graph

2190 Commits

Author SHA1 Message Date
Julia Lawall 00b275dbfc drivers/mtd/maps: introduce missing kfree
Error handling code following a kmalloc should free the allocated data.

The semantic match that finds the problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r exists@
local idexpression x;
statement S;
expression E;
identifier f,f1,l;
position p1,p2;
expression *ptr != NULL;
@@

x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
...
if (x == NULL) S
<... when != x
     when != if (...) { <+...x...+> }
(
x->f1 = E
|
 (x->f1 == NULL || ...)
|
 f(...,x->f1,...)
)
...>
(
 return \(0\|<+...x...+>\|ptr\);
|
 return@p2 ...;
)

@script:python@
p1 << r.p1;
p2 << r.p2;
@@

print "* file: %s kmalloc %s return %s" % (p1[0].file,p1[0].line,p2[0].line)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-06-03 11:29:25 +01:00
Anatolij Gustschin b51adeae29 of/mtd: nand: fix build breakage in drivers
Fixes build errors in drivers caused by the OF device_node
pointer being moved into struct device

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-06-03 11:28:45 +01:00
Wolfram Sang fbae3fb154 i2c: Remove all i2c_set_clientdata(client, NULL) in drivers
I2C drivers can use the clientdata-pointer to point to private data. As I2C
devices are not really unregistered, but merely detached from their driver, it
used to be the drivers obligation to clear this pointer during remove() or a
failed probe(). As a couple of drivers forgot to do this, it was agreed that it
was cleaner if the i2c-core does this clearance when appropriate, as there is
no guarantee for the lifetime of the clientdata-pointer after remove() anyhow.
This feature was added to the core with commit
e4a7b9b04d to fix the faulty drivers.

As there is no need anymore to clear the clientdata-pointer, remove all current
occurrences in the drivers to simplify the code and prevent confusion.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Richard Purdie <rpurdie@linux.intel.com>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-06-03 11:33:58 +02:00
Maxim Levitsky 5869d2c387 mtd: Fix NAND submenu
Move MTD_NAND_ECC and MTD_NAND_ECC_SMC above NAND memuconfig, to unbreak
display in xconfig. This shouldn't change any dependencies.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-06-03 07:48:24 +01:00
Anatolij Gustschin c8a4d0fd2a of/mtd: nand: fix build breakage in drivers
Fixes build errors in drivers caused by the OF device_node
pointer being moved into struct device

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-06-02 21:02:38 -06:00
Anatolij Gustschin 14acbbf8ba of/mtd/nand: mpc5121_nfc.c: Fix build failures
Fixes build errors caused by the:
 - OF device_node pointer being moved into struct device
 - removal of the match_table field from struct of_platform_driver

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-06-02 13:45:07 -06:00
Maxim Levitsky ac373f7e22 mtd/r852: update card detect early.
This turns out to be the reason for DMA timeouts on resume,
if card was inserted while system was suspended

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-06-02 15:35:31 +01:00
Maxim Levitsky 9489be8ca2 mtd/r852: Fixes in case of DMA timeout
* Don't call complete on dma completion
* do a INIT_COMPLETE before using it each time
* Report DMA read error via ecc 'correct'

I finally managed to make my system do suspend to ram propertly, and I see that
if card was inserted during suspend (while system was off), I get dma timeouts
on resume. Simple card reinsert solves the issue.
This patch solves a crash that would happen otherwise

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-06-02 14:53:40 +01:00
Maxim Levitsky cc1fed00c9 mtd/r852: register IRQ as last step
Otherwise, if it fires right away, it might access
uninitialized spinlock

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-06-02 14:53:16 +01:00
Christoph Hellwig 7ea8085910 drop unused dentry argument to ->fsync
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2010-05-27 22:05:02 -04:00
Linus Torvalds f13771187b Merge branch 'bkl/ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing
* 'bkl/ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing:
  uml: Pushdown the bkl from harddog_kern ioctl
  sunrpc: Pushdown the bkl from sunrpc cache ioctl
  sunrpc: Pushdown the bkl from ioctl
  autofs4: Pushdown the bkl from ioctl
  uml: Convert to unlocked_ioctls to remove implicit BKL
  ncpfs: BKL ioctl pushdown
  coda: Clean-up whitespace problems in pioctl.c
  coda: BKL ioctl pushdown
  drivers: Push down BKL into various drivers
  isdn: Push down BKL into ioctl functions
  scsi: Push down BKL into ioctl functions
  dvb: Push down BKL into ioctl functions
  smbfs: Push down BKL into ioctl function
  coda/psdev: Remove BKL from ioctl function
  um/mmapper: Remove BKL usage
  sn_hwperf: Kill BKL usage
  hfsplus: Push down BKL into ioctl function
2010-05-24 08:01:10 -07:00
Julia Lawall df1f1d1cb4 drivers/mtd: Use memdup_user
Use memdup_user when user data is immediately copied into the
allocated region.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression from,to,size,flag;
position p;
identifier l1,l2;
@@

-  to = \(kmalloc@p\|kzalloc@p\)(size,flag);
+  to = memdup_user(from,size);
   if (
-      to==NULL
+      IS_ERR(to)
                 || ...) {
   <+... when != goto l1;
-  -ENOMEM
+  PTR_ERR(to)
   ...+>
   }
-  if (copy_from_user(to, from, size) != 0) {
-    <+... when != goto l2;
-    -EFAULT
-    ...+>
-  }
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-22 11:49:37 +01:00
Grant Likely cf9b59e9d3 Merge remote branch 'origin' into secretlab/next-devicetree
Merging in current state of Linus' tree to deal with merge conflicts and
build failures in vio.c after merge.

Conflicts:
	drivers/i2c/busses/i2c-cpm.c
	drivers/i2c/busses/i2c-mpc.c
	drivers/net/gianfar.c

Also fixed up one line in arch/powerpc/kernel/vio.c to use the
correct node pointer.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-05-22 00:36:56 -06:00
Grant Likely 4018294b53 of: Remove duplicate fields from of_platform_driver
.name, .match_table and .owner are duplicated in both of_platform_driver
and device_driver.  This patch is a removes the extra copies from struct
of_platform_driver and converts all users to the device_driver members.

This patch is a pretty mechanical change.  The usage model doesn't change
and if any drivers have been missed, or if anything has been fixed up
incorrectly, then it will fail with a compile time error, and the fixup
will be trivial.  This patch looks big and scary because it touches so
many files, but it should be pretty safe.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Sean MacLennan <smaclennan@pikatech.com>
2010-05-22 00:10:40 -06:00
Linus Torvalds 05ec7dd8dd Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (154 commits)
  mtd: cfi_cmdset_0002: use AMD standard command-set with Winbond flash chips
  mtd: cfi_cmdset_0002: Fix MODULE_ALIAS and linkage for new 0701 commandset ID
  mtd: mxc_nand: Remove duplicate NAND_CMD_RESET case value
  mtd: update gfp/slab.h includes
  jffs2: Stop triggering block erases from jffs2_write_super()
  jffs2: Rename jffs2_erase_pending_trigger() to jffs2_dirty_trigger()
  jffs2: Use jffs2_garbage_collect_trigger() to trigger pending erases
  jffs2: Require jffs2_garbage_collect_trigger() to be called with lock held
  jffs2: Wake GC thread when there are blocks to be erased
  jffs2: Erase pending blocks in GC pass, avoid invalid -EIO return
  jffs2: Add 'work_done' return value from jffs2_erase_pending_blocks()
  mtd: mtdchar: Do not corrupt backing device of device node inode
  mtd/maps/pcmciamtd: Fix printk format for ssize_t in debug messages
  drivers/mtd: Use kmemdup
  mtd: cfi_cmdset_0002: Fix argument order in bootloc warning
  mtd: nand: add Toshiba TC58NVG0 device ID
  pcmciamtd: add another ID
  pcmciamtd: coding style cleanups
  pcmciamtd: fixing obvious errors
  mtd: chips: add SST39WF160x NOR-flashes
  ...

Trivial conflicts due to dev_node removal in drivers/mtd/maps/pcmciamtd.c
2010-05-21 07:25:43 -07:00
Linus Torvalds c316ba3b51 Merge branch 'linux-next' of git://git.infradead.org/ubi-2.6
* 'linux-next' of git://git.infradead.org/ubi-2.6:
  UBI: misc comment fixes
  UBI: fix s/then/than/ typos
  UBI: init even if MTD device cannot be attached, if built into kernel
  UBI: remove reboot notifier
2010-05-21 07:23:12 -07:00
Guillaume LECERF 8046112818 mtd: cfi_cmdset_0002: use AMD standard command-set with Winbond flash chips
Tested with W19L320SBT9C [1].

[1] http://www.datasheetarchive.com/pdf-datasheets/Datasheets-40/DSA-795343.pdf

[dwmw2: Fix MODULE_ALIAS and linkage]
Signed-off-by: Obinou <obconseil@gmail.com>
Signed-off-by: Guillaume LECERF <glecerf@gmail.com>
Acked-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-20 16:57:00 +01:00
David Woodhouse 1e804cec7a mtd: cfi_cmdset_0002: Fix MODULE_ALIAS and linkage for new 0701 commandset ID
Signed-off-by: Guillaume LECERF <glecerf@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-20 16:56:27 +01:00
David Woodhouse 73850975e9 mtd: mxc_nand: Remove duplicate NAND_CMD_RESET case value
This reverts commit 66803762 ("mtd: mxc_nand: add RESET command support").
Support for NAND_CMD_RESET was added separately in commit d4840180
("mtd: mxc_nand: set NFC registers after reset"), causing a build error:

drivers/mtd/nand/mxc_nand.c: In function 'mxc_nand_command':
drivers/mtd/nand/mxc_nand.c:689: error: duplicate case value
drivers/mtd/nand/mxc_nand.c:606: error: previously used here

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-20 10:10:33 +01:00
Tejun Heo 05d71b4625 mtd: update gfp/slab.h includes
Implicit slab.h inclusion via percpu.h is about to go away.  Make sure
gfp.h or slab.h is included as necessary.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-19 17:21:52 +01:00
Grant Likely 61c7a080a5 of: Always use 'struct device.of_node' to get device node pointer.
The following structure elements duplicate the information in
'struct device.of_node' and so are being eliminated.  This patch
makes all readers of these elements use device.of_node instead.

(struct of_device *)->node
(struct dev_archdata *)->prom_node (sparc)
(struct dev_archdata *)->of_node (powerpc & microblaze)

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-05-18 16:10:44 -06:00
Kirill A. Shutemov cd874237d9 mtd: mtdchar: Do not corrupt backing device of device node inode
We cannot modify file->f_mapping->backing_dev_info, because it will corrupt
backing device of device node inode, since file->f_mapping is equal to
inode->i_mapping (see __dentry_open() in fs/open.c).

Let's introduce separate inode for MTD device with appropriate backing
device.

[dwmw2: Refactor to keep it all entirely within mtdchar.c; use iget_locked()]

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-18 12:19:36 +01:00
David Woodhouse 11c93605fa mtd/maps/pcmciamtd: Fix printk format for ssize_t in debug messages
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-17 07:01:41 +01:00
Arnd Bergmann 55929332c9 drivers: Push down BKL into various drivers
These are the last remaining device drivers using
the ->ioctl file operation in the drivers directory
(except from v4l drivers).

[fweisbec: drop i8k pushdown as it has been done from
procfs pushdown branch already]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
2010-05-17 05:27:41 +02:00
Julia Lawall d80f2666b5 drivers/mtd: Use kmemdup
Use kmemdup when some other buffer is immediately copied into the
allocated region.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression from,to,size,flag;
statement S;
@@

-  to = \(kmalloc\|kzalloc\)(size,flag);
+  to = kmemdup(from,size,flag);
   if (to==NULL || ...) S
-  memcpy(to, from, size);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-15 23:07:01 +01:00
David Woodhouse abab7ebf8c mtd: cfi_cmdset_0002: Fix argument order in bootloc warning
Doh. Pointed out by Guillaume LECERF <glecerf@gmail.com> since I managed
to miss it in my test builds. S'what I get for hacking at 2am, I suppose.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 09:14:27 +01:00
Florian Fainelli f6b173cc9d mtd: nand: add Toshiba TC58NVG0 device ID
This NAND flash part advertises 0xD1 as an identifier but is still a working
128MBytes x 8bits 3.3V NAND part.

Signed-off-by: Florian Fainelli <ffainelli@freebox.fr>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 03:25:52 +01:00
Dominik Brodowski b2321ac37a pcmciamtd: add another ID
Reported-by: Komuro <komurojun-mbn@nifty.com>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 03:23:40 +01:00
Alexander Kurz 9bdde162eb pcmciamtd: coding style cleanups
Signed-off-by: Alexander Kurz <linux@kbdbabel.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 03:23:33 +01:00
Alexander Kurz f6763c98cb pcmciamtd: fixing obvious errors
After fixing the obvious errors, the driver will now compile
again on v2.6.34-rc3. First tests with two 4MB flash cards including
erase- and write test with one of the cards where successful.

Also, add two new PCMCIA_DEVICE_PROD_IDs.

[linux@dominikbrodowski.net: clean up commit message]
Signed-off-by: Alexander Kurz <linux@kbdbabel.org>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 03:23:01 +01:00
Wolfram Sang 087acaf1c6 mtd: chips: add SST39WF160x NOR-flashes
Due to a broken CFI, they have to be added to jedec_probe.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 02:27:46 +01:00
Kevin Cernekee b60b08b02c mtd: nand: support alternate BB marker locations on MLC
This is a slightly modified version of a patch submitted last year by
Reuben Dowle <reuben.dowle@navico.com>.  His original comments follow:

This patch adds support for some MLC NAND flashes that place the BB
marker in the LAST page of the bad block rather than the FIRST page used
for SLC NAND and other types of MLC nand.

Lifted from Samsung datasheet for K9LG8G08U0A (1Gbyte MLC NAND):
"
Identifying Initial Invalid Block(s)
All device locations are erased(FFh) except locations where the initial
invalid block(s) information is written prior to shipping. The initial
invalid block(s) status is defined by the 1st byte in the spare area.
Samsung makes sure that the last page of every initial invalid block has
non-FFh data at the column address of 2,048.
...
"

As far as I can tell, this is the same for all Samsung MLC nand, and in
fact the samsung bsp for the processor used in our project (s3c6410)
actually contained a hack similar to this patch but less portable to
enable use of their NAND parts. I discovered this problem when trying to
use a Micron NAND which does not used this layout - I wish samsung would
put their stuff in main-line to avoid this type of problem.

Currently this patch causes all MLC nand with manufacturer codes from
Samsung and ST(Numonyx) to use this alternative location, since these
are the manufactures that I know of that use this layout.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:56:12 +01:00
Kevin Cernekee 426c457a32 mtd: nand: extend NAND flash detection to new MLC chips
Some of the newer MLC devices have a 6-byte ID sequence in which
several field definitions differ from older chips in a manner that is
not backward compatible.  For instance:

Samsung K9GAG08U0M (5-byte sequence): ec d5 14 b6 74
4th byte, bits 1:0 encode the page size: 0=1KiB, 1=2KiB, 2=4KiB, 3=8KiB
4th byte, bits 5:4 encode the block size: 0=64KiB, 1=128KiB, ...
4th byte, bit 6 encodes the OOB size: 0=8B/512B, 1=16B/512B

Samsung K9GAG08U0D (6-byte sequence): ec d5 94 29 34 41
4th byte, bits 1:0 encode the page size: 0=2KiB, 1=4KiB, 3=8KiB, 4=rsvd
4th byte, bits 7;5:4 encode the block size: 0=128KiB, 1=256KiB, ...
4th byte, bits 6;3:2 encode the OOB size: 1=128B/page, 2=218B/page

This patch uses the new 6-byte scheme if the following conditions are
all true:

1) The ID code wraps around after exactly 6 bytes

2) Manufacturer is Samsung

3) 6th byte is zero

The patch also extends the maximum OOB size from 128B to 256B.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:54:44 +01:00
H Hartley Sweeten 0ffe0ce36e mtd: sst25l: fix multi-part messages with broken spi masters
Some SPI masters (ep93xx) have limitations when using the SFRMOUT
signal for the spi device chip select.  The SFRMOUT signal is
only asserted as long as the spi transmit fifo contains data.  As
soon as the last bit is clocked into the receive fifo it gets
deasserted.

The functions sst25l_status and sst25l_match_device use the API
function spi_write_then_read to write a command to the flash then
read the response back.  This API function creates a two part spi
message for the write then read.  When this message is transferred
the SFRMOUT signal ends up getting deasserted after the command
phase.  This causes the command to get aborted by the device so
the read phase returns invalid data.

By changing sst25l_status and sst25l_match_device to use a single
transfer synchronous message, the SFRMOUT signal stays asserted
during the entire message so the correct data always gets returned.

This change will have no effect on SPI masters which use a chip
select mechanism (GPIO's, etc.) which does stay asserted correctly.
As a bonus, the single transfer synchronous messages complete faster
than multi-part messages.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:52:24 +01:00
Kyungmin Park 46f3e88bd9 mtd: add Samsung SoC OneNAND driver
This patch adds a driver for OneNAND controller on Samsung SoCs.
Following SoCs are supported: S3C6400, S3C6410, S5PC100 and S5PC110.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:51:20 +01:00
Kyungmin Park c37cb56fb1 mtd: onenand: add workaround for SYNC_WRITE mode
Some chips fails to identify properly when SYNC_WRITE mode is enabled
(the example is OneNAND on S5PC110 SoC). This patch adds a workaround
for such chips.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:50:21 +01:00
Kyungmin Park 3328dc3159 mtd: onenand: add new callback for bufferram read
This patch adds a new callback for the underlying drivers, which is
called instead of accessing the buffer ram directly. This callback will
be used by Samsung OneNAND driver to implement DMA transfers on S5PC110
SoC.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:50:04 +01:00
Kyungmin Park 4a8ce0b030 mtd: onenand: allocate verify buffer in the core
This patch extends OneNAND core code with support for OneNAND verify
write check. This is done by allocating the buffer for verify read
directly from the core code.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:49:48 +01:00
Kyungmin Park 6a88c47bd5 mtd: onenand: add support for chips with 4KiB page size
This patch adds support for OneNAND chips that have 4KiB page size.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:49:21 +01:00
Artem Bityutskiy 7d84b6273c mtd: jedec_probe: remove spaces before tabs
Nothing very important, this just makes git am stop producing warnings.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:49:03 +01:00
Wolfram Sang ae73182229 mtd: chips: use common manufacturer codes in jedec_probe()
Factor out old manufacturers and use the generic ones from cfi.h

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:48:58 +01:00
Guillaume LECERF 087444da61 mtd: cfi_util: do not printk if no extended query table
Signed-off-by: Guillaume LECERF <glecerf@gmail.com>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:39:55 +01:00
Guillaume LECERF 5a0563f0ad mtd: cfi_cmdset_0002: add CFI detection for SST 39VF{32, 64}xxB chips
This patch adds support for detecting SST 39VF32xxB and 39VF64xxB
chips in CFI mode.

Signed-off-by: Guillaume LECERF <glecerf@gmail.com>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:39:43 +01:00
Guillaume LECERF 83dcd3bb11 mtd: cfi_cmdset_0002: add CFI detection for SST 39VF{16, 32}xx chips
SST 39VF{16,32}xx chips use the 0x0701 command set, fully compatible
with the AMD one. This patch adds support for detecting them in CFI
mode.

Signed-off-by: Guillaume LECERF <glecerf@gmail.com>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:39:23 +01:00
David Woodhouse 412da2f6e0 mtd: cfi_cmdset_0002: Tone down warning messages about TopBottom CFI field
Accept values of 2-5 for TopBottom, where the newly-added 4 and 5 values
mean a uniform layout. It does indicate WP layout but we don't handle that.

Also don't say "broken" when swapping erase regions in a top-boot chip.
That got retrospectively documented in the spec.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:39:20 +01:00
Guillaume LECERF 564b84978d mtd: cfi_cmdset_0002: do not fail on no extended query table as they are both optional
After looking at AMD's CFI specification [1], both of the extended query
tables are optional. Thus, it looks like relying that at least one of
those tables exist is a bug in cfi_cmdset_0002.

This patch inverts the logic and checks for unlock function pointers before
exiting on error. This approach leaves place to add a call to a fixup
function to try to handle chips compatible with the early AMD specification
from 1995 [2].

[1] http://www.amd.com/us-en/assets/content_type/DownloadableAssets/cfi_r20.pdf
[2] http://noel.feld.cvut.cz/hw/amd/20158a.pdf

Signed-off-by: Guillaume LECERF <glecerf@gmail.com>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:33:27 +01:00
Guillaume LECERF 5859886122 mtd: cfi_probe: use P_ID_* definitions instead of hardcoded values
Use P_ID_* definitions already in include/linux/mtd/cfi.h instead of the
hardcoded values. Make the code more readable.

Signed-off-by: Guillaume LECERF <glecerf@gmail.com>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:08:19 +01:00
Guillaume LECERF 54b93a49d8 mtd: cfi_probe: add support for SST 0x0701 vendorname
SST 39VF160x and 39VF320x chips use vendorname id 0x0701 and alternative
unlock addresses. Add support for them in cfi_probe.c.

Signed-off-by: Guillaume LECERF <glecerf@gmail.com>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:08:11 +01:00
Guillaume LECERF ad7026fef6 mtd: cfi_probe: make the addresses used to enter Auto Select Mode variable
Make the addresses used to enter Auto Select Mode variable to leave place
for handling chips using non-standard addresses.

Signed-off-by: Guillaume LECERF <glecerf@gmail.com>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:07:49 +01:00
Guillaume LECERF 8473044d64 mtd: cfi_probe: enter Auto Select Mode after filling cfi->cfiq members
Move the code to enter Auto Select Mode down to be able to use cfi->cfiq
members to add support for chips using alternative sequence / unlock
addresses.

Signed-off-by: Guillaume LECERF <glecerf@gmail.com>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:07:42 +01:00
Ben Dooks eedfea2526 mtd: orion/kirkwood: add RnB line support to orion mtd driver
Add support for a board to register a callback to get the state of the
RnB line if it has it attached.

Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:04:19 +01:00
Maxim Levitsky c3611570dd mtd: sm_common: split smartmedia and xD table
2GB xD card, and 4MB SmartMedia ROM card share same ID, so to make both work
split xD and smartmedia ID tables.

Hardware driver must be able to know which type it handles (and probably just one).

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:03:46 +01:00
Ivo Clarysse a47bfd2eb6 mtd: mxc_nand: support i.MX21
On i.MX21 SoCs, if the NFC_CONFIG1:NFC_INT_MASK bit is set,
NFC_CONFIG2:NFC_INT always reads out zero, even if an
operation is completed.  This patch uses enable_irq and
disable_irq_nosync instead of NFC_CONFIG1:NFC_INT_MASK to
mask NFC interrupts.  This allows NFC_CONFIG2:NFC_INT to also
be used to detect operation completion on i.MX21.

The i.MX21 NFC does not signal reset completion using
NFC_CONFIG1:NFC_INT_MASK, so instead reset completion is
tested by checking if NFC_CONFIG2 becomes 0.

Signed-off-by: Ivo Clarysse <ivo.clarysse@gmail.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:02:53 +01:00
Ivo Clarysse d484018056 mtd: mxc_nand: set NFC registers after reset
This patch allows the mxc_nand driver to reset the NAND
flash controller.  NFC registers are (re-)set after
completion of the reset, as a reset will have reverted
the NFC registers to their default values.

Signed-off-by: Ivo Clarysse <ivo.clarysse@gmail.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 01:02:32 +01:00
Jason Gunthorpe 9d5da3a9b8 mtd: extend physmap_of to let the device tree specify the parition probe
This is to support custom partitioning schemes for embedded PPC. To use
define your own mtd_part_parser and then add something like:
   linux,part-probe = "my_probe", "cmdlinepart";
To the board's dts file.

If linux,part-probe is not specified then this behaves the same as before.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-14 00:32:30 +01:00
Julia Lawall 2bfefa4c96 drivers/mtd: Use kzalloc
Use kzalloc rather than the combination of kmalloc and memset.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,size,flags;
statement S;
@@

-x = kmalloc(size,flags);
+x = kzalloc(size,flags);
 if (x == NULL) S
-memset(x, 0, size);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-13 21:23:06 +01:00
Julia Lawall ecce2a6f9b drivers/mtd/nand: Use kzalloc
Use kzalloc rather than the combination of kmalloc and memset.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,size,flags;
statement S;
@@

-x = kmalloc(size,flags);
+x = kzalloc(size,flags);
 if (x == NULL) S
-memset(x, 0, size);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-13 21:21:38 +01:00
David Woodhouse aadff49c56 mtd/nand: Fix denali build on ppc64
drivers/mtd/nand/denali.c:1427: error: conflicting types for ‘enable_dma’
arch/powerpc/include/asm/dma.h:189: note: previous definition of ‘enable_dma’ was here

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-13 16:12:45 +01:00
Jason Roberts ce082596ae mtd/nand: Add Intel Moorestown/Denali NAND support
There is more work to be done on this but it is basically working now.

Signed-off-by: Jason Roberts <jason.e.roberts@intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-13 16:12:16 +01:00
David Woodhouse 0ae28a35bc Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
	drivers/mtd/mtdcore.c

Pull in the bdi fixes and ARM platform changes that other outstanding
patches depend on.
2010-05-10 14:32:46 +01:00
Steve Deiters 6f1f3d0ab5 mtd: mpc5121_nfc: Changed SVR check to allow MPC5123.
The revision in SVR for MPC5123 is 3.  The NFC is the same as MPC5121
revision 2.

Signed-off-by: Steve Deiters <SteveDeiters@basler.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-10 14:27:16 +01:00
H Hartley Sweeten 29da3380de mtd: sst25l: remove unnecessary MTD_DEBUG_LEVEL2 messages
All the SST25L series flash parts have uniform erase sectors.  Remove
the extra MTD_DEBUG_LEVEL2 messages showing the eraseregions info
since they could never be shown.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-10 14:27:08 +01:00
Kevin Cernekee eafe1311aa mtd: cfi_cmdset_0002: Add reboot notifier for AMD flashes
Ensure that the flash device is in a quiescent state before rebooting.
The implementation is closely modeled after the cfi_cmdset_0001 reboot
notifier, commit 963a6fb0a0 .

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-10 14:25:12 +01:00
Marc Kleine-Budde bff3c10d36 mtd: pxa32xx_nand: add support for partition table parsing
The pxa32xx_nand driver doesn't support partition tables from the
command line. This patch adds support for it.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-10 14:23:43 +01:00
Huang Weiyi 1dd2a092af mtd/nand/bcm_umi: remove unused #include <linux/version.h>
Remove unused #include <linux/version.h>('s) in
  drivers/mtd/nand/bcm_umi_nand.c

Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
Acked-by: Leo Chen <leochen@broadcom.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-10 14:23:13 +01:00
Julia Lawall 258006d1ab mtd: maps: Eliminate use after free
Moved the debugging message before the call to map_destroy, which frees its
argument.  The message is also slightly changed to reflect its new
position.

A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression E,E2;
@@

del_mtd_device(E)
...
(
  E = E2
|
* E
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-10 14:22:55 +01:00
Stefani Seibold c4e773764c mtd: fix a huge latency problem in the MTD CFI and LPDDR flash drivers.
The use of a memcpy() during a spinlock operation will cause very long
thread context switch delays if the flash chip bandwidth is low and the
data to be copied large, because a spinlock will disable preemption.

For example: A flash with 6,5 MB/s bandwidth will cause under ubifs,
which request sometimes 128 KiB (the flash erase size), a preemption delay of
20 milliseconds. High priority threads will not be served during this
time, regardless whether this threads access the flash or not. This behavior
breaks real time.

The patch changes all the use of spin_lock operations for xxxx->mutex
into mutex operations, which is exact what the name says and means.

I have checked the code of the drivers and there is no use of atomic
pathes like interrupt or timers. The mtdoops facility will also not be used
by this drivers. So it is dave to replace the spin_lock against mutex.

There is no performance regression since the mutex is normally not
acquired.

Changelog:
 06.03.2010 First release
 26.03.2010 Fix mutex[1] issue and tested it for compile failure

Signed-off-by: Stefani Seibold <stefani@seibold.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-10 14:22:30 +01:00
Ferenc Wagner b92b5c41a0 mtd/nand/fsl_upm: Replace the dangerous to_fsl_upm_nand macro
The original macro worked only when applied to variables named 'mtd'.
While this could have been fixed by simply renaming the macro argument,
a more type-safe replacement is preferred.

Signed-off-by: Ferenc Wagner <wferi@niif.hu>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-10 14:18:28 +01:00
Mika Westerberg 4a70b7d395 mtd: OneNAND: OMAP2/3: unmap correct DMA buffer
Functions omap2_onenand_write_bufferram() and omap3_onenand_write_bufferram()
map the write buffer and store the returned handle in variable dma_src. However,
when DMA unmap is done, variable dma_dst is used instead of the correct dma_src.

This patch fixes them to use the correct DMA buffer.

Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
Tested-by: Arnaud Ebalard <arno@natisbad.org>
Acked-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>
2010-05-10 14:17:05 +01:00
Mike Frysinger ac39ee304a mtd: Blackfin NFC: localize MMR bit masks
Convert all magic numbers into appropriate defines, and move the defines
out of the global namespace and into this one driver.  No other driver
needs to care about the MMR layout anyways.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-10 14:16:43 +01:00
Ferenc Wagner dad9431890 mtd: kconfig: remove stray endchoice from help text
Signed-off-by: Ferenc Wagner <wferi@niif.hu>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-10 14:12:17 +01:00
Artem Bityutskiy 0bfa4df2b6 mtd: nandsim: make some structures anonymous
We do not need these names. Moreover, there are spelling typos
there: "nansin" instead of "nandsim".

This patch is just a clean up, no functional changes.

Reported-by: Ferenc Wagner <wferi@niif.hu>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-05-10 14:12:06 +01:00
Dominik Brodowski 317b6d6300 pcmcia: dev_node removal (write-only drivers)
dev_node_t was only used to transport some minor/major numbers
from the PCMCIA device drivers to deprecated userspace helpers.
However, only a few drivers made use of it, and the userspace
helpers are deprecated anyways. Therefore, get rid of dev_node_t .

As a first step, remove any usage of dev_node_t from drivers which
only wrote to this typedef/struct, but did not make use of it.

CC: linux-bluetooth@vger.kernel.org
CC: Harald Welte <laforge@gnumonks.org>
CC: linux-mtd@lists.infradead.org
CC: linux-wireless@vger.kernel.org
CC: netdev@vger.kernel.org
CC: linux-serial@vger.kernel.org
CC: alsa-devel@alsa-project.org
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
2010-05-10 10:23:14 +02:00
Shinya Kuribayashi be436f6238 UBI: misc comment fixes
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-05-07 08:33:32 +03:00
Shinya Kuribayashi 3f5026222e UBI: fix s/then/than/ typos
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-05-07 08:33:10 +03:00
Marc Kleine-Budde af7ad7a0a6 UBI: init even if MTD device cannot be attached, if built into kernel
UBI can be built into the kernel or be compiled as a kernel module.
Further on the command line one can specify MTD devices to be attach to
UBI while loading. In the current implementation the UBI driver refuses
to load if one of the MTD devices cannot be attached.

Consider:
1) UBI compiled into the kernel and
2) a MTD device specified on the command line and
3) this MTD device contains bogus data (for whatever reason).

During init UBI tries to attach the MTD device is this fails the whole
UBI subsystem isn't initialized. Later the userspace cannot attach any
MTD to UBI because UBI isn't loaded.

This patch keeps the current behaviour: if UBI is compiled as a module
and a MTD device cannot be attached the UBI module cannot be loaded,
but changes it for the UBI-is-built-into-the-kernel usecase.

If UBI is builtin, a not attachable MTD device doen't stop UBI from
initializing. This slightly modifies the behaviour if multiple MTD
devices are specified on the command line. Now every MTD device is
probed and, if possible, attached, i.e. a faulty MTD device doesn't
stop the others from being attached.

Artem: tweaked the patch

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-05-06 09:12:11 +03:00
Jeff Garzik 0fd6b32b3b [MTD] Remove zero-length files mtdbdi.c and internal.ho
Both were "removed" in commit a33eb6b910.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-05-05 15:25:12 -04:00
Kevin Cernekee 70d38b9625 UBI: remove reboot notifier
The UBI reboot notifier causes problems with hibernation.  Move this
functionality into the low-level MTD driver instead.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-05-03 09:08:13 +03:00
Linus Torvalds 970b06485f Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
  coda: move backing-dev.h kernel include inside __KERNEL__
  mtd: ensure that bdi entries are properly initialized and registered
  Move mtd_bdi_*mappable to mtdcore.c
  btrfs: convert to using bdi_setup_and_register()
  Catch filesystems lacking s_bdi
  drbd: Terminate a connection early if sending the protocol fails
  drbd: fix memory leak
  Fix JFFS2 sync silent failure
  smbfs: add bdi backing to mount session
  ncpfs: add bdi backing to mount session
  exofs: add bdi backing to mount session
  ecryptfs: add bdi backing to mount session
  coda: add bdi backing to mount session
  cifs: add bdi backing to mount session
  afs: add bdi backing to mount session.
  9p: add bdi backing to mount session
  bdi: add helper function for doing init and register of a bdi for a file system
  block: ensure jiffies wrap is handled correctly in blk_rq_timed_out_timer
2010-04-28 07:56:05 -07:00
Jens Axboe 0661b1ac5d mtd: ensure that bdi entries are properly initialized and registered
They will be holding dirty inodes and be responsible for flushing
them out, so they need to be setup properly.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2010-04-27 09:51:30 +02:00
Jörn Engel a33eb6b910 Move mtd_bdi_*mappable to mtdcore.c
Removes one .h and one .c file that are never used outside of
mtdcore.c.

Signed-off-by: Joern Engel <joern@logfs.org>

Edited to remove on leftover debug define.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2010-04-27 09:50:58 +02:00
Paulius Zaleckas a88a2b8864 mtd: fix Orion NAND driver compilation with ARM OABI
We must tell GCC to use even register for variable passed to ldrd
instruction.  Without this patch GCC 4.2.1 puts this variable to r2/r3 on
EABI and r3/r4 on OABI, so force it to r2/r3.  This does not change
anything when EABI and OABI compilation works OK.

Without this patch and with OABI I get:

    CC      drivers/mtd/nand/orion_nand.o
  /tmp/ccMkwOCs.s: Assembler messages:
  /tmp/ccMkwOCs.s:63: Error: first destination register must be even -- `ldrd r3,[ip]'
  make[5]: *** [drivers/mtd/nand/orion_nand.o] Error 1

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@gmail.com>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Acked-by: Artem Bityutskiy <dedekind1@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Jamie Lokier <jamie@shareable.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-04-24 11:31:24 -07:00
Jörn Engel 6de9400250 Fix JFFS2 sync silent failure
JFFS2 does not appear to set s_bdi anywhere.  And as of 32a88aa1,
__sync_filesystem() will return 0 if s_bdi is not set.  As a result,
sync_fs() is never called for jffs2 and whatever remains in the wbuf
will not make it to the device.

Fix that up by assigning the mtd bdi.

Signed-off-by: Jörn Engel <joern@logfs.org>
Acked-By: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2010-04-22 14:11:43 +02:00
H Hartley Sweeten 1ca5d2f019 mtd/maps/physmap: catch failure to register MTD_PHYSMAP_COMPAT device
If the default Kconfig values are used with MTD_PHYSMAP_COMPAT you end
up with a resource where end < start.  This causes __request_resource to
return a conflict which then returns an -EBUSY error code.  The current
physmap.c code just assumes that the platfom_device_register will always
succeed.

Catch this failure during the physmap_init and propogate the error.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-04-20 08:53:52 +01:00
Akinobu Mita fed457a836 bitops: rename for_each_bit() to for_each_set_bit(): mtd
Rename for_each_bit() to for_each_set_bit in the kernel source tree.  To
permit for_each_clear_bit(), should that ever be added.

I'll be sending a patch to Linus this week which removes the temporary
for_each_bit() macro, so this patch will be needed to avoid build
breakage.

Suggested-by: Alexey Dobriyan <adobriyan@gmail.com>
Suggested-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Artem Bityutskiy <dedekind@infradead.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-04-08 09:42:41 +01:00
Tejun Heo 5a0e3ad6af include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed.  Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability.  As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

  http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
  only the necessary includes are there.  ie. if only gfp is used,
  gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
  blocks and try to put the new include such that its order conforms
  to its surrounding.  It's put in the include block which contains
  core kernel includes, in the same order that the rest are ordered -
  alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
  doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
  because the file doesn't have fitting include block), it prints out
  an error message indicating which .h file needs to be added to the
  file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
   over 4000 files, deleting around 700 includes and adding ~480 gfp.h
   and ~3000 slab.h inclusions.  The script emitted errors for ~400
   files.

2. Each error was manually checked.  Some didn't need the inclusion,
   some needed manual addition while adding it to implementation .h or
   embedding .c file was more appropriate for others.  This step added
   inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
   from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
   e.g. lib/decompress_*.c used malloc/free() wrappers around slab
   APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
   editing them as sprinkling gfp.h and slab.h inclusions around .h
   files could easily lead to inclusion dependency hell.  Most gfp.h
   inclusion directives were ignored as stuff from gfp.h was usually
   wildly available and often used in preprocessor macros.  Each
   slab.h inclusion directive was examined and added manually as
   necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
   were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
   distributed build env didn't work with gcov compiles) and a few
   more options had to be turned off depending on archs to make things
   build (like ipr on powerpc/64 which failed due to missing writeq).

   * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
   * powerpc and powerpc64 SMP allmodconfig
   * sparc and sparc64 SMP allmodconfig
   * ia64 SMP allmodconfig
   * s390 SMP allmodconfig
   * alpha SMP allmodconfig
   * um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
   a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-30 22:02:32 +09:00
Stephen Rothwell 8da552f261 mtd: SmartMedia/xD FTL: use of kmalloc/kfree requires the include of slab.h
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-03-29 14:14:04 +01:00
Maxim Levitsky 01de69c2b0 mtd: sm_ftl: remove CONFIG_SM_FTL_MUSEUM and make it always on
The sole purpose of this setting was to avoid a dependency on MTD_NAND. 
Now that we can depend on MTD_NAND_ECC without pulling in all the rest 
of the NAND code, we might as well do so unconditionally.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-03-26 15:28:59 +00:00
Maxim Levitsky e5f710cfc6 mtd: nand: split out ECC module
This way drivers could use ecc routines without depedency on whole nand

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-03-26 15:26:27 +00:00
Maxim Levitsky ca7081d96e mtd: sm_ftl: initialize sysfs attributes
This is new requirement in 2.6.34

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-03-26 15:04:15 +00:00
David Woodhouse 329f9052db Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
	drivers/mtd/nand/sh_flctl.c

Maxim's patch to initialise sysfs attributes depends on the patch which
actually adds sysfs_attr_init().
2010-03-26 14:55:59 +00:00
Wolfram Sang 395b228858 mtd/maps/pismo: remove dangling pointer and a leak
While looking for drivers which forgot to clear i2c_clientdata before freeing
the data structure it points to, I found that the pismo driver even has a leak
on the probe error path.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-03-21 08:28:34 +00:00
Jeff Garzik 17cf444249 Delete zero-length file drivers/mtd/maps/omap_nor.c
The content was deleted in cc87edb173,
but the file remained as a zero-length file.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-03-19 14:25:45 -04:00
Julia Lawall 4d682420ce mtd: block2mtd: Use kasprintf
kasprintf combines kmalloc and sprintf, and takes care of the size
calculation itself.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression a,flag;
expression list args;
statement S;
@@

  a =
-  \(kmalloc\|kzalloc\)(...,flag)
+  kasprintf(flag,args)
  <... when != a
  if (a == NULL || ...) S
  ...>
- sprintf(a,args);
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-03-18 15:04:09 +00:00
Matteo Croce 42c259193e mtd: small typo in Makefile
Cosmetic fix: the path in the Makefile is wrong

Signed-off-by: Matteo Croce <matteo@teknoraver.net>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-03-18 07:53:16 +00:00
Magnus Damm 3e862c05ca mtd: enable sh_flctl on SH-Mobile ARM
Update the Kconfig entry for the sh_flctl driver to
enable build on SH-Mobile ARM platforms.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-03-15 11:13:15 +09:00
Linus Torvalds c32da02342 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (56 commits)
  doc: fix typo in comment explaining rb_tree usage
  Remove fs/ntfs/ChangeLog
  doc: fix console doc typo
  doc: cpuset: Update the cpuset flag file
  Fix of spelling in arch/sparc/kernel/leon_kernel.c no longer needed
  Remove drivers/parport/ChangeLog
  Remove drivers/char/ChangeLog
  doc: typo - Table 1-2 should refer to "status", not "statm"
  tree-wide: fix typos "ass?o[sc]iac?te" -> "associate" in comments
  No need to patch AMD-provided drivers/gpu/drm/radeon/atombios.h
  devres/irq: Fix devm_irq_match comment
  Remove reference to kthread_create_on_cpu
  tree-wide: Assorted spelling fixes
  tree-wide: fix 'lenght' typo in comments and code
  drm/kms: fix spelling in error message
  doc: capitalization and other minor fixes in pnp doc
  devres: typo fix s/dev/devm/
  Remove redundant trailing semicolons from macros
  fix typo "definetly" -> "definitely" in comment
  tree-wide: s/widht/width/g typo in comments
  ...

Fix trivial conflict in Documentation/laptops/00-INDEX
2010-03-12 16:04:50 -08:00
Linus Torvalds dca1d9f6d7 Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (370 commits)
  ARM: S3C2443: Add set_rate and round_rate calls for armdiv clock
  ARM: S3C2443: Remove #if 0 for clk_mpll
  ARM: S3C2443: Update notes on MPLLREF clock
  ARM: S3C2443: Further clksrc-clk conversions
  ARM: S3C2443: Change to using plat-samsung clksrc-clk implementation
  USB: Fix s3c-hsotg build following Samsung platform header moves
  ARM: S3C64XX: Reintroduce unconditional build of audio device
  ARM: 5961/1: ux500: fix CLKRST addresses
  ARM: 5977/1: arm: Enable backtrace printing on oops when PC is corrupted
  ASoC: Fix S3C64xx IIS driver for Samsung header reorg
  ARM: S3C2440: Fix plat-s3c24xx move of s3c2440/s3c2442 support
  [ARM] pxa: fix typo in mxm8x10.h
  [ARM] pxa/raumfeld: set GPIO drive bits for LED pins
  [ARM] pxa/zeus: Add support for mcp2515 CAN bus
  [ARM] pxa/zeus: Add support for onboard max6369 watchdog
  [ARM] pxa/zeus: Add Eurotech as the manufacturer
  [ARM] pxa/zeus: Correct the USB host initialisation flags
  [ARM] pxa/zeus: Allow usage of 8250-compatible UART in uncompress
  [ARM] pxa: refactor uncompress.h for non-PXA uarts
  [ARM] mmp2: fix incorrect calling of chip->mask_ack() for 2nd level cascaded IRQs
  ...
2010-03-12 16:00:54 -08:00
David Woodhouse 0c82d3ce2f mtd/nand/r852: Use pci_dma_mapping_error()
... instead of comparing with DMA_ERROR_CODE, which will only work on
powerpc/sparc/x86.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-03-11 09:25:18 -08:00
Randy Dunlap f696aa43fa mtd/nand/r852: fix build for CONFIG_PCI disabled
r852 fails to build when CONFIG_PCI is not enabled since it uses
pci_*() calls and is a PCI driver, so it should depend on PCI
to prevent build errors.
It should also #include <linux/pci.h>.

drivers/mtd/nand/r852.c:1053: error: implicit declaration of function 'pci_prepare_to_sleep'
drivers/mtd/nand/r852.c:1062: error: implicit declaration of function 'pci_back_from_sleep'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-03-11 09:19:12 -08:00
Maxim Levitsky e4d64cab99 mtd: blktrans: do blk_cleanup_queue when it is really safe to do so
I was calling it in del_mtd_blktrans_dev, but ->request_fn could
still be running at that point, thus defer this call
to blktrans_dev_release

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-03-08 18:57:42 -08:00
David Woodhouse 7de6f798e1 mtd: Make SM_FTL depend on MTD_NAND
Randy Dunlap observed a build problem with the following config:

CONFIG_SM_FTL=y
CONFIG_SM_FTL_MUSEUM=y

CONFIG_MTD_NAND=m

The ECC calculation routines are then built as a module, but referenced
by the sm_ftl code in the kernel, resulting in a build failure. The
simple fix is to make CONFIG_SM_FTL depend on MTD_NAND unconditionally
-- it's pointless without hardware support anyway.

Fix some typos which Randy pointed out, too.

Reported-By: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-03-08 18:45:06 -08:00
Stephen Rothwell 1f6ca0d621 mtd: nand: r852: declare inline functions static
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-03-08 18:34:05 -08:00
Stephen Rothwell ada4965788 mtd: nand: r852: fix name space clash
and include delay.h for msleep().

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-03-08 18:33:19 -08:00
Randy Dunlap b2aaf7a2b4 mtd/nand/r852: fix build for CONFIG_PM=n
Fix r852 build for the case of CONFIG_PM=n.

drivers/mtd/nand/r852.c:1039: error: implicit declaration of function 'pci_prepare_to_sleep'
drivers/mtd/nand/r852.c:1048: error: implicit declaration of function 'pci_back_from_sleep'

This patch leaves r852_pm_ops untouched.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-03-08 18:32:05 -08:00
Maxim Levitsky fb45d3232c mtd: r852: Few fixes for problems that occur when card is rapidly inserted/removed.
First don't enable card detection logic to early. Second be very careful with
DMA engine, to be sure it doesn't write to kernel memory driver doesn't own.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-03-08 18:31:18 -08:00
Russell King 91e013827c Merge branch 'master' into for-linus 2010-03-08 20:24:11 +00:00
Russell King 988addf82e Merge branch 'origin' into devel-stable
Conflicts:
	arch/arm/mach-mx2/devices.c
	arch/arm/mach-mx2/devices.h
	sound/soc/pxa/pxa-ssp.c
2010-03-08 20:21:04 +00:00
Jiri Kosina 318ae2edc3 Merge branch 'for-next' into for-linus
Conflicts:
	Documentation/filesystems/proc.txt
	arch/arm/mach-u300/include/mach/debug-macro.S
	drivers/net/qlge/qlge_ethtool.c
	drivers/net/qlge/qlge_main.c
	drivers/net/typhoon.c
2010-03-08 16:55:37 +01:00
Andi Kleen 28812fe11a driver-core: Add attribute argument to class_attribute show/store
Passing the attribute to the low level IO functions allows all kinds
of cleanups, by sharing low level IO code without requiring
an own function for every piece of data.

Also drivers can extend the attributes with own data fields
and use that in the low level function.

This makes the class attributes the same as sysdev_class attributes
and plain attributes.

This will allow further cleanups in drivers.

Full tree sweep converting all users.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-03-07 17:04:48 -08:00
Linus Torvalds 4582a30c2f Merge git://git.infradead.org/ubi-2.6
* git://git.infradead.org/ubi-2.6:
  UBI: add write checking
  UBI: simplify debugging return codes
  UBI: fix attaching error path
  UBI: support attaching by MTD character device name
  UBI: mark few variables as __initdata
2010-03-06 11:30:18 -08:00
Russell King b93a4afcff Merge branch 'for-rmk' of git://git.pengutronix.de/git/imx/linux-2.6 into devel-stable
Conflicts:
	arch/arm/Makefile
2010-03-02 23:29:32 +00:00
Tony Lindgren d702d12167 Merge with mainline to remove plat-omap/Kconfig conflict
Conflicts:
	arch/arm/plat-omap/Kconfig
2010-03-01 14:19:05 -08:00
Russell King 1d40ddd10d MTD: fix pismo build error
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-03-01 16:19:23 +00:00
Manuel Lauss 206aa6cdad MIPS: Alchemy: physmap-flash for all devboards
Replace the devboard NOR MTD mapping driver with physmap-flash support.
Also honor the "swapboot" switch settings wrt. to the layout of the
NOR partitions.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Acked-By: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-02-27 12:52:59 +01:00
Manuel Lauss 9bdcf336d0 MIPS: Alchemy: devboard register abstraction
All Alchemy development boards have external CPLDs with a few registers
in them.  They all share an identical register layout with only a few
minor differences (except the PB1000) in bit functions and base
addresses.

This patch
- adds a primitive facility to initialize and use these external
  registers,
- replaces all occurrences of bcsr->xxx accesses with calls to the new
  functions (the pb1200 cascade irq handling code is special).
- collects BCSR register information scattered throughout the board
  headers in a central place.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-02-27 12:52:50 +01:00
Maxim Levitsky d4080cb32e mtd: r852 fix pci ID
The PCI_DEVICE_ID_RICOH_R5C852 was missed in the edited commit, and on 
second thought I just open code it.

This fixes compile error.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 21:29:35 +00:00
Maxim Levitsky 133fa8c7d7 mtd: Few follow up cleanups for Smartmedia/xD support
* Test results of few functions that were declared with __must_check
* Fix bogus gcc warning about uinitialized variable 'ret'
* Remove unused variable from mtdblock_remove_dev
* Don't use deprecated DMA_32BIT_MASK

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 20:13:49 +00:00
Maxim Levitsky 67e054e919 mtd: nand: Add driver for Ricoh xD/SmartMedia reader
This adds a driver for Ricoh R5C852 xD card reader.

This reader is a part of larger mulifunction chip
and found at least in R5C832

Driver is complete, but bewere of the fact that some
(probably only type M) xD cards are 'fake' which means that
they have an on board CPU and expose emulated nand command set

These cards don't even store the  oob area on the flash,
but generate it on the fly from something else.

Thus they demand to have proper values written in the oob area,
and therefore only useful with SmartMedia FTL.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 19:22:38 +00:00
Maxim Levitsky 7d17c02a01 mtd: Add new SmartMedia/xD FTL
This implements new readwrite SmartMedia/xd FTL.

mtd driver must have support proper ECC and badblock verification
based on oob parts for 512 bytes nand.

Also mtd driver must define read_oob and write_oob, which are used
to read and write both data and oob together.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 19:06:50 +00:00
David Woodhouse a7790532f5 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
The SmartMedia FTL code depends on new kfifo bits from 2.6.33
2010-02-26 19:06:24 +00:00
David Woodhouse 2764fb4244 mtd: nand: Add SmartMedia device table to sm_common module
(and remove the CONFIG_MTD_NAND_SMARTMEDIA option which isn't going to be
used now that we're doing it this way)

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 18:46:45 +00:00
Maxim Levitsky 93edbad69b mtd: Workaround wrong write protect status on some xD cards
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 18:44:57 +00:00
David Woodhouse 5e81e88a4c mtd: nand: Allow caller to pass alternative ID table to nand_scan_ident()
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 18:32:56 +00:00
Maxim Levitsky 9fc51a37a8 mtd: common module for smartmedia/xD support
This small module implements few helpers that are usefull
for nand drivers for SmartMedia/xD card readers.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 18:04:51 +00:00
Maxim Levitsky e0b58d0a70 mtd: nand: add ->badblockbits for minimum number of set bits in bad block byte
This can be used to protect against bitflips in that field, but now mostly
for smartmedia.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 18:02:07 +00:00
Maxim Levitsky b64d39d8b0 mtd: nand: make reads using MTD_OOB_RAW affect only ECC validation
This changes the behavier of MTD_OOB_RAW. It used to read both OOB and 
data to the data buffer, however you would still need to specify the 
dummy oob buffer.

This is only used in one place, but makes it hard to read data+oob 
without ECC test, thus I removed that behavier, and fixed the user.

Now MTD_OOB_RAW behaves just like MTD_OOB_PLACE, but doesn't do ECC 
validation

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 18:00:08 +00:00
Maxim Levitsky 782ce79a45 mtd: nand: cleanup the nand_do_write_ops
nand_do_write_ops was broken in regard to writing several pages, each 
with its own oob.

Although nand_do_write_ops intends to allow such mode, it fails do do so
Probably this was never tested.

Also add missing checks for attempts to write at illegal offsets.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 17:47:47 +00:00
Maxim Levitsky 9aca334e85 mtd: nand: make MTD_OOB_PLACE work correctly.
MTD_OOB_PLACE is supposed to read/write the raw oob data similiar to the 
MTD_OOB_RAW however due to a bug, currently it is not possible to read 
more data that is specified by the oob 'free' regions.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 17:44:51 +00:00
Maxim Levitsky 49ef3c6ee1 mtd: nand: make suspend work if device is accessed by kernel threads.
Since all userspace threads are frozen at the time the nand_suspend is called,
they aren't inside any nand function.

We don't call try_to_freeze in nand ether. Thus the only user that can 
be inside the nand functions is an non freezeable kernel thread. Thus we 
can safely wait for it to finish.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 17:43:21 +00:00
Maxim Levitsky 026ec57886 mtd: blktrans: allow FTL drivers to export sysfs attributes
This patch adds an ability to export sysfs attributes below
the block disk device.

This can be used to pass the udev an information about the FTL
and could include the vendor, serial, version, etc...

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 17:37:40 +00:00
Maxim Levitsky 75c0b84d41 mtd: call the remove notifiers before assuming it is in use
Now that mtd block common layer is prepared for proper hotplug support,
enable it here

Now all users of the mtd device have a chance to put the mtd device
when they are notified to do so, and they have to do so to make hotplug work.

[dwmw2: There's more work to be done to fix hotplug in the general case, but
        this is a reasonable start]

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 17:37:10 +00:00
Maxim Levitsky 298304f1a5 mtd: mtdblock: test return value of add_mtd_blktrans_dev, because if can fail
This prevents a memory leak

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 17:05:46 +00:00
Maxim Levitsky 048d871995 mtd: blktrans: Hotplug fixes
* Add locking where it was missing.

* Don't do a get_mtd_device in blktrans_open because it would lead to a
  deadlock; instead do that in add_mtd_blktrans_dev.

* Only free the mtd_blktrans_dev structure when the last user exits.

* Flush request queue on device removal.

* Track users, and call tr->release in del_mtd_blktrans_dev
  Due to that ->open and release aren't called more that once.

Now it is safe to call del_mtd_blktrans_dev while the device is still in use.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 17:05:26 +00:00
Maxim Levitsky a863862257 mtd: blktrans: remove mtd_blkcore_priv, switch to per device queue and thread
This is the biggest change. To make hotplug possible, and this layer 
clean, the mtd_blktrans_dev now contains everything for a single mtd 
block translation device. Also removed some very old leftovers.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 17:04:03 +00:00
Maxim Levitsky 3bd456576f mtd: create unlocked versions of {get,put}_mtd_device
Use these only if you know that you already hold mtd_table_mutex

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 17:03:15 +00:00
Anatolij Gustschin bb315f749f mtd: nand: Add MPC5121 NAND Flash Controller driver
Adds NAND Flash Controller driver for MPC5121 Revision 2.
All device features, except hardware ECC and power management,
are supported.

Signed-off-by: Piotr Ziecik <kosmo@semihalf.com>
Signed-off-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 16:56:43 +00:00
Roel Kluin 1385858ee0 mtd: nand_bcm: fix hot spin and code duplication
In the branch where pagesize equalled NAND_DATA_ACCESS_SIZE, NumToRead
wasn't decremented in the `while (numToRead > 11)' loop.
Also the first and last while loops were duplicated in both branches.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Leo Chen <leochen@broadcom.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 16:56:35 +00:00
Vimal Singh c3341d0ceb mtd: omap2 fix prefetch mode read issue
There is a bug in nand prefetch read routine, which comes into effect
only if nand device is a 16-bit device (as we have in zoom boards).
This bug is effective only with below combination of conditions:
1. nand deivce, in use, is a 16 bit device
2. nand driver supports 'subpage' read
3. SW ECC is in use

This was not seen old  kernel (ex: .23), because when, in early days,
we tested this (nand prefetch read in LDP boards) there was no
'subpage read' support.
Later when we had subpage read in (.27) kernel, we had hw ecc enabled
always in our internal tree. So, we missed this bug.

This patch fixes the issue.

Signed-off-by: Vimal Singh <vimalsingh@ti.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 16:51:23 +00:00
Vimal Singh f35b6eda51 mtd: omap2: correct 'info' pointer in 'omap_nand_remove'
Removing OMAP NAND driver, when loaded as a module, gives error and
does not get success. This fixes this and makes driver loadable and
removable run time.

Signed-off-by: Vimal Singh <vimalsingh@ti.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 16:47:39 +00:00
Vimal Singh bdaefc4162 mtd: omap2: fixing compilation warning
Fixing below warning in compilation:
drivers/mtd/nand/omap2.c: In function 'omap_write_buf_dma_pref':
drivers/mtd/nand/omap2.c:508: warning: passing argument 2 of
'omap_nand_dma_transfer' discards qualifiers from pointer target type

Signed-off-by: Vimal Singh <vimalsingh@ti.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 16:46:13 +00:00
Guillaume LECERF f3e69c6584 mtd: move more manufacturers to the common cfi.h header file
Move MANUFACTURER_MACRONIX and MANUFACTURER_SST definitions to the
include/linux/mtd/cfi.h header file and rename them to CFI_MFR_MACRONIX and
CFI_MFR_SST.

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

Signed-off-by: Guillaume LECERF <glecerf@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 16:45:52 +00:00
Eric Benard 66803762c1 mtd: mxc_nand: add RESET command support
mxc_nand driver must support the RESET Command in order to support
Micron NAND which need a reset before any other command.

Signed-off-by: Eric Benard <eric@eukrea.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 15:18:12 +00:00
Roel Kluin 35109451f1 mtd: inftl: misplaced parenthesis in find_boot_record
The parenthesis was misplaced, upon error a one was shown.

[dwmw2: Fix the code not to do the assignment within the if() statement]
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>
2010-02-26 13:22:07 +00:00
Aaro Koskinen 932f5d21cc mtd: OneNAND: do not use DMA if oops in progress
Otherwise we may hang if we are called from panic() through mtdoops.

Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 13:22:01 +00:00
Vimal Singh 7d70f334ad mtd: nand: add lock/unlock routines
Add nand lock / unlock routines. At least 'micron' parts
support this.

Signed-off-by: Vimal Singh <vimalsingh@ti.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 13:21:49 +00:00
Vimal Singh 6fe5a6acdc mtd: nand: create a helper verification function
... verification for 'nand_erase_nand'

These checks are expected to be used by 'nand_lock' and 'nand_unlock'
routines too. As all these three are block aligned operations.
So, creating a helper function for this makes sense.

Signed-off-by: Vimal Singh <vimalsingh@ti.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-26 13:21:22 +00:00
Artem Bityutskiy 9a5dea7b10 mtd: maps: ceiva: do not return random numbers
When machine_is_ceiva() returns zero, 'clps_setup_flash()' returns a
value of an unitialized variable. Fix this.

Spotted by David Binderman.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-25 12:50:45 +00:00
Ben Hutchings dad0db318b mtdchar: Register the full range of minor numbers
register_chrdev() registers minor numbers up to 255, but we can now
potentially have much larger numbers.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-25 12:46:04 +00:00
Ben Hutchings 4d3a8534bd mtd: Raise limit on block device minor numbers
add_mtd_blktrans_dev() imposes a maximum of 257 devices per block
translator.  This was presumably meant to prevent overflow back in the
days of 8-bit minor numbers.  Instead, check against MINORMASK and the
limits of the partition naming scheme.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-25 12:40:19 +00:00
Ben Hutchings b520e412fa mtd: Replace static array of devices with an idr structure
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-25 11:55:14 +00:00
Ben Hutchings cbfe93e9ce mtd: mtdblock: Dynamically allocate cache info structures
Since we allocate struct mtd_blktrans_dev for each block device, we
can add our own structure members to the end.  Therefore embed
struct mtd_blktrans_dev in struct mtdblk_dev and remove the static
array of struct mtdblk_dev.  Also remove the redundant pointer to
struct mtd_info.

This is preparation for removing the static limit on the number of MTD
devices.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-25 11:53:00 +00:00
Ben Hutchings 24c1549677 mtd: Remove unnecessary comparisons with MAX_MTD_DEVICES
MAX_MTD_DEVICES is about to be removed.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-25 11:39:09 +00:00
Ben Hutchings e99e90aef1 mtd: nandsim: Define CONFIG_NANDSIM_MAX_PARTS and use it instead of MAX_MTD_DEVICES
MAX_MTD_DEVICES is about to be removed.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-25 11:39:03 +00:00
Ben Hutchings 677c2aec8c mtd: Use get_mtd_device_nm() to find named device in get_sb_mtd()
This removes the need to know the number of MTD devices.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-25 11:38:35 +00:00
Ben Hutchings f1332ba2f2 mtd: Introduce and use iteration macro for reading the MTD device table
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-25 11:37:16 +00:00
Roel Kluin 0040476b0e mtd: change positive error return into 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>
2010-02-25 11:35:28 +00:00
Mike Frysinger 4335c1003e mtd: maps: Blackfin async: rename local funcs to avoid common clashes
There are new Blackfin MMR helper functions that use the same name as some
of the local functions in this driver, so have the driver use more specific
names to avoid the issue.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-25 11:35:14 +00:00
H Hartley Sweeten bcc98a46ea mtd: fix different address space noise
In mtd_ioctl MEMGETREGIONINFO the region_user_info pointer ur
is cast in __kernel space. This produces a number of sparse warnings
like:

warning: cast removes address space of expression
warning: incorrect type in initializer (different address spaces)
   expected unsigned int const [noderef] <asn:1>*register __p
   got unsigned int *<noident>

Since argp is already a void __user * just use it dirrectly without
the cast and make ur a __user *.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-25 11:29:48 +00:00
Jon Ringle 53f2b1c86a mtd: ixp4xx: fix reading from half-word boundary
Fix handling of reads that don't start on a half-word boundary.

Signed-off-by: Jon Ringle <jon@ringle.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-25 11:28:56 +00:00
Uwe Kleine-König 9c14b153e6 mtd: mxc-nand: don't disable clock in mxcnd-suspend
The clock must already be off after mtd->suspend.  Disabling it again
results in an negative overflow of the clock usage count.  This didn't
hurt as mxcnd_resume undid it after wake up.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-25 11:28:35 +00:00
Uwe Kleine-König b840bc11b5 mtd: mxc-nand: no need to check for validity of platform driver data
The probe function calls platform_set_drvdata with a valid pointer when
the probe is successful.  As mxcnd_suspend and mxcnd_resume are only
called on bound devices, platform_get_drvdata always returns non-NULL.

This fix isn't critical as the pointer is always valid so it doesn't
matter if the compiler generated code for it or not.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-25 11:28:06 +00:00
Jiri Slaby 17fabf1565 mtd: cfi: remove unneeded NULL checks
In cfi_intelext_setup and cfi_amdstd_setup, mtd is never NULL.
Remove unnecessary checks.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-25 11:27:38 +00:00
Márton Németh b2d4fbab79 mtd: nand: make Open Firmware device id constant
The match_table field of the struct of_device_id is constant in <linux/of_platform.h>
so it is worth to make xps2_of_match also constant.

The semantic match that finds this kind of pattern is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
disable decl_init,const_decl_init;
identifier I1, I2, x;
@@
	struct I1 {
	  ...
	  const struct I2 *x;
	  ...
	};
@s@
identifier r.I1, y;
identifier r.x, E;
@@
	struct I1 y = {
	  .x = E,
	};
@c@
identifier r.I2;
identifier s.E;
@@
	const struct I2 E[] = ... ;
@depends on !c@
identifier r.I2;
identifier s.E;
@@
+	const
	struct I2 E[] = ...;
// </smpl>

Signed-off-by: Márton Németh <nm127@freemail.hu>
Cc: Julia Lawall <julia@diku.dk>
Cc: cocci@diku.dk
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-25 11:26:36 +00:00
Márton Németh b3acd638a2 mtd: nand: make USB device id constant
The id_table field of the struct usb_device_id is constant in <linux/usb.h>
so it is worth to make alauda_table also constant.

The semantic match that finds this kind of pattern is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
disable decl_init,const_decl_init;
identifier I1, I2, x;
@@
	struct I1 {
	  ...
	  const struct I2 *x;
	  ...
	};
@s@
identifier r.I1, y;
identifier r.x, E;
@@
	struct I1 y = {
	  .x = E,
	};
@c@
identifier r.I2;
identifier s.E;
@@
	const struct I2 E[] = ... ;
@depends on !c@
identifier r.I2;
identifier s.E;
@@
+	const
	struct I2 E[] = ...;
// </smpl>

Signed-off-by: Márton Németh <nm127@freemail.hu>
Cc: Julia Lawall <julia@diku.dk>
Cc: cocci@diku.dk
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-25 11:26:31 +00:00
Márton Németh 377ace08ea mtd: nand: make PCI device id constant
The id_table field of the struct pci_driver is constant in <linux/pci.h>
so it is worth to make cafe_nand_tbl also constant.

The semantic match that finds this kind of pattern is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
disable decl_init,const_decl_init;
identifier I1, I2, x;
@@
	struct I1 {
	  ...
	  const struct I2 *x;
	  ...
	};
@s@
identifier r.I1, y;
identifier r.x, E;
@@
	struct I1 y = {
	  .x = E,
	};
@c@
identifier r.I2;
identifier s.E;
@@
	const struct I2 E[] = ... ;
@depends on !c@
identifier r.I2;
identifier s.E;
@@
+	const
	struct I2 E[] = ...;
// </smpl>

Signed-off-by: Márton Németh <nm127@freemail.hu>
Cc: Julia Lawall <julia@diku.dk>
Cc: cocci@diku.dk
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-25 11:26:26 +00:00
Andrey Yurovsky 6029a3a462 mtd: nandsim: fix spelling
s/nanodeconds/nanoseconds

Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-02-25 11:26:11 +00:00
Vimal Singh 2f70a1e936 omap2/3/4: Introducing 'gpmc-nand.c' for GPMC specific NAND init
Introducing 'gpmc-nand.c' for GPMC specific NAND init.
For example: GPMC timing parameters and all.
This patch also migrates gpmc related calls from 'nand/omap2.c'
to 'gpmc-nand.c'.

Signed-off-by: Vimal Singh <vimalsingh@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
2010-02-15 10:03:33 -08:00
Ladislav Michl cc87edb173 MTD: remove no longer used OMAP flash map
All OMAP boards are now using physmap-flash.

Cc: linux-mtd@lists.infradead.org
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
2010-02-15 10:03:32 -08:00
Peter Huewe 2d6bfc261a mtd: orion_nand: Fix build failure caused by typo
Commit e99030609e ("mtd: orion_nand.c: add 
error handling and use resource_size()") introduced a build error -- it 
assigns something to a undeclared variable 'err', whereas the rest of 
the code uses 'ret' for this task.

This patch fixes this typo and thus removes the build failure.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2010-02-10 18:14:39 +00:00
Daniel Mack 3ad2f3fbb9 tree-wide: Assorted spelling fixes
In particular, several occurances of funny versions of 'success',
'unknown', 'therefore', 'acknowledge', 'argument', 'achieve', 'address',
'beginning', 'desirable', 'separate' and 'necessary' are fixed.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Joe Perches <joe@perches.com>
Cc: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-09 11:13:56 +01:00
Stefan Weil 947af29435 Fix spelling of 'platform' in comments and doc
Replace platfrom -> platform.

This is a frequent spelling bug.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-05 12:22:34 +01:00
Sebastian Andrzej Siewior c14e522b1a tree wide: remove execute flag from .c files
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-02-04 11:55:44 +01:00
Magnus Damm 010ab82058 mtd: sh_flctl SHBUSSEL and SEL_16BIT support
This patch extends the sh_flctl driver with support
for 16-bit bus configuration using SEL_16BIT and
support for multiplexed pins using SHBUSSEL.

Signed-off-by: Magnus Damm <damm@opensource.se>
Acked-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-02 13:02:16 +09:00
Magnus Damm b79c7adf82 mtd: trivial sh_flctl changes
This patch contains a few changes for the sh_flctl driver:
 - not sh7723-only driver - get rid of kconfig dependency
 - use dev_err() instead of printk()
 - use __devinit and __devexit for probe()/remove()
 - fix probe() return values

Signed-off-by: Magnus Damm <damm@opensource.se>
Acked-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2010-02-02 13:01:25 +09:00
Artem Bityutskiy 6e9065d756 UBI: add write checking
Add an extra debugging check function which validates writes.
After every write it reads the data back, compares it with the
original data, and complains if they mismatch.

Useful for debugging. No-op if extra debugging checks are disabled.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-02-01 15:16:37 +02:00
Artem Bityutskiy adbf05e3ec UBI: simplify debugging return codes
UBI debugging functions were a little bit over-engineered and
returned more error codes than needed, and the callers had to
do useless checks. Simplify the return codes.

Impact: only debugging code is affected, which means that for
        non-developers this is a no-op patch.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-02-01 15:16:37 +02:00
Artem Bityutskiy 0bf1c4399a UBI: fix attaching error path
In the error path of 'ubi_attach_mtd_dev()' we have a tricky situation:
we have to release things differently depending on at which point
the failure happening. Namely, if @ubi->dev is not initialized, we have
to free everything ourselves. But if it was, we should not free the @ubi
object, because it will be freed in the 'dev_release()' function. And
we did not get this situation right.

This patch introduces additional argument to the 'uif_init()' function.
On exit, this argument indicates whether the final 'free(ubi)' will
happen in 'dev_release()' or not. So the caller always knows how to
properly release the resources.

Impact: all memory is now correctly released when UBI fails to attach
        an MTD device.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-02-01 15:16:36 +02:00
Artem Bityutskiy f9b0080e10 UBI: support attaching by MTD character device name
This patch adds a capability to attach MTD devices by their character
device paths. For example, one can do:

$ modprobe ubi mtd=/dev/mtd0

to attach /dev/mtd0.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-02-01 15:16:36 +02:00
Artem Bityutskiy 9e0c7ef3f6 UBI: mark few variables as __initdata
The @mtd_devs and @mtd_dev_param variables are used only during the
initialization, and all functions that use the variables have
the __init prefix. This means we can safely mark the variables
as __initdata, which is a tiny optimization.

Impact: tiny RAM consumption optimization when UBI is used as a kernel
        module.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-02-01 15:16:36 +02:00
Linus Torvalds 551e28dbe8 Merge branch 'for-linus' of git://git.infradead.org/ubi-2.6
* 'for-linus' of git://git.infradead.org/ubi-2.6:
  UBI: fix volume creation input checking
2010-01-28 12:57:50 -08:00
Mika Westerberg c5ce5b46af UBI: fix volume creation input checking
Do not use an unchecked variable UBI_IOCMKVOL ioctl.

Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: stable@vger.kernel.org
2010-01-27 11:55:43 +02:00
Linus Torvalds a8d0b6666e Merge branch 'linux-next' of git://git.infradead.org/ubi-2.6
* 'linux-next' of git://git.infradead.org/ubi-2.6:
  UBI: fix memory leak in update path
  UBI: add more checks to chdev open
  UBI: initialise update marker
2010-01-25 19:02:06 -08:00
Linus Torvalds b8be634e01 Merge git://git.infradead.org/~dwmw2/mtd-2.6.33
* git://git.infradead.org/~dwmw2/mtd-2.6.33:
  mtd: tests: fix read, speed and stress tests on NOR flash
  mtd: Really add ARM pismo support
  kmsg_dump: Dump on crash_kexec as well
2010-01-24 10:31:34 -08:00
Artem Bityutskiy ebddd63b74 UBI: fix memory leak in update path
When truncating an UBI volume, UBI should allocates a PEB-sized
buffer but does not release it, which leads to memory leaks.
This patch fixes the issue.

Reported-by: Marek Skuczynski <mareksk7@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tested-by: Marek Skuczynski <mareksk7@gmail.com>
Cc: stable@kernel.org
2010-01-18 18:53:56 +02:00
Baruch Siach b6d0c1bda9 mtd: mxc_nand: add MX25 to Kconfig
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-01-14 11:14:44 +01:00
Morten Thunberg Svendsen f5e2bae0aa mtd: tests: fix read, speed and stress tests on NOR flash
Before using block_isbad() check if mtd->block_isbad() is defined.
Calculating pgcnt must be done using pgsize defined to 512 on
NOR and mtd->writesize for NAND, not using  mtd->writesize directly.

Signed-off-by: Morten Thunberg Svendsen <mts.doredevelopment@gmail.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-01-13 09:06:17 +00:00
Russell King - ARM Linux f6a8c60960 mtd: Really add ARM pismo support
(Commit 7cb777a3d7 (mtd: add ARM pismo support)
intended to add this, but seems only to have patched the Makefile without
touching Kconfig or providing any code...)

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>
2010-01-13 09:04:53 +00:00
Artem Bityutskiy b531b55a7b UBI: add more checks to chdev open
When opening UBI volumes by their character device names, make
sure we are opening character devices, not block devices or any
other inode type.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-01-12 13:19:15 +02:00
Peter Horton ff99879328 UBI: initialise update marker
The in kernel copy of a volume's update marker is not initialised from the
volume table. This means that volumes where an update was unfinnished will
not be treated as "forbidden to use". This is basically that the update
functionality was broken.

Signed-off-by: Peter Horton <zero@colonel-panic.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Cc: stable@kernel.org
2010-01-12 13:19:08 +02:00
H Hartley Sweeten 7603757993 mtd: Remove now-defunct ts7250 nand driver
The ts72xx platform has been updated to use the generic platform nand
driver (plat_nand.c).  This removes the now-defunct ts7250.c nand driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Matthieu Crapet <mcrapet@gmail.com>
Cc: Jesse Off <joff@embeddedARM.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-01-06 13:24:36 +00:00
Julia Lawall e026255f7d mtd: physmap_of: Correct the size argument to kzalloc
mtd_list has type struct mtd_info **, not struct mtd_info *, so the
elements of the array should have pointer type, not structure type.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@disable sizeof_type_expr@
type T;
T **x;
@@

  x =
  <+...sizeof(
- T
+ *x
  )...+>
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-01-02 10:04:56 +00:00
David Woodhouse bb6a775549 mtd: nand: rename w90p910_nand.c to nuc900_nand.c
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-01-01 12:16:47 +00:00
Wan ZongShun 49f37b74d0 ARM: NUC900: rename mtd nand driver name
Due to I have renamed the platform_device.name,so this patch changes
this nand driver platform_driver name.

Signed-off-by: Wan ZongShun <mcuos.com@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-01-01 12:06:14 +00:00
H Hartley Sweeten cbd38a875f mtd: drivers/mtd/nand/sh_flctl.c: use resource_size()
Use resource_size().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-12-31 20:47:26 +00:00
H Hartley Sweeten 448791abfb mtd: tmio_nand.c: use dev_get_platdata() and resource_size()
Remove unnecessary casts and use dev_get_platdata() to retrieve the
struct mfd_cell data from the platform.

Use resource_size() for the ioremap()'s.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-12-31 20:47:24 +00:00
H Hartley Sweeten fc161c4e8e mtd: drivers/mtd/nand/s3c2410.c: use resource_size()
Use resource_size().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-12-31 20:47:22 +00:00
H Hartley Sweeten e99030609e mtd: orion_nand.c: add error handling and use resource_size()
Use platform_get_resource() to fetch the memory resource and
add error handling for when it is missing. Use resource_size()
for the ioremap().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-12-31 20:47:20 +00:00
H Hartley Sweeten 4442241ef6 mtd: nomadik_nand.c: use resource_size()
Use resource_size().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-12-31 20:47:18 +00:00
H Hartley Sweeten db5a5ae25a mtd: drivers/mtd/nand/gpio.c: use resource_size()
Use resource_size().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-12-31 20:47:01 +00:00