blob: ea0db69c72a89504a6b2bf9a0d1a179282ffc3dd [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
Anton Vorontsovd8bc55a2009-09-01 20:58:03 +040017#include <compiler.h>
Heiko Schocher0c06db52014-06-24 10:10:03 +020018#include <linux/compat.h>
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010019#include <malloc.h>
20#include <div64.h>
Heiko Schocher0c06db52014-06-24 10:10:03 +020021#include <linux/math64.h>
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010022#include <linux/crc32.h>
Stefan Roese9eefe2a2009-03-19 15:35:05 +010023#include <linux/types.h>
24#include <linux/list.h>
25#include <linux/rbtree.h>
26#include <linux/string.h>
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010027#include <linux/mtd/mtd.h>
Stefan Roese9eefe2a2009-03-19 15:35:05 +010028#include <linux/mtd/ubi.h>
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010029
30#ifdef CONFIG_CMD_ONENAND
31#include <onenand_uboot.h>
32#endif
33
Masahiro Yamada1221ce42016-09-21 11:28:55 +090034#include <linux/errno.h>
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010035
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010036/* build.c */
37#define get_device(...)
38#define put_device(...)
39#define ubi_sysfs_init(...) 0
40#define ubi_sysfs_close(...) do { } while (0)
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010041
Stefan Roese9eefe2a2009-03-19 15:35:05 +010042#ifndef __UBIFS_H__
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010043#include "../drivers/mtd/ubi/ubi.h"
Stefan Roese9eefe2a2009-03-19 15:35:05 +010044#endif
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010045
46/* functions */
47extern int ubi_mtd_param_parse(const char *val, struct kernel_param *kp);
48extern int ubi_init(void);
Stefan Roese2ee951b2008-11-27 14:07:09 +010049extern void ubi_exit(void);
Joe Hershberger71829062013-04-08 10:32:47 +000050extern int ubi_part(char *part_name, const char *vid_header_offset);
Alexey Romanov25ee9c22024-07-18 08:45:24 +030051extern int ubi_volume_write(char *volume, void *buf, loff_t offset, size_t size);
Alexey Romanovcead69c2024-07-18 08:45:23 +030052extern int ubi_volume_read(char *volume, char *buf, loff_t offset, size_t size);
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010053
54extern struct ubi_device *ubi_devices[];
Tien Fong Chee14dfc642018-07-06 16:26:01 +080055int cmd_ubifs_mount(char *vol_name);
Tien Fong Chee10c20442018-07-06 16:25:12 +080056int cmd_ubifs_umount(void);
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010057
Alexey Romanov9daad112024-07-18 08:45:25 +030058#if IS_ENABLED(CONFIG_UBI_BLOCK)
59int ubi_bind(struct udevice *dev);
60#else
61static inline int ubi_bind(struct udevice *dev)
62{
63 return -EOPNOTSUPP;
64}
65#endif
66
Kyungmin Park7e6ee7a2008-11-19 16:32:36 +010067#endif