Skip to contentSkip to conversation

mtd: rawnand: mxc: Remove platform data support

PATCH Superseded Fabio Estevam 2 participants 3 messages Nov 10, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/1 mtd: rawnand: mxc: Remove platform data support

i.MX is a devicetree-only platform now and the existing platform data support in this driver was only useful for old non-devicetree platforms.

Get rid of the platform data support since it is no longer used.

---
 drivers/mtd/nand/raw/mxc_nand.c            | 25 +---------------------
 include/linux/platform_data/mtd-mxc_nand.h | 19 ----------------
 2 files changed, 1 insertion(+), 43 deletions(-)
 delete mode 100644 include/linux/platform_data/mtd-mxc_nand.h
drivers/mtd/nand/raw/mxc_nand.c +1 -24
index 684c51e5e60d..e38c84e1c76d 100644
@@ -21,7 +21,6 @@
 #include <linux/completion.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
-#include <linux/platform_data/mtd-mxc_nand.h>
 
 #define DRIVER_NAME "mxc_nand"
 
@@ -184,7 +183,6 @@ struct mxc_nand_host {
 	unsigned int		buf_start;
 
 	const struct mxc_nand_devtype_data *devtype_data;
-	struct mxc_nand_platform_data pdata;
 };
 
 static const char * const part_probes[] = {
@@ -1801,17 +1799,6 @@ static int mxcnd_probe(struct platform_device *pdev)
 		return PTR_ERR(host->clk);
 
 	err = mxcnd_probe_dt(host);
-	if (err > 0) {
-		struct mxc_nand_platform_data *pdata =
-					dev_get_platdata(&pdev->dev);
-		if (pdata) {
-			host->pdata = *pdata;
-			host->devtype_data = (struct mxc_nand_devtype_data *)
-						pdev->id_entry->driver_data;
-		} else {
-			err = -ENODEV;
-		}
-	}
 	if (err < 0)
 		return err;
 
@@ -1843,14 +1830,6 @@ static int mxcnd_probe(struct platform_device *pdev)
 
 	this->legacy.select_chip = host->devtype_data->select_chip;
 
-	/* NAND bus width determines access functions used by upper layer */
-	if (host->pdata.width == 2)
-		this->options |= NAND_BUSWIDTH_16;
-
-	/* update flash based bbt */
-	if (host->pdata.flash_bbt)
-		this->bbt_options |= NAND_BBT_USE_FLASH;
-
 	init_completion(&host->op_completion);
 
 	host->irq = platform_get_irq(pdev, 0);
@@ -1891,9 +1870,7 @@ static int mxcnd_probe(struct platform_device *pdev)
 		goto escan;
 
 	/* Register the partitions */
-	err = mtd_device_parse_register(mtd, part_probes, NULL,
-					host->pdata.parts,
-					host->pdata.nr_parts);
+	err = mtd_device_parse_register(mtd, part_probes, NULL, NULL, 0);
 	if (err)
 		goto cleanup_nand;
 
include/linux/platform_data/mtd-mxc_nand.h deleted +0 -19
deleted file mode 100644
index d1230030c6db..000000000000
@@ -1,19 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
- * Copyright 2008 Sascha Hauer, [email protected]
- */
-
-#ifndef __ASM_ARCH_NAND_H
-#define __ASM_ARCH_NAND_H
-
-#include <linux/mtd/partitions.h>
-
-struct mxc_nand_platform_data {
-	unsigned int width;	/* data bus width in bytes */
-	unsigned int hw_ecc:1;	/* 0 if suppress hardware ECC */
-	unsigned int flash_bbt:1; /* set to 1 to use a flash based bbt */
-	struct mtd_partition *parts;	/* partition table */
-	int nr_parts;			/* size of parts */
-};
-#endif /* __ASM_ARCH_NAND_H */
Signature · 6 lines
2.17.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
maintainer
#1 lore raw

Hi Fabio,

Quoted 4 lines · Fabio Estevam

i.MX is a devicetree-only platform now and the existing platform data support in this driver was only useful for old non-devicetree platforms.

Get rid of the platform data support since it is no longer used.

What about

static const struct platform_device_id mxcnd_devtype[] = {
	...
};

This is unused now as well.

Also the #ifdef CONFIG_OF seem unnecessary now when it's the only way to probe this driver.

Quoted 35 lines
---
 drivers/mtd/nand/raw/mxc_nand.c            | 25 +---------------------
 include/linux/platform_data/mtd-mxc_nand.h | 19 ----------------
 2 files changed, 1 insertion(+), 43 deletions(-)
 delete mode 100644 include/linux/platform_data/mtd-mxc_nand.h
drivers/mtd/nand/raw/mxc_nand.c +0 -5
index 684c51e5e60d..e38c84e1c76d 100644
@@ -21,7 +21,6 @@
 #include <linux/completion.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
-#include <linux/platform_data/mtd-mxc_nand.h>
 
 #define DRIVER_NAME "mxc_nand"
 
@@ -184,7 +183,6 @@ struct mxc_nand_host {
 	unsigned int		buf_start;
 
 	const struct mxc_nand_devtype_data *devtype_data;
-	struct mxc_nand_platform_data pdata;
 };
 
 static const char * const part_probes[] = {
@@ -1801,17 +1799,6 @@ static int mxcnd_probe(struct platform_device *pdev)
 		return PTR_ERR(host->clk);
 
 	err = mxcnd_probe_dt(host);
-	if (err > 0) {
-		struct mxc_nand_platform_data *pdata =
-					dev_get_platdata(&pdev->dev);

drivers/mtd/nand/raw/mxc_nand.c static int mxcnd_probe(struct platform_device *pdev) · line 1803

Quoted 10 lines
drivers/mtd/nand/raw/mxc_nand.c +0 -8
-		if (pdata) {
-			host->pdata = *pdata;
-			host->devtype_data = (struct mxc_nand_devtype_data *)
-						pdev->id_entry->driver_data;
-		} else {
-			err = -ENODEV;
-		}
-	}
 	if (err < 0)
 		return err;

mxcnd_probe_dt() can still return values > 0 in which case you should return an error from probe. I think this code path should be cleaned up a bit. Maybe you can inline mxcnd_probe_dt() here.

Sascha

Signature · 8 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
author reviewer
#2 lore raw

Hi Sascha,

Quoted 3 lines · Sascha Hauer

mxcnd_probe_dt() can still return values > 0 in which case you should return an error from probe. I think this code path should be cleaned up a bit. Maybe you can inline mxcnd_probe_dt() here.

Thanks for your review. I have addressed your comments and sent a v2.

Thanks

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/