[v3,1/6] mtd: rawnand: add Reed-Solomon error correction algorithm

Message ID 20180531221637.6017-2-stefan@agner.ch
State Superseded
Headers show
Series
  • mtd: rawnand: add NVIDIA Tegra NAND flash support
Related show

Commit Message

Stefan Agner May 31, 2018, 10:16 p.m.
Add Reed-Solomon (RS) to the enumeration of ECC algorithms.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 drivers/mtd/nand/raw/nand_base.c | 1 +
 include/linux/mtd/rawnand.h      | 1 +
 2 files changed, 2 insertions(+)

Comments

Boris Brezillon June 1, 2018, 7:26 a.m. | #1
On Fri,  1 Jun 2018 00:16:32 +0200
Stefan Agner <stefan@agner.ch> wrote:

> Add Reed-Solomon (RS) to the enumeration of ECC algorithms.
> 
> Signed-off-by: Stefan Agner <stefan@agner.ch>

Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>

> ---
>  drivers/mtd/nand/raw/nand_base.c | 1 +
>  include/linux/mtd/rawnand.h      | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> index f28c3a555861..9eb5678dd6d0 100644
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -5744,6 +5744,7 @@ static int of_get_nand_ecc_mode(struct device_node *np)
>  static const char * const nand_ecc_algos[] = {
>  	[NAND_ECC_HAMMING]	= "hamming",
>  	[NAND_ECC_BCH]		= "bch",
> +	[NAND_ECC_RS]		= "rs",
>  };
>  
>  static int of_get_nand_ecc_algo(struct device_node *np)
> diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
> index 5dad59b31244..6a82da8c44ce 100644
> --- a/include/linux/mtd/rawnand.h
> +++ b/include/linux/mtd/rawnand.h
> @@ -114,6 +114,7 @@ enum nand_ecc_algo {
>  	NAND_ECC_UNKNOWN,
>  	NAND_ECC_HAMMING,
>  	NAND_ECC_BCH,
> +	NAND_ECC_RS,
>  };
>  
>  /*

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Boris Brezillon June 1, 2018, 9:25 a.m. | #2
On Fri, 1 Jun 2018 09:26:00 +0200
Boris Brezillon <boris.brezillon@bootlin.com> wrote:

> On Fri,  1 Jun 2018 00:16:32 +0200
> Stefan Agner <stefan@agner.ch> wrote:
> 
> > Add Reed-Solomon (RS) to the enumeration of ECC algorithms.
> > 
> > Signed-off-by: Stefan Agner <stefan@agner.ch>  
> 
> Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
> 
> > ---
> >  drivers/mtd/nand/raw/nand_base.c | 1 +
> >  include/linux/mtd/rawnand.h      | 1 +

Hm, you forgot to update Documentation/devicetree/bindings/mtd/nand.txt.

> >  2 files changed, 2 insertions(+)
> > 
> > diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> > index f28c3a555861..9eb5678dd6d0 100644
> > --- a/drivers/mtd/nand/raw/nand_base.c
> > +++ b/drivers/mtd/nand/raw/nand_base.c
> > @@ -5744,6 +5744,7 @@ static int of_get_nand_ecc_mode(struct device_node *np)
> >  static const char * const nand_ecc_algos[] = {
> >  	[NAND_ECC_HAMMING]	= "hamming",
> >  	[NAND_ECC_BCH]		= "bch",
> > +	[NAND_ECC_RS]		= "rs",
> >  };
> >  
> >  static int of_get_nand_ecc_algo(struct device_node *np)
> > diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
> > index 5dad59b31244..6a82da8c44ce 100644
> > --- a/include/linux/mtd/rawnand.h
> > +++ b/include/linux/mtd/rawnand.h
> > @@ -114,6 +114,7 @@ enum nand_ecc_algo {
> >  	NAND_ECC_UNKNOWN,
> >  	NAND_ECC_HAMMING,
> >  	NAND_ECC_BCH,
> > +	NAND_ECC_RS,
> >  };
> >  
> >  /*  
> 
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stefan Agner June 1, 2018, 1:34 p.m. | #3
On 01.06.2018 11:25, Boris Brezillon wrote:
> On Fri, 1 Jun 2018 09:26:00 +0200
> Boris Brezillon <boris.brezillon@bootlin.com> wrote:
> 
>> On Fri,  1 Jun 2018 00:16:32 +0200
>> Stefan Agner <stefan@agner.ch> wrote:
>>
>> > Add Reed-Solomon (RS) to the enumeration of ECC algorithms.
>> >
>> > Signed-off-by: Stefan Agner <stefan@agner.ch>
>>
>> Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
>>
>> > ---
>> >  drivers/mtd/nand/raw/nand_base.c | 1 +
>> >  include/linux/mtd/rawnand.h      | 1 +
> 
> Hm, you forgot to update Documentation/devicetree/bindings/mtd/nand.txt.
> 

Yeah I was not sure about that. Currently it says:

- nand-ecc-algo: string, algorithm of NAND ECC.                         
                                                                   
                 Supported values are: "hamming", "bch".

Is supported meant by software ECC here? I feel "supported" is a rather
strong word since it is clearly controller dependent whether it is
actually supported...

--
Stefan

>> >  2 files changed, 2 insertions(+)
>> >
>> > diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
>> > index f28c3a555861..9eb5678dd6d0 100644
>> > --- a/drivers/mtd/nand/raw/nand_base.c
>> > +++ b/drivers/mtd/nand/raw/nand_base.c
>> > @@ -5744,6 +5744,7 @@ static int of_get_nand_ecc_mode(struct device_node *np)
>> >  static const char * const nand_ecc_algos[] = {
>> >  	[NAND_ECC_HAMMING]	= "hamming",
>> >  	[NAND_ECC_BCH]		= "bch",
>> > +	[NAND_ECC_RS]		= "rs",
>> >  };
>> >
>> >  static int of_get_nand_ecc_algo(struct device_node *np)
>> > diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
>> > index 5dad59b31244..6a82da8c44ce 100644
>> > --- a/include/linux/mtd/rawnand.h
>> > +++ b/include/linux/mtd/rawnand.h
>> > @@ -114,6 +114,7 @@ enum nand_ecc_algo {
>> >  	NAND_ECC_UNKNOWN,
>> >  	NAND_ECC_HAMMING,
>> >  	NAND_ECC_BCH,
>> > +	NAND_ECC_RS,
>> >  };
>> >
>> >  /*
>>
>>
>> ______________________________________________________
>> Linux MTD discussion mailing list
>> http://lists.infradead.org/mailman/listinfo/linux-mtd/
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Boris Brezillon June 1, 2018, 1:43 p.m. | #4
On Fri, 01 Jun 2018 15:34:33 +0200
Stefan Agner <stefan@agner.ch> wrote:

> On 01.06.2018 11:25, Boris Brezillon wrote:
> > On Fri, 1 Jun 2018 09:26:00 +0200
> > Boris Brezillon <boris.brezillon@bootlin.com> wrote:
> >   
> >> On Fri,  1 Jun 2018 00:16:32 +0200
> >> Stefan Agner <stefan@agner.ch> wrote:
> >>  
> >> > Add Reed-Solomon (RS) to the enumeration of ECC algorithms.
> >> >
> >> > Signed-off-by: Stefan Agner <stefan@agner.ch>  
> >>
> >> Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
> >>  
> >> > ---
> >> >  drivers/mtd/nand/raw/nand_base.c | 1 +
> >> >  include/linux/mtd/rawnand.h      | 1 +  
> > 
> > Hm, you forgot to update Documentation/devicetree/bindings/mtd/nand.txt.
> >   
> 
> Yeah I was not sure about that. Currently it says:
> 
> - nand-ecc-algo: string, algorithm of NAND ECC.                         
>                                                                    
>                  Supported values are: "hamming", "bch".
> 
> Is supported meant by software ECC here? I feel "supported" is a rather
> strong word since it is clearly controller dependent whether it is
> actually supported...

I guess "valid values" or "accepted values" would be more appropriate
here.
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index f28c3a555861..9eb5678dd6d0 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -5744,6 +5744,7 @@  static int of_get_nand_ecc_mode(struct device_node *np)
 static const char * const nand_ecc_algos[] = {
 	[NAND_ECC_HAMMING]	= "hamming",
 	[NAND_ECC_BCH]		= "bch",
+	[NAND_ECC_RS]		= "rs",
 };
 
 static int of_get_nand_ecc_algo(struct device_node *np)
diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
index 5dad59b31244..6a82da8c44ce 100644
--- a/include/linux/mtd/rawnand.h
+++ b/include/linux/mtd/rawnand.h
@@ -114,6 +114,7 @@  enum nand_ecc_algo {
 	NAND_ECC_UNKNOWN,
 	NAND_ECC_HAMMING,
 	NAND_ECC_BCH,
+	NAND_ECC_RS,
 };
 
 /*