change the way to calculate pagesize to get correct free oob space for
legacy_set_geometry function.
Signed-off-by: Han Xu <[email protected]>
---
drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index 316b5ac..bda77a9 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -319,7 +319,8 @@ static int legacy_set_geometry(struct gpmi_nand_data *this)
return -EINVAL;
}
- geo->page_size = mtd->writesize + mtd->oobsize;
+ geo->page_size = mtd->writesize + geo->metadata_size +
+ (geo->gf_len * geo->ecc_strength * geo->ecc_chunk_count) / 8;
geo->payload_size = mtd->writesize;
/*
--
1.9.1
Hi Han,
On Tue, 12 Apr 2016 17:06:33 -0500
Han Xu <[email protected]> wrote:
> change the way to calculate pagesize to get correct free oob space for
> legacy_set_geometry function.
Are you sure it's safe to expose free OOB bytes in this case? Do you
know why it wasn't done before?
Best Regards,
Boris
>
> Signed-off-by: Han Xu <[email protected]>
> ---
> drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> index 316b5ac..bda77a9 100644
> --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> @@ -319,7 +319,8 @@ static int legacy_set_geometry(struct gpmi_nand_data *this)
> return -EINVAL;
> }
>
> - geo->page_size = mtd->writesize + mtd->oobsize;
> + geo->page_size = mtd->writesize + geo->metadata_size +
> + (geo->gf_len * geo->ecc_strength * geo->ecc_chunk_count) / 8;
> geo->payload_size = mtd->writesize;
>
> /*
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Hi Han,
On Wed, 13 Apr 2016 00:43:51 +0200
Boris Brezillon <[email protected]> wrote:
> Hi Han,
>
> On Tue, 12 Apr 2016 17:06:33 -0500
> Han Xu <[email protected]> wrote:
>
> > change the way to calculate pagesize to get correct free oob space for
> > legacy_set_geometry function.
>
> Are you sure it's safe to expose free OOB bytes in this case? Do you
> know why it wasn't done before?
You did not answer this question. Do you want me to drop this patch. If
that's not the case, can you confirm it does not break platforms that
didn't have those free OOB bytes exposed before this change.
Thanks,
Boris
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
________________________________________
From: Boris Brezillon <[email protected]>
Sent: Friday, April 29, 2016 2:31 AM
To: Han Xu
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] mtd: nand: gpmi: get correct free oob space
Hi Han,
On Wed, 13 Apr 2016 00:43:51 +0200
Boris Brezillon <[email protected]> wrote:
> Hi Han,
>
> On Tue, 12 Apr 2016 17:06:33 -0500
> Han Xu <[email protected]> wrote:
>
> > change the way to calculate pagesize to get correct free oob space for
> > legacy_set_geometry function.
>
> Are you sure it's safe to expose free OOB bytes in this case? Do you
> know why it wasn't done before?
You did not answer this question. Do you want me to drop this patch. If
that's not the case, can you confirm it does not break platforms that
didn't have those free OOB bytes exposed before this change.
I think it's safe to expose the free OOB and also tested on my side, no
issue found.
Thanks,
Boris
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com