xref: /openbmc/u-boot/drivers/mtd/ubi/wl.h (revision 588eec2a)
1*0195a7bbSHeiko Schocher #ifndef UBI_WL_H
2*0195a7bbSHeiko Schocher #define UBI_WL_H
3*0195a7bbSHeiko Schocher #ifdef CONFIG_MTD_UBI_FASTMAP
4*0195a7bbSHeiko Schocher static int anchor_pebs_avalible(struct rb_root *root);
5*0195a7bbSHeiko Schocher #ifndef __UBOOT__
6*0195a7bbSHeiko Schocher static void update_fastmap_work_fn(struct work_struct *wrk);
7*0195a7bbSHeiko Schocher #else
8*0195a7bbSHeiko Schocher void update_fastmap_work_fn(struct ubi_device *ubi);
9*0195a7bbSHeiko Schocher #endif
10*0195a7bbSHeiko Schocher static struct ubi_wl_entry *find_anchor_wl_entry(struct rb_root *root);
11*0195a7bbSHeiko Schocher static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi);
12*0195a7bbSHeiko Schocher static void ubi_fastmap_close(struct ubi_device *ubi);
ubi_fastmap_init(struct ubi_device * ubi,int * count)13*0195a7bbSHeiko Schocher static inline void ubi_fastmap_init(struct ubi_device *ubi, int *count)
14*0195a7bbSHeiko Schocher {
15*0195a7bbSHeiko Schocher 	/* Reserve enough LEBs to store two fastmaps. */
16*0195a7bbSHeiko Schocher 	*count += (ubi->fm_size / ubi->leb_size) * 2;
17*0195a7bbSHeiko Schocher #ifndef __UBOOT__
18*0195a7bbSHeiko Schocher 	INIT_WORK(&ubi->fm_work, update_fastmap_work_fn);
19*0195a7bbSHeiko Schocher #endif
20*0195a7bbSHeiko Schocher }
21*0195a7bbSHeiko Schocher static struct ubi_wl_entry *may_reserve_for_fm(struct ubi_device *ubi,
22*0195a7bbSHeiko Schocher 					       struct ubi_wl_entry *e,
23*0195a7bbSHeiko Schocher 					       struct rb_root *root);
24*0195a7bbSHeiko Schocher #else /* !CONFIG_MTD_UBI_FASTMAP */
25*0195a7bbSHeiko Schocher static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi);
ubi_fastmap_close(struct ubi_device * ubi)26*0195a7bbSHeiko Schocher static inline void ubi_fastmap_close(struct ubi_device *ubi) { }
ubi_fastmap_init(struct ubi_device * ubi,int * count)27*0195a7bbSHeiko Schocher static inline void ubi_fastmap_init(struct ubi_device *ubi, int *count) { }
may_reserve_for_fm(struct ubi_device * ubi,struct ubi_wl_entry * e,struct rb_root * root)28*0195a7bbSHeiko Schocher static struct ubi_wl_entry *may_reserve_for_fm(struct ubi_device *ubi,
29*0195a7bbSHeiko Schocher 					       struct ubi_wl_entry *e,
30*0195a7bbSHeiko Schocher 					       struct rb_root *root) {
31*0195a7bbSHeiko Schocher 	return e;
32*0195a7bbSHeiko Schocher }
33*0195a7bbSHeiko Schocher #endif /* CONFIG_MTD_UBI_FASTMAP */
34*0195a7bbSHeiko Schocher #endif /* UBI_WL_H */
35