linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: computersforpeace@gmail.com (Brian Norris)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv4 4/5] of/mtd/nand: add generic binding and helper for NAND_BBT_NO_OOB_BBM
Date: Wed, 23 Jul 2014 19:06:27 -0700	[thread overview]
Message-ID: <20140724020627.GD3711@ld-irv-0074> (raw)
In-Reply-To: <1402579245-13377-5-git-send-email-LW@KARO-electronics.de>

(BTW, that's a mighty CC list you have! I'm not sure all CC'd parties
are interested in this series; e.g., Russel and the ARM list seem
unrelated)

Hi Lothar,

Sorry for the delay on this. I get busy enough that I can't/don't reply
to everything quickly...

On Thu, Jun 12, 2014 at 03:20:44PM +0200, Lothar Wa?mann wrote:
> add a boolean property 'nand-no-oob-bbm' and helper function to be
> able to set the NAND_BBT_NO_OOB_BBM flag in DT capable NAND drivers
> and use it for i.MX and MXS nand drivers.

If I'm understanding your previous conversations with Huang correctly,
you *must* use NAND_BBT_NO_OOB_BBM if you're going to use the
fsl,no-blockmark-swap option. Correct? If so, then you might not need
a separate 'nand-no-oob-bbm' binding; your driver should imply from
'fsl,no-blockmark-swap' that it must also enable NAND_BBT_NO_OOB_BBM.

Also, as I noted in [1], I don't really like exposing a ton of
individual boolean DT properties like this. (At least this property is
orthogonal to the bad block table; I was a little off-base in [1].)

Brian

[1] http://lists.infradead.org/pipermail/linux-mtd/2014-July/054764.html

> Signed-off-by: Lothar Wa?mann <LW@KARO-electronics.de>
> ---
>  Documentation/devicetree/bindings/mtd/nand.txt |    1 +
>  drivers/mtd/nand/gpmi-nand/gpmi-nand.c         |    3 +++
>  drivers/mtd/nand/mxc_nand.c                    |    2 ++
>  drivers/of/of_mtd.c                            |   12 ++++++++++++
>  include/linux/of_mtd.h                         |    6 ++++++
>  5 files changed, 24 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/mtd/nand.txt b/Documentation/devicetree/bindings/mtd/nand.txt
> index b53f92e..e46bfbe 100644
> --- a/Documentation/devicetree/bindings/mtd/nand.txt
> +++ b/Documentation/devicetree/bindings/mtd/nand.txt
> @@ -5,6 +5,7 @@
>    "soft_bch".
>  - nand-bus-width : 8 or 16 bus width if not present 8
>  - nand-on-flash-bbt: boolean to enable on flash bbt option if not present false
> +- nand-no-oob-bbm: boolean to disable writing bad block markers to flash
>  
>  - nand-ecc-strength: integer representing the number of bits to correct
>  		     per ECC step.
> diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> index 959cb9b..37537b4 100644
> --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> @@ -1724,6 +1724,9 @@ static int gpmi_nand_init(struct gpmi_nand_data *this)
>  	if (of_get_nand_on_flash_bbt(this->dev->of_node)) {
>  		chip->bbt_options |= NAND_BBT_USE_FLASH | NAND_BBT_NO_OOB;
>  
> +		if (of_get_nand_no_oob_bbm(this->dev->of_node))
> +			chip->bbt_options |= NAND_BBT_NO_OOB_BBM;
> +
>  		if (of_property_read_bool(this->dev->of_node,
>  						"fsl,no-blockmark-swap"))
>  			this->swap_block_mark = false;
> diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
> index dba262b..bb54a2a 100644
> --- a/drivers/mtd/nand/mxc_nand.c
> +++ b/drivers/mtd/nand/mxc_nand.c
> @@ -1496,6 +1496,8 @@ static int mxcnd_probe(struct platform_device *pdev)
>  		this->bbt_md = &bbt_mirror_descr;
>  		/* update flash based bbt */
>  		this->bbt_options |= NAND_BBT_USE_FLASH;
> +		if (of_get_nand_no_oob_bbm(pdev->dev.of_node))
> +			this->bbt_options |= NAND_BBT_NO_OOB_BBM;
>  	}
>  
>  	init_completion(&host->op_completion);
> diff --git a/drivers/of/of_mtd.c b/drivers/of/of_mtd.c
> index b7361ed..d947acc 100644
> --- a/drivers/of/of_mtd.c
> +++ b/drivers/of/of_mtd.c
> @@ -117,3 +117,15 @@ bool of_get_nand_on_flash_bbt(struct device_node *np)
>  	return of_property_read_bool(np, "nand-on-flash-bbt");
>  }
>  EXPORT_SYMBOL_GPL(of_get_nand_on_flash_bbt);
> +
> +/**
> + * of_get_nand_no_oob_bbm - Get nand no oob bbm for given device_node
> + * @np:	Pointer to the given device_node
> + *
> + * return true if present, false otherwise
> + */
> +bool of_get_nand_no_oob_bbm(struct device_node *np)
> +{
> +	return of_property_read_bool(np, "nand-no-oob-bbm");
> +}
> +EXPORT_SYMBOL_GPL(of_get_nand_no_oob_bbm);
> diff --git a/include/linux/of_mtd.h b/include/linux/of_mtd.h
> index e266caa..6ece1a9 100644
> --- a/include/linux/of_mtd.h
> +++ b/include/linux/of_mtd.h
> @@ -17,6 +17,7 @@ int of_get_nand_ecc_step_size(struct device_node *np);
>  int of_get_nand_ecc_strength(struct device_node *np);
>  int of_get_nand_bus_width(struct device_node *np);
>  bool of_get_nand_on_flash_bbt(struct device_node *np);
> +bool of_get_nand_no_oob_bbm(struct device_node *np);
>  
>  #else /* CONFIG_OF_MTD */
>  
> @@ -45,6 +46,11 @@ static inline bool of_get_nand_on_flash_bbt(struct device_node *np)
>  	return false;
>  }
>  
> +static inline bool of_get_nand_no_oob_bbm(struct device_node *np)
> +{
> +	return false;
> +}
> +
>  #endif /* CONFIG_OF_MTD */
>  
>  #endif /* __LINUX_OF_MTD_H */

  parent reply	other threads:[~2014-07-24  2:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-12 13:20 [PATCHv4 0/5] mtd: gpmi: make blockmark swapping optional Lothar Waßmann
2014-06-12 13:20 ` [PATCHv4 1/5] mtd: gpmi: remove useless (void *) type casts and spaces between type casts and variables Lothar Waßmann
2014-06-12 13:20   ` [PATCHv4 2/5] mtd: gpmi: remove line breaks from error messages and improve wording Lothar Waßmann
2014-06-12 13:20     ` [PATCHv4 3/5] mtd: gpmi: make blockmark swapping optional Lothar Waßmann
2014-06-12 13:20       ` [PATCHv4 4/5] of/mtd/nand: add generic binding and helper for NAND_BBT_NO_OOB_BBM Lothar Waßmann
2014-06-12 13:20         ` [PATCHv4 5/5] mtd: gpmi: prevent creating a new BBT when blockmark swapping is disabled Lothar Waßmann
2014-07-28  5:29           ` Brian Norris
2014-07-29  6:31             ` Lothar Waßmann
2014-07-24  2:06         ` Brian Norris [this message]
2014-07-24  6:49           ` [PATCHv4 4/5] of/mtd/nand: add generic binding and helper for NAND_BBT_NO_OOB_BBM Lothar Waßmann
2014-07-24  7:47             ` Brian Norris
2014-06-26 10:44 ` [PATCHv4 0/5] mtd: gpmi: make blockmark swapping optional Lothar Waßmann
2014-07-28  5:31 ` Brian Norris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140724020627.GD3711@ld-irv-0074 \
    --to=computersforpeace@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).