Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a61ae81a authored by Brian Norris's avatar Brian Norris
Browse files

mtd: nand: drop unnecessary partition parser data



All of these drivers set up a parser data struct just to communicate DT
partition data. This field has been deprecated and is instead supported
by telling nand_scan_ident() about the 'flash_node'.

This patch:
 * sets chip->flash_node for those drivers that didn't already (but used
   OF partitioning)
 * drops the parser data
 * switches to the simpler mtd_device_register() where possible, now
   that we've eliminated one of the auxiliary parameters

Now that we've assigned chip->flash_node for these drivers, we can
probably rely on nand_dt_init() to do more of the DT parsing for us, but
for now, I don't want to fiddle with each of these drivers. The parsing
is done in duplicate for now on some drivers. I don't think this should
break things. (Famous last words.)

(Rolled in some changes by Boris Brezillon)

Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
Reviewed-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
parent 9c7d7875
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -2093,7 +2093,6 @@ static int atmel_nand_probe(struct platform_device *pdev)
	struct mtd_info *mtd;
	struct nand_chip *nand_chip;
	struct resource *mem;
	struct mtd_part_parser_data ppdata = {};
	int res, irq;

	/* Allocate memory for the device structure (and zero it) */
@@ -2117,6 +2116,7 @@ static int atmel_nand_probe(struct platform_device *pdev)
	nand_chip = &host->nand_chip;
	host->dev = &pdev->dev;
	if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) {
		nand_set_flash_node(nand_chip, pdev->dev.of_node);
		/* Only when CONFIG_OF is enabled of_node can be parsed */
		res = atmel_of_init_port(host, pdev->dev.of_node);
		if (res)
@@ -2259,9 +2259,8 @@ static int atmel_nand_probe(struct platform_device *pdev)
	}

	mtd->name = "atmel_nand";
	ppdata.of_node = pdev->dev.of_node;
	res = mtd_device_parse_register(mtd, NULL, &ppdata,
			host->board.parts, host->board.num_parts);
	res = mtd_device_register(mtd, host->board.parts,
				  host->board.num_parts);
	if (!res)
		return res;

+1 −2
Original line number Diff line number Diff line
@@ -1914,7 +1914,6 @@ static int brcmnand_init_cs(struct brcmnand_host *host)
	struct nand_chip *chip;
	int ret;
	u16 cfg_offs;
	struct mtd_part_parser_data ppdata = { .of_node = dn };

	ret = of_property_read_u32(dn, "reg", &host->cs);
	if (ret) {
@@ -1993,7 +1992,7 @@ static int brcmnand_init_cs(struct brcmnand_host *host)
	if (nand_scan_tail(mtd))
		return -ENXIO;

	return mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0);
	return mtd_device_register(mtd, NULL, 0);
}

static void brcmnand_save_restore_cs_config(struct brcmnand_host *host,
+3 −7
Original line number Diff line number Diff line
@@ -684,6 +684,7 @@ static int nand_davinci_probe(struct platform_device *pdev)

	info->mtd.priv		= &info->chip;
	info->mtd.dev.parent	= &pdev->dev;
	nand_set_flash_node(&info->chip, pdev->dev.of_node);

	info->chip.IO_ADDR_R	= vaddr;
	info->chip.IO_ADDR_W	= vaddr;
@@ -839,13 +840,8 @@ static int nand_davinci_probe(struct platform_device *pdev)
	if (pdata->parts)
		ret = mtd_device_parse_register(&info->mtd, NULL, NULL,
					pdata->parts, pdata->nr_parts);
	else {
		struct mtd_part_parser_data	ppdata;

		ppdata.of_node = pdev->dev.of_node;
		ret = mtd_device_parse_register(&info->mtd, NULL, &ppdata,
						NULL, 0);
	}
	else
		ret = mtd_device_register(&info->mtd, NULL, 0);
	if (ret < 0)
		goto err;

+2 −3
Original line number Diff line number Diff line
@@ -748,6 +748,7 @@ static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv)
	/* Fill in fsl_elbc_mtd structure */
	priv->mtd.priv = chip;
	priv->mtd.dev.parent = priv->dev;
	nand_set_flash_node(chip, priv->dev->of_node);

	/* set timeout to maximum */
	priv->fmr = 15 << FMR_CWTO_SHIFT;
@@ -823,9 +824,7 @@ static int fsl_elbc_nand_probe(struct platform_device *pdev)
	int bank;
	struct device *dev;
	struct device_node *node = pdev->dev.of_node;
	struct mtd_part_parser_data ppdata;

	ppdata.of_node = pdev->dev.of_node;
	if (!fsl_lbc_ctrl_dev || !fsl_lbc_ctrl_dev->regs)
		return -ENODEV;
	lbc = fsl_lbc_ctrl_dev->regs;
@@ -911,7 +910,7 @@ static int fsl_elbc_nand_probe(struct platform_device *pdev)

	/* First look for RedBoot table or partitions on the command
	 * line, these take precedence over device tree information */
	mtd_device_parse_register(&priv->mtd, part_probe_types, &ppdata,
	mtd_device_parse_register(&priv->mtd, part_probe_types, NULL,
				  NULL, 0);

	printk(KERN_INFO "eLBC NAND device at 0x%llx, bank %d\n",
+2 −3
Original line number Diff line number Diff line
@@ -883,6 +883,7 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv)
	/* Fill in fsl_ifc_mtd structure */
	priv->mtd.priv = chip;
	priv->mtd.dev.parent = priv->dev;
	nand_set_flash_node(chip, priv->dev->of_node);

	/* fill in nand_chip structure */
	/* set up function call table */
@@ -1030,9 +1031,7 @@ static int fsl_ifc_nand_probe(struct platform_device *dev)
	int ret;
	int bank;
	struct device_node *node = dev->dev.of_node;
	struct mtd_part_parser_data ppdata;

	ppdata.of_node = dev->dev.of_node;
	if (!fsl_ifc_ctrl_dev || !fsl_ifc_ctrl_dev->regs)
		return -ENODEV;
	ifc = fsl_ifc_ctrl_dev->regs;
@@ -1128,7 +1127,7 @@ static int fsl_ifc_nand_probe(struct platform_device *dev)

	/* First look for RedBoot table or partitions on the command
	 * line, these take precedence over device tree information */
	mtd_device_parse_register(&priv->mtd, part_probe_types, &ppdata,
	mtd_device_parse_register(&priv->mtd, part_probe_types, NULL,
						NULL, 0);

	dev_info(priv->dev, "IFC NAND device at 0x%llx, bank %d\n",
Loading