aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/nand_base.c
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2012-05-01 20:12:54 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-05-14 00:15:16 -0400
commitc00a0991d14dce8d714becc49ec8ae5db9c8ac98 (patch)
treec8982f0df143c0b76e29f76c790f52e78220d96d /drivers/mtd/nand/nand_base.c
parent831d316b8b80b68dcdd2b3f5ede6d33c2bbf5835 (diff)
mtd: nand: remove autoincrement 'sndcmd' code
The NAND_NO_AUTOINCR option is always set, so we will kill the option and make "no autoincrement" the default behavior for nand_base.c. Thus, we should remove the code which decides whether or not to send the NAND_CMD_READ0 command. Instead, we unconditionally send the command. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand/nand_base.c')
-rw-r--r--drivers/mtd/nand/nand_base.c43
1 files changed, 6 insertions, 37 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 640f1f8159e8..6246b0fc2fcd 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1477,8 +1477,6 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
1477 int chipnr, page, realpage, col, bytes, aligned; 1477 int chipnr, page, realpage, col, bytes, aligned;
1478 struct nand_chip *chip = mtd->priv; 1478 struct nand_chip *chip = mtd->priv;
1479 struct mtd_ecc_stats stats; 1479 struct mtd_ecc_stats stats;
1480 int blkcheck = (1 << (chip->phys_erase_shift - chip->page_shift)) - 1;
1481 int sndcmd = 1;
1482 int ret = 0; 1480 int ret = 0;
1483 uint32_t readlen = ops->len; 1481 uint32_t readlen = ops->len;
1484 uint32_t oobreadlen = ops->ooblen; 1482 uint32_t oobreadlen = ops->ooblen;
@@ -1509,10 +1507,7 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
1509 if (realpage != chip->pagebuf || oob) { 1507 if (realpage != chip->pagebuf || oob) {
1510 bufpoi = aligned ? buf : chip->buffers->databuf; 1508 bufpoi = aligned ? buf : chip->buffers->databuf;
1511 1509
1512 if (likely(sndcmd)) { 1510 chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
1513 chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
1514 sndcmd = 0;
1515 }
1516 1511
1517 /* 1512 /*
1518 * Now read the page into the buffer. Absent an error, 1513 * Now read the page into the buffer. Absent an error,
@@ -1564,13 +1559,7 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
1564 } 1559 }
1565 1560
1566 if (!(chip->options & NAND_NO_READRDY)) { 1561 if (!(chip->options & NAND_NO_READRDY)) {
1567 /* 1562 /* Apply delay or wait for ready/busy pin */
1568 * Apply delay or wait for ready/busy pin. Do
1569 * this before the AUTOINCR check, so no
1570 * problems arise if a chip which does auto
1571 * increment is marked as NOAUTOINCR by the
1572 * board driver.
1573 */
1574 if (!chip->dev_ready) 1563 if (!chip->dev_ready)
1575 udelay(chip->chip_delay); 1564 udelay(chip->chip_delay);
1576 else 1565 else
@@ -1600,13 +1589,6 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
1600 chip->select_chip(mtd, -1); 1589 chip->select_chip(mtd, -1);
1601 chip->select_chip(mtd, chipnr); 1590 chip->select_chip(mtd, chipnr);
1602 } 1591 }
1603
1604 /*
1605 * Check, if the chip supports auto page increment or if we
1606 * have hit a block boundary.
1607 */
1608 if (!NAND_CANAUTOINCR(chip) || !(page & blkcheck))
1609 sndcmd = 1;
1610 } 1592 }
1611 1593
1612 ops->retlen = ops->len - (size_t) readlen; 1594 ops->retlen = ops->len - (size_t) readlen;
@@ -1800,10 +1782,9 @@ static int nand_write_oob_syndrome(struct mtd_info *mtd,
1800static int nand_do_read_oob(struct mtd_info *mtd, loff_t from, 1782static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
1801 struct mtd_oob_ops *ops) 1783 struct mtd_oob_ops *ops)
1802{ 1784{
1803 int page, realpage, chipnr, sndcmd = 1; 1785 int page, realpage, chipnr;
1804 struct nand_chip *chip = mtd->priv; 1786 struct nand_chip *chip = mtd->priv;
1805 struct mtd_ecc_stats stats; 1787 struct mtd_ecc_stats stats;
1806 int blkcheck = (1 << (chip->phys_erase_shift - chip->page_shift)) - 1;
1807 int readlen = ops->ooblen; 1788 int readlen = ops->ooblen;
1808 int len; 1789 int len;
1809 uint8_t *buf = ops->oobbuf; 1790 uint8_t *buf = ops->oobbuf;
@@ -1842,20 +1823,15 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
1842 1823
1843 while (1) { 1824 while (1) {
1844 if (ops->mode == MTD_OPS_RAW) 1825 if (ops->mode == MTD_OPS_RAW)
1845 sndcmd = chip->ecc.read_oob_raw(mtd, chip, page, sndcmd); 1826 chip->ecc.read_oob_raw(mtd, chip, page, 1);
1846 else 1827 else
1847 sndcmd = chip->ecc.read_oob(mtd, chip, page, sndcmd); 1828 chip->ecc.read_oob(mtd, chip, page, 1);
1848 1829
1849 len = min(len, readlen); 1830 len = min(len, readlen);
1850 buf = nand_transfer_oob(chip, buf, ops, len); 1831 buf = nand_transfer_oob(chip, buf, ops, len);
1851 1832
1852 if (!(chip->options & NAND_NO_READRDY)) { 1833 if (!(chip->options & NAND_NO_READRDY)) {
1853 /* 1834 /* Apply delay or wait for ready/busy pin */
1854 * Apply delay or wait for ready/busy pin. Do this
1855 * before the AUTOINCR check, so no problems arise if a
1856 * chip which does auto increment is marked as
1857 * NOAUTOINCR by the board driver.
1858 */
1859 if (!chip->dev_ready) 1835 if (!chip->dev_ready)
1860 udelay(chip->chip_delay); 1836 udelay(chip->chip_delay);
1861 else 1837 else
@@ -1876,13 +1852,6 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
1876 chip->select_chip(mtd, -1); 1852 chip->select_chip(mtd, -1);
1877 chip->select_chip(mtd, chipnr); 1853 chip->select_chip(mtd, chipnr);
1878 } 1854 }
1879
1880 /*
1881 * Check, if the chip supports auto page increment or if we
1882 * have hit a block boundary.
1883 */
1884 if (!NAND_CANAUTOINCR(chip) || !(page & blkcheck))
1885 sndcmd = 1;
1886 } 1855 }
1887 1856
1888 ops->oobretlen = ops->ooblen; 1857 ops->oobretlen = ops->ooblen;