All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mtd: rawnand: mxc: Remove platform data support
@ 2020-11-10 12:19 Fabio Estevam
  2020-11-11  9:37 ` Sascha Hauer
  2020-11-19 21:07 ` Miquel Raynal
  0 siblings, 2 replies; 3+ messages in thread
From: Fabio Estevam @ 2020-11-10 12:19 UTC (permalink / raw)
  To: miquel.raynal; +Cc: Fabio Estevam, linux-mtd, kernel

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.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
Changes since v1:
- Remove more unused structures and inline mxcnd_probe_dt() - Sascha

 drivers/mtd/nand/raw/Kconfig               |  2 +-
 drivers/mtd/nand/raw/mxc_nand.c            | 75 ++--------------------
 include/linux/platform_data/mtd-mxc_nand.h | 19 ------
 3 files changed, 5 insertions(+), 91 deletions(-)
 delete mode 100644 include/linux/platform_data/mtd-mxc_nand.h

diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
index cc86d6e4e042..b93e6cd23259 100644
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -292,7 +292,7 @@ config MTD_NAND_VF610_NFC
 config MTD_NAND_MXC
 	tristate "Freescale MXC NAND controller"
 	depends on ARCH_MXC || COMPILE_TEST
-	depends on HAS_IOMEM
+	depends on HAS_IOMEM && OF
 	help
 	  This enables the driver for the NAND flash controller on the
 	  MXC processors.
diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c
index 684c51e5e60d..f896364968d8 100644
--- a/drivers/mtd/nand/raw/mxc_nand.c
+++ b/drivers/mtd/nand/raw/mxc_nand.c
@@ -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[] = {
@@ -1611,29 +1609,6 @@ static inline int is_imx53_nfc(struct mxc_nand_host *host)
 	return host->devtype_data == &imx53_nand_devtype_data;
 }
 
-static const struct platform_device_id mxcnd_devtype[] = {
-	{
-		.name = "imx21-nand",
-		.driver_data = (kernel_ulong_t) &imx21_nand_devtype_data,
-	}, {
-		.name = "imx27-nand",
-		.driver_data = (kernel_ulong_t) &imx27_nand_devtype_data,
-	}, {
-		.name = "imx25-nand",
-		.driver_data = (kernel_ulong_t) &imx25_nand_devtype_data,
-	}, {
-		.name = "imx51-nand",
-		.driver_data = (kernel_ulong_t) &imx51_nand_devtype_data,
-	}, {
-		.name = "imx53-nand",
-		.driver_data = (kernel_ulong_t) &imx53_nand_devtype_data,
-	}, {
-		/* sentinel */
-	}
-};
-MODULE_DEVICE_TABLE(platform, mxcnd_devtype);
-
-#ifdef CONFIG_OF
 static const struct of_device_id mxcnd_dt_ids[] = {
 	{
 		.compatible = "fsl,imx21-nand",
@@ -1655,26 +1630,6 @@ static const struct of_device_id mxcnd_dt_ids[] = {
 };
 MODULE_DEVICE_TABLE(of, mxcnd_dt_ids);
 
-static int mxcnd_probe_dt(struct mxc_nand_host *host)
-{
-	struct device_node *np = host->dev->of_node;
-	const struct of_device_id *of_id =
-		of_match_device(mxcnd_dt_ids, host->dev);
-
-	if (!np)
-		return 1;
-
-	host->devtype_data = of_id->data;
-
-	return 0;
-}
-#else
-static int mxcnd_probe_dt(struct mxc_nand_host *host)
-{
-	return 1;
-}
-#endif
-
 static int mxcnd_attach_chip(struct nand_chip *chip)
 {
 	struct mtd_info *mtd = nand_to_mtd(chip);
@@ -1759,6 +1714,7 @@ static const struct nand_controller_ops mxcnd_controller_ops = {
 
 static int mxcnd_probe(struct platform_device *pdev)
 {
+	const struct of_device_id *of_id;
 	struct nand_chip *this;
 	struct mtd_info *mtd;
 	struct mxc_nand_host *host;
@@ -1800,20 +1756,8 @@ static int mxcnd_probe(struct platform_device *pdev)
 	if (IS_ERR(host->clk))
 		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;
+	of_id = of_match_device(mxcnd_dt_ids, host->dev);
+	host->devtype_data = of_id->data;
 
 	if (!host->devtype_data->setup_interface)
 		this->options |= NAND_KEEP_TIMINGS;
@@ -1843,14 +1787,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 +1827,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;
 
@@ -1930,7 +1864,6 @@ static struct platform_driver mxcnd_driver = {
 		   .name = DRIVER_NAME,
 		   .of_match_table = of_match_ptr(mxcnd_dt_ids),
 	},
-	.id_table = mxcnd_devtype,
 	.probe = mxcnd_probe,
 	.remove = mxcnd_remove,
 };
diff --git a/include/linux/platform_data/mtd-mxc_nand.h b/include/linux/platform_data/mtd-mxc_nand.h
deleted file mode 100644
index d1230030c6db..000000000000
--- a/include/linux/platform_data/mtd-mxc_nand.h
+++ /dev/null
@@ -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, kernel@pengutronix.de
- */
-
-#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 */
-- 
2.17.1


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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mtd: rawnand: mxc: Remove platform data support
  2020-11-10 12:19 [PATCH v2] mtd: rawnand: mxc: Remove platform data support Fabio Estevam
@ 2020-11-11  9:37 ` Sascha Hauer
  2020-11-19 21:07 ` Miquel Raynal
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2020-11-11  9:37 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: linux-mtd, kernel, miquel.raynal

On Tue, Nov 10, 2020 at 09:19:08AM -0300, Fabio Estevam wrote:
> 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.
> 
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> ---
> Changes since v1:
> - Remove more unused structures and inline mxcnd_probe_dt() - Sascha

Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>

Sascha

> 
>  drivers/mtd/nand/raw/Kconfig               |  2 +-
>  drivers/mtd/nand/raw/mxc_nand.c            | 75 ++--------------------
>  include/linux/platform_data/mtd-mxc_nand.h | 19 ------
>  3 files changed, 5 insertions(+), 91 deletions(-)
>  delete mode 100644 include/linux/platform_data/mtd-mxc_nand.h
> 
> diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig
> index cc86d6e4e042..b93e6cd23259 100644
> --- a/drivers/mtd/nand/raw/Kconfig
> +++ b/drivers/mtd/nand/raw/Kconfig
> @@ -292,7 +292,7 @@ config MTD_NAND_VF610_NFC
>  config MTD_NAND_MXC
>  	tristate "Freescale MXC NAND controller"
>  	depends on ARCH_MXC || COMPILE_TEST
> -	depends on HAS_IOMEM
> +	depends on HAS_IOMEM && OF
>  	help
>  	  This enables the driver for the NAND flash controller on the
>  	  MXC processors.
> diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c
> index 684c51e5e60d..f896364968d8 100644
> --- a/drivers/mtd/nand/raw/mxc_nand.c
> +++ b/drivers/mtd/nand/raw/mxc_nand.c
> @@ -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[] = {
> @@ -1611,29 +1609,6 @@ static inline int is_imx53_nfc(struct mxc_nand_host *host)
>  	return host->devtype_data == &imx53_nand_devtype_data;
>  }
>  
> -static const struct platform_device_id mxcnd_devtype[] = {
> -	{
> -		.name = "imx21-nand",
> -		.driver_data = (kernel_ulong_t) &imx21_nand_devtype_data,
> -	}, {
> -		.name = "imx27-nand",
> -		.driver_data = (kernel_ulong_t) &imx27_nand_devtype_data,
> -	}, {
> -		.name = "imx25-nand",
> -		.driver_data = (kernel_ulong_t) &imx25_nand_devtype_data,
> -	}, {
> -		.name = "imx51-nand",
> -		.driver_data = (kernel_ulong_t) &imx51_nand_devtype_data,
> -	}, {
> -		.name = "imx53-nand",
> -		.driver_data = (kernel_ulong_t) &imx53_nand_devtype_data,
> -	}, {
> -		/* sentinel */
> -	}
> -};
> -MODULE_DEVICE_TABLE(platform, mxcnd_devtype);
> -
> -#ifdef CONFIG_OF
>  static const struct of_device_id mxcnd_dt_ids[] = {
>  	{
>  		.compatible = "fsl,imx21-nand",
> @@ -1655,26 +1630,6 @@ static const struct of_device_id mxcnd_dt_ids[] = {
>  };
>  MODULE_DEVICE_TABLE(of, mxcnd_dt_ids);
>  
> -static int mxcnd_probe_dt(struct mxc_nand_host *host)
> -{
> -	struct device_node *np = host->dev->of_node;
> -	const struct of_device_id *of_id =
> -		of_match_device(mxcnd_dt_ids, host->dev);
> -
> -	if (!np)
> -		return 1;
> -
> -	host->devtype_data = of_id->data;
> -
> -	return 0;
> -}
> -#else
> -static int mxcnd_probe_dt(struct mxc_nand_host *host)
> -{
> -	return 1;
> -}
> -#endif
> -
>  static int mxcnd_attach_chip(struct nand_chip *chip)
>  {
>  	struct mtd_info *mtd = nand_to_mtd(chip);
> @@ -1759,6 +1714,7 @@ static const struct nand_controller_ops mxcnd_controller_ops = {
>  
>  static int mxcnd_probe(struct platform_device *pdev)
>  {
> +	const struct of_device_id *of_id;
>  	struct nand_chip *this;
>  	struct mtd_info *mtd;
>  	struct mxc_nand_host *host;
> @@ -1800,20 +1756,8 @@ static int mxcnd_probe(struct platform_device *pdev)
>  	if (IS_ERR(host->clk))
>  		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;
> +	of_id = of_match_device(mxcnd_dt_ids, host->dev);
> +	host->devtype_data = of_id->data;
>  
>  	if (!host->devtype_data->setup_interface)
>  		this->options |= NAND_KEEP_TIMINGS;
> @@ -1843,14 +1787,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 +1827,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;
>  
> @@ -1930,7 +1864,6 @@ static struct platform_driver mxcnd_driver = {
>  		   .name = DRIVER_NAME,
>  		   .of_match_table = of_match_ptr(mxcnd_dt_ids),
>  	},
> -	.id_table = mxcnd_devtype,
>  	.probe = mxcnd_probe,
>  	.remove = mxcnd_remove,
>  };
> diff --git a/include/linux/platform_data/mtd-mxc_nand.h b/include/linux/platform_data/mtd-mxc_nand.h
> deleted file mode 100644
> index d1230030c6db..000000000000
> --- a/include/linux/platform_data/mtd-mxc_nand.h
> +++ /dev/null
> @@ -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, kernel@pengutronix.de
> - */
> -
> -#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 */
> -- 
> 2.17.1
> 
> 
> 

-- 
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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mtd: rawnand: mxc: Remove platform data support
  2020-11-10 12:19 [PATCH v2] mtd: rawnand: mxc: Remove platform data support Fabio Estevam
  2020-11-11  9:37 ` Sascha Hauer
@ 2020-11-19 21:07 ` Miquel Raynal
  1 sibling, 0 replies; 3+ messages in thread
From: Miquel Raynal @ 2020-11-19 21:07 UTC (permalink / raw)
  To: Fabio Estevam, miquel.raynal; +Cc: linux-mtd, kernel

On Tue, 2020-11-10 at 12:19:08 UTC, Fabio Estevam wrote:
> 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.
> 
> Signed-off-by: Fabio Estevam <festevam@gmail.com>
> Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-19 21:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 12:19 [PATCH v2] mtd: rawnand: mxc: Remove platform data support Fabio Estevam
2020-11-11  9:37 ` Sascha Hauer
2020-11-19 21:07 ` Miquel Raynal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.