diff options
author | Kyungmin Park <kmpark@infradead.org> | 2008-08-19 08:42:53 +0900 |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2008-08-21 13:50:20 -0500 |
commit | bfd7f38614e21f745b6d6845fcc616ebc5e4d36f (patch) | |
tree | f72c120c39a8a6b51e57d22d600571e29aaa976e /include | |
parent | 8d765456c1d33f2010d2717ee58de7647fdc6346 (diff) | |
download | u-boot-imx-bfd7f38614e21f745b6d6845fcc616ebc5e4d36f.zip u-boot-imx-bfd7f38614e21f745b6d6845fcc616ebc5e4d36f.tar.gz u-boot-imx-bfd7f38614e21f745b6d6845fcc616ebc5e4d36f.tar.bz2 |
Fix OneNAND read_oob/write_oob functions compatability
Also sync with kernel OneNAND codes
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mtd/bbm.h | 7 | ||||
-rw-r--r-- | include/linux/mtd/onenand.h | 22 | ||||
-rw-r--r-- | include/linux/mtd/onenand_regs.h | 2 | ||||
-rw-r--r-- | include/onenand_uboot.h | 14 |
4 files changed, 33 insertions, 12 deletions
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h index bffb25b..abf8f1a 100644 --- a/include/linux/mtd/bbm.h +++ b/include/linux/mtd/bbm.h @@ -97,6 +97,13 @@ struct nand_bbt_descr { */ #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 bbt_info - [GENERIC] Bad Block Table data structure * @param bbt_erase_shift [INTERN] number of address bits in a bbt entry diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h index 8a0fd0d..420eb14 100644 --- a/include/linux/mtd/onenand.h +++ b/include/linux/mtd/onenand.h @@ -75,6 +75,7 @@ struct onenand_chip { unsigned int page_shift; unsigned int ppb_shift; /* Pages per block shift */ unsigned int page_mask; + unsigned int writesize; unsigned int bufferram_index; struct onenand_bufferram bufferram[MAX_BUFFERRAM]; @@ -93,25 +94,39 @@ struct onenand_chip { 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; int state; + unsigned char *page_buf; + unsigned char *oob_buf; struct nand_oobinfo *autooob; + 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_IS_DDP(this) \ + (this->device_id & ONENAND_DEVICE_IS_DDP) + +#define ONENAND_IS_2PLANE(this) (0) /* * Options bits */ #define ONENAND_CONT_LOCK (0x0001) +#define ONENAND_PAGEBUF_ALLOC (0x1000) +#define ONENAND_OOBBUF_ALLOC (0x2000) /* * OneNAND Flash Manufacturer ID Codes @@ -129,4 +144,7 @@ struct onenand_manufacturers { 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/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h index c8a9f3e..6a8aa28 100644 --- a/include/linux/mtd/onenand_regs.h +++ b/include/linux/mtd/onenand_regs.h @@ -83,6 +83,8 @@ * Start Address 1 F100h (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) diff --git a/include/onenand_uboot.h b/include/onenand_uboot.h index 4260ee7..6605e4f 100644 --- a/include/onenand_uboot.h +++ b/include/onenand_uboot.h @@ -16,23 +16,17 @@ #include <linux/types.h> -struct kvec { - void *iov_base; - size_t iov_len; -}; - -typedef int spinlock_t; -typedef int wait_queue_head_t; - struct mtd_info; struct erase_info; +extern struct mtd_info onenand_mtd; + /* Functions */ extern void onenand_init(void); extern int onenand_read(struct mtd_info *mtd, loff_t from, size_t len, size_t * retlen, u_char * buf); -extern int onenand_read_oob(struct mtd_info *mtd, loff_t from, size_t len, - size_t * retlen, u_char * buf); +extern int onenand_read_oob(struct mtd_info *mtd, loff_t from, + struct mtd_oob_ops *ops); extern int onenand_write(struct mtd_info *mtd, loff_t from, size_t len, size_t * retlen, const u_char * buf); extern int onenand_erase(struct mtd_info *mtd, struct erase_info *instr); |