summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-04-04 10:06:22 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-04-04 10:06:22 +0200
commit149e9d8121a1bf1ea1477e0eabfee1e1bfb2697f (patch)
tree2f3bb4653125c249a21c43433f9be437fe08f840 /include
parent245bc10ca5fbd1064445281a13d51481253f1010 (diff)
parent3676454f5cb571fe1370d3d8f9b67704c08cb9b3 (diff)
downloadbarebox-149e9d8121a1bf1ea1477e0eabfee1e1bfb2697f.tar.gz
barebox-149e9d8121a1bf1ea1477e0eabfee1e1bfb2697f.tar.xz
Merge branch 'for-next/mtd'
Diffstat (limited to 'include')
-rw-r--r--include/linux/mtd/mtd-abi.h12
-rw-r--r--include/linux/mtd/mtd.h15
2 files changed, 22 insertions, 5 deletions
diff --git a/include/linux/mtd/mtd-abi.h b/include/linux/mtd/mtd-abi.h
index 11d51e2744..c1ba55bd2d 100644
--- a/include/linux/mtd/mtd-abi.h
+++ b/include/linux/mtd/mtd-abi.h
@@ -9,6 +9,8 @@
#ifndef DOXYGEN_SHOULD_SKIP_THIS
+#include <asm-generic/div64.h>
+
struct erase_info_user {
uint32_t start;
uint32_t length;
@@ -73,7 +75,7 @@ enum {
struct mtd_info_user {
uint8_t type;
uint32_t flags;
- uint32_t size; // Total size of the MTD
+ uint64_t size; /* Total size of the MTD */
uint32_t erasesize;
uint32_t writesize;
uint32_t oobsize; // Amount of OOB data per block (e.g. 16)
@@ -173,6 +175,14 @@ enum mtd_file_modes {
MTD_MODE_RAW,
};
+
+static inline uint32_t mtd_user_div_by_eb(uint64_t sz,
+ struct mtd_info_user *mtd_user)
+{
+ do_div(sz, mtd_user->erasesize);
+ return sz;
+}
+
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
#endif /* __MTD_ABI_H__ */
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index e02204a503..c63b514f44 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -86,7 +86,7 @@ struct mtd_oob_ops {
struct mtd_info {
u_char type;
u_int32_t flags;
- u_int32_t size; // Total size of the MTD
+ u_int64_t size; /* Total size of the MTD */
/* "Major" erase size for the device. Naïve users may take this
* to be the only erase size available, or may use the more detailed
@@ -219,7 +219,7 @@ struct mtd_info {
int p_allow_erasebad;
struct mtd_info *master;
- uint32_t master_offset;
+ loff_t master_offset;
};
int mtd_erase(struct mtd_info *mtd, struct erase_info *instr);
@@ -256,6 +256,13 @@ static inline uint32_t mtd_mod_by_eb(uint64_t sz, struct mtd_info *mtd)
{
return do_div(sz, mtd->erasesize);
}
+
+static inline uint32_t mtd_div_by_wb(uint64_t sz, struct mtd_info *mtd)
+{
+ do_div(sz, mtd->writesize);
+ return sz;
+}
+
/* Kernel-side ioctl definitions */
extern int add_mtd_device(struct mtd_info *mtd, char *devname, int device_id);
@@ -273,8 +280,8 @@ struct mtd_notifier {
struct list_head list;
};
-struct mtd_info *mtd_add_partition(struct mtd_info *mtd, off_t offset, size_t size,
- unsigned long flags, const char *name);
+struct mtd_info *mtd_add_partition(struct mtd_info *mtd, off_t offset,
+ uint64_t size, unsigned long flags, const char *name);
int mtd_del_partition(struct mtd_info *mtd);
extern void register_mtd_user (struct mtd_notifier *new);