Commit graph

156 commits

Author SHA1 Message Date
Gabor Juhos 58d864ed20 mtd: m25p80: add support for the EON EN25Q64 chip
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-09-29 15:12:56 +01:00
Jan Luebbe 3105875f6b mtd: m25p80: add support for Micron N25Q128
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-09-29 15:12:53 +01:00
Vivien Didelot 8da28681eb mtd: m25p80: add support for Micron N25Q256A
The manufacturer datasheet can be found on the Micron website,
under the name n25q_256mb_3v_65nm.pdf:

http://www.micron.com/search?source=ps&q=n25q_256mb_3v_65nm

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-09-29 15:00:28 +01:00
Marek Vasut 8bb8b85f67 mtd: m25p80: Fix the Spansion chip detection
Due to the implementation of the following loop at the end
of jedec_probe():

776         for (tmp = 0; tmp < ARRAY_SIZE(m25p_ids) - 1; tmp++) {
777                 info = (void *)m25p_ids[tmp].driver_data;
778                 if (info->jedec_id == jedec) {
779                         if (info->ext_id != 0 && info->ext_id != ext_jedec)
780                                 continue;
781                         return &m25p_ids[tmp];
782                 }
783         }

In particular line 779 in the above numbering, the chips with ext_id != 0 must
be ordered first in the list of chips (m25p_ids[]).

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-09-29 14:50:22 +01:00
Marek Vasut f728598f8d mtd: m25p80: add support for Spansion s25sl064p chip
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-09-29 14:50:09 +01:00
Knut Wohlrab 4800399e33 mtd: m25p80: Add support for serial flash STM/Micron N25Q032
Signed-off-by: Knut Wohlrab <knut.wohlrab@de.bosch.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-07-17 14:49:55 +01:00
Chunhe Lan a5b2d76d72 mtd: m25p80: Add support for Atmel at45db081d
Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-07-06 18:17:07 +01:00
Alexandre Pereira da Silva 95c1b0ce2a mtd: m25p80: Add support for n25q064
Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-07-06 18:17:07 +01:00
Alexandre Pereira da Silva 943b35a6da mtd: m25p80: Add support for m25pe20
Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-07-06 18:17:06 +01:00
ing. Federico Fuga 9d6367f4f7 mtd: add JEDEC ID for w25q32dw to chip table
Adds JEDEC ID for the 1.8V version of WinBond w25q32.

Signed-off-by: Federico Fuga <fuga@studiofuga.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-07-06 18:17:05 +01:00
Thomas Abraham 4fba37aec7 mtd: m25p80: Add support for Winbond W25Q80BW
Winbond W25Q80BW is a 8Mbit serial flash memory device.

Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-05-13 23:24:26 -05:00
John Crispin bb08bc1086 mtd: add m25p80 id for mx25l2005a
Add the id and sector mappings for mx25l2005a flash chips.

Signed-off-by: John Crispin <blogic@openwrt.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-05-13 23:15:57 -05:00
Marek Vasut 5ca11ca7ad mtd: m25p80: add support for Everspin MR25H256 MRAM chip
This chip isn't JEDEC-compatible.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-05-13 23:15:48 -05:00
Artem Bityutskiy bcb1d23871 mtd: move zero length verification to MTD API functions
In many places in drivers we verify for the zero length, but this is very
inconsistent across drivers. This is obviously the right thing to do, though.
This patch moves the check to the MTD API functions instead and removes a lot
of duplication.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Reviewed-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-03-27 00:32:19 +01:00
Artem Bityutskiy 834247ec7e mtd: remove retlen zeroing duplication
The MTD API function now zero the 'retlen' parameter before calling
the driver's method — do not do this again in drivers. This removes
duplicated '*retlen = 0' assignent from the following methods:

    'mtd_point()'
    'mtd_read()'
    'mtd_write()'
    'mtd_writev()'
    'mtd_panic_write()'

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-03-27 00:29:34 +01:00
Artem Bityutskiy 5def48982b mtd: do not duplicate length and offset checks in drivers
We already verify that offset and length are within the MTD device size
in the MTD API functions. Let's remove the duplicated checks in drivers.
This patch only affects the following API's:

'mtd_erase()'
'mtd_point()'
'mtd_unpoint()'
'mtd_get_unmapped_area()'
'mtd_read()'
'mtd_write()'
'mtd_panic_write()'
'mtd_lock()'
'mtd_unlock()'
'mtd_is_locked()'
'mtd_block_isbad()'
'mtd_block_markbad()'

This patch adds a bit of noise by removing too sparse empty lines, but this is
not too bad.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-03-27 00:28:18 +01:00
Brian Norris b54f47c8bc mtd: m25p80: set writebufsize
Using UBI on m25p80 can give messages like:

    UBI error: io_init: bad write buffer size 0 for 1 min. I/O unit

We need to initialize writebufsize; I think "page_size" is the correct
"bufsize", although I'm not sure. Comments?

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Cc: stable@kernel.org [2.6.38+]
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-03-27 00:20:23 +01:00
Artem Bityutskiy 3c3c10bba1 mtd: add leading underscore to all mtd functions
This patch renames all MTD functions by adding a "_" prefix:

mtd->erase -> mtd->_erase
mtd->read_oob -> mtd->_read_oob
...

The reason is that we are re-working the MTD API and from now on it is
an error to use MTD function pointers directly - we have a corresponding
API call for every pointer. By adding a leading "_" we achieve the following:

1. Make sure we convert every direct pointer users
2. A leading "_" suggests that this interface is internal and it becomes
   less likely that people will use them directly
3. Make sure all the out-of-tree modules stop compiling and the owners
   spot the big API change and amend them.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-03-27 00:20:01 +01:00
Axel Lin c9d1b75293 mtd: convert drivers/mtd/* to use module_spi_driver()
This patch converts the drivers in drivers/mtd/* to use the
module_spi_driver() macro which makes the code smaller and a bit simpler.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-03-27 00:16:18 +01:00
Lars-Peter Clausen 5d3667eee4 mtd: Remove redundant spi driver bus initialization
In ancient times it was necessary to manually initialize the bus field of an
spi_driver to spi_bus_type. These days this is done in spi_driver_register(),
so we can drop the manual assignment.

The patch was generated using the following coccinelle semantic patch:
// <smpl>
@@
identifier _driver;
@@
struct spi_driver _driver = {
	.driver = {
-		.bus = &spi_bus_type,
	},
};
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2012-01-09 18:07:31 +00:00
Shaohui Xie 5f94913795 mtd: m25p80: don't probe device which has status of 'disabled'
On some platforms such as P3060QDS, has multiple spi flashes, but they are
not available at same time, so if their status is 'disabled', which is set
by u-boot, will not be probed.

Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2011-10-16 14:51:04 +03:00
Shaohui Xie 86a9893d08 mtd: m25p80: add EON flash EN25Q32B into spi flash id table
Add support for EON spi flash EN25Q32B, which is not listed in id table,
need to add it in the id table to support the EON flash.

Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-10-14 11:36:48 +03:00
Mikhail Kshevetskiy ada766e959 mtd: m25p80: add support for at25df321a spi data flash
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-26 10:05:25 +03:00
Brian Norris 0a32a10264 mtd: cleanup style on pr_debug messages
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11 15:02:16 +03:00
Brian Norris 289c052221 mtd: replace DEBUG() with pr_debug()
Start moving away from the MTD_DEBUG_LEVEL messages. The dynamic
debugging feature is a generic kernel feature that provides more
flexibility.

(See Documentation/dynamic-debug-howto.txt)

Also fix some punctuation, indentation, and capitalization that went
along with the affected lines.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
2011-09-11 15:02:16 +03:00
Dmitry Eremin-Solenikov 871770b5c8 mtd: m25p80.c: use mtd_device_parse_register
Replace custom invocations of parse_mtd_partitions and mtd_device_register
with common mtd_device_parse_register call. This would bring: standard
handling of all errors, fallback to default partitions, etc.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
2011-09-11 15:02:12 +03:00
Dmitry Eremin-Solenikov ea6a472986 mtd: m25p80: use ofpart through generic parsing
Convert the driver to use ofpart partitions parsing through the generic
parse_mtd_partitions().

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
2011-09-11 15:02:11 +03:00
Dmitry Eremin-Solenikov 4d1220f6fa mtd: m25p80 don't specify default parsing options
Since 'cmdline, NULL' is now a default for parse_mtd_partitions, don't specify
this in every driver, instead pass NULL to force parse_mtd_partitions
to use default.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2011-09-11 15:01:58 +03:00
Jamie Iles ba52f3a253 mtd: m25p80: convert to mtd_device_register()
Convert to mtd_device_register() and remove the CONFIG_MTD_PARTITIONS
preprocessor conditionals as partitioning is always available.

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2011-05-25 02:21:24 +01:00
Kevin Cernekee 3d2d2b657f mtd: m25p80: Add Spansion S25FL512S, S70FL01GS
S25FL512S = 64MiB single die, same family as S25FL256S
S70FL01GS = 2x S25FL512S dies in one package (separate chip selects)

These devices are not sampling yet, but they are expected to be very
similar to S25FL256S, which has been tested.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2011-05-25 02:02:41 +01:00
Kevin Cernekee baa9ae3cfd mtd: m25p80: Add Spansion S25FL256S
These are 32MiB parts which use a slightly different 4-byte enable
sequence from Macronix.

Default to the Spansion 4-byte scheme in set_4byte(), as it is more
likely to be copied by other vendors.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2011-05-25 02:02:34 +01:00
Kevin Cernekee aa0846534b mtd: m25p80: Clean up JEDEC manufacturer checks
Use the manufacturer ID names from cfi.h instead of hard-coding
hex constants.  Introduce a JEDEC_MFR macro for clarity.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2011-05-25 02:02:30 +01:00
Kevin Cernekee 16004f3685 mtd: m25p80: Add Numonyx m25px32 family
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2011-05-25 02:02:20 +01:00
Gabor Juhos 9c76b4e531 mtd: m25p80: add support for the MX25L1606E chip
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>
2011-05-25 01:47:46 +01:00
Yoshihiro Shimoda d8f90b2c9d mtd: m25p80: add support for M25PX64
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2011-03-11 14:22:45 +00:00
Gabor Juhos 37a23c2018 mtd: m25p80: add support for the EON EN25F32 chip
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2011-03-11 14:22:42 +00:00
Aleksandr Koltsoff 8fffed8cfd mtd: m25p80: Fix JEDEC ID for AT26DF321
The last byte of the ID should be zero for this chip. Was added in
commit d0e8c47c58 . Reported by Tomi
Varjo.

Signed-off-by: Aleksandr Koltsoff <aleksandr.koltsoff@ebts.fi>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2011-01-06 15:34:02 +00:00
Nicolas Ferre dcf12463c3 mtd: m25p80: add debugging trace in sst_write
Add a DEBUG(MTD_DEBUG_LEVEL2, ..) trace at beginning of sst_write() function as
it is done in m25p80_write() function.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2011-01-06 15:28:06 +00:00
Kevin Cernekee ac622f583d mtd: m25p80: Add support for Macronix MX25L25655E
Untested, but expected to be compatible with MX25L25635E which I did
test.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 16:26:58 +00:00
Kevin Cernekee 4b7f7422b0 mtd: m25p80: Add support for Macronix MX25L25635E
This is a 256Mbit (32MiB) part so minor changes were made to support
4-byte addressing.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 16:26:55 +00:00
Kevin Cernekee f0dff9bd00 mtd: m25p80: Reinstate error print on unrecognized flash
Commit b34bc037b2 removed the
"unrecognized JEDEC id" error message, causing the probe function to
silently abort if the flash ID is unrecognized.

It is desirable to produce diagnostic output in this situation so that
the user has some idea what went wrong.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-12-03 16:26:08 +00:00
Andres Salomon 40847437f1 mtd: fix build error in m25p80.c
While building an x86 distro kernel, I hit the following:

Kernel: arch/x86/boot/bzImage is ready  (#7)
ERROR: "of_mtd_parse_partitions" [drivers/mtd/devices/m25p80.ko]
undefined!

of_mtd_parse_partitions is defined with MTD_OF_PARTS, and that's only
built on PPC and microblaze.  The code in question should be wrapped w/
a stricter #ifdef.

Signed-off-by: Andres Salomon <dilinger@queued.net>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-10-30 12:46:08 +01:00
David Woodhouse 67577927e8 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Conflicts:
	drivers/mtd/mtd_blkdevs.c

Merge Grant's device-tree bits so that we can apply the subsequent fixes.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-10-30 12:35:11 +01:00
David Jander d86fbdb8ed 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-10-25 00:55:13 +01:00
Thierry Reding d2ac467a10 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-10-25 00:13:45 +01:00
Gernot Hoyler f2df1ae3fe 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-10-24 23:49:10 +01:00
Mingkai Hu 97ff46cb69 mtd/m25p80: add support to parse the partitions by OF node
Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
[grant.likely@secretlab.ca: wrap hunk with #ifdef CONFIG_OF]
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-10-22 01:37:16 -06:00
Dan Carpenter f78ec6b2f3 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-08-12 12:31:39 +01:00
Dan Carpenter b06cd21e2f 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-08-12 12:26:22 +01:00
Gabor Juhos 0af18d27c3 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-08-06 10:16:23 +01:00
Gabor Juhos f80e521c91 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-08-06 10:16:16 +01:00
Gabor Juhos 60845e7272 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-08-06 10:15:43 +01:00
Anton Vorontsov 9d2c4f3fe5 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-08-04 10:58:24 +01:00
Anton Vorontsov f7b000904a mtd: m25p80: Fix false-positive probing
Since commit 18c6182bae ("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-08-04 10:57:47 +01:00
Martin Michlmayr 6175f4a194 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-08-02 09:01:54 +01:00
Tejun Heo 5a0e3ad6af include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

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

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

The script does the followings.

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

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

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

The conversion was done in the following steps.

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-30 22:02:32 +09:00
Linus Torvalds 60d9aa758c Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (90 commits)
  jffs2: Fix long-standing bug with symlink garbage collection.
  mtd: OneNAND: Fix test of unsigned in onenand_otp_walk()
  mtd: cfi_cmdset_0002, fix lock imbalance
  Revert "mtd: move mxcnd_remove to .exit.text"
  mtd: m25p80: add support for Macronix MX25L4005A
  kmsg_dump: fix build for CONFIG_PRINTK=n
  mtd: nandsim: add support for 4KiB pages
  mtd: mtdoops: refactor as a kmsg_dumper
  mtd: mtdoops: make record size configurable
  mtd: mtdoops: limit the maximum mtd partition size
  mtd: mtdoops: keep track of used/unused pages in an array
  mtd: mtdoops: several minor cleanups
  core: Add kernel message dumper to call on oopses and panics
  mtd: add ARM pismo support
  mtd: pxa3xx_nand: Fix PIO data transfer
  mtd: nand: fix multi-chip suspend problem
  mtd: add support for switching old SST chips into QRY mode
  mtd: fix M29W800D dev_id and uaddr
  mtd: don't use PF_MEMALLOC
  mtd: Add bad block table overrides to Davinci NAND driver
  ...

Fixed up conflicts (mostly trivial) in
	drivers/mtd/devices/m25p80.c
	drivers/mtd/maps/pcmciamtd.c
	drivers/mtd/nand/pxa3xx_nand.c
	kernel/printk.c
2009-12-16 10:23:43 -08:00
Simon Guinot df0094d7f4 mtd: m25p80: add support for Macronix MX25L4005A
Signed-off-by: Simon Guinot <sguinot@lacie.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-12-05 16:05:09 +00:00
Anton Vorontsov 837479d25e 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>
2009-11-30 11:29:00 +00:00
Anton Vorontsov 18c6182bae 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>
2009-11-30 11:26:15 +00:00
Anton Vorontsov b34bc037b2 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>
2009-11-30 11:26:08 +00:00
Johannes Stezenbach 61c3506c2c 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>
2009-11-30 09:49:52 +00:00
Alexey Dobriyan d43c36dc6b headers: remove sched.h from interrupt.h
After m68k's task_thread_info() doesn't refer to current,
it's possible to remove sched.h from interrupt.h and not break m68k!
Many thanks to Heiko Carstens for allowing this.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
2009-10-11 11:20:58 -07:00
Graf Yang ea60658a08 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>
2009-09-24 12:52:29 -07:00
Linus Torvalds a7c367b95a Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (58 commits)
  mtd: jedec_probe: add PSD4256G6V id
  mtd: OneNand support for Nomadik 8815 SoC (on NHK8815 board)
  mtd: nand: driver for Nomadik 8815 SoC (on NHK8815 board)
  m25p80: Add Spansion S25FL129P serial flashes
  jffs2: Use SLAB_HWCACHE_ALIGN for jffs2_raw_{dirent,inode} slabs
  mtd: sh_flctl: register sh_flctl using platform_driver_probe()
  mtd: nand: txx9ndfmc: transfer 512 byte at a time if possible
  mtd: nand: fix tmio_nand ecc correction
  mtd: nand: add __nand_correct_data helper function
  mtd: cfi_cmdset_0002: add 0xFF intolerance for M29W128G
  mtd: inftl: fix fold chain block number
  mtd: jedec: fix compilation problem with I28F640C3B definition
  mtd: nand: fix ECC Correction bug for SMC ordering for NDFC driver
  mtd: ofpart: Check availability of reg property instead of name property
  driver/Makefile: Initialize "mtd" and "spi" before "net"
  mtd: omap: adding DMA mode support in nand prefetch/post-write
  mtd: omap: add support for nand prefetch-read and post-write
  mtd: add nand support for w90p910 (v2)
  mtd: maps: add mtd-ram support to physmap_of
  mtd: pxa3xx_nand: add single-bit error corrections reporting
  ...
2009-09-23 10:07:49 -07:00
Peter Huewe 627df23c61 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>
2009-09-21 15:14:53 +02:00
Kevin Cernekee 304e6d5fe2 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>
2009-09-19 16:24:47 -07:00
Graf Yang aa3651e462 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>
2009-09-19 13:10:32 -07:00
Graf Yang 49aac4aec5 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>
2009-09-19 13:10:16 -07:00
Siddarth Gore b0469ea785 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>
2009-09-04 09:40:27 +01:00
Anton Vorontsov edcb3b1486 mtd: m25p80: fix null pointer dereference bug
This patch fixes the following oops, observed with MTD_PARTITIONS=n:

m25p80 spi32766.0: m25p80 (1024 Kbytes)
Unable to handle kernel paging request for data at address 0x00000008
Faulting instruction address: 0xc03a54b0
Oops: Kernel access of bad area, sig: 11 [#1]
Modules linked in:
NIP: c03a54b0 LR: c03a5494 CTR: c01e98b8
REGS: ef82bb60 TRAP: 0300   Not tainted  (2.6.31-rc4-00167-g4733fd3)
MSR: 00029000 <EE,ME,CE>  CR: 24022022  XER: 20000000
DEAR: 00000008, ESR: 00000000
TASK = ef82c000[1] 'swapper' THREAD: ef82a000
GPR00: 00000000 ef82bc10 ef82c000 0000002e 00001eb8 ffffffff c01e9824 00000036
GPR08: c054ed40 c0542a08 00001eb8 00004000 22022022 1001a1a0 3ff8fd00 00000000
GPR16: 00000000 00000001 00000000 00000000 ef82bddc c0530000 efbef500 ef8356d0
GPR24: 00000000 ef8356d0 00000000 efbf7a00 c0530ec4 ffffffed efbf5300 c0541f98
NIP [c03a54b0] m25p_probe+0x22c/0x354
LR [c03a5494] m25p_probe+0x210/0x354
Call Trace:
[ef82bc10] [c03a5494] m25p_probe+0x210/0x354 (unreliable)
[ef82bca0] [c024e37c] spi_drv_probe+0x2c/0x3c
[ef82bcb0] [c01f1afc] driver_probe_device+0xa4/0x178
[ef82bcd0] [c01f06e8] bus_for_each_drv+0x6c/0xa8
[ef82bd00] [c01f1a34] device_attach+0x84/0xa8
...

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-09-03 13:58:02 +01:00
Steven A. Falco 89bb871e96 mtd: m25p80 timeout too short for worst-case m25p16 devices
The m25p16 data sheet from numonyx lists the worst-case bulk erase time
(tBE) as 40 seconds.

Signed-off-by: Steven A. Falco <sfalco@harris.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-06-26 18:15:21 +01:00
Lennert Buytenhek ab1ff210a8 mtd: m25p80: add support for Macronix MX25L12805D
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-06-05 18:10:28 +01:00
Matthieu CASTET 1e42d142e6 mtd: m25p80 nand: add m45pe10 ids
this patch add m45pe10 [1] chip support to the m25p80 driver.

[1] http://www.numonyx.com/Documents/Datasheets/M45PE10.pdf

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-06-05 17:48:30 +01:00
Peter Horton cd1a6de7d4 mtd: fix timeout in M25P80 driver
Extend erase timeout in M25P80 SPI Flash driver.

The M25P80 drivers fails erasing sectors on a M25P128 because the ready
wait timeout is too short. Change the timeout from a simple loop count to a
suitable number of seconds.

Signed-off-by: Peter Horton <zero@colonel-panic.org>
Tested-by: Martin Michlmayr <tbm@cyrius.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-05-08 13:51:53 +01:00
Steven A. Falco 3f33b0aaac mtd: Bug in m25p80.c during whole-chip erase
There is a logic error in "whole chip erase" for the m25p80 family.  If
the whole device is successfully erased, erase_chip() will return 0, and
the code will fall through to the "else" clause, and do sector-by-sector
erase in addition to the whole-chip erase.  This patch corrects that.

Also, the MAX_READY_WAIT_COUNT is insufficient for an m25p16 connected
to a 400 MHz powerpc.  Increasing it allows me to successfully program
the device on my board.

Signed-off-by: Steven A. Falco <sfalco@harris.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-04-29 06:49:28 +01:00
David Brownell 87f39f0493 [MTD] support driver model updates
Follow-on patch to the previous driver model patch for the MTD
framework.  This one makes various MTD drivers connect to the
driver model tree, so /sys/devices/virtual/mtd/* nodes are no
longer present ... mostly drivers used on boards I have handy.

Based on a patch from Kay Sievers.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-04-04 14:32:59 +01:00
David Brownell a4b6d516a6 [MTD] partitioning utility predicates
Move mtd_has_partitions() and mtd_has_cmdlinepart() inlines from a
DaVinci-specific driver to the <linux/mtd/partitions.h> header.

Use those to eliminate #ifdefs in two drivers which had their own
definitions of mtd_has_partitions().

Quite a lot of other MTD drivers could benefit from using use one or both
of these to remove #ifdeffery.  Maybe some Janitors would like to help.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-03-20 13:16:44 +00:00
Kay Sievers 160bbab300 [MTD] struct device - replace bus_id with dev_name(), dev_set_name()
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2008-12-23 10:00:14 +00:00
Artem Bityutskiy d85316ac45 [MTD] fix m25p80 64-bit divisions
MTD has recently been upgraded for 64-bit support, see commit
number 69423d99fc in the
mtd-2.6.git tree (git://git.infradead.org/mtd-2.6.git)
or see this URL:
http://git.infradead.org/mtd-2.6.git?a=commit;h=69423d99fc182a81f3c5db3eb5c140acc6fc64be

Some variables in MTD data structures which were 32-bit
became 64-bit. Namely, the 'size' field in 'struct mtd_info'
and the 'addr'/'len' fields in 'struct erase_info'. This
means we have to use 'do_div' to divide them.

This patch fixes the following linking error:
ERROR: "__umoddi3" [drivers/mtd/devices/m25p80.ko] undefined!

This patch changes divisions of 64-bit variable so that they use
'do_div'. This patch also change some print placeholders to
get rid of gcc warnings.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2008-12-19 16:23:35 +00:00
Chen Gong 7854643a91 [MTD] m25p80: chip erase != block erase != sector erase
This fixes broken terminology added in the "m25p80.c erase enhance" patch,
which added a chip erase command but called it "block erase".  There are
already two block erase commands; blocks are 4KiB or 32KiB.  There's also
a sector erase (usually 64 KiB).  Chip erase typically covers Megabytes.

  OPCODE_BE   ==> OPCODE_CHIP_ERASE
  erase_block ==> erase_chip

[dbrownell@users.sourceforge.net: update sector erase comments too ]

Signed-off-by: Chen Gong <clumsycg@gmail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2008-11-26 10:24:27 +00:00
Mike Frysinger 9168ab861a [MTD] m25p80: fix detection of m25p16 flashes
Commit d0e8c47c58 ("m25p80.c extended jedec
support") added support for extended ids but seems to break on flashes
which don't have an extended id defined.  If the table does not have an
extid defined, then we should ignore it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Michael Hennerich <Michael.Hennerich@analog.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2008-11-26 10:23:35 +00:00
Mike Frysinger a3d3f73ccb [MTD] m25p80: fix detection of SPI parts
Commit d0e8c47c58 ("m25p80.c extended jedec
support") added support for extended ids but in the process managed to
break detection of all flashes.

The ext jedec id check was inserted into an if statement that lacked
braces, and it did not add the required braces.  As such, the detection
routine always returns the first entry in the SPI flash list.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2008-11-26 10:23:25 +00:00
David Woodhouse 8a1a627205 Revert "[MTD] m25p80.c code cleanup"
This reverts commit 75d0ee2202.

Although it seems ObviouslyCorrectâ„¢, the spi_write() call uses DMA,
while spi_write_then_read() does not. Since our buffer is on the stack,
we must use the latter even though we don't actually want to read
anything back.

Pointed out by David Brownell <david-b@pacbell.net>

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2008-10-20 09:28:09 +01:00
Chen Gong daa847356a [MTD] m25p80.c extended jedec support (v2)
Include missing parts of previous patch.

Signed-off-by: Chen Gong <g.chen@freescale.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2008-10-14 10:59:43 +01:00
Chen Gong d0e8c47c58 [MTD] m25p80.c extended jedec support
- add extended device information support
- add s25sl128 device support

Signed-off-by: Chen Gong <g.chen@freescale.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2008-08-11 17:33:08 +01:00
Chen Gong 75d0ee2202 [MTD] m25p80.c code cleanup
code cleanup for m25p80.c

Signed-off-by: Chen Gong <g.chen@freescale.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2008-08-11 17:32:43 +01:00
Chen Gong faff37508a [MTD] m25p80.c erase enhance
This patch adds an erase_block command to enhance erase operation

Signed-off-by: Chen Gong <g.chen@freescale.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2008-08-11 17:32:35 +01:00
Michael Hennerich 7228982442 [MTD] m25p80: fix bug - ATmel spi flash fails to be copied to
Atmel serial flash tends to power up with the protection status bits set.
http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=4089

[michael.hennerich@analog.com: remove duplicate code]
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2008-07-11 14:44:32 +01:00
Chen Gong bc01886352 [MTD] m25p80.c mutex unlock fix
fix a mutex release bug in function m25p80_write.

Signed-off-by: Chen Gong <g.chen@freescale.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-06-06 10:36:21 +01:00
Michael Hennerich 3887ed5231 [MTD] m25p80: Add Support for ATMEL AT25DF641 64-Megabit SPI Flash
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-25 09:14:23 +01:00
Bryan Wu 2230b76b38 [MTD] m25p80: add FAST_READ access support to M25Pxx
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-25 09:13:52 +01:00
Harvey Harrison cb53b3b999 [MTD] replace remaining __FUNCTION__ occurrences
__FUNCTION__ is gcc-specific, use __func__

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 12:36:04 +01:00
David Woodhouse 02d087dbc8 [MTD] m25p80: Use correct units for binary multiples
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-06-28 22:38:38 +01:00
David Brownell fa0a8c71f3 [MTD] m25p80 handles more chips, uses JEDEC ids and small eraseblocks
Update chip ID tables in m25p80 to handle more SPI flash chips, matching
datasheets.  All of these can use the same core operations and are newer
chips that support the JEDEC "read id" instruction:

 - Atmel AT25 and AT26 (seven chips)
 - Spansion S25SL (five chips)
 - SST 25VF (four chips)
 - ST M25, M45 (five more chips)
 - Winbond W25X series (seven chips)

That JEDEC instruction is now used, either to support a sanity check on the
platform data holding board configuration data, or to determine chip type
when it's not included in platform data.  In fact, boards that don't need a
standard partition table may not need that platform data any more.

For chips that support 4KiB erase units, use that smaller block size instead
of the larger size (usually 64KiB); it's less wasteful.  (Tested on W25X80.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-06-28 22:37:36 +01:00
David Brownell 7d5230ea39 [MTD] m25p80 converted to mutex
Convert semaphore usage in m25p80 driver to mutex; mention another kind of
SPI flash chip that should be able to use this driver (given minor tweaks).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-06-28 22:34:32 +01:00
David Brownell 17c65d6990 [PATCH] m25p80 build fixes (with MTD debug)
Fix build issues that show up with the m25p80 SPI flash driver when
building with MTD debug enabled.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-30 10:56:42 -08:00
Christoph Lameter e94b176609 [PATCH] slab: remove SLAB_KERNEL
SLAB_KERNEL is an alias of GFP_KERNEL.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-07 08:39:24 -08:00
Aubrey Lee fa6c220a7f [PATCH] [MTD] DEVICES: Fill more device IDs in the structure of m25p80
The flash_info structure has a bunch of missing fields which causes problems
when actually tryin to use some ST parts as it gets detected incorrectly.

Signed-off-by: Aubrey L1 <aubreylee@gmail.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
2006-09-05 05:55:07 -05:00
Artem B. Bityutskiy 783ed81ff3 [MTD] assume mtd->writesize is 1 for NOR flashes
Signed-off-by: Artem B. Bityitskiy
2006-06-14 19:53:44 +04:00