| 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 | //int nand_program_oob_4740(void *context, int spage, int pages, void (*notify)(int)); |
| 35 | u32 nand_erase_4740(int blk_num, int sblk, int force); |
| 36 | u32 nand_read_4740(void *buf, u32 startpage, u32 pagenum,int option); |
| 37 | u32 nand_read_oob_4740(void *buf, u32 startpage, u32 pagenum); |
| 38 | u32 nand_read_raw_4740(void *buf, u32 startpage, u32 pagenum,int); |
| 39 | u32 nand_mark_bad_4740(int bad); |
| 40 | void nand_enable_4740(u32 csn); |
| 41 | void nand_disable_4740(u32 csn); |
| 42 | |
| 43 | /* Jz4760 nandflash interface */ |
| 44 | unsigned int nand_query_4760(u8 *); |
| 45 | //int nand_init_4760(int bus_width, int row_cycle, int page_size, int page_per_block, |
| 46 | // int,int,int,int); |
| 47 | |
| 48 | int nand_init_4760(int bus_width, int row_cycle, int page_size, int page_per_block, |
| 49 | int bch_bit, int ecc_pos, int bad_pos, int bad_page, int force); |
| 50 | |
| 51 | int nand_fini_4760(void); |
| 52 | u32 nand_program_4760(void *context, int spage, int pages, int option); |
| 53 | //int nand_program_oob_4740(void *context, int spage, int pages, void (*notify)(int)); |
| 54 | u32 nand_erase_4760(int blk_num, int sblk, int force); |
| 55 | u32 nand_read_4760(void *buf, u32 startpage, u32 pagenum,int option); |
| 56 | u32 nand_read_oob_4760(void *buf, u32 startpage, u32 pagenum); |
| 57 | u32 nand_read_raw_4760(void *buf, u32 startpage, u32 pagenum,int); |
| 58 | u32 nand_mark_bad_4760(int bad); |
| 59 | |
| 60 | void nand_enable_4760(u32 csn); |
| 61 | void nand_disable_4760(u32 csn); |
| 62 | |
| 63 | #endif |
| 64 | |