platform/kernel/linux-rpi.git
11 years agomtd: mxc_nand: fix unbalanced clk_disable() in error path
Lothar Waßmann [Thu, 6 Dec 2012 07:42:27 +0000 (08:42 +0100)]
mtd: mxc_nand: fix unbalanced clk_disable() in error path

If nand_scan_ident() or nand_scan_tail() fails, the NAND chip may have
been deselected and the clock already disabled. Thus, check 'clk_act'
in the error path to decide whether the clock still needs to be
disabled.

This fixes a:
|WARNING: at drivers/clk/clk.c:472 __clk_disable+0x3c/0x78()

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: nandsim: Introduce debugfs infrastructure
Ezequiel Garcia [Mon, 3 Dec 2012 13:31:40 +0000 (10:31 -0300)]
mtd: nandsim: Introduce debugfs infrastructure

It's more user friendly to report debug information and statistics
through debugfs, than to use printing facilites.

This patch introduces a very minimal debugfs infrastructure
and moves eraseblock wear report to an entry located at:

/sys/kernel/debug/nandsim/wear_report

This means we can remove rptwear option and just let
the user get the wear report when we needs to.

Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: physmap_of: error checking to prevent a NULL pointer dereference
Anton Prins [Tue, 27 Nov 2012 15:38:16 +0000 (16:38 +0100)]
mtd: physmap_of: error checking to prevent a NULL pointer dereference

This patch solves a NULL pointer dereference, this may occur if the tuple
is not mappable (jumps to continue in the for-loop). Out of the loop
possible results are:
- info->list_size == 0  if no of the tuples is mappable
- info->list_size == 1
- info->list_size > 1
If no one of the supplied tuples is mappable (info->list_size == 0) and
info->cmtd will not be set. But it is used in mtd_device_parse_register, OOPS!
actually it should generate an error in this case!

Signed-off-by: Anton Prins <anton.prins@nl.bosch.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtg: docg3: potential divide by zero in doc_write_oob()
Dan Carpenter [Thu, 29 Nov 2012 14:16:51 +0000 (17:16 +0300)]
mtg: docg3: potential divide by zero in doc_write_oob()

If we set oobdelta to zero then we will either return -EINVAL or hit
a divide (modulus) by zero on the next line when we check
"(ooblen % oobdelta)".  It's better to just return -EINVAL here instead.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: bcm47xxnflash: writing support
Rafał Miłecki [Mon, 3 Dec 2012 09:22:35 +0000 (10:22 +0100)]
mtd: bcm47xxnflash: writing support

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: tests/read: initialize buffer for whole next page
Christian Herzig [Fri, 23 Nov 2012 14:31:26 +0000 (15:31 +0100)]
mtd: tests/read: initialize buffer for whole next page

fix: do block-buffer initialize for the whole next page to zero.

Signed-off-by: Christian Herzig <christian.herzig@keymile.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: at91: atmel_nand: return bit flips for the PMECC read_page()
Josh Wu [Tue, 27 Nov 2012 10:50:31 +0000 (18:50 +0800)]
mtd: at91: atmel_nand: return bit flips for the PMECC read_page()

This patch fix pmecc's read_page() to return maximum number of bitflips, 0 if uncorrectable.

In the commit: 3f91e94f7f511de74c0d2abe08672ccdbdd1961c ("mtd: nand: read_page() returns max_bitflips ()"),
The ecc.read_page() is changed to return the maximum number of bitflips.
And when meet uncorrectable bitflips it needs to return 0.

See the comment in nand.h:
 * @read_page: function to read a page according to the ECC generator
 * requirements; returns maximum number of bitflips corrected in
 * any single ECC step, 0 if bitflips uncorrectable, -EIO hw error

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Reviewed-by: Mike Dunn <mikedunn@newsguy.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: fix recovery after failed write-buffer operation in cfi_cmdset_0002.c
Harald Nordgard-Hansen [Fri, 23 Nov 2012 22:11:03 +0000 (23:11 +0100)]
mtd: fix recovery after failed write-buffer operation in cfi_cmdset_0002.c

When working on a problem with some flash chips that lock up during
write-buffer operations, I think there may be a bug in the linux
handling of chips using cfi_cmdset_0002.c.

The datasheets I have found for a number of these chips all specify that
when aborting a write-buffer command, it is not enough to use the
standard reset.  Rather a "write-to-buffer-reset command" is needed.
This command is quite similar for all chips, the main variance seem to
be if the final 0xF0 can go to any address or must go to addr_unlock1.

The bug is then in the recovery handling when timing out at the end of
do_write_buffer, where using the normal reset command is not sufficient.

Without this change, if the write-buffer command fails then any
following operations on the flash also fail.

Signed-off-by: Harald Nordgard-Hansen <hhansen@pvv.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: nand: onfi need to be probed in 8 bits mode
Matthieu CASTET [Tue, 6 Nov 2012 10:51:43 +0000 (11:51 +0100)]
mtd: nand: onfi need to be probed in 8 bits mode

- NAND_CMD_READID want an address that it is not scaled on x16 device (it is always 0x20)
- NAND_CMD_PARAM want 8 bits data

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: nand: add NAND_BUSWIDTH_AUTO to autodetect bus width
Matthieu CASTET [Tue, 6 Nov 2012 10:51:44 +0000 (11:51 +0100)]
mtd: nand: add NAND_BUSWIDTH_AUTO to autodetect bus width

The driver call nand_scan_ident in 8 bit mode, then
readid or onfi detection are done (and detect bus width).
The driver should update its bus width before calling nand_scan_tail.

This work because readid and onfi are read work 8 byte mode.

Note that nand_scan_ident send command (NAND_CMD_RESET, NAND_CMD_READID, NAND_CMD_PARAM), address and read data
The ONFI specificication is not very clear for x16 device if high byte of address should be driven to 0,
but according to [1] it should be ok to not drive it during autodetection.

[1]
3.3.2. Target Initialization

[...]
The Read ID and Read Parameter Page commands only use the lower 8-bits of the data bus.
The host shall not issue commands that use a word data width on x16 devices until the host
determines the device supports a 16-bit data bus width in the parameter page.

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: nand: print flash size during detection
Matthieu CASTET [Thu, 22 Nov 2012 17:33:40 +0000 (18:33 +0100)]
mtd: nand: print flash size during detection

This help to detect bad flash identification in case the size is not present
on the name (ONFI).

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomted: nand_wait_ready timeout fix
Matthieu CASTET [Thu, 22 Nov 2012 17:31:28 +0000 (18:31 +0100)]
mted: nand_wait_ready timeout fix

nand_wait_ready timeout should not assume HZ=100.
Make it independent of HZ value by using msecs_to_jiffies.

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: bcm47xxnflash: support NAND_CMD_STATUS
Rafał Miłecki [Fri, 23 Nov 2012 08:58:11 +0000 (09:58 +0100)]
mtd: bcm47xxnflash: support NAND_CMD_STATUS

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: bcm47xxnflash: define some magic numbers
Rafał Miłecki [Fri, 23 Nov 2012 06:51:31 +0000 (07:51 +0100)]
mtd: bcm47xxnflash: define some magic numbers

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: remove the "chip" parameter in nand_get_device()
Huang Shijie [Mon, 19 Nov 2012 06:43:30 +0000 (14:43 +0800)]
mtd: remove the "chip" parameter in nand_get_device()

There are two reasons to remove the "chip" parameter in nand_get_device():

[1] The nand_release_device() does not have the "chip" parameter.
[2] We can get the nand_chip by the mtd->priv field.

This patch removes the "chip" parameter in nand_get_device().

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: remove the de-select chip code in nand_release_device()
Huang Shijie [Mon, 19 Nov 2012 06:43:29 +0000 (14:43 +0800)]
mtd: remove the de-select chip code in nand_release_device()

The nand_get_device() does not select the chip, but nand_release_device()
does de-select the chip. It is really strange.

With the current code, nand_sync() will de-select the chip, even if the chip
has never been selected.

To make the balance of select/de-select chip, it's better to remove the
de-select chip code in nand_release_device() which makes the code more
clear.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: m25p80: modify info for Micron N25Q128
Liming Wang [Thu, 22 Nov 2012 06:58:09 +0000 (14:58 +0800)]
mtd: m25p80: modify info for Micron N25Q128

Micron N25Q128 has two types of flash:

 - One is for 1.8v supply voltage, prefixed with "n25q128a11" and the jedec
   code is 0x20bb18.

 - Another is for 3v supply voltage, prefixed with "n25q128a13" and the jedec
   code is 0x20ba18.

So modify the original type info and add another type for Micron N25Q128.

Signed-off-by: Liming Wang <walimisdev@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd cs553x_nand: Initialise ecc.strength before nand_scan()
Nathan Williams [Wed, 21 Nov 2012 23:42:52 +0000 (10:42 +1100)]
mtd cs553x_nand: Initialise ecc.strength before nand_scan()

Loading cs553x_nand with Hynix H27U1G8F2BTR NAND flash causes this bug:

kernel BUG at drivers/mtd/nand/nand_base.c:3345!
invalid opcode: 0000 [#1]
Modules linked in: cs553x_nand(+) vfat fat usb_storage ehci_hcd usbcore usb_comr
Pid: 436, comm: modprobe Not tainted 3.6.7 #1
EIP: 0060:[<c118d205>] EFLAGS: 00010296 CPU: 0
EIP is at nand_scan_tail+0x64c/0x69c
EAX: 00000034 EBX: cea6ed98 ECX: 00000000 EDX: 00000000
ESI: cea6ec00 EDI: cea6ec00 EBP: 20000000 ESP: cdd17e48
 DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068
CR0: 8005003b CR2: 0804e119 CR3: 0d850000 CR4: 00000090
DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
DR6: ffff0ff0 DR7: 00000400
Process modprobe (pid: 436, ti=cdd16000 task=cdd1c320 task.ti=cdd16000)
Stack:
 c12e962c c118f7ef 00000003 cea6ed98 d014b25c 20000000 fffff007 00000001
 00000000 cdd53b00 d014b000 c1001021 cdd53b00 d01493c0 cdd53b00 cdd53b00
 d01493c0 c1047f83 d014b4a0 00000000 cdd17f9c ce4be454 cdd17f48 cdd1c320
Call Trace:
 [<c118f7ef>] ? nand_scan+0x1b/0x4d
 [<d014b25c>] ? init_module+0x25c/0x2de [cs553x_nand]
 [<d014b000>] ? 0xd014afff
 [<c1001021>] ? do_one_initcall+0x21/0x111
 [<c1047f83>] ? sys_init_module+0xe4/0x1261
 [<c1031207>] ? task_work_run+0x36/0x43
 [<c1265ced>] ? syscall_call+0x7/0xb
Code: fa ff ff c7 86 d8 00 00 00 01 00 00 00 e9 5f fc ff ff 68 f8 26 2e c1 e8 a7
EIP: [<c118d205>] nand_scan_tail+0x64c/0x69c SS:ESP 0068:cdd17e48

Initialising ecc.strength before the call to nand_scan() fixes this.

Signed-off-by: Nathan Williams <nathan@traverse.com.au>
Cc: stable@vger.kernel.org [3.4+]
Acked-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Dunn <mikedunn@newsguy.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: fix a number of checkpatch complaints
Artem Bityutskiy [Thu, 22 Nov 2012 10:16:28 +0000 (12:16 +0200)]
mtd: fix a number of checkpatch complaints

While checking the "__devinit" removal patches with checkpatch.pl, I
noticed several warnings related to a space between the function name
and '(', as well as long lines. I fixed the warnings up in this patch.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: remove use of __devexit
Bill Pemberton [Mon, 19 Nov 2012 18:26:04 +0000 (13:26 -0500)]
mtd: remove use of __devexit

CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: remove use of __devinitconst
Bill Pemberton [Mon, 19 Nov 2012 18:25:12 +0000 (13:25 -0500)]
mtd: remove use of __devinitconst

CONFIG_HOTPLUG is going away as an option so __devinitconst is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: remove use of __devinitdata
Bill Pemberton [Mon, 19 Nov 2012 18:24:23 +0000 (13:24 -0500)]
mtd: remove use of __devinitdata

CONFIG_HOTPLUG is going away as an option so __devinitdata is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: remove use of __devinit
Bill Pemberton [Mon, 19 Nov 2012 18:23:07 +0000 (13:23 -0500)]
mtd: remove use of __devinit

CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: remove use of __devexit_p
Bill Pemberton [Mon, 19 Nov 2012 18:21:24 +0000 (13:21 -0500)]
mtd: remove use of __devexit_p

CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: Drop FORTUNET support
Alexander Shiyan [Sun, 18 Nov 2012 10:43:43 +0000 (14:43 +0400)]
mtd: Drop FORTUNET support

The kernel has never contained the symbol SA1100_FORTUNET so the driver
never compiled and can be removed safely.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: ofpart: Replicate mtd cmdline "lk" option with device tree "lock" property
Josh Radel [Wed, 14 Nov 2012 22:11:32 +0000 (14:11 -0800)]
mtd: ofpart: Replicate mtd cmdline "lk" option with device tree "lock" property

The mtd partition command line parser already supports a "lk" option to mask
MTD_POWERUP_LOCK. This extends that same functionality to device tree
partition specifications.

Signed-off-by: Josh Radel <jradel@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: m25p80: add support for the Winbond w25q80bl chip
Stephen Warren [Mon, 12 Nov 2012 19:58:28 +0000 (12:58 -0700)]
mtd: m25p80: add support for the Winbond w25q80bl chip

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: bcm47xxnflash: enable BCM4706 driver
Rafał Miłecki [Mon, 12 Nov 2012 12:03:25 +0000 (13:03 +0100)]
mtd: bcm47xxnflash: enable BCM4706 driver

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: bcm47xxnflash: implement reading
Rafał Miłecki [Mon, 12 Nov 2012 12:03:24 +0000 (13:03 +0100)]
mtd: bcm47xxnflash: implement reading

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: bcm47xxnflash: support for NAND_CMD_READID command
Rafał Miłecki [Mon, 12 Nov 2012 12:03:23 +0000 (13:03 +0100)]
mtd: bcm47xxnflash: support for NAND_CMD_READID command

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: bcm47xxnflash: init NAND on BCM4706
Rafał Miłecki [Mon, 12 Nov 2012 12:03:22 +0000 (13:03 +0100)]
mtd: bcm47xxnflash: init NAND on BCM4706

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: prepare place for BCMA NAND flash driver(s)
Rafał Miłecki [Mon, 12 Nov 2012 12:03:21 +0000 (13:03 +0100)]
mtd: prepare place for BCMA NAND flash driver(s)

BCMA bus can contain NAND flash memory, it's registered in system as
platform device. This adds required hooks and place for controler
specific drivers.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agobcma: export PLL reading function
Rafał Miłecki [Mon, 12 Nov 2012 12:03:20 +0000 (13:03 +0100)]
bcma: export PLL reading function

This is required by NAND flash driver for initializing wait counters.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: bcm63xxpart: use correct printk format for partitions
Jonas Gorski [Mon, 12 Nov 2012 09:52:51 +0000 (10:52 +0100)]
mtd: bcm63xxpart: use correct printk format for partitions

Use ll to be able to remove the casts.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Reviewed-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: bcm63xxpart: move the last curpart++ to its correct place
Jonas Gorski [Mon, 12 Nov 2012 09:52:50 +0000 (10:52 +0100)]
mtd: bcm63xxpart: move the last curpart++ to its correct place

The line belongs above the comment, not below it.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Reviewed-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: bcm63xxpart: make fixed part length calculation more generic
Jonas Gorski [Mon, 12 Nov 2012 09:52:49 +0000 (10:52 +0100)]
mtd: bcm63xxpart: make fixed part length calculation more generic

The CFE does not use 4K sectors even if the flash supports it, so
for the fixed partitions like CFE itself or NVRAM the erase block
size is always 64k or bigger.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Reviewed-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: bcm63xxpart: merge sparelen calculation
Jonas Gorski [Mon, 12 Nov 2012 09:52:48 +0000 (10:52 +0100)]
mtd: bcm63xxpart: merge sparelen calculation

The length of the spare part is calculated the same way in both branches
so move to a common place.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Reviewed-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: bcm63xxpart: remove unused variable
Jonas Gorski [Mon, 12 Nov 2012 09:52:47 +0000 (10:52 +0100)]
mtd: bcm63xxpart: remove unused variable

namelen is never used, so drop it.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Reviewed-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: use SQUASHFS_MAGIC from uapi/linux/magic.h
Luka Perkov [Sun, 11 Nov 2012 19:32:15 +0000 (20:32 +0100)]
mtd: use SQUASHFS_MAGIC from uapi/linux/magic.h

Signed-off-by: Luka Perkov <luka@openwrt.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: mtd_blkdevs: Replace request handler kthread with a workqueue
Ezequiel Garcia [Sat, 10 Nov 2012 16:08:20 +0000 (13:08 -0300)]
mtd: mtd_blkdevs: Replace request handler kthread with a workqueue

By replacing a kthread with a workqueue, the code is now a bit clearer.
There's also a slight reduction of code size (numbers apply for x86):
Before:
   text    data     bss     dec     hex filename
   3248      36       0    3284     cd4 drivers/mtd/mtd_blkdevs.o

After:
   text    data     bss     dec     hex filename
   3150      36       0    3186     c72 drivers/mtd/mtd_blkdevs.o

Due to lack of real hardware, tests have been performed on an emulated
environment with mtdswap and mtdblock over nandsim devices.
Some real testing should be done, before merging this patch.

Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: mtd_blkdev: Use a different name for block_device_operations variable
Ezequiel Garcia [Fri, 9 Nov 2012 15:36:35 +0000 (12:36 -0300)]
mtd: mtd_blkdev: Use a different name for block_device_operations variable

struct mtd_blktrans_ops is a type, and mtd_blktrans_ops is a variable.
To improve code clarity it's better to not use the same names,
so we just change the latter.

Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: Fix typo mtd/tests
Masanari Iida [Fri, 9 Nov 2012 14:20:58 +0000 (23:20 +0900)]
mtd: Fix typo mtd/tests

Correct spelling typo in printk within drivers/mtd/tests.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: de-select the chip when it is not used
Huang Shijie [Fri, 9 Nov 2012 08:23:45 +0000 (16:23 +0800)]
mtd: de-select the chip when it is not used

When we scan several nand chips with nand_scan(), such as
     .......................
      nand_scan(*, 2);
     .......................

In nand_scan_ident(), the maxchips will become 2, so the current code
will select chip 1 to read the device ID. But the chip 0 is still
selected in this case.

To make the logic clear, we'd better de-select the chip when it is not used.

This patch de-select the nand chip if it is not used any more.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: s3c2410: Fix potential NULL pointer dereference error
Sachin Kamat [Fri, 16 Nov 2012 10:38:22 +0000 (16:08 +0530)]
mtd: s3c2410: Fix potential NULL pointer dereference error

'set' is tested for NULL. But subsequently accessed without the check.
Thus making it conditional to avoid NULL pointer dereferencing.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agojffs2: hold erase_completion_lock on exit
Alexey Khoroshilov [Mon, 5 Nov 2012 18:40:14 +0000 (22:40 +0400)]
jffs2: hold erase_completion_lock on exit

Users of jffs2_do_reserve_space() expect they still held
erase_completion_lock after call to it. But there is a path
where jffs2_do_reserve_space() leaves erase_completion_lock unlocked.
The patch fixes it.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: stable@vger.kernel.org
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: physmap_of: allow to specify the mtd name for retro compatiblity
Jean-Christophe PLAGNIOL-VILLARD [Wed, 7 Nov 2012 15:32:16 +0000 (16:32 +0100)]
mtd: physmap_of: allow to specify the mtd name for retro compatiblity

linux,mtd-name allow to specify the mtd name for retro capability with
physmap-flash drivers as boot loader pass the mtd partition via the old
device name physmap-flash.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: fsl_ifc_nand: wait tWB time, poll R/B before command execution
Prabhakar Kushwaha [Thu, 8 Nov 2012 08:12:59 +0000 (13:42 +0530)]
mtd: fsl_ifc_nand: wait tWB time, poll R/B before command execution

IFC_FIR_OP_CMD0 issues command for execution without checking flash
readiness. It may cause problem if flash is not ready. Instead use
IFC_FIR_OP_CW0 which Wait for tWB time and poll R/B to return high or
time-out, before issuing command.

NAND_CMD_READID command implemention does not fulfill above requirement. So
update its programming.

Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
Signed-off-by: Hemant Nautiyal <hemant.nautiyal@freescale.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: uninitialized variable warning in map.h
Arnd Bergmann [Tue, 6 Nov 2012 21:55:28 +0000 (22:55 +0100)]
mtd: uninitialized variable warning in map.h

The map_word_load() function initializes exactly
as many words in the buffer as required, but gcc
cannot figure this out and gives a misleading
warning. Marking the local variable as
uninitialized_var shuts up that warning.

Without this patch, building acs5k_defconfig results in:

drivers/mtd/chips/cfi_cmdset_0002.c: In function 'cfi_amdstd_panic_write':
include/linux/mtd/map.h:331:11: warning: 'r.x[0]' may be used uninitialized in this function [-Wuninitialized]
drivers/mtd/chips/cfi_cmdset_0002.c: In function 'cfi_amdstd_write_words':
include/linux/mtd/map.h:331:11: warning: 'r.x[0]' may be used uninitialized in this function [-Wuninitialized]
drivers/mtd/chips/cfi_cmdset_0001.c: In function 'cfi_intelext_write_words':
include/linux/mtd/map.h:331:11: warning: 'r.x[0]' may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: diskonchip: use inline functions for DocRead/DocWrite
Arnd Bergmann [Tue, 6 Nov 2012 21:55:27 +0000 (22:55 +0100)]
mtd: diskonchip: use inline functions for DocRead/DocWrite

The diskonchip drivers traditionally use home-grown macros for
doing MMIO accesses, which cause a lot of warnings, at least
on ARM machines:

drivers/mtd/devices/doc2000.c: In function 'doc_write':
drivers/mtd/devices/doc2000.c:854:5: warning: value computed is not used [-Wunused-value]
drivers/mtd/devices/doc2000.c: In function 'doc_erase':
drivers/mtd/devices/doc2000.c:1123:5: warning: value computed is not used [-Wunused-value
drivers/mtd/nand/diskonchip.c: In function 'doc2000_read_byte':
drivers/mtd/nand/diskonchip.c:318:3: warning: value computed is not used [-Wunused-value]

A nicer solution is to use the architecture-defined I/O accessors.
Here, we use the __raw_readl/__raw_writel style, instead of the
proper readl/writel ones, in order to preserve the odd semantics
of the existing macros that have their own barrier implementation
and no byte swap. It would be nice to fix this properly and use
the correct accessors as well as make the word size independent
from the architecture, but I guess the hardware is obsolete
enough that we should better not mess the driver an more than
necessary.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: diskonchip: don't warn about ARM architecture
Arnd Bergmann [Tue, 6 Nov 2012 21:55:26 +0000 (22:55 +0100)]
mtd: diskonchip: don't warn about ARM architecture

Enabling the diskonchip drivers on most architectures results
in a pointless warning "#warning Unknown architecture for
DiskOnChip. No default probe locations defined". The driver
can in fact handle the default location already through the
CONFIG_MTD_DOCPROBE_ADDRESS, which gets set on the platforms
that need it, and we get a run-time error if this is not
set correctly.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: nand_wait: warn if the nand is busy on exit
Matthieu CASTET [Mon, 5 Nov 2012 14:00:44 +0000 (15:00 +0100)]
mtd: nand_wait: warn if the nand is busy on exit

This patch allow to detect buggy driver/hardware with
bad RnB (dev_ready) management or when timeout occurs in polling mode.

This works when dev_ready is set or not set.
There are 2 methods to wait for an erase/program command completion:

1. Wait until nand RnB pin goes high (that's what chip->dev_ready usually does)
2. Poll the device: send a status (0x70) command and read status byte in a loop
   until bit NAND_STATUS_READY is set

In all cases, you should send a status command after completion, to check if
the operation was successful. And if the operation completed, the status should
have bit NAND_STATUS_READY set.

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: davinci: add support for parition binding nodes
Murali Karicheri [Fri, 2 Nov 2012 14:22:41 +0000 (10:22 -0400)]
mtd: davinci: add support for parition binding nodes

Enhance the driver to support partition subnodes inside the nand
device bindings to describe partions on the nand device.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Reviewed-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: cmdlinepart: fix the overflow of big mtd partitions
Huang Shijie [Thu, 1 Nov 2012 05:58:17 +0000 (13:58 +0800)]
mtd: cmdlinepart: fix the overflow of big mtd partitions

When the kernel parses the following cmdline

#mtdparts=gpmi-nand:16m(boot),16m(kernel),1g(home),4g(test),-(usr)

for a big nand chip Micron MT29F64G08AFAAAWP(8GB), we got the following wrong
result:

.............................................
"mtd: partition size too small (0)"
.............................................

We can not get any partition.

The "4g(test)" partition triggers a overflow of the "size". The memparse()
returns 4g to the "size", but the size is "unsigned long" type, so a overflow
occurs, the "size" becomes zero in the end.

This patch changes the "size"/"offset" to "unsigned long long" type,
and replaces the UINT_MAX with ULLONG_MAX for macros SIZE_REMAINING and
OFFSET_CONTINUOUS.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: map: Fix compilation warning
Viresh Kumar [Mon, 29 Oct 2012 17:17:26 +0000 (22:47 +0530)]
mtd: map: Fix compilation warning

This patch is an attempt to fix following compilation warning.

In file included from drivers/mtd/chips/cfi_cmdset_0001.c:35:0:
drivers/mtd/chips/cfi_cmdset_0001.c: In function 'cfi_intelext_write_words':
include/linux/mtd/map.h:331:11: warning: 'r.x[0]' may be used uninitialized in this function [-Wmaybe-uninitialized]

I could have used uninitialized_var() too, but didn't used it as the final else
part of map_word_load() is missing. So there is a chance that it might be passed
uninitialized. Better initialize to zero.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: Fix kernel-doc content to avoid warning.
Robert P. J. Day [Thu, 25 Oct 2012 13:43:10 +0000 (09:43 -0400)]
mtd: Fix kernel-doc content to avoid warning.

Add missing colons to fix kernel-doc generation warnings.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtdoops: don't erase flash at each boot
Matthieu CASTET [Fri, 19 Oct 2012 15:29:33 +0000 (17:29 +0200)]
mtdoops: don't erase flash at each boot

The current version on mtdoops erase first block of mtdoops partition at each
boot if there is no oops stored in flash. This can wear the flash.

When mtdoops start, find_next_position is called to find the next free entry in
the circular buffer. But if the flash is erased, find_next_position don't find
anything (maxcount == 0xffffffff) and start with the first entry after erasing it.

The scanning that is done in find_next_position already track free/used entries.
So if at the end of the scanning we don't find anything, we can start at the
first entry and erased the entry only if it is marked as used.
Most of this is implemented in mtdoops_inc_counter, so to avoid duplicating
code, if we don't find anything we set position to -1. mtdoops_inc_counter with
increment it, erase the entry if needed and start as before with nextpage = 0
and nextcount = 1).

Also during the scan phase, we use the MTDOOPS_KERNMSG_MAGIC to detect corruped
entries.

Signed-off-by: Matthieu Castet <matthieu.castet@parrot@com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: sh_flctl: Add device tree support
Bastian Hecht [Fri, 19 Oct 2012 10:15:36 +0000 (12:15 +0200)]
mtd: sh_flctl: Add device tree support

The flctl can now be probed via device tree setup in addition to the
existing platform data way.

SoC specific setup data is set in the .data member of the OF match, so
kept within the driver itself, while board/user specific setup - like
partitioning - is taken from the device tree.

Actual configuration is added for the SoC sh7372.

Signed-off-by: Bastian Hecht <hechtb@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: sh_flctl: Add DMA capabilty
Bastian Hecht [Fri, 19 Oct 2012 10:15:35 +0000 (12:15 +0200)]
mtd: sh_flctl: Add DMA capabilty

The code probes if DMA channels can get allocated and tears them down at
removal/failure if needed.
If available it uses them to transfer the data part (not ECC). On
failure we fall back to PIO mode.

Based on Guennadi Liakhovetski's code from the sh_mmcif driver.

Signed-off-by: Bastian Hecht <hechtb@gmail.com>
Reviewed-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: sh_flctl: Minor cleanups
Bastian Hecht [Fri, 19 Oct 2012 10:15:34 +0000 (12:15 +0200)]
mtd: sh_flctl: Minor cleanups

Some small fixes to avoid sparse and smatch complain. Other cosmetic fixes
as well.

- Change of the type of the member index in struct sh_flctl from signed
to unsigned. We use index by addressing array members, so unsigned is more
concise here. Adapt functions relying on sh_flctl::index.
- Remove a blurring cast in write_fiforeg().
- Apply consistent naming scheme when refering to the data buffer.
- Shorten some unnecessarily verbose functions.
- Remove spaces at start of lines.

Signed-off-by: Bastian Hecht <hechtb@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: gpmi: remove unneccessary header
Huang Shijie [Sat, 13 Oct 2012 17:03:29 +0000 (13:03 -0400)]
mtd: gpmi: remove unneccessary header

The whole gpmi-nand driver has turned to pure devicetree supported.
So the linux/mtd/gpmi-nand.h is not neccessary now. Just remove it,
and move some macros to the gpmi-nand driver itself.

Signed-off-by: Huang Shijie <shijie8@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: gpio-nand: Ability to use driver for configurations without RDY-pin
Alexander Shiyan [Wed, 17 Oct 2012 06:08:27 +0000 (10:08 +0400)]
mtd: gpio-nand: Ability to use driver for configurations without RDY-pin

In some configurations of "gpio-nand" RDY-pin may be not connected.
This patch allow to use driver for these configurations. In this case
we are assume that device always ready.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: use the NAND_STATUS_FAIL to replace the hardcode
Huang Shijie [Mon, 15 Oct 2012 03:47:24 +0000 (23:47 -0400)]
mtd: use the NAND_STATUS_FAIL to replace the hardcode

Use the NAND_STATUS_FAIL to replace the hardcode "0x01",
which make the code more readable.

Signed-off-by: Huang Shijie <shijie8@gmail.com>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: mtd_oobtest: printk -> pr_{info,err,crit}
Vikram Narayanan [Wed, 10 Oct 2012 17:42:02 +0000 (23:12 +0530)]
mtd: mtd_oobtest: printk -> pr_{info,err,crit}

Use pr_info() and pr_err() while defining pr_fmt(). This saves a few
characters, joins a few lines, and makes the code a little more readable
(and grep-able).

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: tests: mtd_torturetest: Replace printk with pr_{info,crit}
Vikram Narayanan [Wed, 10 Oct 2012 17:41:37 +0000 (23:11 +0530)]
mtd: tests: mtd_torturetest: Replace printk with pr_{info,crit}

Use pr_fmt instead of PRINT_PREF macro

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: tests: mtd_subpagetest: replace printk with pr_{info,crit,err}
Vikram Narayanan [Wed, 10 Oct 2012 17:41:06 +0000 (23:11 +0530)]
mtd: tests: mtd_subpagetest: replace printk with pr_{info,crit,err}

Use pr_fmt instead of PRINT_PREF macro

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: tests: mtd_speedtest: Replace printk with pr_{info,crit,err}
Vikram Narayanan [Wed, 10 Oct 2012 17:40:02 +0000 (23:10 +0530)]
mtd: tests: mtd_speedtest: Replace printk with pr_{info,crit,err}

Use pr_fmt instead of PRINT_PREF macro

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: tests: mtd_stresstest: Replace printk with pr_{info,crit,err}
Vikram Narayanan [Wed, 10 Oct 2012 17:40:22 +0000 (23:10 +0530)]
mtd: tests: mtd_stresstest: Replace printk with pr_{info,crit,err}

Use pr_fmt instead of PRINT_PREF macro

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: tests: mtd_readtest: Replace printk with pr_{info,err}
Vikram Narayanan [Wed, 10 Oct 2012 17:38:01 +0000 (23:08 +0530)]
mtd: tests: mtd_readtest: Replace printk with pr_{info,err}

Use pr_fmt instead of PRINT_PREF macro

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: tests: mtd_pagetest: Replace printk with pr_{info,crit,err}
Vikram Narayanan [Wed, 10 Oct 2012 17:37:40 +0000 (23:07 +0530)]
mtd: tests: mtd_pagetest: Replace printk with pr_{info,crit,err}

Use pr_fmt instead of PRINT_PREF macro

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: tests: mtd_nandecctest: Use pr_fmt macro
Vikram Narayanan [Wed, 10 Oct 2012 17:37:19 +0000 (23:07 +0530)]
mtd: tests: mtd_nandecctest: Use pr_fmt macro

Use KBUILD_MODNAME instead of hardcoding the filename

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: tests: mtd_nandbiterrs: replace msg macro with pr_{info,err}
Vikram Narayanan [Wed, 10 Oct 2012 17:34:41 +0000 (23:04 +0530)]
mtd: tests: mtd_nandbiterrs: replace msg macro with pr_{info,err}

Use pr_fmt instead of msg macro

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: spear_smi: use module_platform_driver macro
Srinivas Kandagatla [Wed, 10 Oct 2012 18:39:59 +0000 (19:39 +0100)]
mtd: spear_smi: use module_platform_driver macro

This patch removes some code duplication by using
module_platform_driver.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: nand: Increase the ecc placement locations to 640
Vipin Kumar [Tue, 9 Oct 2012 10:44:53 +0000 (16:14 +0530)]
mtd: nand: Increase the ecc placement locations to 640

Few devices like H27UBG8T2CTR have a writesize/oobsize of 8KB/640B.
This means that the maximum oobsize has gone up to 640 bytes and consequently
the maximum ecc placement locations have also gone up to 640.

Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: fsmc_nand: use relaxed variants of io accessors
Vipin Kumar [Tue, 9 Oct 2012 10:44:50 +0000 (16:14 +0530)]
mtd: fsmc_nand: use relaxed variants of io accessors

Use relaxed variants of readl/writel accessors. readl/writel io accessors use
explicit dsb instruction which causes stalls in the processor core resulting
several cycles of delay for each access

Use relaxed variants where ever possible. This also results in an improved
read/write performance.

Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: fsmc_nand: modify the wait to uninterruptible
Vipin Kumar [Tue, 9 Oct 2012 10:44:48 +0000 (16:14 +0530)]
mtd: fsmc_nand: modify the wait to uninterruptible

Interruptible wait caused trouble in fsmc hardware state machine if the
application was killed abruptly. To make fsmc operation safe turn wait in to
un-interruptible.

Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: fsmc_nand: change the type for regs to void __iomem *
Vipin Kumar [Tue, 9 Oct 2012 10:44:43 +0000 (16:14 +0530)]
mtd: fsmc_nand: change the type for regs to void __iomem *

Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agoARM: nomadik: fixup some FSMC merge problems
Linus Walleij [Thu, 11 Oct 2012 22:23:02 +0000 (00:23 +0200)]
ARM: nomadik: fixup some FSMC merge problems

Due to a clash between refactoring and due to loss of a header
file that remained in my working tree the Nomadik stopped
compiling after switching to the FSMC driver. This patch fixes
it up.

Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: fsmc_nand: pass the ale and cmd resource via resource
Jean-Christophe PLAGNIOL-VILLARD [Thu, 4 Oct 2012 13:14:16 +0000 (15:14 +0200)]
mtd: fsmc_nand: pass the ale and cmd resource via resource

Do not use the platform_data to pass resource and be smart in the drivers.
Just pass it via resource

Switch to devm_request_and_ioremap at the sametime

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-By: Vipin Kumar <vipin.kumar@st.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: delete nomadik_nand driver
Linus Walleij [Thu, 4 Oct 2012 07:28:49 +0000 (09:28 +0200)]
mtd: delete nomadik_nand driver

The nomadik_nand driver is really just a subset of the FSMC
NAND driver, and there are no users anymore so let's delete
it.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agoARM: nomadik: switch over to using the FSMC driver
Linus Walleij [Thu, 4 Oct 2012 07:28:29 +0000 (09:28 +0200)]
ARM: nomadik: switch over to using the FSMC driver

The Nomadik NAND driver is really just a subset of the existing
FSMC driver, so let's switch over to using that driver instead,
since it handles more variants of this chip. The callbacks for
setting up the chip is doing stuff now handled by the FSMC
driver.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Alessandro Rubini <rubini@unipv.it>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: denali: add a DT driver
Dinh Nguyen [Thu, 27 Sep 2012 16:58:06 +0000 (10:58 -0600)]
mtd: denali: add a DT driver

Add a device tree version of the Denali NAND driver. Based
on an original patch from Jamie Iles to add a MMIO version
of this driver.

Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: denali: split the generic driver and PCI layer
Dinh Nguyen [Thu, 27 Sep 2012 16:58:05 +0000 (10:58 -0600)]
mtd: denali: split the generic driver and PCI layer

The Denali controller can also be found in SoC devices attached to a
simple bus.  Move the PCI specific parts into denali_pci so that we can
add a denali_dt that uses the same driver but for a device tree driver
instead of a PCI based device.

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: fsl_elbc_nand: remove unnecessary badblock_pattern
Brian Norris [Wed, 26 Sep 2012 23:15:27 +0000 (16:15 -0700)]
mtd: fsl_elbc_nand: remove unnecessary badblock_pattern

Since the introduction of nand_create_default_bbt_descr() (now known as
nand_create_badblock_pattern()) in

  commit 58373ff0afff4cc8ac40608872995f4d87eb72ec

nand_chip.badblock_pattern will be dynamically calculated to the same
1-byte-length pattern that is required by fsl_elbc_nand. This custom
badblock_pattern is no longer needed, then, and its removal may help
facilitate further nand_bbt.c/nand_base.c cleanup in the future (one
down, many to go?)

Anyway, with nand_bbt.c fixed, this effectively reverts:

  commit 452db2724351ff3d9416a183a7955e00ab4e6ab4
  [MTD] [NAND] fsl_elbc_nand: fix OOB workability for large page NAND chips

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Scott Wood <scottwood@freescale.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: ofpart: Fix incorrect NULL check in parse_ofoldpart_partitions()
Sachin Kamat [Tue, 25 Sep 2012 09:57:13 +0000 (15:27 +0530)]
mtd: ofpart: Fix incorrect NULL check in parse_ofoldpart_partitions()

The pointer returned by kzalloc should be tested for NULL
to avoid potential NULL pointer dereference later. Incorrect
pointer was being tested for NULL. Bug introduced by commit fbcf62a3
(mtd: physmap_of: move parse_obsolete_partitions to become separate
parser).
This patch fixes this bug.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: stable@vger.kernel.org [3.2+]
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: m25p80: add support for the windbond w25q256 chip
Matthieu CASTET [Tue, 25 Sep 2012 09:05:27 +0000 (11:05 +0200)]
mtd: m25p80: add support for the windbond w25q256 chip

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: m25p80: Make fast read configurable via DT
Marek Vasut [Mon, 24 Sep 2012 01:39:39 +0000 (03:39 +0200)]
mtd: m25p80: Make fast read configurable via DT

Add DT property "m25p,fast-read" that signalises the particular
chip supports "fast read" opcode.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: gpmi-nand: make debug prints more clear
Vikram Narayanan [Sun, 23 Sep 2012 09:48:32 +0000 (15:18 +0530)]
mtd: gpmi-nand: make debug prints more clear

Make the error messages more debugging friendly

Signed-off-by: Vikram Narayanan <vikram186@gmail.com>
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: cmdlinepart: Simplify parse_cmdline_partitions
Shmulik Ladkani [Sun, 23 Sep 2012 07:52:29 +0000 (09:52 +0200)]
mtd: cmdlinepart: Simplify parse_cmdline_partitions

Simply 'parse_cmdline_partitions': the outer loop iterating over
'partitions' is actually a search loop, it does not execute the inner
loop for each partition, only for the matched partition.

Let's break when search is successful, and move all inner code (relevant
only for the matched partition) outside of the outer loop.

Resulting code is much more readable, and makes the indent level sane.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: nand: fix Samsung SLC detection regression
Brian Norris [Thu, 15 Nov 2012 05:46:30 +0000 (21:46 -0800)]
mtd: nand: fix Samsung SLC detection regression

This patch fixes errors seen in identifying old Samsung SLC, due to the
following commits:

    commit e2d3a35ee427aaba99b6c68a56609ce276c51270
    mtd: nand: detect Samsung K9GBG08U0A, K9GAG08U0F ID

    commit e3b88bd604283ef83ae6e8f53622d5b1ffe9d43a
    mtd: nand: add generic READ ID length calculation functions

Some Samsung NAND with "5-byte" ID really appear to have 6-byte IDs, with
wraparound like:

  Samsung K9K8G08U0D
  ec d3 51 95 58 ec ec d3

  Samsung K9F1G08U0C
  ec f1 00 95 40 ec ec f1

  Samsung K9F2G08U0B
  ec da 10 95 44 00 ec da

This bad wraparound makes it hard to reliably detect the difference
between Samsung SLC with 5-byte ID and Samsung SLC with 6-byte ID.

The fix is to, for now, only use the new Samsung table for MLC. We
cannot support the new SLC (K9FAG08U0M) until Samsung gives better ID
decode information.

Note that this applies in addition to the previous regression fix:

    commit bc86cf7af2ebda88056538e8edff852ee627f76a
    mtd: nand: fix Samsung SLC NAND identification regression

Together, these patches completely restore the previous detection
behavior so that we cannot see any more regressions in Samsung SLC NAND
(finger crossed). With luck, I can get a hold of a Samsung
representative and stop having to cross my fingers eventually.

Reported-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
Tested-by: Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: nand: fix Samsung SLC NAND identification regression
Brian Norris [Wed, 10 Oct 2012 06:26:06 +0000 (23:26 -0700)]
mtd: nand: fix Samsung SLC NAND identification regression

A combination of the following two commits caused a regression in 3.7-rc1
when identifying some Samsung NAND, so that some previously working NAND
were no longer detected properly:

    commit e3b88bd604283ef83ae6e8f53622d5b1ffe9d43a
    mtd: nand: add generic READ ID length calculation functions

    commit e2d3a35ee427aaba99b6c68a56609ce276c51270
    mtd: nand: detect Samsung K9GBG08U0A, K9GAG08U0F ID

Particularly, a regression was seen on Samsung K9F2G08U0B, with the
following full 8-byte READ ID string:

    ec da 10 95 44 00 ec da

The basic problem is that Samsung manufactures both SLC and MLC NAND
that use a non-standard decoding table for deriving information from
their IDs. I have heuristically determined that all the chips that use
the new table have ID strings which wrap around after the 6th byte.
Unfortunately, I overlooked the fact that some older Samsung SLC (which
use a different decoding table) have "5 byte ID strings" which also wrap
around after the 6th byte.

This patch re-introduces a distinction between these old and new Samsung
NAND by checking that the 6th byte is non-zero, allowing both old and
new Samsung NAND to be detected properly.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Tested-by: Brian Norris <computersforpeace@gmail.com>
Reported-by: Marek Vasut <marex@denx.de>
Tested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agojffs2: Fix lock acquisition order bug in jffs2_write_begin
Thomas Betker [Wed, 17 Oct 2012 20:59:30 +0000 (22:59 +0200)]
jffs2: Fix lock acquisition order bug in jffs2_write_begin

jffs2_write_begin() first acquires the page lock, then f->sem. This
causes an AB-BA deadlock with jffs2_garbage_collect_live(), which first
acquires f->sem, then the page lock:

jffs2_garbage_collect_live
    mutex_lock(&f->sem)                         (A)
    jffs2_garbage_collect_dnode
        jffs2_gc_fetch_page
            read_cache_page_async
                do_read_cache_page
                    lock_page(page)             (B)

jffs2_write_begin
    grab_cache_page_write_begin
        find_lock_page
            lock_page(page)                     (B)
    mutex_lock(&f->sem)                         (A)

We fix this by restructuring jffs2_write_begin() to take f->sem before
the page lock. However, we make sure that f->sem is not held when
calling jffs2_reserve_space(), as this is not permitted by the locking
rules.

The deadlock above was observed multiple times on an SoC with a dual
ARMv7 (Cortex-A9), running the long-term 3.4.11 kernel; it occurred
when using scp to copy files from a host system to the ARM target
system. The fix was heavily tested on the same target system.

Cc: stable@vger.kernel.org
Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com>
Acked-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: onenand: Make flexonenand_set_boundary static
Sachin Kamat [Sat, 22 Sep 2012 06:12:31 +0000 (11:42 +0530)]
mtd: onenand: Make flexonenand_set_boundary static

Fixes the following sparse warning:
drivers/mtd/onenand/onenand_base.c:3697:5: warning:
symbol 'flexonenand_set_boundary' was not declared. Should it be static?

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agomtd: slram: invalid checking of absolute end address
Jiri Engelthaler [Thu, 20 Sep 2012 14:49:50 +0000 (16:49 +0200)]
mtd: slram: invalid checking of absolute end address

Fixed parsing end absolute address.

Signed-off-by: Jiri Engelthaler <engycz@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
11 years agoLinux 3.7-rc4
Linus Torvalds [Sun, 4 Nov 2012 19:07:39 +0000 (11:07 -0800)]
Linux 3.7-rc4

11 years agoMerge tag 'nfs-for-3.7-4' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Linus Torvalds [Sat, 3 Nov 2012 22:27:21 +0000 (15:27 -0700)]
Merge tag 'nfs-for-3.7-4' of git://git.linux-nfs.org/projects/trondmy/linux-nfs

Pull NFS client bugfixes from Trond Myklebust:

 - Fix a bunch of deadlock situations:
   * State recovery can deadlock if we fail to release sequence ids
     before scheduling the recovery thread.
   * Calling deactivate_super() from an RPC workqueue thread can
     deadlock because of the call to rpc_shutdown_client.

 - Display the device name correctly in /proc/*/mounts

 - Fix a number of incorrect error return values:
   * When NFSv3 mounts fail due to a timeout.
   * On NFSv4.1 backchannel setup failure
   * On NFSv4 open access checks

 - pnfs_find_alloc_layout() must check the layout pointer for NULL

 - Fix a regression in the legacy DNS resolved

* tag 'nfs-for-3.7-4' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
  NFS4: nfs4_opendata_access should return errno
  NFSv4: Initialise the NFSv4.1 slot table highest_used_slotid correctly
  SUNRPC: return proper errno from backchannel_rqst
  NFS: add nfs_sb_deactive_async to avoid deadlock
  nfs: Show original device name verbatim in /proc/*/mount{s,info}
  nfsv3: Make v3 mounts fail with ETIMEDOUTs instead EIO on mountd timeouts
  nfs: Check whether a layout pointer is NULL before free it
  NFS: fix bug in legacy DNS resolver.
  NFSv4: nfs4_locku_done must release the sequence id
  NFSv4.1: We must release the sequence id when we fail to get a session slot
  NFS: Wait for session recovery to finish before returning

11 years agoMerge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Linus Torvalds [Sat, 3 Nov 2012 22:25:14 +0000 (15:25 -0700)]
Merge branch 'release' of git://git./linux/kernel/git/rzhang/linux

Pull thermal management & ACPI update from Zhang Rui,

Ho humm.  Normally these things go through Len.  But it's just three
small fixes, I guess I can pull directly too.

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
  exynos4_tmu_driver_ids should be exynos_tmu_driver_ids.
  ACPI video: Ignore errors after _DOD evaluation.
  thermal: solve compilation errors in rcar_thermal

11 years agoMerge branch 'i2c-embedded/for-current' of git://git.pengutronix.de/git/wsa/linux
Linus Torvalds [Sat, 3 Nov 2012 22:14:54 +0000 (15:14 -0700)]
Merge branch 'i2c-embedded/for-current' of git://git.pengutronix.de/git/wsa/linux

Pull i2c embedded fixes from Wolfram Sang:
 "Two patches are usual stuff.

  The bigger patch is needed to correct a wrong decision made in this
  merge window.  We hoped to get the PIOQUEUE mode in the mxs driver
  working with DMA, but it turned out to be too broken (leading to data
  loss), so we now think it is best to remove it entirely and work only
  with DMA now.  The patch should be in 3.7.  IMO, so users never get
  the chance to use both modes in parallel."

* 'i2c-embedded/for-current' of git://git.pengutronix.de/git/wsa/linux:
  i2c: tegra: set irq name as device name
  i2c-nomadik: Fixup clock handling
  i2c: mxs: remove broken PIOQUEUE support

11 years agoMerge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Linus Torvalds [Sat, 3 Nov 2012 22:13:49 +0000 (15:13 -0700)]
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux

Pull drm fixes from Dave Airlie:
 "Scattered selection of fixes:

   - radeon: load detect fixes from SuSE/AMD
   - intel: misc i830, sdvo regression, vesafb kickoff ums fix
   - exynos: maintainers entry update + fixes
   - udl: fix stride scanout issue

  it's slightly bigger than I'd probably like, but nothing looked
  dangerous enough to hold off on."

* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
  drm/udl: fix stride issues scanning out stride != width*bpp
  drm/radeon: add load detection support for ext DAC on R200 (v2)
  DRM/radeon: For single CRTC GPUs move handling of CRTC_CRT_ON to crtc_dpms().
  DRM/Radeon: Fix TV DAC Load Detection for single CRTC chips.
  DRM/Radeon: Clean up code in TV DAC load detection.
  drm/radeon: fix ATPX function documentation
  drivers/gpu/drm/radeon/evergreen_cs.c: Remove unnecessary semicolon
  DRM/Radeon: On DVI-I use Load Detection when EDID is bogus.
  DRM/Radeon: Fix primary DAC Load Detection for RV100 chips.
  DRM/Radeon: Fix Load Detection on legacy primary DAC.
  drm: exynos: removed warning due to missing typecast for mixer driver data
  drm/exynos: add support for ARCH_MULTIPLATFORM
  MAINTAINERS: Add git repository for Exynos DRM
  drm/exynos: fix display on issue
  drm/i915: Only kick out vesafb if we takeover the fbcon with KMS
  drm/i915: be less verbose about inability to provide vendor backlight
  drm/i915: clear the entire sdvo infoframe buffer
  drm/i915: VGA needs to be on pipe A on i830M
  drm/i915: fix overlay on i830M

11 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Linus Torvalds [Sat, 3 Nov 2012 03:48:41 +0000 (20:48 -0700)]
Merge git://git./linux/kernel/git/davem/net

Pull networking fixes from David Miller:
 "First post-Sandy pull request"

 1) Fix antenna gain handling and initialization of chan->max_reg_power
    in wireless, from Felix Fietkau.

 2) Fix nexthop handling in H.232 conntrack helper, from Julian
    Anastasov.

 3) Only process 80211 mesh config header in certain kinds of frames,
    from Javier Cardona.

 4) 80211 management frame header length needs to be validated, from
    Johannes Berg.

 5) Don't access free'd SKBs in ath9k driver, from Felix Fietkay.

 6) Test for permanent state correctly in VXLAN driver, from Stephen
    Hemminger.

 7) BNX2X bug fixes from Yaniv Rosner and Dmitry Kravkov.

 8) Fix off by one errors in bonding, from Nikolay ALeksandrov.

 9) Fix divide by zero in TCP-Illinois congestion control.  From Jesper
    Dangaard Brouer.

10) TCP metrics code says "Yo dawg, I heard you like sizeof, so I did a
    sizeof of a sizeof, so you can size your size" Fix from Julian
    Anastasov.

11) Several drivers do mdiobus_free without first doing an
    mdiobus_unregister leading to stray pointer references.  Fix from
    Peter Senna Tschudin.

12) Fix OOPS in l2tp_eth_create() error path, it's another danling
    pointer kinda situation.  Fix from Tom Parkin.

13) Hardware driven by the vmxnet driver can't handle larger than 16K
    fragments, so split them up when necessary.  From Eric Dumazet.

14) Handle zero length data length in tcp_send_rcvq() properly.  Fix
    from Pavel Emelyanov.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (38 commits)
  tcp-repair: Handle zero-length data put in rcv queue
  vmxnet3: must split too big fragments
  l2tp: fix oops in l2tp_eth_create() error path
  cxgb4: Fix unable to get UP event from the LLD
  drivers/net/phy/mdio-bitbang.c: Call mdiobus_unregister before mdiobus_free
  drivers/net/ethernet/nxp/lpc_eth.c: Call mdiobus_unregister before mdiobus_free
  bnx2x: fix HW initialization using fw 7.8.x
  tcp: Fix double sizeof in new tcp_metrics code
  net: fix divide by zero in tcp algorithm illinois
  net: sctp: Fix typo in net/sctp
  bonding: fix second off-by-one error
  bonding: fix off-by-one error
  bnx2x: Disable FCoE for 57840 since not yet supported by FW
  bnx2x: Fix no link on 577xx 10G-baseT
  bnx2x: Fix unrecognized SFP+ module after driver is loaded
  bnx2x: Fix potential incorrect link speed provision
  bnx2x: Restore global registers back to default.
  bnx2x: Fix link down in 57712 following LFA
  bnx2x: Fix 57810 1G-KR link against certain switches.
  ixgbe: PTP get_ts_info missing software support
  ...

11 years agotcp-repair: Handle zero-length data put in rcv queue
Pavel Emelyanov [Mon, 29 Oct 2012 05:05:33 +0000 (05:05 +0000)]
tcp-repair: Handle zero-length data put in rcv queue

When sending data into a tcp socket in repair state we should check
for the amount of data being 0 explicitly. Otherwise we'll have an skb
with seq == end_seq in rcv queue, but tcp doesn't expect this to happen
(in particular a warn_on in tcp_recvmsg shoots).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Reported-by: Giorgos Mavrikas <gmavrikas@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>