aboutsummaryrefslogtreecommitdiff
path: root/include/linux/mtd/mtd.h
AgeCommit message (Collapse)AuthorFilesLines
2011-10-31include: replace linux/module.h with "struct module" wherever possiblePaul Gortmaker1-1/+2
The <linux/module.h> pretty much brings in the kitchen sink along with it, so it should be avoided wherever reasonably possible in terms of being included from other commonly used <linux/something.h> files, as it results in a measureable increase on compile times. The worst culprit was probably device.h since it is used everywhere. This file also had an implicit dependency/usage of mutex.h which was masked by module.h, and is also fixed here at the same time. There are over a dozen other headers that simply declare the struct instead of pulling in the whole file, so follow their lead and simply make it a few more. Most of the implicit dependencies on module.h being present by these headers pulling it in have been now weeded out, so we can finally make this change with hopefully minimal breakage. Signed-off-by: Paul Gortmaker <[email protected]>
2011-09-21mtd: define `mtd_is_*()' functionsBrian Norris1-0/+12
These functions can be used instead of referencing -EUCLEAN and -EBADMSG all over the place. They should help make code a little bit more readable. Signed-off-by: Brian Norris <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]>
2011-09-11mtd: document ABIBrian Norris1-1/+1
We're missing a lot of important documentation in include/mtd/mtd-abi.h: * add a simple description of each ioctl (feel free to expand!) * give full explanations of recently added and modified operations * explain the usage of "RAW" that appear in different modes and types of operations * fix some comment style along the way Signed-off-by: Brian Norris <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]>
2011-09-11mtd: rename MTD_OOB_* to MTD_OPS_*Brian Norris1-1/+1
These modes are not necessarily for OOB only. Particularly, MTD_OOB_RAW affected operations on in-band page data as well. To clarify these options and to emphasize that their effect is applied per-operation, we change the primary prefix to MTD_OPS_. Signed-off-by: Brian Norris <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]>
2011-09-11mtd: move mtd_oob_mode_t to shared kernel/user spaceBrian Norris1-15/+1
We will want to use the MTD_OOB_{PLACE,AUTO,RAW} modes in user-space applications through the introduction of new ioctls, so we should make this enum a shared type. This enum is now anonymous. Artem: tweaked the patch. Signed-off-by: Brian Norris <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]>
2011-09-11mtd: style fixups in multi-line comment, indentationBrian Norris1-7/+9
Signed-off-by: Brian Norris <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]>
2011-09-11mtd: remove CONFIG_MTD_DEBUGBrian Norris1-23/+0
Signed-off-by: Brian Norris <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]>
2011-09-11mtd: spelling, capitalization, uniformityBrian Norris1-1/+1
Therefor -> Therefore [Intern], [Internal] -> [INTERN] [REPLACABLE] -> [REPLACEABLE] syndrom, syndom -> syndrome ecc -> ECC buswith -> buswidth endianess -> endianness dont -> don't occures -> occurs independend -> independent wihin -> within erease -> erase blockes -> blocks ... Signed-off-by: Brian Norris <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]>
2011-09-11mtd: drop mtd_device_registerDmitry Eremin-Solenikov1-3/+2
mtd_device_register() is a limited version of mtd_device_parse_register. Replace it with macro calling mtd_device_parse_register(). Signed-off-by: Dmitry Eremin-Solenikov <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]>
2011-09-11mtd: abstract last MTD partition parser argumentDmitry Eremin-Solenikov1-1/+2
Encapsulate last MTD partition parser argument into a separate structure. Currently it holds only 'origin' field for RedBoot parser, but will be extended in future to contain at least device_node for OF devices. Amended commentary to make kerneldoc happy Signed-off-by: Dmitry Eremin-Solenikov <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]>
2011-09-11mtd: add new API for handling MTD registrationDmitry Eremin-Solenikov1-0/+5
Lots (nearly all) mtd drivers contain nearly the similar code that calls parse_mtd_partitions, provides some platform-default values, if parsing fails, and registers mtd device. This is an aim to provide single implementation of this scenario: mtd_device_parse_register() which will handle all this parsing and defaults. Artem: amended comments Signed-off-by: Dmitry Eremin-Solenikov <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]>
2011-05-25mtd: kill CONFIG_MTD_PARTITIONSJamie Iles1-8/+0
Now that none of the drivers use CONFIG_MTD_PARTITIONS we can remove it from Kconfig and the last remaining uses. Signed-off-by: Jamie Iles <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2011-05-25mtd: remove add_mtd_partitions, add_mtd_device and friendsJamie Iles1-3/+0
These symbols are replaced with mtd_device_register() (and removal with mtd_device_unregister()) for public registration. Signed-off-by: Jamie Iles <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2011-05-25mtd: introduce mtd_device_(un)register()Jamie Iles1-0/+6
To prepare for the removal of add_mtd_device and add_mtd_partitions(), introduce mtd_device_register(). This will create partitions if they are supplied or register the whole device if there are no partitions. Once all drivers are converted to use mtd_device_register(), add_mtd_device() and add_mtd_partitions() will be made internal only. v2: move kerneldoc to implementation file and fixup some kerneldoc warnings. Artem: tweak comments: remove junk tabs, use dots consistently. Signed-off-by: Jamie Iles <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2011-05-25mtd: create function to perform large allocationsGrant Erickson1-0/+2
Introduce a common function to handle large, contiguous kmalloc buffer allocations by exponentially backing off on the size of the requested kernel transfer buffer until it succeeds or until the requested transfer buffer size falls below the page size. This helps ensure the operation can succeed under low-memory, highly- fragmented situations albeit somewhat more slowly. Artem: so this patch solves the problem that the kernel tries to kmalloc too large buffers, which (a) may fail and does fail - people complain about this, and (b) slows down the system in case of high memory fragmentation, because the kernel starts dropping caches, writing back, swapping, etc. But we do not really have to allocate a lot of memory to do the I/O, we may do this even with as little as one min. I/O unit (NAND page) of RAM. So the idea of this patch is that if the user asks to read or write a lot, we try to kmalloc a lot, with GFP flags which make the kernel _not_ drop caches, etc. If we can allocate it - good, if not - we try to allocate twice as less, and so on, until we reach the min. I/O unit size, which is our last resort allocation and use the normal GFP_KERNEL flag. Artem: re-write the allocation function so that it makes sure the allocated buffer is aligned to the min. I/O size of the flash. Signed-off-by: Grant Erickson <[email protected]> Tested-by: Ben Gardiner <[email protected]> Tested-by: Stefano Babic <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2011-01-06mtd: add writebufsize field to mtd_info structAnatolij Gustschin1-0/+11
This field will be used to indicate the write buffer size of the MTD device. UBI will set it's minimal I/O unit size (min_io_size) to the indicated write buffer size. By this change we intend to fix failed recovery of UBIFS partitions we currently observe on NOR flash when mounting the partition after unclean unmount. Currently the min_io_size is set to mtd->writesize (which is 1 byte for NOR flash). But flash programming is often done from prepared write buffer containing multiple bytes and is performed in one programming operation which could be interrupted by a power cut or a system reset causing corrupted (partially written) areas in a flash sector. Knowing the size of potentially corrupted areas UBIFS scanning and recovery algorithms are able to perform successful recovery. In case of NOR flash minimal I/O size must be equal to the maximal size of the write buffer used by embedded flash programming algorithm. In case of NAND flash mtd->writebufsize should be equivalent to mtd->writesize. The subsequent patches will add mtd->writebufsize initialization where needed. Signed-off-by: Anatolij Gustschin <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2010-10-24mtd: edit comments on deprecation of ioctl ECCGETLAYOUTBrian Norris1-4/+4
There were some improvements and additions necessary in the comments explaining of the expansion of nand_ecclayout, the introduction of nand_ecclayout_user, and the deprecation of the ioctl ECCGETLAYOUT. Also, I found a better placement for the macro MTD_MAX_ECCPOS_ENTRIES; next to the definition of MTD_MAX_OOBFREE_ENTRIES in mtd-abi.h. The macro is really only important for the ioctl code (found in drivers/mtd/mtdchar.c) but since there are small edits being made to the user-space header, I figured this is a better location. Signed-off-by: Brian Norris <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2010-10-24mtd: nand: expand nand_ecc_layout, deprecate ioctl ECCGETLAYOUTBrian Norris1-0/+15
struct nand_ecclayout is too small for many new chips; OOB regions can be as large as 448 bytes and may increase more in the future. Thus, copying that struct to user-space with the ECCGETLAYOUT ioctl is not a good idea; the ioctl would have to be updated every time there's a change to the current largest size. Instead, the old nand_ecclayout is renamed to nand_ecclayout_user and a new struct nand_ecclayout is created that can accomodate larger sizes and expand without affecting the user-space. struct nand_ecclayout can still be used in board drivers without modification -- at least for now. A new function is provided to convert from the new to the old in order to allow the deprecated ioctl to continue to work with truncated data. Perhaps the ioctl, the conversion process, and the struct nand_ecclayout_user can be removed altogether in the future. Note: There are comments in nand/davinci_nand.c::nand_davinci_probe() regarding this issue; this driver (and maybe others) can be updated to account for extra space. All kernel drivers can use the expanded nand_ecclayout as a drop-in replacement and ignore its benefits. Signed-off-by: Brian Norris <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2010-08-08mtd: Remove obsolete <mtd/compatmac.h> includeDavid Woodhouse1-1/+0
Signed-off-by: David Woodhouse <[email protected]>
2010-08-08mtd: Update copyright noticesDavid Woodhouse1-2/+15
Signed-off-by: David Woodhouse <[email protected]>
2010-08-02mtd: add an ioctl to query the lock status of a flash sectorRichard Cochran1-0/+1
This patchs adds a way for user space programs to find out whether a flash sector is locked. An optional driver method in the mtd_info struct provides the information. Signed-off-by: Richard Cochran <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2010-02-26mtd: nand: make reads using MTD_OOB_RAW affect only ECC validationMaxim Levitsky1-3/+1
This changes the behavier of MTD_OOB_RAW. It used to read both OOB and data to the data buffer, however you would still need to specify the dummy oob buffer. This is only used in one place, but makes it hard to read data+oob without ECC test, thus I removed that behavier, and fixed the user. Now MTD_OOB_RAW behaves just like MTD_OOB_PLACE, but doesn't do ECC validation Signed-off-by: Maxim Levitsky <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2010-02-26mtd: create unlocked versions of {get,put}_mtd_deviceMaxim Levitsky1-1/+2
Use these only if you know that you already hold mtd_table_mutex Signed-off-by: Maxim Levitsky <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2010-02-25mtd: Replace static array of devices with an idr structureBen Hutchings1-1/+0
Signed-off-by: Ben Hutchings <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2009-08-03mtd: fix the conversion from dev to mtd_infoSaeed Bishara1-1/+1
The patch fixes a bug when converting dev to mtd_info by using the drvdata of the dev, the previous code used container_of(dev, struct mtd_info, dev), but won't work for the mtdXro devices as they created without being contained inside mtd_info structure. Signed-off-by: Saeed Bishara <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2009-04-04[MTD] driver model updatesDavid Brownell1-0/+7
Update driver model support in the MTD framework, so it fits better into the current udev-based hotplug framework: - Each mtd_info now has a device node. MTD drivers should set the dev.parent field to point to the physical device, before setting up partitions or otherwise declaring MTDs. - Those device nodes always map to /sys/class/mtdX device nodes, which no longer depend on MTD_CHARDEV. - Those mtdX sysfs nodes have a "starter set" of attributes; it's not yet sufficient to replace /proc/mtd. - Enabling MTD_CHARDEV provides /sys/class/mtdXro/ nodes and the /sys/class/mtd*/dev attributes (for udev, mdev, etc). - Include a MODULE_ALIAS_CHARDEV_MAJOR macro. It'll work with udev creating the /dev/mtd* nodes, not just a static rootfs. So the sysfs structure is pretty much what you'd expect, except that readonly chardev nodes are a bit quirky. Signed-off-by: David Brownell <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2009-03-24NOMMU: Present backing device capabilities for MTD chardevsDavid Howells1-0/+14
Present backing device capabilities for MTD character device files to allow NOMMU mmap to do direct mapping where possible. Signed-off-by: David Howells <[email protected]> Tested-by: Bernd Schmidt <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2009-01-09Merge git://git.infradead.org/mtd-2.6Linus Torvalds1-17/+58
* git://git.infradead.org/mtd-2.6: (67 commits) [MTD] [MAPS] Fix printk format warning in nettel.c [MTD] [NAND] add cmdline parsing (mtdparts=) support to cafe_nand [MTD] CFI: remove major/minor version check for command set 0x0002 [MTD] [NAND] ndfc driver [MTD] [TESTS] Fix some size_t printk format warnings [MTD] LPDDR Makefile and KConfig [MTD] LPDDR extended physmap driver to support LPDDR flash [MTD] LPDDR added new pfow_base parameter [MTD] LPDDR Command set driver [MTD] LPDDR PFOW definition [MTD] LPDDR QINFO records definitions [MTD] LPDDR qinfo probing. [MTD] [NAND] pxa3xx: convert from ns to clock ticks more accurately [MTD] [NAND] pxa3xx: fix non-page-aligned reads [MTD] [NAND] fix nandsim sched.h references [MTD] [NAND] alauda: use USB API functions rather than constants [MTD] struct device - replace bus_id with dev_name(), dev_set_name() [MTD] fix m25p80 64-bit divisions [MTD] fix dataflash 64-bit divisions [MTD] [NAND] Set the fsl elbc ECCM according the settings in bootloader. ... Fixed up trivial debug conflicts in drivers/mtd/devices/{m25p80.c,mtd_dataflash.c}
2009-01-06trivial: fix then -> than typos in comments and documentationFrederik Schwarzer1-1/+1
- (better, more, bigger ...) then -> (...) than Signed-off-by: Frederik Schwarzer <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
2008-12-10[MTD] Remove more strange u_intxx_t typesDavid Woodhouse1-13/+13
Signed-off-by: David Woodhouse <[email protected]>
2008-12-10[MTD] update internal API to support 64-bit device sizeAdrian Hunter1-8/+49
MTD internal API presently uses 32-bit values to represent device size. This patch updates them to 64-bits but leaves the external API unchanged. Extending the external API is a separate issue for several reasons. First, no one needs it at the moment. Secondly, whether the implementation is done with IOCTLs, sysfs or both is still debated. Thirdly external API changes require the internal API to be accepted first. Note that although the MTD API will be able to support 64-bit device sizes, existing drivers do not and are not required to do so, although NAND base has been updated. In general, changing from 32-bit to 64-bit values cause little or no changes to the majority of the code with the following exceptions: - printk message formats - division and modulus of 64-bit values - NAND base support - 32-bit local variables used by mtdpart and mtdconcat - naughtily assuming one structure maps to another in MEMERASE ioctl Signed-off-by: Adrian Hunter <[email protected]> Signed-off-by: Artem Bityutskiy <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2008-08-12[MTD] Define and use MTD_FAIL_ADDR_UNKNOWN instead of 0xffffffffAdrian Hunter1-1/+3
Signed-off-by: Adrian Hunter <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2008-07-30[MTD] MTD_DEBUG always does compile-time typechecksDavid Brownell1-1/+5
The current style for debug messages is to ensure they're always parsed by the compiler and then subjected to dead code removal. That way builds won't break only when debug options get enabled, which is common when they are stripped out early by CPP. This patch makes CONFIG_MTD_DEBUG adopt that convention. Signed-off-by: David Brownell <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2008-07-25Merge branch 'linux-next' of git://git.infradead.org/~dedekind/ubi-2.6David Woodhouse1-1/+1
2008-07-21MTD: handle pci_name() being constGreg Kroah-Hartman1-1/+1
This changes the MTD core to handle pci_name() now returning a constant string. Cc: David Woodhouse <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2008-06-04MTD/JFFS2: remove CVS keywordsAdrian Bunk1-2/+0
Once upon a time, the MTD repository was using CVS. This patch therefore removes all usages of the no longer updated CVS keywords from the MTD code. This also includes code that printed them to the user. Signed-off-by: Adrian Bunk <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2008-05-01[MTD][NOR] Add physical address to point() methodJared Hulbert1-2/+4
Adding the ability to get a physical address from point() in addition to virtual address. This physical address is required for XIP of userspace code from flash. Signed-off-by: Jared Hulbert <[email protected]> Reviewed-by: Jörn Engel <[email protected]> Acked-by: Nicolas Pitre <[email protected]> Acked-by: Greg Ungerer <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2008-02-07[MTD] Add mtd panic_write function pointerRichard Purdie1-0/+9
MTDs are well suited for logging critical data and the mtdoops driver allows kernel panics/oops to be written to flash in a blackbox flight recorder fashion allowing better debugging and analysis of crashes. Any kernel oops in user context can be easily handled since the kernel continues as normal and any queued mtd writes are scheduled. Any kernel oops in interrupt context results in a panic and the delayed writes will not be scheduled however. The existing mtd->write function cannot be called in interrupt context so these messages can never be written to flash. This patch adds a panic_write function pointer that drivers can optionally implement which can be called in interrupt context. It is only intended to be called when its known the kernel is about to panic and we need to write to succeed. Since the kernel is not going to be running for much longer, this function can break locks and delay to ensure the write succeeds (but not sleep). Signed-off-by: Richard Purdie <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2007-09-21[MTD] Document erase interface.Jörn Engel1-0/+7
Document mtd erase interface. Signed-off-by: Jörn Engel <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2007-05-09[MTD] Delete allegedly obsolete "bank_size" field of mtd_info.Robert P. J. Day1-3/+0
Delete the allegedly obsolete "bank_size" member of struct mtd_info. Signed-off-by: Robert P. J. Day <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2007-05-09[MTD] Remove unnecessary user space check from mtd.h.Robert P. J. Day1-4/+0
Since the header file include/linux/mtd/mtd.h is not exported to user space, remove the user space check and error. Signed-off-by: Robert P. J. Day <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2007-04-02[MTD] [NOR] Support for auto locking flash on power upRodolfo Giometti1-0/+1
Auto unlock sectors on resume for auto locking flash on power up. Signed-off-by: Rodolfo Giometti <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2007-03-08[MTD] [NAND] make oobavail publicVitaly Wool1-0/+1
During the MTD rework the oobavail parameter of mtd_info structure has become private. This is not quite correct in terms of integrity and logic. If we have means to write to OOB area, then we'd like to know upfront how many bytes out of OOB are spare per page to be able to adapt to specific cases. The patch inlined adds the public oobavail parameter. Signed-off-by: Vitaly Wool <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2007-02-09[MTD] Clarify OOB-operation interface commentsArtem Bityutskiy1-0/+4
Add more comment to OOB I/O interface. Read/write are not symmetric which is confusing and should be documented. Signed-off-by: Artem Bityutskiy <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2007-02-09[MTD] remove unused ecctype,eccsize fields from struct mtd_infoArtem Bityutskiy1-2/+0
Remove unused and broken mtd->ecctype and mtd->eccsize fields from struct mtd_info. Do not remove them from userspace API data structures (don't want to breake userspace) but mark them as obsolete by a comment. Any userspace program which uses them should be half-broken anyway, so this is more about saving data structure size. Signed-off-by: Artem Bityutskiy <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2007-02-09[MTD] [NOR] Intel: remove ugly PROGREGION macrosArtem Bityutskiy1-10/+0
Remove ugly and weird MTD_PROGREGION_CTRLMODE_VALID() and MTD_PROGREGION_CTRLMODE_INVALID() macros. There is only one user of them and they are used locally just for printing. Anyway, this patch is a preparation for removing mtd->ecctype and mtd->eccsize, but these macros use them. Fix this. Signed-off-by: Artem Bityutskiy <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
2006-11-29[MTD] add get and put methodsArtem Bityutskiy1-0/+7
This patch adds get_device() and put_device() methods to the MTD description structure (struct mtd_info). These methods are called by MTD whenever the MTD device is get or put. They are needed when the underlying driver is something smarter then just flash chip driver, for example UBI. Signed-off-by: Artem Bityutskiy <[email protected]>
2006-11-29[MTD] add get_mtd_device_nm() functionArtem Bityutskiy1-0/+1
This patch adds one more function to the MTD interface to make it possible to open MTD devices by their names, not only numbers. This is very handy in many situations. Also, MTD device number depend on load order and may vary, while names are fixed. Signed-off-by: Artem Bityutskiy <[email protected]>
2006-11-29[MTD] NAND: add subpage write supportThomas Gleixner1-0/+2
Many SLC NANDs support up to 4 writes at one NAND page. Add support of this feature. Signed-off-by: Artem Bityutskiy <[email protected]>
2006-11-29[MTD] increase MAX_MTD_DEVICESArtem Bityutskiy1-1/+1
Signed-off-by: Artem Bityutskiy <[email protected]>