1
0
Fork 0

mtd: rawnand: Pass a nand_chip object to nand_scan()

Let's make the raw NAND API consistent by patching all helpers to take
a nand_chip object instead of an mtd_info one.

We start with nand_scan().

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
This commit is contained in:
Boris Brezillon 2018-09-06 14:05:14 +02:00 committed by Miquel Raynal
parent 47bd59e538
commit 00ad378f30
52 changed files with 64 additions and 64 deletions

View file

@ -246,7 +246,7 @@ necessary information about the device.
this->eccmode = NAND_ECC_SOFT; this->eccmode = NAND_ECC_SOFT;
/* Scan to find existence of the device */ /* Scan to find existence of the device */
if (nand_scan (board_mtd, 1)) { if (nand_scan (this, 1)) {
err = -ENXIO; err = -ENXIO;
goto out_ior; goto out_ior;
} }

View file

@ -235,7 +235,7 @@ static int ams_delta_init(struct platform_device *pdev)
goto out_gpio; goto out_gpio;
/* Scan to find existence of the device */ /* Scan to find existence of the device */
err = nand_scan(ams_delta_mtd, 1); err = nand_scan(this, 1);
if (err) if (err)
goto out_mtd; goto out_mtd;

View file

@ -1683,7 +1683,7 @@ atmel_nand_controller_add_nand(struct atmel_nand_controller *nc,
nc->caps->ops->nand_init(nc, nand); nc->caps->ops->nand_init(nc, nand);
ret = nand_scan(mtd, nand->numcs); ret = nand_scan(chip, nand->numcs);
if (ret) { if (ret) {
dev_err(nc->dev, "NAND scan failed: %d\n", ret); dev_err(nc->dev, "NAND scan failed: %d\n", ret);
return ret; return ret;

View file

@ -451,7 +451,7 @@ static int au1550nd_probe(struct platform_device *pdev)
this->write_buf = (pd->devwidth) ? au_write_buf16 : au_write_buf; this->write_buf = (pd->devwidth) ? au_write_buf16 : au_write_buf;
this->read_buf = (pd->devwidth) ? au_read_buf16 : au_read_buf; this->read_buf = (pd->devwidth) ? au_read_buf16 : au_read_buf;
ret = nand_scan(mtd, 1); ret = nand_scan(this, 1);
if (ret) { if (ret) {
dev_err(&pdev->dev, "NAND scan failed with %d\n", ret); dev_err(&pdev->dev, "NAND scan failed with %d\n", ret);
goto out3; goto out3;

View file

@ -423,7 +423,7 @@ int bcm47xxnflash_ops_bcm4706_init(struct bcm47xxnflash *b47n)
(w4 << 24 | w3 << 18 | w2 << 12 | w1 << 6 | w0)); (w4 << 24 | w3 << 18 | w2 << 12 | w1 << 6 | w0));
/* Scan NAND */ /* Scan NAND */
err = nand_scan(nand_to_mtd(&b47n->nand_chip), 1); err = nand_scan(&b47n->nand_chip, 1);
if (err) { if (err) {
pr_err("Could not scan NAND flash: %d\n", err); pr_err("Could not scan NAND flash: %d\n", err);
goto exit; goto exit;

View file

@ -2301,7 +2301,7 @@ static int brcmnand_init_cs(struct brcmnand_host *host, struct device_node *dn)
nand_writereg(ctrl, cfg_offs, nand_writereg(ctrl, cfg_offs,
nand_readreg(ctrl, cfg_offs) & ~CFG_BUS_WIDTH); nand_readreg(ctrl, cfg_offs) & ~CFG_BUS_WIDTH);
ret = nand_scan(mtd, 1); ret = nand_scan(chip, 1);
if (ret) if (ret)
return ret; return ret;

View file

@ -783,7 +783,7 @@ static int cafe_nand_probe(struct pci_dev *pdev,
/* Scan to find existence of the device */ /* Scan to find existence of the device */
cafe->nand.dummy_controller.ops = &cafe_nand_controller_ops; cafe->nand.dummy_controller.ops = &cafe_nand_controller_ops;
err = nand_scan(mtd, 2); err = nand_scan(&cafe->nand, 2);
if (err) if (err)
goto out_irq; goto out_irq;

View file

@ -193,7 +193,7 @@ static int __init cmx270_init(void)
this->write_buf = cmx270_write_buf; this->write_buf = cmx270_write_buf;
/* Scan to find existence of the device */ /* Scan to find existence of the device */
ret = nand_scan(cmx270_nand_mtd, 1); ret = nand_scan(this, 1);
if (ret) { if (ret) {
pr_notice("No NAND device\n"); pr_notice("No NAND device\n");
goto err_scan; goto err_scan;

View file

@ -241,7 +241,7 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr)
} }
/* Scan to find existence of the device */ /* Scan to find existence of the device */
err = nand_scan(new_mtd, 1); err = nand_scan(this, 1);
if (err) if (err)
goto out_free; goto out_free;

View file

@ -807,7 +807,7 @@ static int nand_davinci_probe(struct platform_device *pdev)
/* Scan to find existence of the device(s) */ /* Scan to find existence of the device(s) */
info->chip.dummy_controller.ops = &davinci_nand_controller_ops; info->chip.dummy_controller.ops = &davinci_nand_controller_ops;
ret = nand_scan(mtd, pdata->mask_chipsel ? 2 : 1); ret = nand_scan(&info->chip, pdata->mask_chipsel ? 2 : 1);
if (ret < 0) { if (ret < 0) {
dev_dbg(&pdev->dev, "no NAND chip(s) found\n"); dev_dbg(&pdev->dev, "no NAND chip(s) found\n");
return ret; return ret;

View file

@ -1355,7 +1355,7 @@ int denali_init(struct denali_nand_info *denali)
chip->setup_data_interface = denali_setup_data_interface; chip->setup_data_interface = denali_setup_data_interface;
chip->dummy_controller.ops = &denali_controller_ops; chip->dummy_controller.ops = &denali_controller_ops;
ret = nand_scan(mtd, denali->max_banks); ret = nand_scan(chip, denali->max_banks);
if (ret) if (ret)
goto disable_irq; goto disable_irq;

View file

@ -1620,7 +1620,7 @@ static int __init doc_probe(unsigned long physadr)
else else
numchips = doc2001_init(mtd); numchips = doc2001_init(mtd);
if ((ret = nand_scan(mtd, numchips)) || (ret = doc->late_init(mtd))) { if ((ret = nand_scan(nand, numchips)) || (ret = doc->late_init(mtd))) {
/* DBB note: i believe nand_release is necessary here, as /* DBB note: i believe nand_release is necessary here, as
buffers may have been allocated in nand_base. Check with buffers may have been allocated in nand_base. Check with
Thomas. FIX ME! */ Thomas. FIX ME! */

View file

@ -1391,7 +1391,7 @@ static int __init probe_docg4(struct platform_device *pdev)
* ->attach_chip callback. * ->attach_chip callback.
*/ */
nand->dummy_controller.ops = &docg4_controller_ops; nand->dummy_controller.ops = &docg4_controller_ops;
retval = nand_scan(mtd, 0); retval = nand_scan(nand, 0);
if (retval) if (retval)
goto free_nand; goto free_nand;

View file

@ -915,7 +915,7 @@ static int fsl_elbc_nand_probe(struct platform_device *pdev)
goto err; goto err;
priv->chip.controller->ops = &fsl_elbc_controller_ops; priv->chip.controller->ops = &fsl_elbc_controller_ops;
ret = nand_scan(mtd, 1); ret = nand_scan(&priv->chip, 1);
if (ret) if (ret)
goto err; goto err;

View file

@ -1079,7 +1079,7 @@ static int fsl_ifc_nand_probe(struct platform_device *dev)
goto err; goto err;
priv->chip.controller->ops = &fsl_ifc_controller_ops; priv->chip.controller->ops = &fsl_ifc_controller_ops;
ret = nand_scan(mtd, 1); ret = nand_scan(&priv->chip, 1);
if (ret) if (ret)
goto err; goto err;

View file

@ -191,7 +191,7 @@ static int fun_chip_init(struct fsl_upm_nand *fun,
goto err; goto err;
} }
ret = nand_scan(mtd, fun->mchip_count); ret = nand_scan(&fun->chip, fun->mchip_count);
if (ret) if (ret)
goto err; goto err;

View file

@ -1125,7 +1125,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
* Scan to find existence of the device * Scan to find existence of the device
*/ */
nand->dummy_controller.ops = &fsmc_nand_controller_ops; nand->dummy_controller.ops = &fsmc_nand_controller_ops;
ret = nand_scan(mtd, 1); ret = nand_scan(nand, 1);
if (ret) if (ret)
goto release_dma_write_chan; goto release_dma_write_chan;

View file

@ -289,7 +289,7 @@ static int gpio_nand_probe(struct platform_device *pdev)
if (gpiomtd->nwp && !IS_ERR(gpiomtd->nwp)) if (gpiomtd->nwp && !IS_ERR(gpiomtd->nwp))
gpiod_direction_output(gpiomtd->nwp, 1); gpiod_direction_output(gpiomtd->nwp, 1);
ret = nand_scan(mtd, 1); ret = nand_scan(chip, 1);
if (ret) if (ret)
goto err_wp; goto err_wp;

View file

@ -1934,7 +1934,7 @@ static int gpmi_nand_init(struct gpmi_nand_data *this)
goto err_out; goto err_out;
chip->dummy_controller.ops = &gpmi_nand_controller_ops; chip->dummy_controller.ops = &gpmi_nand_controller_ops;
ret = nand_scan(mtd, GPMI_IS_MX6(this) ? 2 : 1); ret = nand_scan(chip, GPMI_IS_MX6(this) ? 2 : 1);
if (ret) if (ret)
goto err_out; goto err_out;

View file

@ -801,7 +801,7 @@ static int hisi_nfc_probe(struct platform_device *pdev)
} }
chip->dummy_controller.ops = &hisi_nfc_controller_ops; chip->dummy_controller.ops = &hisi_nfc_controller_ops;
ret = nand_scan(mtd, max_chips); ret = nand_scan(chip, max_chips);
if (ret) if (ret)
return ret; return ret;

View file

@ -331,7 +331,7 @@ static int jz_nand_detect_bank(struct platform_device *pdev,
if (chipnr == 0) { if (chipnr == 0) {
/* Detect first chip. */ /* Detect first chip. */
ret = nand_scan(mtd, 1); ret = nand_scan(chip, 1);
if (ret) if (ret)
goto notfound_id; goto notfound_id;

View file

@ -286,7 +286,7 @@ static int jz4780_nand_init_chip(struct platform_device *pdev,
nand_set_flash_node(chip, np); nand_set_flash_node(chip, np);
chip->controller->ops = &jz4780_nand_controller_ops; chip->controller->ops = &jz4780_nand_controller_ops;
ret = nand_scan(mtd, 1); ret = nand_scan(chip, 1);
if (ret) if (ret)
return ret; return ret;

View file

@ -802,7 +802,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
* SMALL block or LARGE block. * SMALL block or LARGE block.
*/ */
nand_chip->dummy_controller.ops = &lpc32xx_nand_controller_ops; nand_chip->dummy_controller.ops = &lpc32xx_nand_controller_ops;
res = nand_scan(mtd, 1); res = nand_scan(nand_chip, 1);
if (res) if (res)
goto free_irq; goto free_irq;

View file

@ -925,7 +925,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
/* Find NAND device */ /* Find NAND device */
chip->dummy_controller.ops = &lpc32xx_nand_controller_ops; chip->dummy_controller.ops = &lpc32xx_nand_controller_ops;
res = nand_scan(mtd, 1); res = nand_scan(chip, 1);
if (res) if (res)
goto release_dma; goto release_dma;

View file

@ -2605,7 +2605,7 @@ static int marvell_nand_chip_init(struct device *dev, struct marvell_nfc *nfc,
chip->options |= NAND_BUSWIDTH_AUTO; chip->options |= NAND_BUSWIDTH_AUTO;
ret = nand_scan(mtd, marvell_nand->nsels); ret = nand_scan(chip, marvell_nand->nsels);
if (ret) { if (ret) {
dev_err(dev, "could not scan the nand chip\n"); dev_err(dev, "could not scan the nand chip\n");
return ret; return ret;

View file

@ -767,7 +767,7 @@ static int mpc5121_nfc_probe(struct platform_device *op)
} }
/* Detect NAND chips */ /* Detect NAND chips */
retval = nand_scan(mtd, be32_to_cpup(chips_no)); retval = nand_scan(chip, be32_to_cpup(chips_no));
if (retval) { if (retval) {
dev_err(dev, "NAND Flash not found !\n"); dev_err(dev, "NAND Flash not found !\n");
goto error; goto error;

View file

@ -1365,7 +1365,7 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc,
mtk_nfc_hw_init(nfc); mtk_nfc_hw_init(nfc);
ret = nand_scan(mtd, nsels); ret = nand_scan(nand, nsels);
if (ret) if (ret)
return ret; return ret;

View file

@ -1887,7 +1887,7 @@ static int mxcnd_probe(struct platform_device *pdev)
/* Scan the NAND device */ /* Scan the NAND device */
this->dummy_controller.ops = &mxcnd_controller_ops; this->dummy_controller.ops = &mxcnd_controller_ops;
err = nand_scan(mtd, is_imx25_nfc(host) ? 4 : 1); err = nand_scan(this, is_imx25_nfc(host) ? 4 : 1);
if (err) if (err)
goto escan; goto escan;

View file

@ -5960,7 +5960,7 @@ static int nand_dt_init(struct nand_chip *chip)
/** /**
* nand_scan_ident - Scan for the NAND device * nand_scan_ident - Scan for the NAND device
* @mtd: MTD device structure * @chip: NAND chip object
* @maxchips: number of chips to scan for * @maxchips: number of chips to scan for
* @table: alternative NAND ID table * @table: alternative NAND ID table
* *
@ -5972,11 +5972,11 @@ static int nand_dt_init(struct nand_chip *chip)
* prevented dynamic allocations during this phase which was unconvenient and * prevented dynamic allocations during this phase which was unconvenient and
* as been banned for the benefit of the ->init_ecc()/cleanup_ecc() hooks. * as been banned for the benefit of the ->init_ecc()/cleanup_ecc() hooks.
*/ */
static int nand_scan_ident(struct mtd_info *mtd, int maxchips, static int nand_scan_ident(struct nand_chip *chip, int maxchips,
struct nand_flash_dev *table) struct nand_flash_dev *table)
{ {
struct mtd_info *mtd = nand_to_mtd(chip);
int i, nand_maf_id, nand_dev_id; int i, nand_maf_id, nand_dev_id;
struct nand_chip *chip = mtd_to_nand(mtd);
int ret; int ret;
/* Enforce the right timings for reset/detection */ /* Enforce the right timings for reset/detection */
@ -6430,15 +6430,15 @@ static bool nand_ecc_strength_good(struct mtd_info *mtd)
/** /**
* nand_scan_tail - Scan for the NAND device * nand_scan_tail - Scan for the NAND device
* @mtd: MTD device structure * @chip: NAND chip object
* *
* This is the second phase of the normal nand_scan() function. It fills out * This is the second phase of the normal nand_scan() function. It fills out
* all the uninitialized function pointers with the defaults and scans for a * all the uninitialized function pointers with the defaults and scans for a
* bad block table if appropriate. * bad block table if appropriate.
*/ */
static int nand_scan_tail(struct mtd_info *mtd) static int nand_scan_tail(struct nand_chip *chip)
{ {
struct nand_chip *chip = mtd_to_nand(mtd); struct mtd_info *mtd = nand_to_mtd(chip);
struct nand_ecc_ctrl *ecc = &chip->ecc; struct nand_ecc_ctrl *ecc = &chip->ecc;
int ret, i; int ret, i;
@ -6777,7 +6777,7 @@ static void nand_detach(struct nand_chip *chip)
/** /**
* nand_scan_with_ids - [NAND Interface] Scan for the NAND device * nand_scan_with_ids - [NAND Interface] Scan for the NAND device
* @mtd: MTD device structure * @chip: NAND chip object
* @maxchips: number of chips to scan for. @nand_scan_ident() will not be run if * @maxchips: number of chips to scan for. @nand_scan_ident() will not be run if
* this parameter is zero (useful for specific drivers that must * this parameter is zero (useful for specific drivers that must
* handle this part of the process themselves, e.g docg4). * handle this part of the process themselves, e.g docg4).
@ -6787,14 +6787,13 @@ static void nand_detach(struct nand_chip *chip)
* The flash ID is read and the mtd/chip structures are filled with the * The flash ID is read and the mtd/chip structures are filled with the
* appropriate values. * appropriate values.
*/ */
int nand_scan_with_ids(struct mtd_info *mtd, int maxchips, int nand_scan_with_ids(struct nand_chip *chip, int maxchips,
struct nand_flash_dev *ids) struct nand_flash_dev *ids)
{ {
struct nand_chip *chip = mtd_to_nand(mtd);
int ret; int ret;
if (maxchips) { if (maxchips) {
ret = nand_scan_ident(mtd, maxchips, ids); ret = nand_scan_ident(chip, maxchips, ids);
if (ret) if (ret)
return ret; return ret;
} }
@ -6803,7 +6802,7 @@ int nand_scan_with_ids(struct mtd_info *mtd, int maxchips,
if (ret) if (ret)
goto cleanup_ident; goto cleanup_ident;
ret = nand_scan_tail(mtd); ret = nand_scan_tail(chip);
if (ret) if (ret)
goto detach_chip; goto detach_chip;

View file

@ -2309,7 +2309,7 @@ static int __init ns_init_module(void)
goto error; goto error;
chip->dummy_controller.ops = &ns_controller_ops; chip->dummy_controller.ops = &ns_controller_ops;
retval = nand_scan(nsmtd, 1); retval = nand_scan(chip, 1);
if (retval) { if (retval) {
NS_ERR("Could not scan NAND Simulator device\n"); NS_ERR("Could not scan NAND Simulator device\n");
goto error; goto error;

View file

@ -181,7 +181,7 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc,
goto err; goto err;
} }
ret = nand_scan(mtd, 1); ret = nand_scan(chip, 1);
if (ret) if (ret)
goto err; goto err;

View file

@ -270,7 +270,7 @@ static int nuc900_nand_probe(struct platform_device *pdev)
nuc900_nand_enable(nuc900_nand); nuc900_nand_enable(nuc900_nand);
if (nand_scan(mtd, 1)) if (nand_scan(chip, 1))
return -ENXIO; return -ENXIO;
mtd_device_register(mtd, partitions, ARRAY_SIZE(partitions)); mtd_device_register(mtd, partitions, ARRAY_SIZE(partitions));

View file

@ -2254,7 +2254,7 @@ static int omap_nand_probe(struct platform_device *pdev)
/* scan NAND device connected to chip controller */ /* scan NAND device connected to chip controller */
nand_chip->options |= info->devsize & NAND_BUSWIDTH_16; nand_chip->options |= info->devsize & NAND_BUSWIDTH_16;
err = nand_scan(mtd, 1); err = nand_scan(nand_chip, 1);
if (err) if (err)
goto return_error; goto return_error;

View file

@ -174,7 +174,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
return ret; return ret;
} }
ret = nand_scan(mtd, 1); ret = nand_scan(nc, 1);
if (ret) if (ret)
goto no_dev; goto no_dev;

View file

@ -142,7 +142,7 @@ static int oxnas_nand_probe(struct platform_device *pdev)
chip->chip_delay = 30; chip->chip_delay = 30;
/* Scan to find existence of the device */ /* Scan to find existence of the device */
err = nand_scan(mtd, 1); err = nand_scan(chip, 1);
if (err) if (err)
goto err_clk_unprepare; goto err_clk_unprepare;

View file

@ -156,7 +156,7 @@ static int pasemi_nand_probe(struct platform_device *ofdev)
chip->bbt_options = NAND_BBT_USE_FLASH; chip->bbt_options = NAND_BBT_USE_FLASH;
/* Scan to find existence of the device */ /* Scan to find existence of the device */
err = nand_scan(pasemi_nand_mtd, 1); err = nand_scan(chip, 1);
if (err) if (err)
goto out_lpc; goto out_lpc;

View file

@ -131,7 +131,7 @@ static int plat_nand_probe(struct platform_device *pdev)
} }
/* Scan to find existence of the device */ /* Scan to find existence of the device */
err = nand_scan(mtd, pdata->chip.nr_chips); err = nand_scan(&data->chip, pdata->chip.nr_chips);
if (err) if (err)
goto out; goto out;

View file

@ -2834,7 +2834,7 @@ static int qcom_nand_host_init_and_register(struct qcom_nand_controller *nandc,
/* set up initial status value */ /* set up initial status value */
host->status = NAND_STATUS_READY | NAND_STATUS_WP; host->status = NAND_STATUS_READY | NAND_STATUS_WP;
ret = nand_scan(mtd, 1); ret = nand_scan(chip, 1);
if (ret) if (ret)
return ret; return ret;

View file

@ -1170,7 +1170,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev)
mtd->dev.parent = &pdev->dev; mtd->dev.parent = &pdev->dev;
s3c2410_nand_init_chip(info, nmtd, sets); s3c2410_nand_init_chip(info, nmtd, sets);
err = nand_scan(mtd, sets ? sets->nr_chips : 1); err = nand_scan(&nmtd->chip, sets ? sets->nr_chips : 1);
if (err) if (err)
goto exit_error; goto exit_error;

View file

@ -1193,7 +1193,7 @@ static int flctl_probe(struct platform_device *pdev)
flctl_setup_dma(flctl); flctl_setup_dma(flctl);
nand->dummy_controller.ops = &flctl_nand_controller_ops; nand->dummy_controller.ops = &flctl_nand_controller_ops;
ret = nand_scan(flctl_mtd, 1); ret = nand_scan(nand, 1);
if (ret) if (ret)
goto err_chip; goto err_chip;

View file

@ -171,7 +171,7 @@ static int sharpsl_nand_probe(struct platform_device *pdev)
this->ecc.correct = nand_correct_data; this->ecc.correct = nand_correct_data;
/* Scan to find existence of the device */ /* Scan to find existence of the device */
err = nand_scan(mtd, 1); err = nand_scan(this, 1);
if (err) if (err)
goto err_scan; goto err_scan;

View file

@ -195,7 +195,7 @@ int sm_register_device(struct mtd_info *mtd, int smartmedia)
/* Scan for card properties */ /* Scan for card properties */
chip->dummy_controller.ops = &sm_controller_ops; chip->dummy_controller.ops = &sm_controller_ops;
flash_ids = smartmedia ? nand_smartmedia_flash_ids : nand_xd_flash_ids; flash_ids = smartmedia ? nand_smartmedia_flash_ids : nand_xd_flash_ids;
ret = nand_scan_with_ids(mtd, 1, flash_ids); ret = nand_scan_with_ids(chip, 1, flash_ids);
if (ret) if (ret)
return ret; return ret;

View file

@ -173,7 +173,7 @@ static int socrates_nand_probe(struct platform_device *ofdev)
dev_set_drvdata(&ofdev->dev, host); dev_set_drvdata(&ofdev->dev, host);
res = nand_scan(mtd, 1); res = nand_scan(nand_chip, 1);
if (res) if (res)
goto out; goto out;

View file

@ -1940,7 +1940,7 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc,
mtd = nand_to_mtd(nand); mtd = nand_to_mtd(nand);
mtd->dev.parent = dev; mtd->dev.parent = dev;
ret = nand_scan(mtd, nsels); ret = nand_scan(nand, nsels);
if (ret) if (ret)
return ret; return ret;

View file

@ -588,7 +588,7 @@ static int chip_init(struct device *dev, struct device_node *np)
mtd_set_ooblayout(mtd, &tango_nand_ooblayout_ops); mtd_set_ooblayout(mtd, &tango_nand_ooblayout_ops);
mtd->dev.parent = dev; mtd->dev.parent = dev;
err = nand_scan(mtd, 1); err = nand_scan(chip, 1);
if (err) if (err)
return err; return err;

View file

@ -1119,7 +1119,7 @@ static int tegra_nand_chips_init(struct device *dev,
chip->select_chip = tegra_nand_select_chip; chip->select_chip = tegra_nand_select_chip;
chip->setup_data_interface = tegra_nand_setup_data_interface; chip->setup_data_interface = tegra_nand_setup_data_interface;
ret = nand_scan(mtd, 1); ret = nand_scan(chip, 1);
if (ret) if (ret)
return ret; return ret;

View file

@ -436,7 +436,7 @@ static int tmio_probe(struct platform_device *dev)
nand_chip->waitfunc = tmio_nand_wait; nand_chip->waitfunc = tmio_nand_wait;
/* Scan to find existence of the device */ /* Scan to find existence of the device */
retval = nand_scan(mtd, 1); retval = nand_scan(nand_chip, 1);
if (retval) if (retval)
goto err_irq; goto err_irq;

View file

@ -359,7 +359,7 @@ static int __init txx9ndfmc_probe(struct platform_device *dev)
if (plat->wide_mask & (1 << i)) if (plat->wide_mask & (1 << i))
chip->options |= NAND_BUSWIDTH_16; chip->options |= NAND_BUSWIDTH_16;
if (nand_scan(mtd, 1)) { if (nand_scan(chip, 1)) {
kfree(txx9_priv->mtdname); kfree(txx9_priv->mtdname);
kfree(txx9_priv); kfree(txx9_priv);
continue; continue;

View file

@ -892,7 +892,7 @@ static int vf610_nfc_probe(struct platform_device *pdev)
/* Scan the NAND chip */ /* Scan the NAND chip */
chip->dummy_controller.ops = &vf610_nfc_controller_ops; chip->dummy_controller.ops = &vf610_nfc_controller_ops;
err = nand_scan(mtd, 1); err = nand_scan(chip, 1);
if (err) if (err)
goto err_disable_clk; goto err_disable_clk;

View file

@ -205,7 +205,7 @@ static int xway_nand_probe(struct platform_device *pdev)
| cs_flag, EBU_NAND_CON); | cs_flag, EBU_NAND_CON);
/* Scan to find existence of the device */ /* Scan to find existence of the device */
err = nand_scan(mtd, 1); err = nand_scan(&data->chip, 1);
if (err) if (err)
return err; return err;

View file

@ -934,7 +934,7 @@ static int spinand_probe(struct spi_device *spi_nand)
mtd_set_ooblayout(mtd, &spinand_oob_64_ops); mtd_set_ooblayout(mtd, &spinand_oob_64_ops);
#endif #endif
if (nand_scan(mtd, 1)) if (nand_scan(chip, 1))
return -ENXIO; return -ENXIO;
return mtd_device_register(mtd, NULL, 0); return mtd_device_register(mtd, NULL, 0);

View file

@ -24,15 +24,16 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/types.h> #include <linux/types.h>
struct nand_chip;
struct nand_flash_dev; struct nand_flash_dev;
/* Scan and identify a NAND device */ /* Scan and identify a NAND device */
int nand_scan_with_ids(struct mtd_info *mtd, int max_chips, int nand_scan_with_ids(struct nand_chip *chip, int max_chips,
struct nand_flash_dev *ids); struct nand_flash_dev *ids);
static inline int nand_scan(struct mtd_info *mtd, int max_chips) static inline int nand_scan(struct nand_chip *chip, int max_chips)
{ {
return nand_scan_with_ids(mtd, max_chips, NULL); return nand_scan_with_ids(chip, max_chips, NULL);
} }
/* Internal helper for board drivers which need to override command function */ /* Internal helper for board drivers which need to override command function */