^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) /* Copyright (c) 2018 Rockchip Electronics Co. Ltd. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #ifndef __RK_SFTL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #define __RK_SFTL_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) u32 ftl_low_format(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) int sftl_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) int sftl_deinit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) int sftl_read(u32 index, u32 count, u8 *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) int sftl_write(u32 index, u32 count, u8 *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) u32 sftl_get_density(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) s32 sftl_gc(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) int sftl_discard(u32 sec, u32 n_sec);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) int sftl_vendor_read(u32 index, u32 count, u8 *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) int sftl_vendor_write(u32 index, u32 count, u8 *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * rknand_proc_ftlread() Read FTL info which's about 2KB size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * @size: buf size(>= 2KB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * @buf: buf for caching ftl info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * @return real size of caching ftl info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) int rknand_proc_ftlread(int size, char *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) int rk_sftl_vendor_read(u32 id, u8 *buf, u32 size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) int rk_sftl_vendor_write(u32 id, u8 *buf, u32 size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) int rk_sftl_vendor_register(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) int rk_sftl_vendor_storage_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) int rk_sftl_vendor_dev_ops_register(int (*read)(u32 sec,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) u32 n_sec,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) void *p_data),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) int (*write)(u32 sec,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) u32 n_sec,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) void *p_data));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) void *ftl_malloc(int n_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) void ftl_free(void *p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) void *ftl_memset(void *s, int c, unsigned int n);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) void *ftl_memcpy(void *pv_to,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) const void *pv_from,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) unsigned int size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) * Function that needs to be defined
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) void __printf(1, 2) sftl_printk(char *fmt, ...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #endif