summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/configs/MPC8313ERDB.h30
-rw-r--r--include/linux/mtd/inftl-user.h2
-rw-r--r--include/linux/mtd/mtd-abi.h16
-rw-r--r--include/linux/mtd/mtd.h24
-rw-r--r--include/linux/mtd/nand.h16
-rw-r--r--include/linux/mtd/nand_legacy.h12
-rw-r--r--include/linux/mtd/nftl-user.h4
-rw-r--r--include/linux/mtd/nftl.h14
-rw-r--r--include/linux/mtd/onenand.h19
-rw-r--r--include/nand.h4
10 files changed, 59 insertions, 82 deletions
diff --git a/include/configs/MPC8313ERDB.h b/include/configs/MPC8313ERDB.h
index a4c4240..95ba840 100644
--- a/include/configs/MPC8313ERDB.h
+++ b/include/configs/MPC8313ERDB.h
@@ -64,7 +64,7 @@
#define CFG_IMMR 0xE0000000
#if defined(CONFIG_NAND_U_BOOT) && !defined(CONFIG_NAND_SPL)
-#define CONFIG_DEFAULT_IMMR CFG_IMMR
+#define CONFIG_DEFAULT_IMMR CFG_IMMR
#endif
#define CFG_MEMTEST_START 0x00001000
@@ -243,7 +243,7 @@
#define CFG_NAND_U_BOOT_OFFS 16384
#define CFG_NAND_U_BOOT_RELOC 0x00010000
-#define CFG_NAND_BR_PRELIM ( CFG_NAND_BASE \
+#define CFG_NAND_BR_PRELIM ( CFG_NAND_BASE \
| (2<<BR_DECC_SHIFT) /* Use HW ECC */ \
| BR_PS_8 /* Port Size = 8 bit */ \
| BR_MS_FCM /* MSEL = FCM */ \
@@ -385,13 +385,13 @@
* Environment
*/
#if defined(CONFIG_NAND_U_BOOT)
- #define CFG_ENV_IS_IN_NAND 1
- #define CFG_ENV_OFFSET (512 * 1024)
- #define CFG_ENV_SECT_SIZE CFG_NAND_BLOCK_SIZE
- #define CFG_ENV_SIZE CFG_ENV_SECT_SIZE
- #define CFG_ENV_SIZE_REDUND CFG_ENV_SIZE
- #define CFG_ENV_RANGE (CFG_ENV_SECT_SIZE * 4)
- #define CFG_ENV_OFFSET_REDUND (CFG_ENV_OFFSET + CFG_ENV_RANGE)
+ #define CFG_ENV_IS_IN_NAND 1
+ #define CFG_ENV_OFFSET (512 * 1024)
+ #define CFG_ENV_SECT_SIZE CFG_NAND_BLOCK_SIZE
+ #define CFG_ENV_SIZE CFG_ENV_SECT_SIZE
+ #define CFG_ENV_SIZE_REDUND CFG_ENV_SIZE
+ #define CFG_ENV_RANGE (CFG_ENV_SECT_SIZE * 4)
+ #define CFG_ENV_OFFSET_REDUND (CFG_ENV_OFFSET + CFG_ENV_RANGE)
#elif !defined(CFG_RAMBOOT)
#define CFG_ENV_IS_IN_FLASH 1
#define CFG_ENV_ADDR (CFG_MONITOR_BASE + CFG_MONITOR_LEN)
@@ -501,14 +501,14 @@
#ifdef CONFIG_NAND_SPL
#define CFG_HRCW_HIGH (CFG_HRCW_HIGH_BASE |\
- HRCWH_FROM_0XFFF00100 |\
- HRCWH_ROM_LOC_NAND_SP_8BIT |\
- HRCWH_RL_EXT_NAND)
+ HRCWH_FROM_0XFFF00100 |\
+ HRCWH_ROM_LOC_NAND_SP_8BIT |\
+ HRCWH_RL_EXT_NAND)
#else
#define CFG_HRCW_HIGH (CFG_HRCW_HIGH_BASE |\
- HRCWH_FROM_0X00000100 |\
- HRCWH_ROM_LOC_LOCAL_16BIT |\
- HRCWH_RL_EXT_LEGACY)
+ HRCWH_FROM_0X00000100 |\
+ HRCWH_ROM_LOC_LOCAL_16BIT |\
+ HRCWH_RL_EXT_LEGACY)
#endif
/* System IO Config */
diff --git a/include/linux/mtd/inftl-user.h b/include/linux/mtd/inftl-user.h
index 9b1e252..45220ed 100644
--- a/include/linux/mtd/inftl-user.h
+++ b/include/linux/mtd/inftl-user.h
@@ -87,5 +87,3 @@ struct INFTLMediaHeader {
#define INFTL_LAST 0x80000000
#endif /* __MTD_INFTL_USER_H__ */
-
-
diff --git a/include/linux/mtd/mtd-abi.h b/include/linux/mtd/mtd-abi.h
index 0ce2099..410c5dd 100644
--- a/include/linux/mtd/mtd-abi.h
+++ b/include/linux/mtd/mtd-abi.h
@@ -35,18 +35,18 @@ struct mtd_oob_buf {
#define MTD_NO_ERASE 0x1000 /* No erase necessary */
#define MTD_STUPID_LOCK 0x2000 /* Always locked after reset */
-// Some common devices / combinations of capabilities
+/* Some common devices / combinations of capabilities */
#define MTD_CAP_ROM 0
#define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE)
#define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE)
#define MTD_CAP_NANDFLASH (MTD_WRITEABLE)
/* ECC byte placement */
-#define MTD_NANDECC_OFF 0 // Switch off ECC (Not recommended)
-#define MTD_NANDECC_PLACE 1 // Use the given placement in the structure (YAFFS1 legacy mode)
-#define MTD_NANDECC_AUTOPLACE 2 // Use the default placement scheme
-#define MTD_NANDECC_PLACEONLY 3 // Use the given placement in the structure (Do not store ecc result on read)
-#define MTD_NANDECC_AUTOPL_USR 4 // Use the given autoplacement scheme rather than using the default
+#define MTD_NANDECC_OFF 0 /* Switch off ECC (Not recommended) */
+#define MTD_NANDECC_PLACE 1 /* Use the given placement in the structure (YAFFS1 legacy mode) */
+#define MTD_NANDECC_AUTOPLACE 2 /* Use the default placement scheme */
+#define MTD_NANDECC_PLACEONLY 3 /* Use the given placement in the structure (Do not store ecc result on read) */
+#define MTD_NANDECC_AUTOPL_USR 4 /* Use the given autoplacement scheme rather than using the default */
/* OTP mode selection */
#define MTD_OTP_OFF 0
@@ -56,10 +56,10 @@ struct mtd_oob_buf {
struct mtd_info_user {
uint8_t type;
uint32_t flags;
- uint32_t size; // Total size of the MTD
+ uint32_t size; /* Total size of the MTD */
uint32_t erasesize;
uint32_t writesize;
- uint32_t oobsize; // Amount of OOB data per block (e.g. 16)
+ uint32_t oobsize; /* Amount of OOB data per block (e.g. 16) */
/* The below two fields are obsolete and broken, do not use them
* (TODO: remove at some point) */
uint32_t ecctype;
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 8e0dc00..55d33dd 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -22,6 +22,22 @@
#define MTD_ERASE_DONE 0x08
#define MTD_ERASE_FAILED 0x10
+/*
+ * Enumeration for NAND/OneNAND flash chip state
+ */
+enum {
+ FL_READY,
+ FL_READING,
+ FL_WRITING,
+ FL_ERASING,
+ FL_SYNCING,
+ FL_CACHEDPRG,
+ FL_RESETING,
+ FL_UNLOCKING,
+ FL_LOCKING,
+ FL_PM_SUSPENDED,
+};
+
/* If the erase fails, fail_addr might indicate exactly which block failed. If
fail_addr = 0xffffffff, the failure was not at the device level or was not
specific to any particular block. */
@@ -96,7 +112,7 @@ struct mtd_oob_ops {
struct mtd_info {
u_char type;
u_int32_t flags;
- u_int32_t size; // Total size of the MTD
+ u_int32_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
@@ -112,10 +128,10 @@ struct mtd_info {
*/
u_int32_t writesize;
- u_int32_t oobsize; // Amount of OOB data per block (e.g. 16)
- u_int32_t oobavail; // Available OOB bytes per block
+ u_int32_t oobsize; /* Amount of OOB data per block (e.g. 16) */
+ u_int32_t oobavail; /* Available OOB bytes per block */
- // Kernel-only stuff starts here.
+ /* Kernel-only stuff starts here. */
char *name;
int index;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 2993a89..7ac72de 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -213,20 +213,6 @@ typedef enum {
#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;
@@ -416,7 +402,7 @@ struct nand_chip {
uint8_t cellinfo;
int badblockpos;
- nand_state_t state;
+ int state;
uint8_t *oob_poi;
struct nand_hw_control *controller;
diff --git a/include/linux/mtd/nand_legacy.h b/include/linux/mtd/nand_legacy.h
index 4494bc5..99eafbb 100644
--- a/include/linux/mtd/nand_legacy.h
+++ b/include/linux/mtd/nand_legacy.h
@@ -55,18 +55,6 @@
#define NAND_CMD_RESET 0xff
/*
- * Enumeration for NAND flash chip state
- */
-typedef enum {
- FL_READY,
- FL_READING,
- FL_WRITING,
- FL_ERASING,
- FL_SYNCING
-} nand_state_t;
-
-
-/*
* NAND Private Flash Chip Data
*
* Structure overview:
diff --git a/include/linux/mtd/nftl-user.h b/include/linux/mtd/nftl-user.h
index b2bca18..22b8b70 100644
--- a/include/linux/mtd/nftl-user.h
+++ b/include/linux/mtd/nftl-user.h
@@ -32,8 +32,8 @@ struct nftl_uci1 {
} __attribute__((packed));
struct nftl_uci2 {
- uint16_t FoldMark;
- uint16_t FoldMark1;
+ uint16_t FoldMark;
+ uint16_t FoldMark1;
uint32_t unused;
} __attribute__((packed));
diff --git a/include/linux/mtd/nftl.h b/include/linux/mtd/nftl.h
index 04963a5..6731a16 100644
--- a/include/linux/mtd/nftl.h
+++ b/include/linux/mtd/nftl.h
@@ -13,10 +13,10 @@
#include <linux/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_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 */
+#define BLOCK_RESERVED 0xfffc /* bios block or bad block */
struct NFTLrecord {
struct mtd_blktrans_dev mbd;
@@ -28,15 +28,15 @@ struct NFTLrecord {
unsigned char sectors;
unsigned short cylinders;
__u16 numvunits;
- __u16 lastEUN; /* should be suppressed */
+ __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;
+ 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;
};
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 4b0c2df..8a0fd0d 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -17,6 +17,7 @@
/* Note: The header order is impoertant */
#include <onenand_uboot.h>
+#include <linux/mtd/compat.h>
#include <linux/mtd/bbm.h>
#define MAX_BUFFERRAM 2
@@ -28,20 +29,6 @@ extern int onenand_scan (struct mtd_info *mtd, int max_chips);
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_UNLOCKING,
- FL_LOCKING,
-} onenand_state_t;
-
-/**
* struct onenand_bufferram - OneNAND BufferRAM Data
* @param block block address in BufferRAM
* @param page page address in BufferRAM
@@ -103,10 +90,12 @@ struct onenand_chip {
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);
spinlock_t chip_lock;
wait_queue_head_t wq;
- onenand_state_t state;
+ int state;
struct nand_oobinfo *autooob;
diff --git a/include/nand.h b/include/nand.h
index 4c2b76d..3296e10 100644
--- a/include/nand.h
+++ b/include/nand.h
@@ -109,9 +109,9 @@ struct nand_erase_options {
typedef struct nand_erase_options nand_erase_options_t;
int nand_read_skip_bad(nand_info_t *nand, size_t offset, size_t *length,
- u_char *buffer);
+ u_char *buffer);
int nand_write_skip_bad(nand_info_t *nand, size_t offset, size_t *length,
- u_char *buffer);
+ u_char *buffer);
int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts);
#define NAND_LOCK_STATUS_TIGHT 0x01