* [PATCH v2] mtd: rawnand: add a way to pass an ID table with nand_scan()
@ 2018-04-22 16:02 Miquel Raynal
2018-04-26 17:33 ` Boris Brezillon
2018-04-26 19:52 ` Boris Brezillon
0 siblings, 2 replies; 3+ messages in thread
From: Miquel Raynal @ 2018-04-22 16:02 UTC (permalink / raw)
To: Boris Brezillon, Richard Weinberger, David Woodhouse,
Brian Norris, Marek Vasut
Cc: linux-mtd, Miquel Raynal
As part of the work of migrating all the drivers to nand_scan(), and
because nand_scan() does not provide a way to pass an ID table, rename
the function nand_scan_with_ids() and add a third parameter to give a
flash ID table (like what was done with nand_scan_ident()).
Create a nand_scan() helper that is just a wrapper of
nand_scan_with_ids(), passing NULL as the ID table. This way a
controller drivers can continue using nand_scan() transparently.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
Changes since v1:
=================
* Removed the ID table from nand_chip structure and created a
nand_scan_with_ids() function called by nand_scan().
* No need to apply any change to the sm_common.c driver, switching
from nand_scan() to nand_scan_with_ids() will be done in a future
series.
drivers/mtd/nand/raw/nand_base.c | 8 +++++---
include/linux/mtd/rawnand.h | 9 ++++++++-
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 72f3a89da513..15d6c6e2b77a 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -6630,19 +6630,21 @@ EXPORT_SYMBOL(nand_scan_tail);
#endif
/**
- * nand_scan - [NAND Interface] Scan for the NAND device
+ * nand_scan_with_ids - [NAND Interface] Scan for the NAND device
* @mtd: MTD device structure
* @maxchips: number of chips to scan for
+ * @ids: optional flash IDs table
*
* This fills out all the uninitialized function pointers with the defaults.
* The flash ID is read and the mtd/chip structures are filled with the
* appropriate values.
*/
-int nand_scan(struct mtd_info *mtd, int maxchips)
+int nand_scan_with_ids(struct mtd_info *mtd, int maxchips,
+ struct nand_flash_dev *ids)
{
int ret;
- ret = nand_scan_ident(mtd, maxchips, NULL);
+ ret = nand_scan_ident(mtd, maxchips, ids);
if (!ret)
ret = nand_scan_tail(mtd);
return ret;
diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
index 5dad59b31244..ba8d908f5cc7 100644
--- a/include/linux/mtd/rawnand.h
+++ b/include/linux/mtd/rawnand.h
@@ -28,7 +28,14 @@ struct nand_flash_dev;
struct device_node;
/* Scan and identify a NAND device */
-int nand_scan(struct mtd_info *mtd, int max_chips);
+int nand_scan_with_ids(struct mtd_info *mtd, int max_chips,
+ struct nand_flash_dev *ids);
+
+static inline int nand_scan(struct mtd_info *mtd, int max_chips)
+{
+ return nand_scan_with_ids(mtd, max_chips, NULL);
+}
+
/*
* Separate phases of nand_scan(), allowing board driver to intervene
* and override command or ECC setup according to flash type.
--
2.14.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] mtd: rawnand: add a way to pass an ID table with nand_scan()
2018-04-22 16:02 [PATCH v2] mtd: rawnand: add a way to pass an ID table with nand_scan() Miquel Raynal
@ 2018-04-26 17:33 ` Boris Brezillon
2018-04-26 19:52 ` Boris Brezillon
1 sibling, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2018-04-26 17:33 UTC (permalink / raw)
To: Miquel Raynal
Cc: Richard Weinberger, David Woodhouse, Brian Norris, Marek Vasut,
linux-mtd
On Sun, 22 Apr 2018 18:02:30 +0200
Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> As part of the work of migrating all the drivers to nand_scan(), and
> because nand_scan() does not provide a way to pass an ID table, rename
> the function nand_scan_with_ids() and add a third parameter to give a
> flash ID table (like what was done with nand_scan_ident()).
>
> Create a nand_scan() helper that is just a wrapper of
> nand_scan_with_ids(), passing NULL as the ID table. This way a
> controller drivers can continue using nand_scan() transparently.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>
> Changes since v1:
> =================
> * Removed the ID table from nand_chip structure and created a
> nand_scan_with_ids() function called by nand_scan().
> * No need to apply any change to the sm_common.c driver, switching
> from nand_scan() to nand_scan_with_ids() will be done in a future
> series.
>
>
> drivers/mtd/nand/raw/nand_base.c | 8 +++++---
> include/linux/mtd/rawnand.h | 9 ++++++++-
> 2 files changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> index 72f3a89da513..15d6c6e2b77a 100644
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -6630,19 +6630,21 @@ EXPORT_SYMBOL(nand_scan_tail);
> #endif
>
> /**
> - * nand_scan - [NAND Interface] Scan for the NAND device
> + * nand_scan_with_ids - [NAND Interface] Scan for the NAND device
> * @mtd: MTD device structure
> * @maxchips: number of chips to scan for
> + * @ids: optional flash IDs table
> *
> * This fills out all the uninitialized function pointers with the defaults.
> * The flash ID is read and the mtd/chip structures are filled with the
> * appropriate values.
> */
> -int nand_scan(struct mtd_info *mtd, int maxchips)
> +int nand_scan_with_ids(struct mtd_info *mtd, int maxchips,
> + struct nand_flash_dev *ids)
> {
> int ret;
>
> - ret = nand_scan_ident(mtd, maxchips, NULL);
> + ret = nand_scan_ident(mtd, maxchips, ids);
> if (!ret)
> ret = nand_scan_tail(mtd);
> return ret;
You forgot to change the name of the exported symbol. No need to send a
new version, I'll fix it when applying.
> diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
> index 5dad59b31244..ba8d908f5cc7 100644
> --- a/include/linux/mtd/rawnand.h
> +++ b/include/linux/mtd/rawnand.h
> @@ -28,7 +28,14 @@ struct nand_flash_dev;
> struct device_node;
>
> /* Scan and identify a NAND device */
> -int nand_scan(struct mtd_info *mtd, int max_chips);
> +int nand_scan_with_ids(struct mtd_info *mtd, int max_chips,
> + struct nand_flash_dev *ids);
> +
> +static inline int nand_scan(struct mtd_info *mtd, int max_chips)
> +{
> + return nand_scan_with_ids(mtd, max_chips, NULL);
> +}
> +
> /*
> * Separate phases of nand_scan(), allowing board driver to intervene
> * and override command or ECC setup according to flash type.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] mtd: rawnand: add a way to pass an ID table with nand_scan()
2018-04-22 16:02 [PATCH v2] mtd: rawnand: add a way to pass an ID table with nand_scan() Miquel Raynal
2018-04-26 17:33 ` Boris Brezillon
@ 2018-04-26 19:52 ` Boris Brezillon
1 sibling, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2018-04-26 19:52 UTC (permalink / raw)
To: Miquel Raynal
Cc: Richard Weinberger, David Woodhouse, Brian Norris, Marek Vasut,
linux-mtd
On Sun, 22 Apr 2018 18:02:30 +0200
Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> As part of the work of migrating all the drivers to nand_scan(), and
> because nand_scan() does not provide a way to pass an ID table, rename
> the function nand_scan_with_ids() and add a third parameter to give a
> flash ID table (like what was done with nand_scan_ident()).
>
> Create a nand_scan() helper that is just a wrapper of
> nand_scan_with_ids(), passing NULL as the ID table. This way a
> controller drivers can continue using nand_scan() transparently.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Applied.
Thanks,
Boris
> ---
>
> Changes since v1:
> =================
> * Removed the ID table from nand_chip structure and created a
> nand_scan_with_ids() function called by nand_scan().
> * No need to apply any change to the sm_common.c driver, switching
> from nand_scan() to nand_scan_with_ids() will be done in a future
> series.
>
>
> drivers/mtd/nand/raw/nand_base.c | 8 +++++---
> include/linux/mtd/rawnand.h | 9 ++++++++-
> 2 files changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> index 72f3a89da513..15d6c6e2b77a 100644
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -6630,19 +6630,21 @@ EXPORT_SYMBOL(nand_scan_tail);
> #endif
>
> /**
> - * nand_scan - [NAND Interface] Scan for the NAND device
> + * nand_scan_with_ids - [NAND Interface] Scan for the NAND device
> * @mtd: MTD device structure
> * @maxchips: number of chips to scan for
> + * @ids: optional flash IDs table
> *
> * This fills out all the uninitialized function pointers with the defaults.
> * The flash ID is read and the mtd/chip structures are filled with the
> * appropriate values.
> */
> -int nand_scan(struct mtd_info *mtd, int maxchips)
> +int nand_scan_with_ids(struct mtd_info *mtd, int maxchips,
> + struct nand_flash_dev *ids)
> {
> int ret;
>
> - ret = nand_scan_ident(mtd, maxchips, NULL);
> + ret = nand_scan_ident(mtd, maxchips, ids);
> if (!ret)
> ret = nand_scan_tail(mtd);
> return ret;
> diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
> index 5dad59b31244..ba8d908f5cc7 100644
> --- a/include/linux/mtd/rawnand.h
> +++ b/include/linux/mtd/rawnand.h
> @@ -28,7 +28,14 @@ struct nand_flash_dev;
> struct device_node;
>
> /* Scan and identify a NAND device */
> -int nand_scan(struct mtd_info *mtd, int max_chips);
> +int nand_scan_with_ids(struct mtd_info *mtd, int max_chips,
> + struct nand_flash_dev *ids);
> +
> +static inline int nand_scan(struct mtd_info *mtd, int max_chips)
> +{
> + return nand_scan_with_ids(mtd, max_chips, NULL);
> +}
> +
> /*
> * Separate phases of nand_scan(), allowing board driver to intervene
> * and override command or ECC setup according to flash type.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-26 19:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-22 16:02 [PATCH v2] mtd: rawnand: add a way to pass an ID table with nand_scan() Miquel Raynal
2018-04-26 17:33 ` Boris Brezillon
2018-04-26 19:52 ` Boris Brezillon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox