All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: linux-mtd@lists.infradead.org, Hauke Mehrtens <hauke@hauke-m.de>,
	Kamal Dasu <kdasu.kdev@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	Grant Likely <grant.likely@linaro.org>,
	devicetree@vger.kernel.org
Subject: Re: [PATCH 3/3] mtd: brcmnand: fix check for Hamming algorithm
Date: Fri, 1 Apr 2016 09:07:56 -0700	[thread overview]
Message-ID: <20160401160756.GD117117@google.com> (raw)
In-Reply-To: <1455300685-27009-3-git-send-email-zajec5@gmail.com>

On Fri, Feb 12, 2016 at 07:11:25PM +0100, Rafał Miłecki wrote:
> So far we were treating ECC strength 1 as Hamming algorithm. It didn't
> supporting some less common devices with BCH-1 (e.g. D-Link DIR-885L).
> 
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> ---
>  drivers/mtd/nand/brcmnand/brcmnand.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/brcmnand/brcmnand.c b/drivers/mtd/nand/brcmnand/brcmnand.c
> index 844fc07..b8055da 100644
> --- a/drivers/mtd/nand/brcmnand/brcmnand.c
> +++ b/drivers/mtd/nand/brcmnand/brcmnand.c
> @@ -1842,7 +1842,7 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)
>  
>  	switch (chip->ecc.size) {
>  	case 512:
> -		if (chip->ecc.strength == 1) /* Hamming */
> +		if (chip->ecc.algo == NAND_ECC_HAMMING)

It's probably best we do a little more than this. Right now, this allows
someone to specify:

	nand-ecc-strength = <20>;
	nand-ecc-stepsize = <512>;
	nand-ecc-algo = "hamming";
	nand-ecc-mode = "hw";

And they'll end up with 1-bit hamming ECC, except nand_base will still
think we have 20-bit correction. I think we need to add a check in this
driver to be sure we haven't selected >1-bit correction with hamming
ECC.

Brian

>  			cfg->ecc_level = 15;
>  		else
>  			cfg->ecc_level = chip->ecc.strength;
> -- 
> 1.8.4.5
> 

WARNING: multiple messages have this Message-ID (diff)
From: Brian Norris <computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: "Rafał Miłecki" <zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Hauke Mehrtens <hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>,
	Kamal Dasu <kdasu.kdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Frank Rowand
	<frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Grant Likely
	<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 3/3] mtd: brcmnand: fix check for Hamming algorithm
Date: Fri, 1 Apr 2016 09:07:56 -0700	[thread overview]
Message-ID: <20160401160756.GD117117@google.com> (raw)
In-Reply-To: <1455300685-27009-3-git-send-email-zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Fri, Feb 12, 2016 at 07:11:25PM +0100, Rafał Miłecki wrote:
> So far we were treating ECC strength 1 as Hamming algorithm. It didn't
> supporting some less common devices with BCH-1 (e.g. D-Link DIR-885L).
> 
> Signed-off-by: Rafał Miłecki <zajec5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  drivers/mtd/nand/brcmnand/brcmnand.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/brcmnand/brcmnand.c b/drivers/mtd/nand/brcmnand/brcmnand.c
> index 844fc07..b8055da 100644
> --- a/drivers/mtd/nand/brcmnand/brcmnand.c
> +++ b/drivers/mtd/nand/brcmnand/brcmnand.c
> @@ -1842,7 +1842,7 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)
>  
>  	switch (chip->ecc.size) {
>  	case 512:
> -		if (chip->ecc.strength == 1) /* Hamming */
> +		if (chip->ecc.algo == NAND_ECC_HAMMING)

It's probably best we do a little more than this. Right now, this allows
someone to specify:

	nand-ecc-strength = <20>;
	nand-ecc-stepsize = <512>;
	nand-ecc-algo = "hamming";
	nand-ecc-mode = "hw";

And they'll end up with 1-bit hamming ECC, except nand_base will still
think we have 20-bit correction. I think we need to add a check in this
driver to be sure we haven't selected >1-bit correction with hamming
ECC.

Brian

>  			cfg->ecc_level = 15;
>  		else
>  			cfg->ecc_level = chip->ecc.strength;
> -- 
> 1.8.4.5
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-04-01 16:08 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-12 18:11 [PATCH 1/3] of: mtd: add helper reading "nand-ecc-algo" from DT Rafał Miłecki
2016-02-12 18:11 ` Rafał Miłecki
2016-02-12 18:11 ` [PATCH 2/3] mtd: nand: read (from DT) and store ECC algorithm Rafał Miłecki
2016-02-12 18:11   ` Rafał Miłecki
2016-02-15 21:31   ` Kamal Dasu
2016-02-15 21:31     ` Kamal Dasu
2016-04-01 16:02   ` Brian Norris
2016-04-01 16:02     ` Brian Norris
2016-04-01 16:07   ` Brian Norris
2016-04-01 16:07     ` Brian Norris
2016-04-01 19:32     ` Rafał Miłecki
2016-04-01 19:32       ` Rafał Miłecki
2016-04-01 20:07       ` Brian Norris
2016-04-01 20:07         ` Brian Norris
2016-04-01 21:23         ` Rafał Miłecki
2016-04-01 21:23           ` Rafał Miłecki
2016-02-12 18:11 ` [PATCH 3/3] mtd: brcmnand: fix check for Hamming algorithm Rafał Miłecki
2016-02-12 18:11   ` Rafał Miłecki
2016-02-15 21:30   ` Kamal Dasu
2016-02-15 21:30     ` Kamal Dasu
2016-04-01 16:07   ` Brian Norris [this message]
2016-04-01 16:07     ` Brian Norris
2016-02-15 21:28 ` [PATCH 1/3] of: mtd: add helper reading "nand-ecc-algo" from DT Kamal Dasu
2016-02-15 21:43 ` Kamal Dasu
2016-02-15 21:43   ` Kamal Dasu
2016-02-22  2:54 ` Rob Herring
2016-02-22  2:54   ` Rob Herring
2016-02-24 13:46 ` Boris Brezillon
2016-02-24 13:46   ` Boris Brezillon
2016-02-25 19:56   ` Rafał Miłecki
2016-02-25 19:56     ` Rafał Miłecki
2016-02-25 20:09     ` Boris Brezillon
2016-02-25 20:09       ` Boris Brezillon
2016-02-26 16:30       ` Rafał Miłecki
2016-02-26 16:30         ` Rafał Miłecki
2016-02-26 16:55         ` Boris Brezillon
2016-02-26 16:55           ` Boris Brezillon
2016-02-26 21:24           ` Rafał Miłecki
2016-02-26 21:24             ` Rafał Miłecki
2016-02-26 21:28             ` Boris Brezillon
2016-02-26 21:28               ` Boris Brezillon
2016-04-01 16:01 ` Brian Norris
2016-04-01 16:01   ` 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=20160401160756.GD117117@google.com \
    --to=computersforpeace@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=grant.likely@linaro.org \
    --cc=hauke@hauke-m.de \
    --cc=kdasu.kdev@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=robh+dt@kernel.org \
    --cc=zajec5@gmail.com \
    /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.