1 /*
2  *  Header file for OneNAND 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_ONENAND_H
15 #define __UBOOT_ONENAND_H
16 
17 #include <linux/types.h>
18 
19 /* Forward declarations */
20 struct mtd_info;
21 struct mtd_oob_ops;
22 struct erase_info;
23 struct onenand_chip;
24 
25 extern struct mtd_info onenand_mtd;
26 extern struct onenand_chip onenand_chip;
27 
28 /* board */
29 extern int onenand_board_init(struct mtd_info *);
30 
31 /* Functions */
32 extern void onenand_init(void);
33 extern int onenand_read(struct mtd_info *mtd, loff_t from, size_t len,
34 			size_t * retlen, u_char * buf);
35 extern int onenand_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops);
36 extern int onenand_write(struct mtd_info *mtd, loff_t from, size_t len,
37 			 size_t * retlen, const u_char * buf);
38 extern int onenand_erase(struct mtd_info *mtd, struct erase_info *instr);
39 
40 extern char *onenand_print_device_info(int device, int version);
41 
42 extern unsigned onenand_block(struct onenand_chip *this, loff_t addr);
43 
44 extern loff_t onenand_addr(struct onenand_chip *this, int block);
45 
46 extern int flexonenand_region(struct mtd_info *mtd, loff_t addr);
47 
48 extern int flexonenand_set_boundary(struct mtd_info *mtd, int die,
49 					int boundary, int lock);
50 
51 /* SPL */
52 int onenand_spl_read_block(int block, int offset, int len, void *dst);
53 void onenand_spl_load_image(uint32_t offs, uint32_t size, void *dst);
54 
55 #endif /* __UBOOT_ONENAND_H */
56