1 /* 2 * Header file for UBI support for U-Boot 3 * 4 * Adaptation from kernel to U-Boot 5 * 6 * Copyright (C) 2005-2007 Samsung Electronics 7 * Kyungmin Park <kyungmin.park@samsung.com> 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License version 2 as 11 * published by the Free Software Foundation. 12 */ 13 14 #ifndef __UBOOT_UBI_H 15 #define __UBOOT_UBI_H 16 17 #include <common.h> 18 #include <compiler.h> 19 #include <linux/compat.h> 20 #include <malloc.h> 21 #include <div64.h> 22 #include <linux/math64.h> 23 #include <linux/crc32.h> 24 #include <linux/types.h> 25 #include <linux/list.h> 26 #include <linux/rbtree.h> 27 #include <linux/string.h> 28 #include <linux/mtd/mtd.h> 29 #include <linux/mtd/ubi.h> 30 31 #ifdef CONFIG_CMD_ONENAND 32 #include <onenand_uboot.h> 33 #endif 34 35 #include <asm/errno.h> 36 37 /* configurable */ 38 #if !defined(CONFIG_MTD_UBI_WL_THRESHOLD) 39 #define CONFIG_MTD_UBI_WL_THRESHOLD 4096 40 #endif 41 #define CONFIG_MTD_UBI_BEB_RESERVE 1 42 43 /* debug options (Linux: drivers/mtd/ubi/Kconfig.debug) */ 44 #undef CONFIG_MTD_UBI_DEBUG 45 #undef CONFIG_MTD_UBI_DEBUG_PARANOID 46 #undef CONFIG_MTD_UBI_DEBUG_MSG 47 #undef CONFIG_MTD_UBI_DEBUG_MSG_EBA 48 #undef CONFIG_MTD_UBI_DEBUG_MSG_WL 49 #undef CONFIG_MTD_UBI_DEBUG_MSG_IO 50 #undef CONFIG_MTD_UBI_DEBUG_MSG_BLD 51 52 #undef CONFIG_MTD_UBI_BLOCK 53 54 #if !defined(CONFIG_MTD_UBI_BEB_LIMIT) 55 #define CONFIG_MTD_UBI_BEB_LIMIT 20 56 #endif 57 58 /* build.c */ 59 #define get_device(...) 60 #define put_device(...) 61 #define ubi_sysfs_init(...) 0 62 #define ubi_sysfs_close(...) do { } while (0) 63 64 #ifndef __UBIFS_H__ 65 #include "../drivers/mtd/ubi/ubi.h" 66 #endif 67 68 /* functions */ 69 extern int ubi_mtd_param_parse(const char *val, struct kernel_param *kp); 70 extern int ubi_init(void); 71 extern void ubi_exit(void); 72 extern int ubi_part(char *part_name, const char *vid_header_offset); 73 extern int ubi_volume_write(char *volume, void *buf, size_t size); 74 extern int ubi_volume_read(char *volume, char *buf, size_t size); 75 76 extern struct ubi_device *ubi_devices[]; 77 78 #endif 79