mtd: rawnand: rename SET/GET FEATURES related functions

SET/GET FEATURES are flagged ONFI-compliant because of their name. This
is not accurate as non-ONFI NAND chips support it and use it.

Rename the hooks and helpers to remove the "onfi" prefix.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
This commit is contained in:
Miquel Raynal 2018-03-19 14:47:19 +01:00 коммит произвёл Boris Brezillon
Родитель fc2f30a4b4
Коммит b958758e68
15 изменённых файлов: 66 добавлений и 71 удалений

Просмотреть файл

@ -392,8 +392,8 @@ int bcm47xxnflash_ops_bcm4706_init(struct bcm47xxnflash *b47n)
b47n->nand_chip.read_byte = bcm47xxnflash_ops_bcm4706_read_byte; b47n->nand_chip.read_byte = bcm47xxnflash_ops_bcm4706_read_byte;
b47n->nand_chip.read_buf = bcm47xxnflash_ops_bcm4706_read_buf; b47n->nand_chip.read_buf = bcm47xxnflash_ops_bcm4706_read_buf;
b47n->nand_chip.write_buf = bcm47xxnflash_ops_bcm4706_write_buf; b47n->nand_chip.write_buf = bcm47xxnflash_ops_bcm4706_write_buf;
b47n->nand_chip.onfi_set_features = nand_onfi_get_set_features_notsupp; b47n->nand_chip.set_features = nand_get_set_features_notsupp;
b47n->nand_chip.onfi_get_features = nand_onfi_get_set_features_notsupp; b47n->nand_chip.get_features = nand_get_set_features_notsupp;
nand_chip->chip_delay = 50; nand_chip->chip_delay = 50;
b47n->nand_chip.bbt_options = NAND_BBT_USE_FLASH; b47n->nand_chip.bbt_options = NAND_BBT_USE_FLASH;

Просмотреть файл

@ -645,8 +645,8 @@ static int cafe_nand_probe(struct pci_dev *pdev,
cafe->nand.read_buf = cafe_read_buf; cafe->nand.read_buf = cafe_read_buf;
cafe->nand.write_buf = cafe_write_buf; cafe->nand.write_buf = cafe_write_buf;
cafe->nand.select_chip = cafe_select_chip; cafe->nand.select_chip = cafe_select_chip;
cafe->nand.onfi_set_features = nand_onfi_get_set_features_notsupp; cafe->nand.set_features = nand_get_set_features_notsupp;
cafe->nand.onfi_get_features = nand_onfi_get_set_features_notsupp; cafe->nand.get_features = nand_get_set_features_notsupp;
cafe->nand.chip_delay = 0; cafe->nand.chip_delay = 0;

Просмотреть файл

@ -1269,8 +1269,8 @@ static void __init init_mtd_structs(struct mtd_info *mtd)
nand->read_buf = docg4_read_buf; nand->read_buf = docg4_read_buf;
nand->write_buf = docg4_write_buf16; nand->write_buf = docg4_write_buf16;
nand->erase = docg4_erase_block; nand->erase = docg4_erase_block;
nand->onfi_set_features = nand_onfi_get_set_features_notsupp; nand->set_features = nand_get_set_features_notsupp;
nand->onfi_get_features = nand_onfi_get_set_features_notsupp; nand->get_features = nand_get_set_features_notsupp;
nand->ecc.read_page = docg4_read_page; nand->ecc.read_page = docg4_read_page;
nand->ecc.write_page = docg4_write_page; nand->ecc.write_page = docg4_write_page;
nand->ecc.read_page_raw = docg4_read_page_raw; nand->ecc.read_page_raw = docg4_read_page_raw;

Просмотреть файл

@ -775,8 +775,8 @@ static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv)
chip->select_chip = fsl_elbc_select_chip; chip->select_chip = fsl_elbc_select_chip;
chip->cmdfunc = fsl_elbc_cmdfunc; chip->cmdfunc = fsl_elbc_cmdfunc;
chip->waitfunc = fsl_elbc_wait; chip->waitfunc = fsl_elbc_wait;
chip->onfi_set_features = nand_onfi_get_set_features_notsupp; chip->set_features = nand_get_set_features_notsupp;
chip->onfi_get_features = nand_onfi_get_set_features_notsupp; chip->get_features = nand_get_set_features_notsupp;
chip->bbt_td = &bbt_main_descr; chip->bbt_td = &bbt_main_descr;
chip->bbt_md = &bbt_mirror_descr; chip->bbt_md = &bbt_mirror_descr;

Просмотреть файл

@ -838,8 +838,8 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv)
chip->select_chip = fsl_ifc_select_chip; chip->select_chip = fsl_ifc_select_chip;
chip->cmdfunc = fsl_ifc_cmdfunc; chip->cmdfunc = fsl_ifc_cmdfunc;
chip->waitfunc = fsl_ifc_wait; chip->waitfunc = fsl_ifc_wait;
chip->onfi_set_features = nand_onfi_get_set_features_notsupp; chip->set_features = nand_get_set_features_notsupp;
chip->onfi_get_features = nand_onfi_get_set_features_notsupp; chip->get_features = nand_get_set_features_notsupp;
chip->bbt_td = &bbt_main_descr; chip->bbt_td = &bbt_main_descr;
chip->bbt_md = &bbt_mirror_descr; chip->bbt_md = &bbt_mirror_descr;

Просмотреть файл

@ -934,15 +934,15 @@ static int enable_edo_mode(struct gpmi_nand_data *this, int mode)
/* [1] send SET FEATURE command to NAND */ /* [1] send SET FEATURE command to NAND */
feature[0] = mode; feature[0] = mode;
ret = nand->onfi_set_features(mtd, nand, ret = nand->set_features(mtd, nand,
ONFI_FEATURE_ADDR_TIMING_MODE, feature); ONFI_FEATURE_ADDR_TIMING_MODE, feature);
if (ret) if (ret)
goto err_out; goto err_out;
/* [2] send GET FEATURE command to double-check the timing mode */ /* [2] send GET FEATURE command to double-check the timing mode */
memset(feature, 0, ONFI_SUBFEATURE_PARAM_LEN); memset(feature, 0, ONFI_SUBFEATURE_PARAM_LEN);
ret = nand->onfi_get_features(mtd, nand, ret = nand->get_features(mtd, nand,
ONFI_FEATURE_ADDR_TIMING_MODE, feature); ONFI_FEATURE_ADDR_TIMING_MODE, feature);
if (ret || feature[0] != mode) if (ret || feature[0] != mode)
goto err_out; goto err_out;

Просмотреть файл

@ -762,8 +762,8 @@ static int hisi_nfc_probe(struct platform_device *pdev)
chip->write_buf = hisi_nfc_write_buf; chip->write_buf = hisi_nfc_write_buf;
chip->read_buf = hisi_nfc_read_buf; chip->read_buf = hisi_nfc_read_buf;
chip->chip_delay = HINFC504_CHIP_DELAY; chip->chip_delay = HINFC504_CHIP_DELAY;
chip->onfi_set_features = nand_onfi_get_set_features_notsupp; chip->set_features = nand_get_set_features_notsupp;
chip->onfi_get_features = nand_onfi_get_set_features_notsupp; chip->get_features = nand_get_set_features_notsupp;
hisi_nfc_host_init(host); hisi_nfc_host_init(host);

Просмотреть файл

@ -707,8 +707,8 @@ static int mpc5121_nfc_probe(struct platform_device *op)
chip->read_buf = mpc5121_nfc_read_buf; chip->read_buf = mpc5121_nfc_read_buf;
chip->write_buf = mpc5121_nfc_write_buf; chip->write_buf = mpc5121_nfc_write_buf;
chip->select_chip = mpc5121_nfc_select_chip; chip->select_chip = mpc5121_nfc_select_chip;
chip->onfi_set_features = nand_onfi_get_set_features_notsupp; chip->set_features = nand_get_set_features_notsupp;
chip->onfi_get_features = nand_onfi_get_set_features_notsupp; chip->get_features = nand_get_set_features_notsupp;
chip->bbt_options = NAND_BBT_USE_FLASH; chip->bbt_options = NAND_BBT_USE_FLASH;
chip->ecc.mode = NAND_ECC_SOFT; chip->ecc.mode = NAND_ECC_SOFT;
chip->ecc.algo = NAND_ECC_HAMMING; chip->ecc.algo = NAND_ECC_HAMMING;

Просмотреть файл

@ -1421,9 +1421,8 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command,
} }
} }
static int mxc_nand_onfi_set_features(struct mtd_info *mtd, static int mxc_nand_set_features(struct mtd_info *mtd, struct nand_chip *chip,
struct nand_chip *chip, int addr, int addr, u8 *subfeature_param)
u8 *subfeature_param)
{ {
struct nand_chip *nand_chip = mtd_to_nand(mtd); struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct mxc_nand_host *host = nand_get_controller_data(nand_chip); struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
@ -1447,9 +1446,8 @@ static int mxc_nand_onfi_set_features(struct mtd_info *mtd,
return 0; return 0;
} }
static int mxc_nand_onfi_get_features(struct mtd_info *mtd, static int mxc_nand_get_features(struct mtd_info *mtd, struct nand_chip *chip,
struct nand_chip *chip, int addr, int addr, u8 *subfeature_param)
u8 *subfeature_param)
{ {
struct nand_chip *nand_chip = mtd_to_nand(mtd); struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct mxc_nand_host *host = nand_get_controller_data(nand_chip); struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
@ -1752,8 +1750,8 @@ static int mxcnd_probe(struct platform_device *pdev)
this->read_word = mxc_nand_read_word; this->read_word = mxc_nand_read_word;
this->write_buf = mxc_nand_write_buf; this->write_buf = mxc_nand_write_buf;
this->read_buf = mxc_nand_read_buf; this->read_buf = mxc_nand_read_buf;
this->onfi_set_features = mxc_nand_onfi_set_features; this->set_features = mxc_nand_set_features;
this->onfi_get_features = mxc_nand_onfi_get_features; this->get_features = mxc_nand_get_features;
host->clk = devm_clk_get(&pdev->dev, NULL); host->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(host->clk)) if (IS_ERR(host->clk))

Просмотреть файл

@ -349,7 +349,7 @@ static void nand_write_byte16(struct mtd_info *mtd, uint8_t byte)
* 8-bits of the data bus. During address transfers, the host shall * 8-bits of the data bus. During address transfers, the host shall
* set the upper 8-bits of the data bus to 00h. * set the upper 8-bits of the data bus to 00h.
* *
* One user of the write_byte callback is nand_onfi_set_features. The * One user of the write_byte callback is nand_set_features. The
* four parameters are specified to be written to I/O[7:0], but this is * four parameters are specified to be written to I/O[7:0], but this is
* neither an address nor a command transfer. Let's assume a 0 on the * neither an address nor a command transfer. Let's assume a 0 on the
* upper I/O lines is OK. * upper I/O lines is OK.
@ -1231,9 +1231,9 @@ static int nand_setup_data_interface(struct nand_chip *chip, int chipnr)
chip->onfi_timing_mode_default, chip->onfi_timing_mode_default,
}; };
ret = chip->onfi_set_features(mtd, chip, ret = chip->set_features(mtd, chip,
ONFI_FEATURE_ADDR_TIMING_MODE, ONFI_FEATURE_ADDR_TIMING_MODE,
tmode_param); tmode_param);
if (ret) if (ret)
goto err; goto err;
} }
@ -4769,15 +4769,15 @@ static int nand_max_bad_blocks(struct mtd_info *mtd, loff_t ofs, size_t len)
} }
/** /**
* nand_default_onfi_set_features- [REPLACEABLE] set features for ONFI nand * nand_default_set_features- [REPLACEABLE] set NAND chip features
* @mtd: MTD device structure * @mtd: MTD device structure
* @chip: nand chip info structure * @chip: nand chip info structure
* @addr: feature address. * @addr: feature address.
* @subfeature_param: the subfeature parameters, a four bytes array. * @subfeature_param: the subfeature parameters, a four bytes array.
*/ */
static int nand_default_onfi_set_features(struct mtd_info *mtd, static int nand_default_set_features(struct mtd_info *mtd,
struct nand_chip *chip, int addr, struct nand_chip *chip, int addr,
uint8_t *subfeature_param) uint8_t *subfeature_param)
{ {
if (!chip->onfi_version || if (!chip->onfi_version ||
!(le16_to_cpu(chip->onfi_params.opt_cmd) !(le16_to_cpu(chip->onfi_params.opt_cmd)
@ -4788,15 +4788,15 @@ static int nand_default_onfi_set_features(struct mtd_info *mtd,
} }
/** /**
* nand_default_onfi_get_features- [REPLACEABLE] get features for ONFI nand * nand_default_get_features- [REPLACEABLE] get NAND chip features
* @mtd: MTD device structure * @mtd: MTD device structure
* @chip: nand chip info structure * @chip: nand chip info structure
* @addr: feature address. * @addr: feature address.
* @subfeature_param: the subfeature parameters, a four bytes array. * @subfeature_param: the subfeature parameters, a four bytes array.
*/ */
static int nand_default_onfi_get_features(struct mtd_info *mtd, static int nand_default_get_features(struct mtd_info *mtd,
struct nand_chip *chip, int addr, struct nand_chip *chip, int addr,
uint8_t *subfeature_param) uint8_t *subfeature_param)
{ {
if (!chip->onfi_version || if (!chip->onfi_version ||
!(le16_to_cpu(chip->onfi_params.opt_cmd) !(le16_to_cpu(chip->onfi_params.opt_cmd)
@ -4807,8 +4807,7 @@ static int nand_default_onfi_get_features(struct mtd_info *mtd,
} }
/** /**
* nand_onfi_get_set_features_notsupp - set/get features stub returning * nand_get_set_features_notsupp - set/get features stub returning -ENOTSUPP
* -ENOTSUPP
* @mtd: MTD device structure * @mtd: MTD device structure
* @chip: nand chip info structure * @chip: nand chip info structure
* @addr: feature address. * @addr: feature address.
@ -4817,13 +4816,12 @@ static int nand_default_onfi_get_features(struct mtd_info *mtd,
* Should be used by NAND controller drivers that do not support the SET/GET * Should be used by NAND controller drivers that do not support the SET/GET
* FEATURES operations. * FEATURES operations.
*/ */
int nand_onfi_get_set_features_notsupp(struct mtd_info *mtd, int nand_get_set_features_notsupp(struct mtd_info *mtd, struct nand_chip *chip,
struct nand_chip *chip, int addr, int addr, u8 *subfeature_param)
u8 *subfeature_param)
{ {
return -ENOTSUPP; return -ENOTSUPP;
} }
EXPORT_SYMBOL(nand_onfi_get_set_features_notsupp); EXPORT_SYMBOL(nand_get_set_features_notsupp);
/** /**
* nand_suspend - [MTD Interface] Suspend the NAND flash * nand_suspend - [MTD Interface] Suspend the NAND flash
@ -4880,10 +4878,10 @@ static void nand_set_defaults(struct nand_chip *chip)
chip->select_chip = nand_select_chip; chip->select_chip = nand_select_chip;
/* set for ONFI nand */ /* set for ONFI nand */
if (!chip->onfi_set_features) if (!chip->set_features)
chip->onfi_set_features = nand_default_onfi_set_features; chip->set_features = nand_default_set_features;
if (!chip->onfi_get_features) if (!chip->get_features)
chip->onfi_get_features = nand_default_onfi_get_features; chip->get_features = nand_default_get_features;
/* If called twice, pointers that depend on busw may need to be reset */ /* If called twice, pointers that depend on busw may need to be reset */
if (!chip->read_byte || chip->read_byte == nand_read_byte) if (!chip->read_byte || chip->read_byte == nand_read_byte)

Просмотреть файл

@ -48,8 +48,8 @@ static int micron_nand_setup_read_retry(struct mtd_info *mtd, int retry_mode)
struct nand_chip *chip = mtd_to_nand(mtd); struct nand_chip *chip = mtd_to_nand(mtd);
u8 feature[ONFI_SUBFEATURE_PARAM_LEN] = {retry_mode}; u8 feature[ONFI_SUBFEATURE_PARAM_LEN] = {retry_mode};
return chip->onfi_set_features(mtd, chip, ONFI_FEATURE_ADDR_READ_RETRY, return chip->set_features(mtd, chip, ONFI_FEATURE_ADDR_READ_RETRY,
feature); feature);
} }
/* /*
@ -108,8 +108,8 @@ static int micron_nand_on_die_ecc_setup(struct nand_chip *chip, bool enable)
if (enable) if (enable)
feature[0] |= ONFI_FEATURE_ON_DIE_ECC_EN; feature[0] |= ONFI_FEATURE_ON_DIE_ECC_EN;
return chip->onfi_set_features(nand_to_mtd(chip), chip, return chip->set_features(nand_to_mtd(chip), chip,
ONFI_FEATURE_ON_DIE_ECC, feature); ONFI_FEATURE_ON_DIE_ECC, feature);
} }
static int static int
@ -219,8 +219,8 @@ static int micron_supports_on_die_ecc(struct nand_chip *chip)
if (ret) if (ret)
return MICRON_ON_DIE_UNSUPPORTED; return MICRON_ON_DIE_UNSUPPORTED;
chip->onfi_get_features(nand_to_mtd(chip), chip, chip->get_features(nand_to_mtd(chip), chip,
ONFI_FEATURE_ON_DIE_ECC, feature); ONFI_FEATURE_ON_DIE_ECC, feature);
if ((feature[0] & ONFI_FEATURE_ON_DIE_ECC_EN) == 0) if ((feature[0] & ONFI_FEATURE_ON_DIE_ECC_EN) == 0)
return MICRON_ON_DIE_UNSUPPORTED; return MICRON_ON_DIE_UNSUPPORTED;
@ -228,8 +228,8 @@ static int micron_supports_on_die_ecc(struct nand_chip *chip)
if (ret) if (ret)
return MICRON_ON_DIE_UNSUPPORTED; return MICRON_ON_DIE_UNSUPPORTED;
chip->onfi_get_features(nand_to_mtd(chip), chip, chip->get_features(nand_to_mtd(chip), chip,
ONFI_FEATURE_ON_DIE_ECC, feature); ONFI_FEATURE_ON_DIE_ECC, feature);
if (feature[0] & ONFI_FEATURE_ON_DIE_ECC_EN) if (feature[0] & ONFI_FEATURE_ON_DIE_ECC_EN)
return MICRON_ON_DIE_MANDATORY; return MICRON_ON_DIE_MANDATORY;

Просмотреть файл

@ -2651,8 +2651,8 @@ static int qcom_nand_host_init(struct qcom_nand_controller *nandc,
chip->read_byte = qcom_nandc_read_byte; chip->read_byte = qcom_nandc_read_byte;
chip->read_buf = qcom_nandc_read_buf; chip->read_buf = qcom_nandc_read_buf;
chip->write_buf = qcom_nandc_write_buf; chip->write_buf = qcom_nandc_write_buf;
chip->onfi_set_features = nand_onfi_get_set_features_notsupp; chip->set_features = nand_get_set_features_notsupp;
chip->onfi_get_features = nand_onfi_get_set_features_notsupp; chip->get_features = nand_get_set_features_notsupp;
/* /*
* the bad block marker is readable only when we read the last codeword * the bad block marker is readable only when we read the last codeword

Просмотреть файл

@ -1180,8 +1180,8 @@ static int flctl_probe(struct platform_device *pdev)
nand->read_buf = flctl_read_buf; nand->read_buf = flctl_read_buf;
nand->select_chip = flctl_select_chip; nand->select_chip = flctl_select_chip;
nand->cmdfunc = flctl_cmdfunc; nand->cmdfunc = flctl_cmdfunc;
nand->onfi_set_features = nand_onfi_get_set_features_notsupp; nand->set_features = nand_get_set_features_notsupp;
nand->onfi_get_features = nand_onfi_get_set_features_notsupp; nand->get_features = nand_get_set_features_notsupp;
if (pdata->flcmncr_val & SEL_16BIT) if (pdata->flcmncr_val & SEL_16BIT)
nand->options |= NAND_BUSWIDTH_16; nand->options |= NAND_BUSWIDTH_16;

Просмотреть файл

@ -918,8 +918,8 @@ static int spinand_probe(struct spi_device *spi_nand)
chip->waitfunc = spinand_wait; chip->waitfunc = spinand_wait;
chip->options |= NAND_CACHEPRG; chip->options |= NAND_CACHEPRG;
chip->select_chip = spinand_select_chip; chip->select_chip = spinand_select_chip;
chip->onfi_set_features = nand_onfi_get_set_features_notsupp; chip->set_features = nand_get_set_features_notsupp;
chip->onfi_get_features = nand_onfi_get_set_features_notsupp; chip->get_features = nand_get_set_features_notsupp;
mtd = nand_to_mtd(chip); mtd = nand_to_mtd(chip);

Просмотреть файл

@ -1170,8 +1170,8 @@ int nand_op_parser_exec_op(struct nand_chip *chip,
* @blocks_per_die: [INTERN] The number of PEBs in a die * @blocks_per_die: [INTERN] The number of PEBs in a die
* @data_interface: [INTERN] NAND interface timing information * @data_interface: [INTERN] NAND interface timing information
* @read_retries: [INTERN] the number of read retry modes supported * @read_retries: [INTERN] the number of read retry modes supported
* @onfi_set_features: [REPLACEABLE] set the features for ONFI nand * @set_features: [REPLACEABLE] set the NAND chip features
* @onfi_get_features: [REPLACEABLE] get the features for ONFI nand * @get_features: [REPLACEABLE] get the NAND chip features
* @setup_data_interface: [OPTIONAL] setup the data interface and timing. If * @setup_data_interface: [OPTIONAL] setup the data interface and timing. If
* chipnr is set to %NAND_DATA_IFACE_CHECK_ONLY this * chipnr is set to %NAND_DATA_IFACE_CHECK_ONLY this
* means the configuration should not be applied but * means the configuration should not be applied but
@ -1212,10 +1212,10 @@ struct nand_chip {
bool check_only); bool check_only);
int (*erase)(struct mtd_info *mtd, int page); int (*erase)(struct mtd_info *mtd, int page);
int (*scan_bbt)(struct mtd_info *mtd); int (*scan_bbt)(struct mtd_info *mtd);
int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip, int (*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 (*get_features)(struct mtd_info *mtd, struct nand_chip *chip,
int feature_addr, uint8_t *subfeature_para); int feature_addr, uint8_t *subfeature_para);
int (*setup_read_retry)(struct mtd_info *mtd, int retry_mode); int (*setup_read_retry)(struct mtd_info *mtd, int retry_mode);
int (*setup_data_interface)(struct mtd_info *mtd, int chipnr, int (*setup_data_interface)(struct mtd_info *mtd, int chipnr,
const struct nand_data_interface *conf); const struct nand_data_interface *conf);
@ -1630,9 +1630,8 @@ int nand_read_oob_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
int page); int page);
/* Stub used by drivers that do not support GET/SET FEATURES operations */ /* Stub used by drivers that do not support GET/SET FEATURES operations */
int nand_onfi_get_set_features_notsupp(struct mtd_info *mtd, int nand_get_set_features_notsupp(struct mtd_info *mtd, struct nand_chip *chip,
struct nand_chip *chip, int addr, int addr, u8 *subfeature_param);
u8 *subfeature_param);
/* Default read_page_raw implementation */ /* Default read_page_raw implementation */
int nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip, int nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip,