|
@@ -1840,11 +1840,13 @@ out:
|
|
|
* @chip: nand chip info structure
|
|
|
* @buf: data buffer
|
|
|
* @oob_required: must write chip->oob_poi to OOB
|
|
|
+ * @page: page number to write
|
|
|
*
|
|
|
* Not for syndrome calculating ECC controllers, which use a special oob layout.
|
|
|
*/
|
|
|
static int nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
|
|
|
- const uint8_t *buf, int oob_required)
|
|
|
+ const uint8_t *buf, int oob_required,
|
|
|
+ int page)
|
|
|
{
|
|
|
chip->write_buf(mtd, buf, mtd->writesize);
|
|
|
if (oob_required)
|
|
@@ -1864,7 +1866,8 @@ static int nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
|
|
|
*/
|
|
|
static int nand_write_page_raw_syndrome(struct mtd_info *mtd,
|
|
|
struct nand_chip *chip,
|
|
|
- const uint8_t *buf, int oob_required)
|
|
|
+ const uint8_t *buf, int oob_required,
|
|
|
+ int page)
|
|
|
{
|
|
|
int eccsize = chip->ecc.size;
|
|
|
int eccbytes = chip->ecc.bytes;
|
|
@@ -1901,9 +1904,11 @@ static int nand_write_page_raw_syndrome(struct mtd_info *mtd,
|
|
|
* @chip: nand chip info structure
|
|
|
* @buf: data buffer
|
|
|
* @oob_required: must write chip->oob_poi to OOB
|
|
|
+ * @page: page number to write
|
|
|
*/
|
|
|
static int nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
|
|
|
- const uint8_t *buf, int oob_required)
|
|
|
+ const uint8_t *buf, int oob_required,
|
|
|
+ int page)
|
|
|
{
|
|
|
int i, eccsize = chip->ecc.size;
|
|
|
int eccbytes = chip->ecc.bytes;
|
|
@@ -1919,7 +1924,7 @@ static int nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
|
|
|
for (i = 0; i < chip->ecc.total; i++)
|
|
|
chip->oob_poi[eccpos[i]] = ecc_calc[i];
|
|
|
|
|
|
- return chip->ecc.write_page_raw(mtd, chip, buf, 1);
|
|
|
+ return chip->ecc.write_page_raw(mtd, chip, buf, 1, page);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1928,9 +1933,11 @@ static int nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
|
|
|
* @chip: nand chip info structure
|
|
|
* @buf: data buffer
|
|
|
* @oob_required: must write chip->oob_poi to OOB
|
|
|
+ * @page: page number to write
|
|
|
*/
|
|
|
static int nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
|
|
|
- const uint8_t *buf, int oob_required)
|
|
|
+ const uint8_t *buf, int oob_required,
|
|
|
+ int page)
|
|
|
{
|
|
|
int i, eccsize = chip->ecc.size;
|
|
|
int eccbytes = chip->ecc.bytes;
|
|
@@ -1962,11 +1969,12 @@ static int nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
|
|
|
* @data_len: data length
|
|
|
* @buf: data buffer
|
|
|
* @oob_required: must write chip->oob_poi to OOB
|
|
|
+ * @page: page number to write
|
|
|
*/
|
|
|
static int nand_write_subpage_hwecc(struct mtd_info *mtd,
|
|
|
struct nand_chip *chip, uint32_t offset,
|
|
|
uint32_t data_len, const uint8_t *buf,
|
|
|
- int oob_required)
|
|
|
+ int oob_required, int page)
|
|
|
{
|
|
|
uint8_t *oob_buf = chip->oob_poi;
|
|
|
uint8_t *ecc_calc = chip->buffers->ecccalc;
|
|
@@ -2027,7 +2035,8 @@ static int nand_write_subpage_hwecc(struct mtd_info *mtd,
|
|
|
*/
|
|
|
static int nand_write_page_syndrome(struct mtd_info *mtd,
|
|
|
struct nand_chip *chip,
|
|
|
- const uint8_t *buf, int oob_required)
|
|
|
+ const uint8_t *buf, int oob_required,
|
|
|
+ int page)
|
|
|
{
|
|
|
int i, eccsize = chip->ecc.size;
|
|
|
int eccbytes = chip->ecc.bytes;
|
|
@@ -2091,12 +2100,13 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
|
|
|
|
|
if (unlikely(raw))
|
|
|
status = chip->ecc.write_page_raw(mtd, chip, buf,
|
|
|
- oob_required);
|
|
|
+ oob_required, page);
|
|
|
else if (subpage)
|
|
|
status = chip->ecc.write_subpage(mtd, chip, offset, data_len,
|
|
|
- buf, oob_required);
|
|
|
+ buf, oob_required, page);
|
|
|
else
|
|
|
- status = chip->ecc.write_page(mtd, chip, buf, oob_required);
|
|
|
+ status = chip->ecc.write_page(mtd, chip, buf, oob_required,
|
|
|
+ page);
|
|
|
|
|
|
if (status < 0)
|
|
|
return status;
|
|
@@ -2135,6 +2145,7 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
|
|
* @oob: oob data buffer
|
|
|
* @len: oob data write length
|
|
|
* @ops: oob ops structure
|
|
|
+ * @page: page number to write
|
|
|
*/
|
|
|
static uint8_t *nand_fill_oob(struct mtd_info *mtd, uint8_t *oob, size_t len,
|
|
|
struct mtd_oob_ops *ops)
|