diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-07-27 22:07:53 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-07-27 22:07:53 +0000 |
commit | 4fbe7358c7747a9165f776eb19addbb9baf7def2 (patch) | |
tree | bc7076b4f6d10c2cc2942539bb666e50f0b66954 /libdde_linux26/contrib/include/linux/mtd | |
parent | 21adb5284111190057db245cfc2b54091920c373 (diff) |
rename libdde_linux26 into libdde-linux26 to make dpkg-source happy
Diffstat (limited to 'libdde_linux26/contrib/include/linux/mtd')
32 files changed, 0 insertions, 4183 deletions
diff --git a/libdde_linux26/contrib/include/linux/mtd/bbm.h b/libdde_linux26/contrib/include/linux/mtd/bbm.h deleted file mode 100644 index fff8c53e..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/bbm.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * linux/include/linux/mtd/bbm.h - * - * NAND family Bad Block Management (BBM) header file - * - Bad Block Table (BBT) implementation - * - * Copyright (c) 2005 Samsung Electronics - * Kyungmin Park <kyungmin.park@samsung.com> - * - * Copyright (c) 2000-2005 - * Thomas Gleixner <tglx@linuxtronix.de> - * - */ -#ifndef __LINUX_MTD_BBM_H -#define __LINUX_MTD_BBM_H - -/* The maximum number of NAND chips in an array */ -#define NAND_MAX_CHIPS 8 - -/** - * struct nand_bbt_descr - bad block table descriptor - * @options: options for this descriptor - * @pages: the page(s) where we find the bbt, used with - * option BBT_ABSPAGE when bbt is searched, - * then we store the found bbts pages here. - * Its an array and supports up to 8 chips now - * @offs: offset of the pattern in the oob area of the page - * @veroffs: offset of the bbt version counter in the oob area of the page - * @version: version read from the bbt page during scan - * @len: length of the pattern, if 0 no pattern check is performed - * @maxblocks: maximum number of blocks to search for a bbt. This - * number of blocks is reserved at the end of the device - * where the tables are written. - * @reserved_block_code: if non-0, this pattern denotes a reserved - * (rather than bad) block in the stored bbt - * @pattern: pattern to identify bad block table or factory marked - * good / bad blocks, can be NULL, if len = 0 - * - * Descriptor for the bad block table marker and the descriptor for the - * pattern which identifies good and bad blocks. The assumption is made - * that the pattern and the version count are always located in the oob area - * of the first block. - */ -struct nand_bbt_descr { - int options; - int pages[NAND_MAX_CHIPS]; - int offs; - int veroffs; - uint8_t version[NAND_MAX_CHIPS]; - int len; - int maxblocks; - int reserved_block_code; - uint8_t *pattern; -}; - -/* Options for the bad block table descriptors */ - -/* The number of bits used per block in the bbt on the device */ -#define NAND_BBT_NRBITS_MSK 0x0000000F -#define NAND_BBT_1BIT 0x00000001 -#define NAND_BBT_2BIT 0x00000002 -#define NAND_BBT_4BIT 0x00000004 -#define NAND_BBT_8BIT 0x00000008 -/* The bad block table is in the last good block of the device */ -#define NAND_BBT_LASTBLOCK 0x00000010 -/* The bbt is at the given page, else we must scan for the bbt */ -#define NAND_BBT_ABSPAGE 0x00000020 -/* The bbt is at the given page, else we must scan for the bbt */ -#define NAND_BBT_SEARCH 0x00000040 -/* bbt is stored per chip on multichip devices */ -#define NAND_BBT_PERCHIP 0x00000080 -/* bbt has a version counter at offset veroffs */ -#define NAND_BBT_VERSION 0x00000100 -/* Create a bbt if none axists */ -#define NAND_BBT_CREATE 0x00000200 -/* Search good / bad pattern through all pages of a block */ -#define NAND_BBT_SCANALLPAGES 0x00000400 -/* Scan block empty during good / bad block scan */ -#define NAND_BBT_SCANEMPTY 0x00000800 -/* Write bbt if neccecary */ -#define NAND_BBT_WRITE 0x00001000 -/* Read and write back block contents when writing bbt */ -#define NAND_BBT_SAVECONTENT 0x00002000 -/* Search good / bad pattern on the first and the second page */ -#define NAND_BBT_SCAN2NDPAGE 0x00004000 - -/* The maximum number of blocks to scan for a bbt */ -#define NAND_BBT_SCAN_MAXBLOCKS 4 - -/* - * Constants for oob configuration - */ -#define ONENAND_BADBLOCK_POS 0 - -/* - * Bad block scanning errors - */ -#define ONENAND_BBT_READ_ERROR 1 -#define ONENAND_BBT_READ_ECC_ERROR 2 -#define ONENAND_BBT_READ_FATAL_ERROR 4 - -/** - * struct bbm_info - [GENERIC] Bad Block Table data structure - * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry - * @badblockpos: [INTERN] position of the bad block marker in the oob area - * @options: options for this descriptor - * @bbt: [INTERN] bad block table pointer - * @isbad_bbt: function to determine if a block is bad - * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for - * initial bad block scan - * @priv: [OPTIONAL] pointer to private bbm date - */ -struct bbm_info { - int bbt_erase_shift; - int badblockpos; - int options; - - uint8_t *bbt; - - int (*isbad_bbt)(struct mtd_info *mtd, loff_t ofs, int allowbbt); - - /* TODO Add more NAND specific fileds */ - struct nand_bbt_descr *badblock_pattern; - - void *priv; -}; - -/* OneNAND BBT interface */ -extern int onenand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd); -extern int onenand_default_bbt(struct mtd_info *mtd); - -#endif /* __LINUX_MTD_BBM_H */ diff --git a/libdde_linux26/contrib/include/linux/mtd/blktrans.h b/libdde_linux26/contrib/include/linux/mtd/blktrans.h deleted file mode 100644 index 8b4aa052..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/blktrans.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * (C) 2003 David Woodhouse <dwmw2@infradead.org> - * - * Interface to Linux block layer for MTD 'translation layers'. - * - */ - -#ifndef __MTD_TRANS_H__ -#define __MTD_TRANS_H__ - -#include <linux/mutex.h> - -struct hd_geometry; -struct mtd_info; -struct mtd_blktrans_ops; -struct file; -struct inode; - -struct mtd_blktrans_dev { - struct mtd_blktrans_ops *tr; - struct list_head list; - struct mtd_info *mtd; - struct mutex lock; - int devnum; - unsigned long size; - int readonly; - void *blkcore_priv; /* gendisk in 2.5, devfs_handle in 2.4 */ -}; - -struct blkcore_priv; /* Differs for 2.4 and 2.5 kernels; private */ - -struct mtd_blktrans_ops { - char *name; - int major; - int part_bits; - int blksize; - int blkshift; - - /* Access functions */ - int (*readsect)(struct mtd_blktrans_dev *dev, - unsigned long block, char *buffer); - int (*writesect)(struct mtd_blktrans_dev *dev, - unsigned long block, char *buffer); - int (*discard)(struct mtd_blktrans_dev *dev, - unsigned long block, unsigned nr_blocks); - - /* Block layer ioctls */ - int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo); - int (*flush)(struct mtd_blktrans_dev *dev); - - /* Called with mtd_table_mutex held; no race with add/remove */ - int (*open)(struct mtd_blktrans_dev *dev); - int (*release)(struct mtd_blktrans_dev *dev); - - /* Called on {de,}registration and on subsequent addition/removal - of devices, with mtd_table_mutex held. */ - void (*add_mtd)(struct mtd_blktrans_ops *tr, struct mtd_info *mtd); - void (*remove_dev)(struct mtd_blktrans_dev *dev); - - struct list_head devs; - struct list_head list; - struct module *owner; - - struct mtd_blkcore_priv *blkcore_priv; -}; - -extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr); -extern int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr); -extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev); -extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev); - - -#endif /* __MTD_TRANS_H__ */ diff --git a/libdde_linux26/contrib/include/linux/mtd/cfi.h b/libdde_linux26/contrib/include/linux/mtd/cfi.h deleted file mode 100644 index 88d3d8fb..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/cfi.h +++ /dev/null @@ -1,535 +0,0 @@ - -/* Common Flash Interface structures - * See http://support.intel.com/design/flash/technote/index.htm - */ - -#ifndef __MTD_CFI_H__ -#define __MTD_CFI_H__ - -#include <linux/delay.h> -#include <linux/types.h> -#include <linux/interrupt.h> -#include <linux/mtd/flashchip.h> -#include <linux/mtd/map.h> -#include <linux/mtd/cfi_endian.h> -#include <linux/mtd/xip.h> - -#ifdef CONFIG_MTD_CFI_I1 -#define cfi_interleave(cfi) 1 -#define cfi_interleave_is_1(cfi) (cfi_interleave(cfi) == 1) -#else -#define cfi_interleave_is_1(cfi) (0) -#endif - -#ifdef CONFIG_MTD_CFI_I2 -# ifdef cfi_interleave -# undef cfi_interleave -# define cfi_interleave(cfi) ((cfi)->interleave) -# else -# define cfi_interleave(cfi) 2 -# endif -#define cfi_interleave_is_2(cfi) (cfi_interleave(cfi) == 2) -#else -#define cfi_interleave_is_2(cfi) (0) -#endif - -#ifdef CONFIG_MTD_CFI_I4 -# ifdef cfi_interleave -# undef cfi_interleave -# define cfi_interleave(cfi) ((cfi)->interleave) -# else -# define cfi_interleave(cfi) 4 -# endif -#define cfi_interleave_is_4(cfi) (cfi_interleave(cfi) == 4) -#else -#define cfi_interleave_is_4(cfi) (0) -#endif - -#ifdef CONFIG_MTD_CFI_I8 -# ifdef cfi_interleave -# undef cfi_interleave -# define cfi_interleave(cfi) ((cfi)->interleave) -# else -# define cfi_interleave(cfi) 8 -# endif -#define cfi_interleave_is_8(cfi) (cfi_interleave(cfi) == 8) -#else -#define cfi_interleave_is_8(cfi) (0) -#endif - -#ifndef cfi_interleave -#warning No CONFIG_MTD_CFI_Ix selected. No NOR chip support can work. -static inline int cfi_interleave(void *cfi) -{ - BUG(); - return 0; -} -#endif - -static inline int cfi_interleave_supported(int i) -{ - switch (i) { -#ifdef CONFIG_MTD_CFI_I1 - case 1: -#endif -#ifdef CONFIG_MTD_CFI_I2 - case 2: -#endif -#ifdef CONFIG_MTD_CFI_I4 - case 4: -#endif -#ifdef CONFIG_MTD_CFI_I8 - case 8: -#endif - return 1; - - default: - return 0; - } -} - - -/* NB: these values must represents the number of bytes needed to meet the - * device type (x8, x16, x32). Eg. a 32 bit device is 4 x 8 bytes. - * These numbers are used in calculations. - */ -#define CFI_DEVICETYPE_X8 (8 / 8) -#define CFI_DEVICETYPE_X16 (16 / 8) -#define CFI_DEVICETYPE_X32 (32 / 8) -#define CFI_DEVICETYPE_X64 (64 / 8) - - -/* Device Interface Code Assignments from the "Common Flash Memory Interface - * Publication 100" dated December 1, 2001. - */ -#define CFI_INTERFACE_X8_ASYNC 0x0000 -#define CFI_INTERFACE_X16_ASYNC 0x0001 -#define CFI_INTERFACE_X8_BY_X16_ASYNC 0x0002 -#define CFI_INTERFACE_X32_ASYNC 0x0003 -#define CFI_INTERFACE_X16_BY_X32_ASYNC 0x0005 -#define CFI_INTERFACE_NOT_ALLOWED 0xffff - - -/* NB: We keep these structures in memory in HOST byteorder, except - * where individually noted. - */ - -/* Basic Query Structure */ -struct cfi_ident { - uint8_t qry[3]; - uint16_t P_ID; - uint16_t P_ADR; - uint16_t A_ID; - uint16_t A_ADR; - uint8_t VccMin; - uint8_t VccMax; - uint8_t VppMin; - uint8_t VppMax; - uint8_t WordWriteTimeoutTyp; - uint8_t BufWriteTimeoutTyp; - uint8_t BlockEraseTimeoutTyp; - uint8_t ChipEraseTimeoutTyp; - uint8_t WordWriteTimeoutMax; - uint8_t BufWriteTimeoutMax; - uint8_t BlockEraseTimeoutMax; - uint8_t ChipEraseTimeoutMax; - uint8_t DevSize; - uint16_t InterfaceDesc; - uint16_t MaxBufWriteSize; - uint8_t NumEraseRegions; - uint32_t EraseRegionInfo[0]; /* Not host ordered */ -} __attribute__((packed)); - -/* Extended Query Structure for both PRI and ALT */ - -struct cfi_extquery { - uint8_t pri[3]; - uint8_t MajorVersion; - uint8_t MinorVersion; -} __attribute__((packed)); - -/* Vendor-Specific PRI for Intel/Sharp Extended Command Set (0x0001) */ - -struct cfi_pri_intelext { - uint8_t pri[3]; - uint8_t MajorVersion; - uint8_t MinorVersion; - uint32_t FeatureSupport; /* if bit 31 is set then an additional uint32_t feature - block follows - FIXME - not currently supported */ - uint8_t SuspendCmdSupport; - uint16_t BlkStatusRegMask; - uint8_t VccOptimal; - uint8_t VppOptimal; - uint8_t NumProtectionFields; - uint16_t ProtRegAddr; - uint8_t FactProtRegSize; - uint8_t UserProtRegSize; - uint8_t extra[0]; -} __attribute__((packed)); - -struct cfi_intelext_otpinfo { - uint32_t ProtRegAddr; - uint16_t FactGroups; - uint8_t FactProtRegSize; - uint16_t UserGroups; - uint8_t UserProtRegSize; -} __attribute__((packed)); - -struct cfi_intelext_blockinfo { - uint16_t NumIdentBlocks; - uint16_t BlockSize; - uint16_t MinBlockEraseCycles; - uint8_t BitsPerCell; - uint8_t BlockCap; -} __attribute__((packed)); - -struct cfi_intelext_regioninfo { - uint16_t NumIdentPartitions; - uint8_t NumOpAllowed; - uint8_t NumOpAllowedSimProgMode; - uint8_t NumOpAllowedSimEraMode; - uint8_t NumBlockTypes; - struct cfi_intelext_blockinfo BlockTypes[1]; -} __attribute__((packed)); - -struct cfi_intelext_programming_regioninfo { - uint8_t ProgRegShift; - uint8_t Reserved1; - uint8_t ControlValid; - uint8_t Reserved2; - uint8_t ControlInvalid; - uint8_t Reserved3; -} __attribute__((packed)); - -/* Vendor-Specific PRI for AMD/Fujitsu Extended Command Set (0x0002) */ - -struct cfi_pri_amdstd { - uint8_t pri[3]; - uint8_t MajorVersion; - uint8_t MinorVersion; - uint8_t SiliconRevision; /* bits 1-0: Address Sensitive Unlock */ - uint8_t EraseSuspend; - uint8_t BlkProt; - uint8_t TmpBlkUnprotect; - uint8_t BlkProtUnprot; - uint8_t SimultaneousOps; - uint8_t BurstMode; - uint8_t PageMode; - uint8_t VppMin; - uint8_t VppMax; - uint8_t TopBottom; -} __attribute__((packed)); - -/* Vendor-Specific PRI for Atmel chips (command set 0x0002) */ - -struct cfi_pri_atmel { - uint8_t pri[3]; - uint8_t MajorVersion; - uint8_t MinorVersion; - uint8_t Features; - uint8_t BottomBoot; - uint8_t BurstMode; - uint8_t PageMode; -} __attribute__((packed)); - -struct cfi_pri_query { - uint8_t NumFields; - uint32_t ProtField[1]; /* Not host ordered */ -} __attribute__((packed)); - -struct cfi_bri_query { - uint8_t PageModeReadCap; - uint8_t NumFields; - uint32_t ConfField[1]; /* Not host ordered */ -} __attribute__((packed)); - -#define P_ID_NONE 0x0000 -#define P_ID_INTEL_EXT 0x0001 -#define P_ID_AMD_STD 0x0002 -#define P_ID_INTEL_STD 0x0003 -#define P_ID_AMD_EXT 0x0004 -#define P_ID_WINBOND 0x0006 -#define P_ID_ST_ADV 0x0020 -#define P_ID_MITSUBISHI_STD 0x0100 -#define P_ID_MITSUBISHI_EXT 0x0101 -#define P_ID_SST_PAGE 0x0102 -#define P_ID_INTEL_PERFORMANCE 0x0200 -#define P_ID_INTEL_DATA 0x0210 -#define P_ID_RESERVED 0xffff - - -#define CFI_MODE_CFI 1 -#define CFI_MODE_JEDEC 0 - -struct cfi_private { - uint16_t cmdset; - void *cmdset_priv; - int interleave; - int device_type; - int cfi_mode; /* Are we a JEDEC device pretending to be CFI? */ - int addr_unlock1; - int addr_unlock2; - struct mtd_info *(*cmdset_setup)(struct map_info *); - struct cfi_ident *cfiq; /* For now only one. We insist that all devs - must be of the same type. */ - int mfr, id; - int numchips; - unsigned long chipshift; /* Because they're of the same type */ - const char *im_name; /* inter_module name for cmdset_setup */ - struct flchip chips[0]; /* per-chip data structure for each chip */ -}; - -/* - * Returns the command address according to the given geometry. - */ -static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs, - struct map_info *map, struct cfi_private *cfi) -{ - unsigned bankwidth = map_bankwidth(map); - unsigned interleave = cfi_interleave(cfi); - unsigned type = cfi->device_type; - uint32_t addr; - - addr = (cmd_ofs * type) * interleave; - - /* Modify the unlock address if we are in compatiblity mode. - * For 16bit devices on 8 bit busses - * and 32bit devices on 16 bit busses - * set the low bit of the alternating bit sequence of the address. - */ - if (((type * interleave) > bankwidth) && ((uint8_t)cmd_ofs == 0xaa)) - addr |= (type >> 1)*interleave; - - return addr; -} - -/* - * Transforms the CFI command for the given geometry (bus width & interleave). - * It looks too long to be inline, but in the common case it should almost all - * get optimised away. - */ -static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cfi_private *cfi) -{ - map_word val = { {0} }; - int wordwidth, words_per_bus, chip_mode, chips_per_word; - unsigned long onecmd; - int i; - - /* We do it this way to give the compiler a fighting chance - of optimising away all the crap for 'bankwidth' larger than - an unsigned long, in the common case where that support is - disabled */ - if (map_bankwidth_is_large(map)) { - wordwidth = sizeof(unsigned long); - words_per_bus = (map_bankwidth(map)) / wordwidth; // i.e. normally 1 - } else { - wordwidth = map_bankwidth(map); - words_per_bus = 1; - } - - chip_mode = map_bankwidth(map) / cfi_interleave(cfi); - chips_per_word = wordwidth * cfi_interleave(cfi) / map_bankwidth(map); - - /* First, determine what the bit-pattern should be for a single - device, according to chip mode and endianness... */ - switch (chip_mode) { - default: BUG(); - case 1: - onecmd = cmd; - break; - case 2: - onecmd = cpu_to_cfi16(cmd); - break; - case 4: - onecmd = cpu_to_cfi32(cmd); - break; - } - - /* Now replicate it across the size of an unsigned long, or - just to the bus width as appropriate */ - switch (chips_per_word) { - default: BUG(); -#if BITS_PER_LONG >= 64 - case 8: - onecmd |= (onecmd << (chip_mode * 32)); -#endif - case 4: - onecmd |= (onecmd << (chip_mode * 16)); - case 2: - onecmd |= (onecmd << (chip_mode * 8)); - case 1: - ; - } - - /* And finally, for the multi-word case, replicate it - in all words in the structure */ - for (i=0; i < words_per_bus; i++) { - val.x[i] = onecmd; - } - - return val; -} -#define CMD(x) cfi_build_cmd((x), map, cfi) - - -static inline unsigned long cfi_merge_status(map_word val, struct map_info *map, - struct cfi_private *cfi) -{ - int wordwidth, words_per_bus, chip_mode, chips_per_word; - unsigned long onestat, res = 0; - int i; - - /* We do it this way to give the compiler a fighting chance - of optimising away all the crap for 'bankwidth' larger than - an unsigned long, in the common case where that support is - disabled */ - if (map_bankwidth_is_large(map)) { - wordwidth = sizeof(unsigned long); - words_per_bus = (map_bankwidth(map)) / wordwidth; // i.e. normally 1 - } else { - wordwidth = map_bankwidth(map); - words_per_bus = 1; - } - - chip_mode = map_bankwidth(map) / cfi_interleave(cfi); - chips_per_word = wordwidth * cfi_interleave(cfi) / map_bankwidth(map); - - onestat = val.x[0]; - /* Or all status words together */ - for (i=1; i < words_per_bus; i++) { - onestat |= val.x[i]; - } - - res = onestat; - switch(chips_per_word) { - default: BUG(); -#if BITS_PER_LONG >= 64 - case 8: - res |= (onestat >> (chip_mode * 32)); -#endif - case 4: - res |= (onestat >> (chip_mode * 16)); - case 2: - res |= (onestat >> (chip_mode * 8)); - case 1: - ; - } - - /* Last, determine what the bit-pattern should be for a single - device, according to chip mode and endianness... */ - switch (chip_mode) { - case 1: - break; - case 2: - res = cfi16_to_cpu(res); - break; - case 4: - res = cfi32_to_cpu(res); - break; - default: BUG(); - } - return res; -} - -#define MERGESTATUS(x) cfi_merge_status((x), map, cfi) - - -/* - * Sends a CFI command to a bank of flash for the given geometry. - * - * Returns the offset in flash where the command was written. - * If prev_val is non-null, it will be set to the value at the command address, - * before the command was written. - */ -static inline uint32_t cfi_send_gen_cmd(u_char cmd, uint32_t cmd_addr, uint32_t base, - struct map_info *map, struct cfi_private *cfi, - int type, map_word *prev_val) -{ - map_word val; - uint32_t addr = base + cfi_build_cmd_addr(cmd_addr, map, cfi); - val = cfi_build_cmd(cmd, map, cfi); - - if (prev_val) - *prev_val = map_read(map, addr); - - map_write(map, val, addr); - - return addr - base; -} - -static inline uint8_t cfi_read_query(struct map_info *map, uint32_t addr) -{ - map_word val = map_read(map, addr); - - if (map_bankwidth_is_1(map)) { - return val.x[0]; - } else if (map_bankwidth_is_2(map)) { - return cfi16_to_cpu(val.x[0]); - } else { - /* No point in a 64-bit byteswap since that would just be - swapping the responses from different chips, and we are - only interested in one chip (a representative sample) */ - return cfi32_to_cpu(val.x[0]); - } -} - -static inline uint16_t cfi_read_query16(struct map_info *map, uint32_t addr) -{ - map_word val = map_read(map, addr); - - if (map_bankwidth_is_1(map)) { - return val.x[0] & 0xff; - } else if (map_bankwidth_is_2(map)) { - return cfi16_to_cpu(val.x[0]); - } else { - /* No point in a 64-bit byteswap since that would just be - swapping the responses from different chips, and we are - only interested in one chip (a representative sample) */ - return cfi32_to_cpu(val.x[0]); - } -} - -static inline void cfi_udelay(int us) -{ - if (us >= 1000) { - msleep((us+999)/1000); - } else { - udelay(us); - cond_resched(); - } -} - -int __xipram cfi_qry_present(struct map_info *map, __u32 base, - struct cfi_private *cfi); -int __xipram cfi_qry_mode_on(uint32_t base, struct map_info *map, - struct cfi_private *cfi); -void __xipram cfi_qry_mode_off(uint32_t base, struct map_info *map, - struct cfi_private *cfi); - -struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t size, - const char* name); -struct cfi_fixup { - uint16_t mfr; - uint16_t id; - void (*fixup)(struct mtd_info *mtd, void* param); - void* param; -}; - -#define CFI_MFR_ANY 0xffff -#define CFI_ID_ANY 0xffff - -#define CFI_MFR_AMD 0x0001 -#define CFI_MFR_ATMEL 0x001F -#define CFI_MFR_SAMSUNG 0x00EC -#define CFI_MFR_ST 0x0020 /* STMicroelectronics */ - -void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups); - -typedef int (*varsize_frob_t)(struct map_info *map, struct flchip *chip, - unsigned long adr, int len, void *thunk); - -int cfi_varsize_frob(struct mtd_info *mtd, varsize_frob_t frob, - loff_t ofs, size_t len, void *thunk); - - -#endif /* __MTD_CFI_H__ */ diff --git a/libdde_linux26/contrib/include/linux/mtd/cfi_endian.h b/libdde_linux26/contrib/include/linux/mtd/cfi_endian.h deleted file mode 100644 index d802f773..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/cfi_endian.h +++ /dev/null @@ -1,52 +0,0 @@ -#include <asm/byteorder.h> - -#ifndef CONFIG_MTD_CFI_ADV_OPTIONS - -#define CFI_HOST_ENDIAN - -#else - -#ifdef CONFIG_MTD_CFI_NOSWAP -#define CFI_HOST_ENDIAN -#endif - -#ifdef CONFIG_MTD_CFI_LE_BYTE_SWAP -#define CFI_LITTLE_ENDIAN -#endif - -#ifdef CONFIG_MTD_CFI_BE_BYTE_SWAP -#define CFI_BIG_ENDIAN -#endif - -#endif - -#if defined(CFI_LITTLE_ENDIAN) -#define cpu_to_cfi8(x) (x) -#define cfi8_to_cpu(x) (x) -#define cpu_to_cfi16(x) cpu_to_le16(x) -#define cpu_to_cfi32(x) cpu_to_le32(x) -#define cpu_to_cfi64(x) cpu_to_le64(x) -#define cfi16_to_cpu(x) le16_to_cpu(x) -#define cfi32_to_cpu(x) le32_to_cpu(x) -#define cfi64_to_cpu(x) le64_to_cpu(x) -#elif defined (CFI_BIG_ENDIAN) -#define cpu_to_cfi8(x) (x) -#define cfi8_to_cpu(x) (x) -#define cpu_to_cfi16(x) cpu_to_be16(x) -#define cpu_to_cfi32(x) cpu_to_be32(x) -#define cpu_to_cfi64(x) cpu_to_be64(x) -#define cfi16_to_cpu(x) be16_to_cpu(x) -#define cfi32_to_cpu(x) be32_to_cpu(x) -#define cfi64_to_cpu(x) be64_to_cpu(x) -#elif defined (CFI_HOST_ENDIAN) -#define cpu_to_cfi8(x) (x) -#define cfi8_to_cpu(x) (x) -#define cpu_to_cfi16(x) (x) -#define cpu_to_cfi32(x) (x) -#define cpu_to_cfi64(x) (x) -#define cfi16_to_cpu(x) (x) -#define cfi32_to_cpu(x) (x) -#define cfi64_to_cpu(x) (x) -#else -#error No CFI endianness defined -#endif diff --git a/libdde_linux26/contrib/include/linux/mtd/compatmac.h b/libdde_linux26/contrib/include/linux/mtd/compatmac.h deleted file mode 100644 index 7d1300d9..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/compatmac.h +++ /dev/null @@ -1,10 +0,0 @@ - -#ifndef __LINUX_MTD_COMPATMAC_H__ -#define __LINUX_MTD_COMPATMAC_H__ - -/* Nothing to see here. We write 2.5-compatible code and this - file makes it all OK in older kernels, but it's empty in _current_ - kernels. Include guard just to make GCC ignore it in future inclusions - anyway... */ - -#endif /* __LINUX_MTD_COMPATMAC_H__ */ diff --git a/libdde_linux26/contrib/include/linux/mtd/concat.h b/libdde_linux26/contrib/include/linux/mtd/concat.h deleted file mode 100644 index e80c674d..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/concat.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * MTD device concatenation layer definitions - * - * (C) 2002 Robert Kaiser <rkaiser@sysgo.de> - * - * This code is GPL - */ - -#ifndef MTD_CONCAT_H -#define MTD_CONCAT_H - - -struct mtd_info *mtd_concat_create( - struct mtd_info *subdev[], /* subdevices to concatenate */ - int num_devs, /* number of subdevices */ - const char *name); /* name for the new device */ - -void mtd_concat_destroy(struct mtd_info *mtd); - -#endif - diff --git a/libdde_linux26/contrib/include/linux/mtd/doc2000.h b/libdde_linux26/contrib/include/linux/mtd/doc2000.h deleted file mode 100644 index 0a6d516a..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/doc2000.h +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Linux driver for Disk-On-Chip devices - * - * Copyright (C) 1999 Machine Vision Holdings, Inc. - * Copyright (C) 2001-2003 David Woodhouse <dwmw2@infradead.org> - * Copyright (C) 2002-2003 Greg Ungerer <gerg@snapgear.com> - * Copyright (C) 2002-2003 SnapGear Inc - * - * Released under GPL - */ - -#ifndef __MTD_DOC2000_H__ -#define __MTD_DOC2000_H__ - -#include <linux/mtd/mtd.h> -#include <linux/mutex.h> - -#define DoC_Sig1 0 -#define DoC_Sig2 1 - -#define DoC_ChipID 0x1000 -#define DoC_DOCStatus 0x1001 -#define DoC_DOCControl 0x1002 -#define DoC_FloorSelect 0x1003 -#define DoC_CDSNControl 0x1004 -#define DoC_CDSNDeviceSelect 0x1005 -#define DoC_ECCConf 0x1006 -#define DoC_2k_ECCStatus 0x1007 - -#define DoC_CDSNSlowIO 0x100d -#define DoC_ECCSyndrome0 0x1010 -#define DoC_ECCSyndrome1 0x1011 -#define DoC_ECCSyndrome2 0x1012 -#define DoC_ECCSyndrome3 0x1013 -#define DoC_ECCSyndrome4 0x1014 -#define DoC_ECCSyndrome5 0x1015 -#define DoC_AliasResolution 0x101b -#define DoC_ConfigInput 0x101c -#define DoC_ReadPipeInit 0x101d -#define DoC_WritePipeTerm 0x101e -#define DoC_LastDataRead 0x101f -#define DoC_NOP 0x1020 - -#define DoC_Mil_CDSN_IO 0x0800 -#define DoC_2k_CDSN_IO 0x1800 - -#define DoC_Mplus_NOP 0x1002 -#define DoC_Mplus_AliasResolution 0x1004 -#define DoC_Mplus_DOCControl 0x1006 -#define DoC_Mplus_AccessStatus 0x1008 -#define DoC_Mplus_DeviceSelect 0x1008 -#define DoC_Mplus_Configuration 0x100a -#define DoC_Mplus_OutputControl 0x100c -#define DoC_Mplus_FlashControl 0x1020 -#define DoC_Mplus_FlashSelect 0x1022 -#define DoC_Mplus_FlashCmd 0x1024 -#define DoC_Mplus_FlashAddress 0x1026 -#define DoC_Mplus_FlashData0 0x1028 -#define DoC_Mplus_FlashData1 0x1029 -#define DoC_Mplus_ReadPipeInit 0x102a -#define DoC_Mplus_LastDataRead 0x102c -#define DoC_Mplus_LastDataRead1 0x102d -#define DoC_Mplus_WritePipeTerm 0x102e -#define DoC_Mplus_ECCSyndrome0 0x1040 -#define DoC_Mplus_ECCSyndrome1 0x1041 -#define DoC_Mplus_ECCSyndrome2 0x1042 -#define DoC_Mplus_ECCSyndrome3 0x1043 -#define DoC_Mplus_ECCSyndrome4 0x1044 -#define DoC_Mplus_ECCSyndrome5 0x1045 -#define DoC_Mplus_ECCConf 0x1046 -#define DoC_Mplus_Toggle 0x1046 -#define DoC_Mplus_DownloadStatus 0x1074 -#define DoC_Mplus_CtrlConfirm 0x1076 -#define DoC_Mplus_Power 0x1fff - -/* How to access the device? - * On ARM, it'll be mmap'd directly with 32-bit wide accesses. - * On PPC, it's mmap'd and 16-bit wide. - * Others use readb/writeb - */ -#if defined(__arm__) -#define ReadDOC_(adr, reg) ((unsigned char)(*(volatile __u32 *)(((unsigned long)adr)+((reg)<<2)))) -#define WriteDOC_(d, adr, reg) do{ *(volatile __u32 *)(((unsigned long)adr)+((reg)<<2)) = (__u32)d; wmb();} while(0) -#define DOC_IOREMAP_LEN 0x8000 -#elif defined(__ppc__) -#define ReadDOC_(adr, reg) ((unsigned char)(*(volatile __u16 *)(((unsigned long)adr)+((reg)<<1)))) -#define WriteDOC_(d, adr, reg) do{ *(volatile __u16 *)(((unsigned long)adr)+((reg)<<1)) = (__u16)d; wmb();} while(0) -#define DOC_IOREMAP_LEN 0x4000 -#else -#define ReadDOC_(adr, reg) readb((void __iomem *)(adr) + (reg)) -#define WriteDOC_(d, adr, reg) writeb(d, (void __iomem *)(adr) + (reg)) -#define DOC_IOREMAP_LEN 0x2000 - -#endif - -#if defined(__i386__) || defined(__x86_64__) -#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 -#define DOC_MODE_RESERVED2 3 - -#define DOC_MODE_CLR_ERR 0x80 -#define DOC_MODE_RST_LAT 0x10 -#define DOC_MODE_BDECT 0x08 -#define DOC_MODE_MDWREN 0x04 - -#define DOC_ChipID_Doc2k 0x20 -#define DOC_ChipID_Doc2kTSOP 0x21 /* internal number for MTD */ -#define DOC_ChipID_DocMil 0x30 -#define DOC_ChipID_DocMilPlus32 0x40 -#define DOC_ChipID_DocMilPlus16 0x41 - -#define CDSN_CTRL_FR_B 0x80 -#define CDSN_CTRL_FR_B0 0x40 -#define CDSN_CTRL_FR_B1 0x80 - -#define CDSN_CTRL_ECC_IO 0x20 -#define CDSN_CTRL_FLASH_IO 0x10 -#define CDSN_CTRL_WP 0x08 -#define CDSN_CTRL_ALE 0x04 -#define CDSN_CTRL_CLE 0x02 -#define CDSN_CTRL_CE 0x01 - -#define DOC_ECC_RESET 0 -#define DOC_ECC_ERROR 0x80 -#define DOC_ECC_RW 0x20 -#define DOC_ECC__EN 0x08 -#define DOC_TOGGLE_BIT 0x04 -#define DOC_ECC_RESV 0x02 -#define DOC_ECC_IGNORE 0x01 - -#define DOC_FLASH_CE 0x80 -#define DOC_FLASH_WP 0x40 -#define DOC_FLASH_BANK 0x02 - -/* 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_RESV) - -struct Nand { - char floor, chip; - unsigned long curadr; - unsigned char curmode; - /* Also some erase/write/pipeline info when we get that far */ -}; - -#define MAX_FLOORS 4 -#define MAX_CHIPS 4 - -#define MAX_FLOORS_MIL 1 -#define MAX_CHIPS_MIL 1 - -#define MAX_FLOORS_MPLUS 2 -#define MAX_CHIPS_MPLUS 1 - -#define ADDR_COLUMN 1 -#define ADDR_PAGE 2 -#define ADDR_COLUMN_PAGE 3 - -struct DiskOnChip { - unsigned long physadr; - void __iomem *virtadr; - unsigned long totlen; - unsigned 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; - char interleave; /* Internal interleaving - Millennium Plus style */ - unsigned long erasesize; - - int curfloor; - int curchip; - - int numchips; - struct Nand *chips; - struct mtd_info *nextdoc; - struct mutex lock; -}; - -int doc_decode_ecc(unsigned char sector[512], unsigned char ecc1[6]); - -#endif /* __MTD_DOC2000_H__ */ diff --git a/libdde_linux26/contrib/include/linux/mtd/flashchip.h b/libdde_linux26/contrib/include/linux/mtd/flashchip.h deleted file mode 100644 index d4f38c5f..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/flashchip.h +++ /dev/null @@ -1,92 +0,0 @@ - -/* - * struct flchip definition - * - * Contains information about the location and state of a given flash device - * - * (C) 2000 Red Hat. GPLd. - */ - -#ifndef __MTD_FLASHCHIP_H__ -#define __MTD_FLASHCHIP_H__ - -/* For spinlocks. sched.h includes spinlock.h from whichever directory it - * happens to be in - so we don't have to care whether we're on 2.2, which - * has asm/spinlock.h, or 2.4, which has linux/spinlock.h - */ -#include <linux/sched.h> - -typedef enum { - FL_READY, - FL_STATUS, - FL_CFI_QUERY, - FL_JEDEC_QUERY, - FL_ERASING, - FL_ERASE_SUSPENDING, - FL_ERASE_SUSPENDED, - FL_WRITING, - FL_WRITING_TO_BUFFER, - FL_OTP_WRITE, - FL_WRITE_SUSPENDING, - FL_WRITE_SUSPENDED, - FL_PM_SUSPENDED, - FL_SYNCING, - FL_UNLOADING, - FL_LOCKING, - FL_UNLOCKING, - FL_POINT, - FL_XIP_WHILE_ERASING, - FL_XIP_WHILE_WRITING, - FL_SHUTDOWN, - FL_UNKNOWN -} flstate_t; - - - -/* NOTE: confusingly, this can be used to refer to more than one chip at a time, - if they're interleaved. This can even refer to individual partitions on - the same physical chip when present. */ - -struct flchip { - unsigned long start; /* Offset within the map */ - // unsigned long len; - /* We omit len for now, because when we group them together - we insist that they're all of the same size, and the chip size - is held in the next level up. If we get more versatile later, - it'll make it a damn sight harder to find which chip we want from - a given offset, and we'll want to add the per-chip length field - back in. - */ - int ref_point_counter; - flstate_t state; - flstate_t oldstate; - - unsigned int write_suspended:1; - unsigned int erase_suspended:1; - unsigned long in_progress_block_addr; - - spinlock_t *mutex; - spinlock_t _spinlock; /* We do it like this because sometimes they'll be shared. */ - wait_queue_head_t wq; /* Wait on here when we're waiting for the chip - to be ready */ - int word_write_time; - int buffer_write_time; - int erase_time; - - int word_write_time_max; - int buffer_write_time_max; - int erase_time_max; - - void *priv; -}; - -/* This is used to handle contention on write/erase operations - between partitions of the same physical chip. */ -struct flchip_shared { - spinlock_t lock; - struct flchip *writing; - struct flchip *erasing; -}; - - -#endif /* __MTD_FLASHCHIP_H__ */ diff --git a/libdde_linux26/contrib/include/linux/mtd/ftl.h b/libdde_linux26/contrib/include/linux/mtd/ftl.h deleted file mode 100644 index 0555f7a0..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/ftl.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Derived from (and probably identical to): - * ftl.h 1.7 1999/10/25 20:23:17 - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License - * at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See - * the License for the specific language governing rights and - * limitations under the License. - * - * The initial developer of the original code is David A. Hinds - * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds - * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. - * - * Alternatively, the contents of this file may be used under the - * terms of the GNU General Public License version 2 (the "GPL"), in - * which case the provisions of the GPL are applicable instead of the - * above. If you wish to allow the use of your version of this file - * only under the terms of the GPL and not to allow others to use - * your version of this file under the MPL, indicate your decision by - * deleting the provisions above and replace them with the notice and - * other provisions required by the GPL. If you do not delete the - * provisions above, a recipient may use your version of this file - * under either the MPL or the GPL. - */ - -#ifndef _LINUX_FTL_H -#define _LINUX_FTL_H - -typedef struct erase_unit_header_t { - uint8_t LinkTargetTuple[5]; - uint8_t DataOrgTuple[10]; - uint8_t NumTransferUnits; - uint32_t EraseCount; - uint16_t LogicalEUN; - uint8_t BlockSize; - uint8_t EraseUnitSize; - uint16_t FirstPhysicalEUN; - uint16_t NumEraseUnits; - uint32_t FormattedSize; - uint32_t FirstVMAddress; - uint16_t NumVMPages; - uint8_t Flags; - uint8_t Code; - uint32_t SerialNumber; - uint32_t AltEUHOffset; - uint32_t BAMOffset; - uint8_t Reserved[12]; - uint8_t EndTuple[2]; -} erase_unit_header_t; - -/* Flags in erase_unit_header_t */ -#define HIDDEN_AREA 0x01 -#define REVERSE_POLARITY 0x02 -#define DOUBLE_BAI 0x04 - -/* Definitions for block allocation information */ - -#define BLOCK_FREE(b) ((b) == 0xffffffff) -#define BLOCK_DELETED(b) (((b) == 0) || ((b) == 0xfffffffe)) - -#define BLOCK_TYPE(b) ((b) & 0x7f) -#define BLOCK_ADDRESS(b) ((b) & ~0x7f) -#define BLOCK_NUMBER(b) ((b) >> 9) -#define BLOCK_CONTROL 0x30 -#define BLOCK_DATA 0x40 -#define BLOCK_REPLACEMENT 0x60 -#define BLOCK_BAD 0x70 - -#endif /* _LINUX_FTL_H */ diff --git a/libdde_linux26/contrib/include/linux/mtd/gen_probe.h b/libdde_linux26/contrib/include/linux/mtd/gen_probe.h deleted file mode 100644 index df362ddf..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/gen_probe.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * (C) 2001, 2001 Red Hat, Inc. - * GPL'd - */ - -#ifndef __LINUX_MTD_GEN_PROBE_H__ -#define __LINUX_MTD_GEN_PROBE_H__ - -#include <linux/mtd/flashchip.h> -#include <linux/mtd/map.h> -#include <linux/mtd/cfi.h> -#include <linux/bitops.h> - -struct chip_probe { - char *name; - int (*probe_chip)(struct map_info *map, __u32 base, - unsigned long *chip_map, struct cfi_private *cfi); -}; - -struct mtd_info *mtd_do_chip_probe(struct map_info *map, struct chip_probe *cp); - -#endif /* __LINUX_MTD_GEN_PROBE_H__ */ diff --git a/libdde_linux26/contrib/include/linux/mtd/inftl.h b/libdde_linux26/contrib/include/linux/mtd/inftl.h deleted file mode 100644 index 64ee53ce..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/inftl.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * inftl.h -- defines to support the Inverse NAND Flash Translation Layer - * - * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com) - */ - -#ifndef __MTD_INFTL_H__ -#define __MTD_INFTL_H__ - -#ifndef __KERNEL__ -#error This is a kernel header. Perhaps include nftl-user.h instead? -#endif - -#include <linux/mtd/blktrans.h> -#include <linux/mtd/mtd.h> -#include <linux/mtd/nftl.h> - -#include <mtd/inftl-user.h> - -#ifndef INFTL_MAJOR -#define INFTL_MAJOR 96 -#endif -#define INFTL_PARTN_BITS 4 - -#ifdef __KERNEL__ - -struct INFTLrecord { - struct mtd_blktrans_dev mbd; - __u16 MediaUnit; - __u32 EraseSize; - struct INFTLMediaHeader MediaHdr; - int usecount; - unsigned char heads; - unsigned char sectors; - unsigned short cylinders; - __u16 numvunits; - __u16 firstEUN; - __u16 lastEUN; - __u16 numfreeEUNs; - __u16 LastFreeEUN; /* To speed up finding a free EUN */ - int head,sect,cyl; - __u16 *PUtable; /* Physical Unit Table */ - __u16 *VUtable; /* Virtual Unit Table */ - unsigned int nb_blocks; /* number of physical blocks */ - unsigned int nb_boot_blocks; /* number of blocks used by the bios */ - struct erase_info instr; - struct nand_ecclayout oobinfo; -}; - -int INFTL_mount(struct INFTLrecord *s); -int INFTL_formatblock(struct INFTLrecord *s, int block); - -void INFTL_dumptables(struct INFTLrecord *s); -void INFTL_dumpVUchains(struct INFTLrecord *s); - -int inftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len, - size_t *retlen, uint8_t *buf); -int inftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len, - size_t *retlen, uint8_t *buf); - -#endif /* __KERNEL__ */ - -#endif /* __MTD_INFTL_H__ */ diff --git a/libdde_linux26/contrib/include/linux/mtd/map.h b/libdde_linux26/contrib/include/linux/mtd/map.h deleted file mode 100644 index b981b877..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/map.h +++ /dev/null @@ -1,444 +0,0 @@ - -/* Overhauled routines for dealing with different mmap regions of flash */ - -#ifndef __LINUX_MTD_MAP_H__ -#define __LINUX_MTD_MAP_H__ - -#include <linux/types.h> -#include <linux/list.h> -#include <linux/string.h> - -#include <linux/mtd/compatmac.h> - -#include <asm/unaligned.h> -#include <asm/system.h> -#include <asm/io.h> - -#ifdef CONFIG_MTD_MAP_BANK_WIDTH_1 -#define map_bankwidth(map) 1 -#define map_bankwidth_is_1(map) (map_bankwidth(map) == 1) -#define map_bankwidth_is_large(map) (0) -#define map_words(map) (1) -#define MAX_MAP_BANKWIDTH 1 -#else -#define map_bankwidth_is_1(map) (0) -#endif - -#ifdef CONFIG_MTD_MAP_BANK_WIDTH_2 -# ifdef map_bankwidth -# undef map_bankwidth -# define map_bankwidth(map) ((map)->bankwidth) -# else -# define map_bankwidth(map) 2 -# define map_bankwidth_is_large(map) (0) -# define map_words(map) (1) -# endif -#define map_bankwidth_is_2(map) (map_bankwidth(map) == 2) -#undef MAX_MAP_BANKWIDTH -#define MAX_MAP_BANKWIDTH 2 -#else -#define map_bankwidth_is_2(map) (0) -#endif - -#ifdef CONFIG_MTD_MAP_BANK_WIDTH_4 -# ifdef map_bankwidth -# undef map_bankwidth -# define map_bankwidth(map) ((map)->bankwidth) -# else -# define map_bankwidth(map) 4 -# define map_bankwidth_is_large(map) (0) -# define map_words(map) (1) -# endif -#define map_bankwidth_is_4(map) (map_bankwidth(map) == 4) -#undef MAX_MAP_BANKWIDTH -#define MAX_MAP_BANKWIDTH 4 -#else -#define map_bankwidth_is_4(map) (0) -#endif - -/* ensure we never evaluate anything shorted than an unsigned long - * to zero, and ensure we'll never miss the end of an comparison (bjd) */ - -#define map_calc_words(map) ((map_bankwidth(map) + (sizeof(unsigned long)-1))/ sizeof(unsigned long)) - -#ifdef CONFIG_MTD_MAP_BANK_WIDTH_8 -# ifdef map_bankwidth -# undef map_bankwidth -# define map_bankwidth(map) ((map)->bankwidth) -# if BITS_PER_LONG < 64 -# undef map_bankwidth_is_large -# define map_bankwidth_is_large(map) (map_bankwidth(map) > BITS_PER_LONG/8) -# undef map_words -# define map_words(map) map_calc_words(map) -# endif -# else -# define map_bankwidth(map) 8 -# define map_bankwidth_is_large(map) (BITS_PER_LONG < 64) -# define map_words(map) map_calc_words(map) -# endif -#define map_bankwidth_is_8(map) (map_bankwidth(map) == 8) -#undef MAX_MAP_BANKWIDTH -#define MAX_MAP_BANKWIDTH 8 -#else -#define map_bankwidth_is_8(map) (0) -#endif - -#ifdef CONFIG_MTD_MAP_BANK_WIDTH_16 -# ifdef map_bankwidth -# undef map_bankwidth -# define map_bankwidth(map) ((map)->bankwidth) -# undef map_bankwidth_is_large -# define map_bankwidth_is_large(map) (map_bankwidth(map) > BITS_PER_LONG/8) -# undef map_words -# define map_words(map) map_calc_words(map) -# else -# define map_bankwidth(map) 16 -# define map_bankwidth_is_large(map) (1) -# define map_words(map) map_calc_words(map) -# endif -#define map_bankwidth_is_16(map) (map_bankwidth(map) == 16) -#undef MAX_MAP_BANKWIDTH -#define MAX_MAP_BANKWIDTH 16 -#else -#define map_bankwidth_is_16(map) (0) -#endif - -#ifdef CONFIG_MTD_MAP_BANK_WIDTH_32 -# ifdef map_bankwidth -# undef map_bankwidth -# define map_bankwidth(map) ((map)->bankwidth) -# undef map_bankwidth_is_large -# define map_bankwidth_is_large(map) (map_bankwidth(map) > BITS_PER_LONG/8) -# undef map_words -# define map_words(map) map_calc_words(map) -# else -# define map_bankwidth(map) 32 -# define map_bankwidth_is_large(map) (1) -# define map_words(map) map_calc_words(map) -# endif -#define map_bankwidth_is_32(map) (map_bankwidth(map) == 32) -#undef MAX_MAP_BANKWIDTH -#define MAX_MAP_BANKWIDTH 32 -#else -#define map_bankwidth_is_32(map) (0) -#endif - -#ifndef map_bankwidth -#warning "No CONFIG_MTD_MAP_BANK_WIDTH_xx selected. No NOR chip support can work" -static inline int map_bankwidth(void *map) -{ - BUG(); - return 0; -} -#define map_bankwidth_is_large(map) (0) -#define map_words(map) (0) -#define MAX_MAP_BANKWIDTH 1 -#endif - -static inline int map_bankwidth_supported(int w) -{ - switch (w) { -#ifdef CONFIG_MTD_MAP_BANK_WIDTH_1 - case 1: -#endif -#ifdef CONFIG_MTD_MAP_BANK_WIDTH_2 - case 2: -#endif -#ifdef CONFIG_MTD_MAP_BANK_WIDTH_4 - case 4: -#endif -#ifdef CONFIG_MTD_MAP_BANK_WIDTH_8 - case 8: -#endif -#ifdef CONFIG_MTD_MAP_BANK_WIDTH_16 - case 16: -#endif -#ifdef CONFIG_MTD_MAP_BANK_WIDTH_32 - case 32: -#endif - return 1; - - default: - return 0; - } -} - -#define MAX_MAP_LONGS ( ((MAX_MAP_BANKWIDTH*8) + BITS_PER_LONG - 1) / BITS_PER_LONG ) - -typedef union { - unsigned long x[MAX_MAP_LONGS]; -} map_word; - -/* The map stuff is very simple. You fill in your struct map_info with - a handful of routines for accessing the device, making sure they handle - paging etc. correctly if your device needs it. Then you pass it off - to a chip probe routine -- either JEDEC or CFI probe or both -- via - do_map_probe(). If a chip is recognised, the probe code will invoke the - appropriate chip driver (if present) and return a struct mtd_info. - At which point, you fill in the mtd->module with your own module - address, and register it with the MTD core code. Or you could partition - it and register the partitions instead, or keep it for your own private - use; whatever. - - The mtd->priv field will point to the struct map_info, and any further - private data required by the chip driver is linked from the - mtd->priv->fldrv_priv field. This allows the map driver to get at - the destructor function map->fldrv_destroy() when it's tired - of living. -*/ - -struct map_info { - const char *name; - unsigned long size; - resource_size_t phys; -#define NO_XIP (-1UL) - - void __iomem *virt; - void *cached; - - int bankwidth; /* in octets. This isn't necessarily the width - of actual bus cycles -- it's the repeat interval - in bytes, before you are talking to the first chip again. - */ - -#ifdef CONFIG_MTD_COMPLEX_MAPPINGS - map_word (*read)(struct map_info *, unsigned long); - void (*copy_from)(struct map_info *, void *, unsigned long, ssize_t); - - void (*write)(struct map_info *, const map_word, unsigned long); - void (*copy_to)(struct map_info *, unsigned long, const void *, ssize_t); - - /* We can perhaps put in 'point' and 'unpoint' methods, if we really - want to enable XIP for non-linear mappings. Not yet though. */ -#endif - /* It's possible for the map driver to use cached memory in its - copy_from implementation (and _only_ with copy_from). However, - when the chip driver knows some flash area has changed contents, - it will signal it to the map driver through this routine to let - the map driver invalidate the corresponding cache as needed. - If there is no cache to care about this can be set to NULL. */ - void (*inval_cache)(struct map_info *, unsigned long, ssize_t); - - /* set_vpp() must handle being reentered -- enable, enable, disable - must leave it enabled. */ - void (*set_vpp)(struct map_info *, int); - - unsigned long pfow_base; - unsigned long map_priv_1; - unsigned long map_priv_2; - void *fldrv_priv; - struct mtd_chip_driver *fldrv; -}; - -struct mtd_chip_driver { - struct mtd_info *(*probe)(struct map_info *map); - void (*destroy)(struct mtd_info *); - struct module *module; - char *name; - struct list_head list; -}; - -void register_mtd_chip_driver(struct mtd_chip_driver *); -void unregister_mtd_chip_driver(struct mtd_chip_driver *); - -struct mtd_info *do_map_probe(const char *name, struct map_info *map); -void map_destroy(struct mtd_info *mtd); - -#define ENABLE_VPP(map) do { if(map->set_vpp) map->set_vpp(map, 1); } while(0) -#define DISABLE_VPP(map) do { if(map->set_vpp) map->set_vpp(map, 0); } while(0) - -#define INVALIDATE_CACHED_RANGE(map, from, size) \ - do { if(map->inval_cache) map->inval_cache(map, from, size); } while(0) - - -static inline int map_word_equal(struct map_info *map, map_word val1, map_word val2) -{ - int i; - for (i=0; i<map_words(map); i++) { - if (val1.x[i] != val2.x[i]) - return 0; - } - return 1; -} - -static inline map_word map_word_and(struct map_info *map, map_word val1, map_word val2) -{ - map_word r; - int i; - - for (i=0; i<map_words(map); i++) { - r.x[i] = val1.x[i] & val2.x[i]; - } - return r; -} - -static inline map_word map_word_clr(struct map_info *map, map_word val1, map_word val2) -{ - map_word r; - int i; - - for (i=0; i<map_words(map); i++) { - r.x[i] = val1.x[i] & ~val2.x[i]; - } - return r; -} - -static inline map_word map_word_or(struct map_info *map, map_word val1, map_word val2) -{ - map_word r; - int i; - - for (i=0; i<map_words(map); i++) { - r.x[i] = val1.x[i] | val2.x[i]; - } - return r; -} - -#define map_word_andequal(m, a, b, z) map_word_equal(m, z, map_word_and(m, a, b)) - -static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word val2) -{ - int i; - - for (i=0; i<map_words(map); i++) { - if (val1.x[i] & val2.x[i]) - return 1; - } - return 0; -} - -static inline map_word map_word_load(struct map_info *map, const void *ptr) -{ - map_word r; - - if (map_bankwidth_is_1(map)) - r.x[0] = *(unsigned char *)ptr; - else if (map_bankwidth_is_2(map)) - r.x[0] = get_unaligned((uint16_t *)ptr); - else if (map_bankwidth_is_4(map)) - r.x[0] = get_unaligned((uint32_t *)ptr); -#if BITS_PER_LONG >= 64 - else if (map_bankwidth_is_8(map)) - r.x[0] = get_unaligned((uint64_t *)ptr); -#endif - else if (map_bankwidth_is_large(map)) - memcpy(r.x, ptr, map->bankwidth); - - return r; -} - -static inline map_word map_word_load_partial(struct map_info *map, map_word orig, const unsigned char *buf, int start, int len) -{ - int i; - - if (map_bankwidth_is_large(map)) { - char *dest = (char *)&orig; - memcpy(dest+start, buf, len); - } else { - for (i=start; i < start+len; i++) { - int bitpos; -#ifdef __LITTLE_ENDIAN - bitpos = i*8; -#else /* __BIG_ENDIAN */ - bitpos = (map_bankwidth(map)-1-i)*8; -#endif - orig.x[0] &= ~(0xff << bitpos); - orig.x[0] |= buf[i-start] << bitpos; - } - } - return orig; -} - -#if BITS_PER_LONG < 64 -#define MAP_FF_LIMIT 4 -#else -#define MAP_FF_LIMIT 8 -#endif - -static inline map_word map_word_ff(struct map_info *map) -{ - map_word r; - int i; - - if (map_bankwidth(map) < MAP_FF_LIMIT) { - int bw = 8 * map_bankwidth(map); - r.x[0] = (1 << bw) - 1; - } else { - for (i=0; i<map_words(map); i++) - r.x[i] = ~0UL; - } - return r; -} - -static inline map_word inline_map_read(struct map_info *map, unsigned long ofs) -{ - map_word r; - - if (map_bankwidth_is_1(map)) - r.x[0] = __raw_readb(map->virt + ofs); - else if (map_bankwidth_is_2(map)) - r.x[0] = __raw_readw(map->virt + ofs); - else if (map_bankwidth_is_4(map)) - r.x[0] = __raw_readl(map->virt + ofs); -#if BITS_PER_LONG >= 64 - else if (map_bankwidth_is_8(map)) - r.x[0] = __raw_readq(map->virt + ofs); -#endif - else if (map_bankwidth_is_large(map)) - memcpy_fromio(r.x, map->virt+ofs, map->bankwidth); - - return r; -} - -static inline void inline_map_write(struct map_info *map, const map_word datum, unsigned long ofs) -{ - if (map_bankwidth_is_1(map)) - __raw_writeb(datum.x[0], map->virt + ofs); - else if (map_bankwidth_is_2(map)) - __raw_writew(datum.x[0], map->virt + ofs); - else if (map_bankwidth_is_4(map)) - __raw_writel(datum.x[0], map->virt + ofs); -#if BITS_PER_LONG >= 64 - else if (map_bankwidth_is_8(map)) - __raw_writeq(datum.x[0], map->virt + ofs); -#endif - else if (map_bankwidth_is_large(map)) - memcpy_toio(map->virt+ofs, datum.x, map->bankwidth); - mb(); -} - -static inline void inline_map_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) -{ - if (map->cached) - memcpy(to, (char *)map->cached + from, len); - else - memcpy_fromio(to, map->virt + from, len); -} - -static inline void inline_map_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) -{ - memcpy_toio(map->virt + to, from, len); -} - -#ifdef CONFIG_MTD_COMPLEX_MAPPINGS -#define map_read(map, ofs) (map)->read(map, ofs) -#define map_copy_from(map, to, from, len) (map)->copy_from(map, to, from, len) -#define map_write(map, datum, ofs) (map)->write(map, datum, ofs) -#define map_copy_to(map, to, from, len) (map)->copy_to(map, to, from, len) - -extern void simple_map_init(struct map_info *); -#define map_is_linear(map) (map->phys != NO_XIP) - -#else -#define map_read(map, ofs) inline_map_read(map, ofs) -#define map_copy_from(map, to, from, len) inline_map_copy_from(map, to, from, len) -#define map_write(map, datum, ofs) inline_map_write(map, datum, ofs) -#define map_copy_to(map, to, from, len) inline_map_copy_to(map, to, from, len) - - -#define simple_map_init(map) BUG_ON(!map_bankwidth_supported((map)->bankwidth)) -#define map_is_linear(map) ({ (void)(map); 1; }) - -#endif /* !CONFIG_MTD_COMPLEX_MAPPINGS */ - -#endif /* __LINUX_MTD_MAP_H__ */ diff --git a/libdde_linux26/contrib/include/linux/mtd/mtd.h b/libdde_linux26/contrib/include/linux/mtd/mtd.h deleted file mode 100644 index 3aa5d77c..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/mtd.h +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. - * - * Released under GPL - */ - -#ifndef __MTD_MTD_H__ -#define __MTD_MTD_H__ - -#include <linux/types.h> -#include <linux/module.h> -#include <linux/uio.h> -#include <linux/notifier.h> - -#include <linux/mtd/compatmac.h> -#include <mtd/mtd-abi.h> - -#include <asm/div64.h> - -#define MTD_CHAR_MAJOR 90 -#define MTD_BLOCK_MAJOR 31 -#define MAX_MTD_DEVICES 32 - -#define MTD_ERASE_PENDING 0x01 -#define MTD_ERASING 0x02 -#define MTD_ERASE_SUSPEND 0x04 -#define MTD_ERASE_DONE 0x08 -#define MTD_ERASE_FAILED 0x10 - -#define MTD_FAIL_ADDR_UNKNOWN -1LL - -/* If the erase fails, fail_addr might indicate exactly which block failed. If - fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not at the device level or was not - specific to any particular block. */ -struct erase_info { - struct mtd_info *mtd; - uint64_t addr; - uint64_t len; - uint64_t fail_addr; - u_long time; - u_long retries; - unsigned dev; - unsigned cell; - void (*callback) (struct erase_info *self); - u_long priv; - u_char state; - struct erase_info *next; -}; - -struct mtd_erase_region_info { - uint64_t offset; /* At which this region starts, from the beginning of the MTD */ - uint32_t erasesize; /* For this region */ - uint32_t numblocks; /* Number of blocks of erasesize in this region */ - unsigned long *lockmap; /* If keeping bitmap of locks */ -}; - -/* - * oob operation modes - * - * MTD_OOB_PLACE: oob data are placed at the given offset - * MTD_OOB_AUTO: oob data are automatically placed at the free areas - * which are defined by the ecclayout - * MTD_OOB_RAW: mode to read raw data+oob in one chunk. The oob data - * is inserted into the data. Thats a raw image of the - * flash contents. - */ -typedef enum { - MTD_OOB_PLACE, - MTD_OOB_AUTO, - MTD_OOB_RAW, -} mtd_oob_mode_t; - -/** - * struct mtd_oob_ops - oob operation operands - * @mode: operation mode - * - * @len: number of data bytes to write/read - * - * @retlen: number of data bytes written/read - * - * @ooblen: number of oob bytes to write/read - * @oobretlen: number of oob bytes written/read - * @ooboffs: offset of oob data in the oob area (only relevant when - * mode = MTD_OOB_PLACE) - * @datbuf: data buffer - if NULL only oob data are read/written - * @oobbuf: oob data buffer - * - * Note, it is allowed to read more than one OOB area at one go, but not write. - * The interface assumes that the OOB write requests program only one page's - * OOB area. - */ -struct mtd_oob_ops { - mtd_oob_mode_t mode; - size_t len; - size_t retlen; - size_t ooblen; - size_t oobretlen; - uint32_t ooboffs; - uint8_t *datbuf; - uint8_t *oobbuf; -}; - -struct mtd_info { - u_char type; - uint32_t flags; - uint64_t size; // Total size of the MTD - - /* "Major" erase size for the device. Naïve users may take this - * to be the only erase size available, or may use the more detailed - * information below if they desire - */ - uint32_t erasesize; - /* Minimal writable flash unit size. In case of NOR flash it is 1 (even - * though individual bits can be cleared), in case of NAND flash it is - * one NAND page (or half, or one-fourths of it), in case of ECC-ed NOR - * it is of ECC block size, etc. It is illegal to have writesize = 0. - * Any driver registering a struct mtd_info must ensure a writesize of - * 1 or larger. - */ - uint32_t writesize; - - uint32_t oobsize; // Amount of OOB data per block (e.g. 16) - uint32_t oobavail; // Available OOB bytes per block - - /* - * If erasesize is a power of 2 then the shift is stored in - * erasesize_shift otherwise erasesize_shift is zero. Ditto writesize. - */ - unsigned int erasesize_shift; - unsigned int writesize_shift; - /* Masks based on erasesize_shift and writesize_shift */ - unsigned int erasesize_mask; - unsigned int writesize_mask; - - // Kernel-only stuff starts here. - const char *name; - int index; - - /* ecc layout structure pointer - read only ! */ - struct nand_ecclayout *ecclayout; - - /* Data for variable erase regions. If numeraseregions is zero, - * it means that the whole device has erasesize as given above. - */ - int numeraseregions; - struct mtd_erase_region_info *eraseregions; - - /* - * Erase is an asynchronous operation. Device drivers are supposed - * to call instr->callback() whenever the operation completes, even - * if it completes with a failure. - * Callers are supposed to pass a callback function and wait for it - * to be called before writing to the block. - */ - int (*erase) (struct mtd_info *mtd, struct erase_info *instr); - - /* This stuff for eXecute-In-Place */ - /* phys is optional and may be set to NULL */ - int (*point) (struct mtd_info *mtd, loff_t from, size_t len, - size_t *retlen, void **virt, resource_size_t *phys); - - /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ - void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); - - - int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); - int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); - - /* In blackbox flight recorder like scenarios we want to make successful - writes in interrupt context. panic_write() is only intended to be - called when its known the kernel is about to panic and we need the - write to succeed. Since the kernel is not going to be running for much - longer, this function can break locks and delay to ensure the write - succeeds (but not sleep). */ - - int (*panic_write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); - - int (*read_oob) (struct mtd_info *mtd, loff_t from, - struct mtd_oob_ops *ops); - int (*write_oob) (struct mtd_info *mtd, loff_t to, - struct mtd_oob_ops *ops); - - /* - * Methods to access the protection register area, present in some - * flash devices. The user data is one time programmable but the - * factory data is read only. - */ - int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); - int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); - int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); - int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); - int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); - int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len); - - /* kvec-based read/write methods. - NB: The 'count' parameter is the number of _vectors_, each of - which contains an (ofs, len) tuple. - */ - int (*writev) (struct mtd_info *mtd, const struct kvec *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, uint64_t len); - int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len); - - /* Power Management functions */ - int (*suspend) (struct mtd_info *mtd); - void (*resume) (struct mtd_info *mtd); - - /* Bad block management functions */ - int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); - int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); - - struct notifier_block reboot_notifier; /* default mode before reboot */ - - /* ECC status information */ - struct mtd_ecc_stats ecc_stats; - /* Subpage shift (NAND) */ - int subpage_sft; - - void *priv; - - struct module *owner; - int usecount; - - /* If the driver is something smart, like UBI, it may need to maintain - * its own reference counting. The below functions are only for driver. - * The driver may register its callbacks. These callbacks are not - * supposed to be called by MTD users */ - int (*get_device) (struct mtd_info *mtd); - void (*put_device) (struct mtd_info *mtd); -}; - -static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd) -{ - if (mtd->erasesize_shift) - return sz >> mtd->erasesize_shift; - do_div(sz, mtd->erasesize); - return sz; -} - -static inline uint32_t mtd_mod_by_eb(uint64_t sz, struct mtd_info *mtd) -{ - if (mtd->erasesize_shift) - return sz & mtd->erasesize_mask; - return do_div(sz, mtd->erasesize); -} - -static inline uint32_t mtd_div_by_ws(uint64_t sz, struct mtd_info *mtd) -{ - if (mtd->writesize_shift) - return sz >> mtd->writesize_shift; - do_div(sz, mtd->writesize); - return sz; -} - -static inline uint32_t mtd_mod_by_ws(uint64_t sz, struct mtd_info *mtd) -{ - if (mtd->writesize_shift) - return sz & mtd->writesize_mask; - return do_div(sz, mtd->writesize); -} - - /* Kernel-side ioctl definitions */ - -extern int add_mtd_device(struct mtd_info *mtd); -extern int del_mtd_device (struct mtd_info *mtd); - -extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num); -extern struct mtd_info *get_mtd_device_nm(const char *name); - -extern void put_mtd_device(struct mtd_info *mtd); - - -struct mtd_notifier { - void (*add)(struct mtd_info *mtd); - void (*remove)(struct mtd_info *mtd); - struct list_head list; -}; - - -extern void register_mtd_user (struct mtd_notifier *new); -extern int unregister_mtd_user (struct mtd_notifier *old); - -int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, - unsigned long count, loff_t to, size_t *retlen); - -int default_mtd_readv(struct mtd_info *mtd, struct kvec *vecs, - unsigned long count, loff_t from, size_t *retlen); - -#ifdef CONFIG_MTD_PARTITIONS -void mtd_erase_callback(struct erase_info *instr); -#else -static inline void mtd_erase_callback(struct erase_info *instr) -{ - if (instr->callback) - instr->callback(instr); -} -#endif - -/* - * 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...) \ - do { \ - if (n <= CONFIG_MTD_DEBUG_VERBOSE) \ - printk(KERN_INFO args); \ - } while(0) -#else /* CONFIG_MTD_DEBUG */ -#define DEBUG(n, args...) \ - do { \ - if (0) \ - printk(KERN_INFO args); \ - } while(0) - -#endif /* CONFIG_MTD_DEBUG */ - -#endif /* __MTD_MTD_H__ */ diff --git a/libdde_linux26/contrib/include/linux/mtd/mtdram.h b/libdde_linux26/contrib/include/linux/mtd/mtdram.h deleted file mode 100644 index 04fdc07b..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/mtdram.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __MTD_MTDRAM_H__ -#define __MTD_MTDRAM_H__ - -#include <linux/mtd/mtd.h> -int mtdram_init_device(struct mtd_info *mtd, void *mapped_address, - unsigned long size, char *name); - -#endif /* __MTD_MTDRAM_H__ */ diff --git a/libdde_linux26/contrib/include/linux/mtd/nand-gpio.h b/libdde_linux26/contrib/include/linux/mtd/nand-gpio.h deleted file mode 100644 index 51534e50..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/nand-gpio.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __LINUX_MTD_NAND_GPIO_H -#define __LINUX_MTD_NAND_GPIO_H - -#include <linux/mtd/nand.h> - -struct gpio_nand_platdata { - int gpio_nce; - int gpio_nwp; - int gpio_cle; - int gpio_ale; - int gpio_rdy; - void (*adjust_parts)(struct gpio_nand_platdata *, size_t); - struct mtd_partition *parts; - unsigned int num_parts; - unsigned int options; - int chip_delay; -}; - -#endif diff --git a/libdde_linux26/contrib/include/linux/mtd/nand.h b/libdde_linux26/contrib/include/linux/mtd/nand.h deleted file mode 100644 index db5b63da..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/nand.h +++ /dev/null @@ -1,619 +0,0 @@ -/* - * linux/include/linux/mtd/nand.h - * - * Copyright (c) 2000 David Woodhouse <dwmw2@infradead.org> - * Steven J. Hill <sjhill@realitydiluted.com> - * Thomas Gleixner <tglx@linutronix.de> - * - * 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: - * See git changelog. - */ -#ifndef __LINUX_MTD_NAND_H -#define __LINUX_MTD_NAND_H - -#include <linux/wait.h> -#include <linux/spinlock.h> -#include <linux/mtd/mtd.h> - -struct mtd_info; -/* Scan and identify a NAND device */ -extern int nand_scan (struct mtd_info *mtd, int max_chips); -/* Separate phases of nand_scan(), allowing board driver to intervene - * and override command or ECC setup according to flash type */ -extern int nand_scan_ident(struct mtd_info *mtd, int max_chips); -extern int nand_scan_tail(struct mtd_info *mtd); - -/* Free resources held by the NAND device */ -extern void nand_release (struct mtd_info *mtd); - -/* Internal helper for board drivers which need to override command function */ -extern void nand_wait_ready(struct mtd_info *mtd); - -/* The maximum number of NAND chips in an array */ -#define NAND_MAX_CHIPS 8 - -/* This constant declares the max. oobsize / page, which - * is supported now. If you add a chip with bigger oobsize/page - * adjust this accordingly. - */ -#define NAND_MAX_OOBSIZE 64 -#define NAND_MAX_PAGESIZE 2048 - -/* - * Constants for hardware specific CLE/ALE/NCE function - * - * These are bits which can be or'ed to set/clear multiple - * bits in one go. - */ -/* Select the chip by setting nCE to low */ -#define NAND_NCE 0x01 -/* Select the command latch by setting CLE to high */ -#define NAND_CLE 0x02 -/* Select the address latch by setting ALE to high */ -#define NAND_ALE 0x04 - -#define NAND_CTRL_CLE (NAND_NCE | NAND_CLE) -#define NAND_CTRL_ALE (NAND_NCE | NAND_ALE) -#define NAND_CTRL_CHANGE 0x80 - -/* - * Standard NAND flash commands - */ -#define NAND_CMD_READ0 0 -#define NAND_CMD_READ1 1 -#define NAND_CMD_RNDOUT 5 -#define NAND_CMD_PAGEPROG 0x10 -#define NAND_CMD_READOOB 0x50 -#define NAND_CMD_ERASE1 0x60 -#define NAND_CMD_STATUS 0x70 -#define NAND_CMD_STATUS_MULTI 0x71 -#define NAND_CMD_SEQIN 0x80 -#define NAND_CMD_RNDIN 0x85 -#define NAND_CMD_READID 0x90 -#define NAND_CMD_ERASE2 0xd0 -#define NAND_CMD_RESET 0xff - -/* Extended commands for large page devices */ -#define NAND_CMD_READSTART 0x30 -#define NAND_CMD_RNDOUTSTART 0xE0 -#define NAND_CMD_CACHEDPROG 0x15 - -/* Extended commands for AG-AND device */ -/* - * Note: the command for NAND_CMD_DEPLETE1 is really 0x00 but - * there is no way to distinguish that from NAND_CMD_READ0 - * until the remaining sequence of commands has been completed - * so add a high order bit and mask it off in the command. - */ -#define NAND_CMD_DEPLETE1 0x100 -#define NAND_CMD_DEPLETE2 0x38 -#define NAND_CMD_STATUS_MULTI 0x71 -#define NAND_CMD_STATUS_ERROR 0x72 -/* multi-bank error status (banks 0-3) */ -#define NAND_CMD_STATUS_ERROR0 0x73 -#define NAND_CMD_STATUS_ERROR1 0x74 -#define NAND_CMD_STATUS_ERROR2 0x75 -#define NAND_CMD_STATUS_ERROR3 0x76 -#define NAND_CMD_STATUS_RESET 0x7f -#define NAND_CMD_STATUS_CLEAR 0xff - -#define NAND_CMD_NONE -1 - -/* Status bits */ -#define NAND_STATUS_FAIL 0x01 -#define NAND_STATUS_FAIL_N1 0x02 -#define NAND_STATUS_TRUE_READY 0x20 -#define NAND_STATUS_READY 0x40 -#define NAND_STATUS_WP 0x80 - -/* - * Constants for ECC_MODES - */ -typedef enum { - NAND_ECC_NONE, - NAND_ECC_SOFT, - NAND_ECC_HW, - NAND_ECC_HW_SYNDROME, -} nand_ecc_modes_t; - -/* - * Constants for Hardware ECC - */ -/* Reset Hardware ECC for read */ -#define NAND_ECC_READ 0 -/* Reset Hardware ECC for write */ -#define NAND_ECC_WRITE 1 -/* Enable Hardware ECC before syndrom is read back from flash */ -#define NAND_ECC_READSYN 2 - -/* Bit mask for flags passed to do_nand_read_ecc */ -#define NAND_GET_DEVICE 0x80 - - -/* Option constants for bizarre disfunctionality and real -* features -*/ -/* Chip can not auto increment pages */ -#define NAND_NO_AUTOINCR 0x00000001 -/* Buswitdh is 16 bit */ -#define NAND_BUSWIDTH_16 0x00000002 -/* Device supports partial programming without padding */ -#define NAND_NO_PADDING 0x00000004 -/* Chip has cache program function */ -#define NAND_CACHEPRG 0x00000008 -/* Chip has copy back function */ -#define NAND_COPYBACK 0x00000010 -/* AND Chip which has 4 banks and a confusing page / block - * assignment. See Renesas datasheet for further information */ -#define NAND_IS_AND 0x00000020 -/* Chip has a array of 4 pages which can be read without - * additional ready /busy waits */ -#define NAND_4PAGE_ARRAY 0x00000040 -/* Chip requires that BBT is periodically rewritten to prevent - * bits from adjacent blocks from 'leaking' in altering data. - * This happens with the Renesas AG-AND chips, possibly others. */ -#define BBT_AUTO_REFRESH 0x00000080 -/* Chip does not require ready check on read. True - * for all large page devices, as they do not support - * autoincrement.*/ -#define NAND_NO_READRDY 0x00000100 -/* Chip does not allow subpage writes */ -#define NAND_NO_SUBPAGE_WRITE 0x00000200 - - -/* Options valid for Samsung large page devices */ -#define NAND_SAMSUNG_LP_OPTIONS \ - (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) - -/* Macros to identify the above */ -#define NAND_CANAUTOINCR(chip) (!(chip->options & NAND_NO_AUTOINCR)) -#define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING)) -#define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG)) -#define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK)) -/* Large page NAND with SOFT_ECC should support subpage reads */ -#define NAND_SUBPAGE_READ(chip) ((chip->ecc.mode == NAND_ECC_SOFT) \ - && (chip->page_shift > 9)) - -/* Mask to zero out the chip options, which come from the id table */ -#define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR) - -/* Non chip related options */ -/* Use a flash based bad block table. This option is passed to the - * default bad block table function. */ -#define NAND_USE_FLASH_BBT 0x00010000 -/* This option skips the bbt scan during initialization. */ -#define NAND_SKIP_BBTSCAN 0x00020000 -/* This option is defined if the board driver allocates its own buffers - (e.g. because it needs them DMA-coherent */ -#define NAND_OWN_BUFFERS 0x00040000 -/* Options set by nand scan */ -/* Nand scan has allocated controller struct */ -#define NAND_CONTROLLER_ALLOC 0x80000000 - -/* Cell info constants */ -#define NAND_CI_CHIPNR_MSK 0x03 -#define NAND_CI_CELLTYPE_MSK 0x0C - -/* - * nand_state_t - chip states - * Enumeration for NAND flash chip state - */ -typedef enum { - FL_READY, - FL_READING, - FL_WRITING, - FL_ERASING, - FL_SYNCING, - FL_CACHEDPRG, - FL_PM_SUSPENDED, -} nand_state_t; - -/* Keep gcc happy */ -struct nand_chip; - -/** - * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices - * @lock: protection lock - * @active: the mtd device which holds the controller currently - * @wq: wait queue to sleep on if a NAND operation is in progress - * used instead of the per chip wait queue when a hw controller is available - */ -struct nand_hw_control { - spinlock_t lock; - struct nand_chip *active; - wait_queue_head_t wq; -}; - -/** - * struct nand_ecc_ctrl - Control structure for ecc - * @mode: ecc mode - * @steps: number of ecc steps per page - * @size: data bytes per ecc step - * @bytes: ecc bytes per step - * @total: total number of ecc bytes per page - * @prepad: padding information for syndrome based ecc generators - * @postpad: padding information for syndrome based ecc generators - * @layout: ECC layout control struct pointer - * @hwctl: function to control hardware ecc generator. Must only - * be provided if an hardware ECC is available - * @calculate: function for ecc calculation or readback from ecc hardware - * @correct: function for ecc correction, matching to ecc generator (sw/hw) - * @read_page_raw: function to read a raw page without ECC - * @write_page_raw: function to write a raw page without ECC - * @read_page: function to read a page according to the ecc generator requirements - * @read_subpage: function to read parts of the page covered by ECC. - * @write_page: function to write a page according to the ecc generator requirements - * @read_oob: function to read chip OOB data - * @write_oob: function to write chip OOB data - */ -struct nand_ecc_ctrl { - nand_ecc_modes_t mode; - int steps; - int size; - int bytes; - int total; - int prepad; - int postpad; - struct nand_ecclayout *layout; - void (*hwctl)(struct mtd_info *mtd, int mode); - int (*calculate)(struct mtd_info *mtd, - const uint8_t *dat, - uint8_t *ecc_code); - int (*correct)(struct mtd_info *mtd, uint8_t *dat, - uint8_t *read_ecc, - uint8_t *calc_ecc); - int (*read_page_raw)(struct mtd_info *mtd, - struct nand_chip *chip, - uint8_t *buf); - void (*write_page_raw)(struct mtd_info *mtd, - struct nand_chip *chip, - const uint8_t *buf); - int (*read_page)(struct mtd_info *mtd, - struct nand_chip *chip, - uint8_t *buf); - int (*read_subpage)(struct mtd_info *mtd, - struct nand_chip *chip, - uint32_t offs, uint32_t len, - uint8_t *buf); - void (*write_page)(struct mtd_info *mtd, - struct nand_chip *chip, - const uint8_t *buf); - int (*read_oob)(struct mtd_info *mtd, - struct nand_chip *chip, - int page, - int sndcmd); - int (*write_oob)(struct mtd_info *mtd, - struct nand_chip *chip, - int page); -}; - -/** - * struct nand_buffers - buffer structure for read/write - * @ecccalc: buffer for calculated ecc - * @ecccode: buffer for ecc read from flash - * @databuf: buffer for data - dynamically sized - * - * Do not change the order of buffers. databuf and oobrbuf must be in - * consecutive order. - */ -struct nand_buffers { - uint8_t ecccalc[NAND_MAX_OOBSIZE]; - uint8_t ecccode[NAND_MAX_OOBSIZE]; - uint8_t databuf[NAND_MAX_PAGESIZE + NAND_MAX_OOBSIZE]; -}; - -/** - * struct nand_chip - NAND Private Flash Chip Data - * @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of the flash device - * @IO_ADDR_W: [BOARDSPECIFIC] address to write the 8 I/O lines of the flash device - * @read_byte: [REPLACEABLE] read one byte from the chip - * @read_word: [REPLACEABLE] read one word from the chip - * @write_buf: [REPLACEABLE] write data from the buffer to the chip - * @read_buf: [REPLACEABLE] read data from the chip into the buffer - * @verify_buf: [REPLACEABLE] verify buffer contents against the chip data - * @select_chip: [REPLACEABLE] select chip nr - * @block_bad: [REPLACEABLE] check, if the block is bad - * @block_markbad: [REPLACEABLE] mark the block bad - * @cmd_ctrl: [BOARDSPECIFIC] hardwarespecific funtion for controlling - * ALE/CLE/nCE. Also used to write command and address - * @dev_ready: [BOARDSPECIFIC] hardwarespecific function for accesing device ready/busy line - * If set to NULL no access to ready/busy is available and the ready/busy information - * is read from the chip status register - * @cmdfunc: [REPLACEABLE] hardwarespecific function for writing commands to the chip - * @waitfunc: [REPLACEABLE] hardwarespecific function for wait on ready - * @ecc: [BOARDSPECIFIC] ecc control ctructure - * @buffers: buffer structure for read/write - * @hwcontrol: platform-specific hardware control structure - * @ops: oob operation operands - * @erase_cmd: [INTERN] erase command write function, selectable due to AND support - * @scan_bbt: [REPLACEABLE] function to scan bad block table - * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR) - * @state: [INTERN] the current state of the NAND device - * @oob_poi: poison value buffer - * @page_shift: [INTERN] number of address bits in a page (column address bits) - * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock - * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry - * @chip_shift: [INTERN] number of address bits in one chip - * @options: [BOARDSPECIFIC] various chip options. They can partly be set to inform nand_scan about - * special functionality. See the defines for further explanation - * @badblockpos: [INTERN] position of the bad block marker in the oob area - * @cellinfo: [INTERN] MLC/multichip data from chip ident - * @numchips: [INTERN] number of physical chips - * @chipsize: [INTERN] the size of one chip for multichip arrays - * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1 - * @pagebuf: [INTERN] holds the pagenumber which is currently in data_buf - * @subpagesize: [INTERN] holds the subpagesize - * @ecclayout: [REPLACEABLE] the default ecc placement scheme - * @bbt: [INTERN] bad block table pointer - * @bbt_td: [REPLACEABLE] bad block table descriptor for flash lookup - * @bbt_md: [REPLACEABLE] bad block table mirror descriptor - * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial bad block scan - * @controller: [REPLACEABLE] a pointer to a hardware controller structure - * which is shared among multiple independend devices - * @priv: [OPTIONAL] pointer to private chip date - * @errstat: [OPTIONAL] hardware specific function to perform additional error status checks - * (determine if errors are correctable) - * @write_page: [REPLACEABLE] High-level page write function - */ - -struct nand_chip { - void __iomem *IO_ADDR_R; - void __iomem *IO_ADDR_W; - - uint8_t (*read_byte)(struct mtd_info *mtd); - u16 (*read_word)(struct mtd_info *mtd); - void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); - void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len); - int (*verify_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); - void (*select_chip)(struct mtd_info *mtd, int chip); - int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip); - int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); - void (*cmd_ctrl)(struct mtd_info *mtd, int dat, - unsigned int ctrl); - int (*dev_ready)(struct mtd_info *mtd); - void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column, int page_addr); - int (*waitfunc)(struct mtd_info *mtd, struct nand_chip *this); - void (*erase_cmd)(struct mtd_info *mtd, int page); - int (*scan_bbt)(struct mtd_info *mtd); - int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page); - int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, - const uint8_t *buf, int page, int cached, int raw); - - int chip_delay; - unsigned int options; - - int page_shift; - int phys_erase_shift; - int bbt_erase_shift; - int chip_shift; - int numchips; - uint64_t chipsize; - int pagemask; - int pagebuf; - int subpagesize; - uint8_t cellinfo; - int badblockpos; - - nand_state_t state; - - uint8_t *oob_poi; - struct nand_hw_control *controller; - struct nand_ecclayout *ecclayout; - - struct nand_ecc_ctrl ecc; - struct nand_buffers *buffers; - struct nand_hw_control hwcontrol; - - struct mtd_oob_ops ops; - - uint8_t *bbt; - struct nand_bbt_descr *bbt_td; - struct nand_bbt_descr *bbt_md; - - struct nand_bbt_descr *badblock_pattern; - - void *priv; -}; - -/* - * NAND Flash Manufacturer ID Codes - */ -#define NAND_MFR_TOSHIBA 0x98 -#define NAND_MFR_SAMSUNG 0xec -#define NAND_MFR_FUJITSU 0x04 -#define NAND_MFR_NATIONAL 0x8f -#define NAND_MFR_RENESAS 0x07 -#define NAND_MFR_STMICRO 0x20 -#define NAND_MFR_HYNIX 0xad -#define NAND_MFR_MICRON 0x2c -#define NAND_MFR_AMD 0x01 - -/** - * struct nand_flash_dev - NAND Flash Device ID Structure - * @name: Identify the device type - * @id: device ID code - * @pagesize: Pagesize in bytes. Either 256 or 512 or 0 - * If the pagesize is 0, then the real pagesize - * and the eraseize are determined from the - * extended id bytes in the chip - * @erasesize: Size of an erase block in the flash device. - * @chipsize: Total chipsize in Mega Bytes - * @options: Bitfield to store chip relevant options - */ -struct nand_flash_dev { - char *name; - int id; - unsigned long pagesize; - unsigned long chipsize; - unsigned long erasesize; - unsigned long options; -}; - -/** - * struct nand_manufacturers - NAND Flash Manufacturer ID Structure - * @name: Manufacturer name - * @id: manufacturer ID code of device. -*/ -struct nand_manufacturers { - int id; - char * name; -}; - -extern struct nand_flash_dev nand_flash_ids[]; -extern struct nand_manufacturers nand_manuf_ids[]; - -/** - * struct nand_bbt_descr - bad block table descriptor - * @options: options for this descriptor - * @pages: the page(s) where we find the bbt, used with option BBT_ABSPAGE - * when bbt is searched, then we store the found bbts pages here. - * Its an array and supports up to 8 chips now - * @offs: offset of the pattern in the oob area of the page - * @veroffs: offset of the bbt version counter in the oob are of the page - * @version: version read from the bbt page during scan - * @len: length of the pattern, if 0 no pattern check is performed - * @maxblocks: maximum number of blocks to search for a bbt. This number of - * blocks is reserved at the end of the device where the tables are - * written. - * @reserved_block_code: if non-0, this pattern denotes a reserved (rather than - * bad) block in the stored bbt - * @pattern: pattern to identify bad block table or factory marked good / - * bad blocks, can be NULL, if len = 0 - * - * Descriptor for the bad block table marker and the descriptor for the - * pattern which identifies good and bad blocks. The assumption is made - * that the pattern and the version count are always located in the oob area - * of the first block. - */ -struct nand_bbt_descr { - int options; - int pages[NAND_MAX_CHIPS]; - int offs; - int veroffs; - uint8_t version[NAND_MAX_CHIPS]; - int len; - int maxblocks; - int reserved_block_code; - uint8_t *pattern; -}; - -/* Options for the bad block table descriptors */ - -/* The number of bits used per block in the bbt on the device */ -#define NAND_BBT_NRBITS_MSK 0x0000000F -#define NAND_BBT_1BIT 0x00000001 -#define NAND_BBT_2BIT 0x00000002 -#define NAND_BBT_4BIT 0x00000004 -#define NAND_BBT_8BIT 0x00000008 -/* The bad block table is in the last good block of the device */ -#define NAND_BBT_LASTBLOCK 0x00000010 -/* The bbt is at the given page, else we must scan for the bbt */ -#define NAND_BBT_ABSPAGE 0x00000020 -/* The bbt is at the given page, else we must scan for the bbt */ -#define NAND_BBT_SEARCH 0x00000040 -/* bbt is stored per chip on multichip devices */ -#define NAND_BBT_PERCHIP 0x00000080 -/* bbt has a version counter at offset veroffs */ -#define NAND_BBT_VERSION 0x00000100 -/* Create a bbt if none axists */ -#define NAND_BBT_CREATE 0x00000200 -/* Search good / bad pattern through all pages of a block */ -#define NAND_BBT_SCANALLPAGES 0x00000400 -/* Scan block empty during good / bad block scan */ -#define NAND_BBT_SCANEMPTY 0x00000800 -/* Write bbt if neccecary */ -#define NAND_BBT_WRITE 0x00001000 -/* Read and write back block contents when writing bbt */ -#define NAND_BBT_SAVECONTENT 0x00002000 -/* Search good / bad pattern on the first and the second page */ -#define NAND_BBT_SCAN2NDPAGE 0x00004000 - -/* The maximum number of blocks to scan for a bbt */ -#define NAND_BBT_SCAN_MAXBLOCKS 4 - -extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd); -extern int nand_update_bbt(struct mtd_info *mtd, loff_t offs); -extern int nand_default_bbt(struct mtd_info *mtd); -extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt); -extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, - int allowbbt); -extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len, - size_t * retlen, uint8_t * buf); - -/* -* Constants for oob configuration -*/ -#define NAND_SMALL_BADBLOCK_POS 5 -#define NAND_LARGE_BADBLOCK_POS 0 - -/** - * struct platform_nand_chip - chip level device structure - * @nr_chips: max. number of chips to scan for - * @chip_offset: chip number offset - * @nr_partitions: number of partitions pointed to by partitions (or zero) - * @partitions: mtd partition list - * @chip_delay: R/B delay value in us - * @options: Option flags, e.g. 16bit buswidth - * @ecclayout: ecc layout info structure - * @part_probe_types: NULL-terminated array of probe types - * @priv: hardware controller specific settings - */ -struct platform_nand_chip { - int nr_chips; - int chip_offset; - int nr_partitions; - struct mtd_partition *partitions; - struct nand_ecclayout *ecclayout; - int chip_delay; - unsigned int options; - const char **part_probe_types; - void *priv; -}; - -/** - * struct platform_nand_ctrl - controller level device structure - * @hwcontrol: platform specific hardware control structure - * @dev_ready: platform specific function to read ready/busy pin - * @select_chip: platform specific chip select function - * @cmd_ctrl: platform specific function for controlling - * ALE/CLE/nCE. Also used to write command and address - * @priv: private data to transport driver specific settings - * - * All fields are optional and depend on the hardware driver requirements - */ -struct platform_nand_ctrl { - void (*hwcontrol)(struct mtd_info *mtd, int cmd); - int (*dev_ready)(struct mtd_info *mtd); - void (*select_chip)(struct mtd_info *mtd, int chip); - void (*cmd_ctrl)(struct mtd_info *mtd, int dat, - unsigned int ctrl); - void *priv; -}; - -/** - * struct platform_nand_data - container structure for platform-specific data - * @chip: chip level chip structure - * @ctrl: controller level device structure - */ -struct platform_nand_data { - struct platform_nand_chip chip; - struct platform_nand_ctrl ctrl; -}; - -/* Some helpers to access the data structures */ -static inline -struct platform_nand_chip *get_platform_nandchip(struct mtd_info *mtd) -{ - struct nand_chip *chip = mtd->priv; - - return chip->priv; -} - -#endif /* __LINUX_MTD_NAND_H */ diff --git a/libdde_linux26/contrib/include/linux/mtd/nand_ecc.h b/libdde_linux26/contrib/include/linux/mtd/nand_ecc.h deleted file mode 100644 index 090da505..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/nand_ecc.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * drivers/mtd/nand_ecc.h - * - * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com) - * - * 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. - * - * This file is the header for the ECC algorithm. - */ - -#ifndef __MTD_NAND_ECC_H__ -#define __MTD_NAND_ECC_H__ - -struct mtd_info; - -/* - * Calculate 3 byte ECC code for 256 byte block - */ -int nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code); - -/* - * Detect and correct a 1 bit error for 256 byte block - */ -int nand_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, u_char *calc_ecc); - -#endif /* __MTD_NAND_ECC_H__ */ diff --git a/libdde_linux26/contrib/include/linux/mtd/ndfc.h b/libdde_linux26/contrib/include/linux/mtd/ndfc.h deleted file mode 100644 index d0558a98..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/ndfc.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * linux/include/linux/mtd/ndfc.h - * - * Copyright (c) 2006 Thomas Gleixner <tglx@linutronix.de> - * - * 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 defines, datastructures for ndfc nand controller - * - */ -#ifndef __LINUX_MTD_NDFC_H -#define __LINUX_MTD_NDFC_H - -/* NDFC Register definitions */ -#define NDFC_CMD 0x00 -#define NDFC_ALE 0x04 -#define NDFC_DATA 0x08 -#define NDFC_ECC 0x10 -#define NDFC_BCFG0 0x30 -#define NDFC_BCFG1 0x34 -#define NDFC_BCFG2 0x38 -#define NDFC_BCFG3 0x3c -#define NDFC_CCR 0x40 -#define NDFC_STAT 0x44 -#define NDFC_HWCTL 0x48 -#define NDFC_REVID 0x50 - -#define NDFC_STAT_IS_READY 0x01000000 - -#define NDFC_CCR_RESET_CE 0x80000000 /* CE Reset */ -#define NDFC_CCR_RESET_ECC 0x40000000 /* ECC Reset */ -#define NDFC_CCR_RIE 0x20000000 /* Interrupt Enable on Device Rdy */ -#define NDFC_CCR_REN 0x10000000 /* Enable wait for Rdy in LinearR */ -#define NDFC_CCR_ROMEN 0x08000000 /* Enable ROM In LinearR */ -#define NDFC_CCR_ARE 0x04000000 /* Auto-Read Enable */ -#define NDFC_CCR_BS(x) (((x) & 0x3) << 24) /* Select Bank on CE[x] */ -#define NDFC_CCR_BS_MASK 0x03000000 /* Select Bank */ -#define NDFC_CCR_ARAC0 0x00000000 /* 3 Addr, 1 Col 2 Row 512b page */ -#define NDFC_CCR_ARAC1 0x00001000 /* 4 Addr, 1 Col 3 Row 512b page */ -#define NDFC_CCR_ARAC2 0x00002000 /* 4 Addr, 2 Col 2 Row 2K page */ -#define NDFC_CCR_ARAC3 0x00003000 /* 5 Addr, 2 Col 3 Row 2K page */ -#define NDFC_CCR_ARAC_MASK 0x00003000 /* Auto-Read mode Addr Cycles */ -#define NDFC_CCR_RPG 0x0000C000 /* Auto-Read Page */ -#define NDFC_CCR_EBCC 0x00000004 /* EBC Configuration Completed */ -#define NDFC_CCR_DHC 0x00000002 /* Direct Hardware Control Enable */ - -#define NDFC_BxCFG_EN 0x80000000 /* Bank Enable */ -#define NDFC_BxCFG_CED 0x40000000 /* nCE Style */ -#define NDFC_BxCFG_SZ_MASK 0x08000000 /* Bank Size */ -#define NDFC_BxCFG_SZ_8BIT 0x00000000 /* 8bit */ -#define NDFC_BxCFG_SZ_16BIT 0x08000000 /* 16bit */ - -#define NDFC_MAX_BANKS 4 - -struct ndfc_controller_settings { - uint32_t ccr_settings; - uint64_t ndfc_erpn; -}; - -struct ndfc_chip_settings { - uint32_t bank_settings; -}; - -#endif diff --git a/libdde_linux26/contrib/include/linux/mtd/nftl.h b/libdde_linux26/contrib/include/linux/mtd/nftl.h deleted file mode 100644 index dcaf611e..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/nftl.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> - */ - -#ifndef __MTD_NFTL_H__ -#define __MTD_NFTL_H__ - -#include <linux/mtd/mtd.h> -#include <linux/mtd/blktrans.h> - -#include <mtd/nftl-user.h> - -/* 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_blktrans_dev mbd; - __u16 MediaUnit, SpareMediaUnit; - __u32 EraseSize; - struct NFTLMediaHeader MediaHdr; - int usecount; - unsigned char heads; - unsigned char sectors; - unsigned short cylinders; - __u16 numvunits; - __u16 lastEUN; /* should be suppressed */ - __u16 numfreeEUNs; - __u16 LastFreeEUN; /* To speed up finding a free EUN */ - int head,sect,cyl; - __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; - struct nand_ecclayout oobinfo; -}; - -int NFTL_mount(struct NFTLrecord *s); -int NFTL_formatblock(struct NFTLrecord *s, int block); - -int nftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len, - size_t *retlen, uint8_t *buf); -int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len, - size_t *retlen, uint8_t *buf); - -#ifndef NFTL_MAJOR -#define NFTL_MAJOR 93 -#endif - -#define MAX_NFTLS 16 -#define MAX_SECTORS_PER_UNIT 64 -#define NFTL_PARTN_BITS 4 - -#endif /* __MTD_NFTL_H__ */ diff --git a/libdde_linux26/contrib/include/linux/mtd/onenand.h b/libdde_linux26/contrib/include/linux/mtd/onenand.h deleted file mode 100644 index 9aa2a914..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/onenand.h +++ /dev/null @@ -1,193 +0,0 @@ -/* - * linux/include/linux/mtd/onenand.h - * - * Copyright (C) 2005-2007 Samsung Electronics - * Kyungmin Park <kyungmin.park@samsung.com> - * - * 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. - */ - -#ifndef __LINUX_MTD_ONENAND_H -#define __LINUX_MTD_ONENAND_H - -#include <linux/spinlock.h> -#include <linux/completion.h> -#include <linux/mtd/onenand_regs.h> -#include <linux/mtd/bbm.h> - -#define MAX_BUFFERRAM 2 - -/* Scan and identify a OneNAND device */ -extern int onenand_scan(struct mtd_info *mtd, int max_chips); -/* Free resources held by the OneNAND device */ -extern void onenand_release(struct mtd_info *mtd); - -/* - * onenand_state_t - chip states - * Enumeration for OneNAND flash chip state - */ -typedef enum { - FL_READY, - FL_READING, - FL_WRITING, - FL_ERASING, - FL_SYNCING, - FL_LOCKING, - FL_RESETING, - FL_OTPING, - FL_PM_SUSPENDED, -} onenand_state_t; - -/** - * struct onenand_bufferram - OneNAND BufferRAM Data - * @blockpage: block & page address in BufferRAM - */ -struct onenand_bufferram { - int blockpage; -}; - -/** - * struct onenand_chip - OneNAND Private Flash Chip Data - * @base: [BOARDSPECIFIC] address to access OneNAND - * @chipsize: [INTERN] the size of one chip for multichip arrays - * @device_id: [INTERN] device ID - * @density_mask: chip density, used for DDP devices - * @verstion_id: [INTERN] version ID - * @options: [BOARDSPECIFIC] various chip options. They can - * partly be set to inform onenand_scan about - * @erase_shift: [INTERN] number of address bits in a block - * @page_shift: [INTERN] number of address bits in a page - * @page_mask: [INTERN] a page per block mask - * @writesize: [INTERN] a real page size - * @bufferram_index: [INTERN] BufferRAM index - * @bufferram: [INTERN] BufferRAM info - * @readw: [REPLACEABLE] hardware specific function for read short - * @writew: [REPLACEABLE] hardware specific function for write short - * @command: [REPLACEABLE] hardware specific function for writing - * commands to the chip - * @wait: [REPLACEABLE] hardware specific function for wait on ready - * @read_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area - * @write_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area - * @read_word: [REPLACEABLE] hardware specific function for read - * register of OneNAND - * @write_word: [REPLACEABLE] hardware specific function for write - * register of OneNAND - * @mmcontrol: sync burst read function - * @block_markbad: function to mark a block as bad - * @scan_bbt: [REPLACEALBE] hardware specific function for scanning - * Bad block Table - * @chip_lock: [INTERN] spinlock used to protect access to this - * structure and the chip - * @wq: [INTERN] wait queue to sleep on if a OneNAND - * operation is in progress - * @state: [INTERN] the current state of the OneNAND device - * @page_buf: [INTERN] page main data buffer - * @oob_buf: [INTERN] page oob data buffer - * @subpagesize: [INTERN] holds the subpagesize - * @ecclayout: [REPLACEABLE] the default ecc placement scheme - * @bbm: [REPLACEABLE] pointer to Bad Block Management - * @priv: [OPTIONAL] pointer to private chip date - */ -struct onenand_chip { - void __iomem *base; - unsigned int chipsize; - unsigned int device_id; - unsigned int version_id; - unsigned int density_mask; - unsigned int options; - - unsigned int erase_shift; - unsigned int page_shift; - unsigned int page_mask; - unsigned int writesize; - - unsigned int bufferram_index; - struct onenand_bufferram bufferram[MAX_BUFFERRAM]; - - int (*command)(struct mtd_info *mtd, int cmd, loff_t address, size_t len); - int (*wait)(struct mtd_info *mtd, int state); - int (*read_bufferram)(struct mtd_info *mtd, int area, - unsigned char *buffer, int offset, size_t count); - int (*write_bufferram)(struct mtd_info *mtd, int area, - const unsigned char *buffer, int offset, size_t count); - unsigned short (*read_word)(void __iomem *addr); - void (*write_word)(unsigned short value, void __iomem *addr); - void (*mmcontrol)(struct mtd_info *mtd, int sync_read); - int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); - int (*scan_bbt)(struct mtd_info *mtd); - - struct completion complete; - int irq; - - spinlock_t chip_lock; - wait_queue_head_t wq; - onenand_state_t state; - unsigned char *page_buf; - unsigned char *oob_buf; - - int subpagesize; - struct nand_ecclayout *ecclayout; - - void *bbm; - - void *priv; -}; - -/* - * Helper macros - */ -#define ONENAND_CURRENT_BUFFERRAM(this) (this->bufferram_index) -#define ONENAND_NEXT_BUFFERRAM(this) (this->bufferram_index ^ 1) -#define ONENAND_SET_NEXT_BUFFERRAM(this) (this->bufferram_index ^= 1) -#define ONENAND_SET_PREV_BUFFERRAM(this) (this->bufferram_index ^= 1) -#define ONENAND_SET_BUFFERRAM0(this) (this->bufferram_index = 0) -#define ONENAND_SET_BUFFERRAM1(this) (this->bufferram_index = 1) - -#define ONENAND_GET_SYS_CFG1(this) \ - (this->read_word(this->base + ONENAND_REG_SYS_CFG1)) -#define ONENAND_SET_SYS_CFG1(v, this) \ - (this->write_word(v, this->base + ONENAND_REG_SYS_CFG1)) - -#define ONENAND_IS_DDP(this) \ - (this->device_id & ONENAND_DEVICE_IS_DDP) - -#ifdef CONFIG_MTD_ONENAND_2X_PROGRAM -#define ONENAND_IS_2PLANE(this) \ - (this->options & ONENAND_HAS_2PLANE) -#else -#define ONENAND_IS_2PLANE(this) (0) -#endif - -/* Check byte access in OneNAND */ -#define ONENAND_CHECK_BYTE_ACCESS(addr) (addr & 0x1) - -/* - * Options bits - */ -#define ONENAND_HAS_CONT_LOCK (0x0001) -#define ONENAND_HAS_UNLOCK_ALL (0x0002) -#define ONENAND_HAS_2PLANE (0x0004) -#define ONENAND_PAGEBUF_ALLOC (0x1000) -#define ONENAND_OOBBUF_ALLOC (0x2000) - -/* - * OneNAND Flash Manufacturer ID Codes - */ -#define ONENAND_MFR_SAMSUNG 0xec - -/** - * struct onenand_manufacturers - NAND Flash Manufacturer ID Structure - * @name: Manufacturer name - * @id: manufacturer ID code of device. -*/ -struct onenand_manufacturers { - int id; - char *name; -}; - -int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from, - struct mtd_oob_ops *ops); - -#endif /* __LINUX_MTD_ONENAND_H */ diff --git a/libdde_linux26/contrib/include/linux/mtd/onenand_regs.h b/libdde_linux26/contrib/include/linux/mtd/onenand_regs.h deleted file mode 100644 index 0c6bbe28..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/onenand_regs.h +++ /dev/null @@ -1,201 +0,0 @@ -/* - * linux/include/linux/mtd/onenand_regs.h - * - * OneNAND Register header file - * - * Copyright (C) 2005-2007 Samsung Electronics - * Kyungmin Park <kyungmin.park@samsung.com> - * - * 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. - */ - -#ifndef __ONENAND_REG_H -#define __ONENAND_REG_H - -/* Memory Address Map Translation (Word order) */ -#define ONENAND_MEMORY_MAP(x) ((x) << 1) - -/* - * External BufferRAM area - */ -#define ONENAND_BOOTRAM ONENAND_MEMORY_MAP(0x0000) -#define ONENAND_DATARAM ONENAND_MEMORY_MAP(0x0200) -#define ONENAND_SPARERAM ONENAND_MEMORY_MAP(0x8010) - -/* - * OneNAND Registers - */ -#define ONENAND_REG_MANUFACTURER_ID ONENAND_MEMORY_MAP(0xF000) -#define ONENAND_REG_DEVICE_ID ONENAND_MEMORY_MAP(0xF001) -#define ONENAND_REG_VERSION_ID ONENAND_MEMORY_MAP(0xF002) -#define ONENAND_REG_DATA_BUFFER_SIZE ONENAND_MEMORY_MAP(0xF003) -#define ONENAND_REG_BOOT_BUFFER_SIZE ONENAND_MEMORY_MAP(0xF004) -#define ONENAND_REG_NUM_BUFFERS ONENAND_MEMORY_MAP(0xF005) -#define ONENAND_REG_TECHNOLOGY ONENAND_MEMORY_MAP(0xF006) - -#define ONENAND_REG_START_ADDRESS1 ONENAND_MEMORY_MAP(0xF100) -#define ONENAND_REG_START_ADDRESS2 ONENAND_MEMORY_MAP(0xF101) -#define ONENAND_REG_START_ADDRESS3 ONENAND_MEMORY_MAP(0xF102) -#define ONENAND_REG_START_ADDRESS4 ONENAND_MEMORY_MAP(0xF103) -#define ONENAND_REG_START_ADDRESS5 ONENAND_MEMORY_MAP(0xF104) -#define ONENAND_REG_START_ADDRESS6 ONENAND_MEMORY_MAP(0xF105) -#define ONENAND_REG_START_ADDRESS7 ONENAND_MEMORY_MAP(0xF106) -#define ONENAND_REG_START_ADDRESS8 ONENAND_MEMORY_MAP(0xF107) - -#define ONENAND_REG_START_BUFFER ONENAND_MEMORY_MAP(0xF200) -#define ONENAND_REG_COMMAND ONENAND_MEMORY_MAP(0xF220) -#define ONENAND_REG_SYS_CFG1 ONENAND_MEMORY_MAP(0xF221) -#define ONENAND_REG_SYS_CFG2 ONENAND_MEMORY_MAP(0xF222) -#define ONENAND_REG_CTRL_STATUS ONENAND_MEMORY_MAP(0xF240) -#define ONENAND_REG_INTERRUPT ONENAND_MEMORY_MAP(0xF241) -#define ONENAND_REG_START_BLOCK_ADDRESS ONENAND_MEMORY_MAP(0xF24C) -#define ONENAND_REG_END_BLOCK_ADDRESS ONENAND_MEMORY_MAP(0xF24D) -#define ONENAND_REG_WP_STATUS ONENAND_MEMORY_MAP(0xF24E) - -#define ONENAND_REG_ECC_STATUS ONENAND_MEMORY_MAP(0xFF00) -#define ONENAND_REG_ECC_M0 ONENAND_MEMORY_MAP(0xFF01) -#define ONENAND_REG_ECC_S0 ONENAND_MEMORY_MAP(0xFF02) -#define ONENAND_REG_ECC_M1 ONENAND_MEMORY_MAP(0xFF03) -#define ONENAND_REG_ECC_S1 ONENAND_MEMORY_MAP(0xFF04) -#define ONENAND_REG_ECC_M2 ONENAND_MEMORY_MAP(0xFF05) -#define ONENAND_REG_ECC_S2 ONENAND_MEMORY_MAP(0xFF06) -#define ONENAND_REG_ECC_M3 ONENAND_MEMORY_MAP(0xFF07) -#define ONENAND_REG_ECC_S3 ONENAND_MEMORY_MAP(0xFF08) - -/* - * Device ID Register F001h (R) - */ -#define ONENAND_DEVICE_DENSITY_MASK (0xf) -#define ONENAND_DEVICE_DENSITY_SHIFT (4) -#define ONENAND_DEVICE_IS_DDP (1 << 3) -#define ONENAND_DEVICE_IS_DEMUX (1 << 2) -#define ONENAND_DEVICE_VCC_MASK (0x3) - -#define ONENAND_DEVICE_DENSITY_512Mb (0x002) -#define ONENAND_DEVICE_DENSITY_1Gb (0x003) -#define ONENAND_DEVICE_DENSITY_2Gb (0x004) -#define ONENAND_DEVICE_DENSITY_4Gb (0x005) - -/* - * Version ID Register F002h (R) - */ -#define ONENAND_VERSION_PROCESS_SHIFT (8) - -/* - * Start Address 1 F100h (R/W) & Start Address 2 F101h (R/W) - */ -#define ONENAND_DDP_SHIFT (15) -#define ONENAND_DDP_CHIP0 (0) -#define ONENAND_DDP_CHIP1 (1 << ONENAND_DDP_SHIFT) - -/* - * Start Address 8 F107h (R/W) - */ -#define ONENAND_FPA_MASK (0x3f) -#define ONENAND_FPA_SHIFT (2) -#define ONENAND_FSA_MASK (0x03) - -/* - * Start Buffer Register F200h (R/W) - */ -#define ONENAND_BSA_MASK (0x03) -#define ONENAND_BSA_SHIFT (8) -#define ONENAND_BSA_BOOTRAM (0 << 2) -#define ONENAND_BSA_DATARAM0 (2 << 2) -#define ONENAND_BSA_DATARAM1 (3 << 2) -#define ONENAND_BSC_MASK (0x03) - -/* - * Command Register F220h (R/W) - */ -#define ONENAND_CMD_READ (0x00) -#define ONENAND_CMD_READOOB (0x13) -#define ONENAND_CMD_PROG (0x80) -#define ONENAND_CMD_PROGOOB (0x1A) -#define ONENAND_CMD_2X_PROG (0x7D) -#define ONENAND_CMD_2X_CACHE_PROG (0x7F) -#define ONENAND_CMD_UNLOCK (0x23) -#define ONENAND_CMD_LOCK (0x2A) -#define ONENAND_CMD_LOCK_TIGHT (0x2C) -#define ONENAND_CMD_UNLOCK_ALL (0x27) -#define ONENAND_CMD_ERASE (0x94) -#define ONENAND_CMD_RESET (0xF0) -#define ONENAND_CMD_OTP_ACCESS (0x65) -#define ONENAND_CMD_READID (0x90) - -/* NOTE: Those are not *REAL* commands */ -#define ONENAND_CMD_BUFFERRAM (0x1978) - -/* - * System Configuration 1 Register F221h (R, R/W) - */ -#define ONENAND_SYS_CFG1_SYNC_READ (1 << 15) -#define ONENAND_SYS_CFG1_BRL_7 (7 << 12) -#define ONENAND_SYS_CFG1_BRL_6 (6 << 12) -#define ONENAND_SYS_CFG1_BRL_5 (5 << 12) -#define ONENAND_SYS_CFG1_BRL_4 (4 << 12) -#define ONENAND_SYS_CFG1_BRL_3 (3 << 12) -#define ONENAND_SYS_CFG1_BRL_10 (2 << 12) -#define ONENAND_SYS_CFG1_BRL_9 (1 << 12) -#define ONENAND_SYS_CFG1_BRL_8 (0 << 12) -#define ONENAND_SYS_CFG1_BRL_SHIFT (12) -#define ONENAND_SYS_CFG1_BL_32 (4 << 9) -#define ONENAND_SYS_CFG1_BL_16 (3 << 9) -#define ONENAND_SYS_CFG1_BL_8 (2 << 9) -#define ONENAND_SYS_CFG1_BL_4 (1 << 9) -#define ONENAND_SYS_CFG1_BL_CONT (0 << 9) -#define ONENAND_SYS_CFG1_BL_SHIFT (9) -#define ONENAND_SYS_CFG1_NO_ECC (1 << 8) -#define ONENAND_SYS_CFG1_RDY (1 << 7) -#define ONENAND_SYS_CFG1_INT (1 << 6) -#define ONENAND_SYS_CFG1_IOBE (1 << 5) -#define ONENAND_SYS_CFG1_RDY_CONF (1 << 4) -#define ONENAND_SYS_CFG1_HF (1 << 2) -#define ONENAND_SYS_CFG1_SYNC_WRITE (1 << 1) - -/* - * Controller Status Register F240h (R) - */ -#define ONENAND_CTRL_ONGO (1 << 15) -#define ONENAND_CTRL_LOCK (1 << 14) -#define ONENAND_CTRL_LOAD (1 << 13) -#define ONENAND_CTRL_PROGRAM (1 << 12) -#define ONENAND_CTRL_ERASE (1 << 11) -#define ONENAND_CTRL_ERROR (1 << 10) -#define ONENAND_CTRL_RSTB (1 << 7) -#define ONENAND_CTRL_OTP_L (1 << 6) -#define ONENAND_CTRL_OTP_BL (1 << 5) - -/* - * Interrupt Status Register F241h (R) - */ -#define ONENAND_INT_MASTER (1 << 15) -#define ONENAND_INT_READ (1 << 7) -#define ONENAND_INT_WRITE (1 << 6) -#define ONENAND_INT_ERASE (1 << 5) -#define ONENAND_INT_RESET (1 << 4) -#define ONENAND_INT_CLEAR (0 << 0) - -/* - * NAND Flash Write Protection Status Register F24Eh (R) - */ -#define ONENAND_WP_US (1 << 2) -#define ONENAND_WP_LS (1 << 1) -#define ONENAND_WP_LTS (1 << 0) - -/* - * ECC Status Reigser FF00h (R) - */ -#define ONENAND_ECC_1BIT (1 << 0) -#define ONENAND_ECC_1BIT_ALL (0x5555) -#define ONENAND_ECC_2BIT (1 << 1) -#define ONENAND_ECC_2BIT_ALL (0xAAAA) - -/* - * One-Time Programmable (OTP) - */ -#define ONENAND_OTP_LOCK_OFFSET (14) - -#endif /* __ONENAND_REG_H */ diff --git a/libdde_linux26/contrib/include/linux/mtd/partitions.h b/libdde_linux26/contrib/include/linux/mtd/partitions.h deleted file mode 100644 index a45dd831..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/partitions.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * MTD partitioning layer definitions - * - * (C) 2000 Nicolas Pitre <nico@cam.org> - * - * This code is GPL - */ - -#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 defined as MTDPART_SIZ_FULL, the partition - * will extend to the end of the master MTD device. - * offset: absolute starting position within the master MTD device; if - * defined as MTDPART_OFS_APPEND, the partition will start where the - * previous one ended; if MTDPART_OFS_NXTBLK, at the next erase block. - * 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 (e.g. use MTDPART_OFS_NEXTBLK). - */ - -struct mtd_partition { - char *name; /* identifier string */ - uint64_t size; /* partition size */ - uint64_t offset; /* offset within the master MTD space */ - uint32_t mask_flags; /* master MTD flags to mask out for this partition */ - struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only)*/ - struct mtd_info **mtdp; /* pointer to store the MTD object */ -}; - -#define MTDPART_OFS_NXTBLK (-2) -#define MTDPART_OFS_APPEND (-1) -#define MTDPART_SIZ_FULL (0) - - -int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int); -int del_mtd_partitions(struct mtd_info *); - -/* - * Functions dealing with the various ways of partitioning the space - */ - -struct mtd_part_parser { - struct list_head list; - struct module *owner; - const char *name; - int (*parse_fn)(struct mtd_info *, struct mtd_partition **, unsigned long); -}; - -extern int register_mtd_parser(struct mtd_part_parser *parser); -extern int deregister_mtd_parser(struct mtd_part_parser *parser); -extern int parse_mtd_partitions(struct mtd_info *master, const char **types, - struct mtd_partition **pparts, unsigned long origin); - -#define put_partition_parser(p) do { module_put((p)->owner); } while(0) - -struct device; -struct device_node; - -int __devinit of_mtd_parse_partitions(struct device *dev, - struct device_node *node, - struct mtd_partition **pparts); - -#endif diff --git a/libdde_linux26/contrib/include/linux/mtd/pfow.h b/libdde_linux26/contrib/include/linux/mtd/pfow.h deleted file mode 100644 index b730d4f8..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/pfow.h +++ /dev/null @@ -1,159 +0,0 @@ -/* Primary function overlay window definitions - * and service functions used by LPDDR chips - */ -#ifndef __LINUX_MTD_PFOW_H -#define __LINUX_MTD_PFOW_H - -#include <linux/mtd/qinfo.h> - -/* PFOW registers addressing */ -/* Address of symbol "P" */ -#define PFOW_QUERY_STRING_P 0x0000 -/* Address of symbol "F" */ -#define PFOW_QUERY_STRING_F 0x0002 -/* Address of symbol "O" */ -#define PFOW_QUERY_STRING_O 0x0004 -/* Address of symbol "W" */ -#define PFOW_QUERY_STRING_W 0x0006 -/* Identification info for LPDDR chip */ -#define PFOW_MANUFACTURER_ID 0x0020 -#define PFOW_DEVICE_ID 0x0022 -/* Address in PFOW where prog buffer can can be found */ -#define PFOW_PROGRAM_BUFFER_OFFSET 0x0040 -/* Size of program buffer in words */ -#define PFOW_PROGRAM_BUFFER_SIZE 0x0042 -/* Address command code register */ -#define PFOW_COMMAND_CODE 0x0080 -/* command data register */ -#define PFOW_COMMAND_DATA 0x0084 -/* command address register lower address bits */ -#define PFOW_COMMAND_ADDRESS_L 0x0088 -/* command address register upper address bits */ -#define PFOW_COMMAND_ADDRESS_H 0x008a -/* number of bytes to be proggrammed lower address bits */ -#define PFOW_DATA_COUNT_L 0x0090 -/* number of bytes to be proggrammed higher address bits */ -#define PFOW_DATA_COUNT_H 0x0092 -/* command execution register, the only possible value is 0x01 */ -#define PFOW_COMMAND_EXECUTE 0x00c0 -/* 0x01 should be written at this address to clear buffer */ -#define PFOW_CLEAR_PROGRAM_BUFFER 0x00c4 -/* device program/erase suspend register */ -#define PFOW_PROGRAM_ERASE_SUSPEND 0x00c8 -/* device status register */ -#define PFOW_DSR 0x00cc - -/* LPDDR memory device command codes */ -/* They are possible values of PFOW command code register */ -#define LPDDR_WORD_PROGRAM 0x0041 -#define LPDDR_BUFF_PROGRAM 0x00E9 -#define LPDDR_BLOCK_ERASE 0x0020 -#define LPDDR_LOCK_BLOCK 0x0061 -#define LPDDR_UNLOCK_BLOCK 0x0062 -#define LPDDR_READ_BLOCK_LOCK_STATUS 0x0065 -#define LPDDR_INFO_QUERY 0x0098 -#define LPDDR_READ_OTP 0x0097 -#define LPDDR_PROG_OTP 0x00C0 -#define LPDDR_RESUME 0x00D0 - -/* Defines possible value of PFOW command execution register */ -#define LPDDR_START_EXECUTION 0x0001 - -/* Defines possible value of PFOW program/erase suspend register */ -#define LPDDR_SUSPEND 0x0001 - -/* Possible values of PFOW device status register */ -/* access R - read; RC read & clearable */ -#define DSR_DPS (1<<1) /* RC; device protect status - * 0 - not protected 1 - locked */ -#define DSR_PSS (1<<2) /* R; program suspend status; - * 0-prog in progress/completed, - * 1- prog suspended */ -#define DSR_VPPS (1<<3) /* RC; 0-Vpp OK, * 1-Vpp low */ -#define DSR_PROGRAM_STATUS (1<<4) /* RC; 0-successful, 1-error */ -#define DSR_ERASE_STATUS (1<<5) /* RC; erase or blank check status; - * 0-success erase/blank check, - * 1 blank check error */ -#define DSR_ESS (1<<6) /* R; erase suspend status; - * 0-erase in progress/complete, - * 1 erase suspended */ -#define DSR_READY_STATUS (1<<7) /* R; Device status - * 0-busy, - * 1-ready */ -#define DSR_RPS (0x3<<8) /* RC; region program status - * 00 - Success, - * 01-re-program attempt in region with - * object mode data, - * 10-object mode program w attempt in - * region with control mode data - * 11-attempt to program invalid half - * with 0x41 command */ -#define DSR_AOS (1<<12) /* RC; 1- AO related failure */ -#define DSR_AVAILABLE (1<<15) /* R; Device availbility - * 1 - Device available - * 0 - not available */ - -/* The superset of all possible error bits in DSR */ -#define DSR_ERR 0x133A - -static inline void send_pfow_command(struct map_info *map, - unsigned long cmd_code, unsigned long adr, - unsigned long len, map_word *datum) -{ - int bits_per_chip = map_bankwidth(map) * 8; - int chipnum; - struct lpddr_private *lpddr = map->fldrv_priv; - chipnum = adr >> lpddr->chipshift; - - map_write(map, CMD(cmd_code), map->pfow_base + PFOW_COMMAND_CODE); - map_write(map, CMD(adr & ((1<<bits_per_chip) - 1)), - map->pfow_base + PFOW_COMMAND_ADDRESS_L); - map_write(map, CMD(adr>>bits_per_chip), - map->pfow_base + PFOW_COMMAND_ADDRESS_H); - if (len) { - map_write(map, CMD(len & ((1<<bits_per_chip) - 1)), - map->pfow_base + PFOW_DATA_COUNT_L); - map_write(map, CMD(len>>bits_per_chip), - map->pfow_base + PFOW_DATA_COUNT_H); - } - if (datum) - map_write(map, *datum, map->pfow_base + PFOW_COMMAND_DATA); - - /* Command execution start */ - map_write(map, CMD(LPDDR_START_EXECUTION), - map->pfow_base + PFOW_COMMAND_EXECUTE); -} - -static inline void print_drs_error(unsigned dsr) -{ - int prog_status = (dsr & DSR_RPS) >> 8; - - if (!(dsr & DSR_AVAILABLE)) - printk(KERN_NOTICE"DSR.15: (0) Device not Available\n"); - if (prog_status & 0x03) - printk(KERN_NOTICE"DSR.9,8: (11) Attempt to program invalid " - "half with 41h command\n"); - else if (prog_status & 0x02) - printk(KERN_NOTICE"DSR.9,8: (10) Object Mode Program attempt " - "in region with Control Mode data\n"); - else if (prog_status & 0x01) - printk(KERN_NOTICE"DSR.9,8: (01) Program attempt in region " - "with Object Mode data\n"); - if (!(dsr & DSR_READY_STATUS)) - printk(KERN_NOTICE"DSR.7: (0) Device is Busy\n"); - if (dsr & DSR_ESS) - printk(KERN_NOTICE"DSR.6: (1) Erase Suspended\n"); - if (dsr & DSR_ERASE_STATUS) - printk(KERN_NOTICE"DSR.5: (1) Erase/Blank check error\n"); - if (dsr & DSR_PROGRAM_STATUS) - printk(KERN_NOTICE"DSR.4: (1) Program Error\n"); - if (dsr & DSR_VPPS) - printk(KERN_NOTICE"DSR.3: (1) Vpp low detect, operation " - "aborted\n"); - if (dsr & DSR_PSS) - printk(KERN_NOTICE"DSR.2: (1) Program suspended\n"); - if (dsr & DSR_DPS) - printk(KERN_NOTICE"DSR.1: (1) Aborted Erase/Program attempt " - "on locked block\n"); -} -#endif /* __LINUX_MTD_PFOW_H */ diff --git a/libdde_linux26/contrib/include/linux/mtd/physmap.h b/libdde_linux26/contrib/include/linux/mtd/physmap.h deleted file mode 100644 index 76f7cabf..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/physmap.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * For boards with physically mapped flash and using - * drivers/mtd/maps/physmap.c mapping driver. - * - * Copyright (C) 2003 MontaVista Software Inc. - * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - */ - -#ifndef __LINUX_MTD_PHYSMAP__ -#define __LINUX_MTD_PHYSMAP__ - -#include <linux/mtd/mtd.h> -#include <linux/mtd/partitions.h> - -struct map_info; - -struct physmap_flash_data { - unsigned int width; - void (*set_vpp)(struct map_info *, int); - unsigned int nr_parts; - unsigned int pfow_base; - struct mtd_partition *parts; -}; - -/* - * Board needs to specify the exact mapping during their setup time. - */ -void physmap_configure(unsigned long addr, unsigned long size, - int bankwidth, void (*set_vpp)(struct map_info *, int) ); - -#ifdef CONFIG_MTD_PARTITIONS - -/* - * Machines that wish to do flash partition may want to call this function in - * their setup routine. - * - * physmap_set_partitions(mypartitions, num_parts); - * - * Note that one can always override this hard-coded partition with - * command line partition (you need to enable CONFIG_MTD_CMDLINE_PARTS). - */ -void physmap_set_partitions(struct mtd_partition *parts, int num_parts); - -#endif /* defined(CONFIG_MTD_PARTITIONS) */ - -#endif /* __LINUX_MTD_PHYSMAP__ */ diff --git a/libdde_linux26/contrib/include/linux/mtd/plat-ram.h b/libdde_linux26/contrib/include/linux/mtd/plat-ram.h deleted file mode 100644 index e07890af..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/plat-ram.h +++ /dev/null @@ -1,34 +0,0 @@ -/* linux/include/linux/mtd/plat-ram.h - * - * (c) 2004 Simtec Electronics - * http://www.simtec.co.uk/products/SWLINUX/ - * Ben Dooks <ben@simtec.co.uk> - * - * Generic platform device based RAM map - * - * 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. - * - */ - -#ifndef __LINUX_MTD_PLATRAM_H -#define __LINUX_MTD_PLATRAM_H __FILE__ - -#define PLATRAM_RO (0) -#define PLATRAM_RW (1) - -struct platdata_mtd_ram { - const char *mapname; - const char **map_probes; - const char **probes; - struct mtd_partition *partitions; - int nr_partitions; - int bankwidth; - - /* control callbacks */ - - void (*set_rw)(struct device *dev, int to); -}; - -#endif /* __LINUX_MTD_PLATRAM_H */ diff --git a/libdde_linux26/contrib/include/linux/mtd/pmc551.h b/libdde_linux26/contrib/include/linux/mtd/pmc551.h deleted file mode 100644 index 27ad40ae..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/pmc551.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * PMC551 PCI Mezzanine Ram Device - * - * Author: - * Mark Ferrell - * Copyright 1999,2000 Nortel Networks - * - * License: - * As part of this driver was derrived from the slram.c driver it falls - * under the same license, which is GNU General Public License v2 - */ - -#ifndef __MTD_PMC551_H__ -#define __MTD_PMC551_H__ - -#include <linux/mtd/mtd.h> - -#define PMC551_VERSION \ - "Ramix PMC551 PCI Mezzanine Ram Driver. (C) 1999,2000 Nortel Networks.\n" - -/* - * Our personal and private information - */ -struct mypriv { - struct pci_dev *dev; - u_char *start; - u32 base_map0; - u32 curr_map0; - u32 asize; - struct mtd_info *nextpmc551; -}; - -/* - * Function Prototypes - */ -static int pmc551_erase(struct mtd_info *, struct erase_info *); -static void pmc551_unpoint(struct mtd_info *, loff_t, size_t); -static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, - size_t *retlen, void **virt, resource_size_t *phys); -static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); -static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); - - -/* - * 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_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) (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)) - - -#endif /* __MTD_PMC551_H__ */ - diff --git a/libdde_linux26/contrib/include/linux/mtd/qinfo.h b/libdde_linux26/contrib/include/linux/mtd/qinfo.h deleted file mode 100644 index 7b3d487d..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/qinfo.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef __LINUX_MTD_QINFO_H -#define __LINUX_MTD_QINFO_H - -#include <linux/mtd/map.h> -#include <linux/wait.h> -#include <linux/spinlock.h> -#include <linux/delay.h> -#include <linux/mtd/mtd.h> -#include <linux/mtd/flashchip.h> -#include <linux/mtd/partitions.h> - -/* lpddr_private describes lpddr flash chip in memory map - * @ManufactId - Chip Manufacture ID - * @DevId - Chip Device ID - * @qinfo - pointer to qinfo records describing the chip - * @numchips - number of chips including virual RWW partitions - * @chipshift - Chip/partiton size 2^chipshift - * @chips - per-chip data structure - */ -struct lpddr_private { - uint16_t ManufactId; - uint16_t DevId; - struct qinfo_chip *qinfo; - int numchips; - unsigned long chipshift; - struct flchip chips[0]; -}; - -/* qinfo_query_info structure contains request information for - * each qinfo record - * @major - major number of qinfo record - * @major - minor number of qinfo record - * @id_str - descriptive string to access the record - * @desc - detailed description for the qinfo record - */ -struct qinfo_query_info { - uint8_t major; - uint8_t minor; - char *id_str; - char *desc; -}; - -/* - * qinfo_chip structure contains necessary qinfo records data - * @DevSizeShift - Device size 2^n bytes - * @BufSizeShift - Program buffer size 2^n bytes - * @TotalBlocksNum - Total number of blocks - * @UniformBlockSizeShift - Uniform block size 2^UniformBlockSizeShift bytes - * @HWPartsNum - Number of hardware partitions - * @SuspEraseSupp - Suspend erase supported - * @SingleWordProgTime - Single word program 2^SingleWordProgTime u-sec - * @ProgBufferTime - Program buffer write 2^ProgBufferTime u-sec - * @BlockEraseTime - Block erase 2^BlockEraseTime m-sec - */ -struct qinfo_chip { - /* General device info */ - uint16_t DevSizeShift; - uint16_t BufSizeShift; - /* Erase block information */ - uint16_t TotalBlocksNum; - uint16_t UniformBlockSizeShift; - /* Partition information */ - uint16_t HWPartsNum; - /* Optional features */ - uint16_t SuspEraseSupp; - /* Operation typical time */ - uint16_t SingleWordProgTime; - uint16_t ProgBufferTime; - uint16_t BlockEraseTime; -}; - -/* defines for fixup usage */ -#define LPDDR_MFR_ANY 0xffff -#define LPDDR_ID_ANY 0xffff -#define NUMONYX_MFGR_ID 0x0089 -#define R18_DEVICE_ID_1G 0x893c - -static inline map_word lpddr_build_cmd(u_long cmd, struct map_info *map) -{ - map_word val = { {0} }; - val.x[0] = cmd; - return val; -} - -#define CMD(x) lpddr_build_cmd(x, map) -#define CMDVAL(cmd) cmd.x[0] - -struct mtd_info *lpddr_cmdset(struct map_info *); - -#endif - diff --git a/libdde_linux26/contrib/include/linux/mtd/sh_flctl.h b/libdde_linux26/contrib/include/linux/mtd/sh_flctl.h deleted file mode 100644 index e77c1cea..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/sh_flctl.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * SuperH FLCTL nand controller - * - * Copyright © 2008 Renesas Solutions Corp. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __SH_FLCTL_H__ -#define __SH_FLCTL_H__ - -#include <linux/mtd/mtd.h> -#include <linux/mtd/nand.h> -#include <linux/mtd/partitions.h> - -/* FLCTL registers */ -#define FLCMNCR(f) (f->reg + 0x0) -#define FLCMDCR(f) (f->reg + 0x4) -#define FLCMCDR(f) (f->reg + 0x8) -#define FLADR(f) (f->reg + 0xC) -#define FLADR2(f) (f->reg + 0x3C) -#define FLDATAR(f) (f->reg + 0x10) -#define FLDTCNTR(f) (f->reg + 0x14) -#define FLINTDMACR(f) (f->reg + 0x18) -#define FLBSYTMR(f) (f->reg + 0x1C) -#define FLBSYCNT(f) (f->reg + 0x20) -#define FLDTFIFO(f) (f->reg + 0x24) -#define FLECFIFO(f) (f->reg + 0x28) -#define FLTRCR(f) (f->reg + 0x2C) -#define FL4ECCRESULT0(f) (f->reg + 0x80) -#define FL4ECCRESULT1(f) (f->reg + 0x84) -#define FL4ECCRESULT2(f) (f->reg + 0x88) -#define FL4ECCRESULT3(f) (f->reg + 0x8C) -#define FL4ECCCR(f) (f->reg + 0x90) -#define FL4ECCCNT(f) (f->reg + 0x94) -#define FLERRADR(f) (f->reg + 0x98) - -/* FLCMNCR control bits */ -#define ECCPOS2 (0x1 << 25) -#define _4ECCCNTEN (0x1 << 24) -#define _4ECCEN (0x1 << 23) -#define _4ECCCORRECT (0x1 << 22) -#define SNAND_E (0x1 << 18) /* SNAND (0=512 1=2048)*/ -#define QTSEL_E (0x1 << 17) -#define ENDIAN (0x1 << 16) /* 1 = little endian */ -#define FCKSEL_E (0x1 << 15) -#define ECCPOS_00 (0x00 << 12) -#define ECCPOS_01 (0x01 << 12) -#define ECCPOS_02 (0x02 << 12) -#define ACM_SACCES_MODE (0x01 << 10) -#define NANWF_E (0x1 << 9) -#define SE_D (0x1 << 8) /* Spare area disable */ -#define CE1_ENABLE (0x1 << 4) /* Chip Enable 1 */ -#define CE0_ENABLE (0x1 << 3) /* Chip Enable 0 */ -#define TYPESEL_SET (0x1 << 0) - -/* FLCMDCR control bits */ -#define ADRCNT2_E (0x1 << 31) /* 5byte address enable */ -#define ADRMD_E (0x1 << 26) /* Sector address access */ -#define CDSRC_E (0x1 << 25) /* Data buffer selection */ -#define DOSR_E (0x1 << 24) /* Status read check */ -#define SELRW (0x1 << 21) /* 0:read 1:write */ -#define DOADR_E (0x1 << 20) /* Address stage execute */ -#define ADRCNT_1 (0x00 << 18) /* Address data bytes: 1byte */ -#define ADRCNT_2 (0x01 << 18) /* Address data bytes: 2byte */ -#define ADRCNT_3 (0x02 << 18) /* Address data bytes: 3byte */ -#define ADRCNT_4 (0x03 << 18) /* Address data bytes: 4byte */ -#define DOCMD2_E (0x1 << 17) /* 2nd cmd stage execute */ -#define DOCMD1_E (0x1 << 16) /* 1st cmd stage execute */ - -/* FLTRCR control bits */ -#define TRSTRT (0x1 << 0) /* translation start */ -#define TREND (0x1 << 1) /* translation end */ - -/* FL4ECCCR control bits */ -#define _4ECCFA (0x1 << 2) /* 4 symbols correct fault */ -#define _4ECCEND (0x1 << 1) /* 4 symbols end */ -#define _4ECCEXST (0x1 << 0) /* 4 symbols exist */ - -#define INIT_FL4ECCRESULT_VAL 0x03FF03FF -#define LOOP_TIMEOUT_MAX 0x00010000 - -#define mtd_to_flctl(mtd) container_of(mtd, struct sh_flctl, mtd) - -struct sh_flctl { - struct mtd_info mtd; - struct nand_chip chip; - void __iomem *reg; - - uint8_t done_buff[2048 + 64]; /* max size 2048 + 64 */ - int read_bytes; - int index; - int seqin_column; /* column in SEQIN cmd */ - int seqin_page_addr; /* page_addr in SEQIN cmd */ - uint32_t seqin_read_cmd; /* read cmd in SEQIN cmd */ - int erase1_page_addr; /* page_addr in ERASE1 cmd */ - uint32_t erase_ADRCNT; /* bits of FLCMDCR in ERASE1 cmd */ - uint32_t rw_ADRCNT; /* bits of FLCMDCR in READ WRITE cmd */ - - int hwecc_cant_correct[4]; - - unsigned page_size:1; /* NAND page size (0 = 512, 1 = 2048) */ - unsigned hwecc:1; /* Hardware ECC (0 = disabled, 1 = enabled) */ -}; - -struct sh_flctl_platform_data { - struct mtd_partition *parts; - int nr_parts; - unsigned long flcmncr_val; - - unsigned has_hwecc:1; -}; - -#endif /* __SH_FLCTL_H__ */ diff --git a/libdde_linux26/contrib/include/linux/mtd/sharpsl.h b/libdde_linux26/contrib/include/linux/mtd/sharpsl.h deleted file mode 100644 index 25f4d2a8..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/sharpsl.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * SharpSL NAND support - * - * Copyright (C) 2008 Dmitry Baryshkov - * - * 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. - */ - -#include <linux/mtd/nand.h> -#include <linux/mtd/nand_ecc.h> -#include <linux/mtd/partitions.h> - -struct sharpsl_nand_platform_data { - struct nand_bbt_descr *badblock_pattern; - struct nand_ecclayout *ecc_layout; - struct mtd_partition *partitions; - unsigned int nr_partitions; -}; diff --git a/libdde_linux26/contrib/include/linux/mtd/super.h b/libdde_linux26/contrib/include/linux/mtd/super.h deleted file mode 100644 index 4016dd6f..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/super.h +++ /dev/null @@ -1,30 +0,0 @@ -/* MTD-based superblock handling - * - * Copyright © 2006 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#ifndef __MTD_SUPER_H__ -#define __MTD_SUPER_H__ - -#ifdef __KERNEL__ - -#include <linux/mtd/mtd.h> -#include <linux/fs.h> -#include <linux/mount.h> - -extern int get_sb_mtd(struct file_system_type *fs_type, int flags, - const char *dev_name, void *data, - int (*fill_super)(struct super_block *, void *, int), - struct vfsmount *mnt); -extern void kill_mtd_super(struct super_block *sb); - - -#endif /* __KERNEL__ */ - -#endif /* __MTD_SUPER_H__ */ diff --git a/libdde_linux26/contrib/include/linux/mtd/ubi.h b/libdde_linux26/contrib/include/linux/mtd/ubi.h deleted file mode 100644 index 6316fafe..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/ubi.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) International Business Machines Corp., 2006 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See - * the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Author: Artem Bityutskiy (Битюцкий Артём) - */ - -#ifndef __LINUX_UBI_H__ -#define __LINUX_UBI_H__ - -#include <asm/ioctl.h> -#include <linux/types.h> -#include <mtd/ubi-user.h> - -/* - * enum ubi_open_mode - UBI volume open mode constants. - * - * UBI_READONLY: read-only mode - * UBI_READWRITE: read-write mode - * UBI_EXCLUSIVE: exclusive mode - */ -enum { - UBI_READONLY = 1, - UBI_READWRITE, - UBI_EXCLUSIVE -}; - -/** - * struct ubi_volume_info - UBI volume description data structure. - * @vol_id: volume ID - * @ubi_num: UBI device number this volume belongs to - * @size: how many physical eraseblocks are reserved for this volume - * @used_bytes: how many bytes of data this volume contains - * @used_ebs: how many physical eraseblocks of this volume actually contain any - * data - * @vol_type: volume type (%UBI_DYNAMIC_VOLUME or %UBI_STATIC_VOLUME) - * @corrupted: non-zero if the volume is corrupted (static volumes only) - * @upd_marker: non-zero if the volume has update marker set - * @alignment: volume alignment - * @usable_leb_size: how many bytes are available in logical eraseblocks of - * this volume - * @name_len: volume name length - * @name: volume name - * @cdev: UBI volume character device major and minor numbers - * - * The @corrupted flag is only relevant to static volumes and is always zero - * for dynamic ones. This is because UBI does not care about dynamic volume - * data protection and only cares about protecting static volume data. - * - * The @upd_marker flag is set if the volume update operation was interrupted. - * Before touching the volume data during the update operation, UBI first sets - * the update marker flag for this volume. If the volume update operation was - * further interrupted, the update marker indicates this. If the update marker - * is set, the contents of the volume is certainly damaged and a new volume - * update operation has to be started. - * - * To put it differently, @corrupted and @upd_marker fields have different - * semantics: - * o the @corrupted flag means that this static volume is corrupted for some - * reasons, but not because an interrupted volume update - * o the @upd_marker field means that the volume is damaged because of an - * interrupted update operation. - * - * I.e., the @corrupted flag is never set if the @upd_marker flag is set. - * - * The @used_bytes and @used_ebs fields are only really needed for static - * volumes and contain the number of bytes stored in this static volume and how - * many eraseblock this data occupies. In case of dynamic volumes, the - * @used_bytes field is equivalent to @size*@usable_leb_size, and the @used_ebs - * field is equivalent to @size. - * - * In general, logical eraseblock size is a property of the UBI device, not - * of the UBI volume. Indeed, the logical eraseblock size depends on the - * physical eraseblock size and on how much bytes UBI headers consume. But - * because of the volume alignment (@alignment), the usable size of logical - * eraseblocks if a volume may be less. The following equation is true: - * @usable_leb_size = LEB size - (LEB size mod @alignment), - * where LEB size is the logical eraseblock size defined by the UBI device. - * - * The alignment is multiple to the minimal flash input/output unit size or %1 - * if all the available space is used. - * - * To put this differently, alignment may be considered is a way to change - * volume logical eraseblock sizes. - */ -struct ubi_volume_info { - int ubi_num; - int vol_id; - int size; - long long used_bytes; - int used_ebs; - int vol_type; - int corrupted; - int upd_marker; - int alignment; - int usable_leb_size; - int name_len; - const char *name; - dev_t cdev; -}; - -/** - * struct ubi_device_info - UBI device description data structure. - * @ubi_num: ubi device number - * @leb_size: logical eraseblock size on this UBI device - * @min_io_size: minimal I/O unit size - * @ro_mode: if this device is in read-only mode - * @cdev: UBI character device major and minor numbers - * - * Note, @leb_size is the logical eraseblock size offered by the UBI device. - * Volumes of this UBI device may have smaller logical eraseblock size if their - * alignment is not equivalent to %1. - */ -struct ubi_device_info { - int ubi_num; - int leb_size; - int min_io_size; - int ro_mode; - dev_t cdev; -}; - -/* UBI descriptor given to users when they open UBI volumes */ -struct ubi_volume_desc; - -int ubi_get_device_info(int ubi_num, struct ubi_device_info *di); -void ubi_get_volume_info(struct ubi_volume_desc *desc, - struct ubi_volume_info *vi); -struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode); -struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name, - int mode); -void ubi_close_volume(struct ubi_volume_desc *desc); -int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, - int len, int check); -int ubi_leb_write(struct ubi_volume_desc *desc, int lnum, const void *buf, - int offset, int len, int dtype); -int ubi_leb_change(struct ubi_volume_desc *desc, int lnum, const void *buf, - int len, int dtype); -int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum); -int ubi_leb_unmap(struct ubi_volume_desc *desc, int lnum); -int ubi_leb_map(struct ubi_volume_desc *desc, int lnum, int dtype); -int ubi_is_mapped(struct ubi_volume_desc *desc, int lnum); -int ubi_sync(int ubi_num); - -/* - * This function is the same as the 'ubi_leb_read()' function, but it does not - * provide the checking capability. - */ -static inline int ubi_read(struct ubi_volume_desc *desc, int lnum, char *buf, - int offset, int len) -{ - return ubi_leb_read(desc, lnum, buf, offset, len, 0); -} - -/* - * This function is the same as the 'ubi_leb_write()' functions, but it does - * not have the data type argument. - */ -static inline int ubi_write(struct ubi_volume_desc *desc, int lnum, - const void *buf, int offset, int len) -{ - return ubi_leb_write(desc, lnum, buf, offset, len, UBI_UNKNOWN); -} - -/* - * This function is the same as the 'ubi_leb_change()' functions, but it does - * not have the data type argument. - */ -static inline int ubi_change(struct ubi_volume_desc *desc, int lnum, - const void *buf, int len) -{ - return ubi_leb_change(desc, lnum, buf, len, UBI_UNKNOWN); -} - -#endif /* !__LINUX_UBI_H__ */ diff --git a/libdde_linux26/contrib/include/linux/mtd/xip.h b/libdde_linux26/contrib/include/linux/mtd/xip.h deleted file mode 100644 index 36efcba1..00000000 --- a/libdde_linux26/contrib/include/linux/mtd/xip.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * MTD primitives for XIP support - * - * Author: Nicolas Pitre - * Created: Nov 2, 2004 - * Copyright: (C) 2004 MontaVista Software, Inc. - * - * This XIP support for MTD has been loosely inspired - * by an earlier patch authored by David Woodhouse. - * - * 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. - */ - -#ifndef __LINUX_MTD_XIP_H__ -#define __LINUX_MTD_XIP_H__ - - -#ifdef CONFIG_MTD_XIP - -/* - * We really don't want gcc to guess anything. - * We absolutely _need_ proper inlining. - */ -#include <linux/compiler.h> - -/* - * Function that are modifying the flash state away from array mode must - * obviously not be running from flash. The __xipram is therefore marking - * those functions so they get relocated to ram. - */ -#define __xipram noinline __attribute__ ((__section__ (".data"))) - -/* - * Each architecture has to provide the following macros. They must access - * the hardware directly and not rely on any other (XIP) functions since they - * won't be available when used (flash not in array mode). - * - * xip_irqpending() - * - * return non zero when any hardware interrupt is pending. - * - * xip_currtime() - * - * return a platform specific time reference to be used with - * xip_elapsed_since(). - * - * xip_elapsed_since(x) - * - * return in usecs the elapsed timebetween now and the reference x as - * returned by xip_currtime(). - * - * note 1: convertion to usec can be approximated, as long as the - * returned value is <= the real elapsed time. - * note 2: this should be able to cope with a few seconds without - * overflowing. - * - * xip_iprefetch() - * - * Macro to fill instruction prefetch - * e.g. a series of nops: asm volatile (".rep 8; nop; .endr"); - */ - -#include <asm/mtd-xip.h> - -#ifndef xip_irqpending - -#warning "missing IRQ and timer primitives for XIP MTD support" -#warning "some of the XIP MTD support code will be disabled" -#warning "your system will therefore be unresponsive when writing or erasing flash" - -#define xip_irqpending() (0) -#define xip_currtime() (0) -#define xip_elapsed_since(x) (0) - -#endif - -#ifndef xip_iprefetch -#define xip_iprefetch() do { } while (0) -#endif - -/* - * xip_cpu_idle() is used when waiting for a delay equal or larger than - * the system timer tick period. This should put the CPU into idle mode - * to save power and to be woken up only when some interrupts are pending. - * This should not rely upon standard kernel code. - */ -#ifndef xip_cpu_idle -#define xip_cpu_idle() do { } while (0) -#endif - -#else - -#define __xipram - -#endif /* CONFIG_MTD_XIP */ - -#endif /* __LINUX_MTD_XIP_H__ */ |