mirror of
https://github.com/u-boot/u-boot.git
synced 2024-12-04 10:03:41 +08:00
mtd: nand: Add page argument to write_page() etc.
This change is part of the Linux 4.6 sync. It is being done before the main sync patch in order to make it easier to address the issue across all NAND drivers (many/most of which do not closely track their Linux counterparts) separately from other merge issues. Signed-off-by: Scott Wood <oss@buserror.net>
This commit is contained in:
parent
17cb4b8f32
commit
81c772521f
@ -433,7 +433,8 @@ static void arasan_nand_fill_tx(const u8 *buf, int len)
|
||||
}
|
||||
|
||||
static int arasan_nand_write_page_hwecc(struct mtd_info *mtd,
|
||||
struct nand_chip *chip, const u8 *buf, int oob_required)
|
||||
struct nand_chip *chip, const u8 *buf, int oob_required,
|
||||
int page)
|
||||
{
|
||||
u32 reg_val, i, pktsize, pktnum;
|
||||
const u32 *bufptr = (const u32 *)buf;
|
||||
|
@ -569,7 +569,7 @@ static int atmel_nand_pmecc_read_page(struct mtd_info *mtd,
|
||||
|
||||
static int atmel_nand_pmecc_write_page(struct mtd_info *mtd,
|
||||
struct nand_chip *chip, const uint8_t *buf,
|
||||
int oob_required)
|
||||
int oob_required, int page)
|
||||
{
|
||||
struct atmel_nand_host *host = nand_get_controller_data(chip);
|
||||
uint32_t *eccpos = chip->ecc.layout->eccpos;
|
||||
|
@ -380,10 +380,13 @@ static int nand_davinci_write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
|
||||
chip->cmdfunc(mtd, NAND_CMD_SEQIN, 0x00, page);
|
||||
|
||||
if (unlikely(raw))
|
||||
status = chip->ecc.write_page_raw(mtd, chip, buf, oob_required);
|
||||
else
|
||||
status = chip->ecc.write_page(mtd, chip, buf, oob_required);
|
||||
if (unlikely(raw)) {
|
||||
status = chip->ecc.write_page_raw(mtd, chip, buf,
|
||||
oob_required, page);
|
||||
} else {
|
||||
status = chip->ecc.write_page(mtd, chip, buf,
|
||||
oob_required, page);
|
||||
}
|
||||
|
||||
if (status < 0) {
|
||||
ret = status;
|
||||
|
@ -866,7 +866,8 @@ static int write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
* by write_page above.
|
||||
*/
|
||||
static int denali_write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
const uint8_t *buf, int oob_required)
|
||||
const uint8_t *buf, int oob_required,
|
||||
int page)
|
||||
{
|
||||
struct denali_nand_info *denali = mtd_to_denali(mtd);
|
||||
|
||||
@ -890,7 +891,8 @@ static int denali_write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
* write_page() function above.
|
||||
*/
|
||||
static int denali_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)
|
||||
{
|
||||
struct denali_nand_info *denali = mtd_to_denali(mtd);
|
||||
|
||||
|
@ -611,7 +611,8 @@ static int fsl_elbc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
* waitfunc.
|
||||
*/
|
||||
static int fsl_elbc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
const uint8_t *buf, int oob_required)
|
||||
const uint8_t *buf, int oob_required,
|
||||
int page)
|
||||
{
|
||||
fsl_elbc_write_buf(mtd, buf, mtd->writesize);
|
||||
fsl_elbc_write_buf(mtd, chip->oob_poi, mtd->oobsize);
|
||||
@ -626,7 +627,7 @@ static struct fsl_elbc_ctrl *elbc_ctrl;
|
||||
*/
|
||||
static int fsl_elbc_write_subpage(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
uint32_t offset, uint32_t data_len,
|
||||
const uint8_t *buf, int oob_required)
|
||||
const uint8_t *buf, int oob_required, int page)
|
||||
{
|
||||
fsl_elbc_write_buf(mtd, buf, mtd->writesize);
|
||||
fsl_elbc_write_buf(mtd, chip->oob_poi, mtd->oobsize);
|
||||
|
@ -755,7 +755,7 @@ static int fsl_ifc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
* waitfunc.
|
||||
*/
|
||||
static int fsl_ifc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
const uint8_t *buf, int oob_required)
|
||||
const uint8_t *buf, int oob_required, int page)
|
||||
{
|
||||
fsl_ifc_write_buf(mtd, buf, mtd->writesize);
|
||||
fsl_ifc_write_buf(mtd, chip->oob_poi, mtd->oobsize);
|
||||
|
@ -378,7 +378,8 @@ static int lpc32xx_read_oob(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
*/
|
||||
|
||||
static int lpc32xx_write_page_hwecc(struct mtd_info *mtd,
|
||||
struct nand_chip *chip, const uint8_t *buf, int oob_required)
|
||||
struct nand_chip *chip, const uint8_t *buf, int oob_required,
|
||||
int page)
|
||||
{
|
||||
unsigned int i, status, timeout;
|
||||
struct lpc32xx_oob *oob = (struct lpc32xx_oob *)chip->oob_poi;
|
||||
@ -435,7 +436,8 @@ static int lpc32xx_write_page_hwecc(struct mtd_info *mtd,
|
||||
*/
|
||||
|
||||
static int lpc32xx_write_page_raw(struct mtd_info *mtd,
|
||||
struct nand_chip *chip, const uint8_t *buf, int oob_required)
|
||||
struct nand_chip *chip, const uint8_t *buf, int oob_required,
|
||||
int page)
|
||||
{
|
||||
unsigned int i;
|
||||
struct lpc32xx_oob *oob = (struct lpc32xx_oob *)chip->oob_poi;
|
||||
|
@ -486,7 +486,8 @@ static int lpc32xx_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
/* Reuse the logic from "nand_write_page_hwecc()" */
|
||||
static int lpc32xx_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;
|
||||
uint8_t *ecc_calc = chip->buffers->ecccalc;
|
||||
|
@ -576,7 +576,7 @@ static int mxc_nand_write_oob_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,
|
||||
int oob_required)
|
||||
int oob_required, int page)
|
||||
{
|
||||
struct mxc_nand_host *host = nand_get_controller_data(chip);
|
||||
int eccsize = chip->ecc.size;
|
||||
@ -616,7 +616,7 @@ static int mxc_nand_write_page_raw_syndrome(struct mtd_info *mtd,
|
||||
static int mxc_nand_write_page_syndrome(struct mtd_info *mtd,
|
||||
struct nand_chip *chip,
|
||||
const uint8_t *buf,
|
||||
int oob_required)
|
||||
int oob_required, int page)
|
||||
{
|
||||
struct mxc_nand_host *host = nand_get_controller_data(chip);
|
||||
int i, n, eccsize = chip->ecc.size;
|
||||
|
@ -707,7 +707,7 @@ rtn:
|
||||
*/
|
||||
static int mxs_nand_ecc_write_page(struct mtd_info *mtd,
|
||||
struct nand_chip *nand, const uint8_t *buf,
|
||||
int oob_required)
|
||||
int oob_required, int page)
|
||||
{
|
||||
struct mxs_nand_info *nand_info = nand_get_controller_data(nand);
|
||||
struct mxs_dma_desc *d;
|
||||
|
@ -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)
|
||||
|
@ -1081,7 +1081,8 @@ static void nand_cmdfunc_extended(struct mtd_info *mtd,
|
||||
}
|
||||
|
||||
static int pxa3xx_nand_write_page_hwecc(struct mtd_info *mtd,
|
||||
struct nand_chip *chip, const uint8_t *buf, int oob_required)
|
||||
struct nand_chip *chip, const uint8_t *buf, int oob_required,
|
||||
int page)
|
||||
{
|
||||
chip->write_buf(mtd, buf, mtd->writesize);
|
||||
chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
|
||||
|
@ -657,16 +657,9 @@ static int nand_read_page_hwecc(struct mtd_info *mtd,
|
||||
* @param buf data buffer
|
||||
*/
|
||||
static int nand_write_page_hwecc(struct mtd_info *mtd,
|
||||
struct nand_chip *chip, const uint8_t *buf, int oob_required)
|
||||
struct nand_chip *chip, const uint8_t *buf, int oob_required,
|
||||
int page)
|
||||
{
|
||||
int page;
|
||||
struct nand_drv *info;
|
||||
|
||||
info = (struct nand_drv *)nand_get_controller_data(chip);
|
||||
|
||||
page = (readl(&info->reg->addr_reg1) >> 16) |
|
||||
(readl(&info->reg->addr_reg2) << 16);
|
||||
|
||||
nand_rw_page(mtd, chip, (uint8_t *)buf, page, 1, 1);
|
||||
return 0;
|
||||
}
|
||||
@ -697,15 +690,9 @@ static int nand_read_page_raw(struct mtd_info *mtd,
|
||||
* @param buf data buffer
|
||||
*/
|
||||
static int nand_write_page_raw(struct mtd_info *mtd,
|
||||
struct nand_chip *chip, const uint8_t *buf, int oob_required)
|
||||
struct nand_chip *chip, const uint8_t *buf,
|
||||
int oob_required, int page)
|
||||
{
|
||||
int page;
|
||||
struct nand_drv *info;
|
||||
|
||||
info = (struct nand_drv *)nand_get_controller_data(chip);
|
||||
page = (readl(&info->reg->addr_reg1) >> 16) |
|
||||
(readl(&info->reg->addr_reg2) << 16);
|
||||
|
||||
nand_rw_page(mtd, chip, (uint8_t *)buf, page, 0, 1);
|
||||
return 0;
|
||||
}
|
||||
|
@ -607,7 +607,7 @@ static int vf610_nfc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
* ECC will be calculated automatically
|
||||
*/
|
||||
static int vf610_nfc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
const uint8_t *buf, int oob_required)
|
||||
const uint8_t *buf, int oob_required, int page)
|
||||
{
|
||||
struct vf610_nfc *nfc = mtd_to_nfc(mtd);
|
||||
|
||||
|
@ -519,16 +519,16 @@ struct nand_ecc_ctrl {
|
||||
int (*read_page_raw)(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
uint8_t *buf, int oob_required, int page);
|
||||
int (*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);
|
||||
int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
uint8_t *buf, int oob_required, int page);
|
||||
int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
uint32_t offs, uint32_t len, uint8_t *buf, int page);
|
||||
int (*write_subpage)(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
uint32_t offset, uint32_t data_len,
|
||||
const uint8_t *data_buf, int oob_required);
|
||||
const uint8_t *data_buf, int oob_required, int page);
|
||||
int (*write_page)(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 (*write_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
int page);
|
||||
int (*read_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip,
|
||||
|
Loading…
Reference in New Issue
Block a user