Kyungmin Park | ad7ae36 | 2008-11-19 16:32:36 +0100 | [diff] [blame] | 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 | |
Anton Vorontsov | 18d59c0 | 2009-09-01 20:58:03 +0400 | [diff] [blame] | 17 | #include <compiler.h> |
Heiko Schocher | 4f7a9a3 | 2014-06-24 10:10:03 +0200 | [diff] [blame] | 18 | #include <linux/compat.h> |
Kyungmin Park | ad7ae36 | 2008-11-19 16:32:36 +0100 | [diff] [blame] | 19 | #include <malloc.h> |
| 20 | #include <div64.h> |
Heiko Schocher | 4f7a9a3 | 2014-06-24 10:10:03 +0200 | [diff] [blame] | 21 | #include <linux/math64.h> |
Kyungmin Park | ad7ae36 | 2008-11-19 16:32:36 +0100 | [diff] [blame] | 22 | #include <linux/crc32.h> |
Stefan Roese | 2fc10f6 | 2009-03-19 15:35:05 +0100 | [diff] [blame] | 23 | #include <linux/types.h> |
| 24 | #include <linux/list.h> |
| 25 | #include <linux/rbtree.h> |
| 26 | #include <linux/string.h> |
Kyungmin Park | ad7ae36 | 2008-11-19 16:32:36 +0100 | [diff] [blame] | 27 | #include <linux/mtd/mtd.h> |
Stefan Roese | 2fc10f6 | 2009-03-19 15:35:05 +0100 | [diff] [blame] | 28 | #include <linux/mtd/ubi.h> |
Kyungmin Park | ad7ae36 | 2008-11-19 16:32:36 +0100 | [diff] [blame] | 29 | |
| 30 | #ifdef CONFIG_CMD_ONENAND |
| 31 | #include <onenand_uboot.h> |
| 32 | #endif |
| 33 | |
Masahiro Yamada | 56a931c | 2016-09-21 11:28:55 +0900 | [diff] [blame] | 34 | #include <linux/errno.h> |
Kyungmin Park | ad7ae36 | 2008-11-19 16:32:36 +0100 | [diff] [blame] | 35 | |
Kyungmin Park | ad7ae36 | 2008-11-19 16:32:36 +0100 | [diff] [blame] | 36 | /* 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 Park | ad7ae36 | 2008-11-19 16:32:36 +0100 | [diff] [blame] | 41 | |
Stefan Roese | 2fc10f6 | 2009-03-19 15:35:05 +0100 | [diff] [blame] | 42 | #ifndef __UBIFS_H__ |
Kyungmin Park | ad7ae36 | 2008-11-19 16:32:36 +0100 | [diff] [blame] | 43 | #include "../drivers/mtd/ubi/ubi.h" |
Stefan Roese | 2fc10f6 | 2009-03-19 15:35:05 +0100 | [diff] [blame] | 44 | #endif |
Kyungmin Park | ad7ae36 | 2008-11-19 16:32:36 +0100 | [diff] [blame] | 45 | |
| 46 | /* functions */ |
| 47 | extern int ubi_mtd_param_parse(const char *val, struct kernel_param *kp); |
| 48 | extern int ubi_init(void); |
Stefan Roese | 1b20eb8 | 2008-11-27 14:07:09 +0100 | [diff] [blame] | 49 | extern void ubi_exit(void); |
Joe Hershberger | 9219845 | 2013-04-08 10:32:47 +0000 | [diff] [blame] | 50 | extern int ubi_part(char *part_name, const char *vid_header_offset); |
Alexey Romanov | de417e9 | 2024-07-18 08:45:24 +0300 | [diff] [blame] | 51 | extern int ubi_volume_write(char *volume, void *buf, loff_t offset, size_t size); |
Alexey Romanov | 0043a97 | 2024-07-18 08:45:23 +0300 | [diff] [blame] | 52 | extern int ubi_volume_read(char *volume, char *buf, loff_t offset, size_t size); |
Kyungmin Park | ad7ae36 | 2008-11-19 16:32:36 +0100 | [diff] [blame] | 53 | |
| 54 | extern struct ubi_device *ubi_devices[]; |
Tien Fong Chee | bb7387f | 2018-07-06 16:26:01 +0800 | [diff] [blame] | 55 | int cmd_ubifs_mount(char *vol_name); |
Tien Fong Chee | dbc9d85 | 2018-07-06 16:25:12 +0800 | [diff] [blame] | 56 | int cmd_ubifs_umount(void); |
Kyungmin Park | ad7ae36 | 2008-11-19 16:32:36 +0100 | [diff] [blame] | 57 | |
Alexey Romanov | 4d44fa2 | 2024-07-18 08:45:25 +0300 | [diff] [blame] | 58 | #if IS_ENABLED(CONFIG_UBI_BLOCK) |
| 59 | int ubi_bind(struct udevice *dev); |
| 60 | #else |
| 61 | static inline int ubi_bind(struct udevice *dev) |
| 62 | { |
| 63 | return -EOPNOTSUPP; |
| 64 | } |
| 65 | #endif |
| 66 | |
Kyungmin Park | ad7ae36 | 2008-11-19 16:32:36 +0100 | [diff] [blame] | 67 | #endif |