Commit Graph

4052 Commits

Author SHA1 Message Date
Huang Shijie 7a2b89acf8 mtd: gpmi: rewrite the gpmi_ecc_write_oob() to support the jffs2
When we use the ECC info which is get from the nand chip's datasheet,
we may have some freed oob area now.

This patch rewrites the gpmi_ecc_write_oob() to implement the ecc.write_oob().
We also update the comment for gpmi_hw_ecclayout.

Yes! We can support the JFFS2 for the SLC nand now.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:06 -07:00
Huang Shijie 3723e93c64 mtd: nand: print out the cell information for nand chip
Print out the cell information for nand chip.

(Since the message is too long, this patch also splits the log
with two separate pr_info())

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:05 -07:00
Huang Shijie 13fbd17941 mtd: nand: set the cell information for ONFI nand
The current code does not set the SLC/MLC information for onfi nand.
(This makes that the kernel treats all the onfi nand as SLC nand.)

This patch fills the cell information for ONFI nands.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:05 -07:00
Huang Shijie 1c195e909c mtd: nand: add the "bits per cell" info for legacy ID NAND
The legacy ID NAND are all SLC.
This patch sets 1 to the @bits_per_cell for the legacy ID NAND,
which means they are all SLC.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:05 -07:00
Huang Shijie 7db906b79f mtd: nand: rename the cellinfo to bits_per_cell
The @cellinfo fields contains unused information, such as write caching,
internal chip numbering, etc. But we only use it to check the SLC or MLC.

This patch tries to make it more clear and simple, renames the @cellinfo
to @bits_per_cell.

In order to avoiding the bisect issue, this patch also does the following
changes:
  (0) add a macro NAND_CI_CELLTYPE_SHIFT to avoid the hardcode.

  (1) add a helper to parse out the cell type : nand_get_bits_per_cell()

  (2) parse out the cell type for extended-ID chips and the full-id nand chips.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:04 -07:00
Huang Shijie 1d0ed69ddd mtd: nand: add a helper to check the SLC/MLC nand chip
Add a helper to check if a nand chip is SLC or MLC.
This helper makes the code more readable.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:04 -07:00
Brian Norris 4ae7d228d6 mtd: nand: correct extemded param page error handling
If the ONFI extended parameter page gives codeword_size == 0, the
extended ECC information is corrupt and should not be used. Currently,
we (correctly) avoid using the information, but we don't report the
error to the caller, so the caller doesn't know that we didn't
initialize ecc_strength_ds and ecc_step_ds. Now the caller can warn the
user that it does not have sufficient information.

This also removes the false and useless "ONFI extended param page
detected" debug message (it was printed even on the aforementioned
corruption, and for the success case, we don't really want a print).

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Huang Shijie <b32955@freescale.com>
2013-10-27 16:27:04 -07:00
Josh Wu 2a3d933a46 mtd: atmel_nand: use minimum ecc requirements of nand: ecc_{strength,step}_ds
Since ecc_{strength,step}_ds is introduced in nand_chip structure for
minimum ecc requirements. So we can use them directly and remove our
own get_onfi_ecc_param function.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:04 -07:00
Josh Wu 81f29b475d mtd: atmel_nand: add MODULE_DEVICE_TABLE for nfc driver
This patch also add a const keyword for the of_device_id of nfc.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:04 -07:00
Josh Wu e9d8da807d mtd: atmel_nand: remove #if defined(CONFIG_OF) around OF-specific code
Since the of specific code are declared in <linux/of_mtd.h> regardless
of CONFIG_OF. Remove the #if defined(CONFIG_OF) guard and use an
IS_ENABLED(CONFIG_OF) instead.

Thanks to Ezequiel Garcia's for this protype.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:03 -07:00
Paul Bolle 86bc7bddc9 mtd: onenand: omap: remove two unused functions
Nothing calls omap2_onenand_rephase(). And __adjust_timing() is only
called by omap2_onenand_rephase(). Remove these two unused functions.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:03 -07:00
Brian Norris c7f23a7063 mtd: nand: cleanup ONFI printed errors, warnings
The ONFI detection routine is too verbose in some cases and not verbose
enough in others. This patch refactors it to print only when there are
significant warnings/errors.

Probing in 16-bit mode:
  It is unnecessary to print until after the READID (address 20h)
  command. READID *has* to work properly in whatever bus width
  configuration we are in, or else no identification mode works. So we
  can silence some useless warnings on systems which come up in 16-bit
  mode and do not even respond with an O-N-F-I string.

Valid parameter page:
  Nobody needs to see this. Do we inform the user every time other
  hardware responds properly? Instead, add an error message if *no*
  uncorrupted parameter pages are found.

ONFI ECC:
  Most drivers don't yet use the reported minimum ECC values, so it
  shouldn't yet be a fatal condition if the extended parameter page is
  incorrect. But we should at least give a warning for the corner cases
  that we don't expect.

ONFI flash detected:
  Nobody needs to see this. This is the expected case, that we detect
  ONFI properly, or else it wasn't ONFI-compliant and is detected by
  some other routine.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Huang Shijie <b32955@freescale.com>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
2013-10-27 16:27:03 -07:00
Brian Norris 535ab90334 mtd: lpddr_cmds: make function static
do_xxlock() is only used locally. This silences a sparse warning:

drivers/mtd/lpddr/lpddr_cmds.c:706:5: warning: no previous prototype for 'do_xxlock' [-Wmissing-prototypes]

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:03 -07:00
Brian Norris 6b7368c230 mtd: onenand: remove unused variable assignments
These variable assignments are never used (the variables are either
never used or are overwritten before use). This resolves some compiler
warnings like the following:

    drivers/mtd/onenand/onenand_base.c: In function 'flexonenand_get_boundary':
    drivers/mtd/onenand/onenand_base.c:3532:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
    drivers/mtd/onenand/onenand_base.c: In function 'onenand_probe':
    drivers/mtd/onenand/onenand_base.c:3838:6: warning: variable 'maf_id' set but not used [-Wunused-but-set-variable]

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
2013-10-27 16:27:03 -07:00
Brian Norris aaadd9819a mtd: nand: remove obsolete 'ecclayout' field
This field is never used, except to print it out.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:03 -07:00
Brian Norris 53d66baef6 mtd: onenand: remove redundant offset check
The mtd_block_isbad() interface already checks for this.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:02 -07:00
Brian Norris 8c5194361d mtd: denali: make init function static
It's only used in this file.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:27:00 -07:00
Brian Norris be1ee7d881 mtd: dataflash: remove unused field
struct dataflash's 'partition' field is unused. Just remove it.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: David Brownell <david-b@pacbell.net>
2013-10-27 16:26:59 -07:00
Brian Norris 552fb55d6e mtd: nand: stop exporting nand_default_bbt
I removed the last non-nand_base users of this, and we shouldn't have
any more modules that need to access it. It's only non-static to share
between nand_base and nand_bbt.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:26:59 -07:00
Brian Norris 4fd18ae46d mtd: nandsim: don't call nand_default_bbt() directly
We want the default nand_chip.scan_bbt() function, so just use the
proper indirection.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:26:59 -07:00
Brian Norris 252026ab93 mtd: nand: lpc32xx_slc: don't call nand_default_bbt directly
This driver is doing some strange logic here. If it doesn't have
flash-based BBT enabled, it allows nand_scan_tail() to scan the BBT. But
if it is using flash-based BBT, it tells nand_scan_tail() to skip
scanning, then it immediately calls the default BBT scanning function
itself.

As I read it, this logic is equivalent to the default nand_scan_tail()
behavior without interfering with NAND_SKIP_BBTSCAN or calling
nand_default_bbt() directly at all.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-27 16:26:59 -07:00
Brian Norris 2ee41fa0ba nand: docg4: use nand_base's default BBT scan
There's no point in the low level driver doing the work that nand_base
already is doing; just let nand_base set the default BBT scanning
function.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Mike Dunn <mikedunn@newsguy.com>
2013-10-27 16:26:59 -07:00
Lothar Waßmann d41f950e27 mtd: nand: gpmi-nand: janitorial cleanup: (commas after last element of struct initializer)
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2013-10-27 16:26:58 -07:00
David Woodhouse 031e2777e0 mtd: gpmi: fix ECC regression
The "legacy" ECC layout used until 3.12-rc1 uses all the OOB area by
computing the ECC strength and ECC step size ourselves.

Commit 2febcdf84b ("mtd: gpmi: set the BCHs geometry with the ecc info")
makes the driver use the ECC info (ECC strength and ECC step size)
provided by the MTD code, and creates a different NAND ECC layout
for the BCH, and use the new ECC layout. This causes a regression:

   We can not mount the ubifs which was created by the old NAND ECC layout.

This patch fixes this issue by reverting to the legacy ECC layout.

We will probably introduce a new device-tree property to indicate that
the new ECC layout can be used. For now though, for the imminent 3.12
release, we just unconditionally revert to the 3.11 behaviour.

This leaves a harmless cosmetic warning about an unused function. At
this point in the cycle I really don't care.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Huang Shijie <b32955@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
Tested-by: Marek Vasut <marex@denx.de>
2013-10-25 10:09:43 -07:00
Ezequiel Garcia 18a84e935e mtd: nand: pxa3xx: Fix registered MTD name
In a recent commit:

  commit f455578dd9
  Author: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
  Date:   Mon Aug 12 14:14:53 2013 -0300

  mtd: nand: pxa3xx: Remove hardcoded mtd name

  There's no advantage in using a hardcoded name for the mtd device.
  Instead use the provided by the platform_device.

The MTD name was changed to use the one provided by the platform_device.
However, this can be problematic as some users want to set partitions
using the kernel parameter 'mtdparts', where the name is needed.

Therefore, to avoid regressions in users relying in 'mtdparts' we revert
the change and use the previous one 'pxa3xx_nand-0'.

While at it, let's put a big comment and prevent this change from happening
ever again.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-24 14:44:28 -07:00
Elie De Brauwer 2b468ef0e7 mtd: m25p80: Fix 4 byte addressing mode for Micron devices.
According to the datasheet for Micron n25q256a (N25Q256A13ESF40F) 4-byte
addressing mode should be entered as follows:

<quote>
To enter or exit the 4-byte address mode, the WRITE ENABLE command
must be executed to set the write enable latch bit to 1. (Note: The
WRITE ENABLE command must NOT be executed on the N25Q256A83ESF40x and
N25Q256A83E1240x devices.) S# must be driven LOW. The effect of the
command is immediate; after the command has been executed, the write
enable latch bit is cleared to 0.
</quote>

Micron's portable way to perform this for all types of Micron flash
is to first issue a write enable, then switch the addressing mode
followed by a write disable to avoid leaving the flash in a write-
able state.

Signed-off-by: Elie De Brauwer <eliedebrauwer@email.com>
[Brian: reworked a bit]
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-09-27 05:56:22 -05:00
Brian Norris 5cb1327172 mtd: nand: fix memory leak in ONFI extended parameter page
This fixes a memory leak in the ONFI support code for detecting the
required ECC levels from this commit:

  commit 6dcbe0cdd8
  Author: Huang Shijie <b32955@freescale.com>
  Date:   Wed May 22 10:28:27 2013 +0800

      mtd: get the ECC info from the Extended Parameter Page

In the success case, we never freed the 'ep' buffer.

Also, this fixes an oversight in the same commit where we (harmlessly)
freed the NULL pointer.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-09-27 05:48:02 -05:00
Ezequiel Garcia ab5be58833 mtd: nand: pxa3xx: Remove unneeded ifdef CONFIG_OF
There's no need to enclose this code within idef CONFIG_OF,
because the OF framework provides no-op stubs if CONFIG_OF=n.

Cc: devicetree@vger.kernel.org
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
2013-09-17 09:08:14 -07:00
Linus Torvalds f1da3458e9 Just a single fastmap fix plus a regression fix.
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJSNrFCAAoJECmIfjd9wqK0yvIP/RZoKYaNMMFoJts8oEr55D/8
 AoYuoWTnYZSNxdJ50vHBaZdI0gtpu+sKo7iLgVCF++rAK7T+asLevqpJFx7ht7ji
 /bGpkncwKACCt7yWhKiqJ7Z9XJnEf5u99fW9up/1gU2Ds/7emjKjaz0pXhSkk6Ut
 PwKof/PckzT8kAnePPnCLhyHsKHFm65TrnmAv5RBOTIM2jUHPLtXXHM3V6Bvnafv
 QzI0u2BClbw6U5N3bg1lFzD9Ww6RwPzBc8wOw9wVRR/bpYxAK/3itiWp5DLhVQHF
 aH7cfXe1y7ccn3IK0aaa0S2ZM50m5t6id2/CMBgTXjDTZmU4sFGQI6TtjRAv47xr
 DOqMpH/RGaGmIkA+TLOJCS+qN/Zqdt2sdINiIRZDLfN/14swdaN5oxUJbccsxSa5
 hnuXGkH/1VxGsWNUJz55s3ugS81SEcSqo26fMbOPDHI/N+SniBHe7G3/0vggUoG0
 rGNCjFXchslYTwtZM4bjrkS5vBfQHlL9Y1XAztjejqMa/TVg+REo2vTB7cJYZL2w
 NE/fj8CwxN1ziMvMcK1eQt9HpVkH1GUvzNc+vc+ZmQJRPZSrW4t5DecuCnEVunq8
 t+Gae4vhVliWHFQwHwiTucYgmfLg6GOmcXSs4fjYN2j7pHMZTRYJPNA3ygDhdRX2
 f3xWERPP5H8GJAhSJyBj
 =qMi3
 -----END PGP SIGNATURE-----

Merge tag 'upstream-3.12-rc1' of git://git.infradead.org/linux-ubi

Pull UBI fixes from Artem Bityutskiy:
 "Just a single fastmap fix plus a regression fix"

* tag 'upstream-3.12-rc1' of git://git.infradead.org/linux-ubi:
  UBI: Fix invalidate_fastmap()
  UBI: Fix PEB leak in wear_leveling_worker()
2013-09-16 15:37:52 -04:00
Linus Torvalds ef9a61bef9 - factor out common code from MTD tests
- nand-gpio cleanup and portability to non-ARM
  - m25p80 support for 4-byte addressing chips, other new chips
  - pxa3xx cleanup and support for new platforms
  - remove obsolete alauda, octagon-5066 drivers
  - erase/write support for bcm47xxsflash
  - improve detection of ECC requirements for NAND, controller setup
  - NFC acceleration support for atmel-nand, read/write via SRAM
  - etc.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.14 (GNU/Linux)
 
 iEYEABECAAYFAlIt3VsACgkQdwG7hYl686NKBQCgqFzV1S+TiXZSjbqanK0374Hu
 lMIAoI2IOQb1bgQFSqaOzgSaBmVhLtMc
 =xWBt
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-20130909' of git://git.infradead.org/linux-mtd

Pull mtd updates from David Woodhouse:
 - factor out common code from MTD tests
 - nand-gpio cleanup and portability to non-ARM
 - m25p80 support for 4-byte addressing chips, other new chips
 - pxa3xx cleanup and support for new platforms
 - remove obsolete alauda, octagon-5066 drivers
 - erase/write support for bcm47xxsflash
 - improve detection of ECC requirements for NAND, controller setup
 - NFC acceleration support for atmel-nand, read/write via SRAM
 - etc

* tag 'for-linus-20130909' of git://git.infradead.org/linux-mtd: (184 commits)
  mtd: chips: Add support for PMC SPI Flash chips in m25p80.c
  mtd: ofpart: use for_each_child_of_node() macro
  mtd: mtdswap: replace strict_strtoul() with kstrtoul()
  mtd cs553x_nand: use kzalloc() instead of memset
  mtd: atmel_nand: fix error return code in atmel_nand_probe()
  mtd: bcm47xxsflash: writing support
  mtd: bcm47xxsflash: implement erasing support
  mtd: bcm47xxsflash: convert to module_platform_driver instead of init/exit
  mtd: bcm47xxsflash: convert kzalloc to avoid invalid access
  mtd: remove alauda driver
  mtd: nand: mxc_nand: mark 'const' properly
  mtd: maps: cfi_flagadm: add missing __iomem annotation
  mtd: spear_smi: add missing __iomem annotation
  mtd: r852: Staticize local symbols
  mtd: nandsim: Staticize local symbols
  mtd: impa7: add missing __iomem annotation
  mtd: sm_ftl: Staticize local symbols
  mtd: m25p80: add support for mr25h10
  mtd: m25p80: make CONFIG_M25PXX_USE_FAST_READ safe to enable
  mtd: m25p80: Pass flags through CAT25_INFO macro
  ...
2013-09-09 10:33:19 -07:00
Michel Stempin 6c3b889701 mtd: chips: Add support for PMC SPI Flash chips in m25p80.c
Add support for PMC (now Chingis, part of ISSI) Pm25LV512 (512 Kib),
Pm25LV010 (1 Mib) and Pm25LQ032 (32 Mib) SPI Flash chips.

This patch addresses two generations of PMC SPI Flash chips:

 - Pm25LV512 and Pm25LV010: these have 4KiB sectors and 32KiB
   blocks. The 4KiB sector erase uses a non-standard opcode
   (0xd7). They do not support JEDEC RDID (0x9f), and so they can only
   be detected by matching their name string with pre-configured
   platform data. Because of the cascaded acquisitions, the datasheet
   is no longer available on the current manufacturer's website,
   although it is still commonly used in some recent wireless routers
   (<https://forum.openwrt.org/viewtopic.php?pid=186360#p186360>). The
   only public datasheet available seems to be on GeoCities:
   <http://www.geocities.jp/scottle556/pdf/Pm25LV512-010.pdf>

 - Pm25LQ032: a newer generation flash, with 4KiB sectors and 64KiB
   blocks. It uses the standard erase and JEDEC read-ID
   opcodes. Manufacturer's datasheet is here:
   <http://www.chingistek.com/img/Product_Files/Pm25LQ032C%20datasheet%20v1.6.1.pdf>

This patch is resent in order to take into account both Brian Norris
remarks and this upstream patch:

commit e534ee4f9c
Author: Krzysztof Mazur <krzysiek@podlesie.net>
Date:   Fri Feb 22 15:51:05 2013 +0100

    mtd: m25p80: introduce SST_WRITE flag for SST byte programming

    Not all SST devices implement the SST byte programming command.
    Some devices (like SST25VF064C) implement only standard m25p80 page
    write command.

    Now SPI flash devices that need sst_write() are explicitly marked
    with new SST_WRITE flag and the decision to use sst_write() is based
    on this flag instead of manufacturer id.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Michel Stempin <michel.stempin@wanadoo.fr>
[Brian: fixed conflict]
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 23:57:37 +01:00
Wei Yongjun 60ea89e22a mtd: ofpart: use for_each_child_of_node() macro
Use for_each_child_of_node() macro instead of open coding it.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 21:52:57 +01:00
Jingoo Han 3156231fb6 mtd: mtdswap: replace strict_strtoul() with kstrtoul()
The usage of strict_strtoul() is not preferred, because
strict_strtoul() is obsolete. Thus, kstrtoul() should be
used.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 21:52:51 +01:00
Dan Carpenter 8e7fd23686 mtd cs553x_nand: use kzalloc() instead of memset
It's cleaner to use kzalloc() instead of zeroing out in a separate call
to memset().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 21:52:48 +01:00
Wei Yongjun ff52c67a10 mtd: atmel_nand: fix error return code in atmel_nand_probe()
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 21:52:44 +01:00
Rafał Miłecki 13134f48c8 mtd: bcm47xxsflash: writing support
Tested with BCM4706.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 21:52:20 +01:00
Rafał Miłecki c0fcbc56d9 mtd: bcm47xxsflash: implement erasing support
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 21:52:15 +01:00
Libo Chen 8268df2636 mtd: bcm47xxsflash: convert to module_platform_driver instead of init/exit
convert to module_platform_driver instead of init/exit

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Libo chen <libo.chen@huawei.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 21:52:14 +01:00
Libo Chen d2b1bd1422 mtd: bcm47xxsflash: convert kzalloc to avoid invalid access
mtd is just member of bcm47xxsflash, so we should free bcm47xxsflash not
its member. So I use devm_kazlloc instead of kazlloc to avoid it.

* Changelog:
   convert to devm_kzalloc

Signed-off-by: Libo chen <libo.chen@huawei.com>
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
[Brian: fixed conflicts]
Signed-off-by: Brian Norris <computersforpeace@gmail.com>

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 21:52:10 +01:00
Jussi Kivilinna ebc6e4b652 mtd: remove alauda driver
The driver has very low utility.  Devices in question are limited to
about 400kB/s and the only known user (me) discarded the hardware
several years back.

Signed-off-by: Joern Engel <joern@logfs.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 21:51:57 +01:00
Jingoo Han b2ac037610 mtd: nand: mxc_nand: mark 'const' properly
The values pointed by the pointer are used as read-only.
Also, mtd_device_parse_register() uses 'part_probes[]' as
the second argument which is defined as 'const char * const *types'.
Thus, the 'const' should be moved to be after the '*'.

drivers/mtd/nand/mxc_nand.c:269:25: warning: duplicate const

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 21:51:52 +01:00
Jingoo Han 9a589c8bad mtd: maps: cfi_flagadm: add missing __iomem annotation
Added missing __iomem annotation and staticized local symbols
in order to fix the following sparse warnings:

drivers/mtd/maps/cfi_flagadm.c:58:17: warning: symbol 'flagadm_map' was not declared. Should it be static?
drivers/mtd/maps/cfi_flagadm.c:64:22: warning: symbol 'flagadm_parts' was not declared. Should it be static?
drivers/mtd/maps/cfi_flagadm.c:115:18: warning: cast removes address space of expression
drivers/mtd/maps/cfi_flagadm.c:115:18: warning: incorrect type in argument 1 (different address spaces)
drivers/mtd/maps/cfi_flagadm.c:115:18:    expected void volatile [noderef] <asn:2>*addr
drivers/mtd/maps/cfi_flagadm.c:115:18:    got void *<noident>
drivers/mtd/maps/cfi_flagadm.c:126:26: warning: cast removes address space of expression
drivers/mtd/maps/cfi_flagadm.c:126:26: warning: incorrect type in argument 1 (different address spaces)
drivers/mtd/maps/cfi_flagadm.c:126:26:    expected void volatile [noderef] <asn:2>*addr
drivers/mtd/maps/cfi_flagadm.c:126:26:    got void *<noident>
drivers/mtd/maps/cfi_flagadm.c:127:36: warning: Using plain integer as NULL pointer

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 21:51:49 +01:00
Jingoo Han e51fb2cb2b mtd: spear_smi: add missing __iomem annotation
Added missing __iomem annotation in order to fix the following
sparse warnings:

drivers/mtd/devices/spear_smi.c:566:13: warning: incorrect type in assignment (different address spaces)
drivers/mtd/devices/spear_smi.c:566:13:    expected void *src
drivers/mtd/devices/spear_smi.c:566:13:    got void [noderef] <asn:2>*
drivers/mtd/devices/spear_smi.c:586:9: warning: incorrect type in argument 2 (different address spaces)
drivers/mtd/devices/spear_smi.c:586:9:    expected void const volatile [noderef] <asn:2>*<noident>
drivers/mtd/devices/spear_smi.c:586:9:    got unsigned char [usertype] *<noident>
drivers/mtd/devices/spear_smi.c:659:14: warning: incorrect type in assignment (different address spaces)
drivers/mtd/devices/spear_smi.c:659:14:    expected void *dest
drivers/mtd/devices/spear_smi.c:659:14:    got void [noderef] <asn:2>*
drivers/mtd/devices/spear_smi.c:620:9: warning: incorrect type in argument 1 (different address spaces)
drivers/mtd/devices/spear_smi.c:620:9:    expected void volatile [noderef] <asn:2>*<noident>
drivers/mtd/devices/spear_smi.c:620:9:    got void *dest
drivers/mtd/devices/spear_smi.c:620:9: warning: incorrect type in argument 1 (different address spaces)
drivers/mtd/devices/spear_smi.c:620:9:    expected void volatile [noderef] <asn:2>*<noident>
drivers/mtd/devices/spear_smi.c:620:9:    got void *dest
drivers/mtd/devices/spear_smi.c:620:9: warning: incorrect type in argument 1 (different address spaces)
drivers/mtd/devices/spear_smi.c:620:9:    expected void volatile [noderef] <asn:2>*<noident>
drivers/mtd/devices/spear_smi.c:620:9:    got void *dest

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 21:51:48 +01:00
Jingoo Han 2fffc7982c mtd: r852: Staticize local symbols
These local symbols are used only in this file.
Fix the following sparse warnings:

drivers/mtd/nand/r852.c:232:6: warning: symbol 'r852_write_buf' was not declared. Should it be static?
drivers/mtd/nand/r852.c:264:6: warning: symbol 'r852_read_buf' was not declared. Should it be static?
drivers/mtd/nand/r852.c:315:6: warning: symbol 'r852_cmdctl' was not declared. Should it be static?
drivers/mtd/nand/r852.c:360:5: warning: symbol 'r852_wait' was not declared. Should it be static?
drivers/mtd/nand/r852.c:389:5: warning: symbol 'r852_ready' was not declared. Should it be static?
drivers/mtd/nand/r852.c:400:6: warning: symbol 'r852_ecc_hwctl' was not declared. Should it be static?
drivers/mtd/nand/r852.c:432:5: warning: symbol 'r852_ecc_calculate' was not declared. Should it be static?
drivers/mtd/nand/r852.c:464:5: warning: symbol 'r852_ecc_correct' was not declared. Should it be static?
drivers/mtd/nand/r852.c:532:6: warning: symbol 'r852_engine_enable' was not declared. Should it be static?
drivers/mtd/nand/r852.c:550:6: warning: symbol 'r852_engine_disable' was not declared. Should it be static?
drivers/mtd/nand/r852.c:560:6: warning: symbol 'r852_card_update_present' was not declared. Should it be static?
drivers/mtd/nand/r852.c:575:6: warning: symbol 'r852_update_card_detect' was not declared. Should it be static?
drivers/mtd/nand/r852.c:589:9: warning: symbol 'r852_media_type_show' was not declared. Should it be static?
drivers/mtd/nand/r852.c:600:1: warning: symbol 'dev_attr_media_type' was not declared. Should it be static?
drivers/mtd/nand/r852.c:604:6: warning: symbol 'r852_update_media_status' was not declared. Should it be static?
drivers/mtd/nand/r852.c:633:5: warning: symbol 'r852_register_nand_device' was not declared. Should it be static?
drivers/mtd/nand/r852.c:671:6: warning: symbol 'r852_unregister_nand_device' was not declared. Should it be static?
drivers/mtd/nand/r852.c:685:6: warning: symbol 'r852_card_detect_work' was not declared. Should it be static?
drivers/mtd/nand/r852.c:824:6: warning: symbol 'r852_probe' was not declared. Should it be static?
drivers/mtd/nand/r852.c:964:6: warning: symbol 'r852_remove' was not declared. Should it be static?
drivers/mtd/nand/r852.c:995:6: warning: symbol 'r852_shutdown' was not declared. Should it be static?

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 21:51:45 +01:00
Jingoo Han b2b263f2e7 mtd: nandsim: Staticize local symbols
These local symbols are used only in this file.
Fix the following sparse warnings:

drivers/mtd/nand/nandsim.c:1436:5: warning: symbol 'do_read_error' was not declared. Should it be static?
drivers/mtd/nand/nandsim.c:1448:6: warning: symbol 'do_bit_flips' was not declared. Should it be static?

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 21:51:43 +01:00
Jingoo Han d1d90c992d mtd: impa7: add missing __iomem annotation
Added missing __iomem annotation and used NULL instead of 0
in order to fix the following sparse warnings:

drivers/mtd/maps/impa7.c:82:32: warning: Using plain integer as NULL pointer
drivers/mtd/maps/impa7.c:96:34: warning: cast removes address space of expression
drivers/mtd/maps/impa7.c:96:34: warning: incorrect type in argument 1 (different address spaces)
drivers/mtd/maps/impa7.c:96:34:    expected void volatile [noderef] <asn:2>*addr
drivers/mtd/maps/impa7.c:96:34:    got void *<noident>
drivers/mtd/maps/impa7.c:108:34: warning: cast removes address space of expression
drivers/mtd/maps/impa7.c:108:34: warning: incorrect type in argument 1 (different address spaces)
drivers/mtd/maps/impa7.c:108:34:    expected void volatile [noderef] <asn:2>*addr
drivers/mtd/maps/impa7.c:108:34:    got void *<noident>
drivers/mtd/maps/impa7.c:109:45: warning: Using plain integer as NULL pointer

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 21:51:40 +01:00
Jingoo Han 582b2ffcaa mtd: sm_ftl: Staticize local symbols
These local symbols are used only in this file.
Fix the following sparse warnings:

drivers/mtd/sm_ftl.c:25:25: warning: symbol 'cache_flush_workqueue' was not declared. Should it be static?
drivers/mtd/sm_ftl.c:44:9: warning: symbol 'sm_attr_show' was not declared. Should it be static?
drivers/mtd/sm_ftl.c:57:24: warning: symbol 'sm_create_sysfs_attributes' was not declared. Should it be static?
drivers/mtd/sm_ftl.c:110:6: warning: symbol 'sm_delete_sysfs_attributes' was not declared. Should it be static?
drivers/mtd/sm_ftl.c:574:5: warning: symbol 'sm_get_media_info' was not declared. Should it be static?
drivers/mtd/sm_ftl.c:881:17: warning: symbol 'sm_get_zone' was not declared. Should it be static?
drivers/mtd/sm_ftl.c:902:6: warning: symbol 'sm_cache_init' was not declared. Should it be static?
drivers/mtd/sm_ftl.c:912:6: warning: symbol 'sm_cache_put' was not declared. Should it be static?
drivers/mtd/sm_ftl.c:920:5: warning: symbol 'sm_cache_get' was not declared. Should it be static?
drivers/mtd/sm_ftl.c:931:5: warning: symbol 'sm_cache_flush' was not declared. Should it be static?

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 21:51:25 +01:00
Markus Niebel a3d7ee9ff8 mtd: m25p80: add support for mr25h10
This adds support for the Everspin mr25h10 MRAM chip to the m25p80
driver.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 21:44:10 +01:00
Sascha Hauer 58146992c9 mtd: m25p80: make CONFIG_M25PXX_USE_FAST_READ safe to enable
This patch adds a flag to struct flash_info indicating that
fast_read is not supported. This now gives the following logic
when determing whether to enable fastread:

If the flash chip does not support fast_read, then disable it.
Otherwise:
1) enable fast_read if device node contains m25p,fast-read
2) enable fast_read if forced in Kconfig

This makes enabling CONFIG_M25PXX_USE_FAST_READ a safe option
since we no longer enable the fast_read option unconditionally.

For now fast_read is disabled for the everspin mr25h256 and the
catalyst devices. Others may need the flag aswell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 21:44:06 +01:00
Sascha Hauer 7e7d83b32e mtd: m25p80: Pass flags through CAT25_INFO macro
The flags may have to be overwritten, so add them to the CAT25_INFO
macro.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2013-08-30 21:43:10 +01:00