1 /* 2 * Copyright (C) 2009 Qi Hardware Inc., 3 * Author: Xiangfu Liu <xiangfu@sharism.cc> 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License 7 * version 3 as published by the Free Software Foundation. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * Boston, MA 02110-1301, USA 18 */ 19 #ifndef __NANDLIB_H__ 20 #define __NANDLIB_H__ 21 22 #include "xburst_types.h" 23 24 #ifndef NULL 25 #define NULL 0 26 #endif 27 28 /* Jz4740 nandflash interface */ 29 unsigned int nand_query_4740(u8 *); 30 int nand_init_4740(int bus_width, int row_cycle, int page_size, int page_per_block, 31 int,int,int,int); 32 int nand_fini_4740(void); 33 u32 nand_program_4740(void *context, int spage, int pages, int option); 34 u32 nand_erase_4740(int blk_num, int sblk, int force); 35 u32 nand_read_4740(void *buf, u32 startpage, u32 pagenum,int option); 36 u32 nand_read_oob_4740(void *buf, u32 startpage, u32 pagenum); 37 u32 nand_read_raw_4740(void *buf, u32 startpage, u32 pagenum,int); 38 u32 nand_mark_bad_4740(int bad); 39 void nand_enable_4740(u32 csn); 40 void nand_disable_4740(u32 csn); 41 42 /* Jz4760 nandflash interface */ 43 unsigned int nand_query_4760(u8 *); 44 int nand_init_4760(int bus_width, int row_cycle, int page_size, int page_per_block, 45 int bch_bit, int ecc_pos, int bad_pos, int bad_page, int force); 46 int nand_fini_4760(void); 47 u32 nand_program_4760(void *context, int spage, int pages, int option); 48 u32 nand_erase_4760(int blk_num, int sblk, int force); 49 u32 nand_read_4760(void *buf, u32 startpage, u32 pagenum,int option); 50 u32 nand_read_oob_4760(void *buf, u32 startpage, u32 pagenum); 51 u32 nand_read_raw_4760(void *buf, u32 startpage, u32 pagenum,int); 52 u32 nand_mark_bad_4760(int bad); 53 void nand_enable_4760(u32 csn); 54 void nand_disable_4760(u32 csn); 55 56 #endif