diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2001-01-10 05:27:25 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2001-01-10 05:27:25 +0000 |
commit | c9c06167e7933d93a6e396174c68abf242294abb (patch) | |
tree | d9a8bb30663e9a3405a1ef37ffb62bc14b9f019f /include/linux/mtd | |
parent | f79e8cc3c34e4192a3e5ef4cc9c6542fdef703c0 (diff) |
Merge with Linux 2.4.0-test12.
Diffstat (limited to 'include/linux/mtd')
-rw-r--r-- | include/linux/mtd/cfi.h | 3 | ||||
-rw-r--r-- | include/linux/mtd/doc2000.h | 34 | ||||
-rw-r--r-- | include/linux/mtd/map.h | 19 | ||||
-rw-r--r-- | include/linux/mtd/mtd.h | 50 | ||||
-rw-r--r-- | include/linux/mtd/nand.h | 169 | ||||
-rw-r--r-- | include/linux/mtd/nand_ids.h | 52 | ||||
-rw-r--r-- | include/linux/mtd/nftl.h | 44 | ||||
-rw-r--r-- | include/linux/mtd/partitions.h | 50 | ||||
-rw-r--r-- | include/linux/mtd/pmc551.h | 52 |
9 files changed, 372 insertions, 101 deletions
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index c8bdd1cd7..4ce69eee8 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h @@ -91,8 +91,9 @@ struct cfi_private { must be of the same type. */ int numchips; unsigned long chipshift; /* Because they're of the same type */ - struct flchip chips[0]; /* per-chip data structure for each chip */ const char *im_name; /* inter_module name for cmdset_setup */ + struct flchip chips[0]; /* per-chip data structure for each chip */ + /* do not add extra fields after "chips" */ }; #define MAX_CFI_CHIPS 8 /* Entirely arbitrary to avoid realloc() */ diff --git a/include/linux/mtd/doc2000.h b/include/linux/mtd/doc2000.h index 0ed87cdb4..696938aa1 100644 --- a/include/linux/mtd/doc2000.h +++ b/include/linux/mtd/doc2000.h @@ -2,7 +2,7 @@ /* Linux driver for Disk-On-Chip 2000 */ /* (c) 1999 Machine Vision Holdings, Inc. */ /* Author: David Woodhouse <dwmw2@mvhi.com> */ -/* $Id: doc2000.h,v 1.8 2000/07/10 15:46:29 dwmw2 Exp $ */ +/* $Id: doc2000.h,v 1.12 2000/11/03 12:43:43 dwmw2 Exp $ */ #ifndef __MTD_DOC2000_H__ #define __MTD_DOC2000_H__ @@ -44,16 +44,24 @@ * Others use readb/writeb */ #if defined(__arm__) -#define ReadDOC(adr, reg) ((unsigned char)(*(__u32 *)(((unsigned long)adr)+(DoC_##reg<<2)))) -#define WriteDOC(d, adr, reg) do{ *(__u32 *)(((unsigned long)adr)+(DoC_##reg<<2)) = (__u32)d} while(0) +#define ReadDOC_(adr, reg) ((unsigned char)(*(__u32 *)(((unsigned long)adr)+(reg<<2)))) +#define WriteDOC_(d, adr, reg) do{ *(__u32 *)(((unsigned long)adr)+(reg<<2)) = (__u32)d} while(0) #elif defined(__ppc__) -#define ReadDOC(adr, reg) ((unsigned char)(*(__u16 *)(((unsigned long)adr)+(DoC_##reg<<1)))) -#define WriteDOC(d, adr, reg) do{ *(__u16 *)(((unsigned long)adr)+(DoC_##reg<<1)) = (__u16)d} while(0) +#define ReadDOC_(adr, reg) ((unsigned char)(*(__u16 *)(((unsigned long)adr)+(reg<<1)))) +#define WriteDOC_(d, adr, reg) do{ *(__u16 *)(((unsigned long)adr)+(reg<<1)) = (__u16)d} while(0) #else -#define ReadDOC(adr, reg) readb(((unsigned long)adr) + DoC_##reg) -#define WriteDOC(d, adr, reg) writeb(d, ((unsigned long)adr) + DoC_##reg) +#define ReadDOC_(adr, reg) readb(((unsigned long)adr) + reg) +#define WriteDOC_(d, adr, reg) writeb(d, ((unsigned long)adr) + reg) #endif +#if defined(__i386__) +#define USE_MEMCPY +#endif + +/* These are provided to directly use the DoC_xxx defines */ +#define ReadDOC(adr, reg) ReadDOC_(adr,DoC_##reg) +#define WriteDOC(d, adr, reg) WriteDOC_(d,adr,DoC_##reg) + #define DOC_MODE_RESET 0 #define DOC_MODE_NORMAL 1 #define DOC_MODE_RESERVED1 2 @@ -80,9 +88,10 @@ #define DOC_TOGGLE_BIT 0x04 #define DOC_ECC_RESV 0x02 #define DOC_ECC_IGNORE 0x01 + /* We have to also set the reserved bit 1 for enable */ #define DOC_ECC_EN (DOC_ECC__EN | DOC_ECC_RESV) -#define DOC_ECC_DIS (DOC_ECC_IGNORE | DOC_ECC_RESV) +#define DOC_ECC_DIS (DOC_ECC_RESV) struct Nand { char floor, chip; @@ -97,15 +106,23 @@ struct Nand { #define MAX_FLOORS_MIL 4 #define MAX_CHIPS_MIL 1 +#define ADDR_COLUMN 1 +#define ADDR_PAGE 2 +#define ADDR_COLUMN_PAGE 3 + struct DiskOnChip { unsigned long physadr; unsigned long virtadr; unsigned long totlen; char ChipID; /* Type of DiskOnChip */ + int ioreg; unsigned long mfr; /* Flash IDs - only one type of flash per device */ unsigned long id; int chipshift; + char page256; + char pageadrlen; + unsigned long erasesize; int curfloor; int curchip; @@ -115,5 +132,6 @@ struct DiskOnChip { struct mtd_info *nextdoc; }; +int doc_decode_ecc(unsigned char sector[512], unsigned char ecc1[6]); #endif /* __MTD_DOC2000_H__ */ diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h index ebb41c973..705169800 100644 --- a/include/linux/mtd/map.h +++ b/include/linux/mtd/map.h @@ -1,6 +1,6 @@ /* Overhauled routines for dealing with different mmap regions of flash */ -/* $Id: map.h,v 1.5 2000/06/26 16:18:58 dwmw2 Exp $ */ +/* $Id: map.h,v 1.10 2000/12/04 13:18:33 dwmw2 Exp $ */ #ifndef __LINUX_MTD_MAP_H__ #define __LINUX_MTD_MAP_H__ @@ -42,6 +42,8 @@ struct map_info { void (*write16)(struct map_info *, __u16, unsigned long); void (*write32)(struct map_info *, __u32, unsigned long); void (*copy_to)(struct map_info *, unsigned long, const void *, ssize_t); + + void (*set_vpp)(int); /* We put these two here rather than a single void *map_priv, because we want mappers to be able to have quickly-accessible cache for the 'currently-mapped page' without the _extra_ @@ -54,6 +56,7 @@ struct map_info { const char *im_name; }; +#ifdef CONFIG_MODULES /* * Probe for the contents of a map device and make an MTD structure * if anything is recognised. Doesn't register it because the calling @@ -78,6 +81,18 @@ static inline struct mtd_info *do_map_probe(struct map_info *map, const char *fu #define do_jedec_probe(x) do_map_probe(x, "jedec_probe", "jedec_probe") #define do_ram_probe(x) do_map_probe(x, "map_ram_probe", "map_ram") #define do_rom_probe(x) do_map_probe(x, "map_rom_probe", "map_rom") +#else + /* without module support, call probe function directly */ +extern struct mtd_info *cfi_probe(struct map_info *); +extern struct mtd_info *jedec_probe(struct map_info *); +extern struct mtd_info *map_ram_probe(struct map_info *); +extern struct mtd_info *map_rom_probe(struct map_info *); + +#define do_cfi_probe(x) cfi_probe(x) +#define do_jedec_probe(x) jedec_probe(x) +#define do_ram_probe(x) map_ram_probe(x) +#define do_rom_probe(x) map_rom_probe(x) +#endif /* * Destroy an MTD device which was created for a map device. @@ -92,5 +107,7 @@ static inline void map_destroy(struct mtd_info *mtd) kfree(mtd); } +#define ENABLE_VPP(map) do { if(map->set_vpp) map->set_vpp(1); } while(0) +#define DISABLE_VPP(map) do { if(map->set_vpp) map->set_vpp(0); } while(0) #endif /* __LINUX_MTD_MAP_H__ */ diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index a7bc521c2..708f4f203 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -1,5 +1,5 @@ -/* $Id: mtd.h,v 1.17 2000/07/04 07:24:49 jgg Exp $ */ +/* $Id: mtd.h,v 1.26 2000/10/30 17:18:04 sjhill Exp $ */ #ifndef __MTD_MTD_H__ #define __MTD_MTD_H__ @@ -10,6 +10,7 @@ #include <linux/types.h> #include <linux/mtd/compatmac.h> #include <linux/module.h> +#include <linux/uio.h> #endif /* __KERNEL__ */ @@ -61,7 +62,8 @@ struct mtd_oob_buf { // Types of automatic ECC/Checksum available #define MTD_ECC_NONE 0 // No automatic ECC available -#define MTD_ECC_RS_DiskOnChip 1 // Automatic ECC on DiskOnChip +#define MTD_ECC_RS_DiskOnChip 1 // Automatic ECC on DiskOnChip +#define MTD_ECC_SW 2 // SW ECC for Toshiba & Samsung devices struct mtd_info_user { u_char type; @@ -78,6 +80,8 @@ struct mtd_info_user { #define MEMERASE _IOW('M', 2, struct erase_info_user) #define MEMWRITEOOB _IOWR('M', 3, struct mtd_oob_buf) #define MEMREADOOB _IOWR('M', 4, struct mtd_oob_buf) +#define MEMLOCK _IOW('M', 5, struct erase_info_user) +#define MEMUNLOCK _IOW('M', 6, struct erase_info_user) #ifndef __KERNEL__ @@ -123,6 +127,7 @@ struct mtd_info { // Kernel-only stuff starts here. char *name; + int index; u_long bank_size; @@ -144,9 +149,22 @@ struct mtd_info { int (*read_oob) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); int (*write_oob) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); - + + /* iovec-based read/write methods. We need these especially for NAND flash, + with its limited number of write cycles per erase. + NB: The 'count' parameter is the number of _vectors_, each of + which contains an (ofs, len) tuple. + */ + int (*readv) (struct mtd_info *mtd, struct iovec *vecs, unsigned long count, loff_t from, size_t *retlen); + int (*writev) (struct mtd_info *mtd, const struct iovec *vecs, unsigned long count, loff_t to, size_t *retlen); + + /* Sync */ void (*sync) (struct mtd_info *mtd); + /* Chip-supported device locking */ + int (*lock) (struct mtd_info *mtd, loff_t ofs, size_t len); + int (*unlock) (struct mtd_info *mtd, loff_t ofs, size_t len); + /* Power Management functions */ int (*suspend) (struct mtd_info *mtd); void (*resume) (struct mtd_info *mtd); @@ -198,20 +216,32 @@ extern int unregister_mtd_user (struct mtd_notifier *old); #define MTD_UNPOINT(mtd, arg) (*(mtd->unpoint))(mtd, (u_char *)arg) #define MTD_READ(mtd, args...) (*(mtd->read))(mtd, args) #define MTD_WRITE(mtd, args...) (*(mtd->write))(mtd, args) +#define MTD_READV(mtd, args...) (*(mtd->readv))(mtd, args) +#define MTD_WRITEV(mtd, args...) (*(mtd->writev))(mtd, args) +#define MTD_READECC(mtd, args...) (*(mtd->read_ecc))(mtd, args) +#define MTD_WRITEECC(mtd, args...) (*(mtd->write_ecc))(mtd, args) #define MTD_READOOB(mtd, args...) (*(mtd->read_oob))(mtd, args) #define MTD_WRITEOOB(mtd, args...) (*(mtd->write_oob))(mtd, args) #define MTD_SYNC(mtd) do { if (mtd->sync) (*(mtd->sync))(mtd); } while (0) #endif /* MTDC */ -/* Debugging macros */ - -#ifdef DEBUGLVL -#define DEBUG(n, args...) if (DEBUGLVL>(n)) printk(KERN_DEBUG args) -#else +/* + * Debugging macro and defines + */ +#define MTD_DEBUG_LEVEL0 (0) /* Quiet */ +#define MTD_DEBUG_LEVEL1 (1) /* Audible */ +#define MTD_DEBUG_LEVEL2 (2) /* Loud */ +#define MTD_DEBUG_LEVEL3 (3) /* Noisy */ + +#ifdef CONFIG_MTD_DEBUG +#define DEBUG(n, args...) \ + if (n <= CONFIG_MTD_DEBUG_VERBOSE) { \ + printk(KERN_INFO args); \ + } +#else /* CONFIG_MTD_DEBUG */ #define DEBUG(n, args...) -#endif +#endif /* CONFIG_MTD_DEBUG */ #endif /* __KERNEL__ */ - #endif /* __MTD_MTD_H__ */ diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 79ca1843c..8c678ab97 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -1,31 +1,154 @@ +/* + * linux/include/linux/mtd/nand.h + * + * Copyright (c) 2000 David Woodhouse <dwmw2@mvhi.com> + * Steven J. Hill <sjhill@cotw.com> + * + * $Id: nand.h,v 1.8 2000/10/30 17:16:17 sjhill Exp $ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Info: + * Contains standard defines and IDs for NAND flash devices + * + * Changelog: + * 01-31-2000 DMW Created + * 09-18-2000 SJH Moved structure out of the Disk-On-Chip drivers + * so it can be used by other NAND flash device + * drivers. I also changed the copyright since none + * of the original contents of this file are specific + * to DoC devices. David can whack me with a baseball + * bat later if I did something naughty. + * 10-11-2000 SJH Added private NAND flash structure for driver + * 10-24-2000 SJH Added prototype for 'nand_scan' function + */ +#ifndef __LINUX_MTD_NAND_H +#define __LINUX_MTD_NAND_H -/* Defines for NAND flash devices */ -/* (c) 1999 Machine Vision Holdings, Inc. */ -/* Author: David Woodhouse <dwmw2@mvhi.com> */ -/* $Id: nand.h,v 1.2 1999/08/17 22:57:08 dwmw2 Exp $ */ +#include <linux/config.h> +#include <linux/sched.h> -#ifndef __MTD_NAND_H__ -#define __MTD_NAND_H__ - -#define NAND_CMD_READ0 0 -#define NAND_CMD_READ1 1 -#define NAND_CMD_PAGEPROG 0x10 -#define NAND_CMD_READOOB 0x50 -#define NAND_CMD_ERASE1 0x60 -#define NAND_CMD_STATUS 0x70 -#define NAND_CMD_SEQIN 0x80 -#define NAND_CMD_READID 0x90 -#define NAND_CMD_ERASE2 0xd0 -#define NAND_CMD_RESET 0xff - -#define NAND_MFR_TOSHIBA 0x98 -#define NAND_MFR_SAMSUNG 0xec - - -#endif /* __MTD_NAND_H__ */ +/* + * Searches for a NAND device + */ +extern int nand_scan (struct mtd_info *mtd); +/* + * Standard NAND flash commands + */ +#define NAND_CMD_READ0 0 +#define NAND_CMD_READ1 1 +#define NAND_CMD_PAGEPROG 0x10 +#define NAND_CMD_READOOB 0x50 +#define NAND_CMD_ERASE1 0x60 +#define NAND_CMD_STATUS 0x70 +#define NAND_CMD_SEQIN 0x80 +#define NAND_CMD_READID 0x90 +#define NAND_CMD_ERASE2 0xd0 +#define NAND_CMD_RESET 0xff +/* + * Enumeration for NAND flash chip state + */ +typedef enum { + FL_READY, + FL_READING, + FL_WRITING, + FL_ERASING, + FL_SYNCING +} nand_state_t; +/* + * NAND Private Flash Chip Data + * + * Structure overview: + * + * IO_ADDR - address to access the 8 I/O lines to the flash device + * + * CTRL_ADDR - address where ALE, CLE and CE control bits are accessed + * + * CLE - location in control word for Command Latch Enable bit + * + * ALE - location in control word for Address Latch Enable bit + * + * NCE - location in control word for nChip Enable bit + * + * chip_lock - spinlock used to protect access to this structure + * + * wq - wait queue to sleep on if a NAND operation is in progress + * + * state - give the current state of the NAND device + * + * page_shift - number of address bits in a page (column address bits) + * + * data_buf - data buffer passed to/from MTD user modules + * + * ecc_code_buf - used only for holding calculated or read ECCs for + * a page read or written when ECC is in use + * + * reserved - padding to make structure fall on word boundary if + * when ECC is in use + */ +struct nand_chip { + unsigned long IO_ADDR; + unsigned long CTRL_ADDR; + unsigned int CLE; + unsigned int ALE; + unsigned int NCE; + spinlock_t chip_lock; + wait_queue_head_t wq; + nand_state_t state; + int page_shift; + u_char *data_buf; +#ifdef CONFIG_MTD_NAND_ECC + u_char ecc_code_buf[6]; + u_char reserved[2]; +#endif +}; +/* + * NAND Flash Manufacturer ID Codes + */ +#define NAND_MFR_TOSHIBA 0x98 +#define NAND_MFR_SAMSUNG 0xec +/* + * NAND Flash Device ID Structure + * + * Structure overview: + * + * name - Complete name of device + * + * manufacture_id - manufacturer ID code of device. + * + * model_id - model ID code of device. + * + * chipshift - total number of address bits for the device which + * is used to calculate address offsets and the total + * number of bytes the device is capable of. + * + * page256 - denotes if flash device has 256 byte pages or not. + * + * pageadrlen - number of bytes minus one needed to hold the + * complete address into the flash array. Keep in + * mind that when a read or write is done to a + * specific address, the address is input serially + * 8 bits at a time. This structure member is used + * by the read/write routines as a loop index for + * shifting the address out 8 bits at a time. + * + * erasesize - size of an erase block in the flash device. + */ +struct nand_flash_dev { + char * name; + int manufacture_id; + int model_id; + int chipshift; + char page256; + char pageadrlen; + unsigned long erasesize; +}; +#endif /* __LINUX_MTD_NAND_H */ diff --git a/include/linux/mtd/nand_ids.h b/include/linux/mtd/nand_ids.h new file mode 100644 index 000000000..0918b8c1e --- /dev/null +++ b/include/linux/mtd/nand_ids.h @@ -0,0 +1,52 @@ +/* + * linux/include/linux/mtd/nand_ids.h + * + * Copyright (c) 2000 David Woodhouse <dwmw2@mvhi.com> + * Steven J. Hill <sjhill@cotw.com> + * + * $Id: nand_ids.h,v 1.1 2000/10/13 16:16:26 mdeans Exp $ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Info: + * Contains standard defines and IDs for NAND flash devices + * + * Changelog: + * 01-31-2000 DMW Created + * 09-18-2000 SJH Moved structure out of the Disk-On-Chip drivers + * so it can be used by other NAND flash device + * drivers. I also changed the copyright since none + * of the original contents of this file are specific + * to DoC devices. David can whack me with a baseball + * bat later if I did something naughty. + * 10-11-2000 SJH Added private NAND flash structure for driver + * 2000-10-13 BE Moved out of 'nand.h' - avoids duplication. + */ + +#ifndef __LINUX_MTD_NAND_IDS_H +#define __LINUX_MTD_NAND_IDS_H + +static struct nand_flash_dev nand_flash_ids[] = { + {"Toshiba TC5816BDC", NAND_MFR_TOSHIBA, 0x64, 21, 1, 2, 0x1000}, + {"Toshiba TC5832DC", NAND_MFR_TOSHIBA, 0x6b, 22, 0, 2, 0x2000}, + {"Toshiba TH58V128DC", NAND_MFR_TOSHIBA, 0x73, 24, 0, 2, 0x4000}, + {"Toshiba TC58256FT/DC", NAND_MFR_TOSHIBA, 0x75, 25, 0, 2, 0x4000}, + {"Toshiba TH58512FT", NAND_MFR_TOSHIBA, 0x76, 26, 0, 3, 0x4000}, + {"Toshiba TC58V32DC", NAND_MFR_TOSHIBA, 0xe5, 22, 0, 2, 0x2000}, + {"Toshiba TC58V64AFT/DC", NAND_MFR_TOSHIBA, 0xe6, 23, 0, 2, 0x2000}, + {"Toshiba TC58V16BDC", NAND_MFR_TOSHIBA, 0xea, 21, 1, 2, 0x1000}, + {"Samsung KM29N16000", NAND_MFR_SAMSUNG, 0x64, 21, 1, 2, 0x1000}, + {"Samsung unknown 4Mb", NAND_MFR_SAMSUNG, 0x6b, 22, 0, 2, 0x2000}, + {"Samsung KM29U128T", NAND_MFR_SAMSUNG, 0x73, 24, 0, 2, 0x4000}, + {"Samsung KM29U256T", NAND_MFR_SAMSUNG, 0x75, 25, 0, 2, 0x4000}, + {"Samsung unknown 64Mb", NAND_MFR_SAMSUNG, 0x76, 26, 0, 3, 0x4000}, + {"Samsung KM29W32000", NAND_MFR_SAMSUNG, 0xe3, 22, 0, 2, 0x2000}, + {"Samsung unknown 4Mb", NAND_MFR_SAMSUNG, 0xe5, 22, 0, 2, 0x2000}, + {"Samsung KM29U64000", NAND_MFR_SAMSUNG, 0xe6, 23, 0, 2, 0x2000}, + {"Samsung KM29W16000", NAND_MFR_SAMSUNG, 0xea, 21, 1, 2, 0x1000}, + {NULL,} +}; + +#endif /* __LINUX_MTD_NAND_IDS_H */ diff --git a/include/linux/mtd/nftl.h b/include/linux/mtd/nftl.h index 153fa5c6a..ae00ceb0b 100644 --- a/include/linux/mtd/nftl.h +++ b/include/linux/mtd/nftl.h @@ -2,18 +2,21 @@ /* Defines for NAND Flash Translation Layer */ /* (c) 1999 Machine Vision Holdings, Inc. */ /* Author: David Woodhouse <dwmw2@mvhi.com> */ -/* $Id: nftl.h,v 1.6 2000/03/31 15:12:20 dwmw2 Exp $ */ +/* $Id: nftl.h,v 1.9 2000/11/07 05:48:49 ollie Exp $ */ #ifndef __MTD_NFTL_H__ #define __MTD_NFTL_H__ +#ifndef __BOOT__ #include <linux/mtd/mtd.h> +#endif /* Block Control Information */ struct nftl_bci { unsigned char ECCSig[6]; - __u16 Status; + __u8 Status; + __u8 Status1; }__attribute__((packed)); /* Unit Control Information */ @@ -32,7 +35,8 @@ struct nftl_uci1 { } __attribute__((packed)); struct nftl_uci2 { - __u32 WriteInh; + __u16 FoldMark; + __u16 FoldMark1; __u32 unused; } __attribute__((packed)); @@ -60,10 +64,12 @@ struct NFTLMediaHeader { #define MAX_ERASE_ZONES (8192 - 512) #define ERASE_MARK 0x3c69 -#define BLOCK_FREE 0xffff -#define BLOCK_USED 0x5555 -#define BLOCK_IGNORE 0x1111 -#define BLOCK_DELETED 0x0000 +#define SECTOR_FREE 0xff +#define SECTOR_USED 0x55 +#define SECTOR_IGNORE 0x11 +#define SECTOR_DELETED 0x00 + +#define FOLD_MARK_IN_PROGRESS 0x5555 #define ZONE_GOOD 0xff #define ZONE_BAD_ORIGINAL 0 @@ -71,6 +77,11 @@ struct NFTLMediaHeader { #ifdef __KERNEL__ +/* these info are used in ReplUnitTable */ +#define BLOCK_NIL 0xffff /* last block of a chain */ +#define BLOCK_FREE 0xfffe /* free block */ +#define BLOCK_NOTEXPLORED 0xfffd /* non explored block, only used during mounting */ +#define BLOCK_RESERVED 0xfffc /* bios block or bad block */ struct NFTLrecord { struct mtd_info *mtd; @@ -83,18 +94,27 @@ struct NFTLrecord { unsigned char sectors; unsigned short cylinders; __u16 numvunits; - __u16 lastEUN; + __u16 lastEUN; /* should be suppressed */ __u16 numfreeEUNs; - __u16 LastFreeEUN; /* To speed up finding a free EUN */ + __u16 LastFreeEUN; /* To speed up finding a free EUN */ __u32 long nr_sects; int head,sect,cyl; - __u16 *EUNtable; /* [numvunits]: First EUN for each virtual unit */ - __u16 *VirtualUnitTable; /* [numEUNs]: VirtualUnitNumber for each */ - __u16 *ReplUnitTable; /* [numEUNs]: ReplUnitNumber for each */ + __u16 *EUNtable; /* [numvunits]: First EUN for each virtual unit */ + __u16 *ReplUnitTable; /* [numEUNs]: ReplUnitNumber for each */ + unsigned int nb_blocks; /* number of physical blocks */ + unsigned int nb_boot_blocks; /* number of blocks used by the bios */ + struct erase_info instr; }; +int NFTL_mount(struct NFTLrecord *s); +int NFTL_formatblock(struct NFTLrecord *s, int block); + +#ifndef NFTL_MAJOR #define NFTL_MAJOR 93 +#endif + #define MAX_NFTLS 16 +#define MAX_SECTORS_PER_UNIT 32 #endif /* __KERNEL__ */ diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h new file mode 100644 index 000000000..a92023886 --- /dev/null +++ b/include/linux/mtd/partitions.h @@ -0,0 +1,50 @@ +/* + * MTD partitioning layer definitions + * + * (C) 2000 Nicolas Pitre <nico@cam.org> + * + * This code is GPL + * + * $Id: partitions.h,v 1.3 2000/11/10 23:35:12 nico Exp $ + */ + +#ifndef MTD_PARTITIONS_H +#define MTD_PARTITIONS_H + +#include <linux/types.h> + + +/* + * Partition definition structure: + * + * An array of struct partition is passed along with a MTD object to + * add_mtd_partitions() to create them. + * + * For each partition, these fields are available: + * name: string that will be used to label the partition's MTD device. + * size: the partition size; if 0, the partition will extend to the end of the + * master MTD device. + * offset: absolute starting position within the master MTD device; if 0, + * partition will start where the previous one ended. + * mask_flags: contains flags that have to be masked (removed) from the + * master MTD flag set for the corresponding MTD partition. + * For example, to force a read-only partition, simply adding + * MTD_WRITEABLE to the mask_flags will do the trick. + * + * Note: writeable partitions require their size and offset be + * erasesize aligned. + */ + +struct mtd_partition { + char *name; /* identifier string */ + u_long size; /* partition size */ + u_long offset; /* offset within the master MTD space */ + u_long mask_flags; /* master MTD flags to mask out for this partition */ +}; + + +int add_mtd_partitions(struct mtd_info *, struct mtd_partition *, int); +int del_mtd_partitions(struct mtd_info *); + +#endif + diff --git a/include/linux/mtd/pmc551.h b/include/linux/mtd/pmc551.h index 05c506516..144eb922a 100644 --- a/include/linux/mtd/pmc551.h +++ b/include/linux/mtd/pmc551.h @@ -1,5 +1,5 @@ /* - * $Id: pmc551.h,v 1.2 2000/03/31 14:40:42 dwmw2 Exp $ + * $Id: pmc551.h,v 1.3 2000/10/30 20:03:23 major Exp $ * * PMC551 PCI Mezzanine Ram Device * @@ -17,6 +17,9 @@ #include <linux/mtd/mtd.h> +#define PMC551_VERSION "$Id: pmc551.h,v 1.3 2000/10/30 20:03:23 major Exp $\n"\ + "Ramix PMC551 PCI Mezzanine Ram Driver. (C) 1999,2000 Nortel Networks.\n" + /* * Our personal and private information */ @@ -54,68 +57,25 @@ static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_cha #define PMC551_PCI_MEM_MAP1 0x54 #define PMC551_PCI_MEM_MAP_MAP_ADDR_MASK 0x3ff00000 #define PMC551_PCI_MEM_MAP_APERTURE_MASK 0x000000f0 -#define PMC551_PCI_MEM_MAP_1MB_APERTURE 0x00000000 -#define PMC551_PCI_MEM_MAP_2MB_APERTURE 0x00000010 -#define PMC551_PCI_MEM_MAP_REG_EN 0x00000002 -#define PMC551_PCI_MEM_MAP_ENABLE 0x00000001 - -#define PMC551_SDRAM_MA 0x60 -#define PMC551_SDRAM_CMD 0x62 -#define PMC551_DRAM_CFG 0x64 - -#define PMC551_DRAM_BLK0 0x68 -#define PMC551_DRAM_BLK1 0x6c -#define PMC551_DRAM_BLK2 0x70 -#define PMC551_DRAM_BLK3 0x74 -#define PMC551_DRAM_BLK_GET_SIZE(x) ((512 * 1024) << ((x >> 4) & 0xf)) -#define PMC551_DRAM_BLK_SET_COL_MUX(x,v) (((x) & ~0x00007000) | (((v) & 0x7) << 12)) -#define PMC551_DRAM_BLK_SET_ROW_MUX(x,v) (((x) & ~0x00000f00) | (((v) & 0xf) << 8)) - - -/* Use a 1MB apeture into the card. */ -#define PMC551_APERTURE_SIZE 0x00100000 -#define PMC551_ADDR_HIGH_MASK 0x3ff00000 -#define PMC551_ADDR_LOW_MASK 0x000fffff -#define PMC551_APERTURE_VAL PMC551_PCI_MEM_MAP_1MB_APERTURE -/* - * Define the PCI ID's if the kernel doesn't define them for us - */ -#ifndef PCI_VENDOR_ID_V3_SEMI -#define PCI_VENDOR_ID_V3_SEMI 0x11b0 -#endif - -#ifndef PCI_DEVICE_ID_V3_SEMI_V370PDC -#define PCI_DEVICE_ID_V3_SEMI_V370PDC 0x0200 -#endif - - -#define PMC551_PCI_MEM_MAP0 0x50 -#define PMC551_PCI_MEM_MAP1 0x54 -#define PMC551_PCI_MEM_MAP_MAP_ADDR_MASK 0x3ff00000 -#define PMC551_PCI_MEM_MAP_APERTURE_MASK 0x000000f0 -#define PMC551_PCI_MEM_MAP_1MB_APERTURE 0x00000000 -#define PMC551_PCI_MEM_MAP_2MB_APERTURE 0x00000010 #define PMC551_PCI_MEM_MAP_REG_EN 0x00000002 #define PMC551_PCI_MEM_MAP_ENABLE 0x00000001 #define PMC551_SDRAM_MA 0x60 #define PMC551_SDRAM_CMD 0x62 #define PMC551_DRAM_CFG 0x64 +#define PMC551_SYS_CTRL_REG 0x78 #define PMC551_DRAM_BLK0 0x68 #define PMC551_DRAM_BLK1 0x6c #define PMC551_DRAM_BLK2 0x70 #define PMC551_DRAM_BLK3 0x74 -#define PMC551_DRAM_BLK_GET_SIZE(x) ((512 * 1024) << ((x >> 4) & 0xf)) +#define PMC551_DRAM_BLK_GET_SIZE(x) (524288<<((x>>4)&0x0f)) #define PMC551_DRAM_BLK_SET_COL_MUX(x,v) (((x) & ~0x00007000) | (((v) & 0x7) << 12)) #define PMC551_DRAM_BLK_SET_ROW_MUX(x,v) (((x) & ~0x00000f00) | (((v) & 0xf) << 8)) -/* Use a 1MB apeture into the card. */ -#define PMC551_APERTURE_SIZE 0x00100000 #define PMC551_ADDR_HIGH_MASK 0x3ff00000 #define PMC551_ADDR_LOW_MASK 0x000fffff -#define PMC551_APERTURE_VAL PMC551_PCI_MEM_MAP_1MB_APERTURE #endif /* __MTD_PMC551_H__ */ |