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