mtd: resync with Linux-3.7.1
Subsystems (8)
PATCH 1/1 mtd: resync with Linux-3.7.1
From: Brian Norris <[email protected]>
This patch is essentially an update of u-boot MTD subsystem to the state of Linux-3.7.1 with exclusion of some bits:
- the update is concentrated on NAND, no onenand or CFI/NOR/SPI flashes interfaces are updated EXCEPT for API changes.
- new large NAND chips support is there, though some updates have got in Linux-3.8.-rc1, (which will follow on top of this patch).
To produce this update I used tag v3.7.1 of linux-stable repository.
The update was made using application of relevant patches, with changes relevant to U-Boot-only stuff sticked together to keep bisectability. Then all changes were grouped together to this patch.
--- board/ait/cam_enc_4xx/cam_enc_4xx.c | 12 +- common/cmd_nand.c | 18 +- common/cmd_onenand.c | 30 +- common/env_onenand.c | 6 +- drivers/mtd/Makefile | 4 +- drivers/mtd/cfi_mtd.c | 12 +- drivers/mtd/mtdconcat.c | 98 +-- drivers/mtd/mtdcore.c | 191 ++++ drivers/mtd/mtdpart.c | 158 ++-- drivers/mtd/nand/atmel_nand.c | 16 +- drivers/mtd/nand/davinci_nand.c | 2 +- drivers/mtd/nand/diskonchip.c | 12 +- drivers/mtd/nand/fsl_elbc_nand.c | 16 +- drivers/mtd/nand/fsl_ifc_nand.c | 16 +- drivers/mtd/nand/fsmc_nand.c | 3 +- drivers/mtd/nand/mpc5121_nfc.c | 2 +- drivers/mtd/nand/mxc_nand.c | 18 +- drivers/mtd/nand/mxs_nand.c | 31 +- drivers/mtd/nand/nand_base.c | 1655 ++++++++++++++++++++--------------- drivers/mtd/nand/nand_bbt.c | 822 ++++++++--------- drivers/mtd/nand/nand_ids.c | 14 +- drivers/mtd/nand/nand_util.c | 21 +- drivers/mtd/nand/omap_gpmc.c | 2 +- drivers/mtd/nand/tegra_nand.c | 26 +- drivers/mtd/nand/tegra_nand.h | 2 +- drivers/mtd/onenand/onenand_base.c | 82 +- drivers/mtd/onenand/onenand_bbt.c | 6 +- drivers/mtd/ubi/build.c | 2 +- drivers/mtd/ubi/eba.c | 2 +- drivers/mtd/ubi/io.c | 12 +- drivers/mtd/ubi/kapi.c | 2 +- drivers/mtd/ubi/misc.c | 2 +- drivers/mtd/ubi/vtbl.c | 2 +- fs/yaffs2/yaffs_mtdif.c | 18 +- fs/yaffs2/yaffs_mtdif2.c | 14 +- include/linux/mtd/bbm.h | 49 +- include/linux/mtd/mtd-abi.h | 158 ---- include/linux/mtd/mtd.h | 203 +++-- include/linux/mtd/nand.h | 173 ++-- include/linux/string.h | 3 + include/mtd/mtd-abi.h | 209 +++++ include/nand.h | 8 +- lib/string.c | 59 ++ 43 files changed, 2333 insertions(+), 1858 deletions(-) delete mode 100644 include/linux/mtd/mtd-abi.h create mode 100644 include/mtd/mtd-abi.h
board/ait/cam_enc_4xx/cam_enc_4xx.c +7 -5
@@ -120,7 +120,7 @@ int board_eth_init(bd_t *bis)#ifdef CONFIG_NAND_DAVINCI static int davinci_std_read_page_syndrome (struct mtd_info *mtd,struct nand_chip *chip, -uint8_t *buf,int page) +uint8_t *buf,int oob_required,int page) {struct nand_chip *this = mtd->priv;int i, eccsize = chip->ecc.size;
@@ -167,8 +167,9 @@ davinci_std_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip,return 0 ; } -static void davinci_std_write_page_syndrome (struct mtd_info *mtd, -struct nand_chip *chip,const uint8_t *buf) +static int davinci_std_write_page_syndrome (struct mtd_info *mtd, +struct nand_chip *chip,const uint8_t *buf, +int oob_required) {unsigned char davinci_ecc_buf[NAND_MAX_OOBSIZE ];struct nand_chip *this = mtd->priv;
@@ -218,6 +219,7 @@ static void davinci_std_write_page_syndrome(struct mtd_info *mtd, i = mtd->oobsize - (oob - chip->oob_poi);if (i) chip->write_buf (mtd, oob, i); +return 0 ; } static int davinci_std_write_oob_syndrome(struct mtd_info *mtd,
@@ -239,7 +241,7 @@ static int davinci_std_write_oob_syndrome(struct mtd_info *mtd, }static int davinci_std_read_oob_syndrome (struct mtd_info *mtd, -struct nand_chip *chip,int page,int sndcmd) +struct nand_chip *chip,int page) {struct nand_chip *this = mtd->priv;uint8_t *buf = chip->oob_poi;
@@ -249,7 +251,7 @@ static int davinci_std_read_oob_syndrome(struct mtd_info *mtd, chip->read_buf (mtd, bufpoi, mtd->oobsize); -return 1 ; +return 0 ; }static void nand_dm365evm_select_chip (struct mtd_info *mtd,int chip)
common/cmd_nand.c +9 -9
@@ -62,8 +62,8 @@ static int nand_dump(nand_info_t *nand, ulong off, int only_oob, int repeat) ops.oobbuf = oobbuf; ops.len = nand->writesize; ops.ooblen = nand->oobsize; - ops.mode =MTD_OOB_RAW ; - i = nand->read_oob (nand, addr, &ops); + ops.mode =MTD_OPS_RAW ; + i =mtd_read_oob (nand, addr, &ops);if (i <0 ) {printf ("Error (%d) reading page %08lx\n" , i, off);free (datbuf);
@@ -407,13 +407,13 @@ static int raw_access(nand_info_t *nand, ulong addr, loff_t off, ulong count, .oobbuf = ((u8 *)addr) + nand->writesize, .len = nand->writesize, .ooblen = nand->oobsize, - .mode = MTD_OOB_RAW + .mode = MTD_OPS_RAW };if (read) - ret = nand->read_oob (nand, off, &ops); + ret =mtd_read_oob (nand, off, &ops);else - ret = nand->write_oob (nand, off, &ops); + ret =mtd_write_oob (nand, off, &ops);if (ret) { printf("%s: error at offset %llx, ret %d\n",
@@ -680,13 +680,13 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])mtd_oob_ops_t ops = { .oobbuf = (u8 *)addr, .ooblen = rwsize, - .mode =MTD_OOB_RAW + .mode =MTD_OPS_RAW };if (read) - ret = nand->read_oob (nand, off, &ops); + ret =mtd_read_oob (nand, off, &ops);else - ret = nand->write_oob (nand, off, &ops); + ret =mtd_write_oob (nand, off, &ops); }else if (raw) { ret =raw_access (nand, addr, off, pagecount, read); }else {
@@ -729,7 +729,7 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])while (argc >0 ) { addr =simple_strtoul (*argv,NULL ,16 ); -if (nand->block_markbad (nand, addr)) { +if (mtd_block_markbad (nand, addr)) {printf ("block 0x%08lx NOT marked " "as bad! ERROR %d\n" , addr, ret);
common/cmd_onenand.c +15 -15
@@ -83,7 +83,7 @@ static int onenand_block_read(loff_t from, size_t len, ops.len = blocksize;while (blocks) { - ret = mtd->block_isbad (mtd, ofs); + ret =mtd_block_isbad (mtd, ofs);if (ret) {printk ("Bad blocks %d at 0x%x\n" , (u32)(ofs >> this->erase_shift), (u32 )ofs);
@@ -97,7 +97,7 @@ static int onenand_block_read(loff_t from, size_t len, ops.datbuf = buf; ops.retlen =0 ; - ret = mtd->read_oob (mtd, ofs, &ops); + ret =mtd_read_oob (mtd, ofs, &ops);if (ret) {printk ("Read failed 0x%x, %d\n" , (u32 )ofs, ret); ofs += blocksize;
@@ -118,7 +118,7 @@ static int onenand_write_oneblock_withoob(loff_t to, const u_char * buf,struct mtd_oob_ops ops = { .len = mtd->writesize, .ooblen = mtd->oobsize, - .mode =MTD_OOB_AUTO , + .mode =MTD_OPS_AUTO_OOB , };int page, ret =0 ;for (page =0 ; page < (mtd->erasesize / mtd->writesize); page ++) {
@@ -126,7 +126,7 @@ static int onenand_write_oneblock_withoob(loff_t to, const u_char * buf, buf += mtd->writesize; ops.oobbuf = (u_char *)buf; buf += mtd->oobsize; - ret = mtd->write_oob (mtd, to, &ops); + ret =mtd_write_oob (mtd, to, &ops);if (ret)break ; to += mtd->writesize;
@@ -156,7 +156,7 @@ static int onenand_block_write(loff_t to, size_t len, ofs = to;while (blocks) { - ret = mtd->block_isbad (mtd, ofs); + ret =mtd_block_isbad (mtd, ofs);if (ret) {printk ("Bad blocks %d at 0x%x\n" , (u32)(ofs >> this->erase_shift), (u32 )ofs);
@@ -165,7 +165,7 @@ static int onenand_block_write(loff_t to, size_t len, }if (!withoob) - ret = mtd->write (mtd, ofs, blocksize, &_retlen, buf); + ret =mtd_write (mtd, ofs, blocksize, &_retlen, buf);else ret =onenand_write_oneblock_withoob (ofs, buf, &_retlen);if (ret) {
@@ -195,7 +195,7 @@ static int onenand_block_erase(u32 start, u32 size, int force)int blocksize =1 << this->erase_shift;for (ofs = start; ofs < (start + size); ofs += blocksize) { - ret = mtd->block_isbad (mtd, ofs); + ret =mtd_block_isbad (mtd, ofs);if (ret && !force) {printf ("Skip erase bad block %d at 0x%x\n" , (u32)(ofs >> this->erase_shift), (u32 )ofs);
@@ -206,7 +206,7 @@ static int onenand_block_erase(u32 start, u32 size, int force) instr.len = blocksize; instr.priv = force; instr.mtd = mtd; - ret = mtd->erase (mtd, &instr); + ret =mtd_erase (mtd, &instr);if (ret) {printf ("erase failed block %d at 0x%x\n" , (u32)(ofs >> this->erase_shift), (u32 )ofs);
@@ -261,7 +261,7 @@ static int onenand_block_test(u32 start, u32 size)while (blocks < end_block) {printf ("\rTesting block %d@0x%x" , (u32)(ofs >> this->erase_shift), (u32 )ofs); - ret = mtd->block_isbad (mtd, ofs); + ret =mtd_block_isbad (mtd, ofs);if (ret) {printf ("Skip erase bad block %d at 0x%x\n" , (u32)(ofs >> this->erase_shift), (u32 )ofs);
@@ -270,19 +270,19 @@ static int onenand_block_test(u32 start, u32 size) instr.addr = ofs; instr.len = blocksize; - ret = mtd->erase (mtd, &instr); + ret =mtd_erase (mtd, &instr);if (ret) {printk ("Erase failed 0x%x, %d\n" , (u32 )ofs, ret); goto next; } - ret = mtd->write (mtd, ofs, blocksize, &retlen, buf); + ret =mtd_write (mtd, ofs, blocksize, &retlen, buf);if (ret) {printk ("Write failed 0x%x, %d\n" , (u32 )ofs, ret); goto next; } - ret = mtd->read (mtd, ofs, blocksize, &retlen, verify_buf); + ret =mtd_read (mtd, ofs, blocksize, &retlen, verify_buf);if (ret) {printk ("Read failed 0x%x, %d\n" , (u32 )ofs, ret); goto next;
@@ -324,7 +324,7 @@ static int onenand_dump(struct mtd_info *mtd, ulong off, int only_oob) ops.len = mtd->writesize; ops.ooblen = mtd->oobsize; ops.retlen =0 ; - i = mtd->read_oob (mtd, addr, &ops); + i =mtd_read_oob (mtd, addr, &ops);if (i <0 ) {printf ("Error (%d) reading page %08lx\n" , i, off);free (datbuf);
@@ -373,7 +373,7 @@ static int do_onenand_bad(cmd_tbl_t * cmdtp, int flag, int argc, char * const ar/* Currently only one OneNAND device is supported */ printf ("\nDevice %d bad blocks:\n" ,0 );for (ofs =0 ; ofs < mtd->size; ofs += mtd->erasesize) { -if (mtd->block_isbad (mtd, ofs)) +if (mtd_block_isbad (mtd, ofs))printf (" %08x\n" , (u32 )ofs); }
@@ -530,7 +530,7 @@ static int do_onenand_markbad(cmd_tbl_t * cmdtp, int flag, int argc, char * conswhile (argc >0 ) { addr =simple_strtoul (*argv,NULL ,16 ); -if (mtd->block_markbad (mtd, addr)) { +if (mtd_block_markbad (mtd, addr)) {printf ("block 0x%08lx NOT marked " "as bad! ERROR %d\n" , addr, ret);
common/env_onenand.c +3 -3
@@ -68,7 +68,7 @@ void env_relocate_spec(void)/* Check OneNAND exist */ if (mtd->writesize)/* Ignore read fail */ - mtd->read (mtd, env_addr,ONENAND_MAX_ENV_SIZE , +mtd_read (mtd, env_addr,ONENAND_MAX_ENV_SIZE , &retlen, (u_char *)buf);else mtd->writesize =MAX_ONENAND_PAGESIZE ;
@@ -113,12 +113,12 @@ int saveenv(void)#endif instr.addr = env_addr; instr.mtd = mtd; -if (mtd->erase (mtd, &instr)) { +if (mtd_erase (mtd, &instr)) {printf ("OneNAND: erase failed at 0x%08llx\n" , env_addr);return 1 ; } -if (mtd->write (mtd, env_addr,ONENAND_MAX_ENV_SIZE , &retlen, +if (mtd_write (mtd, env_addr,ONENAND_MAX_ENV_SIZE , &retlen, (u_char *)&env_new)) {printf ("OneNAND: write failed at 0x%llx\n" , instr.addr);return 2 ;
drivers/mtd/Makefile +3 -1
@@ -25,7 +25,9 @@ include $(TOPDIR)/config.mk LIB := $(obj)libmtd.o -COBJS-$(CONFIG_MTD_DEVICE) += mtdcore.o +ifneq (,$(findstring y,$(CONFIG_MTD_DEVICE)$(CONFIG_CMD_NAND)$(CONFIG_CMD_ONENAND))) +COBJS-y += mtdcore.o +endif COBJS-$(CONFIG_MTD_PARTITIONS) += mtdpart.o COBJS-$(CONFIG_MTD_CONCAT) += mtdconcat.o COBJS-$(CONFIG_HAS_DATAFLASH) += at45.o
drivers/mtd/cfi_mtd.c +6 -6
@@ -244,12 +244,12 @@ int cfi_mtd_init(void) mtd->size = fi->size; mtd->writesize =1 ; - mtd->erase = cfi_mtd_erase; - mtd->read = cfi_mtd_read; - mtd->write = cfi_mtd_write; - mtd->sync = cfi_mtd_sync; - mtd->lock = cfi_mtd_lock; - mtd->unlock = cfi_mtd_unlock; + mtd->_erase = cfi_mtd_erase; + mtd->_read = cfi_mtd_read; + mtd->_write = cfi_mtd_write; + mtd->_sync = cfi_mtd_sync; + mtd->_lock = cfi_mtd_lock; + mtd->_unlock = cfi_mtd_unlock; mtd->priv = fi;if (add_mtd_device (mtd))
drivers/mtd/mtdconcat.c +32 -66
240 lines not on this page · raw message
drivers/mtd/mtdcore.c +191 -0
200 lines not on this page · raw message
drivers/mtd/mtdpart.c +54 -104
284 lines not on this page · raw message
drivers/mtd/nand/atmel_nand.c +10 -6
@@ -489,7 +489,7 @@ normal_check: }static int atmel_nand_pmecc_read_page (struct mtd_info *mtd, -struct nand_chip *chip,uint8_t *buf,int page) +struct nand_chip *chip,uint8_t *buf,int oob_required,int page) {struct atmel_nand_host *host = chip->priv;int eccsize = chip->ecc.size;
@@ -529,8 +529,9 @@ static int atmel_nand_pmecc_read_page(struct mtd_info *mtd,return 0 ; } -static void atmel_nand_pmecc_write_page (struct mtd_info *mtd, -struct nand_chip *chip,const uint8_t *buf) +static int atmel_nand_pmecc_write_page (struct mtd_info *mtd, +struct nand_chip *chip,const uint8_t *buf, +int oob_required) {struct atmel_nand_host *host = chip->priv;uint32_t *eccpos = chip->ecc.layout->eccpos;
@@ -557,7 +558,7 @@ static void atmel_nand_pmecc_write_page(struct mtd_info *mtd,if (!timeout) {printk (KERN_ERR "atmel_nand : Timeout to read PMECC status, fail to write PMECC in oob\n" ); -return ; + goto out; }for (i =0 ; i < host->pmecc_sector_number; i++) {
@@ -570,6 +571,8 @@ static void atmel_nand_pmecc_write_page(struct mtd_info *mtd, } } chip->write_buf (mtd, chip->oob_poi, mtd->oobsize); +out: +return 0 ; }static void atmel_pmecc_core_init (struct mtd_info *mtd)
@@ -775,9 +778,10 @@ static int atmel_nand_calculate(struct mtd_info *mtd,* mtd: mtd info structure * chip: nand chip info structure * buf: buffer to store read data +* oob_required: caller expects OOB data read to chip->oob_poi */ -static int atmel_nand_read_page (struct mtd_info *mtd, -struct nand_chip *chip,uint8_t *buf,int page) +static int atmel_nand_read_page (struct mtd_info *mtd,struct nand_chip *chip, +uint8_t *buf,int oob_required,int page) {int eccsize = chip->ecc.size;int eccbytes = chip->ecc.bytes;
drivers/mtd/nand/davinci_nand.c +1 -1
@@ -607,7 +607,7 @@ void davinci_nand_init(struct nand_chip *nand) { nand->chip_delay =0 ;#ifdef CONFIG_SYS_NAND_USE_FLASH_BBT - nand->options |=NAND_USE_FLASH_BBT ; + nand->bbt_options |=NAND_BBT_USE_FLASH ;#endif #ifdef CONFIG_SYS_NAND_HW_ECC nand->ecc.mode =NAND_ECC_HW ;
drivers/mtd/nand/diskonchip.c +6 -6
@@ -134,7 +134,7 @@ static struct rs_control *rs_decoder;/* * The HW decoder in the DoC ASIC's provides us a error syndrome, -* which we must convert to a standard syndrom usable by the generic +* which we must convert to a standard syndrome usable by the generic * Reed-Solomon library code. * * Fabrice Bellard figured this out in the old docecc code. I added
@@ -154,7 +154,7 @@ static int doc_ecc_decode(struct rs_control *rs, uint8_t *data, uint8_t *ecc) ds[3 ] = ((ecc[3 ] &0xc0 ) >>6 ) | ((ecc[0 ] &0xff ) <<2 ); parity = ecc[1 ]; -/* Initialize the syndrom buffer */ +/* Initialize the syndrome buffer */ for (i =0 ; i <NROOTS ; i++) s[i] = ds[0 ];/*
@@ -1033,7 +1033,7 @@ static int doc200x_correct_data(struct mtd_info *mtd, u_char *dat,WriteDOC (DOC_ECC_DIS , docptr, Mplus_ECCConf); elseWriteDOC (DOC_ECC_DIS ,docptr ,ECCConf ); -if (no_ecc_failures && (ret == -EBADMSG )) { +if (no_ecc_failures &&mtd_is_eccerr (ret)) {printk (KERN_ERR "suppressing ECC failure\n" ); ret =0 ; }
@@ -1073,7 +1073,7 @@ static int __init find_media_headers(struct mtd_info *mtd, u_char *buf, const chsize_t retlen;for (offs =0 ; offs < mtd->size; offs += mtd->erasesize) { - ret = mtd->read (mtd, offs, mtd->writesize, &retlen, buf); + ret =mtd_read (mtd, offs, mtd->writesize, &retlen, buf);if (retlen != mtd->writesize)continue ;if (ret) {
@@ -1098,7 +1098,7 @@ static int __init find_media_headers(struct mtd_info *mtd, u_char *buf, const ch/* Only one mediaheader was found. We want buf to contain a mediaheader on return, so we'll have to re-read the one we found. */ offs = doc->mh0_page << this->page_shift; - ret = mtd->read (mtd, offs, mtd->writesize, &retlen, buf); + ret =mtd_read (mtd, offs, mtd->writesize, &retlen, buf);if (retlen != mtd->writesize) {/* Insanity. Give up. */ printk (KERN_ERR "Read DiskOnChip Media Header once, but can't reread it???\n" );
@@ -1658,7 +1658,7 @@ static int __init doc_probe(unsigned long physadr) nand->ecc.mode =NAND_ECC_HW_SYNDROME ; nand->ecc.size =512 ; nand->ecc.bytes =6 ; - nand->options =NAND_USE_FLASH_BBT ; + nand->bbt_options =NAND_BBT_USE_FLASH ; doc->physadr = physadr; doc->virtadr = virtadr;
drivers/mtd/nand/fsl_elbc_nand.c +8 -8
@@ -640,9 +640,8 @@ static int fsl_elbc_wait(struct mtd_info *mtd, struct nand_chip *chip)return fsl_elbc_read_byte (mtd); } -static int fsl_elbc_read_page (struct mtd_info *mtd, -struct nand_chip *chip, -uint8_t *buf,int page) +static int fsl_elbc_read_page (struct mtd_info *mtd,struct nand_chip *chip, +uint8_t *buf,int oob_required,int page) {fsl_elbc_read_buf (mtd, buf, mtd->writesize);fsl_elbc_read_buf (mtd, chip->oob_poi, mtd->oobsize);
@@ -656,12 +655,13 @@ static int fsl_elbc_read_page(struct mtd_info *mtd,/* ECC will be calculated automatically, and errors will be detected in * waitfunc. */ -static void fsl_elbc_write_page (struct mtd_info *mtd, -struct nand_chip *chip, -const uint8_t *buf) +static int fsl_elbc_write_page (struct mtd_info *mtd,struct nand_chip *chip, +const uint8_t *buf,int oob_required) {fsl_elbc_write_buf (mtd, buf, mtd->writesize);fsl_elbc_write_buf (mtd, chip->oob_poi, mtd->oobsize); + +return 0 ; }static struct fsl_elbc_ctrl *elbc_ctrl;
@@ -747,8 +747,8 @@ static int fsl_elbc_chip_init(int devnum, u8 *addr) nand->bbt_md = &bbt_mirror_descr;/* set up nand options */ - nand->options =NAND_NO_READRDY |NAND_NO_AUTOINCR | -NAND_USE_FLASH_BBT |NAND_NO_SUBPAGE_WRITE ; + nand->options =NAND_NO_SUBPAGE_WRITE ; + nand->bbt_options =NAND_BBT_USE_FLASH ; nand->controller = &elbc_ctrl->controller; nand->priv = priv;
drivers/mtd/nand/fsl_ifc_nand.c +8 -8
@@ -686,9 +686,8 @@ static int fsl_ifc_wait(struct mtd_info *mtd, struct nand_chip *chip)return nand_fsr; } -static int fsl_ifc_read_page (struct mtd_info *mtd, -struct nand_chip *chip, -uint8_t *buf,int page) +static int fsl_ifc_read_page (struct mtd_info *mtd,struct nand_chip *chip, +uint8_t *buf,int oob_required,int page) {struct fsl_ifc_mtd *priv = chip->priv;struct fsl_ifc_ctrl *ctrl = priv->ctrl;
@@ -705,12 +704,13 @@ static int fsl_ifc_read_page(struct mtd_info *mtd,/* ECC will be calculated automatically, and errors will be detected in * waitfunc. */ -static void fsl_ifc_write_page (struct mtd_info *mtd, -struct nand_chip *chip, -const uint8_t *buf) +static int fsl_ifc_write_page (struct mtd_info *mtd,struct nand_chip *chip, +const uint8_t *buf,int oob_required) {fsl_ifc_write_buf (mtd, buf, mtd->writesize);fsl_ifc_write_buf (mtd, chip->oob_poi, mtd->oobsize); + +return 0 ; }static void fsl_ifc_ctrl_init (void )
@@ -852,8 +852,8 @@ int board_nand_init(struct nand_chip *nand) nand->bbt_md = &bbt_mirror_descr;/* set up nand options */ - nand->options =NAND_NO_READRDY |NAND_NO_AUTOINCR | -NAND_USE_FLASH_BBT |NAND_NO_SUBPAGE_WRITE ; + nand->options =NAND_NO_SUBPAGE_WRITE ; + nand->bbt_options =NAND_BBT_USE_FLASH ;if (cspr &CSPR_PORT_SIZE_16 ) { nand->read_byte = fsl_ifc_read_byte16;
drivers/mtd/nand/fsmc_nand.c +2 -1
@@ -341,6 +341,7 @@ void fsmc_enable_hwecc(struct mtd_info *mtd, int mode)* @mtd: mtd info structure * @chip: nand chip info structure * @buf: buffer to store read data +* @oob_required: caller expects OOB data read to chip->oob_poi * @page: page number to read * * This routine is needed for fsmc verison 8 as reading from NAND chip has to be
@@ -350,7 +351,7 @@ void fsmc_enable_hwecc(struct mtd_info *mtd, int mode)* max of 8 bits) */ static int fsmc_read_page_hwecc (struct mtd_info *mtd,struct nand_chip *chip, -uint8_t *buf,int page) +uint8_t *buf,int oob_required,int page) {struct fsmc_eccplace *fsmc_eccpl;int i, j, s, stat, eccsize = chip->ecc.size;
drivers/mtd/nand/mpc5121_nfc.c +1 -1
@@ -621,7 +621,7 @@ int board_nand_init(struct nand_chip *chip) chip->write_buf = mpc5121_nfc_write_buf; chip->verify_buf = mpc5121_nfc_verify_buf; chip->select_chip = mpc5121_nfc_select_chip; - chip->options =NAND_NO_AUTOINCR |NAND_USE_FLASH_BBT ; + chip->bbt_options =NAND_BBT_USE_FLASH ; chip->ecc.mode =NAND_ECC_SOFT ;/* Reset NAND Flash controller */
drivers/mtd/nand/mxc_nand.c +12 -6
@@ -380,7 +380,7 @@ static void mxc_nand_enable_hwecc(struct mtd_info *mtd, int mode)#ifdef MXC_NFC_V2_1 static int mxc_nand_read_oob_syndrome (struct mtd_info *mtd,struct nand_chip *chip, -int page,int sndcmd) +int page) {struct mxc_nand_host *host = chip->priv;uint8_t *buf = chip->oob_poi;
@@ -434,6 +434,7 @@ static int mxc_nand_read_oob_syndrome(struct mtd_info *mtd,static int mxc_nand_read_page_raw_syndrome (struct mtd_info *mtd,struct nand_chip *chip,uint8_t *buf, +int oob_required,int page) {struct mxc_nand_host *host = chip->priv;
@@ -478,6 +479,7 @@ static int mxc_nand_read_page_raw_syndrome(struct mtd_info *mtd,static int mxc_nand_read_page_syndrome (struct mtd_info *mtd,struct nand_chip *chip,uint8_t *buf, +int oob_required,int page) {struct mxc_nand_host *host = chip->priv;
@@ -567,9 +569,10 @@ static int mxc_nand_write_oob_syndrome(struct mtd_info *mtd,return status &NAND_STATUS_FAIL ? -EIO :0 ; } -static void mxc_nand_write_page_raw_syndrome (struct mtd_info *mtd, +static int mxc_nand_write_page_raw_syndrome (struct mtd_info *mtd,struct nand_chip *chip, -const uint8_t *buf) +const uint8_t *buf, +int oob_required) {struct mxc_nand_host *host = chip->priv;int eccsize = chip->ecc.size;
@@ -603,11 +606,13 @@ static void mxc_nand_write_page_raw_syndrome(struct mtd_info *mtd, size = mtd->oobsize - (oob - chip->oob_poi);if (size) chip->write_buf (mtd, oob, size); +return 0 ; } -static void mxc_nand_write_page_syndrome (struct mtd_info *mtd, +static int mxc_nand_write_page_syndrome (struct mtd_info *mtd,struct nand_chip *chip, -const uint8_t *buf) +const uint8_t *buf, +int oob_required) {struct mxc_nand_host *host = chip->priv;int i, n, eccsize = chip->ecc.size;
@@ -646,6 +651,7 @@ static void mxc_nand_write_page_syndrome(struct mtd_info *mtd, i = mtd->oobsize - (oob - chip->oob_poi);if (i) chip->write_buf (mtd, oob, i); +return 0 ; } static int mxc_nand_correct_data(struct mtd_info *mtd, u_char *dat,
@@ -1172,7 +1178,7 @@ int board_nand_init(struct nand_chip *this)#endif #ifdef CONFIG_SYS_NAND_USE_FLASH_BBT - this->options |=NAND_USE_FLASH_BBT ; + this->bbt_options |=NAND_BBT_USE_FLASH ; this->bbt_td = &bbt_main_descr; this->bbt_md = &bbt_mirror_descr;#endif
drivers/mtd/nand/mxs_nand.c +17 -14
@@ -546,7 +546,8 @@ static uint8_t mxs_nand_read_byte(struct mtd_info *mtd)* Read a page from NAND. */ static int mxs_nand_ecc_read_page (struct mtd_info *mtd,struct nand_chip *nand, -uint8_t *buf,int page) +uint8_t *buf,int oob_required, +int page) {struct mxs_nand_info *nand_info = nand->priv;struct mxs_dma_desc *d;
@@ -691,8 +692,9 @@ rtn:/* * Write a page to NAND. */ -static void mxs_nand_ecc_write_page (struct mtd_info *mtd, -struct nand_chip *nand,const uint8_t *buf) +static int mxs_nand_ecc_write_page (struct mtd_info *mtd, +struct nand_chip *nand,const uint8_t *buf, +int oob_required) {struct mxs_nand_info *nand_info = nand->priv;struct mxs_dma_desc *d;
@@ -748,6 +750,7 @@ static void mxs_nand_ecc_write_page(struct mtd_info *mtd, rtn:mxs_nand_return_dma_descs (nand_info); +return 0 ; }/*
@@ -763,7 +766,7 @@ static int mxs_nand_hook_read_oob(struct mtd_info *mtd, loff_t from,struct mxs_nand_info *nand_info = chip->priv;int ret; -if (ops->mode ==MTD_OOB_RAW ) +if (ops->mode ==MTD_OPS_RAW ) nand_info->raw_oob_mode =1 ;else nand_info->raw_oob_mode =0 ;
@@ -788,7 +791,7 @@ static int mxs_nand_hook_write_oob(struct mtd_info *mtd, loff_t to,struct mxs_nand_info *nand_info = chip->priv;int ret; -if (ops->mode ==MTD_OOB_RAW ) +if (ops->mode ==MTD_OPS_RAW ) nand_info->raw_oob_mode =1 ;else nand_info->raw_oob_mode =0 ;
@@ -997,19 +1000,19 @@ static int mxs_nand_scan_bbt(struct mtd_info *mtd)writel (BCH_CTRL_COMPLETE_IRQ_EN , &bch_regs->hw_bch_ctrl_set);/* Hook some operations at the MTD level. */ -if (mtd->read_oob != mxs_nand_hook_read_oob) { - nand_info->hooked_read_oob = mtd->read_oob; - mtd->read_oob = mxs_nand_hook_read_oob; +if (mtd->_read_oob != mxs_nand_hook_read_oob) { + nand_info->hooked_read_oob = mtd->_read_oob; + mtd->_read_oob = mxs_nand_hook_read_oob; } -if (mtd->write_oob != mxs_nand_hook_write_oob) { - nand_info->hooked_write_oob = mtd->write_oob; - mtd->write_oob = mxs_nand_hook_write_oob; +if (mtd->_write_oob != mxs_nand_hook_write_oob) { + nand_info->hooked_write_oob = mtd->_write_oob; + mtd->_write_oob = mxs_nand_hook_write_oob; } -if (mtd->block_markbad != mxs_nand_hook_block_markbad) { - nand_info->hooked_block_markbad = mtd->block_markbad; - mtd->block_markbad = mxs_nand_hook_block_markbad; +if (mtd->_block_markbad != mxs_nand_hook_block_markbad) { + nand_info->hooked_block_markbad = mtd->_block_markbad; + mtd->_block_markbad = mxs_nand_hook_block_markbad; }/* We use the reference implementation for bad block management. */
drivers/mtd/nand/nand_base.c +925 -730
1,681 lines not on this page · raw message
drivers/mtd/nand/nand_bbt.c +386 -436
822 lines not on this page · raw message
drivers/mtd/onenand/onenand_base.c +33 -49
82 lines not on this page · raw message
include/linux/mtd/bbm.h +35 -14
49 lines not on this page · raw message
include/linux/mtd/mtd-abi.h deleted +0 -158
158 lines not on this page · raw message
include/linux/mtd/mtd.h +128 -75
203 lines not on this page · raw message
include/linux/mtd/nand.h +105 -68
173 lines not on this page · raw message
include/mtd/mtd-abi.h new file +209 -0
209 lines not on this page · raw message
lib/string.c +59 -0
59 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.10.4
Part of the diff is not shown here. View the raw message.
PATCH 1/1 mtd: resync with Linux-3.7.1
Quoted 11 lines · Sergey Lapin
From: Brian Norris <[email protected]>
This patch is essentially an update of u-boot MTD subsystem to the state of Linux-3.7.1 with exclusion of some bits:
- the update is concentrated on NAND, no onenand or CFI/NOR/SPI flashes interfaces are updated EXCEPT for API changes.
- new large NAND chips support is there, though some updates have got in Linux-3.8.-rc1, (which will follow on top of this patch).
Quoted 8 lines
To produce this update I used tag v3.7.1 of linux-stable repository.
The update was made using application of relevant patches, with changes relevant to U-Boot-only stuff sticked together to keep bisectability. Then all changes were grouped together to this patch.
Signed-off-by Sergey Lapin <[email protected]>
Also, I need to mention, that size increase with this patch is generally well under 1K.
PATCH 1/1 mtd: resync with Linux-3.7.1
In reply to Sergey LapinQuoted 1 line · Sergey Lapin
From: Brian Norris <[email protected]>
Sorry about this - will fix and resubmit.