William Juul | cfa460a | 2007-10-31 13:53:06 +0100 | [diff] [blame] | 1 | /* |
William Juul | cfa460a | 2007-10-31 13:53:06 +0100 | [diff] [blame] | 2 | * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> |
| 3 | */ |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 4 | |
| 5 | #ifndef __MTD_NFTL_H__ |
| 6 | #define __MTD_NFTL_H__ |
| 7 | |
William Juul | cfa460a | 2007-10-31 13:53:06 +0100 | [diff] [blame] | 8 | #include <linux/mtd/mtd.h> |
| 9 | #include <linux/mtd/blktrans.h> |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 10 | |
William Juul | cfa460a | 2007-10-31 13:53:06 +0100 | [diff] [blame] | 11 | #include <linux/mtd/nftl-user.h> |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 12 | |
| 13 | /* these info are used in ReplUnitTable */ |
Wolfgang Denk | 4b07080 | 2008-08-14 14:41:06 +0200 | [diff] [blame] | 14 | #define BLOCK_NIL 0xffff /* last block of a chain */ |
| 15 | #define BLOCK_FREE 0xfffe /* free block */ |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 16 | #define BLOCK_NOTEXPLORED 0xfffd /* non explored block, only used during mounting */ |
Wolfgang Denk | 4b07080 | 2008-08-14 14:41:06 +0200 | [diff] [blame] | 17 | #define BLOCK_RESERVED 0xfffc /* bios block or bad block */ |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 18 | |
| 19 | struct NFTLrecord { |
William Juul | cfa460a | 2007-10-31 13:53:06 +0100 | [diff] [blame] | 20 | struct mtd_blktrans_dev mbd; |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 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; |
Wolfgang Denk | 4b07080 | 2008-08-14 14:41:06 +0200 | [diff] [blame] | 29 | __u16 lastEUN; /* should be suppressed */ |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 30 | __u16 numfreeEUNs; |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 31 | __u16 LastFreeEUN; /* To speed up finding a free EUN */ |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 32 | int head,sect,cyl; |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 33 | __u16 *EUNtable; /* [numvunits]: First EUN for each virtual unit */ |
| 34 | __u16 *ReplUnitTable; /* [numEUNs]: ReplUnitNumber for each */ |
Wolfgang Denk | 4b07080 | 2008-08-14 14:41:06 +0200 | [diff] [blame] | 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; |
William Juul | cfa460a | 2007-10-31 13:53:06 +0100 | [diff] [blame] | 38 | struct nand_ecclayout oobinfo; |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 39 | }; |
| 40 | |
William Juul | cfa460a | 2007-10-31 13:53:06 +0100 | [diff] [blame] | 41 | int NFTL_mount(struct NFTLrecord *s); |
| 42 | int NFTL_formatblock(struct NFTLrecord *s, int block); |
| 43 | |
Scott Wood | c45912d | 2008-10-24 16:20:43 -0500 | [diff] [blame] | 44 | int nftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len, |
| 45 | size_t *retlen, uint8_t *buf); |
| 46 | int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len, |
| 47 | size_t *retlen, uint8_t *buf); |
| 48 | |
William Juul | cfa460a | 2007-10-31 13:53:06 +0100 | [diff] [blame] | 49 | #ifndef NFTL_MAJOR |
| 50 | #define NFTL_MAJOR 93 |
| 51 | #endif |
| 52 | |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 53 | #define MAX_NFTLS 16 |
William Juul | cfa460a | 2007-10-31 13:53:06 +0100 | [diff] [blame] | 54 | #define MAX_SECTORS_PER_UNIT 64 |
wdenk | a1e329b | 2002-01-26 00:07:42 +0000 | [diff] [blame] | 55 | #define NFTL_PARTN_BITS 4 |
| 56 | |
| 57 | #endif /* __MTD_NFTL_H__ */ |