Kyungmin Park | af3d11c | 2007-09-10 17:15:14 +0900 | [diff] [blame] | 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 | |
Scott Wood | 8b75926 | 2008-05-22 10:49:00 -0500 | [diff] [blame] | 17 | #include <linux/types.h> |
| 18 | |
Remy Bohmer | b0dbfb1 | 2009-02-01 12:27:53 +0100 | [diff] [blame] | 19 | /* Forward declarations */ |
Scott Wood | 8b75926 | 2008-05-22 10:49:00 -0500 | [diff] [blame] | 20 | struct mtd_info; |
Remy Bohmer | b0dbfb1 | 2009-02-01 12:27:53 +0100 | [diff] [blame] | 21 | struct mtd_oob_ops; |
Scott Wood | 8b75926 | 2008-05-22 10:49:00 -0500 | [diff] [blame] | 22 | struct erase_info; |
Kyungmin Park | dc7a79c | 2008-11-04 09:24:07 +0900 | [diff] [blame] | 23 | struct onenand_chip; |
Scott Wood | 8b75926 | 2008-05-22 10:49:00 -0500 | [diff] [blame] | 24 | |
Kyungmin Park | 5d7a01c | 2008-08-19 08:42:53 +0900 | [diff] [blame] | 25 | extern struct mtd_info onenand_mtd; |
Amul Kumar Saha | ed886a2 | 2009-11-06 17:15:31 +0530 | [diff] [blame] | 26 | extern struct onenand_chip onenand_chip; |
Kyungmin Park | 5d7a01c | 2008-08-19 08:42:53 +0900 | [diff] [blame] | 27 | |
Kyungmin Park | dc7a79c | 2008-11-04 09:24:07 +0900 | [diff] [blame] | 28 | /* board */ |
Ladislav Michl | 1173271 | 2016-07-12 20:28:20 +0200 | [diff] [blame] | 29 | extern int onenand_board_init(struct mtd_info *); |
Kyungmin Park | dc7a79c | 2008-11-04 09:24:07 +0900 | [diff] [blame] | 30 | |
Kyungmin Park | af3d11c | 2007-09-10 17:15:14 +0900 | [diff] [blame] | 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); |
Kyungmin Park | dc7a79c | 2008-11-04 09:24:07 +0900 | [diff] [blame] | 35 | extern int onenand_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops); |
Kyungmin Park | af3d11c | 2007-09-10 17:15:14 +0900 | [diff] [blame] | 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 | |
Kyungmin Park | dc7a79c | 2008-11-04 09:24:07 +0900 | [diff] [blame] | 40 | extern char *onenand_print_device_info(int device, int version); |
Kyungmin Park | af3d11c | 2007-09-10 17:15:14 +0900 | [diff] [blame] | 41 | |
Amul Kumar Saha | ed886a2 | 2009-11-06 17:15:31 +0530 | [diff] [blame] | 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 | |
Marek Vasut | 07e69a2 | 2011-10-31 14:14:15 +0100 | [diff] [blame] | 51 | /* SPL */ |
Ladislav Michl | dcd7ed3 | 2016-07-12 20:28:11 +0200 | [diff] [blame] | 52 | int onenand_spl_read_block(int block, int offset, int len, void *dst); |
Marek Vasut | 07e69a2 | 2011-10-31 14:14:15 +0100 | [diff] [blame] | 53 | void onenand_spl_load_image(uint32_t offs, uint32_t size, void *dst); |
| 54 | |
Kyungmin Park | af3d11c | 2007-09-10 17:15:14 +0900 | [diff] [blame] | 55 | #endif /* __UBOOT_ONENAND_H */ |