blob: 0770228cd895c6494e6a95b7810b9b8f39008037 [file] [log] [blame]
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +01001/*
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>
Anton Vorontsovd8bc55a2009-09-01 20:58:03 +040018#include <compiler.h>
Heiko Schocher0c06db52014-06-24 10:10:03 +020019#include <linux/compat.h>
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010020#include <malloc.h>
21#include <div64.h>
Heiko Schocher0c06db52014-06-24 10:10:03 +020022#include <linux/math64.h>
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010023#include <linux/crc32.h>
Stefan Roese9eefe2a2009-03-19 15:35:05 +010024#include <linux/types.h>
25#include <linux/list.h>
26#include <linux/rbtree.h>
27#include <linux/string.h>
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010028#include <linux/mtd/mtd.h>
Stefan Roese9eefe2a2009-03-19 15:35:05 +010029#include <linux/mtd/ubi.h>
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010030
31#ifdef CONFIG_CMD_ONENAND
32#include <onenand_uboot.h>
33#endif
34
Masahiro Yamada1221ce42016-09-21 11:28:55 +090035#include <linux/errno.h>
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010036
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010037/* configurable */
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010038#define CONFIG_MTD_UBI_BEB_RESERVE 1
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010039
40/* debug options (Linux: drivers/mtd/ubi/Kconfig.debug) */
41#undef CONFIG_MTD_UBI_DEBUG
42#undef CONFIG_MTD_UBI_DEBUG_PARANOID
43#undef CONFIG_MTD_UBI_DEBUG_MSG
44#undef CONFIG_MTD_UBI_DEBUG_MSG_EBA
45#undef CONFIG_MTD_UBI_DEBUG_MSG_WL
46#undef CONFIG_MTD_UBI_DEBUG_MSG_IO
47#undef CONFIG_MTD_UBI_DEBUG_MSG_BLD
Heiko Schocher0c06db52014-06-24 10:10:03 +020048
49#undef CONFIG_MTD_UBI_BLOCK
50
Andrew Ruderd1cfeee2014-11-05 13:31:57 -060051/* ubi_init() disables returning error codes when built into the Linux
52 * kernel so that it doesn't hang the Linux kernel boot process. Since
53 * the U-Boot driver code depends on getting valid error codes from this
54 * function we just tell the UBI layer that we are building as a module
55 * (which only enables the additional error reporting).
56 */
57#define CONFIG_MTD_UBI_MODULE
58
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010059/* build.c */
60#define get_device(...)
61#define put_device(...)
62#define ubi_sysfs_init(...) 0
63#define ubi_sysfs_close(...) do { } while (0)
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010064
Stefan Roese9eefe2a2009-03-19 15:35:05 +010065#ifndef __UBIFS_H__
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010066#include "../drivers/mtd/ubi/ubi.h"
Stefan Roese9eefe2a2009-03-19 15:35:05 +010067#endif
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010068
69/* functions */
70extern int ubi_mtd_param_parse(const char *val, struct kernel_param *kp);
71extern int ubi_init(void);
Stefan Roese2ee951b2008-11-27 14:07:09 +010072extern void ubi_exit(void);
Joe Hershberger71829062013-04-08 10:32:47 +000073extern int ubi_part(char *part_name, const char *vid_header_offset);
74extern int ubi_volume_write(char *volume, void *buf, size_t size);
75extern int ubi_volume_read(char *volume, char *buf, size_t size);
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010076
77extern struct ubi_device *ubi_devices[];
Tien Fong Chee14dfc642018-07-06 16:26:01 +080078int cmd_ubifs_mount(char *vol_name);
Tien Fong Chee10c20442018-07-06 16:25:12 +080079int cmd_ubifs_umount(void);
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010080
81#endif