1
2
3
4
5
6
7
8
9#ifndef MTD_PARTITIONS_H
10#define MTD_PARTITIONS_H
11
12#include <linux/types.h>
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39struct mtd_partition {
40 const char *name;
41 uint64_t size;
42 uint64_t offset;
43 uint32_t mask_flags;
44 struct nand_ecclayout *ecclayout;
45};
46
47#define MTDPART_OFS_RETAIN (-3)
48#define MTDPART_OFS_NXTBLK (-2)
49#define MTDPART_OFS_APPEND (-1)
50#define MTDPART_SIZ_FULL (0)
51
52
53struct mtd_info;
54struct device_node;
55
56#ifndef __UBOOT__
57
58
59
60
61
62struct mtd_part_parser_data {
63 unsigned long origin;
64 struct device_node *of_node;
65};
66
67
68
69
70
71
72struct mtd_part_parser {
73 struct list_head list;
74 struct module *owner;
75 const char *name;
76 int (*parse_fn)(struct mtd_info *, struct mtd_partition **,
77 struct mtd_part_parser_data *);
78};
79
80extern void register_mtd_parser(struct mtd_part_parser *parser);
81extern void deregister_mtd_parser(struct mtd_part_parser *parser);
82#endif
83
84int mtd_add_partition(struct mtd_info *master, const char *name,
85 long long offset, long long length);
86int mtd_del_partition(struct mtd_info *master, int partno);
87uint64_t mtd_get_device_size(const struct mtd_info *mtd);
88
89#if defined(CONFIG_MTD_PARTITIONS)
90int mtd_parse_partitions(struct mtd_info *parent, const char **_mtdparts,
91 struct mtd_partition **_parts, int *_nparts);
92void mtd_free_parsed_partitions(struct mtd_partition *parts,
93 unsigned int nparts);
94#else
95static inline int
96mtd_parse_partitions(struct mtd_info *parent, const char **_mtdparts,
97 struct mtd_partition **_parts, int *_nparts)
98{
99 *_nparts = 0;
100
101 return 0;
102}
103static inline void
104mtd_free_parsed_partitions(struct mtd_partition *parts, unsigned int nparts)
105{
106 return;
107}
108#endif
109
110#endif
111