xref: /openbmc/u-boot/fs/yaffs2/yaffs_nandif.h (revision ef64e782)
1 /*
2  * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
3  *
4  * Copyright (C) 2002-2011 Aleph One Ltd.
5  *   for Toby Churchill Ltd and Brightstar Engineering
6  *
7  * Created by Charles Manning <charles@aleph1.co.uk>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU Lesser General Public License version 2.1 as
11  * published by the Free Software Foundation.
12  *
13  * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
14  */
15 
16 
17 #ifndef __YNANDIF_H__
18 #define __YNANDIF_H__
19 
20 #include "yaffs_guts.h"
21 
22 struct ynandif_Geometry {
23 	unsigned start_block;
24 	unsigned end_block;
25 	unsigned dataSize;
26 	unsigned spareSize;
27 	unsigned pagesPerBlock;
28 	unsigned hasECC;
29 	unsigned inband_tags;
30 	unsigned useYaffs2;
31 
32 	int (*initialise)(struct yaffs_dev *dev);
33 	int (*deinitialise)(struct yaffs_dev *dev);
34 
35 	int (*readChunk) (struct yaffs_dev *dev,
36 					  unsigned pageId,
37 					  unsigned char *data,
38 					  unsigned dataLength,
39 					  unsigned char *spare,
40 					  unsigned spareLength,
41 					  int *eccStatus);
42 	/* ECC status is set to 0 for OK, 1 for fixed, -1 for unfixed. */
43 
44 	int (*writeChunk)(struct yaffs_dev *dev,
45 					  unsigned pageId,
46 					  const unsigned char *data,
47 					  unsigned dataLength,
48 					  const unsigned char *spare,
49 					  unsigned spareLength);
50 
51 	int (*eraseBlock)(struct yaffs_dev *dev, unsigned blockId);
52 
53 	int (*checkBlockOk)(struct yaffs_dev *dev, unsigned blockId);
54 	int (*markBlockBad)(struct yaffs_dev *dev, unsigned blockId);
55 
56 	void *privateData;
57 
58 };
59 
60 struct yaffs_dev *
61 	yaffs_add_dev_from_geometry(const YCHAR *name,
62 					const struct ynandif_Geometry *geometry);
63 
64 
65 #endif
66