]> git.ipfire.org Git - people/ms/u-boot.git/blame - include/linux/mtd/nftl.h
Merge branch 'master' of git://git.denx.de/u-boot-mpc83xx
[people/ms/u-boot.git] / include / linux / mtd / nftl.h
CommitLineData
cfa460ad 1/*
cfa460ad
WJ
2 * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org>
3 */
a1e329b4
WD
4
5#ifndef __MTD_NFTL_H__
6#define __MTD_NFTL_H__
7
cfa460ad
WJ
8#include <linux/mtd/mtd.h>
9#include <linux/mtd/blktrans.h>
a1e329b4 10
cfa460ad 11#include <linux/mtd/nftl-user.h>
a1e329b4
WD
12
13/* these info are used in ReplUnitTable */
4b070809
WD
14#define BLOCK_NIL 0xffff /* last block of a chain */
15#define BLOCK_FREE 0xfffe /* free block */
a1e329b4 16#define BLOCK_NOTEXPLORED 0xfffd /* non explored block, only used during mounting */
4b070809 17#define BLOCK_RESERVED 0xfffc /* bios block or bad block */
a1e329b4
WD
18
19struct NFTLrecord {
cfa460ad 20 struct mtd_blktrans_dev mbd;
a1e329b4
WD
21 __u16 MediaUnit, SpareMediaUnit;
22 __u32 EraseSize;
23 struct NFTLMediaHeader MediaHdr;
24 int usecount;
25 unsigned char heads;
26 unsigned char sectors;
27 unsigned short cylinders;
28 __u16 numvunits;
4b070809 29 __u16 lastEUN; /* should be suppressed */
a1e329b4 30 __u16 numfreeEUNs;
53677ef1 31 __u16 LastFreeEUN; /* To speed up finding a free EUN */
a1e329b4 32 int head,sect,cyl;
53677ef1
WD
33 __u16 *EUNtable; /* [numvunits]: First EUN for each virtual unit */
34 __u16 *ReplUnitTable; /* [numEUNs]: ReplUnitNumber for each */
4b070809
WD
35 unsigned int nb_blocks; /* number of physical blocks */
36 unsigned int nb_boot_blocks; /* number of blocks used by the bios */
37 struct erase_info instr;
cfa460ad 38 struct nand_ecclayout oobinfo;
a1e329b4
WD
39};
40
cfa460ad
WJ
41int NFTL_mount(struct NFTLrecord *s);
42int NFTL_formatblock(struct NFTLrecord *s, int block);
43
c45912d8
SW
44int nftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len,
45 size_t *retlen, uint8_t *buf);
46int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
47 size_t *retlen, uint8_t *buf);
48
cfa460ad
WJ
49#ifndef NFTL_MAJOR
50#define NFTL_MAJOR 93
51#endif
52
a1e329b4 53#define MAX_NFTLS 16
cfa460ad 54#define MAX_SECTORS_PER_UNIT 64
a1e329b4
WD
55#define NFTL_PARTN_BITS 4
56
57#endif /* __MTD_NFTL_H__ */