mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 16:52:14 +02:00
mtd: nand: Drop unused cached programming support
Cached programming is always skipped, so drop the associated code until we decide to really support it. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> [Linux commit: 0b4773fd1649e0d418275557723a7ef54f769dc9] [masahiro: modify davinci_nand.c for U-Boot] Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
This commit is contained in:
committed by
Masahiro Yamada
parent
13f3b04f61
commit
4d75596e6d
@@ -358,13 +358,12 @@ static struct nand_ecclayout nand_keystone_rbl_4bit_layout_oobfirst = {
|
|||||||
* @buf: the data to write
|
* @buf: the data to write
|
||||||
* @oob_required: must write chip->oob_poi to OOB
|
* @oob_required: must write chip->oob_poi to OOB
|
||||||
* @page: page number to write
|
* @page: page number to write
|
||||||
* @cached: cached programming
|
|
||||||
* @raw: use _raw version of write_page
|
* @raw: use _raw version of write_page
|
||||||
*/
|
*/
|
||||||
static int nand_davinci_write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
static int nand_davinci_write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||||
uint32_t offset, int data_len,
|
uint32_t offset, int data_len,
|
||||||
const uint8_t *buf, int oob_required,
|
const uint8_t *buf, int oob_required,
|
||||||
int page, int cached, int raw)
|
int page, int raw)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@@ -2409,12 +2409,11 @@ static int nand_write_page_syndrome(struct mtd_info *mtd,
|
|||||||
* @buf: the data to write
|
* @buf: the data to write
|
||||||
* @oob_required: must write chip->oob_poi to OOB
|
* @oob_required: must write chip->oob_poi to OOB
|
||||||
* @page: page number to write
|
* @page: page number to write
|
||||||
* @cached: cached programming
|
|
||||||
* @raw: use _raw version of write_page
|
* @raw: use _raw version of write_page
|
||||||
*/
|
*/
|
||||||
static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||||
uint32_t offset, int data_len, const uint8_t *buf,
|
uint32_t offset, int data_len, const uint8_t *buf,
|
||||||
int oob_required, int page, int cached, int raw)
|
int oob_required, int page, int raw)
|
||||||
{
|
{
|
||||||
int status, subpage;
|
int status, subpage;
|
||||||
|
|
||||||
@@ -2440,31 +2439,19 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
|||||||
if (status < 0)
|
if (status < 0)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
|
if (nand_standard_page_accessors(&chip->ecc))
|
||||||
|
chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1);
|
||||||
|
status = chip->waitfunc(mtd, chip);
|
||||||
/*
|
/*
|
||||||
* Cached progamming disabled for now. Not sure if it's worth the
|
* See if operation failed and additional status checks are
|
||||||
* trouble. The speed gain is not very impressive. (2.3->2.6Mib/s).
|
* available.
|
||||||
*/
|
*/
|
||||||
cached = 0;
|
if ((status & NAND_STATUS_FAIL) && (chip->errstat))
|
||||||
|
status = chip->errstat(mtd, chip, FL_WRITING, status,
|
||||||
|
page);
|
||||||
|
|
||||||
if (!cached || !NAND_HAS_CACHEPROG(chip)) {
|
if (status & NAND_STATUS_FAIL)
|
||||||
|
return -EIO;
|
||||||
if (nand_standard_page_accessors(&chip->ecc))
|
|
||||||
chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1);
|
|
||||||
status = chip->waitfunc(mtd, chip);
|
|
||||||
/*
|
|
||||||
* See if operation failed and additional status checks are
|
|
||||||
* available.
|
|
||||||
*/
|
|
||||||
if ((status & NAND_STATUS_FAIL) && (chip->errstat))
|
|
||||||
status = chip->errstat(mtd, chip, FL_WRITING, status,
|
|
||||||
page);
|
|
||||||
|
|
||||||
if (status & NAND_STATUS_FAIL)
|
|
||||||
return -EIO;
|
|
||||||
} else {
|
|
||||||
chip->cmdfunc(mtd, NAND_CMD_CACHEDPROG, -1, -1);
|
|
||||||
status = chip->waitfunc(mtd, chip);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2538,7 +2525,7 @@ static uint8_t *nand_fill_oob(struct mtd_info *mtd, uint8_t *oob, size_t len,
|
|||||||
static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
|
static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
|
||||||
struct mtd_oob_ops *ops)
|
struct mtd_oob_ops *ops)
|
||||||
{
|
{
|
||||||
int chipnr, realpage, page, blockmask, column;
|
int chipnr, realpage, page, column;
|
||||||
struct nand_chip *chip = mtd_to_nand(mtd);
|
struct nand_chip *chip = mtd_to_nand(mtd);
|
||||||
uint32_t writelen = ops->len;
|
uint32_t writelen = ops->len;
|
||||||
|
|
||||||
@@ -2574,7 +2561,6 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
|
|||||||
|
|
||||||
realpage = (int)(to >> chip->page_shift);
|
realpage = (int)(to >> chip->page_shift);
|
||||||
page = realpage & chip->pagemask;
|
page = realpage & chip->pagemask;
|
||||||
blockmask = (1 << (chip->phys_erase_shift - chip->page_shift)) - 1;
|
|
||||||
|
|
||||||
/* Invalidate the page cache, when we write to the cached page */
|
/* Invalidate the page cache, when we write to the cached page */
|
||||||
if (to <= ((loff_t)chip->pagebuf << chip->page_shift) &&
|
if (to <= ((loff_t)chip->pagebuf << chip->page_shift) &&
|
||||||
@@ -2589,7 +2575,6 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
|
|||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
int bytes = mtd->writesize;
|
int bytes = mtd->writesize;
|
||||||
int cached = writelen > bytes && page != blockmask;
|
|
||||||
uint8_t *wbuf = buf;
|
uint8_t *wbuf = buf;
|
||||||
int use_bufpoi;
|
int use_bufpoi;
|
||||||
int part_pagewr = (column || writelen < mtd->writesize);
|
int part_pagewr = (column || writelen < mtd->writesize);
|
||||||
@@ -2604,7 +2589,6 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
|
|||||||
if (use_bufpoi) {
|
if (use_bufpoi) {
|
||||||
pr_debug("%s: using write bounce buffer for buf@%p\n",
|
pr_debug("%s: using write bounce buffer for buf@%p\n",
|
||||||
__func__, buf);
|
__func__, buf);
|
||||||
cached = 0;
|
|
||||||
if (part_pagewr)
|
if (part_pagewr)
|
||||||
bytes = min_t(int, bytes - column, writelen);
|
bytes = min_t(int, bytes - column, writelen);
|
||||||
chip->pagebuf = -1;
|
chip->pagebuf = -1;
|
||||||
@@ -2622,7 +2606,7 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
|
|||||||
memset(chip->oob_poi, 0xff, mtd->oobsize);
|
memset(chip->oob_poi, 0xff, mtd->oobsize);
|
||||||
}
|
}
|
||||||
ret = chip->write_page(mtd, chip, column, bytes, wbuf,
|
ret = chip->write_page(mtd, chip, column, bytes, wbuf,
|
||||||
oob_required, page, cached,
|
oob_required, page,
|
||||||
(ops->mode == MTD_OPS_RAW));
|
(ops->mode == MTD_OPS_RAW));
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
|
@@ -849,7 +849,7 @@ struct nand_chip {
|
|||||||
int status, int page);
|
int status, int page);
|
||||||
int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
|
int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
|
||||||
uint32_t offset, int data_len, const uint8_t *buf,
|
uint32_t offset, int data_len, const uint8_t *buf,
|
||||||
int oob_required, int page, int cached, int raw);
|
int oob_required, int page, int raw);
|
||||||
int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip,
|
int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip,
|
||||||
int feature_addr, uint8_t *subfeature_para);
|
int feature_addr, uint8_t *subfeature_para);
|
||||||
int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip,
|
int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip,
|
||||||
|
Reference in New Issue
Block a user