All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mtd: Add NAND ECC devicetree binding
@ 2014-02-18 18:51 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
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Ezequiel Garcia @ 2014-02-18 18:51 UTC (permalink / raw)
  To: linux-mtd; +Cc: Grant Likely, Brian Norris, Boris BREZILLON, Ezequiel Garcia

Finally we collect an ack from a devicetree authority (thanks Grant) so
this is the second round to add a suitable ECC devicetree binding.

NAND controllers have special ECC modes, raising per-driver ECC mode devicetree
binding. See for instance the binding for OMAP:

 - ti,nand-ecc-opt: A string setting the ECC layout to use. One of:
	"sw"		<deprecated> use "ham1" instead
	"hw"		<deprecated> use "ham1" instead
	"hw-romcode"	<deprecated> use "ham1" instead
	"ham1"		1-bit Hamming ecc code
	"bch4"		4-bit BCH ecc code
	"bch8"		8-bit BCH ecc code

Other drivers (such as pxa3xx-nand) have similar requirements, with special
(controller-specific) ECC modes. Instead of adding a possibly different
binding per compatible-string, let's add generic ECC strength and ECC step size.

This properties aim at providing a complete description of the required ECC
correction to let drivers choose the appropriate ECC mode.

Ezequiel Garcia (2):
  of_mtd: Add helpers to get ECC strength and ECC step size
  mtd: nand: Add a devicetree binding for ECC strength and ECC step size

 Documentation/devicetree/bindings/mtd/nand.txt | 14 +++++++++++
 drivers/of/of_mtd.c                            | 34 ++++++++++++++++++++++++++
 include/linux/of_mtd.h                         | 12 +++++++++
 3 files changed, 60 insertions(+)

-- 
1.8.1.5

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

* [PATCH v2 1/2] of_mtd: Add helpers to get ECC strength and ECC step size
  2014-02-18 18:51 [PATCH v2 0/2] mtd: Add NAND ECC devicetree binding Ezequiel Garcia
@ 2014-02-18 18:51 ` Ezequiel Garcia
  2014-02-18 20:01   ` Boris BREZILLON
                     ` (2 more replies)
  2014-02-18 18:51 ` [PATCH v2 2/2] mtd: nand: Add a devicetree binding for " Ezequiel Garcia
  2014-02-23 23:59 ` [PATCH v2 0/2] mtd: Add NAND ECC devicetree binding Ezequiel Garcia
  2 siblings, 3 replies; 12+ messages in thread
From: Ezequiel Garcia @ 2014-02-18 18:51 UTC (permalink / raw)
  To: linux-mtd; +Cc: Grant Likely, Brian Norris, Boris BREZILLON, Ezequiel Garcia

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>
---
 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;
-- 
1.8.1.5

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

* [PATCH v2 2/2] mtd: nand: Add a devicetree binding for ECC strength and ECC step size
  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 18:51 ` 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
  2 siblings, 1 reply; 12+ messages in thread
From: Ezequiel Garcia @ 2014-02-18 18:51 UTC (permalink / raw)
  To: linux-mtd; +Cc: Grant Likely, Brian Norris, Boris BREZILLON, Ezequiel Garcia

Some flashes can only be properly accessed when the ECC mode is
specified, so a way to describe such mode is required.

Together, the ECC strength and step size define the correction capability,
so that we say we will correct "{strength} bit errors per {size} bytes".

The interpretation of these parameters is implementation-defined, but they
often have ramifications on the formation, interpretation, and placement of
correction metadata on the flash. Not all implementations must support all
possible combinations. Implementations are encouraged to further define the
value(s) they support.

Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
Brian,

Feel free to rephrase or improve the explanation below as you whish.

 Documentation/devicetree/bindings/mtd/nand.txt | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/Documentation/devicetree/bindings/mtd/nand.txt b/Documentation/devicetree/bindings/mtd/nand.txt
index 03855c8..b53f92e 100644
--- a/Documentation/devicetree/bindings/mtd/nand.txt
+++ b/Documentation/devicetree/bindings/mtd/nand.txt
@@ -5,3 +5,17 @@
   "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-ecc-strength: integer representing the number of bits to correct
+		     per ECC step.
+
+- nand-ecc-step-size: integer representing the number of data bytes
+		      that are covered by a single ECC step.
+
+The ECC strength and ECC step size properties define the correction capability
+of a controller. Together, they say a controller can correct "{strength} bit
+errors per {size} bytes".
+
+The interpretation of these parameters is implementation-defined, so not all
+implementations must support all possible combinations. However, implementations
+are encouraged to further specify the value(s) they support.
-- 
1.8.1.5

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

* Re: [PATCH v2 1/2] of_mtd: Add helpers to get ECC strength and ECC step size
  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:45   ` Boris BREZILLON
  2014-02-24 16:13   ` Boris BREZILLON
  2 siblings, 1 reply; 12+ messages in thread
From: Boris BREZILLON @ 2014-02-18 20:01 UTC (permalink / raw)
  To: Ezequiel Garcia, linux-mtd; +Cc: Grant Likely, Brian Norris

Hi Ezequiel,

Le 18/02/2014 19:51, Ezequiel Garcia a écrit :
> 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.

As already discussed with you, IMHO these 2 properties should both
be available to be meaningful, hence, we should provide an helper
function that gets both properties or return an error if one of them
is missing.

Do you plan to provide a default value (within controller drivers) if one
of these properties is missing ? In this case seperating the helper
functions make sense.

Best Regards,

Boris

> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.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;

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

* Re: [PATCH v2 2/2] mtd: nand: Add a devicetree binding for ECC strength and ECC step size
  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
  0 siblings, 0 replies; 12+ messages in thread
From: Boris BREZILLON @ 2014-02-18 20:02 UTC (permalink / raw)
  To: Ezequiel Garcia, linux-mtd; +Cc: Grant Likely, Brian Norris

Le 18/02/2014 19:51, Ezequiel Garcia a écrit :
> Some flashes can only be properly accessed when the ECC mode is
> specified, so a way to describe such mode is required.
>
> Together, the ECC strength and step size define the correction capability,
> so that we say we will correct "{strength} bit errors per {size} bytes".
>
> The interpretation of these parameters is implementation-defined, but they
> often have ramifications on the formation, interpretation, and placement of
> correction metadata on the flash. Not all implementations must support all
> possible combinations. Implementations are encouraged to further define the
> value(s) they support.
>
> Acked-by: Grant Likely <grant.likely@secretlab.ca>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: Boris BREZILLON <b.brezillon.dev@gmail.com>
> ---
> Brian,
>
> Feel free to rephrase or improve the explanation below as you whish.
>
>   Documentation/devicetree/bindings/mtd/nand.txt | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mtd/nand.txt b/Documentation/devicetree/bindings/mtd/nand.txt
> index 03855c8..b53f92e 100644
> --- a/Documentation/devicetree/bindings/mtd/nand.txt
> +++ b/Documentation/devicetree/bindings/mtd/nand.txt
> @@ -5,3 +5,17 @@
>     "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-ecc-strength: integer representing the number of bits to correct
> +		     per ECC step.
> +
> +- nand-ecc-step-size: integer representing the number of data bytes
> +		      that are covered by a single ECC step.
> +
> +The ECC strength and ECC step size properties define the correction capability
> +of a controller. Together, they say a controller can correct "{strength} bit
> +errors per {size} bytes".
> +
> +The interpretation of these parameters is implementation-defined, so not all
> +implementations must support all possible combinations. However, implementations
> +are encouraged to further specify the value(s) they support.

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

* Re: [PATCH v2 1/2] of_mtd: Add helpers to get ECC strength and ECC step size
  2014-02-18 20:01   ` Boris BREZILLON
@ 2014-02-18 20:25     ` Ezequiel Garcia
  2014-02-24 15:44       ` Boris BREZILLON
  0 siblings, 1 reply; 12+ messages in thread
From: Ezequiel Garcia @ 2014-02-18 20:25 UTC (permalink / raw)
  To: Boris BREZILLON; +Cc: Grant Likely, Brian Norris, linux-mtd

On Tue, Feb 18, 2014 at 09:01:11PM +0100, Boris BREZILLON wrote:
> Le 18/02/2014 19:51, Ezequiel Garcia a écrit :
> > 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.
> 
> As already discussed with you, IMHO these 2 properties should both
> be available to be meaningful, hence, we should provide an helper
> function that gets both properties or return an error if one of them
> is missing.
> 

I think this way is both cleaner and simpler. I don't see the advantage
of having a single function.

> Do you plan to provide a default value (within controller drivers) if one
> of these properties is missing ? In this case seperating the helper
> functions make sense.
> 

Being a general framework, we can't know what drivers will want to do,
which is why I usually like helper function to say as simple as
policy-free as possible.
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

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

* Re: [PATCH v2 0/2] mtd: Add NAND ECC devicetree binding
  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 18:51 ` [PATCH v2 2/2] mtd: nand: Add a devicetree binding for " Ezequiel Garcia
@ 2014-02-23 23:59 ` Ezequiel Garcia
  2 siblings, 0 replies; 12+ messages in thread
From: Ezequiel Garcia @ 2014-02-23 23:59 UTC (permalink / raw)
  To: linux-mtd; +Cc: Grant Likely, Brian Norris, Boris BREZILLON

On Tue, Feb 18, 2014 at 03:51:12PM -0300, Ezequiel Garcia wrote:
> Finally we collect an ack from a devicetree authority (thanks Grant) so
> this is the second round to add a suitable ECC devicetree binding.
> 
> NAND controllers have special ECC modes, raising per-driver ECC mode devicetree
> binding. See for instance the binding for OMAP:
> 
>  - ti,nand-ecc-opt: A string setting the ECC layout to use. One of:
> 	"sw"		<deprecated> use "ham1" instead
> 	"hw"		<deprecated> use "ham1" instead
> 	"hw-romcode"	<deprecated> use "ham1" instead
> 	"ham1"		1-bit Hamming ecc code
> 	"bch4"		4-bit BCH ecc code
> 	"bch8"		8-bit BCH ecc code
> 
> Other drivers (such as pxa3xx-nand) have similar requirements, with special
> (controller-specific) ECC modes. Instead of adding a possibly different
> binding per compatible-string, let's add generic ECC strength and ECC step size.
> 
> This properties aim at providing a complete description of the required ECC
> correction to let drivers choose the appropriate ECC mode.
> 
> Ezequiel Garcia (2):
>   of_mtd: Add helpers to get ECC strength and ECC step size
>   mtd: nand: Add a devicetree binding for ECC strength and ECC step size
> 
>  Documentation/devicetree/bindings/mtd/nand.txt | 14 +++++++++++
>  drivers/of/of_mtd.c                            | 34 ++++++++++++++++++++++++++
>  include/linux/of_mtd.h                         | 12 +++++++++
>  3 files changed, 60 insertions(+)
> 

Any comments about this?

-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

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

* Re: [PATCH v2 1/2] of_mtd: Add helpers to get ECC strength and ECC step size
  2014-02-18 20:25     ` Ezequiel Garcia
@ 2014-02-24 15:44       ` Boris BREZILLON
  0 siblings, 0 replies; 12+ messages in thread
From: Boris BREZILLON @ 2014-02-24 15:44 UTC (permalink / raw)
  To: Ezequiel Garcia; +Cc: Grant Likely, Brian Norris, linux-mtd

On 18/02/2014 21:25, Ezequiel Garcia wrote:
> On Tue, Feb 18, 2014 at 09:01:11PM +0100, Boris BREZILLON wrote:
>> Le 18/02/2014 19:51, Ezequiel Garcia a écrit :
>>> 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.
>> As already discussed with you, IMHO these 2 properties should both
>> be available to be meaningful, hence, we should provide an helper
>> function that gets both properties or return an error if one of them
>> is missing.
>>
> I think this way is both cleaner and simpler. I don't see the advantage
> of having a single function.

Okay, I'll ack this version and do the check in my driver then.

Thanks.

Best Regards,

Boris
>
>> Do you plan to provide a default value (within controller drivers) if one
>> of these properties is missing ? In this case seperating the helper
>> functions make sense.
>>
> Being a general framework, we can't know what drivers will want to do,
> which is why I usually like helper function to say as simple as
> policy-free as possible.

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

* Re: [PATCH v2 1/2] of_mtd: Add helpers to get ECC strength and ECC step size
  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-24 15:45   ` Boris BREZILLON
  2014-02-24 16:13   ` Boris BREZILLON
  2 siblings, 0 replies; 12+ messages in thread
From: Boris BREZILLON @ 2014-02-24 15:45 UTC (permalink / raw)
  To: Ezequiel Garcia, linux-mtd; +Cc: Grant Likely, Brian Norris

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;

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

* Re: [PATCH v2 1/2] of_mtd: Add helpers to get ECC strength and ECC step size
  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-24 15:45   ` Boris BREZILLON
@ 2014-02-24 16:13   ` Boris BREZILLON
  2014-02-24 19:08     ` Grant Likely
  2 siblings, 1 reply; 12+ messages in thread
From: Boris BREZILLON @ 2014-02-24 16:13 UTC (permalink / raw)
  To: Ezequiel Garcia, linux-mtd; +Cc: Grant Likely, Brian Norris

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

You forgot the semicolon.


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

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

* Re: [PATCH v2 1/2] of_mtd: Add helpers to get ECC strength and ECC step size
  2014-02-24 16:13   ` Boris BREZILLON
@ 2014-02-24 19:08     ` Grant Likely
  2014-02-24 20:33       ` Ezequiel Garcia
  0 siblings, 1 reply; 12+ messages in thread
From: Grant Likely @ 2014-02-24 19:08 UTC (permalink / raw)
  To: Boris BREZILLON; +Cc: Brian Norris, linux-mtd, Ezequiel Garcia

On Mon, Feb 24, 2014 at 4:13 PM, Boris BREZILLON
<b.brezillon.dev@gmail.com> wrote:
> 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>
>> ---
>> 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)
>
>
> You forgot the semicolon.

Repeat after me: "I shall not post patches that I have not compiled"

g.

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

* Re: [PATCH v2 1/2] of_mtd: Add helpers to get ECC strength and ECC step size
  2014-02-24 19:08     ` Grant Likely
@ 2014-02-24 20:33       ` Ezequiel Garcia
  0 siblings, 0 replies; 12+ messages in thread
From: Ezequiel Garcia @ 2014-02-24 20:33 UTC (permalink / raw)
  To: Grant Likely; +Cc: linux-mtd, Brian Norris, Boris BREZILLON

On Mon, Feb 24, 2014 at 07:08:15PM +0000, Grant Likely wrote:
> On Mon, Feb 24, 2014 at 4:13 PM, Boris BREZILLON
> <b.brezillon.dev@gmail.com> wrote:
> > 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>
> >> ---
> >> 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)
> >
> >
> > You forgot the semicolon.
> 
> Repeat after me: "I shall not post patches that I have not compiled"
> 

Certainly: "I shall not post patches that I have not compiled".

Hope this helps me learn the lesson.
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

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

end of thread, other threads:[~2014-02-24 20:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.