Commit Graph

1687 Commits

Author SHA1 Message Date
Roel Kluin
4e41073ea1 mtd: mtdpart: prevent a read from regions[-1]
If the erase region was found in the first iteration we read from
regions[-1]

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 07:52:26 -06:00
David Jander
e90355ef19 mtd: m25p80.c: Add support for S25FL032P spi-nor flash devices.
Signed-off-by: David Jander <david@protonic.nl>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 07:43:12 -06:00
Thierry Reding
b73e76642f mtd: m25p80: Add support for the Winbond W25Q64
This patch adds support for the Winbond W25Q64 serial flash.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 07:42:53 -06:00
Gernot Hoyler
84b419195c mtd: m25p80: Add support for two new Spansion SPI devices (S25FL-K)
This patch adds support for Spansion S25FL016K and S25FL064K SPI flash.
It has been tested with physical devices. Note that both parts exhibit
a Winbond manufacturer ID so they might also be added to that section.

Signed-off-by: Gernot Hoyler <Gernot.Hoyler@spansion.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 07:42:35 -06:00
Dan Carpenter
b3c3af1ac7 mtd/m25p80: fix test for end of loop
"plat_id" is always non-NULL here.  There is a zero element on the end
of the m25p_ids[] array and if we hit the end of the loop then plat_id
points to that.

This would lead to a NULL pointer dereference later on in the function.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 07:42:24 -06:00
Gabor Juhos
7700a6dda6 mtd: m25p80: add support for the Winbond W25Q32 SPI flash chip
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2010-12-03 07:41:22 -06:00
Gabor Juhos
7feb107bea mtd: m25p80: add support for the Intel/Numonyx {16,32,64}0S33B SPI flash chips
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 07:40:58 -06:00
Gabor Juhos
576cc79d2c mtd: m25p80: add support for the EON EN25P{32, 64} SPI flash chips
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 07:40:40 -06:00
Anton Vorontsov
c65568fb65 mtd: m25p80: Make jedec_probe() return proper errno values
spi_write_then_read() may return its own return codes (e.g. -EIO),
so let's propagate the value down to the probe().

Also, remove jedec == 0 check, it isn't needed as nowadays we use
dedicated SPI device IDs for non-JEDEC flashes.

Suggested-by: Barry Song <21cnbao@gmail.com>
Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 07:40:21 -06:00
Anton Vorontsov
1cbcb746de mtd: m25p80: Fix false-positive probing
Since commit 18c6182bae0acca220ed6611f741034d563cd19f ("Rework
probing/JEDEC code"), m25p80 driver successfully registers chips
even if JEDEC probing fails.

This was needed to support non-JEDEC flashes. Though, it appears
that some platforms (e.g. blackfin bf533 stamp[1]) used the old
behavior to detect if there's any flash connected, so the driver
have to fail on JEDEC probing errors.

This patch restores the old behavior for JEDEC flashes, and adds
"-nonjedec" SPI device IDs for M25Pxx flashes, so that the kernel
still supports non-JEDEC flashes.

[1] http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=5975

Reported-by: Mingquan Pan
Reported-by: Barry Song <21cnbao@gmail.com>
Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 07:40:02 -06:00
Martin Michlmayr
d72cec8ffa mtd: m25p80: Add support for Macronix 25L8005
Add support for Macronix 25L8005.  Tested on a HP t5325 Thin Client.

Signed-off-by: Martin Michlmayr <tbm@cyrius.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 07:39:51 -06:00
Simon Guinot
9a6435701e mtd: m25p80: add support for Macronix MX25L4005A
Signed-off-by: Simon Guinot <sguinot@lacie.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 07:39:04 -06:00
Anton Vorontsov
9c61c303b4 mtd: m25p80: Add support for CAT25xxx serial EEPROMs
CAT25 chips (as manufactured by On Semiconductor, previously Catalyst
Semiconductor) are similar to the original M25Px0 chips, except:

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

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

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

[dwmw2: Fix up for conflicts with DMA safety patch]
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 07:38:33 -06:00
Anton Vorontsov
3fad5c3524 mtd: m25p80: Rework probing/JEDEC code
Previosly the driver always tried JEDEC probing, assuming that non-JEDEC
chips will return '0'. But truly non-JEDEC chips (like CAT25) won't do
that, their behaviour on RDID command is undefined, so the driver should
not call jedec_probe() for these chips.

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

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 07:34:13 -06:00
Anton Vorontsov
98f730476e mtd: m25p80: Convert to device table matching
This patch converts the m25p80 driver so that now it uses .id_table
for device matching, making it properly detect devices on OpenFirmware
platforms (prior to this patch the driver misdetected non-JEDEC chips,
seeing all chips as "m25p80").

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

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 07:33:16 -06:00
Anton Vorontsov
38962b9aff spi: prefix modalias with "spi:"
This makes it consistent with other buses (platform, i2c, vio, ...).  I'm
not sure why we use the prefixes, but there must be a reason.

This was easy enough to do it, and I did it.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: Samuel Ortiz <sameo@openedhand.com>
Cc: "John W. Linville" <linville@tuxdriver.com>
Acked-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-12-03 05:36:50 -06:00
Dan Carpenter
edcadf3e0d mtd/m25p80: retlen is never NULL
This is just a cleanup, it doesn't fix any bugs.

These functions all check retlen inconsistently and it generates a
warning in Smatch (http://smatch.sf.net).  If retlen were ever NULL it
would cause an oops and the code has been this way since 2006 so someone
would have complained.  Also I looked at other places that implemented
the mtd read and write functions and they dereference retlen without
checking.

I removed the checks.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 02:04:34 -06:00
Johannes Stezenbach
5e285654a7 mtd: m25p80: make command buffer DMA-safe
spi_write() requires the buffer to be DMA-safe, kmalloc()
it seperately to ensure this.

Signed-off-by: Johannes Stezenbach <js@sig21.net>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 02:04:17 -06:00
Graf Yang
90a29e881d mtd: m25p80: disable SST software protection bits by default
The SST SPI flashes is like Atmel SPI flashes in that the software
protection bits are set by default at power up, so clear them at init
time.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 02:04:09 -06:00
Peter Huewe
22ef197963 trivial: mtd: add __init/__exit macros to init/exitfunctions
Trivial patch which adds the __init and __exit macros to the module_init /
module_exit functions to the following modules from drivers/mtd/
 devices/m25p80.c
 devices/slram.c
 linux version 2.6.30
 ftl.c
 nand/cafe_nand.c
 nand/cmx270_nand.c

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-12-03 02:04:01 -06:00
Kevin Cernekee
13ee5760e4 m25p80: Add Spansion S25FL129P serial flashes
Tested 64KiB block size only.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 02:03:51 -06:00
Graf Yang
c1382d626d mtd: m25p80: add SST WF SPI flash device information
Support SST25WF{512,010,020,040} SPI flashes.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 02:03:40 -06:00
Graf Yang
d7a39f6f5a mtd: m25p80: add support for AAI programming with SST SPI flashes
The SST SPI flashes are a bit non-standard in that they can be programmed
one byte at a time (including address!), or they can be written two bytes
at a time with auto address incrementing (AAI).  The latter form is
obviously much better for performance, so let's use it when possible.

Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 02:03:23 -06:00
Siddarth Gore
8243088dca mtd: m25p80: add support for 3 Macronix flash chips
Signed-off-by: Siddarth Gore <gores@marvell.com>
Signed-off-by: Nicolas Pitre <nico@marvell.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 02:03:16 -06:00
Lily Zhang
3a8994f9c7 ENGR00124795 SPI NOR: uniform include header file
The default partitions are missing in MX53 SPI NOR MTD.
It's because spi nor driver and mx53 msl include different
header files. It causes struct definitions are different.
For i.MX SPI nor driver, need to use asm/mach/flash.h by
aligning with NAND driver.

Signed-off-by: Lily Zhang <r58066@freescale.com>
2010-08-10 11:51:19 -05:00
Peter Chen
b2e4d44bb5 ENGR00124477 MXC-Nand: Add disable BI swap entry at sys filesystem
In that case, the user can choose not to swap BI
if necessary, such as programming the bootloader.

Signed-off-by: Peter Chen <b29397@freescale.com>
2010-08-10 11:51:07 -05:00
Patrick Turley
b422b1ca4e ENGR00123828 Improved timing for the i.MX23/i.MX28 NAND Flash driver
Added improved timing calculations to the driver, and various other
support work.

Signed-off-by: Patrick Turley <patrick.turley@freescale.com>
2010-08-10 11:50:42 -05:00
Frank Li
f508044cbb ENGR00123436 Clear GPMI LOCK_CS to lower suspend current.
GPMI LOCK_CS set to low can lower suspend current about 5mA.

Signed-off-by: Frank Li <Frank.Li@freescale.com>
Signed-off-by: Turley Patrick <b18601@freescale.com>
2010-08-10 11:50:34 -05:00
Jason Liu
963774c857 ENGR00123170 Preserve NAND bad block indication
Preserve bad block indication of NAND

Signed-off-by:Jason Liu <r64343@freescale.com>
2010-08-10 11:50:07 -05:00
Jason Liu
f470223cff ENGR00123134-2 MX53 NAND driver support
MX53 NAND driver support

Signed-off-by:Jason Liu <r64343@freescale.com>
2010-08-10 11:50:02 -05:00
Jason Liu
a6a9ff450b ENGR00123131 NAND:Get resources from platform data
Get resources from platform data

Signed-off-by:Jason Liu <r64343@freescale.com>
2010-08-10 11:50:01 -05:00
Patrick Turley
0b7e7c7578 ENGR00122964 Second pass at unified i.MX23/i.MX28 NAND Flash driver
Deleted the old drivers.

Broke the driver into separate files, for readability and to isolate
hardware dependencies.

Fixed bad block problems in the boot area for the i.MX23.

At this writing, UBI can't handle MTDs larger than 2GiB. If the
general use partition is larger than 2GiB, the driver will create
sub-partitions, none of which are larger than 2GiB.

Updated the default configs for the i.MX23 and i.MX28.

Other, miscellaneous changes.

Signed-off-by: Patrick Turley <patrick.turley@freescale.com>
2010-08-10 11:49:55 -05:00
Patrick Turley
fcb50ee09c ENGR00122629 Unified i.MX23/i.MX28 NAND Flash Driver
This driver unifies the i.MX23 and i.MX28 NAND Flash drivers into a single
driver that supports both SoC's.

Signed-off-by: Patrick Turley <patrick.turley@freescale.com>
2010-08-10 11:49:42 -05:00
Patrick Turley
95510f65cd ENGR00122062 Interim i.MX28 NAND Flash driver change to support booting
Changed the driver to detect ECC-based writes to the boot area and write a
byte to the OOB that matches the ROM behavior.

Signed-off-by: Patrick Turley <patrick.turley@freescale.com>
2010-08-10 11:48:48 -05:00
Patrick Turley
1331736c27 ENGR00122007 Kernel panic caused by i.MX28 GPMI NAND Flash driver
Fixed the driver to properly initialize a variable.

Signed-off-by: Patrick Turley <patrick.turley@freescale.com>
2010-08-10 11:48:46 -05:00
Patrick Turley
959817f7e3 ENGR00121689 i.MX28 GPMI driver doesn't compile correctly under some conditions
Changed the driver to ignore CONFIG_MTD_CONCAT, and work correctly with
CONFIG_MTD_PARTITIONS. Also turned on the GPMI driver and UBIFS in the
default config.

Signed-off-by: Patrick Turley <patrick.turley@freescale.com>
2010-08-10 11:48:29 -05:00
Patrick Turley
406d9075cd ENGR00117735-2 MX28: SLC/MLC NAND
Port the i.MX23 NAND Flash driver to i.MX28.

Signed-off-by: Patrick Turley <patrick.turley@freescale.com>
2010-08-10 11:48:13 -05:00
Jason
b4566a78e2 ENGR00120405 MX23 BCH:output debug information via pr_debug function
Output debug information via pr_debug function

Signed-off-by:Jason Liu <r64343@freescale.com>
2010-08-10 11:46:37 -05:00
Jason
160dee8d80 ENGR00119693 Uniform handling NFC INT bit clearance
Uniform handling NFC INT bit clearance, the INT bit
will be unformed cleared in the wait_op_done function
after any NFC operation.

Signed-off-by:Jason Liu <r64343@freescale.com>
2010-08-10 11:46:29 -05:00
Jason
66ff713019 ENGR00119484 Update NFC INT wait timeout value to 1s
Update NFC INT wait timeout value to 1s.
1s should be enough for all platforms.
If INT bit not set for 1s timeout value, this
should be high potential of IC issues.

Signed-off-by:Jason Liu <r64343@freescale.com>
2010-08-10 11:46:23 -05:00
Patrick Turley
bde9c04a2a ENGR00119443 [MX23_BSP] GPMI driver computes wrong block size for K9GAG08U0D
Improved the GPMI driver's use of information from the device identification
database.

Signed-off-by: Patrick Turley <patrick.turley@freescale.com>
2010-08-10 11:46:18 -05:00
Jason
e4bb87cf4a ENGR00119324 Put GPMI NAND flash scan scheme code to the common NAND directory
1.GPMI NAND flash scan scheme can overcome the shortcomings
  of MTD NAND community code.

2.Put it to the common NAND directory can benifit I.MX NAND
  driver besides GPMI NAND driver.

3.Fix the section mismatch build warnings on ALL platforms.

4.Fix the kbuild build errors of I.MX platforms.

Signed-off-by:Jason Liu <r64343@freescale.com>
2010-08-10 11:46:16 -05:00
Jason
53e0dab7b7 ENGR00119242 Add wait timeout support to void dead loop in NAND driver
1. Add wait timeout support to void dead loop in NAND driver,
2. Try best to use IRQ mode instead of POLLING mode

Signed-off-by:Jason Liu <r64343@freescale.com>
2010-08-10 11:46:12 -05:00
Jason
2cf6c691b9 ENGR00118872 Write bootstream to kernel by kobs with BCH ECC
Write bootstream to kernel by kobs with BCH ECC.
Using the same combined Metadata & Block 0 BCH layout
with ROM code.

Page size 2048B; spare area  64B => ECC8,  N=3, B0=512B, M=10B
Page size 4096B; spare area 128B => ECC8,  N=7, B0=512B, M=10B
Page size 4096B; spare area 218B => ECC16, N=7, B0=512B, M=10B

Signed-off-by:Jason Liu <r64343@freescale.com>
2010-08-10 11:46:09 -05:00
Jason
86fde4a0b4 ENGR00118830 Update NAND driver scan scheme to support new nand type
Update NAND scan scheme to support new nand type. With this patch
Linux NAND driver can support new NAND flash on mx25/mx35 board while
compatible with old NAND on old boards.

Signed-off-by: Jason Liu <r64343@freescale.com>
2010-08-10 11:46:07 -05:00
Lily Zhang
97e1b336f2 ENGR00119023-2 Fix build error in SPI NOR driver
1. Add SPI NOR flash driver in Makefile
2. Fix build error with gcc 4.3.3 toolchain

Signed-off-by: Lily Zhang <r58066@freescale.com>
2010-08-10 11:46:04 -05:00
Frank.Li
2e21083d70 ENGR00118544 iMX23 Clear dangerous macro stmp3xxx_setl(clearl)
No all regiser use _SCT. stmp3xxx_setl may write to wrong address.
please use __raw_write (value, REG_XXX_SET) to write date to SCT
register.  Only REG_XXX_SCT is defined when it exist at hardware.

Signed-off-by: Frank.Li <Frank.Li@freescale.com>
2010-08-10 11:45:57 -05:00
Patrick Turley
32656e1ec6 ENGR00115003 [mx233_BSP] Cannot run fdisk on FTL over an UBI volume.
Added FTL support for UBI.

Signed-off-by: Patrick Turley <patrick.turley@freescale.com>
2010-08-10 11:45:53 -05:00
Jason
5ebb0f1b19 ENGR00118706 Update NAND suspend-resume driver mechanism on 2.6.31 kernel
Suspend then resume, kernel will print one warning message.
This is due to mtd suspend/resume framework change on 2.6.31 kernel.
Please refer to the follwing commit for detailed information
commit 15bce40cb3
[MTD] Restore suspend/resume support for mtd devices

Signed-off-by: Jason Liu <r64343@freescale.com>
2010-08-10 11:45:45 -05:00
Jason
b619854611 ENGR00115039 iMX233 NAND MTD Support BCH
iMX233 NAND MTD Support BCH

Signed-off-by:Jason Liu <r64343@freescale.com>
2010-08-10 11:45:38 -05:00