aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mtd
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-02-23 14:02:19 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-02-23 14:02:19 -0500
commit99a85b901eb54f62ff0c3fd6eb56e60b7b9f15c8 (patch)
tree0c6637b7d2172e079c30e966847326767cbaf45c /include/linux/mtd
parent135f9be9194cf7778eb73594aa55791b229cf27c (diff)
parentc517d838eb7d07bbe9507871fab3931deccff539 (diff)
Merge tag 'v4.0-rc1' into patchwork
Linux 34.0-rc1 * tag 'v4.0-rc1': (8947 commits) Linux 4.0-rc1 autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation procfs: fix race between symlink removals and traversals debugfs: leave freeing a symlink body until inode eviction Documentation/filesystems/Locking: ->get_sb() is long gone trylock_super(): replacement for grab_super_passive() fanotify: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions Cachefiles: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions VFS: (Scripted) Convert S_ISLNK/DIR/REG(dentry->d_inode) to d_is_*(dentry) SELinux: Use d_is_positive() rather than testing dentry->d_inode Smack: Use d_is_positive() rather than testing dentry->d_inode TOMOYO: Use d_is_dir() rather than d_inode and S_ISDIR() Apparmor: Use d_is_positive/negative() rather than testing dentry->d_inode Apparmor: mediated_filesystem() should use dentry->d_sb not inode->i_sb VFS: Split DCACHE_FILE_TYPE into regular and special types VFS: Add a fallthrough flag for marking virtual dentries VFS: Add a whiteout dentry type VFS: Introduce inode-getting helpers for layered/unioned fs environments kernel: make READ_ONCE() valid on const arguments blk-throttle: check stats_cpu before reading it from sysfs ...
Diffstat (limited to 'include/linux/mtd')
-rw-r--r--include/linux/mtd/mtd.h3
-rw-r--r--include/linux/mtd/spi-nor.h7
-rw-r--r--include/linux/mtd/ubi.h53
3 files changed, 62 insertions, 1 deletions
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 031ff3a9a0bd..f17fa75809aa 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -227,6 +227,7 @@ struct mtd_info {
227 int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs); 227 int (*_block_markbad) (struct mtd_info *mtd, loff_t ofs);
228 int (*_suspend) (struct mtd_info *mtd); 228 int (*_suspend) (struct mtd_info *mtd);
229 void (*_resume) (struct mtd_info *mtd); 229 void (*_resume) (struct mtd_info *mtd);
230 void (*_reboot) (struct mtd_info *mtd);
230 /* 231 /*
231 * If the driver is something smart, like UBI, it may need to maintain 232 * If the driver is something smart, like UBI, it may need to maintain
232 * its own reference counting. The below functions are only for driver. 233 * its own reference counting. The below functions are only for driver.
@@ -408,4 +409,6 @@ static inline int mtd_is_bitflip_or_eccerr(int err) {
408 return mtd_is_bitflip(err) || mtd_is_eccerr(err); 409 return mtd_is_bitflip(err) || mtd_is_eccerr(err);
409} 410}
410 411
412unsigned mtd_mmap_capabilities(struct mtd_info *mtd);
413
411#endif /* __MTD_MTD_H__ */ 414#endif /* __MTD_MTD_H__ */
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 63aeccf9ddc8..4720b86ee73d 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -56,6 +56,10 @@
56/* Used for Spansion flashes only. */ 56/* Used for Spansion flashes only. */
57#define SPINOR_OP_BRWR 0x17 /* Bank register write */ 57#define SPINOR_OP_BRWR 0x17 /* Bank register write */
58 58
59/* Used for Micron flashes only. */
60#define SPINOR_OP_RD_EVCR 0x65 /* Read EVCR register */
61#define SPINOR_OP_WD_EVCR 0x61 /* Write EVCR register */
62
59/* Status Register bits. */ 63/* Status Register bits. */
60#define SR_WIP 1 /* Write in progress */ 64#define SR_WIP 1 /* Write in progress */
61#define SR_WEL 2 /* Write enable latch */ 65#define SR_WEL 2 /* Write enable latch */
@@ -67,6 +71,9 @@
67 71
68#define SR_QUAD_EN_MX 0x40 /* Macronix Quad I/O */ 72#define SR_QUAD_EN_MX 0x40 /* Macronix Quad I/O */
69 73
74/* Enhanced Volatile Configuration Register bits */
75#define EVCR_QUAD_EN_MICRON 0x80 /* Micron Quad I/O */
76
70/* Flag Status Register bits */ 77/* Flag Status Register bits */
71#define FSR_READY 0x80 78#define FSR_READY 0x80
72 79
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h
index c3918a0684fe..1e271cb559cd 100644
--- a/include/linux/mtd/ubi.h
+++ b/include/linux/mtd/ubi.h
@@ -23,22 +23,32 @@
23 23
24#include <linux/ioctl.h> 24#include <linux/ioctl.h>
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/scatterlist.h>
26#include <mtd/ubi-user.h> 27#include <mtd/ubi-user.h>
27 28
28/* All voumes/LEBs */ 29/* All voumes/LEBs */
29#define UBI_ALL -1 30#define UBI_ALL -1
30 31
31/* 32/*
33 * Maximum number of scatter gather list entries,
34 * we use only 64 to have a lower memory foot print.
35 */
36#define UBI_MAX_SG_COUNT 64
37
38/*
32 * enum ubi_open_mode - UBI volume open mode constants. 39 * enum ubi_open_mode - UBI volume open mode constants.
33 * 40 *
34 * UBI_READONLY: read-only mode 41 * UBI_READONLY: read-only mode
35 * UBI_READWRITE: read-write mode 42 * UBI_READWRITE: read-write mode
36 * UBI_EXCLUSIVE: exclusive mode 43 * UBI_EXCLUSIVE: exclusive mode
44 * UBI_METAONLY: modify only the volume meta-data,
45 * i.e. the data stored in the volume table, but not in any of volume LEBs.
37 */ 46 */
38enum { 47enum {
39 UBI_READONLY = 1, 48 UBI_READONLY = 1,
40 UBI_READWRITE, 49 UBI_READWRITE,
41 UBI_EXCLUSIVE 50 UBI_EXCLUSIVE,
51 UBI_METAONLY
42}; 52};
43 53
44/** 54/**
@@ -116,6 +126,35 @@ struct ubi_volume_info {
116}; 126};
117 127
118/** 128/**
129 * struct ubi_sgl - UBI scatter gather list data structure.
130 * @list_pos: current position in @sg[]
131 * @page_pos: current position in @sg[@list_pos]
132 * @sg: the scatter gather list itself
133 *
134 * ubi_sgl is a wrapper around a scatter list which keeps track of the
135 * current position in the list and the current list item such that
136 * it can be used across multiple ubi_leb_read_sg() calls.
137 */
138struct ubi_sgl {
139 int list_pos;
140 int page_pos;
141 struct scatterlist sg[UBI_MAX_SG_COUNT];
142};
143
144/**
145 * ubi_sgl_init - initialize an UBI scatter gather list data structure.
146 * @usgl: the UBI scatter gather struct itself
147 *
148 * Please note that you still have to use sg_init_table() or any adequate
149 * function to initialize the unterlaying struct scatterlist.
150 */
151static inline void ubi_sgl_init(struct ubi_sgl *usgl)
152{
153 usgl->list_pos = 0;
154 usgl->page_pos = 0;
155}
156
157/**
119 * struct ubi_device_info - UBI device description data structure. 158 * struct ubi_device_info - UBI device description data structure.
120 * @ubi_num: ubi device number 159 * @ubi_num: ubi device number
121 * @leb_size: logical eraseblock size on this UBI device 160 * @leb_size: logical eraseblock size on this UBI device
@@ -210,6 +249,8 @@ int ubi_unregister_volume_notifier(struct notifier_block *nb);
210void ubi_close_volume(struct ubi_volume_desc *desc); 249void ubi_close_volume(struct ubi_volume_desc *desc);
211int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, 250int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset,
212 int len, int check); 251 int len, int check);
252int ubi_leb_read_sg(struct ubi_volume_desc *desc, int lnum, struct ubi_sgl *sgl,
253 int offset, int len, int check);
213int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf, 254int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf,
214 int offset, int len); 255 int offset, int len);
215int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf, 256int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf,
@@ -230,4 +271,14 @@ static inline int ubi_read(struct ubi_volume_desc *desc, int lnum, char *buf,
230{ 271{
231 return ubi_leb_read(desc, lnum, buf, offset, len, 0); 272 return ubi_leb_read(desc, lnum, buf, offset, len, 0);
232} 273}
274
275/*
276 * This function is the same as the 'ubi_leb_read_sg()' function, but it does
277 * not provide the checking capability.
278 */
279static inline int ubi_read_sg(struct ubi_volume_desc *desc, int lnum,
280 struct ubi_sgl *sgl, int offset, int len)
281{
282 return ubi_leb_read_sg(desc, lnum, sgl, offset, len, 0);
283}
233#endif /* !__LINUX_UBI_H__ */ 284#endif /* !__LINUX_UBI_H__ */