From: Boris BREZILLON <b.brezillon.dev@gmail.com>
To: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>,
linux-mtd@lists.infradead.org
Cc: Grant Likely <grant.likely@secretlab.ca>,
Brian Norris <computersforpeace@gmail.com>
Subject: Re: [PATCH v2 1/2] of_mtd: Add helpers to get ECC strength and ECC step size
Date: Mon, 24 Feb 2014 16:45:33 +0100 [thread overview]
Message-ID: <530B691D.7000909@gmail.com> (raw)
In-Reply-To: <1392749474-12936-2-git-send-email-ezequiel.garcia@free-electrons.com>
On 18/02/2014 19:51, Ezequiel Garcia wrote:
> This commit adds simple helpers to obtain the devicetree properties
> that specify the ECC strength and ECC step size to use on a given
> NAND controller.
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: Boris BREZILLOn <b.brezillon.dev@gmail.com>
> ---
> drivers/of/of_mtd.c | 34 ++++++++++++++++++++++++++++++++++
> include/linux/of_mtd.h | 12 ++++++++++++
> 2 files changed, 46 insertions(+)
>
> diff --git a/drivers/of/of_mtd.c b/drivers/of/of_mtd.c
> index a27ec94..b7361ed 100644
> --- a/drivers/of/of_mtd.c
> +++ b/drivers/of/of_mtd.c
> @@ -50,6 +50,40 @@ int of_get_nand_ecc_mode(struct device_node *np)
> EXPORT_SYMBOL_GPL(of_get_nand_ecc_mode);
>
> /**
> + * of_get_nand_ecc_step_size - Get ECC step size associated to
> + * the required ECC strength (see below).
> + * @np: Pointer to the given device_node
> + *
> + * return the ECC step size, or errno in error case.
> + */
> +int of_get_nand_ecc_step_size(struct device_node *np)
> +{
> + int ret;
> + u32 val;
> +
> + ret = of_property_read_u32(np, "nand-ecc-step-size", &val);
> + return ret ? ret : val;
> +}
> +EXPORT_SYMBOL_GPL(of_get_nand_ecc_step_size);
> +
> +/**
> + * of_get_nand_ecc_strength - Get required ECC strength over the
> + * correspnding step size as defined by 'nand-ecc-size'
> + * @np: Pointer to the given device_node
> + *
> + * return the ECC strength, or errno in error case.
> + */
> +int of_get_nand_ecc_strength(struct device_node *np)
> +{
> + int ret;
> + u32 val;
> +
> + ret = of_property_read_u32(np, "nand-ecc-strength", &val);
> + return ret ? ret : val;
> +}
> +EXPORT_SYMBOL_GPL(of_get_nand_ecc_strength);
> +
> +/**
> * of_get_nand_bus_width - Get nand bus witdh for given device_node
> * @np: Pointer to the given device_node
> *
> diff --git a/include/linux/of_mtd.h b/include/linux/of_mtd.h
> index cb32d9c..c078f99 100644
> --- a/include/linux/of_mtd.h
> +++ b/include/linux/of_mtd.h
> @@ -13,6 +13,8 @@
>
> #include <linux/of.h>
> int of_get_nand_ecc_mode(struct device_node *np);
> +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);
>
> @@ -23,6 +25,16 @@ static inline int of_get_nand_ecc_mode(struct device_node *np)
> return -ENOSYS;
> }
>
> +static inline int of_get_nand_ecc_step_size(struct device_node *np)
> +{
> + return -ENOSYS;
> +}
> +
> +static inline int of_get_nand_ecc_strength(struct device_node *np)
> +{
> + return -ENOSYS;
> +}
> +
> static inline int of_get_nand_bus_width(struct device_node *np)
> {
> return -ENOSYS;
next prev parent reply other threads:[~2014-02-24 15:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-18 18:51 [PATCH v2 0/2] mtd: Add NAND ECC devicetree binding Ezequiel Garcia
2014-02-18 18:51 ` [PATCH v2 1/2] of_mtd: Add helpers to get ECC strength and ECC step size Ezequiel Garcia
2014-02-18 20:01 ` Boris BREZILLON
2014-02-18 20:25 ` Ezequiel Garcia
2014-02-24 15:44 ` Boris BREZILLON
2014-02-24 15:45 ` Boris BREZILLON [this message]
2014-02-24 16:13 ` Boris BREZILLON
2014-02-24 19:08 ` Grant Likely
2014-02-24 20:33 ` Ezequiel Garcia
2014-02-18 18:51 ` [PATCH v2 2/2] mtd: nand: Add a devicetree binding for " Ezequiel Garcia
2014-02-18 20:02 ` Boris BREZILLON
2014-02-23 23:59 ` [PATCH v2 0/2] mtd: Add NAND ECC devicetree binding Ezequiel Garcia
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=530B691D.7000909@gmail.com \
--to=b.brezillon.dev@gmail.com \
--cc=computersforpeace@gmail.com \
--cc=ezequiel.garcia@free-electrons.com \
--cc=grant.likely@secretlab.ca \
--cc=linux-mtd@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 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.