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